From 8d0f419acf07f7bbc37a67fd52314e3ece63c58d Mon Sep 17 00:00:00 2001 From: InverseBot Date: Thu, 11 Jan 2018 01:31:21 -0500 Subject: [PATCH] (js/css) Update generated files --- UI/WebServerResources/js/Mailer.services.js | 2 +- .../js/Mailer.services.js.map | 2 +- .../js/Scheduler.services.js | 2 +- .../js/Scheduler.services.js.map | 2 +- .../js/vendor/angular-ui-router.js | 1392 ++++++++--------- .../js/vendor/angular-ui-router.js.map | 160 +- .../js/vendor/angular-ui-router.min.js | 4 +- .../js/vendor/angular-ui-router.min.js.map | 277 ++-- 8 files changed, 898 insertions(+), 943 deletions(-) diff --git a/UI/WebServerResources/js/Mailer.services.js b/UI/WebServerResources/js/Mailer.services.js index a2accbe58..045fa1ebe 100644 --- a/UI/WebServerResources/js/Mailer.services.js +++ b/UI/WebServerResources/js/Mailer.services.js @@ -1,2 +1,2 @@ -!function(){"use strict";function e(t){"function"!=typeof t.then&&(angular.extend(this,t),_.forEach(this.identities,function(e){e.fullName?e.full=e.fullName+" <"+e.email+">":e.full="<"+e.email+">"}),e.$log.debug("Account: "+JSON.stringify(t,void 0,2)))}e.$factory=["$q","$timeout","$log","sgSettings","Resource","Preferences","Mailbox","Message",function(t,n,s,o,i,a,r,l){return angular.extend(e,{$q:t,$timeout:n,$log:s,$$resource:new i(o.activeUser("folderURL")+"Mail",o.activeUser()),$Preferences:a,$Mailbox:r,$Message:l}),e}];try{angular.module("SOGo.MailerUI")}catch(e){angular.module("SOGo.MailerUI",["SOGo.Common"])}angular.module("SOGo.MailerUI").factory("Account",e.$factory),e.$findAll=function(t){return t?e.$unwrapCollection(t):e.$$resource.fetch("","mailAccounts").then(function(t){return e.$unwrapCollection(t)})},e.$unwrapCollection=function(t){var n=[];return angular.forEach(t,function(t,s){t.id=s,n[s]=new e(t)}),e.$accounts=n,n},e.prototype.getLength=function(){return this.$flattenMailboxes().length},e.prototype.getItemAtIndex=function(e){var t;return t=this.$flattenMailboxes(),e>=0&&e=0,e.children&&e.children.length>0&&o(e.children)})};if(e.$Preferences.settings.Mail.ExpandedFolders){if(angular.isString(e.$Preferences.settings.Mail.ExpandedFolders))try{s=angular.fromJson(e.$Preferences.settings.Mail.ExpandedFolders)}catch(t){e.$log.warn("Can't parse list of expanded folders. String was: "+e.$Preferences.settings.Mail.ExpandedFolders),s=[]}else s=e.$Preferences.settings.Mail.ExpandedFolders;n.$expanded=s.indexOf("/"+n.id)>=0,s.length>0&&o(n.$mailboxes)}return e.$accounts&&(n.$expanded|=1==e.$accounts.length),n.$flattenMailboxes({reload:!0}),n.$mailboxes}):e.$q.when(this.$mailboxes)},e.prototype.$flattenMailboxes=function(t){var n=[],s=[],o=function(e){_.forEach(e,function(e){n.push(e),(t&&t.all||e.$expanded)&&e.children&&e.children.length>0&&o(e.children)})};return!this.$$flattenMailboxes||t&&(t.reload||t.all)?(o(this.$mailboxes),t&&t.all||(this.$$flattenMailboxes=n,t&&t.saveState&&(_.forEach(e.$accounts,function(e){e.$expanded&&s.push("/"+e.id),_.reduce(e.$$flattenMailboxes,function(e,t){return t.$expanded&&e.push("/"+t.id),e},s)}),e.$$resource.post(null,"saveFoldersState",s)))):n=this.$$flattenMailboxes,n},e.prototype.$getMailboxByType=function(e){var t=function(n){var s=_.find(n,function(t){return t.type==e});return s||angular.forEach(n,function(e){!s&&e.children&&e.children.length>0&&(s=t(e.children))}),s};return t(this.$mailboxes)},e.prototype.$getMailboxByPath=function(e){var t=function(n){var s=_.find(n,function(t){return t.path==e});return s||angular.forEach(n,function(e){!s&&e.children&&e.children.length>0&&(s=t(e.children))}),s};return t(this.$mailboxes)},e.prototype.$newMailbox=function(t,n){var s=this;return e.$$resource.post(t.toString(),"createFolder",{name:n}).then(function(){s.$getMailboxes({reload:!0})})},e.prototype.$removeCertificate=function(){return e.$$resource.fetch(this.id.toString(),"removeCertificate")},e.prototype.updateQuota=function(e){var t,n;t=Math.round(1e4*e.usedSpace/e.maxQuota)/100,n=l("quotasFormat").formatted(t,Math.round(e.maxQuota/10.24)/100),this.$quota={percent:t,description:n}},e.prototype.$newMessage=function(t){var n=this;return e.$$resource.fetch(this.id.toString(),"compose").then(function(t){e.$log.debug("New message (compose): "+JSON.stringify(t,void 0,2));return new e.$Message(t.accountId,n.$getMailboxByPath(t.mailboxPath),t)}).then(function(n){return e.$$resource.fetch(n.$absolutePath({asDraft:!0}),"edit").then(function(s){return e.$log.debug("New message (edit): "+JSON.stringify(s,void 0,2)),angular.extend(n.editable,s),n.isNew=!0,t&&t.mailto&&(angular.isObject(t.mailto)?angular.extend(n.editable,t.mailto):n.$parseMailto(t.mailto)),n})})},e.prototype.$addDelegate=function(t){var n=this,s=e.$q.defer(),o={uid:t.uid};return!t.uid||_.indexOf(_.map(this.delegates,"uid"),t.uid)>-1?s.resolve():e.$$resource.fetch(this.id.toString(),"addDelegate",o).then(function(){n.delegates.push(t),s.resolve(n.users)},function(e,t){s.reject(l("An error occured please try again."))}),s.promise},e.prototype.$removeDelegate=function(t){var n=this,s={uid:t};return e.$$resource.fetch(this.id.toString(),"removeDelegate",s).then(function(){var e=_.indexOf(_.map(n.delegates,"uid"),t);e>=0&&n.delegates.splice(e,1)})}}(),function(){"use strict";function e(t,n){if(this.$account=t,"function"!=typeof n.then){if(this.init(n),this.name&&!this.path){var s=e.$$resource.create("createFolder",this.name);this.$unwrap(s)}}else this.$unwrap(n)}e.$factory=["$q","$timeout","$log","sgSettings","Resource","Message","Acl","Preferences","sgMailbox_PRELOAD",function(t,n,s,o,i,a,r,l,c){return angular.extend(e,{$q:t,$timeout:n,$log:s,$$resource:new i(o.activeUser("folderURL")+"Mail",o.activeUser()),$Message:a,$$Acl:r,$Preferences:l,$query:{sort:"arrival",asc:0},selectedFolder:null,$refreshTimeout:null,$virtualMode:!1,$virtualPath:!1,PRELOAD:c}),l.settings.Mail.SortingState&&(e.$query.sort=l.settings.Mail.SortingState[0],e.$query.asc=parseInt(l.settings.Mail.SortingState[1])),e}];try{angular.module("SOGo.MailerUI")}catch(e){angular.module("SOGo.MailerUI",["SOGo.Common"])}angular.module("SOGo.MailerUI").constant("sgMailbox_PRELOAD",{LOOKAHEAD:50,SIZE:100}).factory("Mailbox",e.$factory),e.$find=function(t,n){var s;return s=n&&n.all?this.$$resource.fetch(t.id.toString(),"viewAll"):this.$$resource.fetch(t.id.toString(),"view"),e.$unwrapCollection(t,s)},e.$unwrapCollection=function(t,n){var s=[],o=function(n,s){for(var i=0;i=0&&e=0},e.prototype.isNoSelect=function(){return this.flags.indexOf("noselect")>=0},e.prototype.getClassName=function(e){return!1},e.prototype.$rename=function(){var t,n,s,o,i=this;return this.name==this.$shadowData.name?e.$q.when():(n=(t=function(e,n){var s=null;return _.find(n,function(e){return e.path==i.path})?s=e:angular.forEach(n,function(e){!s&&e.children&&e.children.length>0&&(s=t(e,e.children))}),s})(null,this.$account.$mailboxes),s=null===n?this.$account.$mailboxes:n.children,o=_.indexOf(_.map(s,"id"),this.id),this.$save().then(function(t){var n,a=i.path;i.init(t),s.splice(o,1),n=_.find(s,function(t){return e.$log.debug(t.name+" ? "+i.name),"folder"==t.type&&t.name.localeCompare(i.name)>0}),o=n?_.indexOf(_.map(s,"id"),n.id):s.length,s.splice(o,0,i);var r=new RegExp("^"+a),l=function(e){_.forEach(e.children,function(e){e.path=e.path.replace(r,i.path),e.id=e.$id(),l(e)})};l(i)}))},e.prototype.$compact=function(){var t=this;return e.$$resource.post(this.id,"expunge").then(function(e){e.quotas&&t.$account.updateQuota(e.quotas)})},e.prototype.$canFolderAs=function(){return"folder"==this.type&&0===this.level},e.prototype.$setFolderAs=function(t){return e.$$resource.post(this.id,"setAs"+t+"Folder")},e.prototype.$emptyTrash=function(){var t=this;return e.$$resource.post(this.id,"emptyTrash").then(function(e){t.$messages=[],t.uidsMap={},t.unseenCount=0,angular.isDefined(t.children)&&t.children.length&&t.$account.$getMailboxes({reload:!0}),e.quotas&&t.$account.updateQuota(e.quotas)})},e.prototype.$markAsRead=function(){var t=this;return e.$$resource.post(this.id,"markRead").then(function(){t.unseenCount=0,_.forEach(t.$messages,function(e){e.isread=!0})})},e.prototype.$flagMessages=function(t,n,s){var o={msgUIDs:_.map(t,"uid"),flags:n,operation:s};return e.$$resource.post(this.id,"addOrRemoveLabel",o).then(function(){return t})},e.prototype.saveSelectedMessages=function(){var t,n;return t=_.filter(this.$messages,function(e){return e.selected}),{uids:n=_.map(t,"uid")},{filename:l("Saved Messages.zip")},e.$$resource.download(this.id,"saveMessages",{uids:n})},e.prototype.exportFolder=function(){var t;return t={filename:this.name+".zip"},e.$$resource.download(this.id,"exportFolder",null,t)},e.prototype.$delete=function(t){var n=this;return e.$$resource.post(this.id,"delete",t).then(function(){return n.$account.$getMailboxes({reload:!0}),!0})},e.prototype.$_deleteMessages=function(e,t){var n,s=this,o=this.$messages.length;return n=_.filter(t,function(e,t){return!e.isread}),this.unseenCount-=n.length,_.forEachRight(this.$messages,function(t,n){var i=_.findIndex(e,function(e){return t.uid==e});i>-1?(e.splice(i,1),delete s.uidsMap[t.uid],t.uid==s.selectedMessage&&delete s.selectedMessage,s.$messages.splice(n,1),nt.uids.length-1)&&(n.$topIndex=0),n.init(t),n.uids&&(e.$log.debug("unwrapping "+n.uids.length+" messages"),a=_.invokeMap(n.headers[0],"toLowerCase"),n.headers.splice(0,1),n.threaded&&(i=n.uids[0],n.uids.splice(0,1)),_.reduce(n.uids,function(t,s,a){var r,l;return r=n.threaded?_.zipObject(i,s):{uid:s.toString()},n.uidsMap[r.uid]=a,(l=new e.$Message(n.$account.id,n,r,!0)).selected=o.indexOf(l.uid)>-1,t.push(l),t},n.$messages),_.forEach(n.headers,function(e){var t=_.zipObject(a,e),s=n.uidsMap[t.uid.toString()];_.extend(n.$messages[s],t)})),e.$log.debug("mailbox "+n.id+" ready"),n.$isLoading=!1,s.resolve(n.$messages)})},function(e){angular.extend(n,e),n.isError=!0,n.$isLoading=!1,s.reject()}),s.promise},e.prototype.$unwrapHeaders=function(t){var n=this;t.then(function(t){e.$timeout(function(){var e,s;t.length>0&&(e=_.invokeMap(t[0],"toLowerCase"),t.splice(0,1),_.forEach(t,function(t){t=_.zipObject(e,t),s=n.uidsMap[t.uid.toString()],angular.isDefined(s)&&_.extend(n.$messages[s],t)}))})})},e.prototype.$updateSubscribe=function(){var t=this.subscribed?"subscribe":"unsubscribe";e.$$resource.post(this.id,t)}}(),function(){"use strict";function e(e,t,n,s){this.accountId=e,this.$mailbox=t,this.$hasUnsafeContent=!1,this.$loadUnsafeContent=!1,this.editable={to:[],cc:[],bcc:[]},this.selected=!1,"function"!=typeof n.then?(!angular.isUndefined(s)&&s||(angular.extend(this,n),this.$formatFullAddresses()),this.uid=parseInt(n.uid)):this.$unwrap(n)}e.$factory=["$q","$timeout","$log","sgSettings","sgMessage_STATUS","Resource","Preferences",function(t,n,s,o,i,a,r){return angular.extend(e,{STATUS:i,$q:t,$timeout:n,$log:s,$$resource:new a(o.activeUser("folderURL")+"Mail",o.activeUser()),$avatar:angular.bind(r,r.avatar)}),r.defaults.SOGoMailLabelsColors&&(e.$tags=r.defaults.SOGoMailLabelsColors),r.defaults.SOGoMailDisplayRemoteInlineImages&&"always"==r.defaults.SOGoMailDisplayRemoteInlineImages&&(e.$displayRemoteInlineImages=!0),e}];try{angular.module("SOGo.MailerUI")}catch(e){angular.module("SOGo.MailerUI",["SOGo.Common"])}angular.module("SOGo.MailerUI").constant("sgMessage_STATUS",{NOT_LOADED:0,DELAYED_LOADING:1,LOADING:2,LOADED:3,DELAYED_MS:300}).factory("Message",e.$factory),e.filterTags=function(t,n){var s=new RegExp(t,"i"),o=[];return _.forEach(_.keys(e.$tags),function(t){var i=e.$tags[t];-1!=i[0].search(s)&&(_.includes(n,t)||o.push({name:t,description:i[0],color:i[1]}))}),o},e.prototype.$absolutePath=function(t){var n=this,s=this.id;function o(){var e;return(e=_.map(n.$mailbox.path.split("/"),function(e){return"folder"+e.asCSSIdentifier()})).splice(0,0,n.accountId),e.join("/")}return(angular.isUndefined(this.id)||t&&t.nocache)&&(this.id=o()+"/"+this.uid,s=this.id),t&&t.asDraft&&this.draftId&&(s=o()+"/"+this.draftId),t&&t.withResourcePath&&(s=e.$$resource.path(s)),s},e.prototype.$setUID=function(e){var t,n=this.uid||-1,s=this;n!=parseInt(e)&&(this.uid=parseInt(e),this.$absolutePath({nocache:!0}),n>-1?(n=n.toString(),angular.isDefined(this.$mailbox.uidsMap[n])&&(t=this.$mailbox.uidsMap[n],this.$mailbox.uidsMap[e]=t,delete this.$mailbox.uidsMap[n],_.forEach(["from","to","subject"],function(e){s.$mailbox.$messages[t][e]=s[e]}))):this.$mailbox.constructor.selectedFolder&&"draft"==this.$mailbox.constructor.selectedFolder.type&&this.$mailbox.constructor.selectedFolder.$filter())},e.prototype.$formatFullAddresses=function(){var t=this,n=_.map(t.$mailbox.$account.identities,"email");_.forEach(["from","to","cc","bcc","reply-to"],function(s){_.forEach(t[s],function(t){t.name&&t.name!=t.email?(t.full=t.name+" <"+t.email+">",t.name.length<10?t.shortname=t.name:t.name.split(" ").length&&(t.shortname=_.first(_.last(t.name.split(/, */)).split(/ +/)).replace("'",""))):t.email&&(t.full="<"+t.email+">",t.shortname=t.email.split("@")[0]),t.image=e.$avatar(t.email,32),_.indexOf(n,t.email)>=0&&(t.shortname=l("me"))})})},e.prototype.$shortRecipients=function(e){var t=this,n=[],s=0,o=0;return _.forEach(["to","cc","bcc"],function(i){o+=t[i]?t[i].length:0,_.forEach(t[i],function(t,o){se&&n.push(l("and %{0} more...",o-e)),n.join(", ")},e.prototype.$shortAddress=function(e){var t="";return this[e]&&this[e].length>0&&(t=this[e][0].name||this[e][0].email||""),t},e.prototype.allowReplyAll=function(){var e=0;return e=_.reduce(["to","cc"],_.bind(function(e,t){return this[t]?e+this[t].length:e},this),e),!this.isDraft&&e>1},e.prototype.loadUnsafeContent=function(){this.$loadUnsafeContent=!0},e.prototype.$content=function(){var t=this,n=[],s=function(o){if(o.msgclass="msg-attachment-other","UIxMailPartAlternativeViewer"==o.type)s(_.find(o.content,function(e){return o.preferredPart==e.contentType}));else if(angular.isArray(o.content)){if("UIxMailPartSignedViewer"==o.type&&1===o["supports-smime"]){var i="

"+o.error.replace(/\n/,'

');i=i.replace(/\n/g,'

')+"

",t.$smime={validSignature:o.valid,certificate:o.certificates[o.certificates.length-1],message:i}}else"UIxMailPartEncryptedViewer"==o.type&&(t.$smime={message:"THIS MAIL IS ENCRYPTED!"});_.forEach(o.content,function(e){s(e)})}else angular.isUndefined(o.safeContent)&&(o.safeContent=o.content,t.$hasUnsafeContent|=o.safeContent.indexOf(" unsafe-")>-1),"UIxMailPartHTMLViewer"==o.type?(o.html=!0,t.$loadUnsafeContent||e.$displayRemoteInlineImages?(angular.isUndefined(o.unsafeContent)&&(o.unsafeContent=document.createElement("div"),o.unsafeContent.innerHTML=o.safeContent,angular.forEach(["src","data","classid","background","style"],function(e){var t,n,s,i=o.unsafeContent.querySelectorAll("[unsafe-"+e+"]");for(s=0;s"}),n={to:t},_.forEach(["subject","body"],function(t){var o=new RegExp(t+"=([^&]+)");t="body"==t?"text":t,(s=o.exec(e))&&(n[t]=decodeURIComponent(s[1]))}),_.forEach(["cc","bcc"],function(t){var o=new RegExp(t+"=([^&]+)");(s=o.exec(e))&&(n[t]=_.map(decodeURIComponent(s[1]).split(","),function(e){return"<"+e.trim()+">"}))}),angular.extend(this.editable,n))},e.prototype.$reply=function(){return this.$newDraft("reply")},e.prototype.$replyAll=function(){return this.$newDraft("replyall")},e.prototype.$forward=function(){return this.$newDraft("forward")},e.prototype.$newDraft=function(t){var n=this;return e.$$resource.fetch(this.$absolutePath(),t).then(function(s){var o,i;return e.$log.debug("New "+t+": "+JSON.stringify(s,void 0,2)),o=n.$mailbox.$account.$getMailboxByPath(s.mailboxPath),i=new e(s.accountId,o,s),e.$$resource.fetch(i.$absolutePath({asDraft:!0}),"edit").then(function(s){return e.$log.debug("New "+t+": "+JSON.stringify(s,void 0,2)+" original UID: "+n.uid),angular.extend(i.editable,s),i.origin={message:n,action:t},i})})},e.prototype.$save=function(){var t=this,n=this.editable;return e.$log.debug("save = "+JSON.stringify(n,void 0,2)),e.$$resource.save(this.$absolutePath({asDraft:!0}),n).then(function(n){e.$log.debug("save = "+JSON.stringify(n,void 0,2)),t.$setUID(n.uid),t.$reload(),t.isNew=!1})},e.prototype.$send=function(){var t=this,n=angular.copy(this.editable);return e.$log.debug("send = "+JSON.stringify(n,void 0,2)),e.$$resource.post(this.$absolutePath({asDraft:!0}),"send",n).then(function(n){return"success"==n.status?(angular.isDefined(t.origin)&&(t.origin.action.startsWith("reply")?t.origin.message.isanswered=!0:"forward"==t.origin.action&&(t.origin.message.isforwarded=!0)),n):e.$q.reject(n.data)})},e.prototype.$unwrap=function(t){var n=this;return this.$loaded=e.STATUS.DELAYED_LOADING,e.$timeout(function(){n.$loaded!=e.STATUS.LOADED&&(n.$loaded=e.STATUS.LOADING)},e.STATUS.DELAYED_MS),this.$futureMessageData=t.then(function(t){return 0===n.isread&&(n.isread=!0,n.$mailbox.unseenCount--),e.$timeout(function(){return angular.extend(n,t),n.$formatFullAddresses(),n.$loadUnsafeContent=!1,n.$loaded=e.STATUS.LOADED,n})}),this.$futureMessageData},e.prototype.$omit=function(e){var t={},n=e&&e.privateAttributes;return angular.forEach(this,function(e,s){("constructor"!=s&&"$"!=s[0]||n)&&(t[s]=e)}),t},e.prototype.download=function(){var t,n;return t={uids:[this.uid]},n={filename:this.subject+".zip"},e.$$resource.download(this.$mailbox.id,"saveMessages",t,n)},e.prototype.downloadAttachments=function(){var t;return t={filename:l("attachments")+"-"+this.uid+".zip"},e.$$resource.download(this.$absolutePath(),"archiveAttachments",null,t)}}(),function(){"use strict";function e(){this.show=!1,this.message=null,this.elements=[]}e.$factory=["$document","$timeout","$mdPanel","sgHotkeys",function(t,n,s,o){return angular.extend(e,{$document:t,$timeout:n,$mdPanel:s,sgHotkeys:o}),new e}],e.prototype.setMessage=function(e){this.message=e},e.prototype.registerImage=function(e){this.elements.push(e)},e.prototype.registerHotkeys=function(t){this.keys=[e.sgHotkeys.createHotkey({key:"left",description:l("View previous item"),callback:angular.bind(t,t.previousImage)}),e.sgHotkeys.createHotkey({key:"right",description:l("View next item"),callback:angular.bind(t,t.nextImage)})],_.forEach(this.keys,function(t){e.sgHotkeys.registerHotkey(t)})},e.prototype.showGallery=function(t,n){var s=this,o=e.$mdPanel,i=angular.element(this.message.parts.content[n].content).find("img")[0].src,a=_.filter(this.message.attachmentAttrs,function(e){return 0===e.mimetype.indexOf("image/")}),r=_.findIndex(a,function(e){return e.url.indexOf(i)>=0});angular.element(e.$document[0].body).addClass("sg-image-gallery-backdrop");var c=o.newPanelPosition().absolute(),u=o.newPanelAnimation().openFrom(t.target).duration(100).withAnimation(o.animation.FADE),d={attachTo:angular.element(document.body),locals:{lastIndex:a.length-1,images:a,selectedIndex:r,selectedImage:a[r]},bindToController:!0,controller:h,controllerAs:"$panelCtrl",position:c,animation:u,targetEvent:t,fullscreen:!0,hasBackdrop:!0,template:['','
',' '," arrow_back"," ",' image','
',' '," file_download"," ","
",'
',' '," navigate_before"," ",' ',' '," navigate_next"," ","
",'
','
',' ',"
","
","
"].join(""),trapFocus:!0,clickOutsideToClose:!0,escapeToClose:!0,focusOnOpen:!0,onOpenComplete:function(){s.show=!0,_.forEach(e.$document.find("sg-image-gallery")[0].getElementsByClassName("sg-image-thumbnail"),function(t){var n=t.children[0];angular.element(n).one("load",function(){n.naturalWidth0&&this.selectImage(this.selectedIndex-1)}}},angular.module("SOGo.MailerUI").factory("ImageGallery",e.$factory)}(),function(){"use strict";function e(e){this.$account=e}e.$factory=["$q","$timeout","$log","sgSettings","Resource","Message","Mailbox","sgMailbox_PRELOAD",function(t,n,s,o,i,a,r,l){return angular.extend(e,{$q:t,$timeout:n,$log:s,$$resource:new i(o.activeUser("folderURL")+"Mail",o.activeUser()),$Message:r,selectedFolder:null,PRELOAD:l}),e}];try{angular.module("SOGo.MailerUI")}catch(e){angular.module("SOGo.MailerUI",["SOGo.Common"])}angular.module("SOGo.MailerUI").constant("sgMailbox_PRELOAD",{LOOKAHEAD:50,SIZE:100}).factory("VirtualMailbox",e.$factory),e.$absolutePath=function(e){return[e,"virtual"].join("/")},e.prototype.init=function(e){this.$isLoading=!1,this.$mailboxes=[],this.uidsMap={},angular.extend(this,e),this.id=this.$id()},e.prototype.setMailboxes=function(e){this.$mailboxes=e,_.forEach(this.$mailboxes,function(e){e.$messages=[],e.uidsMap={}})},e.prototype.startSearch=function(t,n){var s=this,o=e.$q.when();this.$isLoading=!0,_.forEach(this.$mailboxes,function(i){o=o.then(function(){if(s.$isLoading)return e.$log.debug("searching mailbox "+i.path),i.$filter({sort:"date",asc:!1,match:t},n)})}),o.finally(function(){s.$isLoading=!1})},e.prototype.stopSearch=function(){e.$log.debug("stopping search..."),this.$isLoading=!1},e.prototype.selectFolder=function(){},e.prototype.resetSelectedMessage=function(){_.forEach(this.$mailboxes,function(e){delete e.selectedMessage})},e.prototype.hasSelectedMessage=function(){return angular.isDefined(_.find(this.$mailboxes,function(e){return angular.isDefined(e.selectedMessage)}))},e.prototype.isSelectedMessage=function(e,t){return angular.isDefined(_.find(this.$mailboxes,function(n){return n.path==t&&n.selectedMessage==e}))},e.prototype.getLength=function(){var e=0;return angular.isDefined(this.$mailboxes)?(_.forEach(this.$mailboxes,function(t){e+=t.$messages.length}),e):e},e.prototype.getItemAtIndex=function(e){var t,n,s,o,i;if(angular.isDefined(this.$mailboxes)&&e>=0)for(t=0,n=0;n0){var s=_.map(t,"uid");i.push(t);var r=e.$$resource.post(n,"addOrRemoveLabel",_.assign(o,{msgUIDs:s}));a.push(r)}}),e.$q.all(a).then(function(){return _.flatten(i)})},e.prototype.$deleteMessages=function(t){var n=[];return _.forEach(t,function(e,t){if(e.length>0){var s=e[0].$mailbox.$deleteMessages(e);n.push(s)}}),e.$q.all(n)},e.prototype.$markOrUnMarkMessagesAsJunk=function(t){var n=[];return _.forEach(t,function(e,t){if(e.length>0){var s=e[0].$mailbox.$markOrUnMarkMessagesAsJunk(e);n.push(s)}}),e.$q.all(n)},e.prototype.$copyMessages=function(t,n){var s=[];return _.forEach(t,function(e,t){if(e.length>0){var o=e[0].$mailbox.$copyMessages(e,n);s.push(o)}}),e.$q.all(s)},e.prototype.$moveMessages=function(t,n){var s=[];return _.forEach(t,function(e,t){if(e.length>0){var o=e[0].$mailbox.$moveMessages(e,n);s.push(o)}}),e.$q.all(s)}}(),function(){"use strict";e.$inject=["$window","$scope","$timeout","$q","$state","$mdDialog","$mdToast","stateAccounts","stateAccount","stateMailbox","sgHotkeys","encodeUriFilter","sgSettings","sgFocus","Dialog","Preferences","Account","Mailbox"];function e(e,t,n,s,o,i,a,r,c,u,d,h,g,f,m,p,$,b){var v=this,M=angular.element(e.document).find("title").attr("sg-default")||"SOGo",y=[];this.$onInit=function(){e.$mailboxController=v,this.service=b,this.accounts=r,this.account=c,this.selectedFolder=u,this.messageDialog=null,this.mode={search:!1,multiple:0},(n=y).push(d.createHotkey({key:l("hotkey_search"),description:l("Search"),callback:v.searchMode})),n.push(d.createHotkey({key:l("hotkey_compose"),description:l("Write a new message"),callback:function(e){null===v.messageDialog&&v.newMessage(e)}})),n.push(d.createHotkey({key:l("hotkey_junk"),description:l("Mark the selected messages as junk"),callback:v.markOrUnMarkMessagesAsJunk})),n.push(d.createHotkey({key:"space",description:l("Toggle item"),callback:v.toggleMessageSelection})),n.push(d.createHotkey({key:"shift+space",description:l("Toggle range of items"),callback:v.toggleMessageSelection})),n.push(d.createHotkey({key:"up",description:l("View next item"),callback:C,preventInClass:["sg-mail-part"]})),n.push(d.createHotkey({key:"down",description:l("View previous item"),callback:w,preventInClass:["sg-mail-part"]})),n.push(d.createHotkey({key:"shift+up",description:l("Add next item to selection"),callback:I,preventInClass:["sg-mail-part"]})),n.push(d.createHotkey({key:"shift+down",description:l("Add previous item to selection"),callback:E,preventInClass:["sg-mail-part"]})),_.forEach(["backspace","delete"],function(e){n.push(d.createHotkey({key:e,description:l("Delete selected message or folder"),callback:v.confirmDeleteSelectedMessages}))}),_.forEach(n,function(e){d.registerHotkey(e)});var n;angular.element(e).on("beforeunload",x),t.$on("$destroy",function(){angular.element(e).off("beforeunload",x),_.forEach(y,function(e){d.deregisterHotkey(e)})}),t.$watch(function(){return v.selectedFolder.unseenCount},function(t){var n=M+" - ";t&&(n+="("+t+") "),n+=v.selectedFolder.$displayName,e.document.title=n})};function x(e){return v.selectedFolder.$compact()}this.centerIsClose=function(e){return this.selectedFolder.hasSelectedMessage()&&!!e},this.sort=function(e){v.selectedFolder.$filter({sort:e})},this.sortedBy=function(e){return b.$query.sort==e},this.searchMode=function(){v.mode.search=!0,f("search")},this.cancelSearch=function(){v.mode.search=!1,v.selectedFolder.$filter().then(function(){v.selectedFolder.selectedMessage&&n(function(){v.selectedFolder.$topIndex=v.selectedFolder.uidsMap[v.selectedFolder.selectedMessage]})})},this.composeWindowEnabled=function(){return p.defaults.SOGoMailComposeWindowEnabled},this.newMessage=function(t,n){var s;null===v.messageDialog&&(n||"popup"==p.defaults.SOGoMailComposeWindow?function(){var t=[g.baseURL(),"UIxMailPopupView#!/Mail",v.account.id,h(h(v.selectedFolder.path)),"new"].join("/"),n=v.selectedFolder.$id()+"/"+Math.random(0,1e3);console.debug(t),e.open(t,n,["width=680","height=520","resizable=1","scrollbars=1","toolbar=0","location=0","directories=0","status=0","menubar=0","copyhistory=0"].join(","))}():(s=v.account.$newMessage(),v.messageDialog=i.show({parent:angular.element(document.body),targetEvent:t,clickOutsideToClose:!1,escapeToClose:!1,templateUrl:"UIxMailEditor",controller:"MessageEditorController",controllerAs:"editor",locals:{stateAccount:v.account,stateMessage:s}}).catch().finally(function(){v.messageDialog=null})))};function C(e){var t=v.selectedFolder.$selectedMessageIndex();return angular.isDefined(t)?(t--,v.selectedFolder.$topIndex>0&&v.selectedFolder.$topIndex--):(t=v.selectedFolder.getLength()-1,v.selectedFolder.$topIndex=v.selectedFolder.getLength()),t>-1&&v.selectMessage(v.selectedFolder.$messages[t]),e.preventDefault(),t}function w(e){var t=v.selectedFolder.$selectedMessageIndex();return angular.isDefined(t)?(t++,v.selectedFolder.$topIndex=0&&v.toggleMessageSelection(e,v.selectedFolder.$messages[t])}function E(e){var t;v.selectedFolder.hasSelectedMessage()&&(t=w(e))>=0&&v.toggleMessageSelection(e,v.selectedFolder.$messages[t])}this.selectMessage=function(e){b.$virtualMode?o.go("mail.account.virtualMailbox.message",{mailboxId:h(e.$mailbox.path),messageId:e.uid}):o.go("mail.account.mailbox.message",{messageId:e.uid})},this.toggleMessageSelection=function(e,t){var n,s,o,i=v.selectedFolder;if(t||(t=i.$selectedMessage()),!t)return!0;if(t.selected=!t.selected,v.mode.multiple+=t.selected?1:-1,e.shiftKey&&i.$selectedCount()>1){for(s=(n=i.uidsMap[t.uid])-2;s>=0&&!i.$messages[s].selected;)s--;if(s<0)for(s=n+2;s=0&&s0&&(a-=1,s=v.selectedFolder.$messages[a]),t0&&(v.messageDialog=m.confirm(l("Confirmation"),l("Are you sure you want to delete the selected messages?"),{ok:l("Delete")}).then(function(){var e=v.selectedFolder.hasSelectedMessage();v.selectedFolder.$deleteMessages(t).then(function(t){b.$virtualMode?e&&o.go("mail.account.virtualMailbox"):A(e,t)},function(n){v.messageDialog=m.confirm(l("Warning"),l("The messages could not be moved to the trash folder. Would you like to delete them immediately?"),{ok:l("Delete")}).then(function(){v.selectedFolder.$deleteMessages(t,{withoutTrash:!0}).then(function(t){b.$virtualMode?e&&o.go("mail.account.virtualMailbox"):A(e,t)})})})}).finally(function(){v.messageDialog=null})),e.preventDefault()},this.markOrUnMarkMessagesAsJunk=function(){var e=v.selectedFolder.hasSelectedMessage(),t=v.selectedFolder.$selectedMessages();0===_.size(t)&&e&&(t=[v.selectedFolder.$selectedMessage()]),_.size(t)>0&&v.selectedFolder.$markOrUnMarkMessagesAsJunk(t).then(function(){var n="/"+v.account.id+"/folderINBOX";"junk"!=v.selectedFolder.type&&(n="/"+v.account.$getMailboxByType("junk").id),v.selectedFolder.$moveMessages(t,n).then(function(t){b.$virtualMode?e&&o.go("mail.account.virtualMailbox"):A(e,t)})})},this.copySelectedMessages=function(e){var t=v.selectedFolder.$selectedMessages();_.size(t)>0&&v.selectedFolder.$copyMessages(t,"/"+e).then(function(){a.show(a.simple().content(l("%{0} message(s) copied",v.selectedFolder.$selectedCount())).position("top right").hideDelay(2e3))})},this.moveSelectedMessages=function(e){var t=v.selectedFolder.hasSelectedMessage(),n=v.selectedFolder.$selectedMessages(),s=v.selectedFolder.$selectedCount();_.size(n)>0&&v.selectedFolder.$moveMessages(n,"/"+e).then(function(e){a.show(a.simple().content(l("%{0} message(s) moved",s)).position("top right").hideDelay(2e3)),b.$virtualMode?t&&o.go("mail.account.virtualMailbox"):A(t,e)})},this.selectAll=function(){var e=0;_.forEach(S(),function(t){for(var n=0,s=t.$messages.length;n0&&v.selectedFolder.$flagMessages(e,"\\Flagged","add").then(function(e){_.forEach(e,function(e){e.isflagged=!0})})},this.markSelectedMessagesAsUnread=function(){var e=v.selectedFolder.$selectedMessages();_.size(e)>0&&v.selectedFolder.$flagMessages(e,"seen","remove").then(function(e){_.forEach(e,function(e){e.isread&&e.$mailbox.unseenCount++,e.isread=!1})})},this.markSelectedMessagesAsRead=function(){var e=v.selectedFolder.$selectedMessages();_.size(e)>0&&v.selectedFolder.$flagMessages(e,"seen","add").then(function(e){_.forEach(e,function(e){e.isread||e.$mailbox.unseenCount--,e.isread=!0})})}}angular.module("SOGo.MailerUI").controller("MailboxController",e),t.$inject=["$delegate"];function t(e){return e[0].controller.prototype.resetScroll=function(){"messagesList"==this.$element.parent().attr("id")?this.updateSize():this.scrollTo(0)},e}angular.module("material.components.virtualRepeat").decorator("mdVirtualRepeatContainerDirective",t)}(),function(){"use strict";e.$inject=["$scope","$state","$transitions","$timeout","$window","$mdDialog","$mdToast","sgFocus","encodeUriFilter","Dialog","sgSettings","sgHotkeys","Account","Mailbox","VirtualMailbox","User","Preferences","stateAccounts"];function e(e,t,n,s,o,i,a,r,c,u,d,h,g,f,m,p,$,b){var v,M,y=this,x=[];this.$onInit=function(){this.service=f,this.accounts=b,this.currentSearchParam="",this.search={options:{"":"",subject:l("Enter Subject"),from:l("Enter From"),to:l("Enter To"),cc:l("Enter Cc"),body:l("Enter Body")},subfolders:1,match:"AND",params:[]},this.showSubscribedOnly=$.defaults.SOGoMailShowSubscribedFoldersOnly,this.refreshUnseenCount(),t=x,_.forEach(["backspace","delete"],function(e){t.push(h.createHotkey({key:e,description:l("Delete selected message or folder"),callback:function(){f.selectedFolderController&&f.selectedFolder&&!f.selectedFolder.hasSelectedMessage()&&f.selectedFolderController.confirmDelete(f.selectedFolder)}}))}),_.forEach(t,function(e){h.registerHotkey(e)});var t;e.$on("$destroy",function(){_.forEach(x,function(e){h.deregisterHotkey(e)})})};this.hideAdvancedSearch=function(){y.service.$virtualPath=!1,y.service.$virtualMode=!1,v=y.accounts[0],M=y.searchPreviousMailbox,t.go("mail.account.mailbox",{accountId:v.id,mailboxId:c(M.path)})},this.toggleAdvancedSearch=function(){if(f.selectedFolder.$isLoading)y.virtualMailbox.stopSearch();else{var e,n=[],s=function(e){_.forEach(e,function(e){n.push(e),e.children&&e.children.length>0&&s(e.children)})};y.virtualMailbox=new m(y.accounts[0]),f.$virtualMode||(y.searchPreviousMailbox=f.selectedFolder),f.selectedFolder=y.virtualMailbox,f.$virtualMode=!0,angular.isDefined(f.$virtualPath)?(e=y.accounts[0].$getMailboxByPath(f.$virtualPath),n.push(e),y.search.subfolders&&e.children.length&&s(e.children)):n=y.accounts[0].$flattenMailboxes(),y.virtualMailbox.setMailboxes(n),y.virtualMailbox.startSearch(y.search.match,y.search.params),"mail.account.virtualMailbox"!=t.$current.name&&t.go("mail.account.virtualMailbox",{accountId:y.accounts[0].id})}},this.addSearchParam=function(e){return y.currentSearchParam=e,r("advancedSearch"),!1},this.newSearchParam=function(e){if(e.length&&y.currentSearchParam.length){var t=0,n=y.currentSearchParam;return e.startsWith("!")&&(t=1,e=e.substring(1).trim()),y.currentSearchParam="",{searchBy:n,searchInput:e,negative:t}}},this.toggleAccountState=function(e){e.$expanded=!e.$expanded,e.$flattenMailboxes({reload:!0,saveState:!0}),s(function(){angular.element(o).triggerHandler("resize")},150)},this.subscribe=function(e){i.show({templateUrl:e.id+"/subscribe",controller:t,controllerAs:"subscriptions",clickOutsideToClose:!0,escapeToClose:!0,locals:{srcAccount:e}}).finally(function(){e.$getMailboxes({reload:!0})}),t.$inject=["$scope","$mdDialog","srcAccount"];function t(e,t,n){var s=this;s.loading=!0,s.filter={name:""},s.account=new g({id:n.id,name:n.name}),s.close=function(){t.hide()},s.account.$getMailboxes({reload:!0,all:!0}).then(function(){s.loading=!1})}},this.newFolder=function(e){u.prompt(l("New Folder..."),l("Enter the new name of your folder")).then(function(t){e.$newMailbox(e.id,t).then(function(){},function(e,n){u.alert(l('An error occured while creating the mailbox "%{0}".',t),l(e.error))})})},this.delegate=function(e){i.show({templateUrl:e.id+"/delegation",controller:t,controllerAs:"delegate",clickOutsideToClose:!0,escapeToClose:!0,locals:{User:p,account:e}}),t.$inject=["$scope","$mdDialog","User","account"];function t(e,t,n,s){var o=this;o.users=s.delegates,o.account=s,o.userToAdd="",o.searchText="",o.userFilter=function(e){return n.$filter(e,s.delegates)},o.closeModal=function(){t.hide()},o.removeUser=function(e){s.$removeDelegate(e.uid).catch(function(e,t){u.alert(l("Warning"),l("An error occured please try again."))})},o.addUser=function(e){e&&s.$addDelegate(e).then(function(){o.userToAdd="",o.searchText=""},function(e){u.alert(l("Warning"),e)})}}},this.refreshUnseenCount=function(){var e,t=o.unseenCountFolders;_.forEach(y.accounts,function(e){_.includes(t,e.id+"/folderINBOX")||t.push(e.id+"/folderINBOX"),_.forEach(e.$$flattenMailboxes,function(e){angular.isDefined(e.unseenCount)&&!_.includes(t,e.id)&&t.push(e.id)})}),g.$$resource.post("","unseenCount",{mailboxes:t}).then(function(e){_.forEach(y.accounts,function(t){_.forEach(t.$$flattenMailboxes,function(t){e[t.id]&&(t.unseenCount=e[t.id])})})}),(e=$.defaults.SOGoRefreshViewCheck)&&"manually"!=e&&s(y.refreshUnseenCount,1e3*e.timeInterval())},this.isDroppableFolder=function(e,t){return t.id!=e.id&&!t.isNoSelect()},this.dragSelectedMessages=function(e,n,s){var o,i,r,c,u,d;o="/"+n.id,0===(i=e.$selectedMessages()).length&&(i=[e.$selectedMessage()]),r=_.map(i,"uid"),c=e.selectedMessage&&r.indexOf(e.selectedMessage)>=0,"copy"==s?(u=e.$copyMessages(i,o),d=l("%{0} message(s) copied",i.length)):(u=e.$moveMessages(i,o),d=l("%{0} message(s) moved",i.length)),u.then(function(){c&&t.go("mail.account.mailbox"),a.show(a.simple().content(d).position("top right").hideDelay(2e3))})}}angular.module("SOGo.MailerUI").controller("MailboxesController",e)}(),function(){"use strict";e.$inject=["$window","$scope","$state","$mdMedia","$mdDialog","sgConstant","stateAccounts","stateAccount","stateMailbox","stateMessage","sgHotkeys","encodeUriFilter","sgSettings","ImageGallery","sgFocus","Dialog","Preferences","Calendar","Component","Account","Mailbox","Message"];function e(e,t,n,s,o,i,a,r,c,u,d,h,g,f,m,p,$,b,v,M,y,x){var C=this,w=[];this.$onInit=function(){e.$messageController=C,f.setMessage(u),this.$state=n,this.accounts=a,this.account=r,this.mailbox=c,this.message=u,this.service=x,this.tags={searchText:"",selected:""},this.showFlags=u.flags&&u.flags.length>0,this.$showDetailedRecipients=!1,C.showRawSource=!1,(s=w).push(d.createHotkey({key:l("hotkey_reply"),description:l("Reply to the message"),callback:E(angular.bind(C,C.reply))})),s.push(d.createHotkey({key:l("hotkey_replyall"),description:l("Reply to sender and all recipients"),callback:E(angular.bind(C,C.replyAll))})),s.push(d.createHotkey({key:l("hotkey_forward"),description:l("Forward selected message"),callback:E(angular.bind(C,C.forward))})),s.push(d.createHotkey({key:l("hotkey_flag"),description:l("Flagged"),callback:E(angular.bind(u,u.toggleFlag))})),_.forEach(["backspace","delete"],function(e){s.push(d.createHotkey({key:e,callback:E(function(e){0===C.mailbox.$selectedCount()&&C.deleteMessage(),e.preventDefault()})}))}),_.forEach(s,function(e){d.registerHotkey(e)});var s;e.opener?(t.$watchCollection(function(){return C.message.flags},function(e,t){var n;(e||t)&&(n=S()).messageCtrl&&n.messageCtrl.service.$timeout(function(){n.messageCtrl.showFlags=!0,n.messageCtrl.message.flags=e})}),t.$watch(function(){return C.message.isflagged},function(e,t){var n=S();n.mailboxCtrl&&n.mailboxCtrl.service.$timeout(function(){_.find(n.mailboxCtrl.selectedFolder.$messages,{uid:C.message.uid}).isflagged=e})})):t.$watchCollection(function(){return C.message.flags},function(e,t){var n,s,o;(e||t)&&(n=e||[],s=t||[],_.forEach(n,function(e,t){angular.isObject(e)&&(n[t]=e.name)}),n.length>s.length?(o=_.difference(n,s),_.forEach(o,function(e){C.message.addTag(e)})):n.length0&&(t.mailbox.messageDialog=arguments[0]),t.mailbox.messageDialog):null}function E(e){return function(){if(null===I())return e.apply(C,arguments)}}function S(){var t,n,s={};return e.opener&&e.opener.$mailboxController&&e.opener.$mailboxController.selectedFolder.$id()==c.$id()&&(n=e.opener.$mailboxController,s.mailboxCtrl=n,e.opener.$messageController&&e.opener.$messageController.message.uid==u.uid&&(t=e.opener.$messageController,s.messageCtrl=t)),s}this.addFlags=function(e){this.showFlags=!0,m("flags")},this.toggleDetailedRecipients=function(e){this.$showDetailedRecipients=!this.$showDetailedRecipients,e.stopPropagation(),e.preventDefault()},this.filterMailtoLinks=function(e){var t;"A"==e.target.tagName&&"href"in e.target.attributes&&(t=e.target.attributes.href.value,/^mailto:([^\?]+)/.exec(t)&&(delete e.target.attributes.target,this.newMessage(e,t)))},this.deleteMessage=function(){var e,t,o,a,r,l=S();l.messageCtrl?(e=l.mailboxCtrl.selectedFolder,t=l.messageCtrl.message,o=l.messageCtrl.$state):(e=c,t=u,o=n),e.$deleteMessages([t]).then(function(n){var l=n;if(t=null,angular.isDefined(o)){n>0&&(l-=1,a=e.$messages[l]),ne.$lastVisibleIndex&&(e.$topIndex=l-(e.$lastVisibleIndex-e.$topIndex))):o.go("mail.account.mailbox").then(function(){t=null,delete e.selectedMessage})}catch(e){}}C.closePopup()})};function A(e,t){null===I()&&I(o.show({parent:angular.element(document.body),targetEvent:e,clickOutsideToClose:!1,escapeToClose:!1,templateUrl:"UIxMailEditor",controller:"MessageEditorController",controllerAs:"editor",locals:{stateAccount:C.account,stateMessage:t}}).finally(function(){I(null),C.closePopup()}))}this._showMailEditorInPopup=function(e){return!g.isPopup&&"popup"==$.defaults.SOGoMailComposeWindow&&(this.openInPopup(e),!0)},this.close=function(){n.go("mail.account.mailbox").then(function(){C.message=null,delete c.selectedMessage})},this.reply=function(e){this._showMailEditorInPopup("reply")||A(e,this.message.$reply())},this.replyAll=function(e){this._showMailEditorInPopup("replyall")||A(e,this.message.$replyAll())},this.forward=function(e){this._showMailEditorInPopup("forward")||A(e,this.message.$forward())},this.edit=function(e){this._showMailEditorInPopup("edit")||this.message.$editableContent().then(function(){A(e,C.message)})},this.openInPopup=function(t){var n=[g.baseURL(),"UIxMailPopupView#!/Mail",this.message.accountId,h(h(this.message.$mailbox.path)),this.message.uid].join("/"),s=this.message.$absolutePath();t&&(n+="/"+t),e.open(n,s,["width=680","height=520","resizable=1","scrollbars=1","toolbar=0","location=0","directories=0","status=0","menubar=0","copyhistory=0"].join(","))},this.closePopup=function(){e.opener&&e.close()},this.newMessage=function(e,t){e.stopPropagation(),e.preventDefault(),this.account.$newMessage({mailto:t}).then(function(t){A(e,t)})},this.toggleRawSource=function(e){this.showRawSource||this.message.$rawSource?this.showRawSource=!this.showRawSource:x.$$resource.post(this.message.id,"viewsource").then(function(e){C.message.$rawSource=e,C.showRawSource=!0})},this.print=function(t){e.print()},this.convertToEvent=function(e){return F(e,"appointment")},this.convertToTask=function(e){return F(e,"task")};function F(e,t){C.message.$plainContent().then(function(n){var s={pid:b.$defaultCalendar(),type:t,summary:n.subject,comment:n.content},i=new v(s),a=[g.activeUser("folderURL"),"Calendar","UIx"+t.capitalize()+"EditorTemplate"].join("/");return o.show({parent:angular.element(document.body),targetEvent:e,clickOutsideToClose:!0,escapeToClose:!0,templateUrl:a,controller:"ComponentEditorController",controllerAs:"editor",locals:{stateComponent:i}})})}}angular.module("SOGo.MailerUI").controller("MessageController",e)}(),function(){"use strict";e.$inject=["$scope","$window","$stateParams","$mdConstant","$mdDialog","$mdToast","FileUploader","stateAccount","stateMessage","encodeUriFilter","$timeout","Dialog","AddressBook","Card","Preferences"];function e(e,t,n,s,o,i,a,r,c,u,d,h,g,f,m){var p=this;p.addRecipient=function(e,t){var n,s,o,i,a,r=/([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)/i;if(n=p.message.editable[t],angular.isString(e)){for(a="",i=0;i',' '," {{$ctrl.mailbox.$icon}}"," ",'

',' ',' ',"

",' ',' '," ",' more_vert'].join(""),controller:"sgMailboxListItemController",controllerAs:"$ctrl"}})}(),function(){e.$inject=["$scope","$element","Mailbox"];function e(e,t,n){var s=this;this.$onInit=function(){this.MailboxService=n,e.$watch(function(){return s.message?[_.pick(s.message,["uid","isread","isflagged"])]:null},function(e,t){s.message&&s.onUpdate()},!0)},this.onUpdate=function(){this.message.isread?t.removeClass("unread"):t.addClass("unread"),n.selectedFolder.isSelectedMessage(this.message.uid,this.message.$mailbox.path)?t.addClass("md-default-theme md-accent md-bg md-hue-2"):t.removeClass("md-default-theme md-accent md-bg md-hue-2")},this.setVisibility=function(e,t){t?e.classList.remove("ng-hide"):e.classList.add("ng-hide")}}angular.module("SOGo.MailerUI").controller("sgMessageListItemController",e).directive("sgMessageListItem",function(){return{restrict:"C",scope:{},bindToController:{message:"=sgMessage"},controller:"sgMessageListItemController"}})}(),function(){e.$inject=["$scope","$element","$parse","$state","$mdUtil","$mdToast","Mailbox","Message","encodeUriFilter"];function e(e,t,n,s,o,i,a,r,l){var c=this;this.$postLink=function(){var n,s,i,l;this.parentController=e.parentController,i=this.parentController.onUpdate,l=this.parentController.setVisibility,_.forEach(t.find("div"),function(e){e.classList.contains("sg-tile-content")?n=angular.element(e):e.classList.contains("sg-tile-icons")&&(s=angular.element(e))}),this.priorityIconElement=n.find("md-icon")[0],a.$virtualMode&&(this.mailboxNameElement=n.find("span")[0],this.mailboxNameElement.classList.remove("ng-hide")),this.senderElement=n.find("span")[1],_.forEach(n.find("div"),function(e){e.classList.contains("sg-tile-subject")?c.subjectElement=e:e.classList.contains("sg-tile-size")?c.sizeElement=e:e.classList.contains("sg-tile-date")&&(c.dateElement=e)}),_.forEach(s.find("md-icon"),function(e){"star"==e.textContent?c.flagIconElement=e:"reply"==e.textContent?c.answerIconElement=e:"forward"==e.textContent?c.forwardIconElement=e:"attach_file"==e.textContent&&(c.attachmentIconElement=e)}),this.parentController.onUpdate=function(){var e;c.message=c.parentController.message;var n=o.nodesToArray(t[0].querySelectorAll(".sg-category"));for(_.forEach(n,function(e){t[0].removeChild(e)}),e=0;e');a.css("left",3*e+"px"),a.css("background-color",c.service.$tags[s][1]),t.prepend(a)}}c.mailboxNameElement&&(c.mailboxNameElement.innerHTML=c.message.$mailbox.$displayName),"sent"==c.MailboxService.selectedFolder.type?c.senderElement.innerHTML=c.message.$shortAddress("to").encodeEntities():c.senderElement.innerHTML=c.message.$shortAddress("from").encodeEntities(),c.message.priority&&c.message.priority.level<3?(c.priorityIconElement.classList.remove("ng-hide"),c.message.priority.level<2?c.priorityIconElement.classList.add("md-warn"):c.priorityIconElement.classList.remove("md-warn")):c.priorityIconElement.classList.add("ng-hide"),c.subjectElement.innerHTML=c.message.subject.encodeEntities(),c.sizeElement.innerHTML=c.message.size,c.dateElement.innerHTML=c.message.relativedate,l(c.flagIconElement,c.message.isflagged),l(c.answerIconElement,c.message.isanswered),l(c.forwardIconElement,c.message.isforwarded),l(c.attachmentIconElement,c.message.hasattachment),angular.bind(c.parentController,i)()},this.service=r,this.MailboxService=a}}angular.module("SOGo.MailerUI").controller("sgMessageListItemMainController",e).directive("sgMessageListItemMain",function(){return{restrict:"C",require:"^^sgMessageListItem",scope:{},template:['
','
',"
",' \x3c!-- mailbox --\x3e',' error'," \x3c!-- sender or recipient --\x3e","
",'
\x3c!-- date --\x3e
',"
",'
','
\x3c!-- subject --\x3e
','
\x3c!-- size --\x3e
',"
","
",'
',' star',' reply',' forward',' attach_file',"
",'
',' \x3c!-- message loading progress --\x3e',"
"].join(""),link:function(e,t,n,s){e.parentController=s},controller:"sgMessageListItemMainController",controllerAs:"$ctrl"}})}(),function(){"use strict";e.$inject=["$element","ImageGallery"];function e(e,t){var n=this;this.$postLink=function(){t.registerImage(e),e.on("click",this.showImage)},this.showImage=function(e){"IMG"==e.target.tagName&&t.showGallery(e,n.partIndex)}}angular.module("SOGo.MailerUI").directive("sgZoomableImage",function(){return{restrict:"A",bindToController:{partIndex:"=sgZoomableImage"},controller:e}})}(); +!function(){"use strict";function e(t){"function"!=typeof t.then&&(angular.extend(this,t),_.forEach(this.identities,function(e){e.fullName?e.full=e.fullName+" <"+e.email+">":e.full="<"+e.email+">"}),e.$log.debug("Account: "+JSON.stringify(t,void 0,2)))}e.$factory=["$q","$timeout","$log","sgSettings","Resource","Preferences","Mailbox","Message",function(t,n,s,o,i,a,r,l){return angular.extend(e,{$q:t,$timeout:n,$log:s,$$resource:new i(o.activeUser("folderURL")+"Mail",o.activeUser()),$Preferences:a,$Mailbox:r,$Message:l}),e}];try{angular.module("SOGo.MailerUI")}catch(e){angular.module("SOGo.MailerUI",["SOGo.Common"])}angular.module("SOGo.MailerUI").factory("Account",e.$factory),e.$findAll=function(t){return t?e.$unwrapCollection(t):e.$$resource.fetch("","mailAccounts").then(function(t){return e.$unwrapCollection(t)})},e.$unwrapCollection=function(t){var n=[];return angular.forEach(t,function(t,s){t.id=s,n[s]=new e(t)}),e.$accounts=n,n},e.prototype.getLength=function(){return this.$flattenMailboxes().length},e.prototype.getItemAtIndex=function(e){var t;return t=this.$flattenMailboxes(),e>=0&&e=0,e.children&&e.children.length>0&&o(e.children)})};if(e.$Preferences.settings.Mail.ExpandedFolders){if(angular.isString(e.$Preferences.settings.Mail.ExpandedFolders))try{s=angular.fromJson(e.$Preferences.settings.Mail.ExpandedFolders)}catch(t){e.$log.warn("Can't parse list of expanded folders. String was: "+e.$Preferences.settings.Mail.ExpandedFolders),s=[]}else s=e.$Preferences.settings.Mail.ExpandedFolders;n.$expanded=s.indexOf("/"+n.id)>=0,s.length>0&&o(n.$mailboxes)}return e.$accounts&&(n.$expanded|=1==e.$accounts.length),n.$flattenMailboxes({reload:!0}),n.$mailboxes}):e.$q.when(this.$mailboxes)},e.prototype.$flattenMailboxes=function(t){var n=[],s=[],o=function(e){_.forEach(e,function(e){n.push(e),(t&&t.all||e.$expanded)&&e.children&&e.children.length>0&&o(e.children)})};return!this.$$flattenMailboxes||t&&(t.reload||t.all)?(o(this.$mailboxes),t&&t.all||(this.$$flattenMailboxes=n,t&&t.saveState&&(_.forEach(e.$accounts,function(e){e.$expanded&&s.push("/"+e.id),_.reduce(e.$$flattenMailboxes,function(e,t){return t.$expanded&&e.push("/"+t.id),e},s)}),e.$$resource.post(null,"saveFoldersState",s)))):n=this.$$flattenMailboxes,n},e.prototype.$getMailboxByType=function(e){var t=function(n){var s=_.find(n,function(t){return t.type==e});return s||angular.forEach(n,function(e){!s&&e.children&&e.children.length>0&&(s=t(e.children))}),s};return t(this.$mailboxes)},e.prototype.$getMailboxByPath=function(e){var t=function(n){var s=_.find(n,function(t){return t.path==e});return s||angular.forEach(n,function(e){!s&&e.children&&e.children.length>0&&(s=t(e.children))}),s};return t(this.$mailboxes)},e.prototype.$newMailbox=function(t,n){var s=this;return e.$$resource.post(t.toString(),"createFolder",{name:n}).then(function(){s.$getMailboxes({reload:!0})})},e.prototype.$removeCertificate=function(){return e.$$resource.fetch(this.id.toString(),"removeCertificate")},e.prototype.updateQuota=function(e){var t,n;t=Math.round(1e4*e.usedSpace/e.maxQuota)/100,n=l("quotasFormat").formatted(t,Math.round(e.maxQuota/10.24)/100),this.$quota={percent:t,description:n}},e.prototype.$newMessage=function(t){var n=this;return e.$$resource.fetch(this.id.toString(),"compose").then(function(t){e.$log.debug("New message (compose): "+JSON.stringify(t,void 0,2));return new e.$Message(t.accountId,n.$getMailboxByPath(t.mailboxPath),t)}).then(function(n){return e.$$resource.fetch(n.$absolutePath({asDraft:!0}),"edit").then(function(s){return e.$log.debug("New message (edit): "+JSON.stringify(s,void 0,2)),angular.extend(n.editable,s),n.isNew=!0,t&&t.mailto&&(angular.isObject(t.mailto)?angular.extend(n.editable,t.mailto):n.$parseMailto(t.mailto)),n})})},e.prototype.$addDelegate=function(t){var n=this,s=e.$q.defer(),o={uid:t.uid};return!t.uid||_.indexOf(_.map(this.delegates,"uid"),t.uid)>-1?s.resolve():e.$$resource.fetch(this.id.toString(),"addDelegate",o).then(function(){n.delegates.push(t),s.resolve(n.users)},function(e,t){s.reject(l("An error occured please try again."))}),s.promise},e.prototype.$removeDelegate=function(t){var n=this,s={uid:t};return e.$$resource.fetch(this.id.toString(),"removeDelegate",s).then(function(){var e=_.indexOf(_.map(n.delegates,"uid"),t);e>=0&&n.delegates.splice(e,1)})}}(),function(){"use strict";function e(t,n){if(this.$account=t,"function"!=typeof n.then){if(this.init(n),this.name&&!this.path){var s=e.$$resource.create("createFolder",this.name);this.$unwrap(s)}}else this.$unwrap(n)}e.$factory=["$q","$timeout","$log","sgSettings","Resource","Message","Acl","Preferences","sgMailbox_PRELOAD",function(t,n,s,o,i,a,r,l,c){return angular.extend(e,{$q:t,$timeout:n,$log:s,$$resource:new i(o.activeUser("folderURL")+"Mail",o.activeUser()),$Message:a,$$Acl:r,$Preferences:l,$query:{sort:"arrival",asc:0},selectedFolder:null,$refreshTimeout:null,$virtualMode:!1,$virtualPath:!1,PRELOAD:c}),l.settings.Mail.SortingState&&(e.$query.sort=l.settings.Mail.SortingState[0],e.$query.asc=parseInt(l.settings.Mail.SortingState[1])),e}];try{angular.module("SOGo.MailerUI")}catch(e){angular.module("SOGo.MailerUI",["SOGo.Common"])}angular.module("SOGo.MailerUI").constant("sgMailbox_PRELOAD",{LOOKAHEAD:50,SIZE:100}).factory("Mailbox",e.$factory),e.$find=function(t,n){var s;return s=n&&n.all?this.$$resource.fetch(t.id.toString(),"viewAll"):this.$$resource.fetch(t.id.toString(),"view"),e.$unwrapCollection(t,s)},e.$unwrapCollection=function(t,n){var s=[],o=function(n,s){for(var i=0;i=0&&e=0},e.prototype.isNoSelect=function(){return this.flags.indexOf("noselect")>=0},e.prototype.getClassName=function(e){return!1},e.prototype.$rename=function(){var t,n,s,o,i=this;return this.name==this.$shadowData.name?e.$q.when():(n=(t=function(e,n){var s=null;return _.find(n,function(e){return e.path==i.path})?s=e:angular.forEach(n,function(e){!s&&e.children&&e.children.length>0&&(s=t(e,e.children))}),s})(null,this.$account.$mailboxes),s=null===n?this.$account.$mailboxes:n.children,o=_.indexOf(_.map(s,"id"),this.id),this.$save().then(function(e){var t,n=i.path;i.init(e),s.splice(o,1),t=_.find(s,function(e){return"folder"==e.type&&e.name.localeCompare(i.name)>0}),o=t?_.indexOf(_.map(s,"id"),t.id):s.length,s.splice(o,0,i);var a=new RegExp("^"+n),r=function(e){_.forEach(e.children,function(e){e.path=e.path.replace(a,i.path),e.id=e.$id(),r(e)})};r(i)}))},e.prototype.$compact=function(){var t=this;return e.$$resource.post(this.id,"expunge").then(function(e){e.quotas&&t.$account.updateQuota(e.quotas)})},e.prototype.$canFolderAs=function(){return"folder"==this.type&&0===this.level},e.prototype.$setFolderAs=function(t){return e.$$resource.post(this.id,"setAs"+t+"Folder")},e.prototype.$emptyTrash=function(){var t=this;return e.$$resource.post(this.id,"emptyTrash").then(function(e){t.$messages=[],t.uidsMap={},t.unseenCount=0,angular.isDefined(t.children)&&t.children.length&&t.$account.$getMailboxes({reload:!0}),e.quotas&&t.$account.updateQuota(e.quotas)})},e.prototype.$markAsRead=function(){var t=this;return e.$$resource.post(this.id,"markRead").then(function(){t.unseenCount=0,_.forEach(t.$messages,function(e){e.isread=!0})})},e.prototype.$flagMessages=function(t,n,s){var o={msgUIDs:_.map(t,"uid"),flags:n,operation:s};return e.$$resource.post(this.id,"addOrRemoveLabel",o).then(function(){return t})},e.prototype.saveSelectedMessages=function(){var t,n;return t=_.filter(this.$messages,function(e){return e.selected}),{uids:n=_.map(t,"uid")},{filename:l("Saved Messages.zip")},e.$$resource.download(this.id,"saveMessages",{uids:n})},e.prototype.exportFolder=function(){var t;return t={filename:this.name+".zip"},e.$$resource.download(this.id,"exportFolder",null,t)},e.prototype.$delete=function(t){var n=this;return e.$$resource.post(this.id,"delete",t).then(function(){return n.$account.$getMailboxes({reload:!0}),!0})},e.prototype.$_deleteMessages=function(e,t){var n,s=this,o=this.$messages.length;return n=_.filter(t,function(e,t){return!e.isread}),this.unseenCount-=n.length,_.forEachRight(this.$messages,function(t,n){var i=_.findIndex(e,function(e){return t.uid==e});i>-1?(e.splice(i,1),delete s.uidsMap[t.uid],t.uid==s.selectedMessage&&delete s.selectedMessage,s.$messages.splice(n,1),nt.uids.length-1)&&(n.$topIndex=0),n.init(t),n.uids&&(e.$log.debug("unwrapping "+n.uids.length+" messages"),a=_.invokeMap(n.headers[0],"toLowerCase"),n.headers.splice(0,1),n.threaded&&(i=n.uids[0],n.uids.splice(0,1)),_.reduce(n.uids,function(t,s,a){var r,l;return r=n.threaded?_.zipObject(i,s):{uid:s.toString()},n.uidsMap[r.uid]=a,(l=new e.$Message(n.$account.id,n,r,!0)).selected=o.indexOf(l.uid)>-1,t.push(l),t},n.$messages),_.forEach(n.headers,function(e){var t=_.zipObject(a,e),s=n.uidsMap[t.uid.toString()];_.extend(n.$messages[s],t)})),e.$log.debug("mailbox "+n.id+" ready"),n.$isLoading=!1,s.resolve(n.$messages)})},function(e){angular.extend(n,e),n.isError=!0,n.$isLoading=!1,s.reject()}),s.promise},e.prototype.$unwrapHeaders=function(t){var n=this;t.then(function(t){e.$timeout(function(){var e,s;t.length>0&&(e=_.invokeMap(t[0],"toLowerCase"),t.splice(0,1),_.forEach(t,function(t){t=_.zipObject(e,t),s=n.uidsMap[t.uid.toString()],angular.isDefined(s)&&_.extend(n.$messages[s],t)}))})})},e.prototype.$updateSubscribe=function(){var t=this.subscribed?"subscribe":"unsubscribe";e.$$resource.post(this.id,t)}}(),function(){"use strict";function e(e,t,n,s){this.accountId=e,this.$mailbox=t,this.$hasUnsafeContent=!1,this.$loadUnsafeContent=!1,this.editable={to:[],cc:[],bcc:[]},this.selected=!1,"function"!=typeof n.then?(!angular.isUndefined(s)&&s||(angular.extend(this,n),this.$formatFullAddresses()),this.uid=parseInt(n.uid)):this.$unwrap(n)}e.$factory=["$q","$timeout","$log","sgSettings","sgMessage_STATUS","Resource","Preferences",function(t,n,s,o,i,a,r){return angular.extend(e,{STATUS:i,$q:t,$timeout:n,$log:s,$$resource:new a(o.activeUser("folderURL")+"Mail",o.activeUser()),$avatar:angular.bind(r,r.avatar)}),r.defaults.SOGoMailLabelsColors&&(e.$tags=r.defaults.SOGoMailLabelsColors),r.defaults.SOGoMailDisplayRemoteInlineImages&&"always"==r.defaults.SOGoMailDisplayRemoteInlineImages&&(e.$displayRemoteInlineImages=!0),e}];try{angular.module("SOGo.MailerUI")}catch(e){angular.module("SOGo.MailerUI",["SOGo.Common"])}angular.module("SOGo.MailerUI").constant("sgMessage_STATUS",{NOT_LOADED:0,DELAYED_LOADING:1,LOADING:2,LOADED:3,DELAYED_MS:300}).factory("Message",e.$factory),e.filterTags=function(t,n){var s=new RegExp(t,"i"),o=[];return _.forEach(_.keys(e.$tags),function(t){var i=e.$tags[t];-1!=i[0].search(s)&&(_.includes(n,t)||o.push({name:t,description:i[0],color:i[1]}))}),o},e.prototype.$absolutePath=function(t){var n=this,s=this.id;function o(){var e;return(e=_.map(n.$mailbox.path.split("/"),function(e){return"folder"+e.asCSSIdentifier()})).splice(0,0,n.accountId),e.join("/")}return(angular.isUndefined(this.id)||t&&t.nocache)&&(this.id=o()+"/"+this.uid,s=this.id),t&&t.asDraft&&this.draftId&&(s=o()+"/"+this.draftId),t&&t.withResourcePath&&(s=e.$$resource.path(s)),s},e.prototype.$setUID=function(e){var t,n=this.uid||-1,s=this;n!=parseInt(e)&&(this.uid=parseInt(e),this.$absolutePath({nocache:!0}),n>-1?(n=n.toString(),angular.isDefined(this.$mailbox.uidsMap[n])&&(t=this.$mailbox.uidsMap[n],this.$mailbox.uidsMap[e]=t,delete this.$mailbox.uidsMap[n],_.forEach(["from","to","subject"],function(e){s.$mailbox.$messages[t][e]=s[e]}))):this.$mailbox.constructor.selectedFolder&&"draft"==this.$mailbox.constructor.selectedFolder.type&&this.$mailbox.constructor.selectedFolder.$filter())},e.prototype.$formatFullAddresses=function(){var t=this,n=_.map(t.$mailbox.$account.identities,"email");_.forEach(["from","to","cc","bcc","reply-to"],function(s){_.forEach(t[s],function(t){t.name&&t.name!=t.email?(t.full=t.name+" <"+t.email+">",t.name.length<10?t.shortname=t.name:t.name.split(" ").length&&(t.shortname=_.first(_.last(t.name.split(/, */)).split(/ +/)).replace("'",""))):t.email&&(t.full="<"+t.email+">",t.shortname=t.email.split("@")[0]),t.image=e.$avatar(t.email,32),_.indexOf(n,t.email)>=0&&(t.shortname=l("me"))})})},e.prototype.$shortRecipients=function(e){var t=this,n=[],s=0,o=0;return _.forEach(["to","cc","bcc"],function(i){o+=t[i]?t[i].length:0,_.forEach(t[i],function(t,o){se&&n.push(l("and %{0} more...",o-e)),n.join(", ")},e.prototype.$shortAddress=function(e){var t="";return this[e]&&this[e].length>0&&(t=this[e][0].name||this[e][0].email||""),t},e.prototype.allowReplyAll=function(){var e=0;return e=_.reduce(["to","cc"],_.bind(function(e,t){return this[t]?e+this[t].length:e},this),e),!this.isDraft&&e>1},e.prototype.loadUnsafeContent=function(){this.$loadUnsafeContent=!0},e.prototype.$content=function(){var t=this,n=[],s=function(o){if(o.msgclass="msg-attachment-other","UIxMailPartAlternativeViewer"==o.type)s(_.find(o.content,function(e){return o.preferredPart==e.contentType}));else if(angular.isArray(o.content)){if("UIxMailPartSignedViewer"==o.type&&1===o["supports-smime"]){var i="

"+o.error.replace(/\n/,'

');i=i.replace(/\n/g,'

')+"

",t.$smime={validSignature:o.valid,certificate:o.certificates[o.certificates.length-1],message:i}}else"UIxMailPartEncryptedViewer"==o.type&&(t.$smime={message:"THIS MAIL IS ENCRYPTED!"});_.forEach(o.content,function(e){s(e)})}else angular.isUndefined(o.safeContent)&&(o.safeContent=o.content,t.$hasUnsafeContent|=o.safeContent.indexOf(" unsafe-")>-1),"UIxMailPartHTMLViewer"==o.type?(o.html=!0,t.$loadUnsafeContent||e.$displayRemoteInlineImages?(angular.isUndefined(o.unsafeContent)&&(o.unsafeContent=document.createElement("div"),o.unsafeContent.innerHTML=o.safeContent,angular.forEach(["src","data","classid","background","style"],function(e){var t,n,s,i=o.unsafeContent.querySelectorAll("[unsafe-"+e+"]");for(s=0;s"}),n={to:t},_.forEach(["subject","body"],function(t){var o=new RegExp(t+"=([^&]+)");t="body"==t?"text":t,(s=o.exec(e))&&(n[t]=decodeURIComponent(s[1]))}),_.forEach(["cc","bcc"],function(t){var o=new RegExp(t+"=([^&]+)");(s=o.exec(e))&&(n[t]=_.map(decodeURIComponent(s[1]).split(","),function(e){return"<"+e.trim()+">"}))}),angular.extend(this.editable,n))},e.prototype.$reply=function(){return this.$newDraft("reply")},e.prototype.$replyAll=function(){return this.$newDraft("replyall")},e.prototype.$forward=function(){return this.$newDraft("forward")},e.prototype.$newDraft=function(t){var n=this;return e.$$resource.fetch(this.$absolutePath(),t).then(function(s){var o,i;return e.$log.debug("New "+t+": "+JSON.stringify(s,void 0,2)),o=n.$mailbox.$account.$getMailboxByPath(s.mailboxPath),i=new e(s.accountId,o,s),e.$$resource.fetch(i.$absolutePath({asDraft:!0}),"edit").then(function(s){return e.$log.debug("New "+t+": "+JSON.stringify(s,void 0,2)+" original UID: "+n.uid),angular.extend(i.editable,s),i.origin={message:n,action:t},i})})},e.prototype.$save=function(){var t=this,n=this.editable;return e.$log.debug("save = "+JSON.stringify(n,void 0,2)),e.$$resource.save(this.$absolutePath({asDraft:!0}),n).then(function(n){e.$log.debug("save = "+JSON.stringify(n,void 0,2)),t.$setUID(n.uid),t.$reload(),t.isNew=!1})},e.prototype.$send=function(){var t=this,n=angular.copy(this.editable);return e.$log.debug("send = "+JSON.stringify(n,void 0,2)),e.$$resource.post(this.$absolutePath({asDraft:!0}),"send",n).then(function(n){return"success"==n.status?(angular.isDefined(t.origin)&&(t.origin.action.startsWith("reply")?t.origin.message.isanswered=!0:"forward"==t.origin.action&&(t.origin.message.isforwarded=!0)),n):e.$q.reject(n.data)})},e.prototype.$unwrap=function(t){var n=this;return this.$loaded=e.STATUS.DELAYED_LOADING,e.$timeout(function(){n.$loaded!=e.STATUS.LOADED&&(n.$loaded=e.STATUS.LOADING)},e.STATUS.DELAYED_MS),this.$futureMessageData=t.then(function(t){return 0===n.isread&&(n.isread=!0,n.$mailbox.unseenCount--),e.$timeout(function(){return angular.extend(n,t),n.$formatFullAddresses(),n.$loadUnsafeContent=!1,n.$loaded=e.STATUS.LOADED,n})}),this.$futureMessageData},e.prototype.$omit=function(e){var t={},n=e&&e.privateAttributes;return angular.forEach(this,function(e,s){("constructor"!=s&&"$"!=s[0]||n)&&(t[s]=e)}),t},e.prototype.download=function(){var t,n;return t={uids:[this.uid]},n={filename:this.subject+".zip"},e.$$resource.download(this.$mailbox.id,"saveMessages",t,n)},e.prototype.downloadAttachments=function(){var t;return t={filename:l("attachments")+"-"+this.uid+".zip"},e.$$resource.download(this.$absolutePath(),"archiveAttachments",null,t)}}(),function(){"use strict";function e(){this.show=!1,this.message=null,this.elements=[]}e.$factory=["$document","$timeout","$mdPanel","sgHotkeys",function(t,n,s,o){return angular.extend(e,{$document:t,$timeout:n,$mdPanel:s,sgHotkeys:o}),new e}],e.prototype.setMessage=function(e){this.message=e},e.prototype.registerImage=function(e){this.elements.push(e)},e.prototype.registerHotkeys=function(t){this.keys=[e.sgHotkeys.createHotkey({key:"left",description:l("View previous item"),callback:angular.bind(t,t.previousImage)}),e.sgHotkeys.createHotkey({key:"right",description:l("View next item"),callback:angular.bind(t,t.nextImage)})],_.forEach(this.keys,function(t){e.sgHotkeys.registerHotkey(t)})},e.prototype.showGallery=function(t,n){var s=this,o=e.$mdPanel,i=angular.element(this.message.parts.content[n].content).find("img")[0].src,a=_.filter(this.message.attachmentAttrs,function(e){return 0===e.mimetype.indexOf("image/")}),r=_.findIndex(a,function(e){return e.url.indexOf(i)>=0});angular.element(e.$document[0].body).addClass("sg-image-gallery-backdrop");var c=o.newPanelPosition().absolute(),u=o.newPanelAnimation().openFrom(t.target).duration(100).withAnimation(o.animation.FADE),d={attachTo:angular.element(document.body),locals:{lastIndex:a.length-1,images:a,selectedIndex:r,selectedImage:a[r]},bindToController:!0,controller:h,controllerAs:"$panelCtrl",position:c,animation:u,targetEvent:t,fullscreen:!0,hasBackdrop:!0,template:['','
',' '," arrow_back"," ",' image','
',' '," file_download"," ","
",'
',' '," navigate_before"," ",' ',' '," navigate_next"," ","
",'
','
',' ',"
","
","
"].join(""),trapFocus:!0,clickOutsideToClose:!0,escapeToClose:!0,focusOnOpen:!0,onOpenComplete:function(){s.show=!0,_.forEach(e.$document.find("sg-image-gallery")[0].getElementsByClassName("sg-image-thumbnail"),function(t){var n=t.children[0];angular.element(n).one("load",function(){n.naturalWidth0&&this.selectImage(this.selectedIndex-1)}}},angular.module("SOGo.MailerUI").factory("ImageGallery",e.$factory)}(),function(){"use strict";function e(e){this.$account=e}e.$factory=["$q","$timeout","$log","sgSettings","Resource","Message","Mailbox","sgMailbox_PRELOAD",function(t,n,s,o,i,a,r,l){return angular.extend(e,{$q:t,$timeout:n,$log:s,$$resource:new i(o.activeUser("folderURL")+"Mail",o.activeUser()),$Message:r,selectedFolder:null,PRELOAD:l}),e}];try{angular.module("SOGo.MailerUI")}catch(e){angular.module("SOGo.MailerUI",["SOGo.Common"])}angular.module("SOGo.MailerUI").constant("sgMailbox_PRELOAD",{LOOKAHEAD:50,SIZE:100}).factory("VirtualMailbox",e.$factory),e.$absolutePath=function(e){return[e,"virtual"].join("/")},e.prototype.init=function(e){this.$isLoading=!1,this.$mailboxes=[],this.uidsMap={},angular.extend(this,e),this.id=this.$id()},e.prototype.setMailboxes=function(e){this.$mailboxes=e,_.forEach(this.$mailboxes,function(e){e.$messages=[],e.uidsMap={}})},e.prototype.startSearch=function(t,n){var s=this,o=e.$q.when();this.$isLoading=!0,_.forEach(this.$mailboxes,function(i){o=o.then(function(){if(s.$isLoading)return e.$log.debug("searching mailbox "+i.path),i.$filter({sort:"date",asc:!1,match:t},n)})}),o.finally(function(){s.$isLoading=!1})},e.prototype.stopSearch=function(){e.$log.debug("stopping search..."),this.$isLoading=!1},e.prototype.selectFolder=function(){},e.prototype.resetSelectedMessage=function(){_.forEach(this.$mailboxes,function(e){delete e.selectedMessage})},e.prototype.hasSelectedMessage=function(){return angular.isDefined(_.find(this.$mailboxes,function(e){return angular.isDefined(e.selectedMessage)}))},e.prototype.isSelectedMessage=function(e,t){return angular.isDefined(_.find(this.$mailboxes,function(n){return n.path==t&&n.selectedMessage==e}))},e.prototype.getLength=function(){var e=0;return angular.isDefined(this.$mailboxes)?(_.forEach(this.$mailboxes,function(t){e+=t.$messages.length}),e):e},e.prototype.getItemAtIndex=function(e){var t,n,s,o,i;if(angular.isDefined(this.$mailboxes)&&e>=0)for(t=0,n=0;n0){var s=_.map(t,"uid");i.push(t);var r=e.$$resource.post(n,"addOrRemoveLabel",_.assign(o,{msgUIDs:s}));a.push(r)}}),e.$q.all(a).then(function(){return _.flatten(i)})},e.prototype.$deleteMessages=function(t){var n=[];return _.forEach(t,function(e,t){if(e.length>0){var s=e[0].$mailbox.$deleteMessages(e);n.push(s)}}),e.$q.all(n)},e.prototype.$markOrUnMarkMessagesAsJunk=function(t){var n=[];return _.forEach(t,function(e,t){if(e.length>0){var s=e[0].$mailbox.$markOrUnMarkMessagesAsJunk(e);n.push(s)}}),e.$q.all(n)},e.prototype.$copyMessages=function(t,n){var s=[];return _.forEach(t,function(e,t){if(e.length>0){var o=e[0].$mailbox.$copyMessages(e,n);s.push(o)}}),e.$q.all(s)},e.prototype.$moveMessages=function(t,n){var s=[];return _.forEach(t,function(e,t){if(e.length>0){var o=e[0].$mailbox.$moveMessages(e,n);s.push(o)}}),e.$q.all(s)}}(),function(){"use strict";e.$inject=["$window","$scope","$timeout","$q","$state","$mdDialog","$mdToast","stateAccounts","stateAccount","stateMailbox","sgHotkeys","encodeUriFilter","sgSettings","sgFocus","Dialog","Preferences","Account","Mailbox"];function e(e,t,n,s,o,i,a,r,c,u,d,h,g,f,m,p,$,b){var v=this,M=angular.element(e.document).find("title").attr("sg-default")||"SOGo",y=[];this.$onInit=function(){e.$mailboxController=v,this.service=b,this.accounts=r,this.account=c,this.selectedFolder=u,this.messageDialog=null,this.mode={search:!1,multiple:0},(n=y).push(d.createHotkey({key:l("hotkey_search"),description:l("Search"),callback:v.searchMode})),n.push(d.createHotkey({key:l("hotkey_compose"),description:l("Write a new message"),callback:function(e){null===v.messageDialog&&v.newMessage(e)}})),n.push(d.createHotkey({key:l("hotkey_junk"),description:l("Mark the selected messages as junk"),callback:v.markOrUnMarkMessagesAsJunk})),n.push(d.createHotkey({key:"space",description:l("Toggle item"),callback:v.toggleMessageSelection})),n.push(d.createHotkey({key:"shift+space",description:l("Toggle range of items"),callback:v.toggleMessageSelection})),n.push(d.createHotkey({key:"up",description:l("View next item"),callback:C,preventInClass:["sg-mail-part"]})),n.push(d.createHotkey({key:"down",description:l("View previous item"),callback:w,preventInClass:["sg-mail-part"]})),n.push(d.createHotkey({key:"shift+up",description:l("Add next item to selection"),callback:I,preventInClass:["sg-mail-part"]})),n.push(d.createHotkey({key:"shift+down",description:l("Add previous item to selection"),callback:E,preventInClass:["sg-mail-part"]})),_.forEach(["backspace","delete"],function(e){n.push(d.createHotkey({key:e,description:l("Delete selected message or folder"),callback:v.confirmDeleteSelectedMessages}))}),_.forEach(n,function(e){d.registerHotkey(e)});var n;angular.element(e).on("beforeunload",x),t.$on("$destroy",function(){angular.element(e).off("beforeunload",x),_.forEach(y,function(e){d.deregisterHotkey(e)})}),t.$watch(function(){return v.selectedFolder.unseenCount},function(t){var n=M+" - ";t&&(n+="("+t+") "),n+=v.selectedFolder.$displayName,e.document.title=n})};function x(e){return v.selectedFolder.$compact()}this.centerIsClose=function(e){return this.selectedFolder.hasSelectedMessage()&&!!e},this.sort=function(e){v.selectedFolder.$filter({sort:e})},this.sortedBy=function(e){return b.$query.sort==e},this.searchMode=function(){v.mode.search=!0,f("search")},this.cancelSearch=function(){v.mode.search=!1,v.selectedFolder.$filter().then(function(){v.selectedFolder.selectedMessage&&n(function(){v.selectedFolder.$topIndex=v.selectedFolder.uidsMap[v.selectedFolder.selectedMessage]})})},this.composeWindowEnabled=function(){return p.defaults.SOGoMailComposeWindowEnabled},this.newMessage=function(t,n){var s;null===v.messageDialog&&(n||"popup"==p.defaults.SOGoMailComposeWindow?function(){var t=[g.baseURL(),"UIxMailPopupView#!/Mail",v.account.id,h(h(v.selectedFolder.path)),"new"].join("/"),n=v.selectedFolder.$id()+"/"+Math.random(0,1e3);console.debug(t),e.open(t,n,["width=680","height=520","resizable=1","scrollbars=1","toolbar=0","location=0","directories=0","status=0","menubar=0","copyhistory=0"].join(","))}():(s=v.account.$newMessage(),v.messageDialog=i.show({parent:angular.element(document.body),targetEvent:t,clickOutsideToClose:!1,escapeToClose:!1,templateUrl:"UIxMailEditor",controller:"MessageEditorController",controllerAs:"editor",locals:{stateAccount:v.account,stateMessage:s}}).catch().finally(function(){v.messageDialog=null})))};function C(e){var t=v.selectedFolder.$selectedMessageIndex();return angular.isDefined(t)?(t--,v.selectedFolder.$topIndex>0&&v.selectedFolder.$topIndex--):(t=v.selectedFolder.getLength()-1,v.selectedFolder.$topIndex=v.selectedFolder.getLength()),t>-1&&v.selectMessage(v.selectedFolder.$messages[t]),e.preventDefault(),t}function w(e){var t=v.selectedFolder.$selectedMessageIndex();return angular.isDefined(t)?(t++,v.selectedFolder.$topIndex=0&&v.toggleMessageSelection(e,v.selectedFolder.$messages[t])}function E(e){var t;v.selectedFolder.hasSelectedMessage()&&(t=w(e))>=0&&v.toggleMessageSelection(e,v.selectedFolder.$messages[t])}this.selectMessage=function(e){b.$virtualMode?o.go("mail.account.virtualMailbox.message",{mailboxId:h(e.$mailbox.path),messageId:e.uid}):o.go("mail.account.mailbox.message",{messageId:e.uid})},this.toggleMessageSelection=function(e,t){var n,s,o,i=v.selectedFolder;if(t||(t=i.$selectedMessage()),!t)return!0;if(t.selected=!t.selected,v.mode.multiple+=t.selected?1:-1,e.shiftKey&&i.$selectedCount()>1){for(s=(n=i.uidsMap[t.uid])-2;s>=0&&!i.$messages[s].selected;)s--;if(s<0)for(s=n+2;s=0&&s0&&(a-=1,s=v.selectedFolder.$messages[a]),t0&&(v.messageDialog=m.confirm(l("Confirmation"),l("Are you sure you want to delete the selected messages?"),{ok:l("Delete")}).then(function(){var e=v.selectedFolder.hasSelectedMessage();v.selectedFolder.$deleteMessages(t).then(function(t){b.$virtualMode?e&&o.go("mail.account.virtualMailbox"):A(e,t)},function(n){v.messageDialog=m.confirm(l("Warning"),l("The messages could not be moved to the trash folder. Would you like to delete them immediately?"),{ok:l("Delete")}).then(function(){v.selectedFolder.$deleteMessages(t,{withoutTrash:!0}).then(function(t){b.$virtualMode?e&&o.go("mail.account.virtualMailbox"):A(e,t)})})})}).finally(function(){v.messageDialog=null})),e.preventDefault()},this.markOrUnMarkMessagesAsJunk=function(){var e=v.selectedFolder.hasSelectedMessage(),t=v.selectedFolder.$selectedMessages();0===_.size(t)&&e&&(t=[v.selectedFolder.$selectedMessage()]),_.size(t)>0&&v.selectedFolder.$markOrUnMarkMessagesAsJunk(t).then(function(){var n="/"+v.account.id+"/folderINBOX";"junk"!=v.selectedFolder.type&&(n="/"+v.account.$getMailboxByType("junk").id),v.selectedFolder.$moveMessages(t,n).then(function(t){b.$virtualMode?e&&o.go("mail.account.virtualMailbox"):A(e,t)})})},this.copySelectedMessages=function(e){var t=v.selectedFolder.$selectedMessages();_.size(t)>0&&v.selectedFolder.$copyMessages(t,"/"+e).then(function(){a.show(a.simple().content(l("%{0} message(s) copied",v.selectedFolder.$selectedCount())).position("top right").hideDelay(2e3))})},this.moveSelectedMessages=function(e){var t=v.selectedFolder.hasSelectedMessage(),n=v.selectedFolder.$selectedMessages(),s=v.selectedFolder.$selectedCount();_.size(n)>0&&v.selectedFolder.$moveMessages(n,"/"+e).then(function(e){a.show(a.simple().content(l("%{0} message(s) moved",s)).position("top right").hideDelay(2e3)),b.$virtualMode?t&&o.go("mail.account.virtualMailbox"):A(t,e)})},this.selectAll=function(){var e=0;_.forEach(S(),function(t){for(var n=0,s=t.$messages.length;n0&&v.selectedFolder.$flagMessages(e,"\\Flagged","add").then(function(e){_.forEach(e,function(e){e.isflagged=!0})})},this.markSelectedMessagesAsUnread=function(){var e=v.selectedFolder.$selectedMessages();_.size(e)>0&&v.selectedFolder.$flagMessages(e,"seen","remove").then(function(e){_.forEach(e,function(e){e.isread&&e.$mailbox.unseenCount++,e.isread=!1})})},this.markSelectedMessagesAsRead=function(){var e=v.selectedFolder.$selectedMessages();_.size(e)>0&&v.selectedFolder.$flagMessages(e,"seen","add").then(function(e){_.forEach(e,function(e){e.isread||e.$mailbox.unseenCount--,e.isread=!0})})}}angular.module("SOGo.MailerUI").controller("MailboxController",e),t.$inject=["$delegate"];function t(e){return e[0].controller.prototype.resetScroll=function(){"messagesList"==this.$element.parent().attr("id")?this.updateSize():this.scrollTo(0)},e}angular.module("material.components.virtualRepeat").decorator("mdVirtualRepeatContainerDirective",t)}(),function(){"use strict";e.$inject=["$scope","$state","$transitions","$timeout","$window","$mdDialog","$mdToast","sgFocus","encodeUriFilter","Dialog","sgSettings","sgHotkeys","Account","Mailbox","VirtualMailbox","User","Preferences","stateAccounts"];function e(e,t,n,s,o,i,a,r,c,u,d,h,g,f,m,p,$,b){var v,M,y=this,x=[];this.$onInit=function(){this.service=f,this.accounts=b,this.currentSearchParam="",this.search={options:{"":"",subject:l("Enter Subject"),from:l("Enter From"),to:l("Enter To"),cc:l("Enter Cc"),body:l("Enter Body")},subfolders:1,match:"AND",params:[]},this.showSubscribedOnly=$.defaults.SOGoMailShowSubscribedFoldersOnly,this.refreshUnseenCount(),t=x,_.forEach(["backspace","delete"],function(e){t.push(h.createHotkey({key:e,description:l("Delete selected message or folder"),callback:function(){f.selectedFolderController&&f.selectedFolder&&!f.selectedFolder.hasSelectedMessage()&&f.selectedFolderController.confirmDelete(f.selectedFolder)}}))}),_.forEach(t,function(e){h.registerHotkey(e)});var t;e.$on("$destroy",function(){_.forEach(x,function(e){h.deregisterHotkey(e)})})};this.hideAdvancedSearch=function(){y.service.$virtualPath=!1,y.service.$virtualMode=!1,v=y.accounts[0],M=y.searchPreviousMailbox,t.go("mail.account.mailbox",{accountId:v.id,mailboxId:c(M.path)})},this.toggleAdvancedSearch=function(){if(f.selectedFolder.$isLoading)y.virtualMailbox.stopSearch();else{var e,n=[],s=function(e){_.forEach(e,function(e){n.push(e),e.children&&e.children.length>0&&s(e.children)})};y.virtualMailbox=new m(y.accounts[0]),f.$virtualMode||(y.searchPreviousMailbox=f.selectedFolder),f.selectedFolder=y.virtualMailbox,f.$virtualMode=!0,angular.isDefined(f.$virtualPath)?(e=y.accounts[0].$getMailboxByPath(f.$virtualPath),n.push(e),y.search.subfolders&&e.children.length&&s(e.children)):n=y.accounts[0].$flattenMailboxes(),y.virtualMailbox.setMailboxes(n),y.virtualMailbox.startSearch(y.search.match,y.search.params),"mail.account.virtualMailbox"!=t.$current.name&&t.go("mail.account.virtualMailbox",{accountId:y.accounts[0].id})}},this.addSearchParam=function(e){return y.currentSearchParam=e,r("advancedSearch"),!1},this.newSearchParam=function(e){if(e.length&&y.currentSearchParam.length){var t=0,n=y.currentSearchParam;return e.startsWith("!")&&(t=1,e=e.substring(1).trim()),y.currentSearchParam="",{searchBy:n,searchInput:e,negative:t}}},this.toggleAccountState=function(e){e.$expanded=!e.$expanded,e.$flattenMailboxes({reload:!0,saveState:!0}),s(function(){angular.element(o).triggerHandler("resize")},150)},this.subscribe=function(e){i.show({templateUrl:e.id+"/subscribe",controller:t,controllerAs:"subscriptions",clickOutsideToClose:!0,escapeToClose:!0,locals:{srcAccount:e}}).finally(function(){e.$getMailboxes({reload:!0})}),t.$inject=["$scope","$mdDialog","srcAccount"];function t(e,t,n){var s=this;s.loading=!0,s.filter={name:""},s.account=new g({id:n.id,name:n.name}),s.close=function(){t.hide()},s.account.$getMailboxes({reload:!0,all:!0}).then(function(){s.loading=!1})}},this.newFolder=function(e){u.prompt(l("New Folder..."),l("Enter the new name of your folder")).then(function(t){e.$newMailbox(e.id,t).then(function(){},function(e,n){u.alert(l('An error occured while creating the mailbox "%{0}".',t),l(e.error))})})},this.delegate=function(e){i.show({templateUrl:e.id+"/delegation",controller:t,controllerAs:"delegate",clickOutsideToClose:!0,escapeToClose:!0,locals:{User:p,account:e}}),t.$inject=["$scope","$mdDialog","User","account"];function t(e,t,n,s){var o=this;o.users=s.delegates,o.account=s,o.userToAdd="",o.searchText="",o.userFilter=function(e){return n.$filter(e,s.delegates)},o.closeModal=function(){t.hide()},o.removeUser=function(e){s.$removeDelegate(e.uid).catch(function(e,t){u.alert(l("Warning"),l("An error occured please try again."))})},o.addUser=function(e){e&&s.$addDelegate(e).then(function(){o.userToAdd="",o.searchText=""},function(e){u.alert(l("Warning"),e)})}}},this.refreshUnseenCount=function(){var e,t=o.unseenCountFolders;_.forEach(y.accounts,function(e){_.includes(t,e.id+"/folderINBOX")||t.push(e.id+"/folderINBOX"),_.forEach(e.$$flattenMailboxes,function(e){angular.isDefined(e.unseenCount)&&!_.includes(t,e.id)&&t.push(e.id)})}),g.$$resource.post("","unseenCount",{mailboxes:t}).then(function(e){_.forEach(y.accounts,function(t){_.forEach(t.$$flattenMailboxes,function(t){e[t.id]&&(t.unseenCount=e[t.id])})})}),(e=$.defaults.SOGoRefreshViewCheck)&&"manually"!=e&&s(y.refreshUnseenCount,1e3*e.timeInterval())},this.isDroppableFolder=function(e,t){return t.id!=e.id&&!t.isNoSelect()},this.dragSelectedMessages=function(e,n,s){var o,i,r,c,u,d;o="/"+n.id,0===(i=e.$selectedMessages()).length&&(i=[e.$selectedMessage()]),r=_.map(i,"uid"),c=e.selectedMessage&&r.indexOf(e.selectedMessage)>=0,"copy"==s?(u=e.$copyMessages(i,o),d=l("%{0} message(s) copied",i.length)):(u=e.$moveMessages(i,o),d=l("%{0} message(s) moved",i.length)),u.then(function(){c&&t.go("mail.account.mailbox"),a.show(a.simple().content(d).position("top right").hideDelay(2e3))})}}angular.module("SOGo.MailerUI").controller("MailboxesController",e)}(),function(){"use strict";e.$inject=["$window","$scope","$state","$mdMedia","$mdDialog","sgConstant","stateAccounts","stateAccount","stateMailbox","stateMessage","sgHotkeys","encodeUriFilter","sgSettings","ImageGallery","sgFocus","Dialog","Preferences","Calendar","Component","Account","Mailbox","Message"];function e(e,t,n,s,o,i,a,r,c,u,d,h,g,f,m,p,$,b,v,M,y,x){var C=this,w=[];this.$onInit=function(){e.$messageController=C,f.setMessage(u),this.$state=n,this.accounts=a,this.account=r,this.mailbox=c,this.message=u,this.service=x,this.tags={searchText:"",selected:""},this.showFlags=u.flags&&u.flags.length>0,this.$showDetailedRecipients=!1,C.showRawSource=!1,(s=w).push(d.createHotkey({key:l("hotkey_reply"),description:l("Reply to the message"),callback:E(angular.bind(C,C.reply))})),s.push(d.createHotkey({key:l("hotkey_replyall"),description:l("Reply to sender and all recipients"),callback:E(angular.bind(C,C.replyAll))})),s.push(d.createHotkey({key:l("hotkey_forward"),description:l("Forward selected message"),callback:E(angular.bind(C,C.forward))})),s.push(d.createHotkey({key:l("hotkey_flag"),description:l("Flagged"),callback:E(angular.bind(u,u.toggleFlag))})),_.forEach(["backspace","delete"],function(e){s.push(d.createHotkey({key:e,callback:E(function(e){0===C.mailbox.$selectedCount()&&C.deleteMessage(),e.preventDefault()})}))}),_.forEach(s,function(e){d.registerHotkey(e)});var s;e.opener?(t.$watchCollection(function(){return C.message.flags},function(e,t){var n;(e||t)&&(n=S()).messageCtrl&&n.messageCtrl.service.$timeout(function(){n.messageCtrl.showFlags=!0,n.messageCtrl.message.flags=e})}),t.$watch(function(){return C.message.isflagged},function(e,t){var n=S();n.mailboxCtrl&&n.mailboxCtrl.service.$timeout(function(){_.find(n.mailboxCtrl.selectedFolder.$messages,{uid:C.message.uid}).isflagged=e})})):t.$watchCollection(function(){return C.message.flags},function(e,t){var n,s,o;(e||t)&&(n=e||[],s=t||[],_.forEach(n,function(e,t){angular.isObject(e)&&(n[t]=e.name)}),n.length>s.length?(o=_.difference(n,s),_.forEach(o,function(e){C.message.addTag(e)})):n.length0&&(t.mailbox.messageDialog=arguments[0]),t.mailbox.messageDialog):null}function E(e){return function(){if(null===I())return e.apply(C,arguments)}}function S(){var t,n,s={};return e.opener&&e.opener.$mailboxController&&e.opener.$mailboxController.selectedFolder.$id()==c.$id()&&(n=e.opener.$mailboxController,s.mailboxCtrl=n,e.opener.$messageController&&e.opener.$messageController.message.uid==u.uid&&(t=e.opener.$messageController,s.messageCtrl=t)),s}this.addFlags=function(e){this.showFlags=!0,m("flags")},this.toggleDetailedRecipients=function(e){this.$showDetailedRecipients=!this.$showDetailedRecipients,e.stopPropagation(),e.preventDefault()},this.filterMailtoLinks=function(e){var t;"A"==e.target.tagName&&"href"in e.target.attributes&&(t=e.target.attributes.href.value,/^mailto:([^\?]+)/.exec(t)&&(delete e.target.attributes.target,this.newMessage(e,t)))},this.deleteMessage=function(){var e,t,o,a,r,l=S();l.messageCtrl?(e=l.mailboxCtrl.selectedFolder,t=l.messageCtrl.message,o=l.messageCtrl.$state):(e=c,t=u,o=n),e.$deleteMessages([t]).then(function(n){var l=n;if(t=null,angular.isDefined(o)){n>0&&(l-=1,a=e.$messages[l]),ne.$lastVisibleIndex&&(e.$topIndex=l-(e.$lastVisibleIndex-e.$topIndex))):o.go("mail.account.mailbox").then(function(){t=null,delete e.selectedMessage})}catch(e){}}C.closePopup()})};function A(e,t){null===I()&&I(o.show({parent:angular.element(document.body),targetEvent:e,clickOutsideToClose:!1,escapeToClose:!1,templateUrl:"UIxMailEditor",controller:"MessageEditorController",controllerAs:"editor",locals:{stateAccount:C.account,stateMessage:t}}).finally(function(){I(null),C.closePopup()}))}this._showMailEditorInPopup=function(e){return!g.isPopup&&"popup"==$.defaults.SOGoMailComposeWindow&&(this.openInPopup(e),!0)},this.close=function(){n.go("mail.account.mailbox").then(function(){C.message=null,delete c.selectedMessage})},this.reply=function(e){this._showMailEditorInPopup("reply")||A(e,this.message.$reply())},this.replyAll=function(e){this._showMailEditorInPopup("replyall")||A(e,this.message.$replyAll())},this.forward=function(e){this._showMailEditorInPopup("forward")||A(e,this.message.$forward())},this.edit=function(e){this._showMailEditorInPopup("edit")||this.message.$editableContent().then(function(){A(e,C.message)})},this.openInPopup=function(t){var n=[g.baseURL(),"UIxMailPopupView#!/Mail",this.message.accountId,h(h(this.message.$mailbox.path)),this.message.uid].join("/"),s=this.message.$absolutePath();t&&(n+="/"+t),e.open(n,s,["width=680","height=520","resizable=1","scrollbars=1","toolbar=0","location=0","directories=0","status=0","menubar=0","copyhistory=0"].join(","))},this.closePopup=function(){e.opener&&e.close()},this.newMessage=function(e,t){e.stopPropagation(),e.preventDefault(),this.account.$newMessage({mailto:t}).then(function(t){A(e,t)})},this.toggleRawSource=function(e){this.showRawSource||this.message.$rawSource?this.showRawSource=!this.showRawSource:x.$$resource.post(this.message.id,"viewsource").then(function(e){C.message.$rawSource=e,C.showRawSource=!0})},this.print=function(t){e.print()},this.convertToEvent=function(e){return F(e,"appointment")},this.convertToTask=function(e){return F(e,"task")};function F(e,t){C.message.$plainContent().then(function(n){var s={pid:b.$defaultCalendar(),type:t,summary:n.subject,comment:n.content},i=new v(s),a=[g.activeUser("folderURL"),"Calendar","UIx"+t.capitalize()+"EditorTemplate"].join("/");return o.show({parent:angular.element(document.body),targetEvent:e,clickOutsideToClose:!0,escapeToClose:!0,templateUrl:a,controller:"ComponentEditorController",controllerAs:"editor",locals:{stateComponent:i}})})}}angular.module("SOGo.MailerUI").controller("MessageController",e)}(),function(){"use strict";e.$inject=["$scope","$window","$stateParams","$mdConstant","$mdDialog","$mdToast","FileUploader","stateAccount","stateMessage","encodeUriFilter","$timeout","Dialog","AddressBook","Card","Preferences"];function e(e,t,n,s,o,i,a,r,c,u,d,h,g,f,m){var p=this;p.addRecipient=function(e,t){var n,s,o,i,a,r=/([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)/i;if(n=p.message.editable[t],angular.isString(e)){for(a="",i=0;i',' '," {{$ctrl.mailbox.$icon}}"," ",'

',' ',' ',"

",' ',' '," ",' more_vert'].join(""),controller:"sgMailboxListItemController",controllerAs:"$ctrl"}})}(),function(){e.$inject=["$scope","$element","Mailbox"];function e(e,t,n){var s=this;this.$onInit=function(){this.MailboxService=n,e.$watch(function(){return s.message?[_.pick(s.message,["uid","isread","isflagged"])]:null},function(e,t){s.message&&s.onUpdate()},!0)},this.onUpdate=function(){this.message.isread?t.removeClass("unread"):t.addClass("unread"),n.selectedFolder.isSelectedMessage(this.message.uid,this.message.$mailbox.path)?t.addClass("md-default-theme md-accent md-bg md-hue-2"):t.removeClass("md-default-theme md-accent md-bg md-hue-2")},this.setVisibility=function(e,t){t?e.classList.remove("ng-hide"):e.classList.add("ng-hide")}}angular.module("SOGo.MailerUI").controller("sgMessageListItemController",e).directive("sgMessageListItem",function(){return{restrict:"C",scope:{},bindToController:{message:"=sgMessage"},controller:"sgMessageListItemController"}})}(),function(){e.$inject=["$scope","$element","$parse","$state","$mdUtil","$mdToast","Mailbox","Message","encodeUriFilter"];function e(e,t,n,s,o,i,a,r,l){var c=this;this.$postLink=function(){var n,s,i,l;this.parentController=e.parentController,i=this.parentController.onUpdate,l=this.parentController.setVisibility,_.forEach(t.find("div"),function(e){e.classList.contains("sg-tile-content")?n=angular.element(e):e.classList.contains("sg-tile-icons")&&(s=angular.element(e))}),this.priorityIconElement=n.find("md-icon")[0],a.$virtualMode&&(this.mailboxNameElement=n.find("span")[0],this.mailboxNameElement.classList.remove("ng-hide")),this.senderElement=n.find("span")[1],_.forEach(n.find("div"),function(e){e.classList.contains("sg-tile-subject")?c.subjectElement=e:e.classList.contains("sg-tile-size")?c.sizeElement=e:e.classList.contains("sg-tile-date")&&(c.dateElement=e)}),_.forEach(s.find("md-icon"),function(e){"star"==e.textContent?c.flagIconElement=e:"reply"==e.textContent?c.answerIconElement=e:"forward"==e.textContent?c.forwardIconElement=e:"attach_file"==e.textContent&&(c.attachmentIconElement=e)}),this.parentController.onUpdate=function(){var e;c.message=c.parentController.message;var n=o.nodesToArray(t[0].querySelectorAll(".sg-category"));for(_.forEach(n,function(e){t[0].removeChild(e)}),e=0;e');a.css("left",3*e+"px"),a.css("background-color",c.service.$tags[s][1]),t.prepend(a)}}c.mailboxNameElement&&(c.mailboxNameElement.innerHTML=c.message.$mailbox.$displayName),"sent"==c.MailboxService.selectedFolder.type?c.senderElement.innerHTML=c.message.$shortAddress("to").encodeEntities():c.senderElement.innerHTML=c.message.$shortAddress("from").encodeEntities(),c.message.priority&&c.message.priority.level<3?(c.priorityIconElement.classList.remove("ng-hide"),c.message.priority.level<2?c.priorityIconElement.classList.add("md-warn"):c.priorityIconElement.classList.remove("md-warn")):c.priorityIconElement.classList.add("ng-hide"),c.subjectElement.innerHTML=c.message.subject.encodeEntities(),c.sizeElement.innerHTML=c.message.size,c.dateElement.innerHTML=c.message.relativedate,l(c.flagIconElement,c.message.isflagged),l(c.answerIconElement,c.message.isanswered),l(c.forwardIconElement,c.message.isforwarded),l(c.attachmentIconElement,c.message.hasattachment),angular.bind(c.parentController,i)()},this.service=r,this.MailboxService=a}}angular.module("SOGo.MailerUI").controller("sgMessageListItemMainController",e).directive("sgMessageListItemMain",function(){return{restrict:"C",require:"^^sgMessageListItem",scope:{},template:['
','
',"
",' \x3c!-- mailbox --\x3e',' error'," \x3c!-- sender or recipient --\x3e","
",'
\x3c!-- date --\x3e
',"
",'
','
\x3c!-- subject --\x3e
','
\x3c!-- size --\x3e
',"
","
",'
',' star',' reply',' forward',' attach_file',"
",'
',' \x3c!-- message loading progress --\x3e',"
"].join(""),link:function(e,t,n,s){e.parentController=s},controller:"sgMessageListItemMainController",controllerAs:"$ctrl"}})}(),function(){"use strict";e.$inject=["$element","ImageGallery"];function e(e,t){var n=this;this.$postLink=function(){t.registerImage(e),e.on("click",this.showImage)},this.showImage=function(e){"IMG"==e.target.tagName&&t.showGallery(e,n.partIndex)}}angular.module("SOGo.MailerUI").directive("sgZoomableImage",function(){return{restrict:"A",bindToController:{partIndex:"=sgZoomableImage"},controller:e}})}(); //# sourceMappingURL=Mailer.services.js.map \ No newline at end of file diff --git a/UI/WebServerResources/js/Mailer.services.js.map b/UI/WebServerResources/js/Mailer.services.js.map index 361291185..0bf2ad4b2 100644 --- a/UI/WebServerResources/js/Mailer.services.js.map +++ b/UI/WebServerResources/js/Mailer.services.js.map @@ -1 +1 @@ -{"version":3,"sources":["Mailer/Account.service.js","Mailer/Mailbox.service.js","Mailer/Message.service.js","Mailer/sgImageGallery.service.js","Mailer/VirtualMailbox.service.js","Mailer/MailboxController.js","Mailer/MailboxesController.js","Mailer/MessageController.js","Mailer/MessageEditorController.js","Mailer/sgAccountSection.directive.js","Mailer/sgIMIP.directive.js","Mailer/sgMailboxListItem.directive.js","Mailer/sgMessageListItem.directive.js","Mailer/sgMessageListItemMain.directive.js","Mailer/sgZoomableImage.directive.js"],"names":["Account","futureAccountData","then","angular","extend","this","_","forEach","identities","identity","fullName","full","email","$log","debug","JSON","stringify","undefined","$factory","$q","$timeout","Settings","Resource","Preferences","Mailbox","Message","$$resource","activeUser","$Preferences","$Mailbox","$Message","module","e","factory","$findAll","data","$unwrapCollection","fetch","o","collection","i","id","$accounts","prototype","getLength","$flattenMailboxes","length","getItemAtIndex","index","expandedMailboxes","$getMailboxes","options","_this","$mailboxes","reload","$find","$expanded","expandedFolders","_visit","mailboxes","indexOf","children","settings","Mail","ExpandedFolders","isString","fromJson","warn","when","allMailboxes","push","all","$$flattenMailboxes","saveState","account","reduce","mailbox","post","$getMailboxByType","type","_find","find","$getMailboxByPath","path","$newMailbox","name","toString","$removeCertificate","updateQuota","percent","description","Math","round","usedSpace","maxQuota","l","formatted","$quota","$newMessage","accountId","mailboxPath","message","$absolutePath","asDraft","editable","isNew","mailto","isObject","$parseMailto","$addDelegate","user","deferred","defer","param","uid","map","delegates","resolve","users","status","reject","promise","$removeDelegate","splice","futureMailboxData","$account","init","newMailboxData","create","$unwrap","Acl","PRELOAD","$$Acl","$query","sort","asc","selectedFolder","$refreshTimeout","$virtualMode","$virtualPath","SortingState","parseInt","constant","LOOKAHEAD","SIZE","createMailboxes","level","quotas","split","component","asCSSIdentifier","join","isUndefined","uidsMap","headers","$isLoading","$messages","$id","$acl","$displayName","$isEditable","isEditable","$isSpecial","$icon","$isNoInferiors","isNoInferiors","$shadowData","$omit","selectFolder","$lastVisibleIndex","max","$loadMessage","$selectedMessages","filter","selected","$selectedCount","isSelectedMessage","messageId","selectedMessage","$selectedMessage","$selectedMessageIndex","hasSelectedMessage","isDefined","$filter","sortingAttributes","filters","unseenCount","cancel","searchInput","secondFilter","match","searchBy","copy","refreshViewCheck","defaults","SOGoRefreshViewCheck","f","bind","timeInterval","endIndex","uids","futureHeadersData","startIndex","loaded","subject","min","loading","$unwrapHeaders","flags","isNoSelect","getClassName","base","$rename","findParent","parent","parentMailbox","$save","sibling","oldPath","localeCompare","pathRE","RegExp","_updateChildren","child","replace","$compact","$canFolderAs","$setFolderAs","$emptyTrash","$markAsRead","isread","$flagMessages","messages","operation","msgUIDs","saveSelectedMessages","selectedMessages","selectedUIDs","filename","download","exportFolder","$delete","$_deleteMessages","unseen","firstIndex","forEachRight","selectedIndex","findIndex","$deleteMessages","$markOrUnMarkMessagesAsJunk","method","$copyMessages","folder","$moveMessages","$reset","value","key","save","response","error","$futureMailboxData","$topIndex","invokeMap","threaded","msgs","msg","msgObject","zipObject","isError","j","messageHeaders","$updateSubscribe","action","subscribed","futureMessageData","lazy","$mailbox","$hasUnsafeContent","$loadUnsafeContent","to","cc","bcc","$formatFullAddresses","Message_STATUS","STATUS","$avatar","avatar","SOGoMailLabelsColors","$tags","SOGoMailDisplayRemoteInlineImages","$displayRemoteInlineImages","NOT_LOADED","DELAYED_LOADING","LOADING","LOADED","DELAYED_MS","filterTags","query","excludedTags","re","results","keys","tag","pair","search","includes","color","buildPath","nocache","draftId","withResourcePath","$setUID","oldUID","attr","constructor","shortname","first","last","image","$shortRecipients","result","count","total","$shortAddress","address","allowReplyAll","recipientsCount","isDraft","loadUnsafeContent","$content","parts","part","msgclass","content","alternatePart","preferredPart","contentType","isArray","formattedMessage","$smime","validSignature","valid","certificate","certificates","mixedPart","safeContent","html","unsafeContent","document","createElement","innerHTML","suffix","element","elements","querySelectorAll","removeAttr","compile","$editableContent","from","toLowerCase","text","$plainContent","addTag","$addOrRemoveTag","removeTag","$imipAction","$reload","$sendMDN","shouldAskReceipt","$deleteAttachment","attachmentAttrs","attachment","toggleFlag","isflagged","$loaded","useCache","$futureMessageData","exec","decodeURIComponent","trim","$reply","$newDraft","$replyAll","$forward","origin","$send","startsWith","isanswered","isforwarded","privateAttributes","downloadAttachments","ImageGallery","show","$document","$mdPanel","sgHotkeys","setMessage","registerImage","registerHotkeys","$ctrl","createHotkey","callback","previousImage","nextImage","registerHotkey","showGallery","$event","partIndex","partSrc","src","images","attrs","mimetype","url","body","addClass","panelPosition","newPanelPosition","absolute","panelAnimation","newPanelAnimation","openFrom","target","duration","withAnimation","animation","FADE","config","attachTo","locals","lastIndex","selectedImage","bindToController","controller","PanelController","controllerAs","position","targetEvent","fullscreen","hasBackdrop","template","trapFocus","clickOutsideToClose","escapeToClose","focusOnOpen","onOpenComplete","getElementsByClassName","imgContainer","imgEl","one","naturalWidth","naturalHeight","classList","add","remove","onDomRemoved","removeClass","hotkeys","deregisterHotkey","open","mdPanelRef","$inject","close","selectImage","VirtualMailbox","setMailboxes","startSearch","params","finally","stopSearch","resetSelectedMessage","len","k","transform","messagesMap","sum","allMessages","promises","assign","flatten","MailboxController","$window","$scope","$state","$mdDialog","$mdToast","stateAccounts","stateAccount","stateMailbox","encodeUriFilter","sgSettings","focus","Dialog","vm","defaultWindowTitle","$onInit","$mailboxController","service","accounts","messageDialog","mode","multiple","searchMode","newMessage","markOrUnMarkMessagesAsJunk","toggleMessageSelection","_nextMessage","preventInClass","_previousMessage","_addNextMessageToSelection","_addPreviousMessageToSelection","hotkey","confirmDeleteSelectedMessages","on","_compactBeforeUnload","$on","off","$watch","title","event","centerIsClose","navController_centerIsClose","field","sortedBy","cancelSearch","composeWindowEnabled","SOGoMailComposeWindowEnabled","inPopup","SOGoMailComposeWindow","baseURL","wId","random","console","_newMessageInPopup","templateUrl","stateMessage","catch","selectMessage","preventDefault","go","mailboxId","nextSelectedIndex","shiftKey","stopPropagation","_currentMailboxes","_unselectMessage","nextMessage","previousMessage","nextIndex","size","confirm","ok","deleteSelectedMessage","withoutTrash","moveSelectedMessage","dstFolder","copySelectedMessages","simple","hideDelay","moveSelectedMessages","selectAll","unselectMessages","markSelectedMessagesAsFlagged","markSelectedMessagesAsUnread","markSelectedMessagesAsRead","mdVirtualRepeatContainerDirectiveDecorator","$delegate","resetScroll","$element","updateSize","scrollTo","decorator","MailboxesController","$transitions","User","currentSearchParam","","subfolders","showSubscribedOnly","SOGoMailShowSubscribedFoldersOnly","refreshUnseenCount","selectedFolderController","confirmDelete","hideAdvancedSearch","searchPreviousMailbox","toggleAdvancedSearch","virtualMailbox","root","folders","$current","addSearchParam","v","newSearchParam","pattern","n","searchParam","substring","negative","toggleAccountState","triggerHandler","subscribe","SubscriptionsDialogController","srcAccount","hide","newFolder","parentFolder","prompt","alert","delegate","MailboxDelegationController","userToAdd","searchText","userFilter","closeModal","removeUser","addUser","unseenCountFolders","isDroppableFolder","srcFolder","dragSelectedMessages","dstId","clearMessageView","success","MessageController","$mdMedia","sgConstant","Calendar","Component","$messageController","tags","showFlags","$showDetailedRecipients","showRawSource","_unlessInDialog","reply","replyAll","forward","deleteMessage","opener","$watchCollection","newTags","oldTags","ctrls","$parentControllers","messageCtrl","wasflagged","mailboxCtrl","_newTags","_oldTags","difference","_messageDialog","arguments","apply","addFlags","toggleDetailedRecipients","filterMailtoLinks","href","tagName","attributes","state","parentCtrls","closePopup","_showMailEditor","_showMailEditorInPopup","isPopup","openInPopup","edit","toggleRawSource","$rawSource","print","convertToEvent","_convertToComponent","convertToTask","componentData","pid","$defaultCalendar","summary","comment","capitalize","stateComponent","MessageEditorController","$stateParams","$mdConstant","FileUploader","AddressBook","Card","addRecipient","contact","recipients","recipient","list","emailRE","charCodeAt","test","charAt","$isList","expandable","refs","ref","$shortFormat","container","c_name","listId","autocomplete","autosave","autosaveDrafts","SOGoMailAutoSave","contactFilter","$filterAll","cards","explodedCards","manyCards","card","uniqBy","$$fullname","$$email","isFullscreen","hideBcc","hideCc","uniq","recipientSeparatorKeys","KEY_CODE","ENTER","TAB","COMMA","SEMICOLON","removeAttachment","item","isUploading","uploader","cancelItem","file","getElementById","prop","draftMailboxCtrl","draftMessageCtrl","send","sendState","originMailboxCtrl","errorMessage","statusText","toggleFullscreen","autoUpload","alias","removeAfterUpload","onSuccessItem","inlineUrl","lastAttachmentAttrs","onCancelItem","removeFromQueue","onErrorItem","localeCode","LocaleCode","destroy","actionName","addAttachments","originMessage","fileItem","FileItem","progress","isUploaded","isSuccess","queue","SendMessageToastController","closeToast","sgAccountController","$mdSidenav","$postLink","quotaElement","div","contains","addMailboxController","mailboxController","selectedMailboxCtrl","ctrl","unselectFolder","directive","restrict","scope","sgImipController","delegateInvitation","delegatedTo","iCalendarAction","receiveUpdates","c_email","viewer","pathToAttachment","link","iElement","sgImipPath","sgMailboxListItemController","editMode","accountController","selectableElement","clickableElement","inputContainer","inputElement","moreOptionsButton","childLevel","editFolder","select","saveFolder","disabled","revertEditing","showMenu","relativeTo","addPanelPosition","xPosition","ALIGN_START","yPosition","ALIGN_TOPS","itemCtrl","MenuController","panelRef","panelEl","$menuCtrl","markFolderRead","compactFolder","emptyTrashFolder","showAdvancedSearch","share","$users","usersWithACL","setFolderAs","require","sgMessageListItemController","MailboxService","pick","newId","oldId","onUpdate","setVisibility","visible","sgMessageListItemMainController","$parse","$mdUtil","contentDivElement","iconsDivElement","parentControllerOnUpdate","parentController","priorityIconElement","mailboxNameElement","senderElement","subjectElement","sizeElement","dateElement","textContent","flagIconElement","answerIconElement","forwardIconElement","attachmentIconElement","flagElements","nodesToArray","flagElement","removeChild","css","prepend","encodeEntities","priority","relativedate","hasattachment","sgZoomableImageController","showImage"],"mappings":"CAEA,WACE,aAOE,SAASA,EAAQC,GAEqB,mBAA3BA,EAAkBC,OAC3BC,QAAQC,OAAOC,KAAMJ,GACrBK,EAAEC,QAAQF,KAAKG,WAAY,SAASC,GAC9BA,EAASC,SACXD,EAASE,KAAOF,EAASC,SAAW,KAAOD,EAASG,MAAQ,IAE5DH,EAASE,KAAO,IAAMF,EAASG,MAAQ,MAE3CZ,EAAQa,KAAKC,MAAM,YAAcC,KAAKC,UAAUf,OAAmBgB,EAAW,KAalFjB,EAAQkB,UAAY,KAAM,WAAY,OAAQ,aAAc,WAAY,cAAe,UAAW,UAAW,SAASC,EAAIC,EAAUP,EAAMQ,EAAUC,EAAUC,EAAaC,EAASC,GAWlL,OAVAtB,QAAQC,OAAOJ,GACbmB,GAAIA,EACJC,SAAUA,EACVP,KAAMA,EACNa,WAAY,IAAIJ,EAASD,EAASM,WAAW,aAAe,OAAQN,EAASM,cAC7EC,aAAcL,EACdM,SAAUL,EACVM,SAAUL,IAGLzB,IAOT,IACEG,QA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O4a,GACvC7D,EAAM6D,iBAAmBA,GALzBtZ,WAAY,kCACZE,aAAc,WA1CpB,GCAA,WAEE,aAkDA0a,EAA0BhZ,SAAW,WAAY,gBACjD,SAASgZ,EAA0BrS,EAAUjL,GAC3C,IAAIQ,EAAQ1Y,KAEZA,KAAK0vB,UAAY,WACfxX,EAAaM,cAAc2K,GAC3BA,EAASvD,GAAG,QAAS5f,KAAKy1B,YAG5Bz1B,KAAKy1B,UAAY,SAASxc,GACK,OAAzBA,EAAOgB,OAAO2O,SAChB1Q,EAAac,YAAYC,EAAQP,EAAMQ,YAI7CpZ,QACG4B,OAAO,iBACPyuB,UAAU,kBApDb,WACE,OACEC,SAAU,IACVzV,kBACEzB,UAAW,oBAEb0B,WAAY4a,KAvBlB","file":"Mailer.services.js"} \ No newline at end of file +{"version":3,"sources":["Mailer/Account.service.js","Mailer/Mailbox.service.js","Mailer/Message.service.js","Mailer/sgImageGallery.service.js","Mailer/VirtualMailbox.service.js","Mailer/MailboxController.js","Mailer/MailboxesController.js","Mailer/MessageController.js","Mailer/MessageEditorController.js","Mailer/sgAccountSection.directive.js","Mailer/sgIMIP.directive.js","Mailer/sgMailboxListItem.directive.js","Mailer/sgMessageListItem.directive.js","Mailer/sgMessageListItemMain.directive.js","Mailer/sgZoomableImage.directive.js"],"names":["Account","futureAccountData","then","angular","extend","this","_","forEach","identities","identity","fullName","full","email","$log","debug","JSON","stringify","undefined","$factory","$q","$timeout","Settings","Resource","Preferences","Mailbox","Message","$$resource","activeUser","$Preferences","$Mailbox","$Message","module","e","factory","$findAll","data","$unwrapCollection","fetch","o","collection","i","id","$accounts","prototype","getLength","$flattenMailboxes","length","getItemAtIndex","index","expandedMailboxes","$getMailboxes","options","_this","$mailboxes","reload","$find","$expanded","expandedFolders","_visit","mailboxes","indexOf","children","settings","Mail","ExpandedFolders","isString","fromJson","warn","when","allMailboxes","push","all","$$flattenMailboxes","saveState","account","reduce","mailbox","post","$getMailboxByType","type","_find","find","$getMailboxByPath","path","$newMailbox","name","toString","$removeCertificate","updateQuota","percent","description","Math","round","usedSpace","maxQuota","l","formatted","$quota","$newMessage","accountId","mailboxPath","message","$absolutePath","asDraft","editable","isNew","mailto","isObject","$parseMailto","$addDelegate","user","deferred","defer","param","uid","map","delegates","resolve","users","status","reject","promise","$removeDelegate","splice","futureMailboxData","$account","init","newMailboxData","create","$unwrap","Acl","PRELOAD","$$Acl","$query","sort","asc","selectedFolder","$refreshTimeout","$virtualMode","$virtualPath","SortingState","parseInt","constant","LOOKAHEAD","SIZE","createMailboxes","level","quotas","split","component","asCSSIdentifier","join","isUndefined","uidsMap","headers","$isLoading","$messages","$id","$acl","$displayName","$isEditable","isEditable","$isSpecial","$icon","$isNoInferiors","isNoInferiors","$shadowData","$omit","selectFolder","$lastVisibleIndex","max","$loadMessage","$selectedMessages","filter","selected","$selectedCount","isSelectedMessage","messageId","selectedMessage","$selectedMessage","$selectedMessageIndex","hasSelectedMessage","isDefined","$filter","sortingAttributes","filters","unseenCount","cancel","searchInput","secondFilter","match","searchBy","copy","refreshViewCheck","defaults","SOGoRefreshViewCheck","f","bind","timeInterval","endIndex","uids","futureHeadersData","startIndex","loaded","subject","min","loading","$unwrapHeaders","flags","isNoSelect","getClassName","base","$rename","findParent","parent","parentMailbox","$save","sibling","oldPath","localeCompare","pathRE","RegExp","_updateChildren","child","replace","$compact","$canFolderAs","$setFolderAs","$emptyTrash","$markAsRead","isread","$flagMessages","messages","operation","msgUIDs","saveSelectedMessages","selectedMessages","selectedUIDs","filename","download","exportFolder","$delete","$_deleteMessages","unseen","firstIndex","forEachRight","selectedIndex","findIndex","$deleteMessages","$markOrUnMarkMessagesAsJunk","method","$copyMessages","folder","$moveMessages","$reset","value","key","save","response","error","$futureMailboxData","$topIndex","invokeMap","threaded","msgs","msg","msgObject","zipObject","isError","j","messageHeaders","$updateSubscribe","action","subscribed","futureMessageData","lazy","$mailbox","$hasUnsafeContent","$loadUnsafeContent","to","cc","bcc","$formatFullAddresses","Message_STATUS","STATUS","$avatar","avatar","SOGoMailLabelsColors","$tags","SOGoMailDisplayRemoteInlineImages","$displayRemoteInlineImages","NOT_LOADED","DELAYED_LOADING","LOADING","LOADED","DELAYED_MS","filterTags","query","excludedTags","re","results","keys","tag","pair","search","includes","color","buildPath","nocache","draftId","withResourcePath","$setUID","oldUID","attr","constructor","shortname","first","last","image","$shortRecipients","result","count","total","$shortAddress","address","allowReplyAll","recipientsCount","isDraft","loadUnsafeContent","$content","parts","part","msgclass","content","alternatePart","preferredPart","contentType","isArray","formattedMessage","$smime","validSignature","valid","certificate","certificates","mixedPart","safeContent","html","unsafeContent","document","createElement","innerHTML","suffix","element","elements","querySelectorAll","removeAttr","compile","$editableContent","from","toLowerCase","text","$plainContent","addTag","$addOrRemoveTag","removeTag","$imipAction","$reload","$sendMDN","shouldAskReceipt","$deleteAttachment","attachmentAttrs","attachment","toggleFlag","isflagged","$loaded","useCache","$futureMessageData","exec","decodeURIComponent","trim","$reply","$newDraft","$replyAll","$forward","origin","$send","startsWith","isanswered","isforwarded","privateAttributes","downloadAttachments","ImageGallery","show","$document","$mdPanel","sgHotkeys","setMessage","registerImage","registerHotkeys","$ctrl","createHotkey","callback","previousImage","nextImage","registerHotkey","showGallery","$event","partIndex","partSrc","src","images","attrs","mimetype","url","body","addClass","panelPosition","newPanelPosition","absolute","panelAnimation","newPanelAnimation","openFrom","target","duration","withAnimation","animation","FADE","config","attachTo","locals","lastIndex","selectedImage","bindToController","controller","PanelController","controllerAs","position","targetEvent","fullscreen","hasBackdrop","template","trapFocus","clickOutsideToClose","escapeToClose","focusOnOpen","onOpenComplete","getElementsByClassName","imgContainer","imgEl","one","naturalWidth","naturalHeight","classList","add","remove","onDomRemoved","removeClass","hotkeys","deregisterHotkey","open","mdPanelRef","$inject","close","selectImage","VirtualMailbox","setMailboxes","startSearch","params","finally","stopSearch","resetSelectedMessage","len","k","transform","messagesMap","sum","allMessages","promises","assign","flatten","MailboxController","$window","$scope","$state","$mdDialog","$mdToast","stateAccounts","stateAccount","stateMailbox","encodeUriFilter","sgSettings","focus","Dialog","vm","defaultWindowTitle","$onInit","$mailboxController","service","accounts","messageDialog","mode","multiple","searchMode","newMessage","markOrUnMarkMessagesAsJunk","toggleMessageSelection","_nextMessage","preventInClass","_previousMessage","_addNextMessageToSelection","_addPreviousMessageToSelection","hotkey","confirmDeleteSelectedMessages","on","_compactBeforeUnload","$on","off","$watch","title","event","centerIsClose","navController_centerIsClose","field","sortedBy","cancelSearch","composeWindowEnabled","SOGoMailComposeWindowEnabled","inPopup","SOGoMailComposeWindow","baseURL","wId","random","console","_newMessageInPopup","templateUrl","stateMessage","catch","selectMessage","preventDefault","go","mailboxId","nextSelectedIndex","shiftKey","stopPropagation","_currentMailboxes","_unselectMessage","nextMessage","previousMessage","nextIndex","size","confirm","ok","deleteSelectedMessage","withoutTrash","moveSelectedMessage","dstFolder","copySelectedMessages","simple","hideDelay","moveSelectedMessages","selectAll","unselectMessages","markSelectedMessagesAsFlagged","markSelectedMessagesAsUnread","markSelectedMessagesAsRead","mdVirtualRepeatContainerDirectiveDecorator","$delegate","resetScroll","$element","updateSize","scrollTo","decorator","MailboxesController","$transitions","User","currentSearchParam","","subfolders","showSubscribedOnly","SOGoMailShowSubscribedFoldersOnly","refreshUnseenCount","selectedFolderController","confirmDelete","hideAdvancedSearch","searchPreviousMailbox","toggleAdvancedSearch","virtualMailbox","root","folders","$current","addSearchParam","v","newSearchParam","pattern","n","searchParam","substring","negative","toggleAccountState","triggerHandler","subscribe","SubscriptionsDialogController","srcAccount","hide","newFolder","parentFolder","prompt","alert","delegate","MailboxDelegationController","userToAdd","searchText","userFilter","closeModal","removeUser","addUser","unseenCountFolders","isDroppableFolder","srcFolder","dragSelectedMessages","dstId","clearMessageView","success","MessageController","$mdMedia","sgConstant","Calendar","Component","$messageController","tags","showFlags","$showDetailedRecipients","showRawSource","_unlessInDialog","reply","replyAll","forward","deleteMessage","opener","$watchCollection","newTags","oldTags","ctrls","$parentControllers","messageCtrl","wasflagged","mailboxCtrl","_newTags","_oldTags","difference","_messageDialog","arguments","apply","addFlags","toggleDetailedRecipients","filterMailtoLinks","href","tagName","attributes","state","parentCtrls","closePopup","_showMailEditor","_showMailEditorInPopup","isPopup","openInPopup","edit","toggleRawSource","$rawSource","print","convertToEvent","_convertToComponent","convertToTask","componentData","pid","$defaultCalendar","summary","comment","capitalize","stateComponent","MessageEditorController","$stateParams","$mdConstant","FileUploader","AddressBook","Card","addRecipient","contact","recipients","recipient","list","emailRE","charCodeAt","test","charAt","$isList","expandable","refs","ref","$shortFormat","container","c_name","listId","autocomplete","autosave","autosaveDrafts","SOGoMailAutoSave","contactFilter","$filterAll","cards","explodedCards","manyCards","card","uniqBy","$$fullname","$$email","isFullscreen","hideBcc","hideCc","uniq","recipientSeparatorKeys","KEY_CODE","ENTER","TAB","COMMA","SEMICOLON","removeAttachment","item","isUploading","uploader","cancelItem","file","getElementById","prop","draftMailboxCtrl","draftMessageCtrl","send","sendState","originMailboxCtrl","errorMessage","statusText","toggleFullscreen","autoUpload","alias","removeAfterUpload","onSuccessItem","inlineUrl","lastAttachmentAttrs","onCancelItem","removeFromQueue","onErrorItem","localeCode","LocaleCode","destroy","actionName","addAttachments","originMessage","fileItem","FileItem","progress","isUploaded","isSuccess","queue","SendMessageToastController","closeToast","sgAccountController","$mdSidenav","$postLink","quotaElement","div","contains","addMailboxController","mailboxController","selectedMailboxCtrl","ctrl","unselectFolder","directive","restrict","scope","sgImipController","delegateInvitation","delegatedTo","iCalendarAction","receiveUpdates","c_email","viewer","pathToAttachment","link","iElement","sgImipPath","sgMailboxListItemController","editMode","accountController","selectableElement","clickableElement","inputContainer","inputElement","moreOptionsButton","childLevel","editFolder","select","saveFolder","disabled","revertEditing","showMenu","relativeTo","addPanelPosition","xPosition","ALIGN_START","yPosition","ALIGN_TOPS","itemCtrl","MenuController","panelRef","panelEl","$menuCtrl","markFolderRead","compactFolder","emptyTrashFolder","showAdvancedSearch","share","$users","usersWithACL","setFolderAs","require","sgMessageListItemController","MailboxService","pick","newId","oldId","onUpdate","setVisibility","visible","sgMessageListItemMainController","$parse","$mdUtil","contentDivElement","iconsDivElement","parentControllerOnUpdate","parentController","priorityIconElement","mailboxNameElement","senderElement","subjectElement","sizeElement","dateElement","textContent","flagIconElement","answerIconElement","forwardIconElement","attachmentIconElement","flagElements","nodesToArray","flagElement","removeChild","css","prepend","encodeEntities","priority","relativedate","hasattachment","sgZoomableImageController","showImage"],"mappings":"CAEA,WACE,aAOE,SAASA,EAAQC,GAEqB,mBAA3BA,EAAkBC,OAC3BC,QAAQC,OAAOC,KAAMJ,GACrBK,EAAEC,QAAQF,KAAKG,WAAY,SAASC,GAC9BA,EAASC,SACXD,EAASE,KAAOF,EAASC,SAAW,KAAOD,EAASG,MAAQ,IAE5DH,EAASE,KAAO,IAAMF,EAASG,MAAQ,MAE3CZ,EAAQa,KAAKC,MAAM,YAAcC,KAAKC,UAAUf,OAAmBgB,EAAW,KAalFjB,EAAQkB,UAAY,KAAM,WAAY,OAAQ,aAAc,WAAY,cAAe,UAAW,UAAW,SAASC,EAAIC,EAAUP,EAAMQ,EAAUC,EAAUC,EAAaC,EAASC,GAWlL,OAVAtB,QAAQC,OAAOJ,GACbmB,GAAIA,EACJC,SAAUA,EACVP,KAAMA,EACNa,WAAY,IAAIJ,EAASD,EAASM,WAAW,aAAe,OAAQN,EAASM,cAC7EC,aAAcL,EACdM,SAAUL,EACVM,SAAUL,IAGLzB,IAOT,IACEG,QAAQ4B,OAAO,iBAEjB,MAAMC,GACJ7B,QAAQ4B,OAAO,iBAAkB,gBAEnC5B,QAAQ4B,OAAO,iBACZE,QAAQ,UAAWjC,EAAQkB,UAQ9BlB,EAAQkC,SAAW,SAASC,GAC1B,OAAKA,EAKEnC,EAAQoC,kBAAkBD,GAJxBnC,EAAQ0B,WAAWW,MAAM,GAAI,gBAAgBnC,KAAK,SAASoC,GAChE,OAAOtC,EAAQoC,kBAAkBE,MAYvCtC,EAAQoC,kBAAoB,SAAS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4B,OAAO,iBACPyuB,UAAU,kBApDb,WACE,OACEC,SAAU,IACVzV,kBACEzB,UAAW,oBAEb0B,WAAY4a,KAvBlB","file":"Mailer.services.js"} \ No newline at end of file diff --git a/UI/WebServerResources/js/Scheduler.services.js b/UI/WebServerResources/js/Scheduler.services.js index ab91faab1..6affce565 100644 --- a/UI/WebServerResources/js/Scheduler.services.js +++ b/UI/WebServerResources/js/Scheduler.services.js @@ -1,2 +1,2 @@ -!function(){"use strict";function e(t){if(this.init(t),this.name&&!this.id){var n=e.$$resource.create("createFolder",this.name);this.$unwrap(n)}}e.$factory=["$q","$timeout","$log","sgSettings","Resource","Preferences","Component","Acl",function(t,n,a,o,i,r,s,c){return angular.extend(e,{$q:t,$timeout:n,$log:a,$$resource:new i(o.activeUser("folderURL")+"Calendar",o.activeUser()),$Preferences:r,$Component:s,$$Acl:c,activeUser:o.activeUser(),$view:null}),e}];try{angular.module("SOGo.SchedulerUI")}catch(e){angular.module("SOGo.SchedulerUI",["SOGo.Common"])}angular.module("SOGo.SchedulerUI").value("CalendarSettings",{EventDragDayLength:96,EventDragHorizontalOffset:3,ConflictHTTPErrorCode:409}).factory("Calendar",e.$factory),e.$defaultCalendar=function(){var t;return"first"==e.$Preferences.defaults.SOGoDefaultCalendar&&(t=_.find(e.$findAll(null,!0),function(e){return e.active}))?t.id:"personal"},e.$add=function(t){var n,a;n=t.isWebCalendar?this.$webcalendars:t.isSubscription?this.$subscriptions:this.$calendars,(a=_.findIndex(n,function(e,n){return"personal"==t.id||"personal"!=e.id&&e.name.localeCompare(t.name)>0}))<0?n.push(t):n.splice(a,0,t),e.$Preferences.settings.Calendar.FoldersOrder&&e.saveFoldersOrder(_.flatMap(e.$findAll(),"id")),e.$reloadAll()},e.$findAll=function(t,n){var a=this;if(t)this.$calendars=[],this.$subscriptions=[],this.$webcalendars=[],angular.forEach(t,function(t,n){var o=new e(t);o.isWebCalendar?a.$webcalendars.push(o):o.isSubscription?a.$subscriptions.push(o):a.$calendars.push(o)});else if(angular.isUndefined(this.$calendars))return this.$calendars=[],this.$subscriptions=[],this.$webcalendars=[],e.$$resource.fetch("calendarslist").then(function(t){return e.$findAll(t.calendars,n)});return n?_.union(this.$calendars,_.filter(this.$subscriptions,function(e){return e.isOwned||e.acls.objectCreator})):_.union(this.$calendars,this.$subscriptions,this.$webcalendars)},e.$reloadAll=function(){var t=this;e.$$resource.fetch("calendarslist").then(function(n){_.forEach(n.calendars,function(n){var a,o;a=n.isWebCalendar?t.$webcalendars:n.owner!=e.activeUser.login?t.$subscriptions:t.$calendars,(o=_.find(a,function(e){return e.id==n.id}))&&o.init(n)})})},e.$get=function(t){var n;return(n=_.find(e.$calendars,function(e){return e.id==t}))||(n=_.find(e.$subscriptions,function(e){return e.id==t})),n||(n=_.find(e.$webcalendars,function(e){return e.id==t})),n},e.$getIndex=function(t){var n;return(n=_.indexOf(_.map(e.$calendars,"id"),t))<0&&(n=_.indexOf(_.map(e.$subscriptions,"id"),t)),n<0&&(n=_.indexOf(_.map(e.$webcalendars,"id"),t)),n},e.$subscribe=function(t,n){var a=this;return e.$$resource.userResource(t).fetch(n,"subscribe").then(function(t){var n=new e(angular.extend({active:1},t));return _.find(a.$subscriptions,function(e){return e.id==t.id})||e.$add(n),n})},e.$addWebCalendar=function(t){var n=e.$q.defer();return _.find(this.$webcalendars,function(e){return e.urls.webCalendarURL==t})?n.reject():e.$$resource.post(null,"addWebCalendar",{url:t}).then(function(a){angular.extend(a,{isWebCalendar:!0,isEditable:!0,isRemote:!1,owner:e.activeUser.login,urls:{webCalendarURL:t}});var o=new e(a);e.$$resource.fetch(o.id,"reload").then(function(t){e.$log.debug(JSON.stringify(t,void 0,2)),e.$add(o),n.resolve()},function(e){401==e.status?n.resolve(o):n.reject()})},n.reject),n.promise},e.reloadWebCalendars=function(){var t=[];return _.forEach(this.$webcalendars,function(n){var a=e.$$resource.fetch(n.id,"reload");a.then(function(e){n.$error=!1},function(e){n.$error=l(e.statusText)}),t.push(a)}),e.$q.all(t)},e.$deleteComponents=function(t){var n={},a=[];return _.forEach(t,function(e){angular.isDefined(n[e.pid])||(n[e.pid]=[]),n[e.pid].push(e.id)}),_.forEach(n,function(t,n){a.push(e.$$resource.post(n,"batchDelete",{uids:t}))}),e.$q.all(a)},e.saveFoldersActivation=function(t){var n={};return _.forEach(t,function(t){var a=e.$get(t);n[a.id]=a.active}),e.$$resource.post(null,"saveFoldersActivation",n)},e.saveFoldersOrder=function(t){return this.$$resource.post(null,"saveFoldersOrder",{folders:t}).then(function(){if(e.$Preferences.settings.Calendar.FoldersOrder=t,!t)return e.$$resource.fetch("calendarslist").then(function(t){return e.$findAll(t.calendars)})})},e.prototype.init=function(t){this.color=this.color||"#AAAAAA",this.active=1,angular.extend(this,t),this.id&&(this.$acl=new e.$$Acl("Calendar/"+this.id)),this.isOwned=e.activeUser.isSuperUser||this.owner==e.activeUser.login,this.isSubscription=!this.isRemote&&this.owner!=e.activeUser.login,angular.isUndefined(this.$shadowData)&&(this.$shadowData=this.$omit())},e.prototype.$id=function(){return this.id?e.$q.when(this.id):this.$futureCalendarData.then(function(e){return e.id})},e.prototype.getClassName=function(e){return angular.isUndefined(e)&&(e="fg"),e+"-folder"+this.id},e.prototype.$rename=function(){var t,n,a=this;return this.name==this.$shadowData.name?e.$q.when():(n=this.isWebCalendar?e.$webcalendars:this.isSubscription?e.$subscriptions:e.$calendars,(t=_.indexOf(_.map(n,"id"),this.id))>-1?this.$save().then(function(){n.splice(t,1),e.$add(a)}):e.$q.reject())},e.prototype.$delete=function(){var t,n,a=this;return this.isSubscription?(n=e.$$resource.fetch(this.id,"unsubscribe"),t=e.$subscriptions):(n=e.$$resource.remove(this.id),t=this.isWebCalendar?e.$webcalendars:e.$calendars),n.then(function(){var e=_.indexOf(_.map(t,"id"),a.id);t.splice(e,1)})},e.prototype.$reset=function(){var e=this;angular.forEach(this,function(t,n){"constructor"!=n&&"$"!=n[0]&&delete e[n]}),angular.extend(this,this.$shadowData),this.$shadowData=this.$omit()},e.prototype.$save=function(){var t=this;return e.$$resource.save(this.id,this.$omit()).then(function(e){return t.$shadowData=t.$omit(),e},function(n){return e.$log.error(JSON.stringify(n,void 0,2)),t.$reset(),n})},e.prototype.setCredentials=function(t,n){var a=this,o=e.$q.defer();return e.$$resource.post(this.id,"set-credentials",{username:t,password:n}).then(function(){e.$$resource.fetch(a.id,"reload").then(function(t){e.$add(a),o.resolve()},function(e){401==e.status?o.reject(l("Wrong username or password")):o.reject(e.statusText)})},o.reject),o.promise},e.prototype.export=function(){var t;return t={type:"application/octet-stream",filename:this.name+".ics"},e.$$resource.download(this.id+".ics","export",null,t)},e.prototype.$setActivation=function(){return e.$$resource.fetch(this.id,(this.active?"":"de")+"activateFolder")},e.prototype.$getComponent=function(t,n){return e.$Component.$find(this.id,t,n)},e.prototype.$unwrap=function(t){var n=this;this.$futureCalendarData=t.then(function(t){return e.$timeout(function(){return n.init(t),n})},function(t){n.isError=!0,angular.isObject(t)&&e.$timeout(function(){angular.extend(n,t)})})},e.prototype.$omit=function(){var e={};return angular.forEach(this,function(t,n){"constructor"!=n&&"$"!=n[0]&&(e[n]=t)}),e}}(),function(){"use strict";function e(t){if("function"!=typeof t.then){if(this.init(t),this.pid&&!this.id){var n=e.$$resource.newguid(this.pid);this.$unwrap(n),this.isNew=!0}}else this.$unwrap(t)}e.$factory=["$q","$timeout","$log","$rootScope","sgSettings","sgComponent_STATUS","Preferences","User","Card","Gravatar","Resource",function(t,n,a,o,i,r,s,c,l,d,u){return angular.extend(e,{STATUS:r,$q:t,$timeout:n,$log:a,$rootScope:o,$settings:i,$User:c,$Preferences:s,$Card:l,$gravatar:d,$$resource:new u(i.activeUser("folderURL")+"Calendar",i.activeUser()),timeFormat:"%H:%M",$query:{value:"",search:"title_Category_Location"},$queryEvents:{sort:"start",asc:1,filterpopup:"view_next7"},$queryTasks:{sort:"status",asc:1,filterpopup:"view_incomplete"},$refreshTimeout:null,$ghost:{}}),s.settings.Calendar.EventsFilterState&&(e.$queryEvents.filterpopup=s.settings.Calendar.EventsFilterState),s.settings.Calendar.TasksFilterState&&(e.$queryTasks.filterpopup=s.settings.Calendar.TasksFilterState),s.settings.Calendar.EventsSortingState&&(e.$queryEvents.sort=s.settings.Calendar.EventsSortingState[0],e.$queryEvents.asc=parseInt(s.settings.Calendar.EventsSortingState[1])),s.settings.Calendar.TasksSortingState&&(e.$queryTasks.sort=s.settings.Calendar.TasksSortingState[0],e.$queryTasks.asc=parseInt(s.settings.Calendar.TasksSortingState[1])),e.$queryTasks.show_completed=parseInt(s.settings.ShowCompletedTasks),e.$categories=s.defaults.SOGoCalendarCategoriesColors,s.defaults.SOGoTimeFormat&&(e.timeFormat=s.defaults.SOGoTimeFormat),e}];try{angular.module("SOGo.SchedulerUI")}catch(e){angular.module("SOGo.SchedulerUI",["SOGo.Common"])}angular.module("SOGo.SchedulerUI").constant("sgComponent_STATUS",{NOT_LOADED:0,DELAYED_LOADING:1,LOADING:2,LOADED:3,DELAYED_MS:300}).factory("Component",e.$factory),e.$selectedCount=function(){var t;return t=0,e.$events&&(t+=_.filter(e.$events,function(e){return e.selected}).length),e.$tasks&&(t+=_.filter(e.$tasks,function(e){return e.selected}).length),t},e.$startRefreshTimeout=function(t){e.$refreshTimeout&&e.$timeout.cancel(e.$refreshTimeout);var n=e.$Preferences.defaults.SOGoRefreshViewCheck;if(n&&"manually"!=n){var a=angular.bind(e.$rootScope,e.$rootScope.$emit,"calendars:list");e.$refreshTimeout=e.$timeout(a,1e3*n.timeInterval())}},e.$isLoading=function(){return e.$loaded==e.STATUS.LOADING},e.$filter=function(t,n){var a,o,i=this,r=new Date,s=r.getDate(),c=r.getMonth()+1,l=r.getFullYear(),d="$query"+t.capitalize(),u={day:l+(c<10?"0":"")+c+(s<10?"0":"")+s},h=!1;return e.$startRefreshTimeout(t),angular.extend(this.$query,u),n&&_.forEach(_.keys(n),function(t){h|=i.$query[t]&&n[t]!=e.$query[t],"reload"==t&&n[t]?h=!0:angular.isDefined(i.$query[t])?i.$query[t]=n[t]:i[d][t]=n[t]}),a=this.$$resource.fetch(null,t+"list",angular.extend(this[d],this.$query)),h&&(delete e[o="tasks"==t?"$events":"$tasks"],e.$log.debug("force reload of "+o)),this.$unwrapCollection(t,a)},e.$find=function(t,n,a){var o=[t,encodeURIComponent(n)];return a&&o.push(a),new e(this.$$resource.fetch(o.join("/"),"view"))},e.filterCategories=function(t){var n=new RegExp(t,"i");return _.filter(_.keys(e.$categories),function(e){return-1!=e.search(n)})},e.saveSelectedList=function(e){return this.$$resource.post(null,"saveSelectedList",{list:e+"ListView"})},e.$eventsBlocksForView=function(t,n){var a,o,i,r;return a=e.$Preferences.defaults.SOGoFirstDayOfWeek,"day"==t?(o="dayView",i=r=n):"multicolumnday"==t?(o="multicolumndayView",i=r=n):"week"==t?(o="weekView",i=n.beginOfWeek(a),(r=new Date).setTime(i.getTime()),r.addDays(6)):"month"==t&&(o="monthView",(i=n).setDate(1),i=i.beginOfWeek(a),(r=new Date).setTime(n.getTime()),r.setMonth(r.getMonth()+1),r.addDays(-1),r=r.endOfWeek(a)),this.$eventsBlocks(o,i,r)},e.$eventsBlocks=function(t,n,a){var o,i,r,s=[],c=[],l=e.$q.defer();return o={view:t.toLowerCase(),sd:n.getDayString(),ed:a.getDayString()},this.$$resource.fetch(null,"eventsblocks",o).then(function(t){var n,a;n=function(t,n,a){var o,i=_.zipObject(this.eventsFields,n),r=new Date(1e3*i.c_startdate);return i.hour=r.getHourString(),i.blocks=[],o=new e(i),t.push(o),t},a=function(e){this[e.nbr].blocks.push(e),e.component=this[e.nbr],e.isFirst=1==this[e.nbr].blocks.length},e.$views=[],e.$timeout(function(){_.forEach(t,function(t,o){var l,d=[],u={},h={};for(t.eventsFields.splice(_.indexOf(t.eventsFields,"c_folder"),1,"pid"),t.eventsFields.splice(_.indexOf(t.eventsFields,"c_name"),1,"id"),t.eventsFields.splice(_.indexOf(t.eventsFields,"c_recurrence_id"),1,"occurrenceId"),t.eventsFields.splice(_.indexOf(t.eventsFields,"c_title"),1,"summary"),_.reduce(t.events,_.bind(n,t),d),_.forEach(_.flatten(t.blocks),_.bind(a,d)),_.forEach(_.flatten(t.allDayBlocks),_.bind(a,d)),0===s.length&&(s=_.flatMap(t.days,"date"),c=_.flatMap(t.days,"number")),i=0;i0&&(this.repeat.month={type:"bymonthday"}),angular.isUndefined(this.repeat.month)&&(this.repeat.month={}),angular.isUndefined(this.repeat.month.occurrence)&&angular.extend(this.repeat.month,{occurrence:"1",day:"SU"}),angular.isUndefined(this.repeat.months)&&(this.repeat.months=[]),angular.isUndefined(this.repeat.year)&&(this.repeat.year={}),this.repeat.count?this.repeat.end="count":this.repeat.until?(this.repeat.end="until",angular.isString(this.repeat.until)&&(this.repeat.until=e.$parseDate(this.repeat.until,{no_time:!0}))):this.repeat.end="never",this.$hasCustomRepeat=this.hasCustomRepeat(),this.isNew){var a="appointment"==this.type?"Events":"Tasks";this.classification=e.$Preferences.defaults["SOGoCalendar"+a+"DefaultClassification"].toLowerCase();var o=/-PT?([0-9]+)([MHDW])/.exec(e.$Preferences.defaults.SOGoCalendarDefaultReminder);o&&(this.$hasAlarm=!0,this.alarm.quantity=parseInt(o[1]),this.alarm.unit={M:"MINUTES",H:"HOURS",D:"DAYS",W:"WEEKS"}[o[2]]),this.sendAppointmentNotifications=e.$Preferences.defaults.SOGoAppointmentSendEMailNotifications}else angular.isUndefined(t.$hasAlarm)&&(this.$hasAlarm=angular.isDefined(t.alarm));this.destinationCalendar=this.pid,this.attendees&&_.forEach(this.attendees,function(t){t.image=e.$gravatar(t.email,32)}),this.updateFreeBusy(),this.selected=!1},e.prototype.initOrganizer=function(t){var n,a=this;t&&t.isSubscription?n=e.$User.$filter(t.owner).then(function(e){var t=e[0];a.organizer={uid:t.uid,name:t.cn,email:t.c_email}}):(this.organizer={uid:e.$settings.activeUser("login"),name:e.$settings.activeUser("identification"),email:e.$settings.activeUser("email")},n=e.$q.when()),n.then(function(){a.updateFreeBusyAttendee(a.organizer)})},e.prototype.hasCustomRepeat=function(){return angular.isUndefined(this.occurrenceId)&&angular.isDefined(this.repeat)&&(this.repeat.interval>1||angular.isDefined(this.repeat.days)&&this.repeat.days.length>0||angular.isDefined(this.repeat.monthdays)&&this.repeat.monthdays.length>0||angular.isDefined(this.repeat.months)&&this.repeat.months.length>0||angular.isDefined(this.repeat.month)&&angular.isDefined(this.repeat.month.type)||angular.isDefined(this.repeat.dates)&&this.repeat.dates.length>0)},e.prototype.isEditable=function(){return!this.occurrenceId&&!this.isReadOnly},e.prototype.isEditableOccurrence=function(){return this.occurrenceId&&!this.isReadOnly},e.prototype.isInvitation=function(){return!this.occurrenceId&&this.userHasRSVP},e.prototype.isInvitationOccurrence=function(){return this.occurrenceId&&this.userHasRSVP},e.prototype.showPercentComplete=function(){return"task"==this.type&&this.percentComplete>0&&"cancelled"!=this.status},e.prototype.enablePercentComplete=function(){return"task"==this.type&&"not-specified"!=this.status&&"cancelled"!=this.status},e.prototype.coversFreeBusy=function(e,t,n){return angular.isDefined(this.freebusy[e])&&angular.isDefined(this.freebusy[e][t])&&1==this.freebusy[e][t][n]},e.prototype.updateFreeBusyCoverage=function(){var e=this,t={};if(this.start&&this.end){var n=new Date(this.start.getTime()),a=new Date(this.end.getTime()),o=parseInt(n.getMinutes()/15+.5),i=parseInt(a.getMinutes()/15+.5);return n.setMinutes(15*o),a.setMinutes(15*i),_.forEach(n.daysUpTo(a),function(n,a){var i,r=n.getDate(),s=n.getDayString();if(s==e.start.getDayString())for(i=n.getHours().toString(),t[s]={},t[s][i]=[];o>0;)t[s][i].push(0),o--;else n=n.beginOfDay(),t[s]={};for(;n.getTime()0},e.prototype.addAttachUrl=function(e){if(angular.isUndefined(this.attachUrls))this.attachUrls=[{value:e}];else{for(var t=0;t-1&&this.attachUrls.length>e&&this.attachUrls.splice(e,1)},e.prototype.$addDueDate=function(){this.due=new Date,this.due.setMinutes(15*Math.round(this.due.getMinutes()/15)),this.dueDate=this.due.toISOString()},e.prototype.$deleteDueDate=function(){delete this.due,delete this.dueDate},e.prototype.$addStartDate=function(){this.start=new Date,this.start.setMinutes(15*Math.round(this.start.getMinutes()/15))},e.prototype.$deleteStartDate=function(){delete this.start,delete this.startDate},e.prototype.$addRecurrenceDate=function(){var e=new Date;e.setMinutes(15*Math.round(e.getMinutes()/15)),angular.isUndefined(this.repeat.dates)&&(this.repeat={frequency:"custom",dates:[]}),this.repeat.dates.push(e)},e.prototype.$deleteRecurrenceDate=function(e){e>-1&&this.repeat&&this.repeat.dates&&this.repeat.dates.length>e&&this.repeat.dates.splice(e,1)},e.prototype.$reset=function(){var e=this;angular.forEach(this,function(t,n){"constructor"!=n&&"$"!=n[0]&&delete e[n]}),this.init(this.$shadowData),this.$shadowData=this.$omit()},e.prototype.$reply=function(){var t,n=this,a=[this.pid,encodeURIComponent(this.id)];return this.occurrenceId&&a.push(this.occurrenceId),t={reply:this.reply,delegatedTo:this.delegatedTo,alarm:this.$hasAlarm?this.alarm:{}},e.$$resource.save(a.join("/"),t,{action:"rsvpAppointment"}).then(function(e){return n.$shadowData=n.$omit(),e})},e.prototype.$adjust=function(t){var n=[this.pid,encodeURIComponent(this.id)];return _.every(_.values(t),function(e){return 0===e})?e.$q.when():(this.occurrenceId&&n.push(this.occurrenceId),e.$log.debug("adjust "+n.join("/")+" "+JSON.stringify(t)),e.$$resource.save(n.join("/"),t,{action:"adjust"}))},e.prototype.$save=function(t){var n,a,o,i,r=this;return o=this.$omit(),i=e.$Preferences.$mdDateLocaleProvider,o.startDate=o.start?o.start.format(i,"%Y-%m-%d"):"",o.startTime=o.start?o.start.format(i,"%H:%M"):"",o.endDate=o.end?o.end.format(i,"%Y-%m-%d"):"",o.endTime=o.end?o.end.format(i,"%H:%M"):"",o.dueDate=o.due?o.due.format(i,"%Y-%m-%d"):"",o.dueTime=o.due?o.due.format(i,"%H:%M"):"",o.completedDate=o.completed?o.completed.format(i,"%Y-%m-%d"):"",this.hasCustomRepeat()?"monthly"==this.repeat.frequency&&this.repeat.month.type&&"byday"==this.repeat.month.type&&"relative"!=this.repeat.month.day||"yearly"==this.repeat.frequency&&this.repeat.year.byday?(delete o.repeat.monthdays,o.repeat.days=[{day:this.repeat.month.day,occurrence:this.repeat.month.occurrence.toString()}]):"monthly"!=this.repeat.frequency&&"yearly"!=this.repeat.frequency||!this.repeat.month.type?"custom"==this.repeat.frequency&&this.repeat.dates&&_.forEach(o.repeat.dates,function(e,t,n){n[t]={date:e.format(i,"%Y-%m-%d"),time:e.format(i,"%H:%M")}}):(delete o.repeat.days,"relative"==this.repeat.month.day&&(o.repeat.monthdays=[this.repeat.month.occurrence])):this.repeat.frequency&&"never"!=this.repeat.frequency&&(o.repeat={frequency:this.repeat.frequency}),o.startDate&&this.repeat.frequency&&"never"!=this.repeat.frequency?"until"==this.repeat.end&&this.repeat.until?o.repeat.until=this.repeat.until.stringWithSeparator("-"):"count"==this.repeat.end&&this.repeat.count?o.repeat.count=this.repeat.count:(delete o.repeat.until,delete o.repeat.count):delete o.repeat,"not-specified"==this.status?delete o.status:"completed"!=this.status&&delete o.completedDate,o.startDate&&this.$hasAlarm?!this.alarm.action||"email"!=this.alarm.action||this.attendees&&this.attendees.length>0||(o.alarm.attendees=0,o.alarm.organizer=1):o.alarm={},a=[this.pid,encodeURIComponent(this.id)],this.isNew&&(n={action:"saveAs"+this.type.capitalize()}),this.occurrenceId&&a.push(this.occurrenceId),angular.extend(o,t),e.$$resource.save(a.join("/"),o,n).then(function(e){return r.$shadowData=r.$omit(),e})},e.prototype.remove=function(t){var n=[this.pid,encodeURIComponent(this.id)];return t&&this.occurrenceId&&n.push(this.occurrenceId),e.$$resource.remove(n.join("/"))},e.prototype.$unwrap=function(t){var n=this;this.$futureComponentData=t,this.$futureComponentData.then(function(e){n.init(e),n.$shadowData=n.$omit()},function(t){angular.extend(n,t),n.isError=!0,e.$log.error(n.error)})},e.prototype.$omit=function(){var e={};return angular.forEach(this,function(t,n){"constructor"==n||"$hasAlarm"!=n&&"$"==n[0]||"blocks"==n||(e[n]=angular.copy(t))}),e},e.prototype.repeatDescription=function(){var e=null;return this.repeat&&(e=l("repeat_"+this.repeat.frequency.toUpperCase())),e},e.prototype.alarmDescription=function(){var e,t=null;return this.alarm&&(e=["reminder"+this.alarm.quantity,this.alarm.unit,this.alarm.reference].join("_"))===(t=l(e))&&(t=[this.alarm.quantity,l("reminder_"+this.alarm.unit),l("reminder_"+this.alarm.reference)].join(" ")),t},e.prototype.copyTo=function(t){return e.$$resource.post(this.pid+"/"+encodeURIComponent(this.id),"copy",{destination:t})},e.prototype.moveTo=function(t){return e.$$resource.post(this.pid+"/"+encodeURIComponent(this.id),"move",{destination:t})},e.prototype.toString=function(){return"[Component "+this.id+"]"}}(),function(){"use strict";e.$inject=["$scope","$rootScope","$state","$stateParams","sgHotkeys","Calendar","Component","Preferences","stateEventsBlocks"];function e(t,n,a,o,i,r,s,c,d){var u,h=this,p=[];angular.isUndefined(e.expandedAllDays)&&(e.expandedAllDays=!1),h.selectedDate=o.day.asDate(),h.expandedAllDays=e.expandedAllDays,h.toggleAllDays=function(){e.expandedAllDays=!e.expandedAllDays,h.expandedAllDays=e.expandedAllDays},h.views=d,h.changeDate=y,h.changeView=v,this.$onInit=function(){(e=p).push(i.createHotkey({key:l("hotkey_today"),description:l("Today"),callback:y,args:new Date})),e.push(i.createHotkey({key:l("hotkey_dayview"),description:l("Day"),callback:v,args:"day"})),e.push(i.createHotkey({key:l("hotkey_weekview"),description:l("Week"),callback:v,args:"week"})),e.push(i.createHotkey({key:l("hotkey_monthview"),description:l("Month"),callback:v,args:"month"})),e.push(i.createHotkey({key:l("hotkey_multicolumndayview"),description:l("Multicolumn Day View"),callback:v,args:"multicolumnday"})),e.push(i.createHotkey({key:"left",description:l("Move backward"),callback:m,args:-1})),e.push(i.createHotkey({key:"right",description:l("Move forward"),callback:m,args:1})),_.forEach(e,function(e){i.registerHotkey(e)});var e;f(h.selectedDate),u=n.$on("calendars:list",g),t.$on("$destroy",function(){u(),_.forEach(p,function(e){i.deregisterHotkey(e)})})};function m(e,t){var n;"week"==o.view?n=h.selectedDate.beginOfWeek(c.defaults.SOGoFirstDayOfWeek).addDays(7*t):"month"==o.view?((n=h.selectedDate).setDate(1),n.setMonth(n.getMonth()+t)):n=h.selectedDate.addDays(t),y(e,n)}function f(e){"month"==o.view?(e.setDate(1),e.setHours(12),e.$dateFormat="%B %Y"):"week"==o.view?(e.setTime(e.beginOfWeek(c.defaults.SOGoFirstDayOfWeek).getTime()),e.$dateFormat=l("Week %d").replace("%d","%U")):e.$dateFormat="%A"}function g(){s.$eventsBlocksForView(o.view,o.day.asDate()).then(function(e){var t,n,a;for(t=0;t=t;n--)h.views.splice(n,1)})}function y(e,t){var n=t?t.getDayString():angular.element(e.currentTarget).attr("date");t&&f(t),a.go("calendars.view",{day:n})}function v(e,t){a.go("calendars.view",{view:t})}}angular.module("SOGo.SchedulerUI").controller("CalendarController",e)}(),function(){"use strict";e.$inject=["$rootScope","$scope","$q","$timeout","$state","$mdDialog","sgHotkeys","sgFocus","Dialog","Preferences","CalendarSettings","Calendar","Component","Alarm"];function e(e,t,n,a,o,i,r,s,c,d,u,h,p,m){var f,g=this,y=[];g.component=p,g.componentType="events",g.selectedList=0,g.selectComponentType=v,g.unselectComponents=function(){_.forEach(p["$"+g.componentType],function(e){e.selected=!1}),g.mode.multiple=0},g.selectAll=function(){_.forEach(p["$"+g.componentType],function(e){e.selected=!0}),g.mode.multiple=p["$"+g.componentType].length},g.searchMode=$,g.toggleComponentSelection=function(e,t){t.selected=!t.selected,g.mode.multiple+=t.selected?1:-1,e.preventDefault(),e.stopPropagation()},g.confirmDeleteSelectedComponents=function(){c.confirm(l("Warning"),l("Are you sure you want to delete the selected components?"),{ok:l("Delete")}).then(function(){var t=_.filter(p["$"+g.componentType],function(e){return e.selected});h.$deleteComponents(t).then(function(){g.mode.multiple=0,e.$emit("calendars:list")})})},g.openEvent=function(e,t){C(e,t,"appointment")},g.openTask=function(e,t){C(e,t,"task")},g.newComponent=b,g.filterpopup=function(){return p["$query"+g.componentType.capitalize()].filterpopup},g.filter=function(e){p.$filter(g.componentType,{filterpopup:e})},g.filteredBy=function(e){return p["$query"+g.componentType.capitalize()].filterpopup==e},g.sort=function(e){p.$filter(g.componentType,{sort:e})},g.sortedBy=function(e){return p["$query"+g.componentType.capitalize()].sort==e},g.reload=function(){h.reloadWebCalendars().finally(function(){e.$emit("calendars:list")})},g.cancelSearch=function(){g.mode.search=!1,p.$filter(g.componentType,{value:""})},g.mode={search:!1,multiple:0},this.$onInit=function(){(n=y).push(r.createHotkey({key:l("hotkey_search"),description:l("Search"),callback:$})),n.push(r.createHotkey({key:l("hotkey_create_event"),description:l("Create a new event"),callback:b,args:"appointment"})),n.push(r.createHotkey({key:l("hotkey_create_task"),description:l("Create a new task"),callback:b,args:"task"})),_.forEach(n,function(e){r.registerHotkey(e)});var n;f="events","tasksListView"==d.settings.Calendar.SelectedList&&(g.selectedList=1,f="tasks"),v(f,{reload:!0}),e.$on("calendars:list",function(){p.$filter(g.componentType,{reload:!0})}),e.$on("calendar:dragend",k),t.$on("$destroy",function(){_.forEach(y,function(e){r.deregisterHotkey(e)})})};function v(e,t){(t&&t.reload||g.componentType!=e)&&(angular.isUndefined(p["$"+e])&&p.$filter(e),g.unselectComponents(),g.componentType=e,p.saveSelectedList(e))}function $(){g.mode.search=!0,s("search")}function C(e,t,a){if(t.viewable){var o=n.when();angular.isUndefined(t.$futureComponentData)&&(o=(t=h.$get(t.pid).$getComponent(t.id,t.occurrenceId)).$futureComponentData),o.then(function(){var n="UIx"+a.capitalize()+"ViewTemplate";i.show({parent:angular.element(document.body),targetEvent:e,clickOutsideToClose:!0,escapeToClose:!0,templateUrl:n,controller:"ComponentController",controllerAs:"editor",locals:{stateComponent:t}})})}}function b(e,t,n){var a;n?(a=n).updateFreeBusy():a=new p({pid:h.$defaultCalendar(),type:t});var o="UIx"+t.capitalize()+"EditorTemplate";return i.show({parent:angular.element(document.body),targetEvent:e,clickOutsideToClose:!0,escapeToClose:!0,templateUrl:o,controller:"ComponentEditorController",controllerAs:"editor",locals:{stateComponent:a}})}function k(t){var n,o,r,s,c,d,f;n=p.$ghost.component,o=p.$ghost.pointerHandler,n.isNew?(r=o.currentEventCoordinates,n.summary="",n.isAllDay&&(r.duration-=96),n.setDelta(15*r.duration),b(null,"appointment",n).catch().finally(function(){a(function(){p.$resetGhost()})})):(s=o.currentEventCoordinates.getDelta(o.originalEventCoordinates),c={days:s.dayNumber,start:15*s.start,duration:15*s.duration},o.originalCalendar&&0!==s.dayNumber&&(d=o.currentEventCoordinates.dayNumber,f=_.filter(h.$findAll(),{active:1}),c.destination=f[d].id,c.days=0),n.isException||!n.occurrenceId?n.$adjust(c).then(function(){e.$emit("calendars:list"),m.getAlarms()},function(e){y(e,n,c)}).finally(function(){a(function(){p.$resetGhost()})}):n.occurrenceId&&i.show({clickOutsideToClose:!0,escapeToClose:!0,locals:{component:n,params:c},template:['',' ',"

"+l("editRepeatingItem")+"

","
"," ",' '+l("button_thisOccurrenceOnly")+"",' '+l("button_allOccurrences")+""," ","
"].join(""),controller:g}).then(function(){e.$emit("calendars:list")},function(){}).finally(function(){a(function(){p.$resetGhost()})})),g.$inject=["$scope","$mdDialog","component","params"];function g(e,t,n,a){e.updateThisOccurrence=function(){n.$adjust(a).then(t.hide,function(e){t.cancel().then(function(){y(e,n,a)},function(){})})},e.updateAllOccurrences=function(){delete n.occurrenceId,n.$adjust(a).then(t.hide,function(e){t.cancel().then(function(){y(e,n,a)},function(){})})}}function y(t,n,a){t.status==u.ConflictHTTPErrorCode&&t.data&&t.data.message&&angular.isObject(t.data.message)&&i.show({parent:angular.element(document.body),clickOutsideToClose:!1,escapeToClose:!1,templateUrl:"UIxAttendeeConflictDialog",controller:v,controllerAs:"$AttendeeConflictDialogController",locals:{component:n,params:a,conflictError:t.data.message}}).then(function(){e.$emit("calendars:list")},function(){})}v.$inject=["$scope","$mdDialog","component","params","conflictError"];function v(e,t,n,a,o){this.conflictError=o,this.cancel=t.cancel,this.save=function(){n.$adjust(angular.extend({ignoreConflicts:!0},a)).then(t.hide)}}}}angular.module("SOGo.SchedulerUI").controller("CalendarListController",e)}(),function(){"use strict";e.$inject=["$rootScope","$scope","$window","$mdDialog","$log","$mdToast","Dialog","sgSettings","Preferences","Calendar"];function e(e,t,n,a,o,i,r,s,c,d){var u=this;u.activeUser=s.activeUser,u.service=d,u.newCalendar=function(e){r.prompt(l("New calendar"),l("Name of the Calendar")).then(function(e){var t=new d({name:e,isEditable:!0,isRemote:!1,owner:UserLogin});t.$id().then(function(){d.$add(t)})})},u.addWebCalendar=function(){r.prompt(l("Subscribe to a web calendar..."),l("URL of the Calendar"),{inputType:"url"}).then(function(t){d.$addWebCalendar(t).then(function(n){angular.isObject(n)&&a.show({parent:angular.element(document.body),clickOutsideToClose:!0,escapeToClose:!0,templateUrl:"UIxWebCalendarAuthDialog",controller:e,controllerAs:"$WebCalendarAuthDialogController",locals:{url:t,calendar:n}})})}),e.$inject=["scope","$mdDialog","url","calendar"];function e(e,t,n,a){var o=this,i=n.split("/"),r=i[2];o.title=l("Please identify yourself to %{0}").formatted(r),o.authenticate=function(e){!e.$valid&&e.$error.required||a.setCredentials(o.username,o.password).then(function(e){t.hide()},function(t){e.password.$setValidity("credentials",!1)})},o.cancel=function(){t.cancel()}}},u.subscribeToFolder=function(e){o.debug("subscribeToFolder "+e.owner+e.name),d.$subscribe(e.owner,e.name).then(function(e){i.show(i.simple().content(l("Successfully subscribed to calendar")).position("top right").hideDelay(3e3))})},u.filter={name:""},u.sortableMode=!1,u.toggleSortableMode=function(){u.sortableMode=!u.sortableMode,u.filter.name=""},u.resetSort=function(){d.saveFoldersOrder()},u.sortableCalendars={scrollableContainer:"#sidenav-content",containment:"md-list",orderChanged:function(){d.saveFoldersOrder(_.flatMap(d.$findAll(),"id"))},accept:function(e,t,n){return e.sortableScope.element[0]==t.element[0]}},this.$onInit=function(){u.categories=_.map(c.defaults.SOGoCalendarCategories,function(e){return{id:e.asCSSIdentifier(),name:e,color:c.defaults.SOGoCalendarCategoriesColors[e]}}),t.$watch(function(){return _.union(_.map(d.$calendars,function(e){return _.pick(e,["id","active","color"])}),_.map(d.$subscriptions,function(e){return _.pick(e,["id","active","color"])}),_.map(d.$webcalendars,function(e){return _.pick(e,["id","active","color"])}))},function(t,n){var a,i,r;a=_.intersectionBy(t,n,"id"),i=_.map(_.filter(a,function(e){var t=_.find(n,{id:e.id});return!_.isEqual(e,t)}),"id"),r=d.$q.when(),i.length>0&&(o.debug(i.join(", ")+" changed"),r=d.saveFoldersActivation(i)),(i.length>0||a.length!=t.length||a.length!=n.length)&&r.then(function(){e.$emit("calendars:list")})},!0)}}angular.module("SOGo.SchedulerUI").controller("CalendarsController",e)}(),function(){"use strict";e.$inject=["$rootScope","$mdDialog","Calendar","Component","AddressBook","Alarm","Account","stateComponent"];function e(e,t,n,a,o,i,r,s){var c,d=this;d.calendarService=n,d.service=a,d.component=s,d.close=function(){t.hide()},d.highPriority=function(){return d.component&&d.component.priority&&d.component.priority<5},d.cardFilter=function(e){return o.$filterAll(e)},d.newMessageWithAllRecipients=function(e){var t=_.map(d.component.attendees,function(e){return e.name+" <"+e.email+">"});u(e,t)},d.newMessageWithRecipient=function(e,t,n){u(e,[t+" <"+n+">"])},d.edit=h,d.editAllOccurrences=function(){(c=n.$get(d.component.pid).$getComponent(d.component.id)).$futureComponentData.then(function(){d.component=c,h()})},d.reply=p,d.replyAllOccurrences=function(){(c=n.$get(d.component.pid).$getComponent(d.component.id)).$futureComponentData.then(function(){c.reply=d.component.reply,c.delegatedTo=d.component.delegatedTo,c.$hasAlarm=d.component.$hasAlarm,c.alarm=d.component.alarm,p(c)})},d.deleteOccurrence=function(){d.component.remove(!0).then(function(){e.$emit("calendars:list"),t.hide()})},d.deleteAllOccurrences=function(){d.component.remove().then(function(){e.$emit("calendars:list"),t.hide()})},d.toggleRawSource=function(e){n.$$resource.post(d.component.pid+"/"+d.component.id,"raw").then(function(n){t.hide(),t.show({parent:angular.element(document.body),targetEvent:e,clickOutsideToClose:!0,escapeToClose:!0,template:['',' ','
',"  
"," ",' '+l("Close")+""," ","
"].join(""),controller:a,locals:{data:n}}),a.$inject=["scope","$mdDialog","data"];function a(e,t,n){e.data=n,e.close=function(){t.hide()}}})},d.copySelectedComponent=function(n){d.component.copyTo(n).then(function(){t.hide(),e.$emit("calendars:list")})},d.moveSelectedComponent=function(n){d.component.moveTo(n).then(function(){t.hide(),e.$emit("calendars:list")})},d.organizer=[s.organizer];function u(e,n){r.$findAll().then(function(a){var o=_.find(a,function(e){if(0===e.id)return e});o.$getMailboxes().then(function(a){o.$newMessage().then(function(a){angular.extend(a.editable,{to:n,subject:d.component.summary}),t.show({parent:angular.element(document.body),targetEvent:e,clickOutsideToClose:!1,escapeToClose:!1,templateUrl:"../Mail/UIxMailEditor",controller:"MessageEditorController",controllerAs:"editor",locals:{stateAccount:o,stateMessage:a}})})})}),e.preventDefault(),e.stopPropagation()}function h(){var e="vevent"==d.component.component?"Appointment":"Task";t.hide().then(function(){var n="UIx"+e+"EditorTemplate";t.show({parent:angular.element(document.body),clickOutsideToClose:!0,escapeToClose:!0,templateUrl:n,controller:"ComponentEditorController",controllerAs:"editor",locals:{stateComponent:d.component}})})}function p(n){(n||d.component).$reply().then(function(){e.$emit("calendars:list"),i.getAlarms(),t.hide()})}}t.$inject=["$rootScope","$scope","$log","$timeout","$mdDialog","sgFocus","User","CalendarSettings","Calendar","Component","AddressBook","Card","Alarm","stateComponent"];function t(e,t,n,a,o,i,r,s,c,d,u,h,p,m){var f,g,y=this;y.service=c,y.component=m,y.categories={},y.showRecurrenceEditor=y.component.$hasCustomRepeat,y.toggleRecurrenceEditor=function(){y.showRecurrenceEditor=!y.showRecurrenceEditor,y.component.$hasCustomRepeat=y.showRecurrenceEditor},y.recurrenceMonthDaysAreRequired=function(){return y.component&&"monthly"==y.component.repeat.frequency&&"bymonthday"==y.component.repeat.month.type},y.showAttendeesEditor=y.component.attendees&&y.component.attendees.length,y.toggleAttendeesEditor=function(){y.showAttendeesEditor=!y.showAttendeesEditor},y.changeFrequency=function(){"custom"==y.component.repeat.frequency&&(y.showRecurrenceEditor=!0)},y.changeCalendar=function(){y.component.attendees&&y.component.attendees.length>0&&y.component.initOrganizer(c.$get(y.component.destinationCalendar))},y.cardFilter=function(e){return u.$filterAll(e),u.$cards},y.addAttendee=function(e){var t,n,a=!y.component.attendees||0===y.component.attendees.length,o=c.$get(y.component.destinationCalendar),i=a?{organizerCalendar:o}:{},r=/([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)/i;function s(e){var t=e.match(r),n=t[0],o=e.replace(new RegExp(" *? *"),"");return y.showAttendeesEditor|=a,y.searchText="",new h({c_cn:_.trim(o,' "'),emails:[{value:n}]})}if(angular.isString(e)){for(n="",t=0;t5?l("low"):y.component.priority>4?l("normal"):l("high")},y.reset=v,y.cancel=function(e){v(e),y.component.isNew&&(y.component=null);o.hide()},y.edit=$,y.save=function(t,n){t.$valid&&y.component.$save(n).then(function(t){e.$emit("calendars:list"),p.getAlarms(),o.hide()},function(e){e.status==s.ConflictHTTPErrorCode&&_.isObject(e.data.message)?y.attendeeConflictError=e.data.message:$(t)})},y.attendeeConflictError=!1,y.attendeesEditor={days:C(),hours:function(){for(var e=[],t=0;t<=23;t++)e.push(t.toString());return e}()},y.addStartDate=function(){y.component.$addStartDate(),f=new Date(y.component.start.getTime())},y.addDueDate=function(){y.component.$addDueDate(),new Date(y.component.due.getTime())},y.adjustStartTime=function(){if(y.component.start){0!==f.valueOf()-y.component.start.valueOf()&&(f=new Date(y.component.start.getTime()),"appointment"===y.component.type&&(y.component.end=new Date(y.component.start.getTime()),y.component.end.addMinutes(y.component.delta),g=new Date(y.component.end.getTime())),b())}},y.adjustEndTime=function(){if(y.component.end){var e=g.valueOf()-y.component.end.valueOf();0!==e&&((e=y.component.start.minutesTo(y.component.end))<0?y.component.end=new Date(g.getTime()):(y.component.delta=e,g=new Date(y.component.end.getTime())),b())}},y.adjustDueTime=function(){new Date(y.component.due.getTime())},y.component.start&&(f=new Date(y.component.start.getTime())),y.component.end&&(g=new Date(y.component.end.getTime())),y.component.due&&new Date(y.component.due.getTime());function v(e){y.component.$reset(),e.$setPristine()}function $(e){y.attendeeConflictError=!1,e.$setPristine(),e.$setDirty()}function C(){var e=[];return y.component.start&&y.component.end&&(e=y.component.start.daysUpTo(y.component.end)),_.map(e,function(e){return{stringWithSeparator:e.stringWithSeparator(),getDayString:e.getDayString()}})}function b(){y.attendeesEditor.days=C(),y.component.updateFreeBusy()}}angular.module("SOGo.SchedulerUI").controller("ComponentController",e).controller("ComponentEditorController",t)}(),function(){"use strict";e.$inject=["$scope","Calendar"];function e(e,t){this.day=e.day,this.dayNumber=e.dayNumber,this.dayString=e.dayString,this.calendarData=function(){var n,a,o;return e.calendar?(n=e.calendar,o=_.filter(t.$findAll(),{active:1}),a=_.findIndex(o,function(e){return e.id==n}),{pid:n,index:a}):null}}angular.module("SOGo.SchedulerUI").directive("sgCalendarDay",function(){return{restrict:"E",scope:{day:"@sgDay",dayNumber:"@sgDayNumber",dayString:"@sgDayString",calendar:"@sgCalendar"},controller:e}})}(),function(){"use strict";e.$inject=["CalendarSettings"];function e(e){return{restrict:"E",scope:{block:"=sgBlock",clickBlock:"&sgClick"},replace:!0,template:function(e,t){var n=_.has(t,"sgCalendarGhost")?"":"::";return['
",'
','
",'
',' {{'+n+"block.component.c_priority}}"," {{ "+n+"block.component.summary }}",' ',' ',' ',' ',' '," ",'
',' place ',"
","
","
",'
{{ block.startHour }}
','
{{ block.endHour }}
',"
"].join("")},link:function(e,t,n){var a,o,i;_.has(n,"sgCalendarGhost")||(a=100/e.block.siblings,o=e.block.position*a,i=100-(e.block.position+1)*a,a<100&&(o>0&&(o-=2),i>0&&(i-=2)),0===o&&(o=2),0===i&&(i=2),t.css("left",o+"%"),t.css("right",i+"%"),e.block.component&&e.block.component.c_isallday||(t.addClass("starts"+e.block.start),t.addClass("lasts"+e.block.length)),e.block.userState&&t.addClass("sg-event--"+e.block.userState),e.block.component&&(t.addClass("bg-folder"+e.block.component.pid),t.addClass("contrast-bdr-folder"+e.block.component.pid),0===e.block.component.c_isopaque&&t.addClass("sg-event--transparent"),0===e.block.component.c_status&&t.addClass("sg-event--cancelled")))}}}angular.module("SOGo.SchedulerUI").directive("sgCalendarDayBlock",e)}(),function(){"use strict";angular.module("SOGo.SchedulerUI").directive("sgCalendarDayTable",function(){return{restrict:"E",scope:{blocks:"=sgBlocks",day:"@sgDay",clickBlock:"&sgClick"},template:["'].join("")}})}(),function(){"use strict";e.$inject=["$rootScope","$timeout","CalendarSettings","Calendar","Component"];function e(e,t,n,a,o){return{restrict:"A",require:["^sgCalendarDay","^sgCalendarScrollView"],link:function(t,i,r,s){var c,l,d,u,h;c=i[0],l=s[0],d=s[1],u=-1,i.addClass("sg-event--ghost md-whiteframe-3dp ng-hide");var p=e.$on("calendar:dragstart",function(){var e,n,a;t.block=o.$ghost,(n=l.calendarData())&&(u=n.index,e=n.pid,h=t.block.pointerHandler.originalCalendar.index);e||(e=t.block.component.pid);(a=t.block.component.blocks[0].userState)&&i.addClass("sg-event--"+a);i.addClass("bg-folder"+e)}),m=e.$on("calendar:drag",function(){var e,o,r,s,c,p,m,f;if(e=!1,a.$view&&a.$view.type==d.type){if(o="multiday-allday"===d.type,r=t.block.component.c_isallday,s=t.block.pointerHandler.currentEventCoordinates.dayNumber,c=t.block.pointerHandler.currentEventCoordinates.start,m=t.block.pointerHandler.currentEventCoordinates.duration,f=n.EventDragDayLength-c,angular.isUndefined(m))return;for((p=m)>f&&(p=f),s>-1&&(u<0&&s==l.dayNumber||s==u&&(h==u||!t.block.component.isException))&&(e=!0,o||(r||(t.block.startHour=($=c,g($))),a.$view.quarterHeight?(i.css("top",c*a.$view.quarterHeight+"px"),i.css("height",p*a.$view.quarterHeight+"px")):i.css("top",a.$view.topOffset+"px")),i.removeClass("fg-folder"+t.block.component.pid),i.removeClass("sg-event--ghost--last"),i.addClass("sg-event--ghost--first"),t.block.isFirst=!0),m-=p,s++;!e&&m&&s<=l.dayNumber;)(p=m)>n.EventDragDayLength&&(p=n.EventDragDayLength),s>-1&&s==l.dayNumber&&(e=!0,o||(i.css("top",a.$view.topOffset+"px"),a.$view.quarterHeight&&i.css("height",p*a.$view.quarterHeight+"px")),i.removeClass("sg-event--ghost--first"),i.removeClass("sg-event--ghost--last"),i.addClass("fg-folder"+t.block.component.pid)),m-=p,s++,c=0;m||(o?i.addClass("sg-event--ghost--last"):r||(t.block.endHour=(y=c,v=p,g((y+v)%n.EventDragDayLength))))}var y,v;var $;e?i.removeClass("ng-hide"):i.addClass("ng-hide")}),f=e.$on("calendar:dragend",function(){_.forEachRight(c.classList,function(e){/^bg-folder/.test(e)&&i.removeClass(e)}),i.addClass("ng-hide")});t.$on("$destroy",function(){p(),m(),f()});function g(e){var t,n,a;return t=15*e,(n=Math.floor(t/60))<10&&(n="0"+n),(a=t%60)<10&&(a="0"+a),n+":"+a}}}}angular.module("SOGo.SchedulerUI").directive("sgCalendarGhost",e)}(),function(){"use strict";e.$inject=["CalendarSettings"];function e(e){return{restrict:"E",scope:{component:"=sgComponent",clickComponent:"&sgClick"},replace:!0,template:function(e,t){return['
','
",' '," {{ ::component.c_title }}",' ',' ',' ',' ',' '," ",'
',' access_time ',"
",'
',' place ',"
","
"].join("")},link:function(e,t,n){e.component.viewable&&t.addClass("md-clickable");e.component.userstate&&t.addClass("sg-event--"+e.component.userstate);t.addClass("bg-folder"+e.component.pid),t.addClass("contrast-bdr-folder"+e.component.pid),0===e.component.c_isopaque&&t.addClass("sg-event--transparent");0===e.component.c_status&&t.addClass("sg-event--cancelled")}}}angular.module("SOGo.SchedulerUI").directive("sgCalendarListEvent",e)}(),function(){e.$inject=["$rootScope","$scope","$element","$mdToast","$mdPanel","$mdMedia","$mdSidenav","sgConstant","Dialog","Calendar"];function e(e,t,n,a,o,i,r,s,c,d){var u=this;this.$onInit=function(){this.editMode=!1},this.$postLink=function(){this.clickableElement=n.find("p")[0],this.nameElements=this.clickableElement.getElementsByClassName("sg-calendar-name"),this.inputContainer=n.find("md-input-container")[0],this.inputElement=n.find("input")[0],this.moreOptionsButton=_.last(n.find("md-icon")),this.updateCalendarName()},this.updateCalendarName=function(){_.forEach(this.nameElements,function(e){e.innerHTML=u.calendar.name})},this.editFolder=function(e){this.editMode=!0,this.inputElement.value=this.calendar.name,this.clickableElement.classList.add("ng-hide"),this.inputContainer.classList.remove("ng-hide"),this.inputElement.focus(),this.inputElement.select(),e&&(e.stopPropagation(),e.preventDefault())},this.saveFolder=function(e){this.inputElement.disabled||(this.calendar.name=this.inputElement.value,this.inputElement.disabled=!0,this.calendar.$rename().then(function(e){u.editMode=!1,u.inputContainer.classList.add("ng-hide"),u.clickableElement.classList.remove("ng-hide"),u.updateCalendarName()}).finally(function(){u.inputElement.disabled=!1}))},this.revertEditing=function(){this.editMode=!1,this.clickableElement.classList.remove("ng-hide"),this.inputContainer.classList.add("ng-hide"),this.inputElement.value=this.calendar.name},this.confirmDelete=function(){this.calendar.isSubscription?this.calendar.$delete().catch(function(e,t){c.alert(l('An error occured while deleting the calendar "%{0}".',u.calendar.name),l(e.error))}):c.confirm(l("Warning"),l('Are you sure you want to delete the calendar "%{0}"?',this.calendar.name),{ok:l("Delete")}).then(function(){u.calendar.$delete().catch(function(e,t){c.alert(l('An error occured while deleting the calendar "%{0}".',u.calendar.name),l(e.error))})})},this.showMenu=function(t){var n=o.newPanelPosition().relativeTo(this.moreOptionsButton).addPanelPosition(o.xPosition.ALIGN_START,o.yPosition.ALIGN_TOPS),i=o.newPanelAnimation().openFrom(this.moreOptionsButton).duration(100).withAnimation(o.animation.FADE),r={attachTo:angular.element(document.body),locals:{itemCtrl:this,calendar:this.calendar,editFolder:angular.bind(this,this.editFolder),confirmDelete:angular.bind(this,this.confirmDelete)},bindToController:!0,controller:s,controllerAs:"$menuCtrl",position:n,animation:i,targetEvent:t,templateUrl:"UIxCalendarMenu",trapFocus:!0,clickOutsideToClose:!0,escapeToClose:!0,focusOnOpen:!0};o.open(r).then(function(e){e.panelEl.one("click",function(){e.close()})}),s.$inject=["mdPanelRef","$mdDialog","FileUploader","User"];function s(n,o,i,r){var s=this;this.showOnly=function(){_.forEach(d.$findAll(),function(e){s.calendar.id==e.id?e.active=1:e.active=0})},this.showAll=function(){_.forEach(d.$findAll(),function(e){e.active=1})},this.showProperties=function(){var e=this.calendar.color;o.show({templateUrl:this.calendar.id+"/properties",controller:t,controllerAs:"properties",clickOutsideToClose:!0,escapeToClose:!0,locals:{srcCalendar:this.calendar}}).catch(function(){s.calendar.color=e}),t.$inject=["$scope","$mdDialog","srcCalendar"];function t(e,t,n){var a=this;a.calendar=new d(n.$omit()),a.saveProperties=function(e){e.$valid&&(a.calendar.$save(),n.init(a.calendar.$omit()),t.hide())},a.close=function(){t.cancel()},e.$watch(function(){return a.calendar.color},function(){n.color=a.calendar.color})}},this.showLinks=function(){o.show({parent:angular.element(document.body),clickOutsideToClose:!0,escapeToClose:!0,templateUrl:this.calendar.id+"/links",controller:e,controllerAs:"links",locals:{calendar:this.calendar}}),e.$inject=["$mdDialog","calendar"];function e(e,t){this.calendar=t,this.close=function(){e.hide()}}},this.importCalendar=function(){o.show({parent:angular.element(document.body),targetEvent:t,clickOutsideToClose:!0,escapeToClose:!0,templateUrl:"UIxCalendarImportDialog",controller:n,controllerAs:"$CalendarImportDialogController",locals:{folder:this.calendar}}),n.$inject=["scope","$mdDialog","folder"];function n(t,n,o){this.uploader=new i({url:ApplicationBaseURL+[o.id,"import"].join("/"),autoUpload:!0,queueLimit:1,filters:[{name:r,fn:r}],onSuccessItem:function(t,o,i,r){var s;n.hide(),0===o.imported?s=l("No event was imported."):(s=l("A total of %{0} events were imported in the calendar.",o.imported),e.$emit("calendars:list")),a.show(a.simple().content(s).position("top right").hideDelay(3e3))},onErrorItem:function(e,t,n,o){a.show({template:["",'
',' error_outline'," "+l("An error occurred while importing calendar.")+"","
","
"].join(""),position:"top right",hideDelay:3e3})}}),this.close=function(){n.hide()};function r(e){var t=0===e.type.indexOf("text")||/\.(ics)$/.test(e.name);return t||a.show({template:["",'
',' error_outline'," "+l("Select an iCalendar file (.ics).")+"","
","
"].join(""),position:"top right",hideDelay:3e3}),t}}},this.share=function(){this.calendar.$acl.$users().then(function(){o.show({templateUrl:s.calendar.id+"/UIxAclEditor",controller:"AclController",controllerAs:"acl",clickOutsideToClose:!0,escapeToClose:!0,locals:{usersWithACL:s.calendar.$acl.users,User:r,folder:s.calendar}})})}}}}angular.module("SOGo.SchedulerUI").controller("sgCalendarListItemController",e).directive("sgCalendarListItem",function(){return{restrict:"C",scope:{},bindToController:{calendar:"=sgCalendar"},template:['','

',' ',' ',' ',"

",'',' ',"",''," drag_handle","",'more_vert'].join(""),controller:"sgCalendarListItemController",controllerAs:"$ctrl"}})}(),function(){"use strict";angular.module("SOGo.SchedulerUI").directive("sgCalendarMonthDay",function(){return{restrict:"E",scope:{blocks:"=sgBlocks",day:"@sgDay",clickBlock:"&sgClick"},template:["'].join("")}})}(),function(){"use strict";angular.module("SOGo.SchedulerUI").directive("sgCalendarMonthEvent",function(){return{restrict:"E",scope:{block:"=sgBlock",clickBlock:"&sgClick"},replace:!0,template:function(e,t){var n=_.has(t,"sgCalendarGhost")?"":"::";return['
','
",' {{ '+n+"block.component.startHour }}",' {{'+n+"block.component.c_priority}}"," {{ "+n+"block.component.summary }}",' ',' ',' ',' ',' '," ","
"].join("")},link:function(e,t,n){_.has(n,"sgCalendarGhost")||(e.block.userState&&t.addClass("sg-event--"+e.block.userState),e.block.component&&(t.addClass("bg-folder"+e.block.component.pid),0===e.block.component.c_isopaque&&t.addClass("sg-event--transparent"),0===e.block.component.c_status&&t.addClass("sg-event--cancelled")))}}})}(),function(){"use strict";e.$inject=["$rootScope","$window","$document","$q","$timeout","$mdGesture","Calendar","Component","Preferences"];function e(e,n,a,o,i,r,s,c,l){return{restrict:"A",scope:{type:"@sgCalendarScrollView"},controller:t,link:function(t,a,o,r){var d,u,h=!1;d=null,u=t.type,h="multicolumndayview"==a.attr("sg-view"),r.isMultiColumn=h,i(function(){if(d=new p(a,u),"monthly"!=u){var e,t,n;l.defaults.SOGoDayStartTime&&(e=l.defaults.SOGoDayStartTime.split(":"),t=document.getElementById("hour"+parseInt(e[0])),n=parseInt(e[1])*d.quarterHeight,d.element.scrollTop=t.offsetTop+n)}r.quarterHeight=d.quarterHeight}),t.$on("$destroy",function(){d&&d.$destroy()});function p(t,a){this.$element=t,this.element=t[0],this.type=a,this.quarterHeight=this.getQuarterHeight(),this.scrollStep=6*this.quarterHeight,this.dayNumbers=this.getDayNumbers(),this.maxX=this.getMaxColumns(),this.deregisterDragStart=e.$on("calendar:dragstart",angular.bind(this,this.onDragStart)),this.deregisterDragStop=e.$on("calendar:dragend",angular.bind(this,this.onDragEnd)),this.bindedUpdateCoordinates=angular.bind(this,this.updateCoordinates),this.bindedUpdateFromPointerHandler=angular.bind(this,this.updateFromPointerHandler),this.updateCoordinates(),angular.element(n).on("resize",this.bindedUpdateCoordinates)}p.prototype={$destroy:function(){this.deregisterDragStart(),this.deregisterDragStop(),this.$element.off("mousemove",this.bindedUpdateFromPointerHandler),angular.element(n).off("resize",this.bindedUpdateCoordinates)},onDragStart:function(){this.$element.on("mousemove",this.bindedUpdateFromPointerHandler),this.updateCoordinates(),this.updateFromPointerHandler()},onDragEnd:function(){this.$element.off("mousemove",this.bindedUpdateFromPointerHandler),s.$view=null},getQuarterHeight:function(){var e,t,n=null;return e=document.getElementById("hour0"),t=document.getElementById("hour23"),e&&t&&(n=(t.offsetTop-e.offsetTop)/92),n},getDayDimensions:function(e){var t,n,a,o,i,r,s;return n=t=a=o=0,(i=this.element.getElementsByClassName("day")).length>0&&(n=(r=i[0].getBoundingClientRect()).height,t=r.width,a=r.left-e,(s=i[0].getElementsByClassName("sg-calendar-tile-header")).length>0&&(o=s[0].clientHeight)),{height:n,width:t,offset:{left:a,top:o}}},getDayNumbers:function(){var e;return e=this.element.getElementsByTagName("sg-calendar-day"),_.map(e,function(e,t){return h?t:parseInt(e.attributes["sg-day-number"].value)})},getMaxColumns:function(){var e,t=0;return"monthly"==this.type?(e=this.element.getElementsByTagName("md-grid-list")[0],t=parseInt(e.attributes["md-cols"].value)-1):t=this.element.getElementsByClassName("day").length-1,t},updateCoordinates:function(){var e,t;e=this.element.getBoundingClientRect(),t=this.getDayDimensions(e.left),angular.extend(this,{coordinates:{x:e.left,y:e.top},dayHeight:t.height,dayWidth:t.width,daysOffset:t.offset.left,topOffset:t.offset.top})},updateFromPointerHandler:function(){var e,t,n,a,o,i;e=c.$ghost.pointerHandler,this.coordinates&&e&&(t=e.getContainerBasedCoordinates(this))&&(s.$view=this,n=(new Date).getTime(),(!this.lastScroll||n>this.lastScroll+100)&&(this.lastScroll=n,(a=t.y-this.scrollStep)<0?(a<(o=-this.element.scrollTop)&&(a=o),this.element.scrollTop+=a):(i=(a=t.y+this.scrollStep)-this.element.clientHeight)>0&&(this.element.scrollTop+=i)))}}}}}t.$inject=["$scope"];function t(e){this.type=e.type}angular.module("SOGo.SchedulerUI").directive("sgCalendarScrollView",e)}(),function(){"use strict";angular.module("SOGo.SchedulerUI").directive("sgCategoryStylesheet",function(){return{restrict:"E",require:"ngModel",scope:{ngModel:"="},replace:!0,template:['"].join("")}})}(),function(){"use strict";e.$inject=["$rootScope","$timeout","$log","Preferences","Calendar","CalendarSettings","Component"];function e(e,t,n,a,o,i,r){return{restrict:"CA",require:"^sgCalendarDay",link:function(s,c,d,u){if(s.block){if(!s.block.component.editable||s.block.userState)return void c.removeClass("sg-draggable-calendar-block");!function(){var e,t,n,a,o,i,r,l,d,u;if(s.block.length<3)return;e=s.block.component,t=s.block.dayIndex,n=_.findIndex(e.blocks,["dayIndex",t]),a=0===n,o=n===e.blocks.length-1,(i=angular.element('
')).addClass("bdr-folder"+e.pid),e.c_isallday||"SG-CALENDAR-MONTH-DAY"===c[0].parentNode.tagName?(a&&(r=angular.element('
').append(i),c.append(r)),o&&(l=angular.element('
').append(i.clone()),c.append(l))):(a&&(d=angular.element('
').append(i),c.append(d)),o&&(u=angular.element('
').append(i.clone()),c.append(u)))}()}c.on("mousedown",h),s.$on("$destroy",function(){c.off("mousedown",h),c.off("mousemove",p)});function h(e){var t,n,a,o;e.stopPropagation(),e.target.scrollHeight>e.target.clientHeight+1&&(a=e.target.getBoundingClientRect(),o=a.left+a.width-18,e.pageX>o)||(t="move-event",s.block&&s.block.component?"dragGrip-top"==e.target.className||"dragGrip-left"==e.target.className?t="change-start":"dragGrip-bottom"!=e.target.className&&"dragGrip-right"!=e.target.className||(t="change-end"):t="change-end",(n=new y(t)).initFromEvent(e),r.$ghost.pointerHandler=n,angular.element(document).one("mouseup",m),angular.element(document).on("mousemove",p))}function p(e){var n=r.$ghost.pointerHandler;t(function(){n.updateFromEvent(e)})}function m(t){var n,a;n=s.block,a=r.$ghost.pointerHandler,angular.element(document).off("mousemove",p),a.dragHasStarted&&(e.$emit("calendar:dragend"),a.dragHasStarted=!1),n&&n.component&&_.forEach(n.component.blocks,function(e){e.dragging=!1})}function f(){}f.prototype={x:-1,y:-1,getDelta:function(e){var t=new f;return t.x=this.x-e.x,t.y=this.y-e.y,o.$view&&(t.days=o.$view.dayNumbers[this.x]-o.$view.dayNumbers[e.x]),t},getDistance:function(e){var t=this.getDelta(e);return Math.sqrt(t.x*t.x+t.y*t.y)},clone:function(){var e=new f;return e.x=this.x,e.y=this.y,e}};function g(e){this.setEventType(e)}g.prototype={dayNumber:-1,weekDay:-1,start:-1,duration:-1,eventType:null,setEventType:function(e){this.eventType=e},initFromBlock:function(e){var t=-1;"monthly"===this.eventType?(this.start=0,this.duration=e.component.blocks.length*i.EventDragDayLength):(this.start=e.component.blocks[0].start,this.duration=_.sumBy(e.component.blocks,function(e){var n,a;return a=e.dayNumber,n=t<0?0:a-t-1,t=a,e.length+n*i.EventDragDayLength}))},initFromCalendar:function(e){this.dayNumber=e},getDelta:function(e){var t=new g;return t.dayNumber=this.dayNumber-e.dayNumber,t.start=this.start-e.start,t.duration=this.duration-e.duration,t},_quartersToHM:function(e){var t=15*e,n=Math.floor(t/60);n<10&&(n="0"+n);var a=t%60;return a<10&&(a="0"+a),n+":"+a},getStartTime:function(){return this._quartersToHM(this.start)},getEndTime:function(){var e=(this.start+this.duration)%i.EventDragDayLength;return this._quartersToHM(e)},clone:function(){var e=new g;return e.dayNumber=this.dayNumber,e.start=this.start,e.duration=this.duration,e}};function y(e){this.dragMode=e}y.prototype={originalCoordinates:null,currentCoordinates:null,originalViewCoordinates:null,currentViewCoordinates:null,originalEventCoordinates:null,currentEventCoordinates:null,originalCalendar:null,dragHasStarted:!1,getEventViewCoordinates:null,initFromBlock:function(e){this.currentEventCoordinates=new g(this.eventType),this.originalEventCoordinates=new g(this.eventType),this.originalEventCoordinates.initFromBlock(e)},initFromEvent:function(e){this.currentCoordinates=new f,this.updateFromEvent(e),this.originalCoordinates=this.currentCoordinates.clone()},initFromCalendar:function(e){this.originalCalendar=e,this.currentEventCoordinates.initFromCalendar(e.index),this.originalEventCoordinates.initFromCalendar(e.index)},updateFromEvent:function(t){if(this.currentCoordinates.x=t.pageX,this.currentCoordinates.y=t.pageY,this.dragHasStarted&&o.$view){var i=this.getEventViewCoordinates(o.$view);this.originalViewCoordinates||(this.originalViewCoordinates=this.getEventViewCoordinates(o.$view,this.originalCoordinates),r.$ghost.component.isNew&&(this.setTimeFromQuarters(r.$ghost.component.start,this.originalViewCoordinates.y),n.debug("new event start date "+r.$ghost.component.start))),this.currentViewCoordinates&&i&&i.x==this.currentViewCoordinates.x&&i.y==this.currentViewCoordinates.y||(this.currentViewCoordinates=i,this.originalViewCoordinates&&(i||(this.currentViewCoordinates=this.originalViewCoordinates.clone()),this.updateEventCoordinates()))}else if(this.originalCoordinates&&this.currentCoordinates&&!this.dragHasStarted){var d=this.getDistance();d>3&&(this.dragHasStarted=!0,function(t){var i,d,h,p,m,f,g,y,v;h=c.hasClass("clickableHourCell"),p="SG-CALENDAR-MONTH-DAY"==c[0].parentNode.tagName||c.hasClass("clickableDayCell"),v=u.calendarData(),s.block&&s.block.component?i=s.block:(m=u.dayString.parseDate(a.$mdDateLocaleProvider,"%Y-%m-%e"),f={type:"appointment",pid:v?v.pid:o.$defaultCalendar(),summary:l("New Event"),startDate:m,isAllDay:h?0:1},g=new r(f),(i={component:g,dayNumber:u.dayNumber,length:0}).component.blocks=[i]);d="multiday",p?d="monthly":i.component.c_isallday&&(d="multiday-allday");_.forEach(i.component.blocks,function(e){e.dragging=!0}),(y=r.$ghost.pointerHandler).prepareWithEventType(d),y.initFromBlock(i),v&&y.initFromCalendar(v);r.$ghost.component=i.component,n.debug("emit calendar:dragstart "+d),e.$emit("calendar:dragstart")}())}},updateEventCoordinates:function(){var t,a=this.currentViewCoordinates.getDelta(this.originalViewCoordinates),r=a.days*i.EventDragDayLength+a.y;n.debug("quarters delta "+r),angular.isUndefined(this.originalEventCoordinates.start)?(this.originalEventCoordinates.dayNumber=o.$view.dayNumbers[this.originalViewCoordinates.x],this.originalEventCoordinates.start=this.originalViewCoordinates.y):this.originalEventCoordinates.dayNumber<0&&(this.originalEventCoordinates.dayNumber=o.$view.dayNumbers[s.block.component.blocks[0].dayIndex]),this.currentEventCoordinates.dayNumber=this.originalEventCoordinates.dayNumber,"move-event"==this.dragMode?(this.currentEventCoordinates.start=this.originalEventCoordinates.start+r,this.currentEventCoordinates.duration=this.originalEventCoordinates.duration):"change-start"==this.dragMode?(t=this.originalEventCoordinates.duration-r)>0?(this.currentEventCoordinates.start=this.originalEventCoordinates.start+r,this.currentEventCoordinates.duration=t):t<0&&(this.currentEventCoordinates.start=this.originalEventCoordinates.start+this.originalEventCoordinates.duration,this.currentEventCoordinates.duration=-t):"change-end"==this.dragMode&&((t=this.originalEventCoordinates.duration+r)>0?(this.currentEventCoordinates.start=this.originalEventCoordinates.start,this.currentEventCoordinates.duration=t):t<0&&(this.currentEventCoordinates.start=this.originalEventCoordinates.start+t,this.currentEventCoordinates.duration=-t));var c;this.currentEventCoordinates.start<0?(c=Math.ceil(-this.currentEventCoordinates.start/i.EventDragDayLength),this.currentEventCoordinates.start+=c*i.EventDragDayLength,this.currentEventCoordinates.dayNumber-=c):this.currentEventCoordinates.start>=i.EventDragDayLength&&(c=Math.floor(this.currentEventCoordinates.start/i.EventDragDayLength),this.currentEventCoordinates.start-=c*i.EventDragDayLength,this.currentEventCoordinates.dayNumber+=c),n.debug("event coordinates "+JSON.stringify(this.currentEventCoordinates)),e.$emit("calendar:drag")},getContainerBasedCoordinates:function(e,t){var n=t||this.currentCoordinates,a=n.getDelta(e.coordinates),o=e.element;return(a.xo.clientWidth||a.y<0||a.y>o.clientHeight)&&(a=null),a},prepareWithEventType:function(e){var t={multiday:this.getEventMultiDayViewCoordinates,"multiday-allday":this.getEventMultiDayAllDayViewCoordinates,monthly:this.getEventMonthlyViewCoordinates,unknown:null},n=t[e];this.eventType=e,this.getEventViewCoordinates=n},getEventMultiDayViewCoordinates:function(e,t){var n=this.getEventMultiDayAllDayViewCoordinates(e,t);if(n){var a=e.quarterHeight,o=this.getContainerBasedCoordinates(e,t);o.y+=e.element.scrollTop,n.y=Math.floor((o.y-i.EventDragHorizontalOffset)/a);var r=i.EventDragDayLength-1;n.y<0?n.y=0:n.y>r&&(n.y=r)}return n},getEventMultiDayAllDayViewCoordinates:function(e,t){var n,a=this.getContainerBasedCoordinates(e,t);if(a){n=new f;var i=e.dayWidth,r=e.daysOffset;n.x=Math.floor((a.x-r)/i);var s=0,c=o.$view.maxX;if("move-event"!=this.dragMode){var l=u.calendarData();l&&(s=c=l.index)}n.xc&&(n.x=c),n.y=0}else n=null;return n},getEventMonthlyViewCoordinates:function(e,t){var n,a=this.getContainerBasedCoordinates(e,t);if(a){n=new f;var o=e.maxX,i=e.dayWidth,r=e.daysOffset,s=e.dayHeight,c=Math.floor((a.y-0)/s);c<0&&(c=0),n.x=Math.floor((a.x-r)/i),n.x<0?n.x=0:n.x>o&&(n.x=o),n.x+=(o+1)*c,n.y=0}else n=null;return n},getDistance:function(){return this.currentCoordinates.getDistance(this.originalCoordinates)},setTimeFromQuarters:function(e,t){var n,a;n=Math.floor(t/4),a=t%4*15,e.setHours(n,a)}}}}}angular.module("SOGo.SchedulerUI").directive("sgDraggableCalendarBlock",e)}(),function(){"use strict";e.$inject=["$scope","$element","$timeout"];function e(e,t,n){var a,o=this,i=t.controller("sgCalendarScrollView");e.nowDay=null,e.lineElement=null,e.updateLine=function(r){var s=new Date,c=s.getDayString(),l=s.getHours(),d=4*e.quarterHeight,u=s.getMinutes(),h=e.quarterHeight/15,p=parseInt(l*d+u*h-1);(r||c!=e.nowDay)&&(e.lineElement&&e.lineElement.remove(),e.lineElement=function(e,n){var a=angular.element("");i.isMultiColumn?n&&n[0].attributes["sg-day"].value==e&&t.append(a):_.forEach(n,function(t){t.attributes["sg-day"].value==e&&angular.element(t).find("div").eq(0).append(a)});return a}(c,e.days),e.nowDay=c);e.lineElement&&(e.lineElement.css("top",p+"px"),a=n(angular.bind(o,e.updateLine),6e4))},e.$on("$destroy",function(){a&&n.cancel(a)})}angular.module("SOGo.SchedulerUI").directive("sgNowLine",function(){return{restrict:"C",require:"^^sgCalendarScrollView",link:function(e,t,n,a){function o(){return t.find("sg-calendar-day")}var i=e.$watch(function(){return a.quarterHeight},function(t){if(t){i(),e.quarterHeight=t;var n=e.$watch(o,function(t){t.length&&(n(),e.days=t,e.updateLine())})}})},controller:e}})}(); +!function(){"use strict";function e(t){if(this.init(t),this.name&&!this.id){var n=e.$$resource.create("createFolder",this.name);this.$unwrap(n)}}e.$factory=["$q","$timeout","$log","sgSettings","Resource","Preferences","Component","Acl",function(t,n,a,o,i,r,s,c){return angular.extend(e,{$q:t,$timeout:n,$log:a,$$resource:new i(o.activeUser("folderURL")+"Calendar",o.activeUser()),$Preferences:r,$Component:s,$$Acl:c,activeUser:o.activeUser(),$view:null}),e}];try{angular.module("SOGo.SchedulerUI")}catch(e){angular.module("SOGo.SchedulerUI",["SOGo.Common"])}angular.module("SOGo.SchedulerUI").value("CalendarSettings",{EventDragDayLength:96,EventDragHorizontalOffset:3,ConflictHTTPErrorCode:409}).factory("Calendar",e.$factory),e.$defaultCalendar=function(){var t;return"first"==e.$Preferences.defaults.SOGoDefaultCalendar&&(t=_.find(e.$findAll(null,!0),function(e){return e.active}))?t.id:"personal"},e.$add=function(t){var n,a;n=t.isWebCalendar?this.$webcalendars:t.isSubscription?this.$subscriptions:this.$calendars,(a=_.findIndex(n,function(e,n){return"personal"==t.id||"personal"!=e.id&&e.name.localeCompare(t.name)>0}))<0?n.push(t):n.splice(a,0,t),e.$Preferences.settings.Calendar.FoldersOrder&&e.saveFoldersOrder(_.flatMap(e.$findAll(),"id")),e.$reloadAll()},e.$findAll=function(t,n){var a=this;if(t)this.$calendars=[],this.$subscriptions=[],this.$webcalendars=[],angular.forEach(t,function(t,n){var o=new e(t);o.isWebCalendar?a.$webcalendars.push(o):o.isSubscription?a.$subscriptions.push(o):a.$calendars.push(o)});else if(angular.isUndefined(this.$calendars))return this.$calendars=[],this.$subscriptions=[],this.$webcalendars=[],e.$$resource.fetch("calendarslist").then(function(t){return e.$findAll(t.calendars,n)});return n?_.union(this.$calendars,_.filter(this.$subscriptions,function(e){return e.isOwned||e.acls.objectCreator})):_.union(this.$calendars,this.$subscriptions,this.$webcalendars)},e.$reloadAll=function(){var t=this;e.$$resource.fetch("calendarslist").then(function(n){_.forEach(n.calendars,function(n){var a,o;a=n.isWebCalendar?t.$webcalendars:n.owner!=e.activeUser.login?t.$subscriptions:t.$calendars,(o=_.find(a,function(e){return e.id==n.id}))&&o.init(n)})})},e.$get=function(t){var n;return(n=_.find(e.$calendars,function(e){return e.id==t}))||(n=_.find(e.$subscriptions,function(e){return e.id==t})),n||(n=_.find(e.$webcalendars,function(e){return e.id==t})),n},e.$getIndex=function(t){var n;return(n=_.indexOf(_.map(e.$calendars,"id"),t))<0&&(n=_.indexOf(_.map(e.$subscriptions,"id"),t)),n<0&&(n=_.indexOf(_.map(e.$webcalendars,"id"),t)),n},e.$subscribe=function(t,n){var a=this;return e.$$resource.userResource(t).fetch(n,"subscribe").then(function(t){var n=new e(angular.extend({active:1},t));return _.find(a.$subscriptions,function(e){return e.id==t.id})||e.$add(n),n})},e.$addWebCalendar=function(t){var n=e.$q.defer();return _.find(this.$webcalendars,function(e){return e.urls.webCalendarURL==t})?n.reject():e.$$resource.post(null,"addWebCalendar",{url:t}).then(function(a){angular.extend(a,{isWebCalendar:!0,isEditable:!0,isRemote:!1,owner:e.activeUser.login,urls:{webCalendarURL:t}});var o=new e(a);e.$$resource.fetch(o.id,"reload").then(function(t){e.$log.debug(JSON.stringify(t,void 0,2)),e.$add(o),n.resolve()},function(e){401==e.status?n.resolve(o):n.reject()})},n.reject),n.promise},e.reloadWebCalendars=function(){var t=[];return _.forEach(this.$webcalendars,function(n){var a=e.$$resource.fetch(n.id,"reload");a.then(function(e){n.$error=!1},function(e){n.$error=l(e.statusText)}),t.push(a)}),e.$q.all(t)},e.$deleteComponents=function(t){var n={},a=[];return _.forEach(t,function(e){angular.isDefined(n[e.pid])||(n[e.pid]=[]),n[e.pid].push(e.id)}),_.forEach(n,function(t,n){a.push(e.$$resource.post(n,"batchDelete",{uids:t}))}),e.$q.all(a)},e.saveFoldersActivation=function(t){var n={};return _.forEach(t,function(t){var a=e.$get(t);n[a.id]=a.active}),e.$$resource.post(null,"saveFoldersActivation",n)},e.saveFoldersOrder=function(t){return this.$$resource.post(null,"saveFoldersOrder",{folders:t}).then(function(){if(e.$Preferences.settings.Calendar.FoldersOrder=t,!t)return e.$$resource.fetch("calendarslist").then(function(t){return e.$findAll(t.calendars)})})},e.prototype.init=function(t){this.color=this.color||"#AAAAAA",this.active=1,angular.extend(this,t),this.id&&(this.$acl=new e.$$Acl("Calendar/"+this.id)),this.isOwned=e.activeUser.isSuperUser||this.owner==e.activeUser.login,this.isSubscription=!this.isRemote&&this.owner!=e.activeUser.login,angular.isUndefined(this.$shadowData)&&(this.$shadowData=this.$omit())},e.prototype.$id=function(){return this.id?e.$q.when(this.id):this.$futureCalendarData.then(function(e){return e.id})},e.prototype.getClassName=function(e){return angular.isUndefined(e)&&(e="fg"),e+"-folder"+this.id},e.prototype.$rename=function(){var t,n,a=this;return this.name==this.$shadowData.name?e.$q.when():(n=this.isWebCalendar?e.$webcalendars:this.isSubscription?e.$subscriptions:e.$calendars,(t=_.indexOf(_.map(n,"id"),this.id))>-1?this.$save().then(function(){n.splice(t,1),e.$add(a)}):e.$q.reject())},e.prototype.$delete=function(){var t,n,a=this;return this.isSubscription?(n=e.$$resource.fetch(this.id,"unsubscribe"),t=e.$subscriptions):(n=e.$$resource.remove(this.id),t=this.isWebCalendar?e.$webcalendars:e.$calendars),n.then(function(){var e=_.indexOf(_.map(t,"id"),a.id);t.splice(e,1)})},e.prototype.$reset=function(){var e=this;angular.forEach(this,function(t,n){"constructor"!=n&&"$"!=n[0]&&delete e[n]}),angular.extend(this,this.$shadowData),this.$shadowData=this.$omit()},e.prototype.$save=function(){var t=this;return e.$$resource.save(this.id,this.$omit()).then(function(e){return t.$shadowData=t.$omit(),e},function(n){return e.$log.error(JSON.stringify(n,void 0,2)),t.$reset(),n})},e.prototype.setCredentials=function(t,n){var a=this,o=e.$q.defer();return e.$$resource.post(this.id,"set-credentials",{username:t,password:n}).then(function(){e.$$resource.fetch(a.id,"reload").then(function(t){e.$add(a),o.resolve()},function(e){401==e.status?o.reject(l("Wrong username or password")):o.reject(e.statusText)})},o.reject),o.promise},e.prototype.export=function(){var t;return t={type:"application/octet-stream",filename:this.name+".ics"},e.$$resource.download(this.id+".ics","export",null,t)},e.prototype.$setActivation=function(){return e.$$resource.fetch(this.id,(this.active?"":"de")+"activateFolder")},e.prototype.$getComponent=function(t,n){return e.$Component.$find(this.id,t,n)},e.prototype.$unwrap=function(t){var n=this;this.$futureCalendarData=t.then(function(t){return e.$timeout(function(){return n.init(t),n})},function(t){n.isError=!0,angular.isObject(t)&&e.$timeout(function(){angular.extend(n,t)})})},e.prototype.$omit=function(){var e={};return angular.forEach(this,function(t,n){"constructor"!=n&&"$"!=n[0]&&(e[n]=t)}),e}}(),function(){"use strict";function e(t){if("function"!=typeof t.then){if(this.init(t),this.pid&&!this.id){var n=e.$$resource.newguid(this.pid);this.$unwrap(n),this.isNew=!0}}else this.$unwrap(t)}e.$factory=["$q","$timeout","$log","$rootScope","sgSettings","sgComponent_STATUS","Preferences","User","Card","Gravatar","Resource",function(t,n,a,o,i,r,s,c,l,d,u){return angular.extend(e,{STATUS:r,$q:t,$timeout:n,$log:a,$rootScope:o,$settings:i,$User:c,$Preferences:s,$Card:l,$gravatar:d,$$resource:new u(i.activeUser("folderURL")+"Calendar",i.activeUser()),timeFormat:"%H:%M",$query:{value:"",search:"title_Category_Location"},$queryEvents:{sort:"start",asc:1,filterpopup:"view_next7"},$queryTasks:{sort:"status",asc:1,filterpopup:"view_incomplete"},$refreshTimeout:null,$ghost:{}}),s.settings.Calendar.EventsFilterState&&(e.$queryEvents.filterpopup=s.settings.Calendar.EventsFilterState),s.settings.Calendar.TasksFilterState&&(e.$queryTasks.filterpopup=s.settings.Calendar.TasksFilterState),s.settings.Calendar.EventsSortingState&&(e.$queryEvents.sort=s.settings.Calendar.EventsSortingState[0],e.$queryEvents.asc=parseInt(s.settings.Calendar.EventsSortingState[1])),s.settings.Calendar.TasksSortingState&&(e.$queryTasks.sort=s.settings.Calendar.TasksSortingState[0],e.$queryTasks.asc=parseInt(s.settings.Calendar.TasksSortingState[1])),e.$queryTasks.show_completed=parseInt(s.settings.ShowCompletedTasks),e.$categories=s.defaults.SOGoCalendarCategoriesColors,s.defaults.SOGoTimeFormat&&(e.timeFormat=s.defaults.SOGoTimeFormat),e}];try{angular.module("SOGo.SchedulerUI")}catch(e){angular.module("SOGo.SchedulerUI",["SOGo.Common"])}angular.module("SOGo.SchedulerUI").constant("sgComponent_STATUS",{NOT_LOADED:0,DELAYED_LOADING:1,LOADING:2,LOADED:3,DELAYED_MS:300}).factory("Component",e.$factory),e.$selectedCount=function(){var t;return t=0,e.$events&&(t+=_.filter(e.$events,function(e){return e.selected}).length),e.$tasks&&(t+=_.filter(e.$tasks,function(e){return e.selected}).length),t},e.$startRefreshTimeout=function(t){e.$refreshTimeout&&e.$timeout.cancel(e.$refreshTimeout);var n=e.$Preferences.defaults.SOGoRefreshViewCheck;if(n&&"manually"!=n){var a=angular.bind(e.$rootScope,e.$rootScope.$emit,"calendars:list");e.$refreshTimeout=e.$timeout(a,1e3*n.timeInterval())}},e.$isLoading=function(){return e.$loaded==e.STATUS.LOADING},e.$filter=function(t,n){var a,o,i=this,r=new Date,s=r.getDate(),c=r.getMonth()+1,l=r.getFullYear(),d="$query"+t.capitalize(),u={day:l+(c<10?"0":"")+c+(s<10?"0":"")+s},h=!1;return e.$startRefreshTimeout(t),angular.extend(this.$query,u),n&&_.forEach(_.keys(n),function(t){h|=i.$query[t]&&n[t]!=e.$query[t],"reload"==t&&n[t]?h=!0:angular.isDefined(i.$query[t])?i.$query[t]=n[t]:i[d][t]=n[t]}),a=this.$$resource.fetch(null,t+"list",angular.extend(this[d],this.$query)),h&&(delete e[o="tasks"==t?"$events":"$tasks"],e.$log.debug("force reload of "+o)),this.$unwrapCollection(t,a)},e.$find=function(t,n,a){var o=[t,encodeURIComponent(n)];return a&&o.push(a),new e(this.$$resource.fetch(o.join("/"),"view"))},e.filterCategories=function(t){var n=new RegExp(t,"i");return _.filter(_.keys(e.$categories),function(e){return-1!=e.search(n)})},e.saveSelectedList=function(e){return this.$$resource.post(null,"saveSelectedList",{list:e+"ListView"})},e.$eventsBlocksForView=function(t,n){var a,o,i,r;return a=e.$Preferences.defaults.SOGoFirstDayOfWeek,"day"==t?(o="dayView",i=r=n):"multicolumnday"==t?(o="multicolumndayView",i=r=n):"week"==t?(o="weekView",i=n.beginOfWeek(a),(r=new Date).setTime(i.getTime()),r.addDays(6)):"month"==t&&(o="monthView",(i=n).setDate(1),i=i.beginOfWeek(a),(r=new Date).setTime(n.getTime()),r.setMonth(r.getMonth()+1),r.addDays(-1),r=r.endOfWeek(a)),this.$eventsBlocks(o,i,r)},e.$eventsBlocks=function(t,n,a){var o,i,r,s=[],c=[],l=e.$q.defer();return o={view:t.toLowerCase(),sd:n.getDayString(),ed:a.getDayString()},this.$$resource.fetch(null,"eventsblocks",o).then(function(t){var n,a;n=function(t,n,a){var o,i=_.zipObject(this.eventsFields,n),r=new Date(1e3*i.c_startdate);return i.hour=r.getHourString(),i.blocks=[],o=new e(i),t.push(o),t},a=function(e){this[e.nbr].blocks.push(e),e.component=this[e.nbr],e.isFirst=1==this[e.nbr].blocks.length},e.$views=[],e.$timeout(function(){_.forEach(t,function(t,o){var l,d=[],u={},h={};for(t.eventsFields.splice(_.indexOf(t.eventsFields,"c_folder"),1,"pid"),t.eventsFields.splice(_.indexOf(t.eventsFields,"c_name"),1,"id"),t.eventsFields.splice(_.indexOf(t.eventsFields,"c_recurrence_id"),1,"occurrenceId"),t.eventsFields.splice(_.indexOf(t.eventsFields,"c_title"),1,"summary"),_.reduce(t.events,_.bind(n,t),d),_.forEach(_.flatten(t.blocks),_.bind(a,d)),_.forEach(_.flatten(t.allDayBlocks),_.bind(a,d)),0===s.length&&(s=_.flatMap(t.days,"date"),c=_.flatMap(t.days,"number")),i=0;i0&&(this.repeat.month={type:"bymonthday"}),angular.isUndefined(this.repeat.month)&&(this.repeat.month={}),angular.isUndefined(this.repeat.month.occurrence)&&angular.extend(this.repeat.month,{occurrence:"1",day:"SU"}),angular.isUndefined(this.repeat.months)&&(this.repeat.months=[]),angular.isUndefined(this.repeat.year)&&(this.repeat.year={}),this.repeat.count?this.repeat.end="count":this.repeat.until?(this.repeat.end="until",angular.isString(this.repeat.until)&&(this.repeat.until=e.$parseDate(this.repeat.until,{no_time:!0}))):this.repeat.end="never",this.$hasCustomRepeat=this.hasCustomRepeat(),this.isNew){var a="appointment"==this.type?"Events":"Tasks";this.classification=e.$Preferences.defaults["SOGoCalendar"+a+"DefaultClassification"].toLowerCase();var o=/-PT?([0-9]+)([MHDW])/.exec(e.$Preferences.defaults.SOGoCalendarDefaultReminder);o&&(this.$hasAlarm=!0,this.alarm.quantity=parseInt(o[1]),this.alarm.unit={M:"MINUTES",H:"HOURS",D:"DAYS",W:"WEEKS"}[o[2]]),this.sendAppointmentNotifications=e.$Preferences.defaults.SOGoAppointmentSendEMailNotifications}else angular.isUndefined(t.$hasAlarm)&&(this.$hasAlarm=angular.isDefined(t.alarm));this.destinationCalendar=this.pid,this.attendees&&_.forEach(this.attendees,function(t){t.image=e.$gravatar(t.email,32)}),this.updateFreeBusy(),this.selected=!1},e.prototype.initOrganizer=function(t){var n,a=this;t&&t.isSubscription?n=e.$User.$filter(t.owner).then(function(e){var t=e[0];a.organizer={uid:t.uid,name:t.cn,email:t.c_email}}):(this.organizer={uid:e.$settings.activeUser("login"),name:e.$settings.activeUser("identification"),email:e.$settings.activeUser("email")},n=e.$q.when()),n.then(function(){a.updateFreeBusyAttendee(a.organizer)})},e.prototype.hasCustomRepeat=function(){return angular.isUndefined(this.occurrenceId)&&angular.isDefined(this.repeat)&&(this.repeat.interval>1||angular.isDefined(this.repeat.days)&&this.repeat.days.length>0||angular.isDefined(this.repeat.monthdays)&&this.repeat.monthdays.length>0||angular.isDefined(this.repeat.months)&&this.repeat.months.length>0||angular.isDefined(this.repeat.month)&&angular.isDefined(this.repeat.month.type)||angular.isDefined(this.repeat.dates)&&this.repeat.dates.length>0)},e.prototype.isEditable=function(){return!this.occurrenceId&&!this.isReadOnly},e.prototype.isEditableOccurrence=function(){return this.occurrenceId&&!this.isReadOnly},e.prototype.isInvitation=function(){return!this.occurrenceId&&this.userHasRSVP},e.prototype.isInvitationOccurrence=function(){return this.occurrenceId&&this.userHasRSVP},e.prototype.showPercentComplete=function(){return"task"==this.type&&this.percentComplete>0&&"cancelled"!=this.status},e.prototype.enablePercentComplete=function(){return"task"==this.type&&"not-specified"!=this.status&&"cancelled"!=this.status},e.prototype.coversFreeBusy=function(e,t,n){return angular.isDefined(this.freebusy[e])&&angular.isDefined(this.freebusy[e][t])&&1==this.freebusy[e][t][n]},e.prototype.updateFreeBusyCoverage=function(){var e=this,t={};if(this.start&&this.end){var n=new Date(this.start.getTime()),a=new Date(this.end.getTime()),o=parseInt(n.getMinutes()/15+.5),i=parseInt(a.getMinutes()/15+.5);return n.setMinutes(15*o),a.setMinutes(15*i),_.forEach(n.daysUpTo(a),function(n,a){var i,r=n.getDate(),s=n.getDayString();if(s==e.start.getDayString())for(i=n.getHours().toString(),t[s]={},t[s][i]=[];o>0;)t[s][i].push(0),o--;else n=n.beginOfDay(),t[s]={};for(;n.getTime()0},e.prototype.addAttachUrl=function(e){if(angular.isUndefined(this.attachUrls))this.attachUrls=[{value:e}];else{for(var t=0;t-1&&this.attachUrls.length>e&&this.attachUrls.splice(e,1)},e.prototype.$addDueDate=function(){this.due=new Date,this.due.setMinutes(15*Math.round(this.due.getMinutes()/15)),this.dueDate=this.due.toISOString()},e.prototype.$deleteDueDate=function(){delete this.due,delete this.dueDate},e.prototype.$addStartDate=function(){this.start=new Date,this.start.setMinutes(15*Math.round(this.start.getMinutes()/15))},e.prototype.$deleteStartDate=function(){delete this.start,delete this.startDate},e.prototype.$addRecurrenceDate=function(){var e=new Date;e.setMinutes(15*Math.round(e.getMinutes()/15)),angular.isUndefined(this.repeat.dates)&&(this.repeat={frequency:"custom",dates:[]}),this.repeat.dates.push(e)},e.prototype.$deleteRecurrenceDate=function(e){e>-1&&this.repeat&&this.repeat.dates&&this.repeat.dates.length>e&&this.repeat.dates.splice(e,1)},e.prototype.$reset=function(){var e=this;angular.forEach(this,function(t,n){"constructor"!=n&&"$"!=n[0]&&delete e[n]}),this.init(this.$shadowData),this.$shadowData=this.$omit()},e.prototype.$reply=function(){var t,n=this,a=[this.pid,encodeURIComponent(this.id)];return this.occurrenceId&&a.push(this.occurrenceId),t={reply:this.reply,delegatedTo:this.delegatedTo,alarm:this.$hasAlarm?this.alarm:{}},e.$$resource.save(a.join("/"),t,{action:"rsvpAppointment"}).then(function(e){return n.$shadowData=n.$omit(),e})},e.prototype.$adjust=function(t){var n=[this.pid,encodeURIComponent(this.id)];return _.every(_.values(t),function(e){return 0===e})?e.$q.when():(this.occurrenceId&&n.push(this.occurrenceId),e.$log.debug("adjust "+n.join("/")+" "+JSON.stringify(t)),e.$$resource.save(n.join("/"),t,{action:"adjust"}))},e.prototype.$save=function(t){var n,a,o,i,r=this;return o=this.$omit(),i=e.$Preferences.$mdDateLocaleProvider,o.startDate=o.start?o.start.format(i,"%Y-%m-%d"):"",o.startTime=o.start?o.start.format(i,"%H:%M"):"",o.endDate=o.end?o.end.format(i,"%Y-%m-%d"):"",o.endTime=o.end?o.end.format(i,"%H:%M"):"",o.dueDate=o.due?o.due.format(i,"%Y-%m-%d"):"",o.dueTime=o.due?o.due.format(i,"%H:%M"):"",o.completedDate=o.completed?o.completed.format(i,"%Y-%m-%d"):"",this.hasCustomRepeat()?"monthly"==this.repeat.frequency&&this.repeat.month.type&&"byday"==this.repeat.month.type&&"relative"!=this.repeat.month.day||"yearly"==this.repeat.frequency&&this.repeat.year.byday?(delete o.repeat.monthdays,o.repeat.days=[{day:this.repeat.month.day,occurrence:this.repeat.month.occurrence.toString()}]):"monthly"!=this.repeat.frequency&&"yearly"!=this.repeat.frequency||!this.repeat.month.type?"custom"==this.repeat.frequency&&this.repeat.dates&&_.forEach(o.repeat.dates,function(e,t,n){n[t]={date:e.format(i,"%Y-%m-%d"),time:e.format(i,"%H:%M")}}):(delete o.repeat.days,"relative"==this.repeat.month.day&&(o.repeat.monthdays=[this.repeat.month.occurrence])):this.repeat.frequency&&"never"!=this.repeat.frequency&&(o.repeat={frequency:this.repeat.frequency}),o.startDate&&this.repeat.frequency&&"never"!=this.repeat.frequency?"until"==this.repeat.end&&this.repeat.until?o.repeat.until=this.repeat.until.stringWithSeparator("-"):"count"==this.repeat.end&&this.repeat.count?o.repeat.count=this.repeat.count:(delete o.repeat.until,delete o.repeat.count):delete o.repeat,"not-specified"==this.status?delete o.status:"completed"!=this.status&&delete o.completedDate,o.startDate&&this.$hasAlarm?!this.alarm.action||"email"!=this.alarm.action||this.attendees&&this.attendees.length>0||(o.alarm.attendees=0,o.alarm.organizer=1):o.alarm={},a=[this.pid,encodeURIComponent(this.id)],this.isNew&&(n={action:"saveAs"+this.type.capitalize()}),this.occurrenceId&&a.push(this.occurrenceId),angular.extend(o,t),e.$$resource.save(a.join("/"),o,n).then(function(e){return r.$shadowData=r.$omit(),e})},e.prototype.remove=function(t){var n=[this.pid,encodeURIComponent(this.id)];return t&&this.occurrenceId&&n.push(this.occurrenceId),e.$$resource.remove(n.join("/"))},e.prototype.$unwrap=function(t){var n=this;this.$futureComponentData=t,this.$futureComponentData.then(function(e){n.init(e),n.$shadowData=n.$omit()},function(t){angular.extend(n,t),n.isError=!0,e.$log.error(n.error)})},e.prototype.$omit=function(){var e={};return angular.forEach(this,function(t,n){"constructor"==n||"$hasAlarm"!=n&&"$"==n[0]||"blocks"==n||(e[n]=angular.copy(t))}),e},e.prototype.repeatDescription=function(){var e=null;return this.repeat&&(e=l("repeat_"+this.repeat.frequency.toUpperCase())),e},e.prototype.alarmDescription=function(){var e,t=null;return this.alarm&&(e=["reminder",this.alarm.quantity],this.alarm.quantity>0&&e.push(this.alarm.unit.toUpperCase(),this.alarm.reference.toUpperCase()),(e=e.join("_"))===(t=l(e))&&(t=[this.alarm.quantity,l("reminder_"+this.alarm.unit.toUpperCase()),l("reminder_"+this.alarm.reference.toUpperCase())].join(" "))),t},e.prototype.copyTo=function(t){return e.$$resource.post(this.pid+"/"+encodeURIComponent(this.id),"copy",{destination:t})},e.prototype.moveTo=function(t){return e.$$resource.post(this.pid+"/"+encodeURIComponent(this.id),"move",{destination:t})},e.prototype.toString=function(){return"[Component "+this.id+"]"}}(),function(){"use strict";e.$inject=["$scope","$rootScope","$state","$stateParams","sgHotkeys","Calendar","Component","Preferences","stateEventsBlocks"];function e(t,n,a,o,i,r,s,c,d){var u,h=this,p=[];angular.isUndefined(e.expandedAllDays)&&(e.expandedAllDays=!1),h.selectedDate=o.day.asDate(),h.expandedAllDays=e.expandedAllDays,h.toggleAllDays=function(){e.expandedAllDays=!e.expandedAllDays,h.expandedAllDays=e.expandedAllDays},h.views=d,h.changeDate=y,h.changeView=v,this.$onInit=function(){(e=p).push(i.createHotkey({key:l("hotkey_today"),description:l("Today"),callback:y,args:new Date})),e.push(i.createHotkey({key:l("hotkey_dayview"),description:l("Day"),callback:v,args:"day"})),e.push(i.createHotkey({key:l("hotkey_weekview"),description:l("Week"),callback:v,args:"week"})),e.push(i.createHotkey({key:l("hotkey_monthview"),description:l("Month"),callback:v,args:"month"})),e.push(i.createHotkey({key:l("hotkey_multicolumndayview"),description:l("Multicolumn Day View"),callback:v,args:"multicolumnday"})),e.push(i.createHotkey({key:"left",description:l("Move backward"),callback:m,args:-1})),e.push(i.createHotkey({key:"right",description:l("Move forward"),callback:m,args:1})),_.forEach(e,function(e){i.registerHotkey(e)});var e;f(h.selectedDate),u=n.$on("calendars:list",g),t.$on("$destroy",function(){u(),_.forEach(p,function(e){i.deregisterHotkey(e)})})};function m(e,t){var n;"week"==o.view?n=h.selectedDate.beginOfWeek(c.defaults.SOGoFirstDayOfWeek).addDays(7*t):"month"==o.view?((n=h.selectedDate).setDate(1),n.setMonth(n.getMonth()+t)):n=h.selectedDate.addDays(t),y(e,n)}function f(e){"month"==o.view?(e.setDate(1),e.setHours(12),e.$dateFormat="%B %Y"):"week"==o.view?(e.setTime(e.beginOfWeek(c.defaults.SOGoFirstDayOfWeek).getTime()),e.$dateFormat=l("Week %d").replace("%d","%U")):e.$dateFormat="%A"}function g(){s.$eventsBlocksForView(o.view,o.day.asDate()).then(function(e){var t,n,a;for(t=0;t=t;n--)h.views.splice(n,1)})}function y(e,t){var n=t?t.getDayString():angular.element(e.currentTarget).attr("date");t&&f(t),a.go("calendars.view",{day:n})}function v(e,t){a.go("calendars.view",{view:t})}}angular.module("SOGo.SchedulerUI").controller("CalendarController",e)}(),function(){"use strict";e.$inject=["$rootScope","$scope","$q","$timeout","$state","$mdDialog","sgHotkeys","sgFocus","Dialog","Preferences","CalendarSettings","Calendar","Component","Alarm"];function e(e,t,n,a,o,i,r,s,c,d,u,h,p,m){var f,g=this,y=[];g.component=p,g.componentType="events",g.selectedList=0,g.selectComponentType=v,g.unselectComponents=function(){_.forEach(p["$"+g.componentType],function(e){e.selected=!1}),g.mode.multiple=0},g.selectAll=function(){_.forEach(p["$"+g.componentType],function(e){e.selected=!0}),g.mode.multiple=p["$"+g.componentType].length},g.searchMode=$,g.toggleComponentSelection=function(e,t){t.selected=!t.selected,g.mode.multiple+=t.selected?1:-1,e.preventDefault(),e.stopPropagation()},g.confirmDeleteSelectedComponents=function(){c.confirm(l("Warning"),l("Are you sure you want to delete the selected components?"),{ok:l("Delete")}).then(function(){var t=_.filter(p["$"+g.componentType],function(e){return e.selected});h.$deleteComponents(t).then(function(){g.mode.multiple=0,e.$emit("calendars:list")})})},g.openEvent=function(e,t){C(e,t,"appointment")},g.openTask=function(e,t){C(e,t,"task")},g.newComponent=b,g.filterpopup=function(){return p["$query"+g.componentType.capitalize()].filterpopup},g.filter=function(e){p.$filter(g.componentType,{filterpopup:e})},g.filteredBy=function(e){return p["$query"+g.componentType.capitalize()].filterpopup==e},g.sort=function(e){p.$filter(g.componentType,{sort:e})},g.sortedBy=function(e){return p["$query"+g.componentType.capitalize()].sort==e},g.reload=function(){h.reloadWebCalendars().finally(function(){e.$emit("calendars:list")})},g.cancelSearch=function(){g.mode.search=!1,p.$filter(g.componentType,{value:""})},g.mode={search:!1,multiple:0},this.$onInit=function(){(n=y).push(r.createHotkey({key:l("hotkey_search"),description:l("Search"),callback:$})),n.push(r.createHotkey({key:l("hotkey_create_event"),description:l("Create a new event"),callback:b,args:"appointment"})),n.push(r.createHotkey({key:l("hotkey_create_task"),description:l("Create a new task"),callback:b,args:"task"})),_.forEach(n,function(e){r.registerHotkey(e)});var n;f="events","tasksListView"==d.settings.Calendar.SelectedList&&(g.selectedList=1,f="tasks"),v(f,{reload:!0}),e.$on("calendars:list",function(){p.$filter(g.componentType,{reload:!0})}),e.$on("calendar:dragend",k),t.$on("$destroy",function(){_.forEach(y,function(e){r.deregisterHotkey(e)})})};function v(e,t){(t&&t.reload||g.componentType!=e)&&(angular.isUndefined(p["$"+e])&&p.$filter(e),g.unselectComponents(),g.componentType=e,p.saveSelectedList(e))}function $(){g.mode.search=!0,s("search")}function C(e,t,a){if(t.viewable){var o=n.when();angular.isUndefined(t.$futureComponentData)&&(o=(t=h.$get(t.pid).$getComponent(t.id,t.occurrenceId)).$futureComponentData),o.then(function(){var n="UIx"+a.capitalize()+"ViewTemplate";i.show({parent:angular.element(document.body),targetEvent:e,clickOutsideToClose:!0,escapeToClose:!0,templateUrl:n,controller:"ComponentController",controllerAs:"editor",locals:{stateComponent:t}})})}}function b(e,t,n){var a;n?(a=n).updateFreeBusy():a=new p({pid:h.$defaultCalendar(),type:t});var o="UIx"+t.capitalize()+"EditorTemplate";return i.show({parent:angular.element(document.body),targetEvent:e,clickOutsideToClose:!0,escapeToClose:!0,templateUrl:o,controller:"ComponentEditorController",controllerAs:"editor",locals:{stateComponent:a}})}function k(t){var n,o,r,s,c,d,f;n=p.$ghost.component,o=p.$ghost.pointerHandler,n.isNew?(r=o.currentEventCoordinates,n.summary="",n.isAllDay&&(r.duration-=96),n.setDelta(15*r.duration),b(null,"appointment",n).catch().finally(function(){a(function(){p.$resetGhost()})})):(s=o.currentEventCoordinates.getDelta(o.originalEventCoordinates),c={days:s.dayNumber,start:15*s.start,duration:15*s.duration},o.originalCalendar&&0!==s.dayNumber&&(d=o.currentEventCoordinates.dayNumber,f=_.filter(h.$findAll(),{active:1}),c.destination=f[d].id,c.days=0),n.isException||!n.occurrenceId?n.$adjust(c).then(function(){e.$emit("calendars:list"),m.getAlarms()},function(e){y(e,n,c)}).finally(function(){a(function(){p.$resetGhost()})}):n.occurrenceId&&i.show({clickOutsideToClose:!0,escapeToClose:!0,locals:{component:n,params:c},template:['',' ',"

"+l("editRepeatingItem")+"

","
"," ",' '+l("button_thisOccurrenceOnly")+"",' '+l("button_allOccurrences")+""," ","
"].join(""),controller:g}).then(function(){e.$emit("calendars:list")},function(){}).finally(function(){a(function(){p.$resetGhost()})})),g.$inject=["$scope","$mdDialog","component","params"];function g(e,t,n,a){e.updateThisOccurrence=function(){n.$adjust(a).then(t.hide,function(e){t.cancel().then(function(){y(e,n,a)},function(){})})},e.updateAllOccurrences=function(){delete n.occurrenceId,n.$adjust(a).then(t.hide,function(e){t.cancel().then(function(){y(e,n,a)},function(){})})}}function y(t,n,a){t.status==u.ConflictHTTPErrorCode&&t.data&&t.data.message&&angular.isObject(t.data.message)&&i.show({parent:angular.element(document.body),clickOutsideToClose:!1,escapeToClose:!1,templateUrl:"UIxAttendeeConflictDialog",controller:v,controllerAs:"$AttendeeConflictDialogController",locals:{component:n,params:a,conflictError:t.data.message}}).then(function(){e.$emit("calendars:list")},function(){})}v.$inject=["$scope","$mdDialog","component","params","conflictError"];function v(e,t,n,a,o){this.conflictError=o,this.cancel=t.cancel,this.save=function(){n.$adjust(angular.extend({ignoreConflicts:!0},a)).then(t.hide)}}}}angular.module("SOGo.SchedulerUI").controller("CalendarListController",e)}(),function(){"use strict";e.$inject=["$rootScope","$scope","$window","$mdDialog","$log","$mdToast","Dialog","sgSettings","Preferences","Calendar"];function e(e,t,n,a,o,i,r,s,c,d){var u=this;u.activeUser=s.activeUser,u.service=d,u.newCalendar=function(e){r.prompt(l("New calendar"),l("Name of the Calendar")).then(function(e){var t=new d({name:e,isEditable:!0,isRemote:!1,owner:UserLogin});t.$id().then(function(){d.$add(t)})})},u.addWebCalendar=function(){r.prompt(l("Subscribe to a web calendar..."),l("URL of the Calendar"),{inputType:"url"}).then(function(t){d.$addWebCalendar(t).then(function(n){angular.isObject(n)&&a.show({parent:angular.element(document.body),clickOutsideToClose:!0,escapeToClose:!0,templateUrl:"UIxWebCalendarAuthDialog",controller:e,controllerAs:"$WebCalendarAuthDialogController",locals:{url:t,calendar:n}})})}),e.$inject=["scope","$mdDialog","url","calendar"];function e(e,t,n,a){var o=this,i=n.split("/"),r=i[2];o.title=l("Please identify yourself to %{0}").formatted(r),o.authenticate=function(e){!e.$valid&&e.$error.required||a.setCredentials(o.username,o.password).then(function(e){t.hide()},function(t){e.password.$setValidity("credentials",!1)})},o.cancel=function(){t.cancel()}}},u.subscribeToFolder=function(e){o.debug("subscribeToFolder "+e.owner+e.name),d.$subscribe(e.owner,e.name).then(function(e){i.show(i.simple().content(l("Successfully subscribed to calendar")).position("top right").hideDelay(3e3))})},u.filter={name:""},u.sortableMode=!1,u.toggleSortableMode=function(){u.sortableMode=!u.sortableMode,u.filter.name=""},u.resetSort=function(){d.saveFoldersOrder()},u.sortableCalendars={scrollableContainer:"#sidenav-content",containment:"md-list",orderChanged:function(){d.saveFoldersOrder(_.flatMap(d.$findAll(),"id"))},accept:function(e,t,n){return e.sortableScope.element[0]==t.element[0]}},this.$onInit=function(){u.categories=_.map(c.defaults.SOGoCalendarCategories,function(e){return{id:e.asCSSIdentifier(),name:e,color:c.defaults.SOGoCalendarCategoriesColors[e]}}),t.$watch(function(){return _.union(_.map(d.$calendars,function(e){return _.pick(e,["id","active","color"])}),_.map(d.$subscriptions,function(e){return _.pick(e,["id","active","color"])}),_.map(d.$webcalendars,function(e){return _.pick(e,["id","active","color"])}))},function(t,n){var a,i,r;a=_.intersectionBy(t,n,"id"),i=_.map(_.filter(a,function(e){var t=_.find(n,{id:e.id});return!_.isEqual(e,t)}),"id"),r=d.$q.when(),i.length>0&&(o.debug(i.join(", ")+" changed"),r=d.saveFoldersActivation(i)),(i.length>0||a.length!=t.length||a.length!=n.length)&&r.then(function(){e.$emit("calendars:list")})},!0)}}angular.module("SOGo.SchedulerUI").controller("CalendarsController",e)}(),function(){"use strict";e.$inject=["$rootScope","$mdDialog","Calendar","Component","AddressBook","Alarm","Account","stateComponent"];function e(e,t,n,a,o,i,r,s){var c,d=this;d.calendarService=n,d.service=a,d.component=s,d.close=function(){t.hide()},d.highPriority=function(){return d.component&&d.component.priority&&d.component.priority<5},d.cardFilter=function(e){return o.$filterAll(e)},d.newMessageWithAllRecipients=function(e){var t=_.map(d.component.attendees,function(e){return e.name+" <"+e.email+">"});u(e,t)},d.newMessageWithRecipient=function(e,t,n){u(e,[t+" <"+n+">"])},d.edit=h,d.editAllOccurrences=function(){(c=n.$get(d.component.pid).$getComponent(d.component.id)).$futureComponentData.then(function(){d.component=c,h()})},d.reply=p,d.replyAllOccurrences=function(){(c=n.$get(d.component.pid).$getComponent(d.component.id)).$futureComponentData.then(function(){c.reply=d.component.reply,c.delegatedTo=d.component.delegatedTo,c.$hasAlarm=d.component.$hasAlarm,c.alarm=d.component.alarm,p(c)})},d.deleteOccurrence=function(){d.component.remove(!0).then(function(){e.$emit("calendars:list"),t.hide()})},d.deleteAllOccurrences=function(){d.component.remove().then(function(){e.$emit("calendars:list"),t.hide()})},d.toggleRawSource=function(e){n.$$resource.post(d.component.pid+"/"+d.component.id,"raw").then(function(n){t.hide(),t.show({parent:angular.element(document.body),targetEvent:e,clickOutsideToClose:!0,escapeToClose:!0,template:['',' ','
',"  
"," ",' '+l("Close")+""," ","
"].join(""),controller:a,locals:{data:n}}),a.$inject=["scope","$mdDialog","data"];function a(e,t,n){e.data=n,e.close=function(){t.hide()}}})},d.copySelectedComponent=function(n){d.component.copyTo(n).then(function(){t.hide(),e.$emit("calendars:list")})},d.moveSelectedComponent=function(n){d.component.moveTo(n).then(function(){t.hide(),e.$emit("calendars:list")})},d.organizer=[s.organizer];function u(e,n){r.$findAll().then(function(a){var o=_.find(a,function(e){if(0===e.id)return e});o.$getMailboxes().then(function(a){o.$newMessage().then(function(a){angular.extend(a.editable,{to:n,subject:d.component.summary}),t.show({parent:angular.element(document.body),targetEvent:e,clickOutsideToClose:!1,escapeToClose:!1,templateUrl:"../Mail/UIxMailEditor",controller:"MessageEditorController",controllerAs:"editor",locals:{stateAccount:o,stateMessage:a}})})})}),e.preventDefault(),e.stopPropagation()}function h(){var e="vevent"==d.component.component?"Appointment":"Task";t.hide().then(function(){var n="UIx"+e+"EditorTemplate";t.show({parent:angular.element(document.body),clickOutsideToClose:!0,escapeToClose:!0,templateUrl:n,controller:"ComponentEditorController",controllerAs:"editor",locals:{stateComponent:d.component}})})}function p(n){(n||d.component).$reply().then(function(){e.$emit("calendars:list"),i.getAlarms(),t.hide()})}}t.$inject=["$rootScope","$scope","$log","$timeout","$mdDialog","sgFocus","User","CalendarSettings","Calendar","Component","AddressBook","Card","Alarm","stateComponent"];function t(e,t,n,a,o,i,r,s,c,d,u,h,p,m){var f,g,y=this;y.service=c,y.component=m,y.categories={},y.showRecurrenceEditor=y.component.$hasCustomRepeat,y.toggleRecurrenceEditor=function(){y.showRecurrenceEditor=!y.showRecurrenceEditor,y.component.$hasCustomRepeat=y.showRecurrenceEditor},y.recurrenceMonthDaysAreRequired=function(){return y.component&&"monthly"==y.component.repeat.frequency&&"bymonthday"==y.component.repeat.month.type},y.showAttendeesEditor=y.component.attendees&&y.component.attendees.length,y.toggleAttendeesEditor=function(){y.showAttendeesEditor=!y.showAttendeesEditor},y.changeFrequency=function(){"custom"==y.component.repeat.frequency&&(y.showRecurrenceEditor=!0)},y.changeCalendar=function(){y.component.attendees&&y.component.attendees.length>0&&y.component.initOrganizer(c.$get(y.component.destinationCalendar))},y.cardFilter=function(e){return u.$filterAll(e),u.$cards},y.addAttendee=function(e){var t,n,a=!y.component.attendees||0===y.component.attendees.length,o=c.$get(y.component.destinationCalendar),i=a?{organizerCalendar:o}:{},r=/([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)/i;function s(e){var t=e.match(r),n=t[0],o=e.replace(new RegExp(" *? *"),"");return y.showAttendeesEditor|=a,y.searchText="",new h({c_cn:_.trim(o,' "'),emails:[{value:n}]})}if(angular.isString(e)){for(n="",t=0;t5?l("low"):y.component.priority>4?l("normal"):l("high")},y.reset=v,y.cancel=function(e){v(e),y.component.isNew&&(y.component=null);o.hide()},y.edit=$,y.save=function(t,n){t.$valid&&y.component.$save(n).then(function(t){e.$emit("calendars:list"),p.getAlarms(),o.hide()},function(e){e.status==s.ConflictHTTPErrorCode&&_.isObject(e.data.message)?y.attendeeConflictError=e.data.message:$(t)})},y.attendeeConflictError=!1,y.attendeesEditor={days:C(),hours:function(){for(var e=[],t=0;t<=23;t++)e.push(t.toString());return e}()},y.addStartDate=function(){y.component.$addStartDate(),f=new Date(y.component.start.getTime())},y.addDueDate=function(){y.component.$addDueDate(),new Date(y.component.due.getTime())},y.adjustStartTime=function(){if(y.component.start){0!==f.valueOf()-y.component.start.valueOf()&&(f=new Date(y.component.start.getTime()),"appointment"===y.component.type&&(y.component.end=new Date(y.component.start.getTime()),y.component.end.addMinutes(y.component.delta),g=new Date(y.component.end.getTime())),b())}},y.adjustEndTime=function(){if(y.component.end){var e=g.valueOf()-y.component.end.valueOf();0!==e&&((e=y.component.start.minutesTo(y.component.end))<0?y.component.end=new Date(g.getTime()):(y.component.delta=e,g=new Date(y.component.end.getTime())),b())}},y.adjustDueTime=function(){new Date(y.component.due.getTime())},y.component.start&&(f=new Date(y.component.start.getTime())),y.component.end&&(g=new Date(y.component.end.getTime())),y.component.due&&new Date(y.component.due.getTime());function v(e){y.component.$reset(),e.$setPristine()}function $(e){y.attendeeConflictError=!1,e.$setPristine(),e.$setDirty()}function C(){var e=[];return y.component.start&&y.component.end&&(e=y.component.start.daysUpTo(y.component.end)),_.map(e,function(e){return{stringWithSeparator:e.stringWithSeparator(),getDayString:e.getDayString()}})}function b(){y.attendeesEditor.days=C(),y.component.updateFreeBusy()}}angular.module("SOGo.SchedulerUI").controller("ComponentController",e).controller("ComponentEditorController",t)}(),function(){"use strict";e.$inject=["$scope","Calendar"];function e(e,t){this.day=e.day,this.dayNumber=e.dayNumber,this.dayString=e.dayString,this.calendarData=function(){var n,a,o;return e.calendar?(n=e.calendar,o=_.filter(t.$findAll(),{active:1}),a=_.findIndex(o,function(e){return e.id==n}),{pid:n,index:a}):null}}angular.module("SOGo.SchedulerUI").directive("sgCalendarDay",function(){return{restrict:"E",scope:{day:"@sgDay",dayNumber:"@sgDayNumber",dayString:"@sgDayString",calendar:"@sgCalendar"},controller:e}})}(),function(){"use strict";e.$inject=["CalendarSettings"];function e(e){return{restrict:"E",scope:{block:"=sgBlock",clickBlock:"&sgClick"},replace:!0,template:function(e,t){var n=_.has(t,"sgCalendarGhost")?"":"::";return['
",'
','
",'
',' {{'+n+"block.component.c_priority}}"," {{ "+n+"block.component.summary }}",' ',' ',' ',' ',' '," ",'
',' place ',"
","
","
",'
{{ block.startHour }}
','
{{ block.endHour }}
',"
"].join("")},link:function(e,t,n){var a,o,i;_.has(n,"sgCalendarGhost")||(a=100/e.block.siblings,o=e.block.position*a,i=100-(e.block.position+1)*a,a<100&&(o>0&&(o-=2),i>0&&(i-=2)),0===o&&(o=2),0===i&&(i=2),t.css("left",o+"%"),t.css("right",i+"%"),e.block.component&&e.block.component.c_isallday||(t.addClass("starts"+e.block.start),t.addClass("lasts"+e.block.length)),e.block.userState&&t.addClass("sg-event--"+e.block.userState),e.block.component&&(t.addClass("bg-folder"+e.block.component.pid),t.addClass("contrast-bdr-folder"+e.block.component.pid),0===e.block.component.c_isopaque&&t.addClass("sg-event--transparent"),0===e.block.component.c_status&&t.addClass("sg-event--cancelled")))}}}angular.module("SOGo.SchedulerUI").directive("sgCalendarDayBlock",e)}(),function(){"use strict";angular.module("SOGo.SchedulerUI").directive("sgCalendarDayTable",function(){return{restrict:"E",scope:{blocks:"=sgBlocks",day:"@sgDay",clickBlock:"&sgClick"},template:["'].join("")}})}(),function(){"use strict";e.$inject=["$rootScope","$timeout","CalendarSettings","Calendar","Component"];function e(e,t,n,a,o){return{restrict:"A",require:["^sgCalendarDay","^sgCalendarScrollView"],link:function(t,i,r,s){var c,l,d,u,h;c=i[0],l=s[0],d=s[1],u=-1,i.addClass("sg-event--ghost md-whiteframe-3dp ng-hide");var p=e.$on("calendar:dragstart",function(){var e,n,a;t.block=o.$ghost,(n=l.calendarData())&&(u=n.index,e=n.pid,h=t.block.pointerHandler.originalCalendar.index);e||(e=t.block.component.pid);(a=t.block.component.blocks[0].userState)&&i.addClass("sg-event--"+a);i.addClass("bg-folder"+e)}),m=e.$on("calendar:drag",function(){var e,o,r,s,c,p,m,f;if(e=!1,a.$view&&a.$view.type==d.type){if(o="multiday-allday"===d.type,r=t.block.component.c_isallday,s=t.block.pointerHandler.currentEventCoordinates.dayNumber,c=t.block.pointerHandler.currentEventCoordinates.start,m=t.block.pointerHandler.currentEventCoordinates.duration,f=n.EventDragDayLength-c,angular.isUndefined(m))return;for((p=m)>f&&(p=f),s>-1&&(u<0&&s==l.dayNumber||s==u&&(h==u||!t.block.component.isException))&&(e=!0,o||(r||(t.block.startHour=($=c,g($))),a.$view.quarterHeight?(i.css("top",c*a.$view.quarterHeight+"px"),i.css("height",p*a.$view.quarterHeight+"px")):i.css("top",a.$view.topOffset+"px")),i.removeClass("fg-folder"+t.block.component.pid),i.removeClass("sg-event--ghost--last"),i.addClass("sg-event--ghost--first"),t.block.isFirst=!0),m-=p,s++;!e&&m&&s<=l.dayNumber;)(p=m)>n.EventDragDayLength&&(p=n.EventDragDayLength),s>-1&&s==l.dayNumber&&(e=!0,o||(i.css("top",a.$view.topOffset+"px"),a.$view.quarterHeight&&i.css("height",p*a.$view.quarterHeight+"px")),i.removeClass("sg-event--ghost--first"),i.removeClass("sg-event--ghost--last"),i.addClass("fg-folder"+t.block.component.pid)),m-=p,s++,c=0;m||(o?i.addClass("sg-event--ghost--last"):r||(t.block.endHour=(y=c,v=p,g((y+v)%n.EventDragDayLength))))}var y,v;var $;e?i.removeClass("ng-hide"):i.addClass("ng-hide")}),f=e.$on("calendar:dragend",function(){_.forEachRight(c.classList,function(e){/^bg-folder/.test(e)&&i.removeClass(e)}),i.addClass("ng-hide")});t.$on("$destroy",function(){p(),m(),f()});function g(e){var t,n,a;return t=15*e,(n=Math.floor(t/60))<10&&(n="0"+n),(a=t%60)<10&&(a="0"+a),n+":"+a}}}}angular.module("SOGo.SchedulerUI").directive("sgCalendarGhost",e)}(),function(){"use strict";e.$inject=["CalendarSettings"];function e(e){return{restrict:"E",scope:{component:"=sgComponent",clickComponent:"&sgClick"},replace:!0,template:function(e,t){return['
','
",' '," {{ ::component.c_title }}",' ',' ',' ',' ',' '," ",'
',' access_time ',"
",'
',' place ',"
","
"].join("")},link:function(e,t,n){e.component.viewable&&t.addClass("md-clickable");e.component.userstate&&t.addClass("sg-event--"+e.component.userstate);t.addClass("bg-folder"+e.component.pid),t.addClass("contrast-bdr-folder"+e.component.pid),0===e.component.c_isopaque&&t.addClass("sg-event--transparent");0===e.component.c_status&&t.addClass("sg-event--cancelled")}}}angular.module("SOGo.SchedulerUI").directive("sgCalendarListEvent",e)}(),function(){e.$inject=["$rootScope","$scope","$element","$mdToast","$mdPanel","$mdMedia","$mdSidenav","sgConstant","Dialog","Calendar"];function e(e,t,n,a,o,i,r,s,c,d){var u=this;this.$onInit=function(){this.editMode=!1},this.$postLink=function(){this.clickableElement=n.find("p")[0],this.nameElements=this.clickableElement.getElementsByClassName("sg-calendar-name"),this.inputContainer=n.find("md-input-container")[0],this.inputElement=n.find("input")[0],this.moreOptionsButton=_.last(n.find("md-icon")),this.updateCalendarName()},this.updateCalendarName=function(){_.forEach(this.nameElements,function(e){e.innerHTML=u.calendar.name})},this.editFolder=function(e){this.editMode=!0,this.inputElement.value=this.calendar.name,this.clickableElement.classList.add("ng-hide"),this.inputContainer.classList.remove("ng-hide"),this.inputElement.focus(),this.inputElement.select(),e&&(e.stopPropagation(),e.preventDefault())},this.saveFolder=function(e){this.inputElement.disabled||(this.calendar.name=this.inputElement.value,this.inputElement.disabled=!0,this.calendar.$rename().then(function(e){u.editMode=!1,u.inputContainer.classList.add("ng-hide"),u.clickableElement.classList.remove("ng-hide"),u.updateCalendarName()}).finally(function(){u.inputElement.disabled=!1}))},this.revertEditing=function(){this.editMode=!1,this.clickableElement.classList.remove("ng-hide"),this.inputContainer.classList.add("ng-hide"),this.inputElement.value=this.calendar.name},this.confirmDelete=function(){this.calendar.isSubscription?this.calendar.$delete().catch(function(e,t){c.alert(l('An error occured while deleting the calendar "%{0}".',u.calendar.name),l(e.error))}):c.confirm(l("Warning"),l('Are you sure you want to delete the calendar "%{0}"?',this.calendar.name),{ok:l("Delete")}).then(function(){u.calendar.$delete().catch(function(e,t){c.alert(l('An error occured while deleting the calendar "%{0}".',u.calendar.name),l(e.error))})})},this.showMenu=function(t){var n=o.newPanelPosition().relativeTo(this.moreOptionsButton).addPanelPosition(o.xPosition.ALIGN_START,o.yPosition.ALIGN_TOPS),i=o.newPanelAnimation().openFrom(this.moreOptionsButton).duration(100).withAnimation(o.animation.FADE),r={attachTo:angular.element(document.body),locals:{itemCtrl:this,calendar:this.calendar,editFolder:angular.bind(this,this.editFolder),confirmDelete:angular.bind(this,this.confirmDelete)},bindToController:!0,controller:s,controllerAs:"$menuCtrl",position:n,animation:i,targetEvent:t,templateUrl:"UIxCalendarMenu",trapFocus:!0,clickOutsideToClose:!0,escapeToClose:!0,focusOnOpen:!0};o.open(r).then(function(e){e.panelEl.one("click",function(){e.close()})}),s.$inject=["mdPanelRef","$mdDialog","FileUploader","User"];function s(n,o,i,r){var s=this;this.showOnly=function(){_.forEach(d.$findAll(),function(e){s.calendar.id==e.id?e.active=1:e.active=0})},this.showAll=function(){_.forEach(d.$findAll(),function(e){e.active=1})},this.showProperties=function(){var e=this.calendar.color;o.show({templateUrl:this.calendar.id+"/properties",controller:t,controllerAs:"properties",clickOutsideToClose:!0,escapeToClose:!0,locals:{srcCalendar:this.calendar}}).catch(function(){s.calendar.color=e}),t.$inject=["$scope","$mdDialog","srcCalendar"];function t(e,t,n){var a=this;a.calendar=new d(n.$omit()),a.saveProperties=function(e){e.$valid&&(a.calendar.$save(),n.init(a.calendar.$omit()),t.hide())},a.close=function(){t.cancel()},e.$watch(function(){return a.calendar.color},function(){n.color=a.calendar.color})}},this.showLinks=function(){o.show({parent:angular.element(document.body),clickOutsideToClose:!0,escapeToClose:!0,templateUrl:this.calendar.id+"/links",controller:e,controllerAs:"links",locals:{calendar:this.calendar}}),e.$inject=["$mdDialog","calendar"];function e(e,t){this.calendar=t,this.close=function(){e.hide()}}},this.importCalendar=function(){o.show({parent:angular.element(document.body),targetEvent:t,clickOutsideToClose:!0,escapeToClose:!0,templateUrl:"UIxCalendarImportDialog",controller:n,controllerAs:"$CalendarImportDialogController",locals:{folder:this.calendar}}),n.$inject=["scope","$mdDialog","folder"];function n(t,n,o){this.uploader=new i({url:ApplicationBaseURL+[o.id,"import"].join("/"),autoUpload:!0,queueLimit:1,filters:[{name:r,fn:r}],onSuccessItem:function(t,o,i,r){var s;n.hide(),0===o.imported?s=l("No event was imported."):(s=l("A total of %{0} events were imported in the calendar.",o.imported),e.$emit("calendars:list")),a.show(a.simple().content(s).position("top right").hideDelay(3e3))},onErrorItem:function(e,t,n,o){a.show({template:["",'
',' error_outline'," "+l("An error occurred while importing calendar.")+"","
","
"].join(""),position:"top right",hideDelay:3e3})}}),this.close=function(){n.hide()};function r(e){var t=0===e.type.indexOf("text")||/\.(ics)$/.test(e.name);return t||a.show({template:["",'
',' error_outline'," "+l("Select an iCalendar file (.ics).")+"","
","
"].join(""),position:"top right",hideDelay:3e3}),t}}},this.share=function(){this.calendar.$acl.$users().then(function(){o.show({templateUrl:s.calendar.id+"/UIxAclEditor",controller:"AclController",controllerAs:"acl",clickOutsideToClose:!0,escapeToClose:!0,locals:{usersWithACL:s.calendar.$acl.users,User:r,folder:s.calendar}})})}}}}angular.module("SOGo.SchedulerUI").controller("sgCalendarListItemController",e).directive("sgCalendarListItem",function(){return{restrict:"C",scope:{},bindToController:{calendar:"=sgCalendar"},template:['','

',' ',' ',' ',"

",'',' ',"",''," drag_handle","",'more_vert'].join(""),controller:"sgCalendarListItemController",controllerAs:"$ctrl"}})}(),function(){"use strict";angular.module("SOGo.SchedulerUI").directive("sgCalendarMonthDay",function(){return{restrict:"E",scope:{blocks:"=sgBlocks",day:"@sgDay",clickBlock:"&sgClick"},template:["'].join("")}})}(),function(){"use strict";angular.module("SOGo.SchedulerUI").directive("sgCalendarMonthEvent",function(){return{restrict:"E",scope:{block:"=sgBlock",clickBlock:"&sgClick"},replace:!0,template:function(e,t){var n=_.has(t,"sgCalendarGhost")?"":"::";return['
','
",' {{ '+n+"block.component.startHour }}",' {{'+n+"block.component.c_priority}}"," {{ "+n+"block.component.summary }}",' ',' ',' ',' ',' '," ","
"].join("")},link:function(e,t,n){_.has(n,"sgCalendarGhost")||(e.block.userState&&t.addClass("sg-event--"+e.block.userState),e.block.component&&(t.addClass("bg-folder"+e.block.component.pid),0===e.block.component.c_isopaque&&t.addClass("sg-event--transparent"),0===e.block.component.c_status&&t.addClass("sg-event--cancelled")))}}})}(),function(){"use strict";e.$inject=["$rootScope","$window","$document","$q","$timeout","$mdGesture","Calendar","Component","Preferences"];function e(e,n,a,o,i,r,s,c,l){return{restrict:"A",scope:{type:"@sgCalendarScrollView"},controller:t,link:function(t,a,o,r){var d,u,h=!1;d=null,u=t.type,h="multicolumndayview"==a.attr("sg-view"),r.isMultiColumn=h,i(function(){if(d=new p(a,u),"monthly"!=u){var e,t,n;l.defaults.SOGoDayStartTime&&(e=l.defaults.SOGoDayStartTime.split(":"),t=document.getElementById("hour"+parseInt(e[0])),n=parseInt(e[1])*d.quarterHeight,d.element.scrollTop=t.offsetTop+n)}r.quarterHeight=d.quarterHeight}),t.$on("$destroy",function(){d&&d.$destroy()});function p(t,a){this.$element=t,this.element=t[0],this.type=a,this.quarterHeight=this.getQuarterHeight(),this.scrollStep=6*this.quarterHeight,this.dayNumbers=this.getDayNumbers(),this.maxX=this.getMaxColumns(),this.deregisterDragStart=e.$on("calendar:dragstart",angular.bind(this,this.onDragStart)),this.deregisterDragStop=e.$on("calendar:dragend",angular.bind(this,this.onDragEnd)),this.bindedUpdateCoordinates=angular.bind(this,this.updateCoordinates),this.bindedUpdateFromPointerHandler=angular.bind(this,this.updateFromPointerHandler),this.updateCoordinates(),angular.element(n).on("resize",this.bindedUpdateCoordinates)}p.prototype={$destroy:function(){this.deregisterDragStart(),this.deregisterDragStop(),this.$element.off("mousemove",this.bindedUpdateFromPointerHandler),angular.element(n).off("resize",this.bindedUpdateCoordinates)},onDragStart:function(){this.$element.on("mousemove",this.bindedUpdateFromPointerHandler),this.updateCoordinates(),this.updateFromPointerHandler()},onDragEnd:function(){this.$element.off("mousemove",this.bindedUpdateFromPointerHandler),s.$view=null},getQuarterHeight:function(){var e,t,n=null;return e=document.getElementById("hour0"),t=document.getElementById("hour23"),e&&t&&(n=(t.offsetTop-e.offsetTop)/92),n},getDayDimensions:function(e){var t,n,a,o,i,r,s;return n=t=a=o=0,(i=this.element.getElementsByClassName("day")).length>0&&(n=(r=i[0].getBoundingClientRect()).height,t=r.width,a=r.left-e,(s=i[0].getElementsByClassName("sg-calendar-tile-header")).length>0&&(o=s[0].clientHeight)),{height:n,width:t,offset:{left:a,top:o}}},getDayNumbers:function(){var e;return e=this.element.getElementsByTagName("sg-calendar-day"),_.map(e,function(e,t){return h?t:parseInt(e.attributes["sg-day-number"].value)})},getMaxColumns:function(){var e,t=0;return"monthly"==this.type?(e=this.element.getElementsByTagName("md-grid-list")[0],t=parseInt(e.attributes["md-cols"].value)-1):t=this.element.getElementsByClassName("day").length-1,t},updateCoordinates:function(){var e,t;e=this.element.getBoundingClientRect(),t=this.getDayDimensions(e.left),angular.extend(this,{coordinates:{x:e.left,y:e.top},dayHeight:t.height,dayWidth:t.width,daysOffset:t.offset.left,topOffset:t.offset.top})},updateFromPointerHandler:function(){var e,t,n,a,o,i;e=c.$ghost.pointerHandler,this.coordinates&&e&&(t=e.getContainerBasedCoordinates(this))&&(s.$view=this,n=(new Date).getTime(),(!this.lastScroll||n>this.lastScroll+100)&&(this.lastScroll=n,(a=t.y-this.scrollStep)<0?(a<(o=-this.element.scrollTop)&&(a=o),this.element.scrollTop+=a):(i=(a=t.y+this.scrollStep)-this.element.clientHeight)>0&&(this.element.scrollTop+=i)))}}}}}t.$inject=["$scope"];function t(e){this.type=e.type}angular.module("SOGo.SchedulerUI").directive("sgCalendarScrollView",e)}(),function(){"use strict";angular.module("SOGo.SchedulerUI").directive("sgCategoryStylesheet",function(){return{restrict:"E",require:"ngModel",scope:{ngModel:"="},replace:!0,template:['"].join("")}})}(),function(){"use strict";e.$inject=["$rootScope","$timeout","$log","Preferences","Calendar","CalendarSettings","Component"];function e(e,t,n,a,o,i,r){return{restrict:"CA",require:"^sgCalendarDay",link:function(s,c,d,u){if(s.block){if(!s.block.component.editable||s.block.userState)return void c.removeClass("sg-draggable-calendar-block");!function(){var e,t,n,a,o,i,r,l,d,u;if(s.block.length<3)return;e=s.block.component,t=s.block.dayIndex,n=_.findIndex(e.blocks,["dayIndex",t]),a=0===n,o=n===e.blocks.length-1,(i=angular.element('
')).addClass("bdr-folder"+e.pid),e.c_isallday||"SG-CALENDAR-MONTH-DAY"===c[0].parentNode.tagName?(a&&(r=angular.element('
').append(i),c.append(r)),o&&(l=angular.element('
').append(i.clone()),c.append(l))):(a&&(d=angular.element('
').append(i),c.append(d)),o&&(u=angular.element('
').append(i.clone()),c.append(u)))}()}c.on("mousedown",h),s.$on("$destroy",function(){c.off("mousedown",h),c.off("mousemove",p)});function h(e){var t,n,a,o;e.stopPropagation(),e.target.scrollHeight>e.target.clientHeight+1&&(a=e.target.getBoundingClientRect(),o=a.left+a.width-18,e.pageX>o)||(t="move-event",s.block&&s.block.component?"dragGrip-top"==e.target.className||"dragGrip-left"==e.target.className?t="change-start":"dragGrip-bottom"!=e.target.className&&"dragGrip-right"!=e.target.className||(t="change-end"):t="change-end",(n=new y(t)).initFromEvent(e),r.$ghost.pointerHandler=n,angular.element(document).one("mouseup",m),angular.element(document).on("mousemove",p))}function p(e){var n=r.$ghost.pointerHandler;t(function(){n.updateFromEvent(e)})}function m(t){var n,a;n=s.block,a=r.$ghost.pointerHandler,angular.element(document).off("mousemove",p),a.dragHasStarted&&(e.$emit("calendar:dragend"),a.dragHasStarted=!1),n&&n.component&&_.forEach(n.component.blocks,function(e){e.dragging=!1})}function f(){}f.prototype={x:-1,y:-1,getDelta:function(e){var t=new f;return t.x=this.x-e.x,t.y=this.y-e.y,o.$view&&(t.days=o.$view.dayNumbers[this.x]-o.$view.dayNumbers[e.x]),t},getDistance:function(e){var t=this.getDelta(e);return Math.sqrt(t.x*t.x+t.y*t.y)},clone:function(){var e=new f;return e.x=this.x,e.y=this.y,e}};function g(e){this.setEventType(e)}g.prototype={dayNumber:-1,weekDay:-1,start:-1,duration:-1,eventType:null,setEventType:function(e){this.eventType=e},initFromBlock:function(e){var t=-1;"monthly"===this.eventType?(this.start=0,this.duration=e.component.blocks.length*i.EventDragDayLength):(this.start=e.component.blocks[0].start,this.duration=_.sumBy(e.component.blocks,function(e){var n,a;return a=e.dayNumber,n=t<0?0:a-t-1,t=a,e.length+n*i.EventDragDayLength}))},initFromCalendar:function(e){this.dayNumber=e},getDelta:function(e){var t=new g;return t.dayNumber=this.dayNumber-e.dayNumber,t.start=this.start-e.start,t.duration=this.duration-e.duration,t},_quartersToHM:function(e){var t=15*e,n=Math.floor(t/60);n<10&&(n="0"+n);var a=t%60;return a<10&&(a="0"+a),n+":"+a},getStartTime:function(){return this._quartersToHM(this.start)},getEndTime:function(){var e=(this.start+this.duration)%i.EventDragDayLength;return this._quartersToHM(e)},clone:function(){var e=new g;return e.dayNumber=this.dayNumber,e.start=this.start,e.duration=this.duration,e}};function y(e){this.dragMode=e}y.prototype={originalCoordinates:null,currentCoordinates:null,originalViewCoordinates:null,currentViewCoordinates:null,originalEventCoordinates:null,currentEventCoordinates:null,originalCalendar:null,dragHasStarted:!1,getEventViewCoordinates:null,initFromBlock:function(e){this.currentEventCoordinates=new g(this.eventType),this.originalEventCoordinates=new g(this.eventType),this.originalEventCoordinates.initFromBlock(e)},initFromEvent:function(e){this.currentCoordinates=new f,this.updateFromEvent(e),this.originalCoordinates=this.currentCoordinates.clone()},initFromCalendar:function(e){this.originalCalendar=e,this.currentEventCoordinates.initFromCalendar(e.index),this.originalEventCoordinates.initFromCalendar(e.index)},updateFromEvent:function(t){if(this.currentCoordinates.x=t.pageX,this.currentCoordinates.y=t.pageY,this.dragHasStarted&&o.$view){var i=this.getEventViewCoordinates(o.$view);this.originalViewCoordinates||(this.originalViewCoordinates=this.getEventViewCoordinates(o.$view,this.originalCoordinates),r.$ghost.component.isNew&&(this.setTimeFromQuarters(r.$ghost.component.start,this.originalViewCoordinates.y),n.debug("new event start date "+r.$ghost.component.start))),this.currentViewCoordinates&&i&&i.x==this.currentViewCoordinates.x&&i.y==this.currentViewCoordinates.y||(this.currentViewCoordinates=i,this.originalViewCoordinates&&(i||(this.currentViewCoordinates=this.originalViewCoordinates.clone()),this.updateEventCoordinates()))}else if(this.originalCoordinates&&this.currentCoordinates&&!this.dragHasStarted){var d=this.getDistance();d>3&&(this.dragHasStarted=!0,function(t){var i,d,h,p,m,f,g,y,v;h=c.hasClass("clickableHourCell"),p="SG-CALENDAR-MONTH-DAY"==c[0].parentNode.tagName||c.hasClass("clickableDayCell"),v=u.calendarData(),s.block&&s.block.component?i=s.block:(m=u.dayString.parseDate(a.$mdDateLocaleProvider,"%Y-%m-%e"),f={type:"appointment",pid:v?v.pid:o.$defaultCalendar(),summary:l("New Event"),startDate:m,isAllDay:h?0:1},g=new r(f),(i={component:g,dayNumber:u.dayNumber,length:0}).component.blocks=[i]);d="multiday",p?d="monthly":i.component.c_isallday&&(d="multiday-allday");_.forEach(i.component.blocks,function(e){e.dragging=!0}),(y=r.$ghost.pointerHandler).prepareWithEventType(d),y.initFromBlock(i),v&&y.initFromCalendar(v);r.$ghost.component=i.component,n.debug("emit calendar:dragstart "+d),e.$emit("calendar:dragstart")}())}},updateEventCoordinates:function(){var t,a=this.currentViewCoordinates.getDelta(this.originalViewCoordinates),r=a.days*i.EventDragDayLength+a.y;n.debug("quarters delta "+r),angular.isUndefined(this.originalEventCoordinates.start)?(this.originalEventCoordinates.dayNumber=o.$view.dayNumbers[this.originalViewCoordinates.x],this.originalEventCoordinates.start=this.originalViewCoordinates.y):this.originalEventCoordinates.dayNumber<0&&(this.originalEventCoordinates.dayNumber=o.$view.dayNumbers[s.block.component.blocks[0].dayIndex]),this.currentEventCoordinates.dayNumber=this.originalEventCoordinates.dayNumber,"move-event"==this.dragMode?(this.currentEventCoordinates.start=this.originalEventCoordinates.start+r,this.currentEventCoordinates.duration=this.originalEventCoordinates.duration):"change-start"==this.dragMode?(t=this.originalEventCoordinates.duration-r)>0?(this.currentEventCoordinates.start=this.originalEventCoordinates.start+r,this.currentEventCoordinates.duration=t):t<0&&(this.currentEventCoordinates.start=this.originalEventCoordinates.start+this.originalEventCoordinates.duration,this.currentEventCoordinates.duration=-t):"change-end"==this.dragMode&&((t=this.originalEventCoordinates.duration+r)>0?(this.currentEventCoordinates.start=this.originalEventCoordinates.start,this.currentEventCoordinates.duration=t):t<0&&(this.currentEventCoordinates.start=this.originalEventCoordinates.start+t,this.currentEventCoordinates.duration=-t));var c;this.currentEventCoordinates.start<0?(c=Math.ceil(-this.currentEventCoordinates.start/i.EventDragDayLength),this.currentEventCoordinates.start+=c*i.EventDragDayLength,this.currentEventCoordinates.dayNumber-=c):this.currentEventCoordinates.start>=i.EventDragDayLength&&(c=Math.floor(this.currentEventCoordinates.start/i.EventDragDayLength),this.currentEventCoordinates.start-=c*i.EventDragDayLength,this.currentEventCoordinates.dayNumber+=c),n.debug("event coordinates "+JSON.stringify(this.currentEventCoordinates)),e.$emit("calendar:drag")},getContainerBasedCoordinates:function(e,t){var n=t||this.currentCoordinates,a=n.getDelta(e.coordinates),o=e.element;return(a.xo.clientWidth||a.y<0||a.y>o.clientHeight)&&(a=null),a},prepareWithEventType:function(e){var t={multiday:this.getEventMultiDayViewCoordinates,"multiday-allday":this.getEventMultiDayAllDayViewCoordinates,monthly:this.getEventMonthlyViewCoordinates,unknown:null},n=t[e];this.eventType=e,this.getEventViewCoordinates=n},getEventMultiDayViewCoordinates:function(e,t){var n=this.getEventMultiDayAllDayViewCoordinates(e,t);if(n){var a=e.quarterHeight,o=this.getContainerBasedCoordinates(e,t);o.y+=e.element.scrollTop,n.y=Math.floor((o.y-i.EventDragHorizontalOffset)/a);var r=i.EventDragDayLength-1;n.y<0?n.y=0:n.y>r&&(n.y=r)}return n},getEventMultiDayAllDayViewCoordinates:function(e,t){var n,a=this.getContainerBasedCoordinates(e,t);if(a){n=new f;var i=e.dayWidth,r=e.daysOffset;n.x=Math.floor((a.x-r)/i);var s=0,c=o.$view.maxX;if("move-event"!=this.dragMode){var l=u.calendarData();l&&(s=c=l.index)}n.xc&&(n.x=c),n.y=0}else n=null;return n},getEventMonthlyViewCoordinates:function(e,t){var n,a=this.getContainerBasedCoordinates(e,t);if(a){n=new f;var o=e.maxX,i=e.dayWidth,r=e.daysOffset,s=e.dayHeight,c=Math.floor((a.y-0)/s);c<0&&(c=0),n.x=Math.floor((a.x-r)/i),n.x<0?n.x=0:n.x>o&&(n.x=o),n.x+=(o+1)*c,n.y=0}else n=null;return n},getDistance:function(){return this.currentCoordinates.getDistance(this.originalCoordinates)},setTimeFromQuarters:function(e,t){var n,a;n=Math.floor(t/4),a=t%4*15,e.setHours(n,a)}}}}}angular.module("SOGo.SchedulerUI").directive("sgDraggableCalendarBlock",e)}(),function(){"use strict";e.$inject=["$scope","$element","$timeout"];function e(e,t,n){var a,o=this,i=t.controller("sgCalendarScrollView");e.nowDay=null,e.lineElement=null,e.updateLine=function(r){var s=new Date,c=s.getDayString(),l=s.getHours(),d=4*e.quarterHeight,u=s.getMinutes(),h=e.quarterHeight/15,p=parseInt(l*d+u*h-1);(r||c!=e.nowDay)&&(e.lineElement&&e.lineElement.remove(),e.lineElement=function(e,n){var a=angular.element("");i.isMultiColumn?n&&n[0].attributes["sg-day"].value==e&&t.append(a):_.forEach(n,function(t){t.attributes["sg-day"].value==e&&angular.element(t).find("div").eq(0).append(a)});return a}(c,e.days),e.nowDay=c);e.lineElement&&(e.lineElement.css("top",p+"px"),a=n(angular.bind(o,e.updateLine),6e4))},e.$on("$destroy",function(){a&&n.cancel(a)})}angular.module("SOGo.SchedulerUI").directive("sgNowLine",function(){return{restrict:"C",require:"^^sgCalendarScrollView",link:function(e,t,n,a){function o(){return t.find("sg-calendar-day")}var i=e.$watch(function(){return a.quarterHeight},function(t){if(t){i(),e.quarterHeight=t;var n=e.$watch(o,function(t){t.length&&(n(),e.days=t,e.updateLine())})}})},controller:e}})}(); //# sourceMappingURL=Scheduler.services.js.map \ No newline at end of file diff --git a/UI/WebServerResources/js/Scheduler.services.js.map b/UI/WebServerResources/js/Scheduler.services.js.map index d5d51c5b5..aff3cf155 100644 --- a/UI/WebServerResources/js/Scheduler.services.js.map +++ b/UI/WebServerResources/js/Scheduler.services.js.map @@ -1 +1 @@ -{"version":3,"sources":["Scheduler/Calendar.service.js","Scheduler/Component.service.js","Scheduler/CalendarController.js","Scheduler/CalendarListController.js","Scheduler/CalendarsController.js","Scheduler/ComponentController.js","Scheduler/sgCalendarDay.directive.js","Scheduler/sgCalendarDayBlock.directive.js","Scheduler/sgCalendarDayTable.directive.js","Scheduler/sgCalendarGhost.directive.js","Scheduler/sgCalendarListEvent.directive.js","Scheduler/sgCalendarListItem.directive.js","Scheduler/sgCalendarMonthDay.directive.js","Scheduler/sgCalendarMonthEvent.directive.js","Scheduler/sgCalendarScrollView.directive.js","Scheduler/sgCategoryStylesheet.directive.js","Scheduler/sgDraggableCalendarBlock.directive.js","Scheduler/sgNowLine.directive.js"],"names":["Calendar","futureCalendarData","this","init","name","id","newCalendarData","$$resource","create","$unwrap","$factory","$q","$timeout","$log","Settings","Resource","Preferences","Component","Acl","angular","extend","activeUser","$Preferences","$Component","$$Acl","$view","module","e","value","EventDragDayLength","EventDragHorizontalOffset","ConflictHTTPErrorCode","factory","$defaultCalendar","calendar","defaults","SOGoDefaultCalendar","_","find","$findAll","active","$add","list","sibling","isWebCalendar","$webcalendars","isSubscription","$subscriptions","$calendars","findIndex","o","i","localeCompare","push","splice","settings","FoldersOrder","saveFoldersOrder","flatMap","$reloadAll","data","writable","_this","forEach","isUndefined","fetch","then","calendars","union","filter","isOwned","acls","objectCreator","calendarData","group","owner","login","$get","$getIndex","indexOf","map","$subscribe","uid","path","userResource","$addWebCalendar","url","d","defer","urls","webCalendarURL","reject","post","isEditable","isRemote","debug","JSON","stringify","undefined","resolve","response","status","promise","reloadWebCalendars","promises","$error","l","statusText","all","$deleteComponents","components","component","isDefined","pid","uids","saveFoldersActivation","ids","request","folders","prototype","color","$acl","isSuperUser","$shadowData","$omit","$id","when","$futureCalendarData","getClassName","base","$rename","$save","$delete","remove","$reset","key","save","error","setCredentials","username","password","export","options","type","filename","download","$setActivation","$getComponent","componentId","recurrenceId","$find","isError","isObject","futureComponentData","newComponentData","newguid","isNew","$rootScope","Component_STATUS","User","Card","Gravatar","STATUS","$settings","$User","$Card","$gravatar","timeFormat","$query","search","$queryEvents","sort","asc","filterpopup","$queryTasks","$refreshTimeout","$ghost","EventsFilterState","TasksFilterState","EventsSortingState","parseInt","TasksSortingState","show_completed","ShowCompletedTasks","$categories","SOGoCalendarCategoriesColors","SOGoTimeFormat","constant","NOT_LOADED","DELAYED_LOADING","LOADING","LOADED","DELAYED_MS","$selectedCount","count","$events","event","selected","length","$tasks","task","$startRefreshTimeout","cancel","refreshViewCheck","SOGoRefreshViewCheck","f","bind","$emit","timeInterval","$isLoading","$loaded","$filter","otherType","now","Date","day","getDate","month","getMonth","year","getFullYear","queryKey","capitalize","params","dirty","keys","$unwrapCollection","calendarId","occurrenceId","encodeURIComponent","join","filterCategories","query","re","RegExp","category","saveSelectedList","componentType","$eventsBlocksForView","view","date","firstDayOfWeek","viewAction","startDate","endDate","SOGoFirstDayOfWeek","beginOfWeek","setTime","getTime","addDays","setDate","setMonth","endOfWeek","$eventsBlocks","j","dayDates","dayNumbers","deferred","toLowerCase","sd","getDayString","ed","views","reduceComponent","associateComponent","objects","eventData","componentData","zipObject","eventsFields","start","c_startdate","hour","getHourString","blocks","block","nbr","isFirst","$views","viewIndex","viewData","allDayBlocks","reduce","events","flatten","days","dayIndex","dayNumber","calendarName","fields","invokeMap","monthData","dayData","$resetGhost","pointerHandler","startHour","endHour","$parseDate","dateString","time","substring","split","no_time","categories","repeat","alarm","action","quantity","unit","reference","relation","delta","isString","setMinutes","Math","round","getMinutes","end","minutesTo","setDelta","dueDate","due","completedDate","completed","c_category","$isRecurrent","byDayMask","occurrence","frequency","byday","toString","dates","rdate","rdates","interval","monthdays","months","until","$hasCustomRepeat","hasCustomRepeat","classification","match","exec","SOGoCalendarDefaultReminder","$hasAlarm","M","H","D","W","sendAppointmentNotifications","SOGoAppointmentSendEMailNotifications","destinationCalendar","attendees","attendee","image","email","updateFreeBusy","initOrganizer","results","organizer","cn","c_email","updateFreeBusyAttendee","isReadOnly","isEditableOccurrence","isInvitation","userHasRSVP","isInvitationOccurrence","showPercentComplete","percentComplete","enablePercentComplete","coversFreeBusy","quarter","freebusy","updateFreeBusyCoverage","roundedStart","roundedEnd","startQuarter","endQuarter","daysUpTo","index","hourKey","currentDay","dayKey","getHours","beginOfDay","addMinutes","resource","domain","sday","eday","isMSExchange","c_folder","addAttendee","card","organizerCalendar","$isList","expandable","container","c_name","listId","refs","ref","c_cn","$preferredEmail","role","partstat","c_uid","$avatarIcon","c_domain","ismsexchange","hasAttendee","emails","deleteAttendee","currentAttendee","canRemindAttendeesByEmail","addAttachUrl","attachUrl","attachUrls","deleteAttachUrl","$addDueDate","toISOString","$deleteDueDate","$addStartDate","$deleteStartDate","$addRecurrenceDate","$deleteRecurrenceDate","$reply","reply","delegatedTo","$adjust","every","values","v","extraAttributes","dlp","$mdDateLocaleProvider","format","startTime","endTime","dueTime","stringWithSeparator","occurrenceOnly","$futureComponentData","copy","repeatDescription","localizedString","toUpperCase","alarmDescription","copyTo","destination","moveTo","CalendarController","$inject","$scope","$state","$stateParams","sgHotkeys","stateEventsBlocks","deregisterCalendarsList","vm","hotkeys","expandedAllDays","selectedDate","asDate","toggleAllDays","changeDate","changeView","$onInit","createHotkey","description","callback","args","_goToPeriod","registerHotkey","_formatDate","$on","updateView","deregisterHotkey","$event","direction","setHours","$dateFormat","replace","newDate","element","currentTarget","attr","go","controller","CalendarListController","$mdDialog","focus","Dialog","CalendarSettings","Alarm","selectedList","selectComponentType","unselectComponents","mode","multiple","selectAll","searchMode","toggleComponentSelection","preventDefault","stopPropagation","confirmDeleteSelectedComponents","confirm","ok","openEvent","openComponent","openTask","newComponent","filteredBy","field","sortedBy","reload","finally","cancelSearch","SelectedList","updateComponentFromGhost","viewable","templateUrl","show","parent","document","body","targetEvent","clickOutsideToClose","escapeToClose","controllerAs","locals","stateComponent","baseComponent","coordinates","calendarNumber","activeCalendars","currentEventCoordinates","summary","isAllDay","duration","catch","getDelta","originalEventCoordinates","originalCalendar","isException","getAlarms","onComponentAdjustError","template","RecurrentComponentDialogController","updateThisOccurrence","hide","updateAllOccurrences","message","AttendeeConflictDialogController","conflictError","ignoreConflicts","CalendarsController","$window","$mdToast","service","newCalendar","ev","prompt","UserLogin","addWebCalendar","inputType","WebCalendarAuthDialogController","scope","parts","hostname","title","formatted","authenticate","form","$valid","required","reason","$setValidity","subscribeToFolder","simple","content","position","hideDelay","sortableMode","toggleSortableMode","resetSort","sortableCalendars","scrollableContainer","containment","orderChanged","accept","sourceItemHandleScope","destSortableScope","destItemScope","sortableScope","SOGoCalendarCategories","asCSSIdentifier","$watch","pick","newList","oldList","commonList","intersectionBy","oldObject","isEqual","ComponentController","AddressBook","Account","calendarService","close","highPriority","priority","cardFilter","$filterAll","newMessageWithAllRecipients","recipients","_newMessage","newMessageWithRecipient","edit","editAllOccurrences","replyAllOccurrences","deleteOccurrence","deleteAllOccurrences","toggleRawSource","ComponentRawSourceDialogController","copySelectedComponent","moveSelectedComponent","accounts","account","$getMailboxes","mailboxes","$newMessage","editable","to","subject","stateAccount","stateMessage","ComponentEditorController","oldStartDate","oldEndDate","showRecurrenceEditor","toggleRecurrenceEditor","recurrenceMonthDaysAreRequired","showAttendeesEditor","toggleAttendeesEditor","changeFrequency","changeCalendar","$cards","address","emailRE","createCard","str","searchText","trim","charCodeAt","test","charAt","removeAttendee","$setDirty","priorityLevel","reset","attendeeConflictError","attendeesEditor","getDays","hours","addStartDate","addDueDate","adjustStartTime","valueOf","adjustEndTime","adjustDueTime","$setPristine","sgCalendarDayController","dayString","directive","restrict","sgCalendarDayBlock","clickBlock","tElem","tAttrs","p","has","link","iElement","attrs","pc","left","right","siblings","css","c_isallday","addClass","userState","c_isopaque","c_status","sgCalendarGhost","require","ctrls","domElement","calendarDayCtrl","scrollViewCtrl","originalCalendarNumber","deregisterDragStart","deregisterDrag","showGhost","isRelative","durationLeft","maxDuration","quartersToHM","quarterHeight","topOffset","removeClass","deregisterDragEnd","forEachRight","classList","c","quarters","minutes","mins","floor","sgCalendarListEvent","clickComponent","userstate","sgCalendarListItemController","$element","$mdPanel","$mdMedia","$mdSidenav","sgConstant","$ctrl","editMode","$postLink","clickableElement","nameElements","getElementsByClassName","inputContainer","inputElement","moreOptionsButton","last","updateCalendarName","innerHTML","editFolder","add","select","saveFolder","disabled","revertEditing","confirmDelete","alert","showMenu","panelPosition","newPanelPosition","relativeTo","addPanelPosition","xPosition","ALIGN_START","yPosition","ALIGN_TOPS","panelAnimation","newPanelAnimation","openFrom","withAnimation","animation","FADE","config","attachTo","itemCtrl","bindToController","MenuController","trapFocus","focusOnOpen","open","panelRef","panelEl","one","mdPanelRef","FileUploader","$menuCtrl","showOnly","showAll","showProperties","PropertiesDialogController","srcCalendar","saveProperties","showLinks","LinksDialogController","importCalendar","CalendarImportDialogController","folder","uploader","ApplicationBaseURL","autoUpload","queueLimit","filters","filterByExtension","fn","onSuccessItem","item","headers","msg","imported","onErrorItem","isTextFile","share","$users","usersWithACL","users","sgCalendarScrollView","$document","$mdGesture","sgCalendarScrollViewController","isMultiColumn","sgScrollView","hourCell","quartersOffset","SOGoDayStartTime","getElementById","scrollTop","offsetTop","$destroy","getQuarterHeight","scrollStep","getDayNumbers","maxX","getMaxColumns","onDragStart","deregisterDragStop","onDragEnd","bindedUpdateCoordinates","updateCoordinates","bindedUpdateFromPointerHandler","updateFromPointerHandler","on","off","hour0","hour23","height","getDayDimensions","viewLeft","width","leftOffset","nodes","domRect","tileHeader","getBoundingClientRect","clientHeight","offset","top","getElementsByTagName","el","attributes","mdGridList","max","dayDimensions","x","y","dayHeight","dayWidth","daysOffset","pointerCoordinates","scrollY","minY","getContainerBasedCoordinates","lastScroll","ngModel","sgDraggableCalendarBlock","blockIndex","isFirstBlock","isLastBlock","dragGrip","leftGrip","rightGrip","topGrip","bottomGrip","parentNode","tagName","append","clone","initGrips","onDragDetect","onDrag","dragMode","rect","scrollableZone","target","scrollHeight","pageX","className","SOGoEventDragPointerHandler","initFromEvent","updateFromEvent","pointer","dragHasStarted","b","dragging","SOGoCoordinates","otherCoordinates","getDistance","sqrt","SOGoEventDragEventCoordinates","eventType","setEventType","weekDay","initFromBlock","prevDayNumber","sumBy","currentDayNumber","initFromCalendar","_quartersToHM","getStartTime","getEndTime","originalCoordinates","currentCoordinates","originalViewCoordinates","currentViewCoordinates","getEventViewCoordinates","pageY","newEventCoordinates","setTimeFromQuarters","updateEventCoordinates","distance","isHourCell","isMonthly","newData","hasClass","parseDate","prepareWithEventType","dragStart","newDuration","deltaQuarters","deltaDays","ceil","clientWidth","methods","multiday","getEventMultiDayViewCoordinates","multiday-allday","getEventMultiDayAllDayViewCoordinates","monthly","getEventMonthlyViewCoordinates","unknown","method","pxCoordinates","maxY","minX","daysY","sgNowLineController","updater","nowDay","lineElement","updateLine","force","hourHeight","minuteHeight","$lineElement","dayElement","eq","_addLine","iAttr","sgCalendarScrollViewCtrl","_getDays","_unwatchView","_unwatchDays"],"mappings":"CAEA,WACE,aAOA,SAASA,EAASC,GAGhB,GADAC,KAAKC,KAAKF,GACNC,KAAKE,OAASF,KAAKG,GAAI,CAEzB,IAAIC,EAAkBN,EAASO,WAAWC,OAAO,eAAgBN,KAAKE,MACtEF,KAAKO,QAAQH,IASjBN,EAASU,UAAY,KAAM,WAAY,OAAQ,aAAc,WAAY,cAAe,YAAa,MAAO,SAASC,EAAIC,EAAUC,EAAMC,EAAUC,EAAUC,EAAaC,EAAWC,GAanL,OAZAC,QAAQC,OAAOpB,GACbW,GAAIA,EACJC,SAAUA,EACVC,KAAMA,EACNN,WAAY,IAAIQ,EAASD,EAASO,WAAW,aAAe,WAAYP,EAASO,cACjFC,aAAcN,EACdO,WAAYN,EACZO,MAAON,EACPG,WAAYP,EAASO,aACrBI,MAAO,OAGFzB,IAOT,IACEmB,QAAQO,OAAO,oBAEjB,MAAMC,GACJR,QAAQO,OAAO,oBAAqB,gBAEtCP,QAAQO,OAAO,oBACZE,MAAM,oBACLC,mBAA6B,GAC7BC,0BAA6B,EAC7BC,sBAA6B,MAE9BC,QAAQ,WAAYhC,EAASU,UAOhCV,EAASiC,iBAAmB,WAC1B,IACIC,EAEJ,MAAuB,SAHDlC,EAASsB,aAAaa,SAASC,sBAInDF,EAAWG,EAAEC,KAAKtC,EAASuC,SAAS,MAAM,GAAO,SAASL,GACxD,OAAOA,EAASM,UAGTN,EAAS7B,GAGb,YAQTL,EAASyC,KAAO,SAASP,GAEvB,IAAIQ,EAAMC,EAGRD,EADER,EAASU,cACJ1C,KAAK2C,cACLX,EAASY,eACT5C,KAAK6C,eAEL7C,KAAK8C,YAEdL,EAAUN,EAAEY,UAAUP,EAAM,SAASQ,EAAGC,GACtC,MAAuB,YAAfjB,EAAS7B,IACA,YAAR6C,EAAE7C,IAAoB6C,EAAE9C,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3Y,EAAM3R,KAAOA,EAEb2R,EAAM+X,oBAtBd9c,WAAY0c,KAblB","file":"Scheduler.services.js"} \ No newline at end of file +{"version":3,"sources":["Scheduler/Calendar.service.js","Scheduler/Component.service.js","Scheduler/CalendarController.js","Scheduler/CalendarListController.js","Scheduler/CalendarsController.js","Scheduler/ComponentController.js","Scheduler/sgCalendarDay.directive.js","Scheduler/sgCalendarDayBlock.directive.js","Scheduler/sgCalendarDayTable.directive.js","Scheduler/sgCalendarGhost.directive.js","Scheduler/sgCalendarListEvent.directive.js","Scheduler/sgCalendarListItem.directive.js","Scheduler/sgCalendarMonthDay.directive.js","Scheduler/sgCalendarMonthEvent.directive.js","Scheduler/sgCalendarScrollView.directive.js","Scheduler/sgCategoryStylesheet.directive.js","Scheduler/sgDraggableCalendarBlock.directive.js","Scheduler/sgNowLine.directive.js"],"names":["Calendar","futureCalendarData","this","init","name","id","newCalendarData","$$resource","create","$unwrap","$factory","$q","$timeout","$log","Settings","Resource","Preferences","Component","Acl","angular","extend","activeUser","$Preferences","$Component","$$Acl","$view","module","e","value","EventDragDayLength","EventDragHorizontalOffset","ConflictHTTPErrorCode","factory","$defaultCalendar","calendar","defaults","SOGoDefaultCalendar","_","find","$findAll","active","$add","list","sibling","isWebCalendar","$webcalendars","isSubscription","$subscriptions","$calendars","findIndex","o","i","localeCompare","push","splice","settings","FoldersOrder","saveFoldersOrder","flatMap","$reloadAll","data","writable","_this","forEach","isUndefined","fetch","then","calendars","union","filter","isOwned","acls","objectCreator","calendarData","group","owner","login","$get","$getIndex","indexOf","map","$subscribe","uid","path","userResource","$addWebCalendar","url","d","defer","urls","webCalendarURL","reject","post","isEditable","isRemote","debug","JSON","stringify","undefined","resolve","response","status","promise","reloadWebCalendars","promises","$error","l","statusText","all","$deleteComponents","components","component","isDefined","pid","uids","saveFoldersActivation","ids","request","folders","prototype","color","$acl","isSuperUser","$shadowData","$omit","$id","when","$futureCalendarData","getClassName","base","$rename","$save","$delete","remove","$reset","key","save","error","setCredentials","username","password","export","options","type","filename","download","$setActivation","$getComponent","componentId","recurrenceId","$find","isError","isObject","futureComponentData","newComponentData","newguid","isNew","$rootScope","Component_STATUS","User","Card","Gravatar","STATUS","$settings","$User","$Card","$gravatar","timeFormat","$query","search","$queryEvents","sort","asc","filterpopup","$queryTasks","$refreshTimeout","$ghost","EventsFilterState","TasksFilterState","EventsSortingState","parseInt","TasksSortingState","show_completed","ShowCompletedTasks","$categories","SOGoCalendarCategoriesColors","SOGoTimeFormat","constant","NOT_LOADED","DELAYED_LOADING","LOADING","LOADED","DELAYED_MS","$selectedCount","count","$events","event","selected","length","$tasks","task","$startRefreshTimeout","cancel","refreshViewCheck","SOGoRefreshViewCheck","f","bind","$emit","timeInterval","$isLoading","$loaded","$filter","otherType","now","Date","day","getDate","month","getMonth","year","getFullYear","queryKey","capitalize","params","dirty","keys","$unwrapCollection","calendarId","occurrenceId","encodeURIComponent","join","filterCategories","query","re","RegExp","category","saveSelectedList","componentType","$eventsBlocksForView","view","date","firstDayOfWeek","viewAction","startDate","endDate","SOGoFirstDayOfWeek","beginOfWeek","setTime","getTime","addDays","setDate","setMonth","endOfWeek","$eventsBlocks","j","dayDates","dayNumbers","deferred","toLowerCase","sd","getDayString","ed","views","reduceComponent","associateComponent","objects","eventData","componentData","zipObject","eventsFields","start","c_startdate","hour","getHourString","blocks","block","nbr","isFirst","$views","viewIndex","viewData","allDayBlocks","reduce","events","flatten","days","dayIndex","dayNumber","calendarName","fields","invokeMap","monthData","dayData","$resetGhost","pointerHandler","startHour","endHour","$parseDate","dateString","time","substring","split","no_time","categories","repeat","alarm","action","quantity","unit","reference","relation","delta","isString","setMinutes","Math","round","getMinutes","end","minutesTo","setDelta","dueDate","due","completedDate","completed","c_category","$isRecurrent","byDayMask","occurrence","frequency","byday","toString","dates","rdate","rdates","interval","monthdays","months","until","$hasCustomRepeat","hasCustomRepeat","classification","match","exec","SOGoCalendarDefaultReminder","$hasAlarm","M","H","D","W","sendAppointmentNotifications","SOGoAppointmentSendEMailNotifications","destinationCalendar","attendees","attendee","image","email","updateFreeBusy","initOrganizer","results","organizer","cn","c_email","updateFreeBusyAttendee","isReadOnly","isEditableOccurrence","isInvitation","userHasRSVP","isInvitationOccurrence","showPercentComplete","percentComplete","enablePercentComplete","coversFreeBusy","quarter","freebusy","updateFreeBusyCoverage","roundedStart","roundedEnd","startQuarter","endQuarter","daysUpTo","index","hourKey","currentDay","dayKey","getHours","beginOfDay","addMinutes","resource","domain","sday","eday","isMSExchange","c_folder","addAttendee","card","organizerCalendar","$isList","expandable","container","c_name","listId","refs","ref","c_cn","$preferredEmail","role","partstat","c_uid","$avatarIcon","c_domain","ismsexchange","hasAttendee","emails","deleteAttendee","currentAttendee","canRemindAttendeesByEmail","addAttachUrl","attachUrl","attachUrls","deleteAttachUrl","$addDueDate","toISOString","$deleteDueDate","$addStartDate","$deleteStartDate","$addRecurrenceDate","$deleteRecurrenceDate","$reply","reply","delegatedTo","$adjust","every","values","v","extraAttributes","dlp","$mdDateLocaleProvider","format","startTime","endTime","dueTime","stringWithSeparator","occurrenceOnly","$futureComponentData","copy","repeatDescription","localizedString","toUpperCase","alarmDescription","copyTo","destination","moveTo","CalendarController","$inject","$scope","$state","$stateParams","sgHotkeys","stateEventsBlocks","deregisterCalendarsList","vm","hotkeys","expandedAllDays","selectedDate","asDate","toggleAllDays","changeDate","changeView","$onInit","createHotkey","description","callback","args","_goToPeriod","registerHotkey","_formatDate","$on","updateView","deregisterHotkey","$event","direction","setHours","$dateFormat","replace","newDate","element","currentTarget","attr","go","controller","CalendarListController","$mdDialog","focus","Dialog","CalendarSettings","Alarm","selectedList","selectComponentType","unselectComponents","mode","multiple","selectAll","searchMode","toggleComponentSelection","preventDefault","stopPropagation","confirmDeleteSelectedComponents","confirm","ok","openEvent","openComponent","openTask","newComponent","filteredBy","field","sortedBy","reload","finally","cancelSearch","SelectedList","updateComponentFromGhost","viewable","templateUrl","show","parent","document","body","targetEvent","clickOutsideToClose","escapeToClose","controllerAs","locals","stateComponent","baseComponent","coordinates","calendarNumber","activeCalendars","currentEventCoordinates","summary","isAllDay","duration","catch","getDelta","originalEventCoordinates","originalCalendar","isException","getAlarms","onComponentAdjustError","template","RecurrentComponentDialogController","updateThisOccurrence","hide","updateAllOccurrences","message","AttendeeConflictDialogController","conflictError","ignoreConflicts","CalendarsController","$window","$mdToast","service","newCalendar","ev","prompt","UserLogin","addWebCalendar","inputType","WebCalendarAuthDialogController","scope","parts","hostname","title","formatted","authenticate","form","$valid","required","reason","$setValidity","subscribeToFolder","simple","content","position","hideDelay","sortableMode","toggleSortableMode","resetSort","sortableCalendars","scrollableContainer","containment","orderChanged","accept","sourceItemHandleScope","destSortableScope","destItemScope","sortableScope","SOGoCalendarCategories","asCSSIdentifier","$watch","pick","newList","oldList","commonList","intersectionBy","oldObject","isEqual","ComponentController","AddressBook","Account","calendarService","close","highPriority","priority","cardFilter","$filterAll","newMessageWithAllRecipients","recipients","_newMessage","newMessageWithRecipient","edit","editAllOccurrences","replyAllOccurrences","deleteOccurrence","deleteAllOccurrences","toggleRawSource","ComponentRawSourceDialogController","copySelectedComponent","moveSelectedComponent","accounts","account","$getMailboxes","mailboxes","$newMessage","editable","to","subject","stateAccount","stateMessage","ComponentEditorController","oldStartDate","oldEndDate","showRecurrenceEditor","toggleRecurrenceEditor","recurrenceMonthDaysAreRequired","showAttendeesEditor","toggleAttendeesEditor","changeFrequency","changeCalendar","$cards","address","emailRE","createCard","str","searchText","trim","charCodeAt","test","charAt","removeAttendee","$setDirty","priorityLevel","reset","attendeeConflictError","attendeesEditor","getDays","hours","addStartDate","addDueDate","adjustStartTime","valueOf","adjustEndTime","adjustDueTime","$setPristine","sgCalendarDayController","dayString","directive","restrict","sgCalendarDayBlock","clickBlock","tElem","tAttrs","p","has","link","iElement","attrs","pc","left","right","siblings","css","c_isallday","addClass","userState","c_isopaque","c_status","sgCalendarGhost","require","ctrls","domElement","calendarDayCtrl","scrollViewCtrl","originalCalendarNumber","deregisterDragStart","deregisterDrag","showGhost","isRelative","durationLeft","maxDuration","quartersToHM","quarterHeight","topOffset","removeClass","deregisterDragEnd","forEachRight","classList","c","quarters","minutes","mins","floor","sgCalendarListEvent","clickComponent","userstate","sgCalendarListItemController","$element","$mdPanel","$mdMedia","$mdSidenav","sgConstant","$ctrl","editMode","$postLink","clickableElement","nameElements","getElementsByClassName","inputContainer","inputElement","moreOptionsButton","last","updateCalendarName","innerHTML","editFolder","add","select","saveFolder","disabled","revertEditing","confirmDelete","alert","showMenu","panelPosition","newPanelPosition","relativeTo","addPanelPosition","xPosition","ALIGN_START","yPosition","ALIGN_TOPS","panelAnimation","newPanelAnimation","openFrom","withAnimation","animation","FADE","config","attachTo","itemCtrl","bindToController","MenuController","trapFocus","focusOnOpen","open","panelRef","panelEl","one","mdPanelRef","FileUploader","$menuCtrl","showOnly","showAll","showProperties","PropertiesDialogController","srcCalendar","saveProperties","showLinks","LinksDialogController","importCalendar","CalendarImportDialogController","folder","uploader","ApplicationBaseURL","autoUpload","queueLimit","filters","filterByExtension","fn","onSuccessItem","item","headers","msg","imported","onErrorItem","isTextFile","share","$users","usersWithACL","users","sgCalendarScrollView","$document","$mdGesture","sgCalendarScrollViewController","isMultiColumn","sgScrollView","hourCell","quartersOffset","SOGoDayStartTime","getElementById","scrollTop","offsetTop","$destroy","getQuarterHeight","scrollStep","getDayNumbers","maxX","getMaxColumns","onDragStart","deregisterDragStop","onDragEnd","bindedUpdateCoordinates","updateCoordinates","bindedUpdateFromPointerHandler","updateFromPointerHandler","on","off","hour0","hour23","height","getDayDimensions","viewLeft","width","leftOffset","nodes","domRect","tileHeader","getBoundingClientRect","clientHeight","offset","top","getElementsByTagName","el","attributes","mdGridList","max","dayDimensions","x","y","dayHeight","dayWidth","daysOffset","pointerCoordinates","scrollY","minY","getContainerBasedCoordinates","lastScroll","ngModel","sgDraggableCalendarBlock","blockIndex","isFirstBlock","isLastBlock","dragGrip","leftGrip","rightGrip","topGrip","bottomGrip","parentNode","tagName","append","clone","initGrips","onDragDetect","onDrag","dragMode","rect","scrollableZone","target","scrollHeight","pageX","className","SOGoEventDragPointerHandler","initFromEvent","updateFromEvent","pointer","dragHasStarted","b","dragging","SOGoCoordinates","otherCoordinates","getDistance","sqrt","SOGoEventDragEventCoordinates","eventType","setEventType","weekDay","initFromBlock","prevDayNumber","sumBy","currentDayNumber","initFromCalendar","_quartersToHM","getStartTime","getEndTime","originalCoordinates","currentCoordinates","originalViewCoordinates","currentViewCoordinates","getEventViewCoordinates","pageY","newEventCoordinates","setTimeFromQuarters","updateEventCoordinates","distance","isHourCell","isMonthly","newData","hasClass","parseDate","prepareWithEventType","dragStart","newDuration","deltaQuarters","deltaDays","ceil","clientWidth","methods","multiday","getEventMultiDayViewCoordinates","multiday-allday","getEventMultiDayAllDayViewCoordinates","monthly","getEventMonthlyViewCoordinates","unknown","method","pxCoordinates","maxY","minX","daysY","sgNowLineController","updater","nowDay","lineElement","updateLine","force","hourHeight","minuteHeight","$lineElement","dayElement","eq","_addLine","iAttr","sgCalendarScrollViewCtrl","_getDays","_unwatchView","_unwatchDays"],"mappings":"CAEA,WACE,aAOA,SAASA,EAASC,GAGhB,GADAC,KAAKC,KAAKF,GACNC,KAAKE,OAASF,KAAKG,GAAI,CAEzB,IAAIC,EAAkBN,EAASO,WAAWC,OAAO,eAAgBN,KAAKE,MACtEF,KAAKO,QAAQH,IASjBN,EAASU,UAAY,KAAM,WAAY,OAAQ,aAAc,WAAY,cAAe,YAAa,MAAO,SAASC,EAAIC,EAAUC,EAAMC,EAAUC,EAAUC,EAAaC,EAAWC,GAanL,OAZAC,QAAQC,OAAOpB,GACbW,GAAIA,EACJC,SAAUA,EACVC,KAAMA,EACNN,WAAY,IAAIQ,EAASD,EAASO,WAAW,aAAe,WAAYP,EAASO,cACjFC,aAAcN,EACdO,WAAYN,EACZO,MAAON,EACPG,WAAYP,EAASO,aACrBI,MAAO,OAGFzB,IAOT,IACEmB,QAAQO,OAAO,oBAEjB,MAAMC,GACJR,QA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GAAG,GAAGhF,OAAO8E,KAI3D,OAAOA,EA3BgBG,CAAST,EAAQ/e,EAAOzK,MAC7CyK,EAAO+e,OAASA,GAGd/e,EAAOgf,cAEThf,EAAOgf,YAAYpQ,IAAI,MAAO5G,EAAW,MAEzC8W,EAAUx6B,EAASO,QAAQ2L,KAAKhJ,EAAOwY,EAAOif,YAAa,OA5B/Djf,EAAOsB,IAAI,WAAY,WACjBwd,GACFx6B,EAAS8L,OAAO0uB,KAiDtBj6B,QACGO,OAAO,oBACPyoB,UAAU,YApGb,WACE,OACEC,SAAU,IACVqB,QAAS,yBACTd,KAIF,SAAcnH,EAAOoH,EAAUmR,EAAOC,GACpC,SAASC,IACP,OAAOrR,EAAStoB,KAAK,mBAOvB,IAAI45B,EAAe1Y,EAAM8B,OALzB,WACE,OAAO0W,EAAyB1P,eAIQ,SAASA,GACjD,GAAIA,EAAe,CACjB4P,IACA1Y,EAAM8I,cAAgBA,EAEtB,IAAI6P,EAAe3Y,EAAM8B,OAAO2W,EAAU,SAASpqB,GAC7CA,EAAKvF,SACP6vB,IACA3Y,EAAM3R,KAAOA,EAEb2R,EAAM+X,oBAtBd9c,WAAY0c,KAblB","file":"Scheduler.services.js"} \ No newline at end of file diff --git a/UI/WebServerResources/js/vendor/angular-ui-router.js b/UI/WebServerResources/js/vendor/angular-ui-router.js index 45622a4b1..5a068ed29 100644 --- a/UI/WebServerResources/js/vendor/angular-ui-router.js +++ b/UI/WebServerResources/js/vendor/angular-ui-router.js @@ -4,7 +4,7 @@ * This causes it to be incompatible with plugins that depend on @uirouter/core. * We recommend switching to the ui-router-core.js and ui-router-angularjs.js bundles instead. * For more information, see https://ui-router.github.io/blog/uirouter-for-angularjs-umd-bundles - * @version v1.0.12 + * @version v1.0.13 * @link https://ui-router.github.io * @license MIT License, http://www.opensource.org/licenses/MIT */ @@ -124,7 +124,7 @@ var prop = function (name) { * let getName = propEq("name", "blarg"); * getName(obj) === true */ -var propEq = curry(function (name, val, obj) { return obj && obj[name] === val; }); +var propEq = curry(function (name, _val, obj) { return obj && obj[name] === _val; }); /** * Given a dotted property name, returns a function that returns a nested property from an object, or undefined * let obj = { id: 1, nestedObj: { foo: 1, name: "blarg" }, }; @@ -134,7 +134,7 @@ var propEq = curry(function (name, val, obj) { return obj && obj[name] === val; * propNotFound(obj) === undefined */ var parse = function (name) { - return pipe.apply(null, name.split(".").map(prop)); + return pipe.apply(null, name.split('.').map(prop)); }; /** * Given a function that returns a truthy or falsey value, returns a @@ -184,6 +184,7 @@ function or(fn1, fn2) { var all = function (fn1) { return function (arr) { return arr.reduce(function (b, x) { return b && !!fn1(x); }, true); }; }; +// tslint:disable-next-line:variable-name var any = function (fn1) { return function (arr) { return arr.reduce(function (b, x) { return b || !!fn1(x); }, false); }; }; @@ -194,8 +195,8 @@ var is = function (ctor) { }; }; /** Given a value, returns a Predicate function that returns true if another value is === equal to the original value */ -var eq = function (val) { return function (other) { - return val === other; +var eq = function (value) { return function (other) { + return value === other; }; }; /** Given a value, returns a function which returns the value */ var val = function (v) { return function () { return v; }; }; @@ -317,11 +318,8 @@ var Glob = /** @class */ (function () { return '\\.[^.]*'; return '\\.' + seg; }).join(''); - this.regexp = new RegExp("^" + regexpString + "$"); + this.regexp = new RegExp('^' + regexpString + '$'); } - Glob.prototype.matches = function (name) { - return this.regexp.test('.' + name); - }; /** Returns true if the string has glob-like characters in it */ Glob.is = function (text) { return !!/[!,*]+/.exec(text); @@ -330,6 +328,9 @@ var Glob = /** @class */ (function () { Glob.fromString = function (text) { return Glob.is(text) ? new Glob(text) : null; }; + Glob.prototype.matches = function (name) { + return this.regexp.test('.' + name); + }; return Glob; }()); @@ -362,7 +363,7 @@ var StateObject = /** @class */ (function () { stateDecl.$$state = function () { return state; }; state.self = stateDecl; state.__stateObjectCache = { - nameGlob: Glob.fromString(state.name) // might return null + nameGlob: Glob.fromString(state.name), }; return state; }; @@ -388,7 +389,7 @@ var StateObject = /** @class */ (function () { if (!this.parent || !(this.parent instanceof this.constructor)) return this.name; var name = this.parent.fqn(); - return name ? name + "." + this.name : this.name; + return name ? name + '.' + this.name : this.name; }; /** * Returns the root node of this state's tree. @@ -660,9 +661,9 @@ function ancestors(first, second) { */ function pick(obj, propNames) { var objCopy = {}; - for (var prop_1 in obj) { - if (propNames.indexOf(prop_1) !== -1) { - objCopy[prop_1] = obj[prop_1]; + for (var _prop in obj) { + if (propNames.indexOf(_prop) !== -1) { + objCopy[_prop] = obj[_prop]; } } return objCopy; @@ -849,7 +850,7 @@ var assertPredicate = assertFn; */ var assertMap = assertFn; function assertFn(predicateOrMap, errMsg) { - if (errMsg === void 0) { errMsg = "assert failure"; } + if (errMsg === void 0) { errMsg = 'assert failure'; } return function (obj) { var result = predicateOrMap(obj); if (!result) { @@ -892,8 +893,8 @@ function arrayTuples() { if (args.length === 0) return []; var maxArrayLen = args.reduce(function (min, arr) { return Math.min(arr.length, min); }, 9007199254740991); // aka 2^53 − 1 aka Number.MAX_SAFE_INTEGER - var i, result = []; - for (i = 0; i < maxArrayLen; i++) { + var result = []; + var _loop_1 = function (i) { // This is a hot function // Unroll when there are 1-4 arguments switch (args.length) { @@ -913,6 +914,9 @@ function arrayTuples() { result.push(args.map(function (array) { return array[i]; })); break; } + }; + for (var i = 0; i < maxArrayLen; i++) { + _loop_1(i); } return result; } @@ -941,7 +945,7 @@ function applyPairs(memo, keyValTuple) { if (isArray(keyValTuple)) key = keyValTuple[0], value = keyValTuple[1]; if (!isString(key)) - throw new Error("invalid parameters to applyPairs"); + throw new Error('invalid parameters to applyPairs'); memo[key] = value; return memo; } @@ -999,13 +1003,13 @@ function _equals(o1, o2) { var predicates = [isFunction, isArray, isDate, isRegExp]; if (predicates.map(any).reduce(function (b, fn) { return b || !!fn(tup); }, false)) return false; - var key, keys = {}; - for (key in o1) { + var keys = {}; + for (var key in o1) { if (!_equals(o1[key], o2[key])) return false; keys[key] = true; } - for (key in o2) { + for (var key in o2) { if (!keys[key]) return false; } @@ -1079,7 +1083,8 @@ var Queue = /** @class */ (function () { RejectType[RejectType["IGNORED"] = 5] = "IGNORED"; RejectType[RejectType["ERROR"] = 6] = "ERROR"; })(exports.RejectType || (exports.RejectType = {})); -/** @hidden */ var id = 0; +/** @hidden */ +var id = 0; var Rejection = /** @class */ (function () { function Rejection(type, message, detail) { this.$id = id++; @@ -1087,24 +1092,13 @@ var Rejection = /** @class */ (function () { this.message = message; this.detail = detail; } - Rejection.prototype.toString = function () { - var detailString = function (d) { - return d && d.toString !== Object.prototype.toString ? d.toString() : stringify(d); - }; - var detail = detailString(this.detail); - var _a = this, $id = _a.$id, type = _a.type, message = _a.message; - return "Transition Rejection($id: " + $id + " type: " + type + ", message: " + message + ", detail: " + detail + ")"; - }; - Rejection.prototype.toPromise = function () { - return extend(silentRejection(this), { _transitionRejection: this }); - }; /** Returns true if the obj is a rejected promise created from the `asPromise` factory */ Rejection.isRejectionPromise = function (obj) { return obj && (typeof obj.then === 'function') && is(Rejection)(obj._transitionRejection); }; /** Returns a Rejection due to transition superseded */ Rejection.superseded = function (detail, options) { - var message = "The transition has been superseded by a different transition"; + var message = 'The transition has been superseded by a different transition'; var rejection = new Rejection(exports.RejectType.SUPERSEDED, message, detail); if (options && options.redirected) { rejection.redirected = true; @@ -1117,22 +1111,22 @@ var Rejection = /** @class */ (function () { }; /** Returns a Rejection due to invalid transition */ Rejection.invalid = function (detail) { - var message = "This transition is invalid"; + var message = 'This transition is invalid'; return new Rejection(exports.RejectType.INVALID, message, detail); }; /** Returns a Rejection due to ignored transition */ Rejection.ignored = function (detail) { - var message = "The transition was ignored"; + var message = 'The transition was ignored'; return new Rejection(exports.RejectType.IGNORED, message, detail); }; /** Returns a Rejection due to aborted transition */ Rejection.aborted = function (detail) { - var message = "The transition has been aborted"; + var message = 'The transition has been aborted'; return new Rejection(exports.RejectType.ABORTED, message, detail); }; /** Returns a Rejection due to aborted transition */ Rejection.errored = function (detail) { - var message = "The transition errored"; + var message = 'The transition errored'; return new Rejection(exports.RejectType.ERROR, message, detail); }; /** @@ -1147,6 +1141,17 @@ var Rejection = /** @class */ (function () { Rejection.normalize = function (detail) { return is(Rejection)(detail) ? detail : Rejection.errored(detail); }; + Rejection.prototype.toString = function () { + var detailString = function (d) { + return d && d.toString !== Object.prototype.toString ? d.toString() : stringify(d); + }; + var detail = detailString(this.detail); + var _a = this, $id = _a.$id, type = _a.type, message = _a.message; + return "Transition Rejection($id: " + $id + " type: " + type + ", message: " + message + ", detail: " + detail + ")"; + }; + Rejection.prototype.toPromise = function () { + return extend(silentRejection(this), { _transitionRejection: this }); + }; return Rejection; }()); @@ -1184,7 +1189,8 @@ var Rejection = /** @class */ (function () { * * @coreapi * @module trace - */ /** for typedoc */ + */ +/* tslint:disable:no-console */ /** @hidden */ function uiViewString(uiview) { if (!uiview) @@ -1227,9 +1233,12 @@ var consoletable = isFunction(console.table) ? console.table.bind(console) : con Category[Category["UIVIEW"] = 3] = "UIVIEW"; Category[Category["VIEWCONFIG"] = 4] = "VIEWCONFIG"; })(exports.Category || (exports.Category = {})); -/** @hidden */ var _tid = parse("$id"); -/** @hidden */ var _rid = parse("router.$id"); -/** @hidden */ var transLbl = function (trans) { return "Transition #" + _tid(trans) + "-" + _rid(trans); }; +/** @hidden */ +var _tid = parse('$id'); +/** @hidden */ +var _rid = parse('router.$id'); +/** @hidden */ +var transLbl = function (trans) { return "Transition #" + _tid(trans) + "-" + _rid(trans); }; /** * Prints UI-Router Transition trace information to the console. */ @@ -1293,7 +1302,7 @@ var Trace = /** @class */ (function () { Trace.prototype.traceHookInvocation = function (step, trans, options) { if (!this.enabled(exports.Category.HOOK)) return; - var event = parse("traceData.hookType")(options) || "internal", context = parse("traceData.context.state.name")(options) || parse("traceData.context")(options) || "unknown", name = functionToString(step.registeredHook.callback); + var event = parse('traceData.hookType')(options) || 'internal', context = parse('traceData.context.state.name')(options) || parse('traceData.context')(options) || 'unknown', name = functionToString(step.registeredHook.callback); console.log(transLbl(trans) + ": Hook -> " + event + " context: " + context + ", " + maxLength(200, name)); }; /** @internalapi called by ui-router code */ @@ -1328,7 +1337,7 @@ var Trace = /** @class */ (function () { }; /** @internalapi called by ui-router code */ Trace.prototype.traceUIViewEvent = function (event, viewData, extra) { - if (extra === void 0) { extra = ""; } + if (extra === void 0) { extra = ''; } if (!this.enabled(exports.Category.UIVIEW)) return; console.log("ui-view: " + padString(30, event) + " " + uiViewString(viewData) + extra); @@ -1337,24 +1346,27 @@ var Trace = /** @class */ (function () { Trace.prototype.traceUIViewConfigUpdated = function (viewData, context) { if (!this.enabled(exports.Category.UIVIEW)) return; - this.traceUIViewEvent("Updating", viewData, " with ViewConfig from context='" + context + "'"); + this.traceUIViewEvent('Updating', viewData, " with ViewConfig from context='" + context + "'"); }; /** @internalapi called by ui-router code */ Trace.prototype.traceUIViewFill = function (viewData, html) { if (!this.enabled(exports.Category.UIVIEW)) return; - this.traceUIViewEvent("Fill", viewData, " with: " + maxLength(200, html)); + this.traceUIViewEvent('Fill', viewData, " with: " + maxLength(200, html)); }; /** @internalapi called by ui-router code */ Trace.prototype.traceViewSync = function (pairs) { if (!this.enabled(exports.Category.VIEWCONFIG)) return; + var uivheader = 'uiview component fqn'; + var cfgheader = 'view config state (view name)'; var mapping = pairs.map(function (_a) { var uiView = _a.uiView, viewConfig = _a.viewConfig; var uiv = uiView && uiView.fqn; - var cfg = viewConfig && viewConfig.viewDecl.$context.name + ": " + viewConfig.viewDecl.$name; - return { 'ui-view fqn': uiv, 'state: view name': cfg }; - }).sort(function (a, b) { return a['ui-view fqn'].localeCompare(b['ui-view fqn']); }); + var cfg = viewConfig && viewConfig.viewDecl.$context.name + ": (" + viewConfig.viewDecl.$name + ")"; + return _b = {}, _b[uivheader] = uiv, _b[cfgheader] = cfg, _b; + var _b; + }).sort(function (a, b) { return (a[uivheader] || '').localeCompare(b[uivheader] || ''); }); consoletable(mapping); }; /** @internalapi called by ui-router code */ @@ -1563,6 +1575,59 @@ var TransitionHook = /** @class */ (function () { this.options = defaults(options, defaultOptions); this.type = registeredHook.eventType; } + /** + * Chains together an array of TransitionHooks. + * + * Given a list of [[TransitionHook]] objects, chains them together. + * Each hook is invoked after the previous one completes. + * + * #### Example: + * ```js + * var hooks: TransitionHook[] = getHooks(); + * let promise: Promise = TransitionHook.chain(hooks); + * + * promise.then(handleSuccess, handleError); + * ``` + * + * @param hooks the list of hooks to chain together + * @param waitFor if provided, the chain is `.then()`'ed off this promise + * @returns a `Promise` for sequentially invoking the hooks (in order) + */ + TransitionHook.chain = function (hooks, waitFor) { + // Chain the next hook off the previous + var createHookChainR = function (prev, nextHook) { + return prev.then(function () { return nextHook.invokeHook(); }); + }; + return hooks.reduce(createHookChainR, waitFor || services.$q.when()); + }; + /** + * Invokes all the provided TransitionHooks, in order. + * Each hook's return value is checked. + * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned. + * If no hook returns a promise, then all hooks are processed synchronously. + * + * @param hooks the list of TransitionHooks to invoke + * @param doneCallback a callback that is invoked after all the hooks have successfully completed + * + * @returns a promise for the async result, or the result of the callback + */ + TransitionHook.invokeHooks = function (hooks, doneCallback) { + for (var idx = 0; idx < hooks.length; idx++) { + var hookResult = hooks[idx].invokeHook(); + if (isPromise(hookResult)) { + var remainingHooks = hooks.slice(idx + 1); + return TransitionHook.chain(remainingHooks, hookResult) + .then(doneCallback); + } + } + return doneCallback(); + }; + /** + * Run all TransitionHooks, ignoring their return value. + */ + TransitionHook.runAllHooks = function (hooks) { + hooks.forEach(function (hook) { return hook.invokeHook(); }); + }; TransitionHook.prototype.logError = function (err) { this.transition.router.stateService.defaultErrorHandler()(err); }; @@ -1631,7 +1696,7 @@ var TransitionHook = /** @class */ (function () { // Hook returned false if (result === false) { // Abort this Transition - return Rejection.aborted("Hook aborted transition").toPromise(); + return Rejection.aborted('Hook aborted transition').toPromise(); } var isTargetState = is(TargetState); // hook returned a TargetState @@ -1662,62 +1727,9 @@ var TransitionHook = /** @class */ (function () { }; TransitionHook.prototype.toString = function () { var _a = this, options = _a.options, registeredHook = _a.registeredHook; - var event = parse("traceData.hookType")(options) || "internal", context = parse("traceData.context.state.name")(options) || parse("traceData.context")(options) || "unknown", name = fnToString(registeredHook.callback); + var event = parse('traceData.hookType')(options) || 'internal', context = parse('traceData.context.state.name')(options) || parse('traceData.context')(options) || 'unknown', name = fnToString(registeredHook.callback); return event + " context: " + context + ", " + maxLength(200, name); }; - /** - * Chains together an array of TransitionHooks. - * - * Given a list of [[TransitionHook]] objects, chains them together. - * Each hook is invoked after the previous one completes. - * - * #### Example: - * ```js - * var hooks: TransitionHook[] = getHooks(); - * let promise: Promise = TransitionHook.chain(hooks); - * - * promise.then(handleSuccess, handleError); - * ``` - * - * @param hooks the list of hooks to chain together - * @param waitFor if provided, the chain is `.then()`'ed off this promise - * @returns a `Promise` for sequentially invoking the hooks (in order) - */ - TransitionHook.chain = function (hooks, waitFor) { - // Chain the next hook off the previous - var createHookChainR = function (prev, nextHook) { - return prev.then(function () { return nextHook.invokeHook(); }); - }; - return hooks.reduce(createHookChainR, waitFor || services.$q.when()); - }; - /** - * Invokes all the provided TransitionHooks, in order. - * Each hook's return value is checked. - * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned. - * If no hook returns a promise, then all hooks are processed synchronously. - * - * @param hooks the list of TransitionHooks to invoke - * @param doneCallback a callback that is invoked after all the hooks have successfully completed - * - * @returns a promise for the async result, or the result of the callback - */ - TransitionHook.invokeHooks = function (hooks, doneCallback) { - for (var idx = 0; idx < hooks.length; idx++) { - var hookResult = hooks[idx].invokeHook(); - if (isPromise(hookResult)) { - var remainingHooks = hooks.slice(idx + 1); - return TransitionHook.chain(remainingHooks, hookResult) - .then(doneCallback); - } - } - return doneCallback(); - }; - /** - * Run all TransitionHooks, ignoring their return value. - */ - TransitionHook.runAllHooks = function (hooks) { - hooks.forEach(function (hook) { return hook.invokeHook(); }); - }; /** * These GetResultHandler(s) are used by [[invokeHook]] below * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]]) @@ -1951,7 +1963,7 @@ var HookBuilder = /** @class */ (function () { return []; var baseHookOptions = { transition: transition, - current: transition.options().current + current: transition.options().current, }; var makeTransitionHooks = function (hook) { // Fetch the Nodes that caused this hook to match. @@ -1962,7 +1974,7 @@ var HookBuilder = /** @class */ (function () { return matchingNodes.map(function (node) { var _options = extend({ bind: hook.bind, - traceData: { hookType: hookType.name, context: node } + traceData: { hookType: hookType.name, context: node }, }, baseHookOptions); var state = hookType.criteriaMatchPath.scope === exports.TransitionHookScope.STATE ? node.state.self : null; var transitionHook = new TransitionHook(transition, state, hook, _options); @@ -2065,7 +2077,7 @@ var ParamType = /** @class */ (function () { /** @inheritdoc */ ParamType.prototype.decode = function (val, key) { return val; }; /** @inheritdoc */ - ParamType.prototype.equals = function (a, b) { return a == b; }; + ParamType.prototype.equals = function (a, b) { return a == b; }; // tslint:disable-line:triple-equals ParamType.prototype.$subPattern = function () { var sub = this.pattern.toString(); return sub.substr(1, sub.length - 2); @@ -2090,7 +2102,7 @@ var ParamType = /** @class */ (function () { ParamType.prototype.$asArray = function (mode, isSearch) { if (!mode) return this; - if (mode === "auto" && !isSearch) + if (mode === 'auto' && !isSearch) throw new Error("'auto' array mode is for query parameters only"); return new ArrayType(this, mode); }; @@ -2110,7 +2122,7 @@ function ArrayType(type, mode) { function arrayUnwrap(val) { switch (val.length) { case 0: return undefined; - case 1: return mode === "auto" ? val[0] : val; + case 1: return mode === 'auto' ? val[0] : val; default: return val; } } @@ -2148,7 +2160,7 @@ function ArrayType(type, mode) { pattern: type.pattern, inherit: type.inherit, is: arrayHandler(type.is.bind(type), true), - $arrayMode: mode + $arrayMode: mode, }); } @@ -2156,9 +2168,11 @@ function ArrayType(type, mode) { * @coreapi * @module params */ /** for typedoc */ -/** @hidden */ var hasOwn = Object.prototype.hasOwnProperty; -/** @hidden */ var isShorthand = function (cfg) { - return ["value", "type", "squash", "array", "dynamic"].filter(hasOwn.bind(cfg || {})).length === 0; +/** @hidden */ +var hasOwn = Object.prototype.hasOwnProperty; +/** @hidden */ +var isShorthand = function (cfg) { + return ['value', 'type', 'squash', 'array', 'dynamic'].filter(hasOwn.bind(cfg || {})).length === 0; }; /** @internalapi */ @@ -2187,9 +2201,9 @@ function getType(cfg, urlType, location, id, paramTypes) { if (urlType) return urlType; if (!cfg.type) { - var type = location === exports.DefType.CONFIG ? "any" : - location === exports.DefType.PATH ? "path" : - location === exports.DefType.SEARCH ? "query" : "string"; + var type = location === exports.DefType.CONFIG ? 'any' : + location === exports.DefType.PATH ? 'path' : + location === exports.DefType.SEARCH ? 'query' : 'string'; return paramTypes.type(type); } return cfg.type instanceof ParamType ? cfg.type : paramTypes.type(cfg.type); @@ -2210,14 +2224,14 @@ function getSquashPolicy(config, isOptional, defaultPolicy) { } /** @internalapi */ function getReplace(config, arrayMode, isOptional, squash) { - var replace, configuredKeys, defaultPolicy = [ - { from: "", to: (isOptional || arrayMode ? undefined : "") }, - { from: null, to: (isOptional || arrayMode ? undefined : "") }, + var defaultPolicy = [ + { from: '', to: (isOptional || arrayMode ? undefined : '') }, + { from: null, to: (isOptional || arrayMode ? undefined : '') }, ]; - replace = isArray(config.replace) ? config.replace : []; + var replace = isArray(config.replace) ? config.replace : []; if (isString(squash)) replace.push({ from: squash, to: undefined }); - configuredKeys = map(replace, prop("from")); + var configuredKeys = map(replace, prop('from')); return filter(defaultPolicy, function (item) { return configuredKeys.indexOf(item.from) === -1; }).concat(replace); } /** @internalapi */ @@ -2235,66 +2249,12 @@ var Param = /** @class */ (function () { var inherit$$1 = isDefined(config.inherit) ? !!config.inherit : !!type.inherit; // array config: param name (param[]) overrides default settings. explicit config overrides param name. function getArrayMode() { - var arrayDefaults = { array: (location === exports.DefType.SEARCH ? "auto" : false) }; + var arrayDefaults = { array: (location === exports.DefType.SEARCH ? 'auto' : false) }; var arrayParamNomenclature = id.match(/\[\]$/) ? { array: true } : {}; return extend(arrayDefaults, arrayParamNomenclature, config).array; } extend(this, { id: id, type: type, location: location, isOptional: isOptional, dynamic: dynamic, raw: raw, squash: squash, replace: replace, inherit: inherit$$1, array: arrayMode, config: config }); } - Param.prototype.isDefaultValue = function (value) { - return this.isOptional && this.type.equals(this.value(), value); - }; - /** - * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the - * default value, which may be the result of an injectable function. - */ - Param.prototype.value = function (value) { - var _this = this; - /** - * [Internal] Get the default value of a parameter, which may be an injectable function. - */ - var getDefaultValue = function () { - if (_this._defaultValueCache) - return _this._defaultValueCache.defaultValue; - if (!services.$injector) - throw new Error("Injectable functions cannot be called at configuration time"); - var defaultValue = services.$injector.invoke(_this.config.$$fn); - if (defaultValue !== null && defaultValue !== undefined && !_this.type.is(defaultValue)) - throw new Error("Default value (" + defaultValue + ") for parameter '" + _this.id + "' is not an instance of ParamType (" + _this.type.name + ")"); - if (_this.config.$$fn['__cacheable']) { - _this._defaultValueCache = { defaultValue: defaultValue }; - } - return defaultValue; - }; - var replaceSpecialValues = function (val$$1) { - for (var _i = 0, _a = _this.replace; _i < _a.length; _i++) { - var tuple = _a[_i]; - if (tuple.from === val$$1) - return tuple.to; - } - return val$$1; - }; - value = replaceSpecialValues(value); - return isUndefined(value) ? getDefaultValue() : this.type.$normalize(value); - }; - Param.prototype.isSearch = function () { - return this.location === exports.DefType.SEARCH; - }; - Param.prototype.validates = function (value) { - // There was no parameter value, but the param is optional - if ((isUndefined(value) || value === null) && this.isOptional) - return true; - // The value was not of the correct ParamType, and could not be decoded to the correct ParamType - var normalized = this.type.$normalize(value); - if (!this.type.is(normalized)) - return false; - // The value was of the correct type, but when encoded, did not match the ParamType's regexp - var encoded = this.type.encode(normalized); - return !(isString(encoded) && !this.type.pattern.exec(encoded)); - }; - Param.prototype.toString = function () { - return "{Param:" + this.id + " " + this.type + " squash: '" + this.squash + "' optional: " + this.isOptional + "}"; - }; Param.values = function (params, values$$1) { if (values$$1 === void 0) { values$$1 = {}; } var paramValues = {}; @@ -2339,6 +2299,60 @@ var Param = /** @class */ (function () { if (values$$1 === void 0) { values$$1 = {}; } return params.map(function (param) { return param.validates(values$$1[param.id]); }).reduce(allTrueR, true); }; + Param.prototype.isDefaultValue = function (value) { + return this.isOptional && this.type.equals(this.value(), value); + }; + /** + * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the + * default value, which may be the result of an injectable function. + */ + Param.prototype.value = function (value) { + var _this = this; + /** + * [Internal] Get the default value of a parameter, which may be an injectable function. + */ + var getDefaultValue = function () { + if (_this._defaultValueCache) + return _this._defaultValueCache.defaultValue; + if (!services.$injector) + throw new Error('Injectable functions cannot be called at configuration time'); + var defaultValue = services.$injector.invoke(_this.config.$$fn); + if (defaultValue !== null && defaultValue !== undefined && !_this.type.is(defaultValue)) + throw new Error("Default value (" + defaultValue + ") for parameter '" + _this.id + "' is not an instance of ParamType (" + _this.type.name + ")"); + if (_this.config.$$fn['__cacheable']) { + _this._defaultValueCache = { defaultValue: defaultValue }; + } + return defaultValue; + }; + var replaceSpecialValues = function (val$$1) { + for (var _i = 0, _a = _this.replace; _i < _a.length; _i++) { + var tuple = _a[_i]; + if (tuple.from === val$$1) + return tuple.to; + } + return val$$1; + }; + value = replaceSpecialValues(value); + return isUndefined(value) ? getDefaultValue() : this.type.$normalize(value); + }; + Param.prototype.isSearch = function () { + return this.location === exports.DefType.SEARCH; + }; + Param.prototype.validates = function (value) { + // There was no parameter value, but the param is optional + if ((isUndefined(value) || value === null) && this.isOptional) + return true; + // The value was not of the correct ParamType, and could not be decoded to the correct ParamType + var normalized = this.type.$normalize(value); + if (!this.type.is(normalized)) + return false; + // The value was of the correct type, but when encoded, did not match the ParamType's regexp + var encoded = this.type.encode(normalized); + return !(isString(encoded) && !this.type.pattern.exec(encoded)); + }; + Param.prototype.toString = function () { + return "{Param:" + this.id + " " + this.type + " squash: '" + this.squash + "' optional: " + this.isOptional + "}"; + }; return Param; }()); @@ -2370,6 +2384,10 @@ var PathNode = /** @class */ (function () { this.resolvables = state.resolvables.map(function (res) { return res.clone(); }); } } + /** Returns a clone of the PathNode */ + PathNode.clone = function (node) { + return new PathNode(node); + }; /** Sets [[paramValues]] for the node, from the values of an object hash */ PathNode.prototype.applyRawParams = function (params) { var getParamVal = function (paramDef) { return [paramDef.id, paramDef.value(params[paramDef.id])]; }; @@ -2378,7 +2396,7 @@ var PathNode = /** @class */ (function () { }; /** Gets a specific [[Param]] metadata that belongs to the node */ PathNode.prototype.parameter = function (name) { - return find(this.paramSchema, propEq("id", name)); + return find(this.paramSchema, propEq('id', name)); }; /** * @returns true if the state and parameter values for another PathNode are @@ -2406,10 +2424,6 @@ var PathNode = /** @class */ (function () { var params = paramsFn ? paramsFn(this) : this.paramSchema; return Param.changed(params, this.paramValues, node.paramValues); }; - /** Returns a clone of the PathNode */ - PathNode.clone = function (node) { - return new PathNode(node); - }; return PathNode; }()); @@ -2423,7 +2437,7 @@ var PathUtils = /** @class */ (function () { /** Given a PathNode[], create an TargetState */ PathUtils.makeTargetState = function (registry, path) { var state = tail(path).state; - return new TargetState(registry, state, path.map(prop("paramValues")).reduce(mergeR, {}), {}); + return new TargetState(registry, state, path.map(prop('paramValues')).reduce(mergeR, {}), {}); }; PathUtils.buildPath = function (targetState) { var toParams = targetState.params(); @@ -2494,7 +2508,8 @@ var PathUtils = /** @class */ (function () { * Computes the tree changes (entering, exiting) between a fromPath and toPath. */ PathUtils.treeChanges = function (fromPath, toPath, reloadState) { - var keep = 0, max = Math.min(fromPath.length, toPath.length); + var max = Math.min(fromPath.length, toPath.length); + var keep = 0; var nodesMatch = function (node1, node2) { return node1.equals(node2, PathUtils.nonDynamicParams); }; @@ -2509,12 +2524,10 @@ var PathUtils = /** @class */ (function () { } var from, retained, exiting, entering, to; from = fromPath; - retained = from.slice(0, keep); + retained = from.slice(0, keep).map(applyToParams); // applyToParams to update dynamic params exiting = from.slice(keep); - // Create a new retained path (with shallow copies of nodes) which have the params of the toPath mapped - var retainedWithToParams = retained.map(applyToParams); entering = toPath.slice(keep); - to = (retainedWithToParams).concat(entering); + to = (retained).concat(entering); return { from: from, to: to, retained: retained, exiting: exiting, entering: entering }; }; /** @@ -2585,8 +2598,8 @@ var PathUtils = /** @class */ (function () { */ /** for typedoc */ // TODO: explicitly make this user configurable var defaultResolvePolicy = { - when: "LAZY", - async: "WAIT" + when: 'LAZY', + async: 'WAIT', }; /** * The basic building block for the resolve system. @@ -2609,9 +2622,9 @@ var Resolvable = /** @class */ (function () { } else if (isFunction(resolveFn)) { if (isNullOrUndefined(arg1)) - throw new Error("new Resolvable(): token argument is required"); + throw new Error('new Resolvable(): token argument is required'); if (!isFunction(resolveFn)) - throw new Error("new Resolvable(): resolveFn argument must be a function"); + throw new Error('new Resolvable(): resolveFn argument must be a function'); this.token = arg1; this.policy = policy; this.resolveFn = resolveFn; @@ -2668,7 +2681,7 @@ var Resolvable = /** @class */ (function () { // If the resolve policy is RXWAIT, wait for the observable to emit something. otherwise pass through. var node = resolveContext.findNode(this); var state = node && node.state; - var maybeWaitForRx = this.getPolicy(state).async === "RXWAIT" ? waitForRx : identity; + var maybeWaitForRx = this.getPolicy(state).async === 'RXWAIT' ? waitForRx : identity; // After the final value has been resolved, update the state of the Resolvable var applyResolvedValue = function (resolvedValue) { _this.data = resolvedValue; @@ -2707,14 +2720,14 @@ var Resolvable = /** @class */ (function () { /** @internalapi */ var resolvePolicies = { when: { - LAZY: "LAZY", - EAGER: "EAGER" + LAZY: 'LAZY', + EAGER: 'EAGER', }, async: { - WAIT: "WAIT", - NOWAIT: "NOWAIT", - RXWAIT: "RXWAIT" - } + WAIT: 'WAIT', + NOWAIT: 'NOWAIT', + RXWAIT: 'RXWAIT', + }, }; /** @module resolve */ @@ -2722,7 +2735,8 @@ var resolvePolicies = { var whens = resolvePolicies.when; var ALL_WHENS = [whens.EAGER, whens.LAZY]; var EAGER_WHENS = [whens.EAGER]; -var NATIVE_INJECTOR_TOKEN = "Native Injector"; +// tslint:disable-next-line:no-inferrable-types +var NATIVE_INJECTOR_TOKEN = 'Native Injector'; /** * Encapsulates Dependency Injection for a path of nodes * @@ -2813,9 +2827,9 @@ var ResolveContext = /** @class */ (function () { */ ResolveContext.prototype.resolvePath = function (when, trans) { var _this = this; - if (when === void 0) { when = "LAZY"; } + if (when === void 0) { when = 'LAZY'; } // This option determines which 'when' policy Resolvables we are about to fetch. - var whenOption = inArray(ALL_WHENS, when) ? when : "LAZY"; + var whenOption = inArray(ALL_WHENS, when) ? when : 'LAZY'; // If the caller specified EAGER, only the EAGER Resolvables are fetched. // if the caller specified LAZY, both EAGER and LAZY Resolvables are fetched.` var matchedWhens = whenOption === resolvePolicies.when.EAGER ? EAGER_WHENS : ALL_WHENS; @@ -2860,7 +2874,7 @@ var ResolveContext = /** @class */ (function () { // subpath stopping at resolvable's node, or the whole path (if the resolvable isn't in the path) var subPath = PathUtils.subPath(this._path, function (x) { return x === node; }) || this._path; var availableResolvables = subPath - .reduce(function (acc, _node) { return acc.concat(_node.resolvables); }, []) //all of subpath's resolvables + .reduce(function (acc, _node) { return acc.concat(_node.resolvables); }, []) // all of subpath's resolvables .filter(function (res) { return res !== resolvable; }); // filter out the `resolvable` argument var getDependency = function (token) { var matching = availableResolvables.filter(function (r) { return r.token === token; }); @@ -2868,7 +2882,7 @@ var ResolveContext = /** @class */ (function () { return tail(matching); var fromInjector = _this.injector().getNative(token); if (isUndefined(fromInjector)) { - throw new Error("Could not find Dependency Injection token: " + stringify(token)); + throw new Error('Could not find Dependency Injection token: ' + stringify(token)); } return new Resolvable(token, function () { return fromInjector; }, [], fromInjector); }; @@ -2888,7 +2902,7 @@ var UIInjectorImpl = /** @class */ (function () { return resolvable.get(this.context); } if (!resolvable.resolved) { - throw new Error("Resolvable async .get() not complete:" + stringify(resolvable.token)); + throw new Error('Resolvable async .get() not complete:' + stringify(resolvable.token)); } return resolvable.data; } @@ -2912,7 +2926,7 @@ var UIInjectorImpl = /** @class */ (function () { */ /** for typedoc */ /** @hidden */ -var stateSelf = prop("self"); +var stateSelf = prop('self'); /** * Represents a transition between two states. * @@ -3061,8 +3075,8 @@ var Transition = /** @class */ (function () { (compare.from && !matchState(this.$from(), compare.from))); }; Transition.prototype.params = function (pathname) { - if (pathname === void 0) { pathname = "to"; } - return Object.freeze(this._treeChanges[pathname].map(prop("paramValues")).reduce(mergeR, {})); + if (pathname === void 0) { pathname = 'to'; } + return Object.freeze(this._treeChanges[pathname].map(prop('paramValues')).reduce(mergeR, {})); }; /** * Creates a [[UIInjector]] Dependency Injector @@ -3120,7 +3134,7 @@ var Transition = /** @class */ (function () { * @returns a [[UIInjector]] */ Transition.prototype.injector = function (state, pathName) { - if (pathName === void 0) { pathName = "to"; } + if (pathName === void 0) { pathName = 'to'; } var path = this._treeChanges[pathName]; if (state) path = PathUtils.subPath(path, function (node) { return node.state === state || node.state.name === state; }); @@ -3159,7 +3173,7 @@ var Transition = /** @class */ (function () { * @returns an array of resolve tokens (keys) */ Transition.prototype.getResolveTokens = function (pathname) { - if (pathname === void 0) { pathname = "to"; } + if (pathname === void 0) { pathname = 'to'; } return new ResolveContext(this._treeChanges[pathname]).getTokens(); }; /** @@ -3192,9 +3206,9 @@ var Transition = /** @class */ (function () { * @param state the state in the "to path" which should receive the new resolve (otherwise, the root state) */ Transition.prototype.addResolvable = function (resolvable, state) { - if (state === void 0) { state = ""; } + if (state === void 0) { state = ''; } resolvable = is(Resolvable)(resolvable) ? resolvable : new Resolvable(resolvable); - var stateName = (typeof state === "string") ? state : state.name; + var stateName = (typeof state === 'string') ? state : state.name; var topath = this._treeChanges.to; var targetNode = find(topath, function (node) { return node.state.name === stateName; }); var resolveContext = new ResolveContext(topath); @@ -3296,10 +3310,10 @@ var Transition = /** @class */ (function () { * @returns a list of ViewConfig objects for the given path. */ Transition.prototype.views = function (pathname, state) { - if (pathname === void 0) { pathname = "entering"; } + if (pathname === void 0) { pathname = 'entering'; } var path = this._treeChanges[pathname]; path = !state ? path : path.filter(propEq('state', state)); - return path.map(prop("views")).filter(identity).reduce(unnestR, []); + return path.map(prop('views')).filter(identity).reduce(unnestR, []); }; Transition.prototype.treeChanges = function (pathname) { return pathname ? this._treeChanges[pathname] : this._treeChanges; @@ -3316,11 +3330,12 @@ var Transition = /** @class */ (function () { */ Transition.prototype.redirect = function (targetState) { var redirects = 1, trans = this; + // tslint:disable-next-line:no-conditional-assignment while ((trans = trans.redirectedFrom()) != null) { if (++redirects > 20) throw new Error("Too many consecutive Transition redirects (20+)"); } - var redirectOpts = { redirectedFrom: this, source: "redirect" }; + var redirectOpts = { redirectedFrom: this, source: 'redirect' }; // If the original transition was caused by URL sync, then use { location: 'replace' } // on the new transition (unless the target state explicitly specifies location: false). // This causes the original url to be replaced with the url for the redirect target @@ -3416,9 +3431,9 @@ var Transition = /** @class */ (function () { var newTC = this.treeChanges(); var pendTC = pending && pending.treeChanges(); if (pendTC && same(pendTC.to, newTC.to) && same(pendTC.exiting, newTC.exiting)) - return "SameAsPending"; + return 'SameAsPending'; if (newTC.exiting.length === 0 && newTC.entering.length === 0 && same(newTC.from, newTC.to)) - return "SameAsCurrent"; + return 'SameAsCurrent'; }; /** * Runs the transition @@ -3520,10 +3535,10 @@ var Transition = /** @class */ (function () { var fromStateOrName = this.from(); var toStateOrName = this.to(); var avoidEmptyHash = function (params) { - return (params["#"] !== null && params["#"] !== undefined) ? params : omit(params, ["#"]); + return (params['#'] !== null && params['#'] !== undefined) ? params : omit(params, ['#']); }; // (X) means the to state is invalid. - var id = this.$id, from = isObject(fromStateOrName) ? fromStateOrName.name : fromStateOrName, fromParams = stringify(avoidEmptyHash(this._treeChanges.from.map(prop('paramValues')).reduce(mergeR, {}))), toValid = this.valid() ? "" : "(X) ", to = isObject(toStateOrName) ? toStateOrName.name : toStateOrName, toParams = stringify(avoidEmptyHash(this.params())); + var id = this.$id, from = isObject(fromStateOrName) ? fromStateOrName.name : fromStateOrName, fromParams = stringify(avoidEmptyHash(this._treeChanges.from.map(prop('paramValues')).reduce(mergeR, {}))), toValid = this.valid() ? '' : '(X) ', to = isObject(toStateOrName) ? toStateOrName.name : toStateOrName, toParams = stringify(avoidEmptyHash(this.params())); return "Transition#" + id + "( '" + from + "'" + fromParams + " -> " + toValid + "'" + to + "'" + toParams + " )"; }; /** @hidden */ @@ -3550,7 +3565,7 @@ var Transition = /** @class */ (function () { function maxLength(max, str) { if (str.length <= max) return str; - return str.substr(0, max - 3) + "..."; + return str.substr(0, max - 3) + '...'; } /** * Returns a string, with spaces added to the end, up to a desired str length @@ -3563,19 +3578,19 @@ function maxLength(max, str) { */ function padString(length, str) { while (str.length < length) - str += " "; + str += ' '; return str; } function kebobString(camelCase) { return camelCase .replace(/^([A-Z])/, function ($1) { return $1.toLowerCase(); }) // replace first char - .replace(/([A-Z])/g, function ($1) { return "-" + $1.toLowerCase(); }); // replace rest + .replace(/([A-Z])/g, function ($1) { return '-' + $1.toLowerCase(); }); // replace rest } function functionToString(fn) { var fnStr = fnToString(fn); var namedFunctionMatch = fnStr.match(/^(function [^ ]+\([^)]*\))/); var toStr = namedFunctionMatch ? namedFunctionMatch[1] : fnStr; - var fnName = fn['name'] || ""; + var fnName = fn['name'] || ''; if (fnName && toStr.match(/function \(/)) { return 'function ' + fnName + toStr.substr(9); } @@ -3583,51 +3598,51 @@ function functionToString(fn) { } function fnToString(fn) { var _fn = isArray(fn) ? fn.slice(-1)[0] : fn; - return _fn && _fn.toString() || "undefined"; + return _fn && _fn.toString() || 'undefined'; } var stringifyPatternFn = null; var stringifyPattern = function (value) { var isRejection = Rejection.isRejectionPromise; stringifyPatternFn = stringifyPatternFn || pattern([ - [not(isDefined), val("undefined")], - [isNull, val("null")], - [isPromise, val("[Promise]")], + [not(isDefined), val('undefined')], + [isNull, val('null')], + [isPromise, val('[Promise]')], [isRejection, function (x) { return x._transitionRejection.toString(); }], - [is(Rejection), invoke("toString")], - [is(Transition), invoke("toString")], - [is(Resolvable), invoke("toString")], + [is(Rejection), invoke('toString')], + [is(Transition), invoke('toString')], + [is(Resolvable), invoke('toString')], [isInjectable, functionToString], - [val(true), identity] + [val(true), identity], ]); return stringifyPatternFn(value); }; function stringify(o) { var seen = []; - function format(val$$1) { - if (isObject(val$$1)) { - if (seen.indexOf(val$$1) !== -1) + function format(value) { + if (isObject(value)) { + if (seen.indexOf(value) !== -1) return '[circular ref]'; - seen.push(val$$1); + seen.push(value); } - return stringifyPattern(val$$1); + return stringifyPattern(value); } - return JSON.stringify(o, function (key, val$$1) { return format(val$$1); }).replace(/\\"/g, '"'); + return JSON.stringify(o, function (key, value) { return format(value); }).replace(/\\"/g, '"'); } /** Returns a function that splits a string on a character or substring */ var beforeAfterSubstr = function (char) { return function (str) { if (!str) - return ["", ""]; + return ['', '']; var idx = str.indexOf(char); if (idx === -1) - return [str, ""]; + return [str, '']; return [str.substr(0, idx), str.substr(idx + 1)]; }; }; var hostRegex = new RegExp('^(?:[a-z]+:)?//[^/]+/'); var stripLastPathElement = function (str) { return str.replace(/\/[^/]*$/, ''); }; -var splitHash = beforeAfterSubstr("#"); -var splitQuery = beforeAfterSubstr("?"); -var splitEqual = beforeAfterSubstr("="); -var trimHashVal = function (str) { return str ? str.replace(/^#/, "") : ""; }; +var splitHash = beforeAfterSubstr('#'); +var splitQuery = beforeAfterSubstr('?'); +var splitEqual = beforeAfterSubstr('='); +var trimHashVal = function (str) { return str ? str.replace(/^#/, '') : ''; }; /** * Splits on a delimiter, but returns the delimiters in the array * @@ -3639,12 +3654,11 @@ var trimHashVal = function (str) { return str ? str.replace(/^#/, "") : ""; }; * ``` */ function splitOnDelim(delim) { - var re = new RegExp("(" + delim + ")", "g"); + var re = new RegExp('(' + delim + ')', 'g'); return function (str) { return str.split(re).filter(identity); }; } - /** * Reduce fn that joins neighboring strings * @@ -3695,7 +3709,7 @@ var ParamTypes = /** @class */ (function () { /** @hidden */ this.typeQueue = []; /** @internalapi */ - this.defaultTypes = pick(ParamTypes.prototype, ["hash", "string", "query", "path", "int", "bool", "date", "json", "any"]); + this.defaultTypes = pick(ParamTypes.prototype, ['hash', 'string', 'query', 'path', 'int', 'bool', 'date', 'json', 'any']); // Register default types. Store them in the prototype of this.types. var makeType = function (definition, name) { return new ParamType(extend({ name: name }, definition)); @@ -3746,6 +3760,7 @@ function initDefaultTypes() { decode: valToString, is: is(String), pattern: /.*/, + // tslint:disable-next-line:triple-equals equals: function (a, b) { return a == b; }, }; return extend({}, defaultTypeBase, def); @@ -3779,7 +3794,7 @@ function initDefaultTypes() { val$$1.getFullYear(), ('0' + (val$$1.getMonth() + 1)).slice(-2), ('0' + val$$1.getDate()).slice(-2), - ].join("-"); + ].join('-'); }, decode: function (val$$1) { if (this.is(val$$1)) @@ -3833,7 +3848,8 @@ var StateParams = /** @class */ (function () { * @param {Object} $to Internal definition of object representing state to transition to. */ StateParams.prototype.$inherit = function (newParams, $current, $to) { - var parents = ancestors($current, $to), parentParams, inherited = {}, inheritList = []; + var parentParams; + var parents = ancestors($current, $to), inherited = {}, inheritList = []; for (var i in parents) { if (!parents[i] || !parents[i].params) continue; @@ -3849,7 +3865,6 @@ var StateParams = /** @class */ (function () { } return extend({}, inherited, newParams); }; - return StateParams; }()); @@ -3883,7 +3898,7 @@ var getUrlBuilder = function ($urlMatcherFactoryProvider, root$$1) { // For future states, i.e., states whose name ends with `.**`, // match anything that starts with the url prefix if (stateDec && stateDec.url && stateDec.name && stateDec.name.match(/\.\*\*$/)) { - stateDec.url += "{remainder:any}"; // match any path (.*) + stateDec.url += '{remainder:any}'; // match any path (.*) } var parsed = parseUrl(stateDec.url), parent = state.parent; var url = !parsed ? stateDec.url : $urlMatcherFactoryProvider.compile(parsed.val, { @@ -3892,7 +3907,7 @@ var getUrlBuilder = function ($urlMatcherFactoryProvider, root$$1) { if (stateDec.reloadOnSearch === false && isSearch) paramConfig = extend(paramConfig || {}, { dynamic: true }); return paramConfig; - } + }, }); if (!url) return null; @@ -3974,7 +3989,7 @@ function resolvablesBuilder(state) { // ng1 doesn't have an $injector until runtime. // If the $injector doesn't exist, use "deferred" literal as a // marker indicating they should be annotated when runtime starts - return fn['$inject'] || ($injector && $injector.annotate(fn, $injector.strictDi)) || "deferred"; + return fn['$inject'] || ($injector && $injector.annotate(fn, $injector.strictDi)) || 'deferred'; }; /** true if the object has both `token` and `resolveFn`, and is probably a [[ResolveLiteral]] */ var isResolveLiteral = function (obj) { return !!(obj.token && obj.resolveFn); }; @@ -3983,26 +3998,26 @@ function resolvablesBuilder(state) { /** true if the object looks like a tuple from obj2Tuples */ var isTupleFromObj = function (obj) { return !!(obj && obj.val && (isString(obj.val) || isArray(obj.val) || isFunction(obj.val))); }; /** extracts the token from a Provider or provide literal */ - var token = function (p) { return p.provide || p.token; }; + var getToken = function (p) { return p.provide || p.token; }; /** Given a literal resolve or provider object, returns a Resolvable */ var literal2Resolvable = pattern([ - [prop('resolveFn'), function (p) { return new Resolvable(token(p), p.resolveFn, p.deps, p.policy); }], - [prop('useFactory'), function (p) { return new Resolvable(token(p), p.useFactory, (p.deps || p.dependencies), p.policy); }], - [prop('useClass'), function (p) { return new Resolvable(token(p), function () { return new p.useClass(); }, [], p.policy); }], - [prop('useValue'), function (p) { return new Resolvable(token(p), function () { return p.useValue; }, [], p.policy, p.useValue); }], - [prop('useExisting'), function (p) { return new Resolvable(token(p), identity, [p.useExisting], p.policy); }], + [prop('resolveFn'), function (p) { return new Resolvable(getToken(p), p.resolveFn, p.deps, p.policy); }], + [prop('useFactory'), function (p) { return new Resolvable(getToken(p), p.useFactory, (p.deps || p.dependencies), p.policy); }], + [prop('useClass'), function (p) { return new Resolvable(getToken(p), function () { return new p.useClass(); }, [], p.policy); }], + [prop('useValue'), function (p) { return new Resolvable(getToken(p), function () { return p.useValue; }, [], p.policy, p.useValue); }], + [prop('useExisting'), function (p) { return new Resolvable(getToken(p), identity, [p.useExisting], p.policy); }], ]); var tuple2Resolvable = pattern([ - [pipe(prop("val"), isString), function (tuple) { return new Resolvable(tuple.token, identity, [tuple.val], tuple.policy); }], - [pipe(prop("val"), isArray), function (tuple) { return new Resolvable(tuple.token, tail(tuple.val), tuple.val.slice(0, -1), tuple.policy); }], - [pipe(prop("val"), isFunction), function (tuple) { return new Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy); }], + [pipe(prop('val'), isString), function (tuple) { return new Resolvable(tuple.token, identity, [tuple.val], tuple.policy); }], + [pipe(prop('val'), isArray), function (tuple) { return new Resolvable(tuple.token, tail(tuple.val), tuple.val.slice(0, -1), tuple.policy); }], + [pipe(prop('val'), isFunction), function (tuple) { return new Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy); }], ]); var item2Resolvable = pattern([ [is(Resolvable), function (r) { return r; }], [isResolveLiteral, literal2Resolvable], [isLikeNg2Provider, literal2Resolvable], [isTupleFromObj, tuple2Resolvable], - [val(true), function (obj) { throw new Error("Invalid resolve value: " + stringify(obj)); }] + [val(true), function (obj) { throw new Error('Invalid resolve value: ' + stringify(obj)); }], ]); // If resolveBlock is already an array, use it as-is. // Otherwise, assume it's an object and convert to an Array of tuples @@ -4026,8 +4041,8 @@ var StateBuilder = /** @class */ (function () { function StateBuilder(matcher, urlMatcherFactory) { this.matcher = matcher; var self = this; - var root$$1 = function () { return matcher.find(""); }; - var isRoot = function (state) { return state.name === ""; }; + var root$$1 = function () { return matcher.find(''); }; + var isRoot = function (state) { return state.name === ''; }; function parentBuilder(state) { if (isRoot(state)) return null; @@ -4050,7 +4065,7 @@ var StateBuilder = /** @class */ (function () { path: [pathBuilder], // Speed up $state.includes() as it's used a lot includes: [includesBuilder], - resolvables: [resolvablesBuilder] + resolvables: [resolvablesBuilder], }; } /** @@ -4098,7 +4113,7 @@ var StateBuilder = /** @class */ (function () { }; StateBuilder.prototype.parentName = function (state) { // name = 'foo.bar.baz.**' - var name = state.name || ""; + var name = state.name || ''; // segments = ['foo', 'bar', 'baz', '.**'] var segments = name.split('.'); // segments = ['foo', 'bar', 'baz'] @@ -4111,10 +4126,10 @@ var StateBuilder = /** @class */ (function () { throw new Error("States that specify the 'parent:' property should not have a '.' in their name (" + name + ")"); } // 'foo.bar' - return segments.join("."); + return segments.join('.'); } if (!state.parent) - return ""; + return ''; return isString(state.parent) ? state.parent : state.parent.name; }; StateBuilder.prototype.name = function (state) { @@ -4122,7 +4137,7 @@ var StateBuilder = /** @class */ (function () { if (name.indexOf('.') !== -1 || !state.parent) return name; var parentName = isString(state.parent) ? state.parent : state.parent.name; - return parentName ? parentName + "." + name : name; + return parentName ? parentName + '.' + name : name; }; return StateBuilder; }()); @@ -4133,12 +4148,12 @@ var StateMatcher = /** @class */ (function () { this._states = _states; } StateMatcher.prototype.isRelative = function (stateName) { - stateName = stateName || ""; - return stateName.indexOf(".") === 0 || stateName.indexOf("^") === 0; + stateName = stateName || ''; + return stateName.indexOf('.') === 0 || stateName.indexOf('^') === 0; }; StateMatcher.prototype.find = function (stateOrName, base, matchGlob) { if (matchGlob === void 0) { matchGlob = true; } - if (!stateOrName && stateOrName !== "") + if (!stateOrName && stateOrName !== '') return undefined; var isStr = isString(stateOrName); var name = isStr ? stateOrName : stateOrName.name; @@ -4150,11 +4165,12 @@ var StateMatcher = /** @class */ (function () { } else if (isStr && matchGlob) { var _states = values(this._states); - var matches = _states.filter(function (state) { - return state.__stateObjectCache.nameGlob && - state.__stateObjectCache.nameGlob.matches(name); + var matches = _states.filter(function (_state) { + return _state.__stateObjectCache.nameGlob && + _state.__stateObjectCache.nameGlob.matches(name); }); if (matches.length > 1) { + // tslint:disable-next-line:no-console console.log("stateMatcher.find: Found multiple matches for " + name + " using glob: ", matches.map(function (match) { return match.name; })); } return matches[0]; @@ -4165,13 +4181,15 @@ var StateMatcher = /** @class */ (function () { if (!base) throw new Error("No reference point given for path '" + name + "'"); var baseState = this.find(base); - var splitName = name.split("."), i = 0, pathLength = splitName.length, current = baseState; + var splitName = name.split('.'); + var pathLength = splitName.length; + var i = 0, current = baseState; for (; i < pathLength; i++) { - if (splitName[i] === "" && i === 0) { + if (splitName[i] === '' && i === 0) { current = baseState; continue; } - if (splitName[i] === "^") { + if (splitName[i] === '^') { if (!current.parent) throw new Error("Path '" + name + "' not valid for state '" + baseState.name + "'"); current = current.parent; @@ -4179,8 +4197,8 @@ var StateMatcher = /** @class */ (function () { } break; } - var relName = splitName.slice(i).join("."); - return current.name + (current.name && relName ? "." : "") + relName; + var relName = splitName.slice(i).join('.'); + return current.name + (current.name && relName ? '.' : '') + relName; }; return StateMatcher; }()); @@ -4206,7 +4224,7 @@ var StateQueueManager = /** @class */ (function () { var state = StateObject.create(stateDecl); var name = state.name; if (!isString(name)) - throw new Error("State must have a valid name"); + throw new Error('State must have a valid name'); if (this.states.hasOwnProperty(name) || inArray(queue.map(prop('name')), name)) throw new Error("State '" + name + "' is already defined"); queue.push(state); @@ -4232,7 +4250,7 @@ var StateQueueManager = /** @class */ (function () { if (existingState && existingState.name === name_1) { throw new Error("State '" + name_1 + "' is already defined"); } - var existingFutureState = getState(name_1 + ".**"); + var existingFutureState = getState(name_1 + '.**'); if (existingFutureState) { // Remove future state of the same name this.$registry.deregister(existingFutureState); @@ -4258,7 +4276,7 @@ var StateQueueManager = /** @class */ (function () { queue.push(state); } if (registered.length) { - this.listeners.forEach(function (listener) { return listener("registered", registered.map(function (s) { return s.self; })); }); + this.listeners.forEach(function (listener) { return listener('registered', registered.map(function (s) { return s.self; })); }); } return states; }; @@ -4292,9 +4310,9 @@ var StateRegistry = /** @class */ (function () { url: '^', views: null, params: { - '#': { value: null, type: 'hash', dynamic: true } + '#': { value: null, type: 'hash', dynamic: true }, }, - abstract: true + abstract: true, }; var _root = this._root = this.stateQueue.register(rootStateDef); _root.navigable = null; @@ -4374,17 +4392,17 @@ var StateRegistry = /** @class */ (function () { var _this = this; var all$$1 = this.get().map(function (s) { return s.$$state(); }); var getChildren = function (states) { - var children = all$$1.filter(function (s) { return states.indexOf(s.parent) !== -1; }); - return children.length === 0 ? children : children.concat(getChildren(children)); + var _children = all$$1.filter(function (s) { return states.indexOf(s.parent) !== -1; }); + return _children.length === 0 ? _children : _children.concat(getChildren(_children)); }; var children = getChildren([state]); var deregistered = [state].concat(children).reverse(); - deregistered.forEach(function (state) { + deregistered.forEach(function (_state) { var $ur = _this._router.urlRouter; // Remove URL rule - $ur.rules().filter(propEq("state", state)).forEach($ur.removeRule.bind($ur)); + $ur.rules().filter(propEq('state', _state)).forEach($ur.removeRule.bind($ur)); // Remove state from registry - delete _this.states[state.name]; + delete _this.states[_state.name]; }); return deregistered; }; @@ -4402,7 +4420,7 @@ var StateRegistry = /** @class */ (function () { if (!_state) throw new Error("Can't deregister state; not found: " + stateOrName); var deregisteredStates = this._deregisterTree(_state.$$state()); - this.listeners.forEach(function (listener) { return listener("deregistered", deregisteredStates.map(function (s) { return s.self; })); }); + this.listeners.forEach(function (listener) { return listener('deregistered', deregisteredStates.map(function (s) { return s.self; })); }); return deregisteredStates; }; StateRegistry.prototype.get = function (stateOrName, base) { @@ -4424,8 +4442,8 @@ var StateRegistry = /** @class */ (function () { */ /** for typedoc */ /** @hidden */ -function quoteRegExp(string, param) { - var surroundPattern = ['', ''], result = string.replace(/[\\\[\]\^$*+?.()|{}]/g, "\\$&"); +function quoteRegExp(str, param) { + var surroundPattern = ['', ''], result = str.replace(/[\\\[\]\^$*+?.()|{}]/g, '\\$&'); if (!param) return result; switch (param.squash) { @@ -4443,8 +4461,8 @@ function quoteRegExp(string, param) { return result + surroundPattern[0] + param.type.pattern.source + surroundPattern[1]; } /** @hidden */ -var memoizeTo = function (obj, prop$$1, fn) { - return obj[prop$$1] = obj[prop$$1] || fn(); +var memoizeTo = function (obj, _prop, fn) { + return obj[_prop] = obj[_prop] || fn(); }; /** @hidden */ var splitOnSlash = splitOnDelim('/'); @@ -4525,7 +4543,7 @@ var UrlMatcher = /** @class */ (function () { params: {}, strict: true, caseInsensitive: false, - paramMap: identity + paramMap: identity, }); // Find all placeholders and create a compiled pattern, using either classic or curly syntax: // '*' name @@ -4540,7 +4558,10 @@ var UrlMatcher = /** @class */ (function () { // [^{}\\]+ - anything other than curly braces or backslash // \\. - a backslash escape // \{(?:[^{}\\]+|\\.)*\} - a matched set of curly braces containing other atoms - var placeholder = /([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g, searchPlaceholder = /([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g, last = 0, m, patterns = []; + var placeholder = /([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g; + var searchPlaceholder = /([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g; + var patterns = []; + var last = 0, matchArray; var checkParamErrors = function (id) { if (!UrlMatcher.nameValidator.test(id)) throw new Error("Invalid parameter name '" + id + "' in pattern '" + pattern$$1 + "'"); @@ -4553,20 +4574,21 @@ var UrlMatcher = /** @class */ (function () { // IE[78] returns '' for unmatched groups instead of null var id = m[2] || m[3]; var regexp = isSearch ? m[4] : m[4] || (m[1] === '*' ? '[\\s\\S]*' : null); - var makeRegexpType = function (regexp) { return inherit(paramTypes.type(isSearch ? "query" : "path"), { - pattern: new RegExp(regexp, _this.config.caseInsensitive ? 'i' : undefined) + var makeRegexpType = function (str) { return inherit(paramTypes.type(isSearch ? 'query' : 'path'), { + pattern: new RegExp(str, _this.config.caseInsensitive ? 'i' : undefined), }); }; return { id: id, regexp: regexp, cfg: _this.config.params[id], segment: pattern$$1.substring(last, m.index), - type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp) + type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp), }; }; var p, segment; - while ((m = placeholder.exec(pattern$$1))) { - p = matchDetails(m, false); + // tslint:disable-next-line:no-conditional-assignment + while ((matchArray = placeholder.exec(pattern$$1))) { + p = matchDetails(matchArray, false); if (p.segment.indexOf('?') >= 0) break; // we're into the search part checkParamErrors(p.id); @@ -4583,8 +4605,9 @@ var UrlMatcher = /** @class */ (function () { segment = segment.substring(0, i); if (search.length > 0) { last = 0; - while ((m = searchPlaceholder.exec(search))) { - p = matchDetails(m, true); + // tslint:disable-next-line:no-conditional-assignment + while ((matchArray = searchPlaceholder.exec(search))) { + p = matchDetails(matchArray, true); checkParamErrors(p.id); this._params.push(paramFactory.fromSearch(p.id, p.type, this.config.paramMap(p.cfg, true))); last = placeholder.lastIndex; @@ -4593,8 +4616,90 @@ var UrlMatcher = /** @class */ (function () { } } this._segments.push(segment); - this._compiled = patterns.map(function (pattern$$1) { return quoteRegExp.apply(null, pattern$$1); }).concat(quoteRegExp(segment)); + this._compiled = patterns.map(function (_pattern) { return quoteRegExp.apply(null, _pattern); }).concat(quoteRegExp(segment)); } + /** @hidden */ + UrlMatcher.encodeDashes = function (str) { + return encodeURIComponent(str).replace(/-/g, function (c) { return "%5C%" + c.charCodeAt(0).toString(16).toUpperCase(); }); + }; + /** @hidden Given a matcher, return an array with the matcher's path segments and path params, in order */ + UrlMatcher.pathSegmentsAndParams = function (matcher) { + var staticSegments = matcher._segments; + var pathParams = matcher._params.filter(function (p) { return p.location === exports.DefType.PATH; }); + return arrayTuples(staticSegments, pathParams.concat(undefined)) + .reduce(unnestR, []) + .filter(function (x) { return x !== '' && isDefined(x); }); + }; + /** @hidden Given a matcher, return an array with the matcher's query params */ + UrlMatcher.queryParams = function (matcher) { + return matcher._params.filter(function (p) { return p.location === exports.DefType.SEARCH; }); + }; + /** + * Compare two UrlMatchers + * + * This comparison function converts a UrlMatcher into static and dynamic path segments. + * Each static path segment is a static string between a path separator (slash character). + * Each dynamic segment is a path parameter. + * + * The comparison function sorts static segments before dynamic ones. + */ + UrlMatcher.compare = function (a, b) { + /** + * Turn a UrlMatcher and all its parent matchers into an array + * of slash literals '/', string literals, and Param objects + * + * This example matcher matches strings like "/foo/:param/tail": + * var matcher = $umf.compile("/foo").append($umf.compile("/:param")).append($umf.compile("/")).append($umf.compile("tail")); + * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ] + * + * Caches the result as `matcher._cache.segments` + */ + var segments = function (matcher) { + return matcher._cache.segments = matcher._cache.segments || + matcher._cache.path.map(UrlMatcher.pathSegmentsAndParams) + .reduce(unnestR, []) + .reduce(joinNeighborsR, []) + .map(function (x) { return isString(x) ? splitOnSlash(x) : x; }) + .reduce(unnestR, []); + }; + /** + * Gets the sort weight for each segment of a UrlMatcher + * + * Caches the result as `matcher._cache.weights` + */ + var weights = function (matcher) { + return matcher._cache.weights = matcher._cache.weights || + segments(matcher).map(function (segment) { + // Sort slashes first, then static strings, the Params + if (segment === '/') + return 1; + if (isString(segment)) + return 2; + if (segment instanceof Param) + return 3; + }); + }; + /** + * Pads shorter array in-place (mutates) + */ + var padArrays = function (l, r, padVal) { + var len = Math.max(l.length, r.length); + while (l.length < len) + l.push(padVal); + while (r.length < len) + r.push(padVal); + }; + var weightsA = weights(a), weightsB = weights(b); + padArrays(weightsA, weightsB, 0); + var _pairs = arrayTuples(weightsA, weightsB); + var cmp, i; + for (i = 0; i < _pairs.length; i++) { + cmp = _pairs[i][0] - _pairs[i][1]; + if (cmp !== 0) + return cmp; + } + return 0; + }; /** * Creates a new concatenated UrlMatcher * @@ -4654,19 +4759,19 @@ var UrlMatcher = /** @class */ (function () { '^', unnest(_this._cache.path.map(prop('_compiled'))).join(''), _this.config.strict === false ? '\/?' : '', - '$' + '$', ].join(''), _this.config.caseInsensitive ? 'i' : undefined); }).exec(path); if (!match) return null; - //options = defaults(options, { isolate: false }); + // options = defaults(options, { isolate: false }); var allParams = this.parameters(), pathParams = allParams.filter(function (param) { return !param.isSearch(); }), searchParams = allParams.filter(function (param) { return param.isSearch(); }), nPathSegments = this._cache.path.map(function (urlm) { return urlm._segments.length - 1; }).reduce(function (a, x) { return a + x; }), values$$1 = {}; if (nPathSegments !== match.length - 1) throw new Error("Unbalanced capture group in route '" + this.pattern + "'"); - function decodePathArray(string) { - var reverseString = function (str) { return str.split("").reverse().join(""); }; - var unquoteDashes = function (str) { return str.replace(/\\-/g, "-"); }; - var split = reverseString(string).split(/-(?!\\)/); + function decodePathArray(paramVal) { + var reverseString = function (str) { return str.split('').reverse().join(''); }; + var unquoteDashes = function (str) { return str.replace(/\\-/g, '-'); }; + var split = reverseString(paramVal).split(/-(?!\\)/); var allReversed = map(split, reverseString); return map(allReversed, unquoteDashes).reverse(); } @@ -4695,7 +4800,7 @@ var UrlMatcher = /** @class */ (function () { values$$1[param.id] = param.value(value); }); if (hash) - values$$1["#"] = hash; + values$$1['#'] = hash; return values$$1; }; /** @@ -4815,13 +4920,13 @@ var UrlMatcher = /** @class */ (function () { return acc; // If this parameter value is an array, encode the value using encodeDashes if (isArray(encoded)) - return acc + map(encoded, UrlMatcher.encodeDashes).join("-"); + return acc + map(encoded, UrlMatcher.encodeDashes).join('-'); // If the parameter type is "raw", then do not encodeURIComponent if (param.raw) return acc + encoded; // Encode the value return acc + encodeURIComponent(encoded); - }, ""); + }, ''); // Build the query string by applying parameter values (array or regular) // then mapping to key=value, then flattening and joining using "&" var queryString = queryParams.map(function (paramDetails) { @@ -4835,90 +4940,9 @@ var UrlMatcher = /** @class */ (function () { if (!param.raw) encoded = map(encoded, encodeURIComponent); return encoded.map(function (val$$1) { return param.id + "=" + val$$1; }); - }).filter(identity).reduce(unnestR, []).join("&"); + }).filter(identity).reduce(unnestR, []).join('&'); // Concat the pathstring with the queryString (if exists) and the hashString (if exists) - return pathString + (queryString ? "?" + queryString : "") + (values$$1["#"] ? "#" + values$$1["#"] : ""); - }; - /** @hidden */ - UrlMatcher.encodeDashes = function (str) { - return encodeURIComponent(str).replace(/-/g, function (c) { return "%5C%" + c.charCodeAt(0).toString(16).toUpperCase(); }); - }; - /** @hidden Given a matcher, return an array with the matcher's path segments and path params, in order */ - UrlMatcher.pathSegmentsAndParams = function (matcher) { - var staticSegments = matcher._segments; - var pathParams = matcher._params.filter(function (p) { return p.location === exports.DefType.PATH; }); - return arrayTuples(staticSegments, pathParams.concat(undefined)) - .reduce(unnestR, []) - .filter(function (x) { return x !== "" && isDefined(x); }); - }; - /** @hidden Given a matcher, return an array with the matcher's query params */ - UrlMatcher.queryParams = function (matcher) { - return matcher._params.filter(function (p) { return p.location === exports.DefType.SEARCH; }); - }; - /** - * Compare two UrlMatchers - * - * This comparison function converts a UrlMatcher into static and dynamic path segments. - * Each static path segment is a static string between a path separator (slash character). - * Each dynamic segment is a path parameter. - * - * The comparison function sorts static segments before dynamic ones. - */ - UrlMatcher.compare = function (a, b) { - /** - * Turn a UrlMatcher and all its parent matchers into an array - * of slash literals '/', string literals, and Param objects - * - * This example matcher matches strings like "/foo/:param/tail": - * var matcher = $umf.compile("/foo").append($umf.compile("/:param")).append($umf.compile("/")).append($umf.compile("tail")); - * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ] - * - * Caches the result as `matcher._cache.segments` - */ - var segments = function (matcher) { - return matcher._cache.segments = matcher._cache.segments || - matcher._cache.path.map(UrlMatcher.pathSegmentsAndParams) - .reduce(unnestR, []) - .reduce(joinNeighborsR, []) - .map(function (x) { return isString(x) ? splitOnSlash(x) : x; }) - .reduce(unnestR, []); - }; - /** - * Gets the sort weight for each segment of a UrlMatcher - * - * Caches the result as `matcher._cache.weights` - */ - var weights = function (matcher) { - return matcher._cache.weights = matcher._cache.weights || - segments(matcher).map(function (segment) { - // Sort slashes first, then static strings, the Params - if (segment === '/') - return 1; - if (isString(segment)) - return 2; - if (segment instanceof Param) - return 3; - }); - }; - /** - * Pads shorter array in-place (mutates) - */ - var padArrays = function (l, r, padVal) { - var len = Math.max(l.length, r.length); - while (l.length < len) - l.push(padVal); - while (r.length < len) - r.push(padVal); - }; - var weightsA = weights(a), weightsB = weights(b); - padArrays(weightsA, weightsB, 0); - var cmp, i, pairs$$1 = arrayTuples(weightsA, weightsB); - for (i = 0; i < pairs$$1.length; i++) { - cmp = pairs$$1[i][0] - pairs$$1[i][1]; - if (cmp !== 0) - return cmp; - } - return 0; + return pathString + (queryString ? "?" + queryString : '') + (values$$1['#'] ? '#' + values$$1['#'] : ''); }; /** @hidden */ UrlMatcher.nameValidator = /^\w+([-.]+\w+)*(?:\[\])?$/; @@ -4942,10 +4966,6 @@ var UrlMatcherFactory = /** @class */ (function () { /** @hidden */ this._isCaseInsensitive = false; /** @hidden */ this._isStrictMode = true; /** @hidden */ this._defaultSquashPolicy = false; - /** @hidden */ - this._getConfig = function (config) { - return extend({ strict: _this._isStrictMode, caseInsensitive: _this._isCaseInsensitive }, config); - }; /** @internalapi Creates a new [[Param]] for a given location (DefType) */ this.paramFactory = { /** Creates a new [[Param]] from a CONFIG block */ @@ -4961,6 +4981,10 @@ var UrlMatcherFactory = /** @class */ (function () { return new Param(id, type, config, exports.DefType.SEARCH, _this); }, }; + /** @hidden */ + this._getConfig = function (config) { + return extend({ strict: _this._isStrictMode, caseInsensitive: _this._isCaseInsensitive }, config); + }; extend(this, { UrlMatcher: UrlMatcher, Param: Param }); } /** @inheritdoc */ @@ -5005,7 +5029,6 @@ var UrlMatcherFactory = /** @class */ (function () { }); return result; }; - /** * Creates and registers a custom [[ParamType]] object * @@ -5029,14 +5052,12 @@ var UrlMatcherFactory = /** @class */ (function () { var type = this.paramTypes.type(name, definition, definitionFn); return !isDefined(definition) ? type : this; }; - /** @hidden */ UrlMatcherFactory.prototype.$get = function () { this.paramTypes.enqueue = false; this.paramTypes._flushTypeQueue(); return this; }; - /** @internalapi */ UrlMatcherFactory.prototype.dispose = function () { this.paramTypes.dispose(); @@ -5122,9 +5143,9 @@ var UrlRuleFactory = /** @class */ (function () { handler = this.router.urlMatcherFactory.compile(handler); if (is(UrlMatcher)(handler)) _handler = function (match) { return handler.format(match); }; - function match(url) { - var match = urlMatcher.exec(url.path, url.search, url.hash); - return urlMatcher.validates(match) && match; + function matchUrlParamters(url) { + var params = urlMatcher.exec(url.path, url.search, url.hash); + return urlMatcher.validates(params) && params; } // Prioritize URLs, lowest to highest: // - Some optional URL parameters, but none matched @@ -5138,8 +5159,8 @@ var UrlRuleFactory = /** @class */ (function () { var matched = optional.filter(function (param) { return params[param.id]; }); return matched.length / optional.length; } - var details = { urlMatcher: urlMatcher, matchPriority: matchPriority, type: "URLMATCHER" }; - return extend(new BaseUrlRule(match, _handler), details); + var details = { urlMatcher: urlMatcher, matchPriority: matchPriority, type: 'URLMATCHER' }; + return extend(new BaseUrlRule(matchUrlParamters, _handler), details); }; /** * A UrlRule which matches a state by its url @@ -5164,10 +5185,10 @@ var UrlRuleFactory = /** @class */ (function () { var $state = router.stateService; var globals = router.globals; if ($state.href(state, match) !== $state.href(globals.current, globals.params)) { - $state.transitionTo(state, match, { inherit: true, source: "url" }); + $state.transitionTo(state, match, { inherit: true, source: 'url' }); } }; - var details = { state: state, type: "STATE" }; + var details = { state: state, type: 'STATE' }; return extend(this.fromUrlMatcher(state.url, handler), details); }; /** @@ -5204,7 +5225,7 @@ var UrlRuleFactory = /** @class */ (function () { */ UrlRuleFactory.prototype.fromRegExp = function (regexp, handler) { if (regexp.global || regexp.sticky) - throw new Error("Rule RegExp must not be global or sticky"); + throw new Error('Rule RegExp must not be global or sticky'); /** * If handler is a string, the url will be replaced by the string. * If the string has any String.replace() style variables in it (like `$2`), @@ -5217,11 +5238,11 @@ var UrlRuleFactory = /** @class */ (function () { }); }; var _handler = isString(handler) ? redirectUrlTo : handler; - var match = function (url) { + var matchParamsFromRegexp = function (url) { return regexp.exec(url.path); }; - var details = { regexp: regexp, type: "REGEXP" }; - return extend(new BaseUrlRule(match, _handler), details); + var details = { regexp: regexp, type: 'REGEXP' }; + return extend(new BaseUrlRule(matchParamsFromRegexp, _handler), details); }; UrlRuleFactory.isUrlRule = function (obj) { return obj && ['type', 'match', 'handler'].every(function (key) { return isDefined(obj[key]); }); @@ -5238,7 +5259,7 @@ var BaseUrlRule = /** @class */ (function () { function BaseUrlRule(match, handler) { var _this = this; this.match = match; - this.type = "RAW"; + this.type = 'RAW'; this.matchPriority = function (match) { return 0 - _this.$id; }; this.handler = handler || identity; } @@ -5266,7 +5287,7 @@ var prioritySort = function (a, b) { }; /** @hidden */ var typeSort = function (a, b) { - var weights = { "STATE": 4, "URLMATCHER": 4, "REGEXP": 3, "RAW": 2, "OTHER": 1 }; + var weights = { 'STATE': 4, 'URLMATCHER': 4, 'REGEXP': 3, 'RAW': 2, 'OTHER': 1 }; return (weights[a.type] || 0) - (weights[b.type] || 0); }; /** @hidden */ @@ -5468,14 +5489,15 @@ var UrlRouter = /** @class */ (function () { var cfg = this._router.urlService.config; var isHtml5 = cfg.html5Mode(); if (!isHtml5 && url !== null) { - url = "#" + cfg.hashPrefix() + url; + url = '#' + cfg.hashPrefix() + url; } url = appendBasePath(url, isHtml5, options.absolute, cfg.baseHref()); if (!options.absolute || !url) { return url; } - var slash = (!isHtml5 && url ? '/' : ''), port = cfg.port(); - port = (port === 80 || port === 443 ? '' : ':' + port); + var slash = (!isHtml5 && url ? '/' : ''); + var cfgPort = cfg.port(); + var port = (cfgPort === 80 || cfgPort === 443 ? '' : ':' + cfgPort); return [cfg.protocol(), '://', cfg.host(), port, slash, url].join(''); }; /** @@ -5493,7 +5515,7 @@ var UrlRouter = /** @class */ (function () { UrlRouter.prototype.rule = function (rule) { var _this = this; if (!UrlRuleFactory.isUrlRule(rule)) - throw new Error("invalid rule"); + throw new Error('invalid rule'); rule.$id = this._id++; rule.priority = rule.priority || 0; this._rules.push(rule); @@ -5515,7 +5537,6 @@ var UrlRouter = /** @class */ (function () { this._otherwiseFn = this.urlRuleFactory.create(val(true), handlerFn); this._sorted = false; }; - /** @inheritdoc */ UrlRouter.prototype.initial = function (handler) { var handlerFn = getHandlerFn(handler); @@ -5524,7 +5545,6 @@ var UrlRouter = /** @class */ (function () { }; this.rule(this.urlRuleFactory.create(matchFn, handlerFn)); }; - /** @inheritdoc */ UrlRouter.prototype.when = function (matcher, handler, options) { var rule = this.urlRuleFactory.create(matcher, handler); @@ -5533,14 +5553,12 @@ var UrlRouter = /** @class */ (function () { this.rule(rule); return rule; }; - /** @inheritdoc */ UrlRouter.prototype.deferIntercept = function (defer) { if (defer === undefined) defer = true; this.interceptDeferred = defer; }; - return UrlRouter; }()); function getHandlerFn(handler) { @@ -5588,17 +5606,59 @@ var ViewService = /** @class */ (function () { }, }; } + /** + * Normalizes a view's name from a state.views configuration block. + * + * This should be used by a framework implementation to calculate the values for + * [[_ViewDeclaration.$uiViewName]] and [[_ViewDeclaration.$uiViewContextAnchor]]. + * + * @param context the context object (state declaration) that the view belongs to + * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]] + * + * @returns the normalized uiViewName and uiViewContextAnchor that the view targets + */ + ViewService.normalizeUIViewTarget = function (context, rawViewName) { + if (rawViewName === void 0) { rawViewName = ''; } + // TODO: Validate incoming view name with a regexp to allow: + // ex: "view.name@foo.bar" , "^.^.view.name" , "view.name@^.^" , "" , + // "@" , "$default@^" , "!$default.$default" , "!foo.bar" + var viewAtContext = rawViewName.split('@'); + var uiViewName = viewAtContext[0] || '$default'; // default to unnamed view + var uiViewContextAnchor = isString(viewAtContext[1]) ? viewAtContext[1] : '^'; // default to parent context + // Handle relative view-name sugar syntax. + // Matches rawViewName "^.^.^.foo.bar" into array: ["^.^.^.foo.bar", "^.^.^", "foo.bar"], + var relativeViewNameSugar = /^(\^(?:\.\^)*)\.(.*$)/.exec(uiViewName); + if (relativeViewNameSugar) { + // Clobbers existing contextAnchor (rawViewName validation will fix this) + uiViewContextAnchor = relativeViewNameSugar[1]; // set anchor to "^.^.^" + uiViewName = relativeViewNameSugar[2]; // set view-name to "foo.bar" + } + if (uiViewName.charAt(0) === '!') { + uiViewName = uiViewName.substr(1); + uiViewContextAnchor = ''; // target absolutely from root + } + // handle parent relative targeting "^.^.^" + var relativeMatch = /^(\^(?:\.\^)*)$/; + if (relativeMatch.exec(uiViewContextAnchor)) { + var anchorState = uiViewContextAnchor.split('.') + .reduce((function (anchor, x) { return anchor.parent; }), context); + uiViewContextAnchor = anchorState.name; + } + else if (uiViewContextAnchor === '.') { + uiViewContextAnchor = context.name; + } + return { uiViewName: uiViewName, uiViewContextAnchor: uiViewContextAnchor }; + }; ViewService.prototype._rootViewContext = function (context) { return this._rootContext = context || this._rootContext; }; - ViewService.prototype._viewConfigFactory = function (viewType, factory) { this._viewConfigFactories[viewType] = factory; }; ViewService.prototype.createViewConfig = function (path, decl) { var cfgFactory = this._viewConfigFactories[decl.$type]; if (!cfgFactory) - throw new Error("ViewService: No view config factory registered for type " + decl.$type); + throw new Error('ViewService: No view config factory registered for type ' + decl.$type); var cfgs = cfgFactory(path, decl); return isArray(cfgs) ? cfgs : [cfgs]; }; @@ -5611,11 +5671,11 @@ var ViewService = /** @class */ (function () { * @param viewConfig The ViewConfig view to deregister. */ ViewService.prototype.deactivateViewConfig = function (viewConfig) { - trace.traceViewServiceEvent("<- Removing", viewConfig); + trace.traceViewServiceEvent('<- Removing', viewConfig); removeFrom(this._viewConfigs, viewConfig); }; ViewService.prototype.activateViewConfig = function (viewConfig) { - trace.traceViewServiceEvent("-> Registering", viewConfig); + trace.traceViewServiceEvent('-> Registering', viewConfig); this._viewConfigs.push(viewConfig); }; ViewService.prototype.sync = function () { @@ -5628,7 +5688,7 @@ var ViewService = /** @class */ (function () { var stateDepth = function (context) { return context && context.parent ? stateDepth(context.parent) + 1 : 1; }; - return (uiView.fqn.split(".").length * 10000) + stateDepth(uiView.creationContext); + return (uiView.fqn.split('.').length * 10000) + stateDepth(uiView.creationContext); } // Return the ViewConfig's context's depth in the context tree. function viewConfigDepth(config) { @@ -5659,14 +5719,13 @@ var ViewService = /** @class */ (function () { var uiViewTuples = this._uiViews.sort(depthCompare(uiViewDepth, 1)).map(matchingConfigPair); var matchedViewConfigs = uiViewTuples.map(function (tuple) { return tuple.viewConfig; }); var unmatchedConfigTuples = this._viewConfigs - .filter(function (config) { return inArray(matchedViewConfigs, config); }) + .filter(function (config) { return !inArray(matchedViewConfigs, config); }) .map(function (viewConfig) { return ({ uiView: undefined, viewConfig: viewConfig }); }); - var allTuples = uiViewTuples.concat(unmatchedConfigTuples); uiViewTuples.forEach(configureUIView); + var allTuples = uiViewTuples.concat(unmatchedConfigTuples); this._listeners.forEach(function (cb) { return cb(allTuples); }); trace.traceViewSync(allTuples); }; - /** * Registers a `ui-view` component * @@ -5683,31 +5742,30 @@ var ViewService = /** @class */ (function () { * @return a de-registration function used when the view is destroyed. */ ViewService.prototype.registerUIView = function (uiView) { - trace.traceViewServiceUIViewEvent("-> Registering", uiView); + trace.traceViewServiceUIViewEvent('-> Registering', uiView); var uiViews = this._uiViews; var fqnAndTypeMatches = function (uiv) { return uiv.fqn === uiView.fqn && uiv.$type === uiView.$type; }; if (uiViews.filter(fqnAndTypeMatches).length) - trace.traceViewServiceUIViewEvent("!!!! duplicate uiView named:", uiView); + trace.traceViewServiceUIViewEvent('!!!! duplicate uiView named:', uiView); uiViews.push(uiView); this.sync(); return function () { var idx = uiViews.indexOf(uiView); if (idx === -1) { - trace.traceViewServiceUIViewEvent("Tried removing non-registered uiView", uiView); + trace.traceViewServiceUIViewEvent('Tried removing non-registered uiView', uiView); return; } - trace.traceViewServiceUIViewEvent("<- Deregistering", uiView); + trace.traceViewServiceUIViewEvent('<- Deregistering', uiView); removeFrom(uiViews)(uiView); }; }; - /** * Returns the list of views currently available on the page, by fully-qualified name. * * @return {Array} Returns an array of fully-qualified view names. */ ViewService.prototype.available = function () { - return this._uiViews.map(prop("fqn")); + return this._uiViews.map(prop('fqn')); }; /** * Returns the list of views on the page containing loaded content. @@ -5715,49 +5773,7 @@ var ViewService = /** @class */ (function () { * @return {Array} Returns an array of fully-qualified view names. */ ViewService.prototype.active = function () { - return this._uiViews.filter(prop("$config")).map(prop("name")); - }; - /** - * Normalizes a view's name from a state.views configuration block. - * - * This should be used by a framework implementation to calculate the values for - * [[_ViewDeclaration.$uiViewName]] and [[_ViewDeclaration.$uiViewContextAnchor]]. - * - * @param context the context object (state declaration) that the view belongs to - * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]] - * - * @returns the normalized uiViewName and uiViewContextAnchor that the view targets - */ - ViewService.normalizeUIViewTarget = function (context, rawViewName) { - if (rawViewName === void 0) { rawViewName = ""; } - // TODO: Validate incoming view name with a regexp to allow: - // ex: "view.name@foo.bar" , "^.^.view.name" , "view.name@^.^" , "" , - // "@" , "$default@^" , "!$default.$default" , "!foo.bar" - var viewAtContext = rawViewName.split("@"); - var uiViewName = viewAtContext[0] || "$default"; // default to unnamed view - var uiViewContextAnchor = isString(viewAtContext[1]) ? viewAtContext[1] : "^"; // default to parent context - // Handle relative view-name sugar syntax. - // Matches rawViewName "^.^.^.foo.bar" into array: ["^.^.^.foo.bar", "^.^.^", "foo.bar"], - var relativeViewNameSugar = /^(\^(?:\.\^)*)\.(.*$)/.exec(uiViewName); - if (relativeViewNameSugar) { - // Clobbers existing contextAnchor (rawViewName validation will fix this) - uiViewContextAnchor = relativeViewNameSugar[1]; // set anchor to "^.^.^" - uiViewName = relativeViewNameSugar[2]; // set view-name to "foo.bar" - } - if (uiViewName.charAt(0) === '!') { - uiViewName = uiViewName.substr(1); - uiViewContextAnchor = ""; // target absolutely from root - } - // handle parent relative targeting "^.^.^" - var relativeMatch = /^(\^(?:\.\^)*)$/; - if (relativeMatch.exec(uiViewContextAnchor)) { - var anchor = uiViewContextAnchor.split(".").reduce((function (anchor, x) { return anchor.parent; }), context); - uiViewContextAnchor = anchor.name; - } - else if (uiViewContextAnchor === '.') { - uiViewContextAnchor = context.name; - } - return { uiViewName: uiViewName, uiViewContextAnchor: uiViewContextAnchor }; + return this._uiViews.filter(prop('$config')).map(prop('name')); }; /** * Given a ui-view and a ViewConfig, determines if they "match". @@ -5822,8 +5838,8 @@ var ViewService = /** @class */ (function () { return false; // Split names apart from both viewConfig and uiView into segments var vc = viewConfig.viewDecl; - var vcSegments = vc.$uiViewName.split("."); - var uivSegments = uiView.fqn.split("."); + var vcSegments = vc.$uiViewName.split('.'); + var uivSegments = uiView.fqn.split('.'); // Check if the tails of the segment arrays match. ex, these arrays' tails match: // vc: ["foo", "bar"], uiv fqn: ["$default", "foo", "bar"] if (!equals(vcSegments, uivSegments.slice(0 - vcSegments.length))) @@ -5831,7 +5847,7 @@ var ViewService = /** @class */ (function () { // Now check if the fqn ending at the first segment of the viewConfig matches the context: // ["$default", "foo"].join(".") == "$default.foo", does the ui-view $default.foo context match? var negOffset = (1 - vcSegments.length) || undefined; - var fqnToFirstSegment = uivSegments.slice(0, negOffset).join("."); + var fqnToFirstSegment = uivSegments.slice(0, negOffset).join('.'); var uiViewContext = uiViewsByFqn[fqnToFirstSegment].creationContext; return vc.$uiViewContextAnchor === (uiViewContext && uiViewContext.name); }; }; @@ -5879,11 +5895,13 @@ var UIRouterGlobals = /** @class */ (function () { var makeStub = function (keys) { return keys.reduce(function (acc, key) { return (acc[key] = notImplemented(key), acc); }, { dispose: noop }); }; -/** @hidden */ var locationServicesFns = ["url", "path", "search", "hash", "onChange"]; -/** @hidden */ var locationConfigFns = ["port", "protocol", "host", "baseHref", "html5Mode", "hashPrefix"]; -/** @hidden */ var umfFns = ["type", "caseInsensitive", "strictMode", "defaultSquashPolicy"]; -/** @hidden */ var rulesFns = ["sort", "when", "initial", "otherwise", "rules", "rule", "removeRule"]; -/** @hidden */ var syncFns = ["deferIntercept", "listen", "sync", "match"]; +/* tslint:disable:align */ +/** @hidden */ var locationServicesFns = ['url', 'path', 'search', 'hash', 'onChange']; +/** @hidden */ var locationConfigFns = ['port', 'protocol', 'host', 'baseHref', 'html5Mode', 'hashPrefix']; +/** @hidden */ var umfFns = ['type', 'caseInsensitive', 'strictMode', 'defaultSquashPolicy']; +/** @hidden */ var rulesFns = ['sort', 'when', 'initial', 'otherwise', 'rules', 'rule', 'removeRule']; +/** @hidden */ var syncFns = ['deferIntercept', 'listen', 'sync', 'match']; +/* tslint:enable:align */ /** * API for URL management */ @@ -5906,19 +5924,14 @@ var UrlService = /** @class */ (function () { createProxyFunctions(urlRouter, this, urlRouter, syncFns); } UrlService.prototype.url = function (newurl, replace, state) { return; }; - /** @inheritdoc */ UrlService.prototype.path = function () { return; }; - /** @inheritdoc */ UrlService.prototype.search = function () { return; }; - /** @inheritdoc */ UrlService.prototype.hash = function () { return; }; - /** @inheritdoc */ UrlService.prototype.onChange = function (callback) { return; }; - /** * Returns the current URL parts * @@ -5934,7 +5947,6 @@ var UrlService = /** @class */ (function () { UrlService.prototype.sync = function (evt) { return; }; /** @inheritdoc */ UrlService.prototype.listen = function (enabled) { return; }; - /** @inheritdoc */ UrlService.prototype.deferIntercept = function (defer) { return; }; /** @inheritdoc */ @@ -6007,7 +6019,7 @@ var UIRouter = /** @class */ (function () { this.stateService = new StateService(this); /** Provides services related to the URL */ this.urlService = new UrlService(this); - /** @hidden */ + /** @hidden plugin instances are registered here */ this._plugins = {}; this.viewService._pluginapi._rootViewContext(this.stateRegistry.root()); this.globals.$current = this.stateRegistry.root(); @@ -6106,7 +6118,7 @@ var UIRouter = /** @class */ (function () { if (options === void 0) { options = {}; } var pluginInstance = new plugin(this, options); if (!pluginInstance.name) - throw new Error("Required property `name` missing on plugin: " + pluginInstance); + throw new Error('Required property `name` missing on plugin: ' + pluginInstance); this._disposables.push(pluginInstance); return this._plugins[pluginInstance.name] = pluginInstance; }; @@ -6118,10 +6130,10 @@ var UIRouter = /** @class */ (function () { /** @module hooks */ /** */ function addCoreResolvables(trans) { - trans.addResolvable({ token: UIRouter, deps: [], resolveFn: function () { return trans.router; }, data: trans.router }, ""); - trans.addResolvable({ token: Transition, deps: [], resolveFn: function () { return trans; }, data: trans }, ""); - trans.addResolvable({ token: '$transition$', deps: [], resolveFn: function () { return trans; }, data: trans }, ""); - trans.addResolvable({ token: '$stateParams', deps: [], resolveFn: function () { return trans.params(); }, data: trans.params() }, ""); + trans.addResolvable({ token: UIRouter, deps: [], resolveFn: function () { return trans.router; }, data: trans.router }, ''); + trans.addResolvable({ token: Transition, deps: [], resolveFn: function () { return trans; }, data: trans }, ''); + trans.addResolvable({ token: '$transition$', deps: [], resolveFn: function () { return trans; }, data: trans }, ''); + trans.addResolvable({ token: '$stateParams', deps: [], resolveFn: function () { return trans.params(); }, data: trans.params() }, ''); trans.entering().forEach(function (state) { trans.addResolvable({ token: '$state$', deps: [], resolveFn: function () { return state; }, data: state }, state); }); @@ -6231,7 +6243,7 @@ var RESOLVE_HOOK_PRIORITY = 1000; */ var eagerResolvePath = function (trans) { return new ResolveContext(trans.treeChanges().to) - .resolvePath("EAGER", trans) + .resolvePath('EAGER', trans) .then(noop); }; var registerEagerResolvePath = function (transitionService) { @@ -6249,7 +6261,7 @@ var registerEagerResolvePath = function (transitionService) { var lazyResolveState = function (trans, state) { return new ResolveContext(trans.treeChanges().to) .subContext(state.$$state()) - .resolvePath("LAZY", trans) + .resolvePath('LAZY', trans) .then(noop); }; var registerLazyResolveState = function (transitionService) { @@ -6267,7 +6279,7 @@ var registerLazyResolveState = function (transitionService) { */ var resolveRemaining = function (trans) { return new ResolveContext(trans.treeChanges().to) - .resolvePath("LAZY", trans) + .resolvePath('LAZY', trans) .then(noop); }; var registerResolveRemaining = function (transitionService) { @@ -6285,7 +6297,7 @@ var registerResolveRemaining = function (transitionService) { */ var loadEnteringViews = function (transition) { var $q = services.$q; - var enteringViews = transition.views("entering"); + var enteringViews = transition.views('entering'); if (!enteringViews.length) return; return $q.all(enteringViews.map(function (view) { return $q.when(view.load()); })).then(noop); @@ -6304,8 +6316,8 @@ var registerLoadEnteringViews = function (transitionService) { * See [[ViewService]] */ var activateViews = function (transition) { - var enteringViews = transition.views("entering"); - var exitingViews = transition.views("exiting"); + var enteringViews = transition.views('entering'); + var exitingViews = transition.views('exiting'); if (!enteringViews.length && !exitingViews.length) return; var $view = transition.router.viewService; @@ -6412,7 +6424,7 @@ var lazyLoadHook = function (transition) { var rule = result && result.rule; // If the best match is a state, redirect the transition (instead // of calling sync() which supersedes the current transition) - if (rule && rule.type === "STATE") { + if (rule && rule.type === 'STATE') { var state = rule.state; var params = result.match; return router.stateService.target(state, params, transition.options()); @@ -6458,7 +6470,7 @@ function lazyLoadState(transition, state) { /** Register any lazy loaded state definitions */ function updateStateRegistry(result) { if (result && Array.isArray(result.states)) { - result.states.forEach(function (state) { return transition.router.stateRegistry.register(state); }); + result.states.forEach(function (_state) { return transition.router.stateRegistry.register(_state); }); } return result; } @@ -6472,6 +6484,7 @@ function lazyLoadState(transition, state) { * @interalapi */ var TransitionEventType = /** @class */ (function () { + /* tslint:disable:no-inferrable-types */ function TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous) { if (reverseSort === void 0) { reverseSort = false; } if (getResultHandler === void 0) { getResultHandler = TransitionHook.HANDLE_RESULT; } @@ -6553,7 +6566,7 @@ var defaultTransOpts = { reload: false, custom: {}, current: function () { return null; }, - source: "unknown", + source: 'unknown', }; /** * This class provides services related to Transitions. @@ -6659,24 +6672,24 @@ var TransitionService = /** @class */ (function () { var paths = this._criteriaPaths; var NORMAL_SORT = false, REVERSE_SORT = true; var SYNCHRONOUS = true; - this._defineEvent("onCreate", Phase.CREATE, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.THROW_ERROR, SYNCHRONOUS); - this._defineEvent("onBefore", Phase.BEFORE, 0, paths.to); - this._defineEvent("onStart", Phase.RUN, 0, paths.to); - this._defineEvent("onExit", Phase.RUN, 100, paths.exiting, REVERSE_SORT); - this._defineEvent("onRetain", Phase.RUN, 200, paths.retained); - this._defineEvent("onEnter", Phase.RUN, 300, paths.entering); - this._defineEvent("onFinish", Phase.RUN, 400, paths.to); - this._defineEvent("onSuccess", Phase.SUCCESS, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS); - this._defineEvent("onError", Phase.ERROR, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS); + this._defineEvent('onCreate', Phase.CREATE, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.THROW_ERROR, SYNCHRONOUS); + this._defineEvent('onBefore', Phase.BEFORE, 0, paths.to); + this._defineEvent('onStart', Phase.RUN, 0, paths.to); + this._defineEvent('onExit', Phase.RUN, 100, paths.exiting, REVERSE_SORT); + this._defineEvent('onRetain', Phase.RUN, 200, paths.retained); + this._defineEvent('onEnter', Phase.RUN, 300, paths.entering); + this._defineEvent('onFinish', Phase.RUN, 400, paths.to); + this._defineEvent('onSuccess', Phase.SUCCESS, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS); + this._defineEvent('onError', Phase.ERROR, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS); }; /** @hidden */ TransitionService.prototype._defineCorePaths = function () { var STATE = exports.TransitionHookScope.STATE, TRANSITION = exports.TransitionHookScope.TRANSITION; - this._definePathType("to", TRANSITION); - this._definePathType("from", TRANSITION); - this._definePathType("exiting", STATE); - this._definePathType("retained", STATE); - this._definePathType("entering", STATE); + this._definePathType('to', TRANSITION); + this._definePathType('from', TRANSITION); + this._definePathType('exiting', STATE); + this._definePathType('retained', STATE); + this._definePathType('entering', STATE); }; /** @hidden */ TransitionService.prototype._defineEvent = function (name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous) { @@ -6956,7 +6969,6 @@ var StateService = /** @class */ (function () { notify: false, }); }; - /** * Transition to a different state and/or parameters * @@ -7002,7 +7014,6 @@ var StateService = /** @class */ (function () { var transOpts = defaults(options, defautGoOpts, defaultTransOpts); return this.transitionTo(to, params, transOpts); }; - /** * Creates a [[TargetState]] * @@ -7021,7 +7032,6 @@ var StateService = /** @class */ (function () { throw new Error("No such reload state '" + (isString(options.reload) ? options.reload : options.reload.name) + "'"); return new TargetState(this.router.stateRegistry, identifier, params, options); }; - StateService.prototype.getCurrentPath = function () { var _this = this; var globals = this.router.globals; @@ -7078,9 +7088,9 @@ var StateService = /** @class */ (function () { * no error occurred. Likewise, the transition.run() promise may be rejected because of * a Redirect, but the transitionTo() promise is chained to the new Transition's promise. */ - var rejectedTransitionHandler = function (transition) { return function (error) { + var rejectedTransitionHandler = function (trans) { return function (error) { if (error instanceof Rejection) { - var isLatest = router.globals.lastStartedTransitionId === transition.$id; + var isLatest = router.globals.lastStartedTransitionId === trans.$id; if (error.type === exports.RejectType.IGNORED) { isLatest && router.urlRouter.update(); // Consider ignored `Transition.run()` as a successful `transitionTo` @@ -7090,7 +7100,7 @@ var StateService = /** @class */ (function () { if (error.type === exports.RejectType.SUPERSEDED && error.redirected && detail instanceof TargetState) { // If `Transition.run()` was redirected, allow the `transitionTo()` promise to resolve successfully // by returning the promise for the new (redirect) `Transition.run()`. - var redirect = transition.redirect(detail); + var redirect = trans.redirect(detail); return redirect.run().catch(rejectedTransitionHandler(redirect)); } if (error.type === exports.RejectType.ABORTED) { @@ -7108,7 +7118,6 @@ var StateService = /** @class */ (function () { // Return a promise for the transition, which also has the transition object on it. return extend(transitionToPromise, { transition: transition }); }; - /** * Checks if the current state *is* the provided state * @@ -7152,7 +7161,6 @@ var StateService = /** @class */ (function () { var schema = state.parameters({ inherit: true, matchingKeys: params }); return Param.equals(schema, Param.values(schema, params), this.params); }; - /** * Checks if the current state *includes* the provided state * @@ -7209,7 +7217,6 @@ var StateService = /** @class */ (function () { var schema = state.parameters({ inherit: true, matchingKeys: params }); return Param.equals(schema, Param.values(schema, params), this.params); }; - /** * Generates a URL for a state and parameters * @@ -7248,7 +7255,6 @@ var StateService = /** @class */ (function () { absolute: options.absolute, }); }; - /** * Sets or gets the default [[transitionTo]] error handler. * @@ -7297,7 +7303,7 @@ var StateService = /** @class */ (function () { StateService.prototype.lazyLoad = function (stateOrName, transition) { var state = this.get(stateOrName); if (!state || !state.lazyLoad) - throw new Error("Can not lazy load " + stateOrName); + throw new Error('Can not lazy load ' + stateOrName); var currentPath = this.getCurrentPath(); var target = PathUtils.makeTargetState(this.router.stateRegistry, currentPath); transition = transition || this.router.transitionService.create(currentPath, target); @@ -7370,7 +7376,7 @@ var $q = { return values.reduce(function (acc, tuple) { acc[tuple.key] = tuple.val; return acc; }, {}); }); } - } + }, }; /** @@ -7467,7 +7473,7 @@ var $injector = { var fnStr = fn.toString().replace(STRIP_COMMENTS, ''); var result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES); return result || []; - } + }, }; /** @@ -7489,10 +7495,10 @@ var keyValsToObjectR = function (accum, _a) { return accum; }; var getParams = function (queryString) { - return queryString.split("&").filter(identity).map(splitEqual).reduce(keyValsToObjectR, {}); + return queryString.split('&').filter(identity).map(splitEqual).reduce(keyValsToObjectR, {}); }; function parseUrl$1(url) { - var orEmptyString = function (x) { return x || ""; }; + var orEmptyString = function (x) { return x || ''; }; var _a = splitHash(url).map(orEmptyString), beforehash = _a[0], hash = _a[1]; var _b = splitQuery(beforehash).map(orEmptyString), path = _b[0], search = _b[1]; return { path: path, search: search, hash: hash, url: url }; @@ -7504,14 +7510,14 @@ var buildUrl = function (loc) { var search = Object.keys(searchObject).map(function (key) { var param = searchObject[key]; var vals = isArray(param) ? param : [param]; - return vals.map(function (val) { return key + "=" + val; }); - }).reduce(unnestR, []).join("&"); - return path + (search ? "?" + search : "") + (hash ? "#" + hash : ""); + return vals.map(function (val) { return key + '=' + val; }); + }).reduce(unnestR, []).join('&'); + return path + (search ? '?' + search : '') + (hash ? '#' + hash : ''); }; function locationPluginFactory(name, isHtml5, serviceClass, configurationClass) { - return function (router) { - var service = router.locationService = new serviceClass(router); - var configuration = router.locationConfig = new configurationClass(router, isHtml5); + return function (uiRouter) { + var service = uiRouter.locationService = new serviceClass(uiRouter); + var configuration = uiRouter.locationConfig = new configurationClass(uiRouter, isHtml5); function dispose(router) { router.dispose(service); router.dispose(configuration); @@ -7529,8 +7535,8 @@ var BaseLocationServices = /** @class */ (function () { function BaseLocationServices(router, fireAfterUpdate) { var _this = this; this.fireAfterUpdate = fireAfterUpdate; - this._listener = function (evt) { return _this._listeners.forEach(function (cb) { return cb(evt); }); }; this._listeners = []; + this._listener = function (evt) { return _this._listeners.forEach(function (cb) { return cb(evt); }); }; this.hash = function () { return parseUrl$1(_this._get()).hash; }; this.path = function () { return parseUrl$1(_this._get()).path; }; this.search = function () { return getParams(parseUrl$1(_this._get()).search); }; @@ -7647,7 +7653,6 @@ var PushStateLocationService = /** @class */ (function (_super) { root.addEventListener('popstate', _this._listener, false); return _this; } - /** * Gets the base prefix without: * - trailing slash @@ -7699,18 +7704,18 @@ var PushStateLocationService = /** @class */ (function (_super) { var MemoryLocationConfig = /** @class */ (function () { function MemoryLocationConfig() { var _this = this; + this.dispose = noop; this._baseHref = ''; this._port = 80; - this._protocol = "http"; - this._host = "localhost"; - this._hashPrefix = ""; + this._protocol = 'http'; + this._host = 'localhost'; + this._hashPrefix = ''; this.port = function () { return _this._port; }; this.protocol = function () { return _this._protocol; }; this.host = function () { return _this._host; }; this.baseHref = function () { return _this._baseHref; }; this.html5Mode = function () { return false; }; this.hashPrefix = function (newval) { return isDefined(newval) ? _this._hashPrefix = newval : _this._hashPrefix; }; - this.dispose = noop; } return MemoryLocationConfig; }()); @@ -7726,7 +7731,7 @@ var BrowserLocationConfig = /** @class */ (function () { if (_isHtml5 === void 0) { _isHtml5 = false; } this._isHtml5 = _isHtml5; this._baseHref = undefined; - this._hashPrefix = ""; + this._hashPrefix = ''; } BrowserLocationConfig.prototype.port = function () { if (location.port) { @@ -7746,13 +7751,12 @@ var BrowserLocationConfig = /** @class */ (function () { BrowserLocationConfig.prototype.hashPrefix = function (newprefix) { return isDefined(newprefix) ? this._hashPrefix = newprefix : this._hashPrefix; }; - BrowserLocationConfig.prototype.baseHref = function (href) { return isDefined(href) ? this._baseHref = href : isDefined(this._baseHref) ? this._baseHref : this.applyDocumentBaseHref(); }; BrowserLocationConfig.prototype.applyDocumentBaseHref = function () { - var baseTag = document.getElementsByTagName("base")[0]; + var baseTag = document.getElementsByTagName('base')[0]; return this._baseHref = baseTag ? baseTag.href.substr(location.origin.length) : location.pathname || '/'; }; BrowserLocationConfig.prototype.dispose = function () { }; @@ -7767,14 +7771,14 @@ var BrowserLocationConfig = /** @class */ (function () { function servicesPlugin(router) { services.$injector = $injector; services.$q = $q; - return { name: "vanilla.services", $q: $q, $injector: $injector, dispose: function () { return null; } }; + return { name: 'vanilla.services', $q: $q, $injector: $injector, dispose: function () { return null; } }; } /** A `UIRouterPlugin` uses the browser hash to get/set the current location */ var hashLocationPlugin = locationPluginFactory('vanilla.hashBangLocation', false, HashLocationService, BrowserLocationConfig); /** A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis */ -var pushStateLocationPlugin = locationPluginFactory("vanilla.pushStateLocation", true, PushStateLocationService, BrowserLocationConfig); +var pushStateLocationPlugin = locationPluginFactory('vanilla.pushStateLocation', true, PushStateLocationService, BrowserLocationConfig); /** A `UIRouterPlugin` that gets/sets the current location from an in-memory object */ -var memoryLocationPlugin = locationPluginFactory("vanilla.memoryLocation", false, MemoryLocationService, MemoryLocationConfig); +var memoryLocationPlugin = locationPluginFactory('vanilla.memoryLocation', false, MemoryLocationService, MemoryLocationConfig); /** * @internalapi @@ -7972,7 +7976,7 @@ var index$1 = Object.freeze({ function getNg1ViewConfigFactory() { var templateFactory = null; return function (path, view) { - templateFactory = templateFactory || services.$injector.get("$templateFactory"); + templateFactory = templateFactory || services.$injector.get('$templateFactory'); return [new Ng1ViewConfig(path, view, templateFactory)]; }; } @@ -8000,12 +8004,12 @@ function ng1ViewsBuilder(state) { throw new Error("State '" + state.name + "' has a 'views' object. " + "It cannot also have \"view properties\" at the state level. " + "Move the following properties into a view (in the 'views' object): " + - (" " + allViewKeys.filter(function (key) { return isDefined(state[key]); }).join(", "))); + (" " + allViewKeys.filter(function (key) { return isDefined(state[key]); }).join(', '))); } - var views = {}, viewsObject = state.views || { "$default": pick(state, allViewKeys) }; + var views = {}, viewsObject = state.views || { '$default': pick(state, allViewKeys) }; forEach(viewsObject, function (config, name) { // Account for views: { "": { template... } } - name = name || "$default"; + name = name || '$default'; // Account for views: { header: "headerComponent" } if (isString(config)) config = { component: config }; @@ -8013,10 +8017,10 @@ function ng1ViewsBuilder(state) { config = extend({}, config); // Do not allow a view to mix props for component-style view with props for template/controller-style view if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) { - throw new Error("Cannot combine: " + compKeys.join("|") + " with: " + nonCompKeys.join("|") + " in stateview: '" + name + "@" + state.name + "'"); + throw new Error("Cannot combine: " + compKeys.join('|') + " with: " + nonCompKeys.join('|') + " in stateview: '" + name + "@" + state.name + "'"); } config.resolveAs = config.resolveAs || '$resolve'; - config.$type = "ng1"; + config.$type = 'ng1'; config.$context = state; config.$name = name; var normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name); @@ -8046,10 +8050,10 @@ var Ng1ViewConfig = /** @class */ (function () { var params = this.path.reduce(function (acc, node) { return extend(acc, node.paramValues); }, {}); var promises = { template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)), - controller: $q.when(this.getController(context)) + controller: $q.when(this.getController(context)), }; return $q.all(promises).then(function (results) { - trace.traceViewServiceEvent("Loaded", _this); + trace.traceViewServiceEvent('Loaded', _this); _this.controller = results.controller; extend(_this, results.template); // Either { template: "tpl" } or { component: "cmpName" } return _this; @@ -8066,7 +8070,7 @@ var Ng1ViewConfig = /** @class */ (function () { return this.viewDecl.controller; var deps = services.$injector.annotate(provider); var providerFn = isArray(provider) ? tail(provider) : provider; - var resolvable = new Resolvable("", providerFn, deps); + var resolvable = new Resolvable('', providerFn, deps); return resolvable.get(context); }; return Ng1ViewConfig; @@ -8092,7 +8096,6 @@ var TemplateFactory = /** @class */ (function () { TemplateFactory.prototype.useHttpService = function (value) { this._useHttp = value; }; - /** * Creates a template from a configuration object. * @@ -8107,7 +8110,7 @@ var TemplateFactory = /** @class */ (function () { * that string,or `null` if no template is configured. */ TemplateFactory.prototype.fromConfig = function (config, params, context) { - var defaultTemplate = ""; + var defaultTemplate = ''; var asTemplate = function (result) { return services.$q.when(result).then(function (str) { return ({ template: str }); }); }; var asComponent = function (result) { return services.$q.when(result).then(function (str) { return ({ component: str }); }); }; return (isDefined(config.template) ? asTemplate(this.fromString(config.template, params)) : @@ -8117,7 +8120,6 @@ var TemplateFactory = /** @class */ (function () { isDefined(config.componentProvider) ? asComponent(this.fromComponentProvider(config.componentProvider, params, context)) : asTemplate(defaultTemplate)); }; - /** * Creates a template from a string or a function returning a string. * @@ -8130,7 +8132,6 @@ var TemplateFactory = /** @class */ (function () { TemplateFactory.prototype.fromString = function (template, params) { return isFunction(template) ? template(params) : template; }; - /** * Loads a template from the a URL via `$http` and `$templateCache`. * @@ -8153,7 +8154,6 @@ var TemplateFactory = /** @class */ (function () { } return this.$templateRequest(url); }; - /** * Creates a template by invoking an injectable provider function. * @@ -8165,10 +8165,9 @@ var TemplateFactory = /** @class */ (function () { TemplateFactory.prototype.fromProvider = function (provider, params, context) { var deps = services.$injector.annotate(provider); var providerFn = isArray(provider) ? tail(provider) : provider; - var resolvable = new Resolvable("", providerFn, deps); + var resolvable = new Resolvable('', providerFn, deps); return resolvable.get(context); }; - /** * Creates a component's template by invoking an injectable provider function. * @@ -8179,10 +8178,9 @@ var TemplateFactory = /** @class */ (function () { TemplateFactory.prototype.fromComponentProvider = function (provider, params, context) { var deps = services.$injector.annotate(provider); var providerFn = isArray(provider) ? tail(provider) : provider; - var resolvable = new Resolvable("", providerFn, deps); + var resolvable = new Resolvable('', providerFn, deps); return resolvable.get(context); }; - /** * Creates a template from a component's name * @@ -8200,7 +8198,7 @@ var TemplateFactory = /** @class */ (function () { TemplateFactory.prototype.makeComponentTemplate = function (uiView, context, component, bindings) { bindings = bindings || {}; // Bind once prefix - var prefix = ng.version.minor >= 3 ? "::" : ""; + var prefix = ng.version.minor >= 3 ? '::' : ''; // Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-` var kebob = function (camelCase) { var kebobed = kebobString(camelCase); @@ -8228,21 +8226,20 @@ var TemplateFactory = /** @class */ (function () { var args = fn && services.$injector.annotate(fn) || []; // account for array style injection, i.e., ['foo', function(foo) {}] var arrayIdxStr = isArray(fn) ? "[" + (fn.length - 1) + "]" : ''; - return attrName + "='$resolve." + resolveName + arrayIdxStr + "(" + args.join(",") + ")'"; + return attrName + "='$resolve." + resolveName + arrayIdxStr + "(" + args.join(',') + ")'"; } // some-attr="::$resolve.someResolveName" return attrName + "='" + prefix + "$resolve." + resolveName + "'"; }; - var attrs = getComponentBindings(component).map(attributeTpl).join(" "); + var attrs = getComponentBindings(component).map(attributeTpl).join(' '); var kebobName = kebob(component); return "<" + kebobName + " " + attrs + ">"; }; - return TemplateFactory; }()); // Gets all the directive(s)' inputs ('@', '=', and '<') and outputs ('&') function getComponentBindings(name) { - var cmpDefs = services.$injector.get(name + "Directive"); // could be multiple + var cmpDefs = services.$injector.get(name + 'Directive'); // could be multiple if (!cmpDefs || !cmpDefs.length) throw new Error("Unable to find component named '" + name + "'"); return cmpDefs.map(getBindings).reduce(unnestR, []); @@ -8406,8 +8403,8 @@ var StateProvider = /** @class */ (function () { * ensures that those hooks are injectable for @uirouter/angularjs (ng1). */ var getStateHookBuilder = function (hookName) { - return function stateHookBuilder(state, parentFn) { - var hook = state[hookName]; + return function stateHookBuilder(stateObject, parentFn) { + var hook = stateObject[hookName]; var pathname = hookName === 'onExit' ? 'from' : 'to'; function decoratedNg1Hook(trans, state) { var resolveContext = new ResolveContext(trans.treeChanges(pathname)); @@ -8434,6 +8431,27 @@ var Ng1LocationServices = /** @class */ (function () { var _lp = val($locationProvider); createProxyFunctions(_lp, this, _lp, ['hashPrefix']); } + /** + * Applys ng1-specific path parameter encoding + * + * The Angular 1 `$location` service is a bit weird. + * It doesn't allow slashes to be encoded/decoded bi-directionally. + * + * See the writeup at https://github.com/angular-ui/ui-router/issues/2598 + * + * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F + * + * @param router + */ + Ng1LocationServices.monkeyPatchPathParameterType = function (router) { + var pathType = router.urlMatcherFactory.type('path'); + pathType.encode = function (x) { + return x != null ? x.toString().replace(/(~|\/)/g, function (m) { return ({ '~': '~~', '/': '~2F' }[m]); }) : x; + }; + pathType.decode = function (x) { + return x != null ? x.toString().replace(/(~~|~2F)/g, function (m) { return ({ '~~': '~', '~2F': '/' }[m]); }) : x; + }; + }; Ng1LocationServices.prototype.dispose = function () { }; Ng1LocationServices.prototype.onChange = function (callback) { var _this = this; @@ -8460,37 +8478,16 @@ var Ng1LocationServices = /** @class */ (function () { this.$location = $location; this.$sniffer = $sniffer; // Bind $locationChangeSuccess to the listeners registered in LocationService.onChange - $rootScope.$on("$locationChangeSuccess", function (evt) { return _this._urlListeners.forEach(function (fn) { return fn(evt); }); }); + $rootScope.$on('$locationChangeSuccess', function (evt) { return _this._urlListeners.forEach(function (fn) { return fn(evt); }); }); var _loc = val($location); var _browser = val($browser); // Bind these LocationService functions to $location - createProxyFunctions(_loc, this, _loc, ["replace", "path", "search", "hash"]); + createProxyFunctions(_loc, this, _loc, ['replace', 'path', 'search', 'hash']); // Bind these LocationConfig functions to $location createProxyFunctions(_loc, this, _loc, ['port', 'protocol', 'host']); // Bind these LocationConfig functions to $browser createProxyFunctions(_browser, this, _browser, ['baseHref']); }; - /** - * Applys ng1-specific path parameter encoding - * - * The Angular 1 `$location` service is a bit weird. - * It doesn't allow slashes to be encoded/decoded bi-directionally. - * - * See the writeup at https://github.com/angular-ui/ui-router/issues/2598 - * - * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F - * - * @param router - */ - Ng1LocationServices.monkeyPatchPathParameterType = function (router) { - var pathType = router.urlMatcherFactory.type('path'); - pathType.encode = function (val) { - return val != null ? val.toString().replace(/(~|\/)/g, function (m) { return ({ '~': '~~', '/': '~2F' }[m]); }) : val; - }; - pathType.decode = function (val) { - return val != null ? val.toString().replace(/(~~|~2F)/g, function (m) { return ({ '~~': '~', '~2F': '/' }[m]); }) : val; - }; - }; return Ng1LocationServices; }()); @@ -8515,6 +8512,11 @@ var UrlRouterProvider = /** @class */ (function () { this._router = router; this._urlRouter = router.urlRouter; } + UrlRouterProvider.injectableHandler = function (router, handler) { + return function (match) { + return services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params }); + }; + }; /** @hidden */ UrlRouterProvider.prototype.$get = function () { var urlRouter = this._urlRouter; @@ -8565,7 +8567,6 @@ var UrlRouterProvider = /** @class */ (function () { this._urlRouter.rule(rule); return this; }; - /** * Defines the path or behavior to use when no url can be matched. * @@ -8606,7 +8607,6 @@ var UrlRouterProvider = /** @class */ (function () { } return this; }; - /** * Registers a handler for a given url matching. * @@ -8652,12 +8652,6 @@ var UrlRouterProvider = /** @class */ (function () { this._urlRouter.when(what, handler); return this; }; - - UrlRouterProvider.injectableHandler = function (router, handler) { - return function (match) { - return services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params }); - }; - }; /** * Disables monitoring of the URL. * @@ -8691,7 +8685,6 @@ var UrlRouterProvider = /** @class */ (function () { UrlRouterProvider.prototype.deferIntercept = function (defer) { this._urlRouter.deferIntercept(defer); }; - return UrlRouterProvider; }()); @@ -8707,7 +8700,7 @@ var UrlRouterProvider = /** @class */ (function () { * @preferred */ /** for typedoc */ -ng.module("ui.router.angular1", []); +ng.module('ui.router.angular1', []); var mod_init = ng.module('ui.router.init', []); var mod_util = ng.module('ui.router.util', ['ng', 'ui.router.init']); var mod_rtr = ng.module('ui.router.router', ['ui.router.util']); @@ -8715,17 +8708,17 @@ var mod_state = ng.module('ui.router.state', ['ui.router.router', 'ui.router.uti var mod_main = ng.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']); var mod_cmpt = ng.module('ui.router.compat', ['ui.router']); // tslint:disable-line var router = null; -$uiRouter.$inject = ['$locationProvider']; +$uiRouterProvider.$inject = ['$locationProvider']; /** This angular 1 provider instantiates a Router and exposes its services via the angular injector */ -function $uiRouter($locationProvider) { +function $uiRouterProvider($locationProvider) { // Create a new instance of the Router when the $uiRouterProvider is initialized router = this.router = new UIRouter(); router.stateProvider = new StateProvider(router.stateRegistry, router.stateService); // Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties - router.stateRegistry.decorator("views", ng1ViewsBuilder); - router.stateRegistry.decorator("onExit", getStateHookBuilder("onExit")); - router.stateRegistry.decorator("onRetain", getStateHookBuilder("onRetain")); - router.stateRegistry.decorator("onEnter", getStateHookBuilder("onEnter")); + router.stateRegistry.decorator('views', ng1ViewsBuilder); + router.stateRegistry.decorator('onExit', getStateHookBuilder('onExit')); + router.stateRegistry.decorator('onRetain', getStateHookBuilder('onRetain')); + router.stateRegistry.decorator('onEnter', getStateHookBuilder('onEnter')); router.viewService._pluginapi._viewConfigFactory('ng1', getNg1ViewConfigFactory()); var ng1LocationService = router.locationService = router.locationConfig = new Ng1LocationServices($locationProvider); Ng1LocationServices.monkeyPatchPathParameterType(router); @@ -8743,7 +8736,7 @@ function $uiRouter($locationProvider) { } var getProviderFor = function (serviceName) { return ['$uiRouterProvider', function ($urp) { var service = $urp.router[serviceName]; - service["$get"] = function () { return service; }; + service['$get'] = function () { return service; }; return service; }]; }; // This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime) @@ -8756,7 +8749,7 @@ function runBlock($injector, $q, $uiRouter) { $uiRouter.stateRegistry.get() .map(function (x) { return x.$$state().resolvables; }) .reduce(unnestR, []) - .filter(function (x) { return x.deps === "deferred"; }) + .filter(function (x) { return x.deps === 'deferred'; }) .forEach(function (resolvable) { return resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi); }); } // $urlRouter service and $urlRouterProvider @@ -8772,7 +8765,7 @@ watchDigests.$inject = ['$rootScope']; function watchDigests($rootScope) { $rootScope.$watch(function () { trace.approximateDigests++; }); } -mod_init.provider("$uiRouter", $uiRouter); +mod_init.provider('$uiRouter', $uiRouterProvider); mod_rtr.provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]); mod_util.provider('$urlService', getProviderFor('urlService')); mod_util.provider('$urlMatcherFactory', ['$uiRouterProvider', function () { return router.urlMatcherFactory; }]); @@ -8783,7 +8776,7 @@ mod_state.provider('$transitions', getProviderFor('transitionService')); mod_state.provider('$state', ['$uiRouterProvider', getStateProvider]); mod_state.factory('$stateParams', ['$uiRouter', function ($uiRouter) { return $uiRouter.globals.params; }]); mod_main.factory('$view', function () { return router.viewService; }); -mod_main.service("$trace", function () { return trace; }); +mod_main.service('$trace', function () { return trace; }); mod_main.run(watchDigests); mod_util.run(['$urlMatcherFactory', function ($urlMatcherFactory) { }]); mod_state.run(['$state', function ($state) { }]); @@ -8800,58 +8793,6 @@ var getLocals = function (ctx) { return tuples.reduce(applyPairs, {}); }; -/** - * # Angular 1 injectable services - * - * This is a list of the objects which can be injected using angular's injector. - * - * There are three different kind of injectable objects: - * - * ## **Provider** objects - * #### injectable into a `.config()` block during configtime - * - * - [[$uiRouterProvider]]: The UI-Router instance - * - [[$stateProvider]]: State registration - * - [[$transitionsProvider]]: Transition hooks - * - [[$urlServiceProvider]]: All URL related public APIs - * - * - [[$uiViewScrollProvider]]: Disable ui-router view scrolling - * - [[$urlRouterProvider]]: (deprecated) Url matching rules - * - [[$urlMatcherFactoryProvider]]: (deprecated) Url parsing config - * - * ## **Service** objects - * #### injectable globally during runtime - * - * - [[$uiRouter]]: The UI-Router instance - * - [[$trace]]: Enable transition trace/debug - * - [[$transitions]]: Transition hooks - * - [[$state]]: Imperative state related APIs - * - [[$stateRegistry]]: State registration - * - [[$urlService]]: All URL related public APIs - * - [[$uiRouterGlobals]]: Global variables - * - [[$uiViewScroll]]: Scroll an element into view - * - * - [[$stateParams]]: (deprecated) Global state param values - * - [[$urlRouter]]: (deprecated) URL synchronization - * - [[$urlMatcherFactory]]: (deprecated) URL parsing config - * - * ## **Per-Transition** objects - * - * - These kind of objects are injectable into: - * - Resolves ([[Ng1StateDeclaration.resolve]]), - * - Transition Hooks ([[TransitionService.onStart]], etc), - * - Routed Controllers ([[Ng1ViewDeclaration.controller]]) - * - * #### Different instances are injected based on the [[Transition]] - * - * - [[$transition$]]: The current Transition object - * - [[$stateParams]]: State param values for pending Transition (deprecated) - * - Any resolve data defined using [[Ng1StateDeclaration.resolve]] - * - * @ng1api - * @preferred - * @module injectables - */ /** */ /** * The current (or pending) State Parameters * @@ -8926,10 +8867,11 @@ var getLocals = function (ctx) { */ /** for typedoc */ /** @hidden */ function parseStateRef(ref) { - var paramsOnly = ref.match(/^\s*({[^}]*})\s*$/), parsed; + var parsed; + var paramsOnly = ref.match(/^\s*({[^}]*})\s*$/); if (paramsOnly) ref = '(' + paramsOnly[1] + ')'; - parsed = ref.replace(/\n/g, " ").match(/^\s*([^(]*?)\s*(\((.*)\))?\s*$/); + parsed = ref.replace(/\n/g, ' ').match(/^\s*([^(]*?)\s*(\((.*)\))?\s*$/); if (!parsed || parsed.length !== 4) throw new Error("Invalid state ref '" + ref + "'"); return { state: parsed[1] || null, paramExpr: parsed[3] || null }; @@ -8951,11 +8893,11 @@ function processedDef($state, $element, def) { function getTypeInfo(el) { // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute. var isSvg = Object.prototype.toString.call(el.prop('href')) === '[object SVGAnimatedString]'; - var isForm = el[0].nodeName === "FORM"; + var isForm = el[0].nodeName === 'FORM'; return { - attr: isForm ? "action" : (isSvg ? 'xlink:href' : 'href'), - isAnchor: el.prop("tagName").toUpperCase() === "A", - clickable: !isForm + attr: isForm ? 'action' : (isSvg ? 'xlink:href' : 'href'), + isAnchor: el.prop('tagName').toUpperCase() === 'A', + clickable: !isForm, }; } /** @hidden */ @@ -8964,15 +8906,15 @@ function clickHook(el, $state, $timeout, type, getDef) { var button = e.which || e.button, target = getDef(); if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || el.attr('target'))) { // HACK: This is to allow ng-clicks to be processed before the transition is initiated: - var transition = $timeout(function () { + var transition_1 = $timeout(function () { $state.go(target.uiState, target.uiStateParams, target.uiStateOpts); }); e.preventDefault(); // if the state has no URL, ignore one preventDefault from the directive. - var ignorePreventDefaultCount = type.isAnchor && !target.href ? 1 : 0; + var ignorePreventDefaultCount_1 = type.isAnchor && !target.href ? 1 : 0; e.preventDefault = function () { - if (ignorePreventDefaultCount-- <= 0) - $timeout.cancel(transition); + if (ignorePreventDefaultCount_1-- <= 0) + $timeout.cancel(transition_1); }; } }; @@ -8982,7 +8924,7 @@ function defaultOpts(el, $state) { return { relative: stateContext(el) || $state.$current, inherit: true, - source: "sref" + source: 'sref', }; } /** @hidden */ @@ -9140,8 +9082,8 @@ function bindEvents(element, scope, hookFn, uiStateOpts) { * - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons). * If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive. */ -var uiSref; -uiSref = ['$uiRouter', '$timeout', +var uiSrefDirective; +uiSrefDirective = ['$uiRouter', '$timeout', function $StateRefDirective($uiRouter, $timeout) { var $state = $uiRouter.stateService; return { @@ -9180,7 +9122,7 @@ uiSref = ['$uiRouter', '$timeout', return; hookFn = clickHook(element, $state, $timeout, type, getDef); bindEvents(element, scope, hookFn, rawDef.uiStateOpts); - } + }, }; }]; /** @@ -9267,8 +9209,8 @@ uiSref = ['$uiRouter', '$timeout', * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example. * ``` */ -var uiState; -uiState = ['$uiRouter', '$timeout', +var uiStateDirective; +uiStateDirective = ['$uiRouter', '$timeout', function $StateRefDynamicDirective($uiRouter, $timeout) { var $state = $uiRouter.stateService; return { @@ -9309,7 +9251,7 @@ uiState = ['$uiRouter', '$timeout', return; hookFn = clickHook(element, $state, $timeout, type, getDef); bindEvents(element, scope, hookFn, rawDef.uiStateOpts); - } + }, }; }]; /** @@ -9393,14 +9335,16 @@ uiState = ['$uiRouter', '$timeout', * * - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'` */ -var uiSrefActive; -uiSrefActive = ['$state', '$stateParams', '$interpolate', '$uiRouter', +var uiSrefActiveDirective; +uiSrefActiveDirective = ['$state', '$stateParams', '$interpolate', '$uiRouter', function $StateRefActiveDirective($state, $stateParams, $interpolate, $uiRouter) { return { - restrict: "A", + restrict: 'A', controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) { - var states = [], activeEqClass, uiSrefActive; + var states = []; + var activeEqClass; + var uiSrefActive; // There probably isn't much point in $observing this // uiSrefActive and uiSrefActiveEq share the same directive object with some // slight difference in logic routing @@ -9445,7 +9389,7 @@ uiSrefActive = ['$state', '$stateParams', '$interpolate', '$uiRouter', var stateInfo = { state: state || { name: stateName }, params: stateParams, - activeClass: activeClass + activeClass: activeClass, }; states.push(stateInfo); return function removeState() { @@ -9472,14 +9416,14 @@ uiSrefActive = ['$state', '$stateParams', '$interpolate', '$uiRouter', }); } update(); - }] + }], }; }]; ng.module('ui.router.state') - .directive('uiSref', uiSref) - .directive('uiSrefActive', uiSrefActive) - .directive('uiSrefActiveEq', uiSrefActive) - .directive('uiState', uiState); + .directive('uiSref', uiSrefDirective) + .directive('uiSrefActive', uiSrefActiveDirective) + .directive('uiSrefActiveEq', uiSrefActiveDirective) + .directive('uiState', uiStateDirective); /** @module ng1 */ /** for typedoc */ /** @@ -9671,7 +9615,7 @@ uiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q', else { $animate.leave(element, cb); } - } + }, }; } function configsEqual(config1, config2) { @@ -9679,7 +9623,7 @@ uiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q', } var rootData = { $cfg: { viewDecl: { $context: $view._pluginapi._rootViewContext() } }, - $uiView: {} + $uiView: {}, }; var directive = { count: 0, @@ -9689,12 +9633,13 @@ uiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q', transclude: 'element', compile: function (tElement, tAttrs, $transclude) { return function (scope, $element, attrs) { - var previousEl, currentEl, currentScope, unregister, onloadExp = attrs['onload'] || '', autoScrollExp = attrs['autoscroll'], renderer = getRenderer(attrs, scope), viewConfig = undefined, inherited = $element.inheritedData('$uiView') || rootData, name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default'; + var onloadExp = attrs['onload'] || '', autoScrollExp = attrs['autoscroll'], renderer = getRenderer(attrs, scope), inherited = $element.inheritedData('$uiView') || rootData, name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default'; + var previousEl, currentEl, currentScope, viewConfig, unregister; var activeUIView = { $type: 'ng1', id: directive.count++, name: name, - fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + "." + name : name, + fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + '.' + name : name, config: null, configUpdated: configUpdatedCallback, get creationContext() { @@ -9703,9 +9648,9 @@ uiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q', // See https://github.com/angular-ui/ui-router/issues/3355 var fromParentTag = parse('$uiView.creationContext')(inherited); return fromParentTagConfig || fromParentTag; - } + }, }; - trace.traceUIViewEvent("Linking", activeUIView); + trace.traceUIViewEvent('Linking', activeUIView); function configUpdatedCallback(config) { if (config && !(config instanceof Ng1ViewConfig)) return; @@ -9718,24 +9663,24 @@ uiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q', $element.data('$uiView', { $uiView: activeUIView }); updateView(); unregister = $view.registerUIView(activeUIView); - scope.$on("$destroy", function () { - trace.traceUIViewEvent("Destroying/Unregistering", activeUIView); + scope.$on('$destroy', function () { + trace.traceUIViewEvent('Destroying/Unregistering', activeUIView); unregister(); }); function cleanupLastView() { if (previousEl) { - trace.traceUIViewEvent("Removing (previous) el", previousEl.data('$uiView')); + trace.traceUIViewEvent('Removing (previous) el', previousEl.data('$uiView')); previousEl.remove(); previousEl = null; } if (currentScope) { - trace.traceUIViewEvent("Destroying scope", activeUIView); + trace.traceUIViewEvent('Destroying scope', activeUIView); currentScope.$destroy(); currentScope = null; } if (currentEl) { var _viewData_1 = currentEl.data('$uiViewAnim'); - trace.traceUIViewEvent("Animate out", _viewData_1); + trace.traceUIViewEvent('Animate out', _viewData_1); renderer.leave(currentEl, function () { _viewData_1.$$animLeave.resolve(); previousEl = null; @@ -9754,7 +9699,7 @@ uiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q', var $uiViewAnim = { $animEnter: animEnter.promise, $animLeave: animLeave.promise, - $$animLeave: animLeave + $$animLeave: animLeave, }; /** * @ngdoc event @@ -9798,7 +9743,7 @@ uiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q', currentScope.$eval(onloadExp); } }; - } + }, }; return directive; }]; @@ -9848,7 +9793,7 @@ function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q, $tim if (isString(cfg.viewDecl.component)) { var cmp_1 = cfg.viewDecl.component; var kebobName = kebobString(cmp_1); - var tagRegexp_1 = new RegExp("^(x-|data-)?" + kebobName + "$", "i"); + var tagRegexp_1 = new RegExp("^(x-|data-)?" + kebobName + "$", 'i'); var getComponentController = function () { var directiveEl = [].slice.call($element[0].children) .filter(function (el) { return el && el.tagName && tagRegexp_1.exec(el.tagName); }); @@ -9863,7 +9808,7 @@ function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q, $tim } link(scope); }; - } + }, }; } /** @hidden */ @@ -9888,8 +9833,8 @@ function registerControllerCallbacks($q, $transitions, controllerInstance, $scop // Exit early if the $transition$ will exit the state the view is for. if ($transition$ === viewCreationTrans_1 || $transition$.exiting().indexOf(viewState) !== -1) return; - var toParams = $transition$.params("to"); - var fromParams = $transition$.params("from"); + var toParams = $transition$.params('to'); + var fromParams = $transition$.params('from'); var toSchema = $transition$.treeChanges().to.map(function (node) { return node.paramSchema; }).reduce(unnestR, []); var fromSchema = $transition$.treeChanges().from.map(function (node) { return node.paramSchema; }).reduce(unnestR, []); // Find the to params that have different values than the from params @@ -9917,7 +9862,8 @@ function registerControllerCallbacks($q, $transitions, controllerInstance, $scop }; // If a user answered yes, but the transition was later redirected, don't also ask for the new redirect transition var wrappedHook = function (trans) { - var promise, ids = trans[cacheProp_1] = trans[cacheProp_1] || {}; + var promise; + var ids = trans[cacheProp_1] = trans[cacheProp_1] || {}; if (!prevTruthyAnswer_1(trans)) { promise = $q.when(controllerInstance.uiCanExit(trans)); promise.then(function (val) { return ids[id_1] = (val !== false); }); @@ -9955,7 +9901,7 @@ ng.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider); * Main entry point for angular 1.x build * @module ng1 */ /** */ -var index = "ui.router"; +var index = 'ui.router'; exports['default'] = index; exports.core = index$1; diff --git a/UI/WebServerResources/js/vendor/angular-ui-router.js.map b/UI/WebServerResources/js/vendor/angular-ui-router.js.map index 8ff32efa3..b0148d339 100644 --- a/UI/WebServerResources/js/vendor/angular-ui-router.js.map +++ b/UI/WebServerResources/js/vendor/angular-ui-router.js.map @@ -20,7 +20,7 @@ "@uirouter/angularjs/node_modules/@uirouter/core/lib-esm/params/@uirouter/core/params/paramType.ts", "@uirouter/angularjs/node_modules/@uirouter/core/lib-esm/params/@uirouter/core/params/param.ts", "@uirouter/angularjs/node_modules/@uirouter/core/lib-esm/path/@uirouter/core/path/pathNode.ts", - "@uirouter/angularjs/node_modules/@uirouter/core/lib-esm/path/@uirouter/core/path/pathFactory.ts", + "@uirouter/angularjs/node_modules/@uirouter/core/lib-esm/path/@uirouter/core/path/pathUtils.ts", "@uirouter/angularjs/node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/resolvable.ts", "@uirouter/angularjs/node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/interface.ts", "@uirouter/angularjs/node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/resolveContext.ts", @@ -85,87 +85,87 @@ "@uirouter/angularjs/src/index.ts" ], "sourcesContent": [ - "/**\n * @hidden\n * @module ng1\n */ /** */\ndeclare var angular;\nimport * as ng_from_import from \"angular\";\nlet ng_from_global = angular;\n\nexport const ng = (ng_from_import && ng_from_import.module) ? ng_from_import : ng_from_global;\n", - "/**\n * Higher order functions\n *\n * These utility functions are exported, but are subject to change without notice.\n *\n * @module common_hof\n */ /** */\n\nimport {Predicate} from \"./common\";\n/**\n * Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function.\n *\n * Given a function with N parameters, returns a new function that supports partial application.\n * The new function accepts anywhere from 1 to N parameters. When that function is called with M parameters,\n * where M is less than N, it returns a new function that accepts the remaining parameters. It continues to\n * accept more parameters until all N parameters have been supplied.\n *\n *\n * This contrived example uses a partially applied function as an predicate, which returns true\n * if an object is found in both arrays.\n * @example\n * ```\n * // returns true if an object is in both of the two arrays\n * function inBoth(array1, array2, object) {\n * return array1.indexOf(object) !== -1 &&\n * array2.indexOf(object) !== 1;\n * }\n * let obj1, obj2, obj3, obj4, obj5, obj6, obj7\n * let foos = [obj1, obj3]\n * let bars = [obj3, obj4, obj5]\n *\n * // A curried \"copy\" of inBoth\n * let curriedInBoth = curry(inBoth);\n * // Partially apply both the array1 and array2\n * let inFoosAndBars = curriedInBoth(foos, bars);\n *\n * // Supply the final argument; since all arguments are\n * // supplied, the original inBoth function is then called.\n * let obj1InBoth = inFoosAndBars(obj1); // false\n *\n * // Use the inFoosAndBars as a predicate.\n * // Filter, on each iteration, supplies the final argument\n * let allObjs = [ obj1, obj2, obj3, obj4, obj5, obj6, obj7 ];\n * let foundInBoth = allObjs.filter(inFoosAndBars); // [ obj3 ]\n *\n * ```\n *\n * Stolen from: http://stackoverflow.com/questions/4394747/javascript-curry-function\n *\n * @param fn\n * @returns {*|function(): (*|any)}\n */\nexport function curry(fn: Function): Function {\n let initial_args = [].slice.apply(arguments, [1]);\n let func_args_length = fn.length;\n\n function curried(args: any[]) {\n if (args.length >= func_args_length)\n return fn.apply(null, args);\n return function () {\n return curried(args.concat([].slice.apply(arguments)));\n };\n }\n return curried(initial_args);\n}\n\n\n\n/**\n * Given a varargs list of functions, returns a function that composes the argument functions, right-to-left\n * given: f(x), g(x), h(x)\n * let composed = compose(f,g,h)\n * then, composed is: f(g(h(x)))\n */\nexport function compose() {\n let args = arguments;\n let start = args.length - 1;\n return function() {\n let i = start, result = args[start].apply(this, arguments);\n while (i--) result = args[i].call(this, result);\n return result;\n };\n}\n\n/**\n * Given a varargs list of functions, returns a function that is composes the argument functions, left-to-right\n * given: f(x), g(x), h(x)\n * let piped = pipe(f,g,h);\n * then, piped is: h(g(f(x)))\n */\nexport function pipe(...funcs: Function[]): (obj: any) => any {\n return compose.apply(null, [].slice.call(arguments).reverse());\n}\n\n/**\n * Given a property name, returns a function that returns that property from an object\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = prop(\"name\");\n * getName(obj) === \"blarg\"\n */\nexport const prop = (name: string) =>\n (obj: any) => obj && obj[name];\n\n/**\n * Given a property name and a value, returns a function that returns a boolean based on whether\n * the passed object has a property that matches the value\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = propEq(\"name\", \"blarg\");\n * getName(obj) === true\n */\nexport const propEq = curry((name: string, val: any, obj: any) => obj && obj[name] === val);\n\n/**\n * Given a dotted property name, returns a function that returns a nested property from an object, or undefined\n * let obj = { id: 1, nestedObj: { foo: 1, name: \"blarg\" }, };\n * let getName = prop(\"nestedObj.name\");\n * getName(obj) === \"blarg\"\n * let propNotFound = prop(\"this.property.doesnt.exist\");\n * propNotFound(obj) === undefined\n */\nexport const parse = (name: string) =>\n pipe.apply(null, name.split(\".\").map(prop));\n\n/**\n * Given a function that returns a truthy or falsey value, returns a\n * function that returns the opposite (falsey or truthy) value given the same inputs\n */\nexport const not: (fn: Predicate) => Predicate = (fn: Predicate) =>\n (...args: any[]) => !fn.apply(null, args);\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if both functions return truthy for the given arguments\n */\nexport function and(fn1: Predicate, fn2: Predicate): Predicate {\n return (...args: any[]) => fn1.apply(null, args) && fn2.apply(null, args);\n}\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if at least one of the functions returns truthy for the given arguments\n */\nexport function or(fn1: Predicate, fn2: Predicate): Predicate {\n return (...args: any[]) => fn1.apply(null, args) || fn2.apply(null, args);\n}\n\n/**\n * Check if all the elements of an array match a predicate function\n *\n * @param fn1 a predicate function `fn1`\n * @returns a function which takes an array and returns true if `fn1` is true for all elements of the array\n */\nexport const all = (fn1: Predicate) =>\n (arr: any[]) => arr.reduce((b, x) => b && !!fn1(x), true) as boolean;\nexport const any = (fn1: Predicate) =>\n (arr: any[]) => arr.reduce((b, x) => b || !!fn1(x), false) as boolean;\n\n/** Given a class, returns a Predicate function that returns true if the object is of that class */\nexport const is = (ctor: { new(...args): T }) =>\n (obj: any): obj is T =>\n (obj != null && obj.constructor === ctor || obj instanceof ctor);\n\n/** Given a value, returns a Predicate function that returns true if another value is === equal to the original value */\nexport const eq: (comp: any) => Predicate = (val: any) => (other: any) =>\n val === other;\n\n/** Given a value, returns a function which returns the value */\nexport const val = (v: T) => () => v;\n\n\n\nexport function invoke(fnName: string): Function;\nexport function invoke(fnName: string, args: any[]): Function;\nexport function invoke(fnName: string, args?: any[]): Function {\n return (obj: any) =>\n obj[fnName].apply(obj, args);\n}\n\n/**\n * Sorta like Pattern Matching (a functional programming conditional construct)\n *\n * See http://c2.com/cgi/wiki?PatternMatching\n *\n * This is a conditional construct which allows a series of predicates and output functions\n * to be checked and then applied. Each predicate receives the input. If the predicate\n * returns truthy, then its matching output function (mapping function) is provided with\n * the input and, then the result is returned.\n *\n * Each combination (2-tuple) of predicate + output function should be placed in an array\n * of size 2: [ predicate, mapFn ]\n *\n * These 2-tuples should be put in an outer array.\n *\n * @example\n * ```\n *\n * // Here's a 2-tuple where the first element is the isString predicate\n * // and the second element is a function that returns a description of the input\n * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];\n *\n * // Second tuple: predicate \"isNumber\", mapfn returns a description\n * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];\n *\n * let third = [ (input) => input === null, (input) => `Oh, null...` ];\n *\n * let fourth = [ (input) => input === undefined, (input) => `notdefined` ];\n *\n * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);\n *\n * console.log(descriptionOf(undefined)); // 'notdefined'\n * console.log(descriptionOf(55)); // '(55) That's a number!'\n * console.log(descriptionOf(\"foo\")); // 'Here's your string foo'\n * ```\n *\n * @param struct A 2D array. Each element of the array should be an array, a 2-tuple,\n * with a Predicate and a mapping/output function\n * @returns {function(any): *}\n */\nexport function pattern(struct: Function[][]): Function {\n return function(x: any) {\n for (var i = 0; i < struct.length; i++) {\n if (struct[i][0](x)) return struct[i][1](x);\n }\n };\n}\n\n", - "/**\n * @coreapi\n * @module core\n */\n/** \n * Matches state names using glob-like pattern strings.\n *\n * Globs can be used in specific APIs including:\n *\n * - [[StateService.is]]\n * - [[StateService.includes]]\n * - The first argument to Hook Registration functions like [[TransitionService.onStart]]\n * - [[HookMatchCriteria]] and [[HookMatchCriterion]]\n *\n * A `Glob` string is a pattern which matches state names.\n * Nested state names are split into segments (separated by a dot) when processing.\n * The state named `foo.bar.baz` is split into three segments ['foo', 'bar', 'baz']\n *\n * Globs work according to the following rules:\n *\n * ### Exact match:\n *\n * The glob `'A.B'` matches the state named exactly `'A.B'`.\n *\n * | Glob |Matches states named|Does not match state named|\n * |:------------|:--------------------|:---------------------|\n * | `'A'` | `'A'` | `'B'` , `'A.C'` |\n * | `'A.B'` | `'A.B'` | `'A'` , `'A.B.C'` |\n * | `'foo'` | `'foo'` | `'FOO'` , `'foo.bar'`|\n *\n * ### Single star (`*`)\n *\n * A single star (`*`) is a wildcard that matches exactly one segment.\n *\n * | Glob |Matches states named |Does not match state named |\n * |:------------|:---------------------|:--------------------------|\n * | `'*'` | `'A'` , `'Z'` | `'A.B'` , `'Z.Y.X'` |\n * | `'A.*'` | `'A.B'` , `'A.C'` | `'A'` , `'A.B.C'` |\n * | `'A.*.*'` | `'A.B.C'` , `'A.X.Y'`| `'A'`, `'A.B'` , `'Z.Y.X'`|\n *\n * ### Double star (`**`)\n *\n * A double star (`'**'`) is a wildcard that matches *zero or more segments*\n *\n * | Glob |Matches states named |Does not match state named |\n * |:------------|:----------------------------------------------|:----------------------------------|\n * | `'**'` | `'A'` , `'A.B'`, `'Z.Y.X'` | (matches all states) |\n * | `'A.**'` | `'A'` , `'A.B'` , `'A.C.X'` | `'Z.Y.X'` |\n * | `'**.X'` | `'X'` , `'A.X'` , `'Z.Y.X'` | `'A'` , `'A.login.Z'` |\n * | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` |\n *\n */\nexport class Glob {\n text: string;\n glob: Array;\n regexp: RegExp;\n\n constructor(text: string) {\n this.text = text;\n this.glob = text.split('.');\n\n let regexpString = this.text.split('.')\n .map(seg => {\n if (seg === '**') return '(?:|(?:\\\\.[^.]*)*)';\n if (seg === '*') return '\\\\.[^.]*';\n return '\\\\.' + seg;\n }).join('');\n\n this.regexp = new RegExp(\"^\" + regexpString + \"$\");\n }\n\n matches(name: string) {\n return this.regexp.test('.' + name);\n }\n\n /** Returns true if the string has glob-like characters in it */\n static is(text: string) {\n return !!/[!,*]+/.exec(text);\n }\n\n /** Returns a glob from the string, or null if the string isn't Glob-like */\n static fromString(text: string) {\n return Glob.is(text) ? new Glob(text) : null;\n }\n}\n", - "/**\n * @coreapi\n * @module state\n */\n/** for typedoc */\nimport { StateDeclaration, _ViewDeclaration, _StateDeclaration, LazyLoadResult } from \"./interface\";\nimport { defaults, values, find, inherit } from \"../common/common\";\nimport { propEq } from \"../common/hof\";\nimport { Param } from \"../params/param\";\nimport { UrlMatcher } from \"../url/urlMatcher\";\nimport { Resolvable } from \"../resolve/resolvable\";\nimport { TransitionStateHookFn } from \"../transition/interface\";\nimport { TargetState } from \"./targetState\";\nimport { Transition } from \"../transition/transition\";\nimport { Glob } from \"../common/glob\";\nimport { isObject, isFunction } from \"../common/predicates\";\n\n/**\n * Internal representation of a UI-Router state.\n *\n * Instances of this class are created when a [[StateDeclaration]] is registered with the [[StateRegistry]].\n *\n * A registered [[StateDeclaration]] is augmented with a getter ([[StateDeclaration.$$state]]) which returns the corresponding [[StateObject]] object.\n *\n * This class prototypally inherits from the corresponding [[StateDeclaration]].\n * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]].\n */\nexport class StateObject {\n /** The parent [[StateObject]] */\n public parent: StateObject;\n\n /** The name used to register the state */\n public name: string;\n\n /** Prototypally inherits from [[StateDeclaration.abstract]] */\n public abstract: boolean;\n\n /** Prototypally inherits from [[StateDeclaration.resolve]] */\n public resolve: ({ [key: string]: (string|any[]|Function) }|any[]);\n\n /** A list of [[Resolvable]] objects. The internal representation of [[resolve]]. */\n public resolvables: Resolvable[];\n\n /** Prototypally inherits from [[StateDeclaration.resolvePolicy]] */\n public resolvePolicy: any;\n\n /** A compiled URLMatcher which detects when the state's URL is matched */\n public url: UrlMatcher;\n\n /** The parameters for the state, built from the URL and [[StateDeclaration.params]] */\n public params: { [key: string]: Param };\n\n /**\n * The views for the state.\n * Note: `@uirouter/core` does not register a builder for views.\n * The framework specific code should register a `views` builder.\n */\n public views: { [key: string]: _ViewDeclaration; };\n\n /**\n * The original [[StateDeclaration]] used to build this [[StateObject]].\n * Note: `this` object also prototypally inherits from the `self` declaration object.\n */\n public self: StateDeclaration;\n\n /** The nearest parent [[StateObject]] which has a URL */\n public navigable: StateObject;\n\n /** The parent [[StateObject]] objects from this state up to the root */\n public path: StateObject[];\n\n /**\n * Prototypally inherits from [[StateDeclaration.data]]\n * Note: This is the only field on the [[StateDeclaration]] which is mutated.\n * The definition object's `data` field is replaced with a new object\n * which prototypally inherits from the parent state definition's `data` field.\n */\n public data: any;\n\n /** \n * An object containing the parent States' names as keys and \n * true as their values.\n */\n public includes: { [name: string]: boolean };\n\n /** Prototypally inherits from [[StateDeclaration.onExit]] */\n public onExit: TransitionStateHookFn;\n /** Prototypally inherits from [[StateDeclaration.onRetain]] */\n public onRetain: TransitionStateHookFn;\n /** Prototypally inherits from [[StateDeclaration.onEnter]] */\n public onEnter: TransitionStateHookFn;\n\n /** Prototypally inherits from [[StateDeclaration.lazyLoad]] */\n public lazyLoad: (transition: Transition, state: StateDeclaration) => Promise;\n\n /** Prototypally inherits from [[StateDeclaration.redirectTo]] */\n redirectTo: (\n string |\n (($transition$: Transition) => TargetState) |\n { state: (string|StateDeclaration), params: { [key: string]: any }}\n );\n\n /** @hidden */\n __stateObjectCache: {\n /** Might be null */\n nameGlob?: Glob\n };\n\n\n /** @deprecated use State.create() */\n constructor(config?: StateDeclaration) {\n return StateObject.create(config || {});\n }\n\n /**\n * Create a state object to put the private/internal implementation details onto.\n * The object's prototype chain looks like:\n * (Internal State Object) -> (Copy of State.prototype) -> (State Declaration object) -> (State Declaration's prototype...)\n *\n * @param stateDecl the user-supplied State Declaration\n * @returns {StateObject} an internal State object\n */\n static create(stateDecl: _StateDeclaration): StateObject {\n stateDecl = StateObject.isStateClass(stateDecl) ? new stateDecl() : stateDecl;\n\n let state = inherit(inherit(stateDecl, StateObject.prototype)) as StateObject;\n stateDecl.$$state = () => state;\n state.self = stateDecl;\n state.__stateObjectCache = {\n nameGlob: Glob.fromString(state.name) // might return null\n };\n return state;\n }\n\n /** Predicate which returns true if the object is an class with @State() decorator */\n static isStateClass = (stateDecl: _StateDeclaration): stateDecl is ({ new (): StateDeclaration }) =>\n isFunction(stateDecl) && stateDecl['__uiRouterState'] === true;\n\n /** Predicate which returns true if the object is an internal [[StateObject]] object */\n static isState = (obj: any): obj is StateObject =>\n isObject(obj['__stateObjectCache']);\n\n /**\n * Returns true if the provided parameter is the same state.\n *\n * Compares the identity of the state against the passed value, which is either an object\n * reference to the actual `State` instance, the original definition object passed to\n * `$stateProvider.state()`, or the fully-qualified name.\n *\n * @param ref Can be one of (a) a `State` instance, (b) an object that was passed\n * into `$stateProvider.state()`, (c) the fully-qualified name of a state as a string.\n * @returns Returns `true` if `ref` matches the current `State` instance.\n */\n is(ref: StateObject|StateDeclaration|string): boolean {\n return this === ref || this.self === ref || this.fqn() === ref;\n }\n\n /**\n * @deprecated this does not properly handle dot notation\n * @returns Returns a dot-separated name of the state.\n */\n fqn(): string {\n if (!this.parent || !(this.parent instanceof this.constructor)) return this.name;\n let name = this.parent.fqn();\n return name ? name + \".\" + this.name : this.name;\n }\n\n /**\n * Returns the root node of this state's tree.\n *\n * @returns The root of this state's tree.\n */\n root(): StateObject {\n return this.parent && this.parent.root() || this;\n }\n\n /**\n * Gets the state's `Param` objects\n *\n * Gets the list of [[Param]] objects owned by the state.\n * If `opts.inherit` is true, it also includes the ancestor states' [[Param]] objects.\n * If `opts.matchingKeys` exists, returns only `Param`s whose `id` is a key on the `matchingKeys` object\n *\n * @param opts options\n */\n parameters(opts?: { inherit?: boolean, matchingKeys?: any }): Param[] {\n opts = defaults(opts, { inherit: true, matchingKeys: null });\n let inherited = opts.inherit && this.parent && this.parent.parameters() || [];\n return inherited.concat(values(this.params))\n .filter(param => !opts.matchingKeys || opts.matchingKeys.hasOwnProperty(param.id));\n }\n\n /**\n * Returns a single [[Param]] that is owned by the state\n *\n * If `opts.inherit` is true, it also searches the ancestor states` [[Param]]s.\n * @param id the name of the [[Param]] to return\n * @param opts options\n */\n parameter(id: string, opts: { inherit?: boolean } = {}): Param {\n return (\n this.url && this.url.parameter(id, opts) ||\n find(values(this.params), propEq('id', id)) ||\n opts.inherit && this.parent && this.parent.parameter(id)\n );\n }\n\n toString() {\n return this.fqn();\n }\n}\n", - "/** Predicates\n *\n * These predicates return true/false based on the input.\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_predicates\n */\n/** */\nimport { and, not, pipe, prop, or } from \"./hof\";\nimport { Predicate } from \"./common\"; // has or is using\nimport { StateObject } from \"../state/stateObject\";\n\nconst toStr = Object.prototype.toString;\nconst tis = (t: string) => (x: any) => typeof(x) === t;\nexport const isUndefined = tis('undefined');\nexport const isDefined = not(isUndefined);\nexport const isNull = (o: any) => o === null;\nexport const isNullOrUndefined = or(isNull, isUndefined);\nexport const isFunction: (x: any) => x is Function = tis('function');\nexport const isNumber: (x: any) => x is number = tis('number');\nexport const isString = <(x: any) => x is string> tis('string');\nexport const isObject = (x: any) => x !== null && typeof x === 'object';\nexport const isArray = Array.isArray;\nexport const isDate: (x: any) => x is Date = ((x: any) => toStr.call(x) === '[object Date]');\nexport const isRegExp: (x: any) => x is RegExp = ((x: any) => toStr.call(x) === '[object RegExp]');\nexport const isState: (x: any) => x is StateObject = StateObject.isState;\n\n/**\n * Predicate which checks if a value is injectable\n *\n * A value is \"injectable\" if it is a function, or if it is an ng1 array-notation-style array\n * where all the elements in the array are Strings, except the last one, which is a Function\n */\nexport function isInjectable(val: any) {\n if (isArray(val) && val.length) {\n let head = val.slice(0, -1), tail = val.slice(-1);\n return !(head.filter(not(isString)).length || tail.filter(not(isFunction)).length);\n }\n return isFunction(val);\n}\n\n/**\n * Predicate which checks if a value looks like a Promise\n *\n * It is probably a Promise if it's an object, and it has a `then` property which is a Function\n */\nexport const isPromise = <(x: any) => x is Promise> and(isObject, pipe(prop('then'), isFunction));\n\n", - "/**\n * This module is a stub for core services such as Dependency Injection or Browser Location.\n * Core services may be implemented by a specific framework, such as ng1 or ng2, or be pure javascript.\n *\n * @module common\n */\n/** for typedoc */\nimport {IInjectable, Obj} from \"./common\";\nimport { Disposable } from \"../interface\";\nimport { UrlParts } from \"../url/interface\";\n\nexport let notImplemented = (fnname: string) => () => {\n throw new Error(`${fnname}(): No coreservices implementation for UI-Router is loaded.`);\n};\n\nlet services: CoreServices = {\n $q: undefined,\n $injector: undefined,\n};\n\nexport interface $QLikeDeferred {\n resolve: (val?: any) => void;\n reject: (reason?: any) => void;\n promise: Promise;\n}\n\nexport interface $QLike {\n when(value?: T | PromiseLike): Promise;\n reject(reason: any): Promise;\n defer(): $QLikeDeferred;\n all(promises: { [key: string]: Promise }): Promise;\n all(promises: Promise[]): Promise;\n}\n\nexport interface $InjectorLike {\n get(token: any): any;\n get(token: any): T;\n has(token: any): boolean;\n invoke(fn: IInjectable, context?: any, locals?: Obj): any;\n annotate(fn: IInjectable, strictDi?: boolean): any[];\n strictDi?: boolean;\n}\n\nexport interface CoreServices {\n $q: $QLike;\n $injector: $InjectorLike;\n}\n\nexport interface LocationServices extends Disposable {\n /**\n * Gets the current url string\n *\n * The URL is normalized using the internal [[path]]/[[search]]/[[hash]] values.\n *\n * For example, the URL may be stored in the hash ([[HashLocationServices]]) or\n * have a base HREF prepended ([[PushStateLocationServices]]).\n *\n * The raw URL in the browser might be:\n *\n * ```\n * http://mysite.com/somepath/index.html#/internal/path/123?param1=foo#anchor\n * ```\n *\n * or\n *\n * ```\n * http://mysite.com/basepath/internal/path/123?param1=foo#anchor\n * ```\n *\n * then this method returns:\n *\n * ```\n * /internal/path/123?param1=foo#anchor\n * ```\n *\n *\n * #### Example:\n * ```js\n * locationServices.url(); // \"/some/path?query=value#anchor\"\n * ```\n *\n * @returns the current value of the url, as a string.\n */\n url(): string;\n\n /**\n * Updates the url, or gets the current url\n *\n * Updates the url, changing it to the value in `newurl`\n *\n * #### Example:\n * ```js\n * locationServices.url(\"/some/path?query=value#anchor\", true);\n * ```\n *\n * @param newurl The new value for the URL.\n * This url should reflect only the new internal [[path]], [[search]], and [[hash]] values.\n * It should not include the protocol, site, port, or base path of an absolute HREF.\n * @param replace When true, replaces the current history entry (instead of appending it) with this new url\n * @param state The history's state object, i.e., pushState (if the LocationServices implementation supports it)\n * @return the url (after potentially being processed)\n */\n url(newurl: string, replace?: boolean, state?: any): string;\n\n /**\n * Gets the path part of the current url\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`\n *\n * @return the path portion of the url\n */\n path(): string;\n\n /**\n * Gets the search part of the current url as an object\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`\n *\n * @return the search (querystring) portion of the url, as an object\n */\n search(): { [key: string]: any };\n\n /**\n * Gets the hash part of the current url\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `anchor`\n *\n * @return the hash (anchor) portion of the url\n */\n hash(): string;\n\n /**\n * Registers a url change handler\n *\n * #### Example:\n * ```js\n * let deregisterFn = locationServices.onChange((evt) => console.log(\"url change\", evt));\n * ```\n *\n * @param callback a function that will be called when the url is changing\n * @return a function that de-registers the callback\n */\n onChange(callback: Function): Function;\n}\n\n/**\n * This service returns the location configuration\n *\n * This service returns information about the location configuration.\n * This service is primarily used when building URLs (e.g., for `hrefs`)\n */\nexport interface LocationConfig extends Disposable {\n /**\n * Gets the port, e.g., `80`\n *\n * @return the port number\n */\n port(): number;\n /**\n * Gets the protocol, e.g., `http`\n *\n * @return the protocol\n */\n protocol(): string;\n /**\n * Gets the host, e.g., `localhost`\n *\n * @return the protocol\n */\n host(): string;\n /**\n * Gets the base Href, e.g., `http://localhost/approot/`\n *\n * @return the application's base href\n */\n baseHref(): string;\n /**\n * Returns true when running in pushstate mode\n *\n * @return true when running in pushstate mode\n */\n html5Mode(): boolean;\n /**\n * Gets the hashPrefix (when not running in pushstate mode)\n *\n * If the current url is `http://localhost/app#!/uirouter/path/#anchor`, it returns `!` which is the prefix for the \"hashbang\" portion.\n *\n * @return the hash prefix\n */\n hashPrefix(): string;\n /**\n * Sets the hashPrefix (when not running in pushstate mode)\n *\n * @return the new hash prefix\n */\n hashPrefix(newprefix: string): string;\n}\n\nexport {services};\n", - "/**\n * Random utility functions used in the UI-Router code\n *\n * These functions are exported, but are subject to change without notice.\n *\n * @preferred\n * @module common\n */\n/** for typedoc */\nimport { isFunction, isString, isArray, isRegExp, isDate } from \"./predicates\";\nimport { all, any, prop, curry, not } from \"./hof\";\nimport { services } from \"./coreservices\";\nimport { StateObject } from \"../state/stateObject\";\n\ndeclare const global;\nexport const root: any = (typeof self === 'object' && self.self === self && self) ||\n (typeof global === 'object' && global.global === global && global) || this;\nconst angular = root.angular || {};\n\nexport const fromJson = angular.fromJson || JSON.parse.bind(JSON);\nexport const toJson = angular.toJson || JSON.stringify.bind(JSON);\nexport const forEach = angular.forEach || _forEach;\nexport const extend = Object.assign || _extend;\nexport const equals = angular.equals || _equals;\nexport function identity(x: any) { return x; }\nexport function noop(): any {}\n\nexport type Mapper = (x: X, key?: (string|number)) => T;\nexport interface TypedMap { [key: string]: T; }\nexport type Predicate = (x?: X) => boolean;\n/**\n * An ng1-style injectable\n *\n * This could be a (non-minified) function such as:\n * ```js\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an explicitly annotated function (minify safe)\n * ```js\n * injectableFunction.$inject = [ 'SomeDependency' ];\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an array style annotated function (minify safe)\n * ```js\n * ['SomeDependency', function injectableFunction(SomeDependency) {\n *\n * }];\n * ```\n *\n * @publicapi\n */\nexport type IInjectable = (Function|any[]);\n\nexport interface Obj extends Object {\n [key: string]: any;\n}\n\n/**\n * Builds proxy functions on the `to` object which pass through to the `from` object.\n *\n * For each key in `fnNames`, creates a proxy function on the `to` object.\n * The proxy function calls the real function on the `from` object.\n *\n *\n * #### Example:\n * This example creates an new class instance whose functions are prebound to the new'd object.\n * ```js\n * class Foo {\n * constructor(data) {\n * // Binds all functions from Foo.prototype to 'this',\n * // then copies them to 'this'\n * bindFunctions(Foo.prototype, this, this);\n * this.data = data;\n * }\n *\n * log() {\n * console.log(this.data);\n * }\n * }\n *\n * let myFoo = new Foo([1,2,3]);\n * var logit = myFoo.log;\n * logit(); // logs [1, 2, 3] from the myFoo 'this' instance\n * ```\n *\n * #### Example:\n * This example creates a bound version of a service function, and copies it to another object\n * ```\n *\n * var SomeService = {\n * this.data = [3, 4, 5];\n * this.log = function() {\n * console.log(this.data);\n * }\n * }\n *\n * // Constructor fn\n * function OtherThing() {\n * // Binds all functions from SomeService to SomeService,\n * // then copies them to 'this'\n * bindFunctions(SomeService, this, SomeService);\n * }\n *\n * let myOtherThing = new OtherThing();\n * myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this'\n * ```\n *\n * @param source A function that returns the source object which contains the original functions to be bound\n * @param target A function that returns the target object which will receive the bound functions\n * @param bind A function that returns the object which the functions will be bound to\n * @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object)\n * @param latebind If true, the binding of the function is delayed until the first time it's invoked\n */\nexport function createProxyFunctions(source: Function, target: Obj, bind: Function, fnNames?: string[], latebind = false): Obj {\n const bindFunction = (fnName) =>\n source()[fnName].bind(bind());\n\n const makeLateRebindFn = fnName => function lateRebindFunction() {\n target[fnName] = bindFunction(fnName);\n return target[fnName].apply(null, arguments);\n };\n\n fnNames = fnNames || Object.keys(source());\n\n return fnNames.reduce((acc, name) => {\n acc[name] = latebind ? makeLateRebindFn(name) : bindFunction(name);\n return acc;\n }, target);\n}\n\n\n/**\n * prototypal inheritance helper.\n * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it\n */\nexport const inherit = (parent: Obj, extra?: Obj) =>\n extend(Object.create(parent), extra);\n\n/** Given an array, returns true if the object is found in the array, (using indexOf) */\nexport const inArray: typeof _inArray = curry(_inArray) as any;\nexport function _inArray(array: any[], obj: any): boolean;\nexport function _inArray(array: any[]): (obj: any) => boolean;\nexport function _inArray(array, obj?): any {\n return array.indexOf(obj) !== -1;\n}\n\n/**\n * Given an array, and an item, if the item is found in the array, it removes it (in-place).\n * The same array is returned\n */\nexport const removeFrom: typeof _removeFrom = curry(_removeFrom) as any;\nexport function _removeFrom(array: T[], obj: T): T[];\nexport function _removeFrom(array: T[]): (obj: T) => T[];\nexport function _removeFrom(array, obj?) {\n let idx = array.indexOf(obj);\n if (idx >= 0) array.splice(idx, 1);\n return array;\n}\n\n/** pushes a values to an array and returns the value */\nexport const pushTo: typeof _pushTo = curry(_pushTo) as any;\nexport function _pushTo(arr: T[], val: T): T ;\nexport function _pushTo(arr: T[]): (val: T) => T ;\nexport function _pushTo(arr, val?): any {\n return (arr.push(val), val);\n}\n\n/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */\nexport const deregAll = (functions: Function[]) =>\n functions.slice().forEach(fn => {\n typeof fn === 'function' && fn();\n removeFrom(functions, fn);\n });\n/**\n * Applies a set of defaults to an options object. The options object is filtered\n * to only those properties of the objects in the defaultsList.\n * Earlier objects in the defaultsList take precedence when applying defaults.\n */\nexport function defaults(opts, ...defaultsList: Obj[]) {\n let _defaultsList = defaultsList.concat({}).reverse();\n let defaultVals = extend.apply(null, _defaultsList);\n return extend({}, defaultVals, pick(opts || {}, Object.keys(defaultVals)));\n}\n\n/** Reduce function that merges each element of the list into a single object, using extend */\nexport const mergeR = (memo: Obj, item: Obj) => extend(memo, item);\n\n/**\n * Finds the common ancestor path between two states.\n *\n * @param {Object} first The first state.\n * @param {Object} second The second state.\n * @return {Array} Returns an array of state names in descending order, not including the root.\n */\nexport function ancestors(first: StateObject, second: StateObject) {\n let path: StateObject[] = [];\n\n for (let n in first.path) {\n if (first.path[n] !== second.path[n]) break;\n path.push(first.path[n]);\n }\n return path;\n}\n\n/**\n * Return a copy of the object only containing the whitelisted properties.\n *\n * #### Example:\n * ```\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the whitelisted property names\n */\nexport function pick(obj: Obj, propNames: string[]): Obj {\n let objCopy = {};\n for (let prop in obj) {\n if (propNames.indexOf(prop) !== -1) {\n objCopy[prop] = obj[prop];\n }\n }\n return objCopy;\n}\n\n/**\n * Return a copy of the object omitting the blacklisted properties.\n *\n * @example\n * ```\n *\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = omit(foo, ['a', 'b']); // { c: 3 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the blacklisted property names\n */\nexport function omit(obj: Obj, propNames: string[]): Obj {\n return Object.keys(obj)\n .filter(not(inArray(propNames)))\n .reduce((acc, key) => (acc[key] = obj[key], acc), {});\n}\n\n\n/** Given an array of objects, maps each element to a named property of the element. */\nexport function pluck(collection: Obj[], propName: string): T[];\n/** Given an object, maps each property of the object to a named property of the property. */\nexport function pluck(collection: { [key: string]: any }, propName: string): { [key: string]: any };\n/**\n * Maps an array, or object to a property (by name)\n */\nexport function pluck(collection: any, propName: string): any {\n return map(collection, > prop(propName));\n}\n\n\n/** Given an array of objects, returns a new array containing only the elements which passed the callback predicate */\nexport function filter(collection: T[], callback: (t: T, key?: number) => boolean): T[];\n/** Given an object, returns a new object with only those properties that passed the callback predicate */\nexport function filter(collection: TypedMap, callback: (t: T, key?: string) => boolean): TypedMap;\n/** Filters an Array or an Object's properties based on a predicate */\nexport function filter(collection: any, callback: Function): T {\n let arr = isArray(collection), result: any = arr ? [] : {};\n let accept = arr ? x => result.push(x) : (x, key) => result[key] = x;\n forEach(collection, function(item, i) {\n if (callback(item, i)) accept(item, i);\n });\n return result;\n}\n\n\n/** Given an object, return the first property of that object which passed the callback predicate */\nexport function find(collection: TypedMap, callback: Predicate): T;\n/** Given an array of objects, returns the first object which passed the callback predicate */\nexport function find(collection: T[], callback: Predicate): T;\n/** Finds an object from an array, or a property of an object, that matches a predicate */\nexport function find(collection: any, callback: any) {\n let result;\n\n forEach(collection, function(item, i) {\n if (result) return;\n if (callback(item, i)) result = item;\n });\n\n return result;\n}\n\n/** Given an object, returns a new object, where each property is transformed by the callback function */\nexport let mapObj: (collection: { [key: string]: T }, callback: Mapper) => { [key: string]: U } = map;\n/** Given an array, returns a new array, where each element is transformed by the callback function */\nexport function map(collection: T[], callback: Mapper): U[];\nexport function map(collection: { [key: string]: T }, callback: Mapper): { [key: string]: U };\n/** Maps an array or object properties using a callback function */\nexport function map(collection: any, callback: any): any {\n let result = isArray(collection) ? [] : {};\n forEach(collection, (item, i) => result[i] = callback(item, i));\n return result;\n}\n\n/**\n * Given an object, return its enumerable property values\n *\n * @example\n * ```\n *\n * let foo = { a: 1, b: 2, c: 3 }\n * let vals = values(foo); // [ 1, 2, 3 ]\n * ```\n */\nexport const values: ( (obj: TypedMap) => T[]) = (obj: Obj) =>\n Object.keys(obj).map(key => obj[key]);\n\n/**\n * Reduce function that returns true if all of the values are truthy.\n *\n * @example\n * ```\n *\n * let vals = [ 1, true, {}, \"hello world\"];\n * vals.reduce(allTrueR, true); // true\n *\n * vals.push(0);\n * vals.reduce(allTrueR, true); // false\n * ```\n */\nexport const allTrueR = (memo: boolean, elem: any) => memo && elem;\n\n/**\n * Reduce function that returns true if any of the values are truthy.\n *\n * * @example\n * ```\n *\n * let vals = [ 0, null, undefined ];\n * vals.reduce(anyTrueR, true); // false\n *\n * vals.push(\"hello world\");\n * vals.reduce(anyTrueR, true); // true\n * ```\n */\nexport const anyTrueR = (memo: boolean, elem: any) => memo || elem;\n\n/**\n * Reduce function which un-nests a single level of arrays\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnestR = (memo: any[], elem: any[]) => memo.concat(elem);\n\n/**\n * Reduce function which recursively un-nests all arrays\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flattenR = (memo: any[], elem: any) =>\n isArray(elem) ? memo.concat(elem.reduce(flattenR, [])) : pushR(memo, elem);\n\n/**\n * Reduce function that pushes an object to an array, then returns the array.\n * Mostly just for [[flattenR]] and [[uniqR]]\n */\nexport function pushR(arr: any[], obj: any) {\n arr.push(obj);\n return arr;\n}\n\n/** Reduce function that filters out duplicates */\nexport const uniqR = (acc: T[], token: T): T[] =>\n inArray(acc, token) ? acc : pushR(acc, token);\n\n/**\n * Return a new array with a single level of arrays unnested.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * unnest(input) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnest = (arr: any[]) => arr.reduce(unnestR, []);\n/**\n * Return a completely flattened version of an array.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * flatten(input) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flatten = (arr: any[]) => arr.reduce(flattenR, []);\n\n/**\n * Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass.\n * @example\n * ```\n *\n * let isNumber = (obj) => typeof(obj) === 'number';\n * let allNumbers = [ 1, 2, 3, 4, 5 ];\n * allNumbers.filter(assertPredicate(isNumber)); //OK\n *\n * let oneString = [ 1, 2, 3, 4, \"5\" ];\n * oneString.filter(assertPredicate(isNumber, \"Not all numbers\")); // throws Error(\"\"Not all numbers\"\");\n * ```\n */\nexport const assertPredicate: (predicate: Predicate, errMsg: (string|Function)) => Predicate = assertFn;\n/**\n * Given a .map function, builds a .map function which throws an error if any mapped elements do not pass a truthyness test.\n * @example\n * ```\n *\n * var data = { foo: 1, bar: 2 };\n *\n * let keys = [ 'foo', 'bar' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // values is [1, 2]\n *\n * let keys = [ 'foo', 'bar', 'baz' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // throws Error(\"Key not found\")\n * ```\n */\nexport const assertMap: (mapFn: (t: T) => U, errMsg: (string|Function)) => (t: T) => U = assertFn;\nexport function assertFn(predicateOrMap: Function, errMsg: (string|Function) = \"assert failure\"): any {\n return (obj) => {\n let result = predicateOrMap(obj);\n if (!result) {\n throw new Error(isFunction(errMsg) ? ( errMsg)(obj) : errMsg);\n }\n return result;\n };\n}\n\n/**\n * Like _.pairs: Given an object, returns an array of key/value pairs\n *\n * @example\n * ```\n *\n * pairs({ foo: \"FOO\", bar: \"BAR }) // [ [ \"foo\", \"FOO\" ], [ \"bar\": \"BAR\" ] ]\n * ```\n */\nexport const pairs = (obj: Obj) =>\n Object.keys(obj).map(key => [ key, obj[key]] );\n\n/**\n * Given two or more parallel arrays, returns an array of tuples where\n * each tuple is composed of [ a[i], b[i], ... z[i] ]\n *\n * @example\n * ```\n *\n * let foo = [ 0, 2, 4, 6 ];\n * let bar = [ 1, 3, 5, 7 ];\n * let baz = [ 10, 30, 50, 70 ];\n * arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ]\n * arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ]\n * ```\n */\nexport function arrayTuples(...args: any[]): any[] {\n if (args.length === 0) return [];\n let maxArrayLen = args.reduce((min, arr) => Math.min(arr.length, min), 9007199254740991); // aka 2^53 − 1 aka Number.MAX_SAFE_INTEGER\n\n let i, result = [];\n\n for (i = 0; i < maxArrayLen; i++) {\n // This is a hot function\n // Unroll when there are 1-4 arguments\n switch (args.length) {\n case 1: result.push([args[0][i]]); break;\n case 2: result.push([args[0][i], args[1][i]]); break;\n case 3: result.push([args[0][i], args[1][i], args[2][i]]); break;\n case 4: result.push([args[0][i], args[1][i], args[2][i], args[3][i]]); break;\n default:\n result.push(args.map(array => array[i])); break;\n }\n }\n\n return result;\n}\n\n/**\n * Reduce function which builds an object from an array of [key, value] pairs.\n *\n * Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration.\n *\n * Each keyValueTuple should be an array with values [ key: string, value: any ]\n *\n * @example\n * ```\n *\n * var pairs = [ [\"fookey\", \"fooval\"], [\"barkey\", \"barval\"] ]\n *\n * var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n *\n * // Or, more simply:\n * var pairsToObj = pairs.reduce(applyPairs, {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n * ```\n */\nexport function applyPairs(memo: TypedMap, keyValTuple: any[]) {\n let key: string, value: any;\n if (isArray(keyValTuple)) [key, value] = keyValTuple;\n if (!isString(key)) throw new Error(\"invalid parameters to applyPairs\");\n memo[key] = value;\n return memo;\n}\n\n/** Get the last element of an array */\nexport function tail(arr: T[]): T {\n return arr.length && arr[arr.length - 1] || undefined;\n}\n\n/**\n * shallow copy from src to dest\n */\nexport function copy(src: Obj, dest?: Obj) {\n if (dest) Object.keys(dest).forEach(key => delete dest[key]);\n if (!dest) dest = {};\n return extend(dest, src);\n}\n\n/** Naive forEach implementation works with Objects or Arrays */\nfunction _forEach(obj: (any[]|any), cb: (el, idx?) => void, _this: Obj) {\n if (isArray(obj)) return obj.forEach(cb, _this);\n Object.keys(obj).forEach(key => cb(obj[key], key));\n}\n\n/** Like Object.assign() */\nexport function _extend(toObj: Obj, ...fromObjs: Obj[]): any;\nexport function _extend(toObj: Obj): any {\n for (let i = 1; i < arguments.length; i++) {\n let obj = arguments[i];\n if (!obj) continue;\n let keys = Object.keys(obj);\n\n for (let j = 0; j < keys.length; j++) {\n toObj[keys[j]] = obj[keys[j]];\n }\n }\n\n return toObj;\n}\n\nfunction _equals(o1: any, o2: any): boolean {\n if (o1 === o2) return true;\n if (o1 === null || o2 === null) return false;\n if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN\n let t1 = typeof o1, t2 = typeof o2;\n if (t1 !== t2 || t1 !== 'object') return false;\n\n const tup = [o1, o2];\n if (all(isArray)(tup)) return _arraysEq(o1, o2);\n if (all(isDate)(tup)) return o1.getTime() === o2.getTime();\n if (all(isRegExp)(tup)) return o1.toString() === o2.toString();\n if (all(isFunction)(tup)) return true; // meh\n\n let predicates = [isFunction, isArray, isDate, isRegExp];\n if (predicates.map(any).reduce((b, fn) => b || !!fn(tup), false)) return false;\n\n let key: string, keys: { [i: string]: boolean } = {};\n for (key in o1) {\n if (!_equals(o1[key], o2[key])) return false;\n keys[key] = true;\n }\n for (key in o2) {\n if (!keys[key]) return false;\n }\n\n return true;\n}\n\nfunction _arraysEq(a1: any[], a2: any[]) {\n if (a1.length !== a2.length) return false;\n return arrayTuples(a1, a2).reduce((b, t) => b && _equals(t[0], t[1]), true);\n}\n\n// issue #2676\nexport const silenceUncaughtInPromise = (promise: Promise) =>\n promise.catch(e => 0) && promise;\nexport const silentRejection = (error: any) =>\n silenceUncaughtInPromise(services.$q.reject(error));\n", - "/**\n * @module common\n */ /** for typedoc */\n\nexport class Queue {\n constructor(private _items: T[] = [], private _limit: number = null) { }\n\n enqueue(item: T) {\n let items = this._items;\n items.push(item);\n if (this._limit && items.length > this._limit) items.shift();\n return item;\n }\n\n dequeue(): T {\n if (this.size())\n return this._items.splice(0, 1)[0];\n }\n\n clear(): Array {\n let current = this._items;\n this._items = [];\n return current;\n }\n\n size(): number {\n return this._items.length;\n }\n\n remove(item: T) {\n let idx = this._items.indexOf(item);\n return idx > -1 && this._items.splice(idx, 1)[0];\n }\n\n peekTail(): T {\n return this._items[this._items.length - 1];\n }\n\n peekHead(): T {\n if (this.size())\n return this._items[0];\n }\n}\n", - "/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\n\"use strict\";\nimport {extend, silentRejection} from \"../common/common\";\nimport {stringify} from \"../common/strings\";\nimport { is } from '../common/hof';\n\nexport enum RejectType {\n SUPERSEDED = 2, ABORTED = 3, INVALID = 4, IGNORED = 5, ERROR = 6\n}\n\n/** @hidden */ let id = 0;\n\nexport class Rejection {\n $id = id++;\n type: number;\n message: string;\n detail: any;\n redirected: boolean;\n\n constructor(type: number, message?: string, detail?: any) {\n this.type = type;\n this.message = message;\n this.detail = detail;\n }\n\n toString() {\n const detailString = (d: any) => \n d && d.toString !== Object.prototype.toString ? d.toString() : stringify(d);\n let detail = detailString(this.detail);\n let { $id, type, message } = this;\n return `Transition Rejection($id: ${$id} type: ${type}, message: ${message}, detail: ${detail})`;\n }\n\n toPromise(): Promise {\n return extend(silentRejection(this), { _transitionRejection: this });\n }\n\n /** Returns true if the obj is a rejected promise created from the `asPromise` factory */\n static isRejectionPromise(obj: any): boolean {\n return obj && (typeof obj.then === 'function') && is(Rejection)(obj._transitionRejection);\n }\n\n /** Returns a Rejection due to transition superseded */\n static superseded(detail?: any, options?: any): Rejection {\n let message = \"The transition has been superseded by a different transition\";\n let rejection = new Rejection(RejectType.SUPERSEDED, message, detail);\n if (options && options.redirected) {\n rejection.redirected = true;\n }\n return rejection;\n }\n\n /** Returns a Rejection due to redirected transition */\n static redirected(detail?: any): Rejection {\n return Rejection.superseded(detail, { redirected: true });\n }\n\n /** Returns a Rejection due to invalid transition */\n static invalid(detail?: any): Rejection {\n let message = \"This transition is invalid\";\n return new Rejection(RejectType.INVALID, message, detail);\n }\n\n /** Returns a Rejection due to ignored transition */\n static ignored(detail?: any): Rejection {\n let message = \"The transition was ignored\";\n return new Rejection(RejectType.IGNORED, message, detail);\n }\n\n /** Returns a Rejection due to aborted transition */\n static aborted(detail?: any): Rejection {\n let message = \"The transition has been aborted\";\n return new Rejection(RejectType.ABORTED, message, detail);\n }\n\n /** Returns a Rejection due to aborted transition */\n static errored(detail?: any): Rejection {\n let message = \"The transition errored\";\n return new Rejection(RejectType.ERROR, message, detail);\n }\n \n /**\n * Returns a Rejection\n *\n * Normalizes a value as a Rejection.\n * If the value is already a Rejection, returns it.\n * Otherwise, wraps and returns the value as a Rejection (Rejection type: ERROR).\n *\n * @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection.\n */\n static normalize(detail?: Rejection | Error | any): Rejection {\n return is(Rejection)(detail) ? detail : Rejection.errored(detail);\n }\n}\n", - "/**\n * # Transition tracing (debug)\n *\n * Enable transition tracing to print transition information to the console,\n * in order to help debug your application.\n * Tracing logs detailed information about each Transition to your console.\n *\n * To enable tracing, import the [[Trace]] singleton and enable one or more categories.\n *\n * ### ES6\n * ```js\n * import {trace} from \"ui-router-ng2\"; // or \"angular-ui-router\"\n * trace.enable(1, 5); // TRANSITION and VIEWCONFIG\n * ```\n *\n * ### CJS\n * ```js\n * let trace = require(\"angular-ui-router\").trace; // or \"ui-router-ng2\"\n * trace.enable(\"TRANSITION\", \"VIEWCONFIG\");\n * ```\n *\n * ### Globals\n * ```js\n * let trace = window[\"angular-ui-router\"].trace; // or \"ui-router-ng2\"\n * trace.enable(); // Trace everything (very verbose)\n * ```\n *\n * ### Angular 1:\n * ```js\n * app.run($trace => $trace.enable());\n * ```\n *\n * @coreapi\n * @module trace\n */ /** for typedoc */\nimport { parse } from \"../common/hof\";\nimport { isFunction, isNumber } from \"../common/predicates\";\nimport { Transition } from \"../transition/transition\";\nimport { ViewTuple } from '../view';\nimport { ActiveUIView, ViewConfig, ViewContext } from \"../view/interface\";\nimport { stringify, functionToString, maxLength, padString } from \"./strings\";\nimport { Resolvable } from \"../resolve/resolvable\";\nimport { PathNode } from \"../path/pathNode\";\nimport { PolicyWhen } from \"../resolve/interface\";\nimport { TransitionHook } from \"../transition/transitionHook\";\nimport { HookResult } from \"../transition/interface\";\nimport { StateObject } from \"../state/stateObject\";\n\n/** @hidden */\nfunction uiViewString (uiview: ActiveUIView) {\n if (!uiview) return 'ui-view (defunct)';\n const state = uiview.creationContext ? uiview.creationContext.name || '(root)' : '(none)';\n return `[ui-view#${uiview.id} ${uiview.$type}:${uiview.fqn} (${uiview.name}@${state})]`;\n}\n\n/** @hidden */\nconst viewConfigString = (viewConfig: ViewConfig) => {\n let view = viewConfig.viewDecl;\n const state = view.$context.name || '(root)';\n return `[View#${viewConfig.$id} from '${state}' state]: target ui-view: '${view.$uiViewName}@${view.$uiViewContextAnchor}'`;\n};\n\n/** @hidden */\nfunction normalizedCat(input: Category|string): string {\n return isNumber(input) ? Category[input] : Category[Category[input]];\n}\n\n/** @hidden */\nconst consoleLog = Function.prototype.bind.call(console.log, console);\n\n/** @hidden */\nconst consoletable = isFunction(console.table) ? console.table.bind(console) : consoleLog.bind(console);\n\n\n/**\n * Trace categories Enum\n *\n * Enable or disable a category using [[Trace.enable]] or [[Trace.disable]]\n *\n * `trace.enable(Category.TRANSITION)`\n *\n * These can also be provided using a matching string, or position ordinal\n *\n * `trace.enable(\"TRANSITION\")`\n *\n * `trace.enable(1)`\n */\nexport enum Category {\n RESOLVE, TRANSITION, HOOK, UIVIEW, VIEWCONFIG,\n}\n\n/** @hidden */ const _tid = parse(\"$id\");\n/** @hidden */ const _rid = parse(\"router.$id\");\n/** @hidden */ const transLbl = (trans) => `Transition #${_tid(trans)}-${_rid(trans)}`;\n\n/**\n * Prints UI-Router Transition trace information to the console.\n */\nexport class Trace {\n /** @hidden */\n approximateDigests: number;\n\n /** @hidden */\n constructor() {\n this.approximateDigests = 0;\n }\n\n /** @hidden */\n private _enabled: { [key: string]: boolean } = {};\n\n /** @hidden */\n private _set(enabled: boolean, categories: Category[]) {\n if (!categories.length) {\n categories = Object.keys(Category)\n .map(k => parseInt(k, 10))\n .filter(k => !isNaN(k))\n .map(key => Category[key]);\n }\n categories.map(normalizedCat).forEach(category => this._enabled[category] = enabled);\n }\n\n /**\n * Enables a trace [[Category]]\n *\n * ```js\n * trace.enable(\"TRANSITION\");\n * ```\n *\n * @param categories categories to enable. If `categories` is omitted, all categories are enabled.\n * Also takes strings (category name) or ordinal (category position)\n */\n enable(...categories: (Category|string|number)[]);\n enable(...categories: any[]) { this._set(true, categories); }\n /**\n * Disables a trace [[Category]]\n *\n * ```js\n * trace.disable(\"VIEWCONFIG\");\n * ```\n *\n * @param categories categories to disable. If `categories` is omitted, all categories are disabled.\n * Also takes strings (category name) or ordinal (category position)\n */\n disable(...categories: (Category|string|number)[]);\n disable(...categories: any[]) { this._set(false, categories); }\n\n /**\n * Retrieves the enabled stateus of a [[Category]]\n *\n * ```js\n * trace.enabled(\"VIEWCONFIG\"); // true or false\n * ```\n *\n * @returns boolean true if the category is enabled\n */\n enabled(category: (Category|string|number)): boolean {\n return !!this._enabled[normalizedCat(category)];\n }\n\n /** @internalapi called by ui-router code */\n traceTransitionStart(trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: Started -> ${stringify(trans)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceTransitionIgnored(trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: Ignored <> ${stringify(trans)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceHookInvocation(step: TransitionHook, trans: Transition, options: any) {\n if (!this.enabled(Category.HOOK)) return;\n let event = parse(\"traceData.hookType\")(options) || \"internal\",\n context = parse(\"traceData.context.state.name\")(options) || parse(\"traceData.context\")(options) || \"unknown\",\n name = functionToString((step as any).registeredHook.callback);\n console.log(`${transLbl(trans)}: Hook -> ${event} context: ${context}, ${maxLength(200, name)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceHookResult(hookResult: HookResult, trans: Transition, transitionOptions: any) {\n if (!this.enabled(Category.HOOK)) return;\n console.log(`${transLbl(trans)}: <- Hook returned: ${maxLength(200, stringify(hookResult))}`);\n }\n\n /** @internalapi called by ui-router code */\n traceResolvePath(path: PathNode[], when: PolicyWhen, trans?: Transition) {\n if (!this.enabled(Category.RESOLVE)) return;\n console.log(`${transLbl(trans)}: Resolving ${path} (${when})`);\n }\n\n /** @internalapi called by ui-router code */\n traceResolvableResolved(resolvable: Resolvable, trans?: Transition) {\n if (!this.enabled(Category.RESOLVE)) return;\n console.log(`${transLbl(trans)}: <- Resolved ${resolvable} to: ${maxLength(200, stringify(resolvable.data))}`);\n }\n\n /** @internalapi called by ui-router code */\n traceError(reason: any, trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: <- Rejected ${stringify(trans)}, reason: ${reason}`);\n }\n\n /** @internalapi called by ui-router code */\n traceSuccess(finalState: StateObject, trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: <- Success ${stringify(trans)}, final state: ${finalState.name}`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewEvent(event: string, viewData: ActiveUIView, extra = \"\") {\n if (!this.enabled(Category.UIVIEW)) return;\n console.log(`ui-view: ${padString(30, event)} ${uiViewString(viewData)}${extra}`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewConfigUpdated(viewData: ActiveUIView, context: ViewContext) {\n if (!this.enabled(Category.UIVIEW)) return;\n this.traceUIViewEvent(\"Updating\", viewData, ` with ViewConfig from context='${context}'`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewFill(viewData: ActiveUIView, html: string) {\n if (!this.enabled(Category.UIVIEW)) return;\n this.traceUIViewEvent(\"Fill\", viewData, ` with: ${maxLength(200, html)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceViewSync(pairs: ViewTuple[]) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n const mapping = pairs.map(({ uiView, viewConfig }) => {\n const uiv = uiView && uiView.fqn;\n const cfg = viewConfig && `${viewConfig.viewDecl.$context.name}: ${viewConfig.viewDecl.$name}`;\n\n return { 'ui-view fqn': uiv, 'state: view name': cfg };\n }).sort((a, b) => a['ui-view fqn'].localeCompare(b['ui-view fqn']));\n\n consoletable(mapping);\n }\n\n /** @internalapi called by ui-router code */\n traceViewServiceEvent(event: string, viewConfig: ViewConfig) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n console.log(`VIEWCONFIG: ${event} ${viewConfigString(viewConfig)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceViewServiceUIViewEvent(event: string, viewData: ActiveUIView) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n console.log(`VIEWCONFIG: ${event} ${uiViewString(viewData)}`);\n }\n}\n\n/**\n * The [[Trace]] singleton\n *\n * #### Example:\n * ```js\n * import {trace} from \"angular-ui-router\";\n * trace.enable(1, 5);\n * ```\n */\nlet trace = new Trace();\nexport {trace};\n", - "/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\nimport {StateDeclaration} from \"../state/interface\";\nimport {Predicate} from \"../common/common\";\n\nimport {Transition} from \"./transition\";\nimport {StateObject} from \"../state/stateObject\";\nimport {PathNode} from \"../path/pathNode\";\nimport {TargetState} from \"../state/targetState\";\nimport {RegisteredHook} from \"./hookRegistry\";\n\n/**\n * The TransitionOptions object can be used to change the behavior of a transition.\n *\n * It is passed as the third argument to [[StateService.go]], [[StateService.transitionTo]].\n * It can also be used with a `uiSref`.\n */\nexport interface TransitionOptions {\n /**\n * This option changes how the Transition interacts with the browser's location bar (URL).\n *\n * - If `true`, it will update the url in the location bar.\n * - If `false`, it will not update the url in the location bar.\n * - If it is the string `\"replace\"`, it will update the url and also replace the last history record.\n *\n * @default `true`\n */\n location ?: (boolean|string);\n\n /**\n * When transitioning to relative path (e.g '`^`'), this option defines which state to be relative from.\n * @default `$state.current`\n */\n relative ?: (string|StateDeclaration|StateObject);\n\n /**\n * This option sets whether or not the transition's parameter values should be inherited from\n * the current parameter values.\n *\n * - If `true`, it will inherit parameter values from the current parameter values.\n * - If `false`, only the parameters which are provided to `transitionTo` will be used.\n *\n * @default `false`\n */\n inherit ?: boolean;\n\n /**\n * @deprecated\n */\n notify ?: boolean;\n\n /**\n * This option may be used to force states which are currently active to reload.\n *\n * During a normal transition, a state is \"retained\" if:\n * - It was previously active\n * - The state's parameter values have not changed\n * - All the parent states' parameter values have not changed\n *\n * Forcing a reload of a state will cause it to be exited and entered, which will:\n * - Refetch that state's resolve data\n * - Exit the state (onExit hook)\n * - Re-enter the state (onEnter hook)\n * - Re-render the views (controllers and templates)\n *\n * - When `true`, the destination state (and all parent states) will be reloaded.\n * - When it is a string and is the name of a state, or when it is a State object,\n * that state and any children states will be reloaded.\n *\n * @default `false`\n */\n reload ?: (boolean|string|StateDeclaration|StateObject);\n /**\n * You can define your own Transition Options inside this property and use them, e.g., from a Transition Hook\n */\n custom ?: any;\n /** @internalapi */\n reloadState ?: (StateObject);\n /** @internalapi\n * If this transition is a redirect, this property should be the original Transition (which was redirected to this one)\n */\n redirectedFrom?: Transition;\n /** @internalapi */\n current ?: () => Transition;\n /** @internalapi */\n source ?: \"sref\" | \"url\" | \"redirect\" | \"otherwise\" | \"unknown\";\n}\n\n/** @internalapi */\nexport interface TransitionHookOptions {\n current ?: () => Transition; //path?\n transition ?: Transition;\n hookType ?: string;\n target ?: any;\n traceData ?: any;\n bind ?: any;\n stateHook ?: boolean;\n}\n\n/**\n * TreeChanges encapsulates the various Paths that are involved in a Transition.\n *\n * Get a TreeChanges object using [[Transition.treeChanges]]\n *\n * A UI-Router Transition is from one Path in a State Tree to another Path. For a given Transition,\n * this object stores the \"to\" and \"from\" paths, as well as subsets of those: the \"retained\",\n * \"exiting\" and \"entering\" paths.\n *\n * Each path in TreeChanges is an array of [[PathNode]] objects. Each PathNode in the array corresponds to a portion\n * of a nested state.\n *\n * For example, if you had a nested state named `foo.bar.baz`, it would have three\n * portions, `foo, bar, baz`. If you transitioned **to** `foo.bar.baz` and inspected the [[TreeChanges.to]]\n * Path, you would find a node in the array for each portion: `foo`, `bar`, and `baz`.\n *\n * ---\n *\n * @todo show visual state tree\n */\nexport interface TreeChanges {\n /** @nodoc */\n [key: string]: PathNode[];\n\n /** The path of nodes in the state tree that the transition is coming *from* */\n from: PathNode[];\n\n /** The path of nodes in the state tree that the transition is going *to* */\n to: PathNode[];\n\n /**\n * The path of active nodes that the transition is retaining.\n *\n * These nodes are neither exited, nor entered.\n * Before and after the transition is successful, these nodes are active.\n */\n retained: PathNode[];\n\n /**\n * The path of previously active nodes that the transition is exiting.\n *\n * After the Transition is successful, these nodes are no longer active.\n *\n * Note that a state that is being reloaded (due to parameter values changing, or `reload: true`) may be in both the\n * `exiting` and `entering` paths.\n */\n exiting: PathNode[];\n\n /**\n * The path of nodes that the transition is entering.\n *\n * After the Transition is successful, these nodes will be active.\n * Because they are entering, they have their resolves fetched, `onEnter` hooks run, and their views\n * (component(s) or controller(s)+template(s)) refreshed.\n *\n * Note that a state that is reloaded (due to parameter values changing, or `reload: true`) may be in both the\n * `exiting` and `entering` paths.\n */\n entering: PathNode[];\n}\n\nexport type IHookRegistration = (matchCriteria: HookMatchCriteria, callback: HookFn, options?: HookRegOptions) => Function;\n\n/**\n * The signature for Transition Hooks.\n *\n * Transition hooks are callback functions that hook into the lifecycle of transitions.\n * As a transition runs, it reaches certain lifecycle events.\n * As each event occurs, the hooks which are registered for the event are called (in priority order).\n *\n * A transition hook may alter a Transition by returning a [[HookResult]].\n *\n * #### See:\n *\n * - [[IHookRegistry.onBefore]]\n * - [[IHookRegistry.onStart]]\n * - [[IHookRegistry.onFinish]]\n * - [[IHookRegistry.onSuccess]]\n * - [[IHookRegistry.onError]]\n *\n * @param transition the current [[Transition]]\n * @param injector (for ng1 or ng2 only) the injector service\n *\n * @returns a [[HookResult]] which may alter the transition\n *\n */\nexport interface TransitionHookFn {\n (transition: Transition) : HookResult;\n}\n\n/**\n * The signature for Transition State Hooks.\n *\n * A function which hooks into a lifecycle event for a specific state.\n *\n * Transition State Hooks are callback functions that hook into the lifecycle events of specific states during a transition.\n * As a transition runs, it may exit some states, retain (keep) states, and enter states.\n * As each lifecycle event occurs, the hooks which are registered for the event and that state are called (in priority order).\n *\n * #### See:\n *\n * - [[IHookRegistry.onExit]]\n * - [[IHookRegistry.onRetain]]\n * - [[IHookRegistry.onEnter]]\n *\n * @param transition the current [[Transition]]\n * @param state the [[StateObject]] that the hook is bound to\n * @param injector (for ng1 or ng2 only) the injector service\n *\n * @returns a [[HookResult]] which may alter the transition\n */\nexport interface TransitionStateHookFn {\n (transition: Transition, state: StateDeclaration) : HookResult;\n}\n\n/**\n * The signature for Transition onCreate Hooks.\n *\n * Transition onCreate Hooks are callbacks that allow customization or preprocessing of\n * a Transition before it is returned from [[TransitionService.create]]\n *\n * @param transition the [[Transition]] that was just created\n * @return a [[Transition]] which will then be returned from [[TransitionService.create]]\n */\nexport interface TransitionCreateHookFn {\n (transition: Transition): void;\n}\n\nexport type HookFn = (TransitionHookFn|TransitionStateHookFn|TransitionCreateHookFn);\n\n/**\n * The return value of a [[TransitionHookFn]] or [[TransitionStateHookFn]]\n *\n * When returned from a [[TransitionHookFn]] or [[TransitionStateHookFn]], these values alter the running [[Transition]]:\n *\n * - `false`: the transition will be cancelled.\n * - [[TargetState]]: the transition will be redirected to the new target state (see: [[StateService.target]])\n * - `Promise`: the transition will wait for the promise to resolve or reject\n * - If the promise is rejected (or resolves to `false`), the transition will be cancelled\n * - If the promise resolves to a [[TargetState]], the transition will be redirected\n * - If the promise resolves to anything else, the transition will resume\n * - Anything else: the transition will resume\n */\nexport type HookResult = (boolean | TargetState | void | Promise);\n\n/**\n * These options may be provided when registering a Transition Hook (such as `onStart`)\n */\nexport interface HookRegOptions {\n /**\n * Sets the priority of the registered hook\n *\n * Hooks of the same type (onBefore, onStart, etc) are invoked in priority order. A hook with a higher priority\n * is invoked before a hook with a lower priority.\n *\n * The default hook priority is 0\n */\n priority?: number;\n\n /**\n * Specifies what `this` is bound to during hook invocation.\n */\n bind?: any;\n\n /**\n * Limits the number of times that the hook will be invoked.\n * Once the hook has been invoked this many times, it is automatically deregistered.\n */\n invokeLimit?: number;\n}\n\n/**\n * This interface specifies the api for registering Transition Hooks. Both the\n * [[TransitionService]] and also the [[Transition]] object itself implement this interface.\n * Note: the Transition object only allows hooks to be registered before the Transition is started.\n */\nexport interface IHookRegistry {\n /**\n * Registers a [[TransitionHookFn]], called *before a transition starts*.\n *\n * Registers a transition lifecycle hook, which is invoked before a transition even begins.\n * This hook can be useful to implement logic which prevents a transition from even starting, such\n * as authentication, redirection\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onBefore` hooks are invoked *before a Transition starts*.\n * No resolves have been fetched yet.\n * Each `onBefore` hook is invoked synchronously, in the same call stack as [[StateService.transitionTo]].\n * The registered `onBefore` hooks are invoked in priority order.\n *\n * Note: during the `onBefore` phase, additional hooks can be added to the specific [[Transition]] instance.\n * These \"on-the-fly\" hooks only affect the currently running transition..\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * If any hook modifies the transition *synchronously* (by throwing, returning `false`, or returning\n * a [[TargetState]]), the remainder of the hooks are skipped.\n * If a hook returns a promise, the remainder of the `onBefore` hooks are still invoked synchronously.\n * All promises are resolved, and processed asynchronously before the `onStart` phase of the Transition.\n *\n * ### Examples\n *\n * #### Default Substate\n *\n * This example redirects any transition from 'home' to 'home.dashboard'. This is commonly referred to as a\n * \"default substate\".\n *\n * @example\n * ```js\n * // ng2\n * transitionService.onBefore({ to: 'home' }, (trans: Transition) =>\n * trans.router.stateService.target(\"home.dashboard\"));\n * ```\n *\n * #### Data Driven Default Substate\n *\n * This example provides data-driven default substate functionality. It matches on a transition to any state\n * which has `defaultSubstate: \"some.sub.state\"` defined. See: [[Transition.to]] which returns the \"to state\"\n * definition.\n *\n * @example\n * ```js\n * // ng1\n * // state declaration\n * {\n * name: 'home',\n * template: '
',\n * defaultSubstate: 'home.dashboard'\n * }\n *\n * var criteria = {\n * to: function(state) {\n * return state.defaultSubstate != null;\n * }\n * }\n *\n * $transitions.onBefore(criteria, function(trans: Transition) {\n * var substate = trans.to().defaultSubstate;\n * return trans.router.stateService.target(substate);\n * });\n * ```\n *\n *\n * #### Require authentication\n *\n * This example cancels a transition to a state which requires authentication, if the user is not currently authenticated.\n *\n * This example assumes a state tree where all states which require authentication are children of a parent `'requireauth'` state.\n * This example assumes `MyAuthService` synchronously returns a boolean from `isAuthenticated()`.\n *\n * #### Example:\n * ```js\n * // ng1\n * $transitions.onBefore( { to: 'requireauth.**' }, function(trans) {\n * var myAuthService = trans.injector().get('MyAuthService');\n * // If isAuthenticated returns false, the transition is cancelled.\n * return myAuthService.isAuthenticated();\n * });\n * ```\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be invoked.\n * @returns a function which deregisters the hook.\n */\n onBefore(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called when a transition starts.\n *\n * Registers a transition lifecycle hook, which is invoked as a transition starts running.\n * This hook can be useful to perform some asynchronous action before completing a transition.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onStart` hooks are invoked asynchronously when the Transition starts running.\n * This happens after the `onBefore` phase is complete.\n * At this point, the Transition has not yet exited nor entered any states.\n * The registered `onStart` hooks are invoked in priority order.\n *\n * Note: A built-in `onStart` hook with high priority is used to fetch any eager resolve data.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Example\n *\n * #### Login during transition\n *\n * This example intercepts any transition to a state which requires authentication, when the user is\n * not currently authenticated. It allows the user to authenticate asynchronously, then resumes the\n * transition. If the user did not authenticate successfully, it redirects to the \"guest\" state, which\n * does not require authentication.\n *\n * This example assumes:\n * - a state tree where all states which require authentication are children of a parent `'auth'` state.\n * - `MyAuthService.isAuthenticated()` synchronously returns a boolean.\n * - `MyAuthService.authenticate()` presents a login dialog, and returns a promise which is resolved\n * or rejected, whether or not the login attempt was successful.\n *\n * #### Example:\n * ```js\n * // ng1\n * $transitions.onStart( { to: 'auth.**' }, function(trans) {\n * var $state = trans.router.stateService;\n * var MyAuthService = trans.injector().get('MyAuthService');\n *\n * // If the user is not authenticated\n * if (!MyAuthService.isAuthenticated()) {\n *\n * // Then return a promise for a successful login.\n * // The transition will wait for this promise to settle\n *\n * return MyAuthService.authenticate().catch(function() {\n *\n * // If the authenticate() method failed for whatever reason,\n * // redirect to a 'guest' state which doesn't require auth.\n * return $state.target(\"guest\");\n * });\n * }\n * });\n * ```\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onStart(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is entered.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being entered.\n *\n * Since this hook is run only when the specific state is being *entered*, it can be useful for\n * performing tasks when entering a submodule/feature area such as initializing a stateful service,\n * or for guarding access to a submodule/feature area.\n *\n * See [[TransitionStateHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onEnter` hooks generally specify `{ entering: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onEnter` hooks are invoked when the Transition is entering a state.\n * States are entered after the `onRetain` phase is complete.\n * If more than one state is being entered, the parent state is entered first.\n * The registered `onEnter` hooks for a state are invoked in priority order.\n *\n * Note: A built-in `onEnter` hook with high priority is used to fetch lazy resolve data for states being entered.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onEnter` hooks using the [[TransitionService]], you may define an `onEnter` hook\n * directly on a state declaration (see: [[StateDeclaration.onEnter]]).\n *\n *\n * ### Examples\n *\n * #### Audit Log\n *\n * This example uses a service to log that a user has entered the admin section of an app.\n * This assumes that there are substates of the \"admin\" state, such as \"admin.users\", \"admin.pages\", etc.\n * @example\n * ```\n *\n * $transitions.onEnter({ entering: 'admin' }, function(transition, state) {\n * var AuditService = trans.injector().get('AuditService');\n * AuditService.log(\"Entered \" + state.name + \" module while transitioning to \" + transition.to().name);\n * }\n * ```\n *\n * #### Audit Log (inside a state declaration)\n *\n * The `onEnter` inside this state declaration is syntactic sugar for the previous Audit Log example.\n * ```\n * {\n * name: 'admin',\n * component: 'admin',\n * onEnter: function($transition$, $state$) {\n * var AuditService = $transition$.injector().get('AuditService');\n * AuditService.log(\"Entered \" + state.name + \" module while transitioning to \" + transition.to().name);\n * }\n * }\n * ```\n *\n * Note: A state declaration's `onEnter` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onEnter(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is retained/kept.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) for\n * a specific state that was previously active will remain active (is not being entered nor exited).\n *\n * This hook is invoked when a state is \"retained\" or \"kept\".\n * It means the transition is coming *from* a substate of the retained state *to* a substate of the retained state.\n * This hook can be used to perform actions when the user moves from one substate to another, such as between steps in a wizard.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onRetain` hooks generally specify `{ retained: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onRetain` hooks are invoked after any `onExit` hooks have been fired.\n * If more than one state is retained, the child states' `onRetain` hooks are invoked first.\n * The registered `onRetain` hooks for a state are invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onRetain` hooks using the [[TransitionService]], you may define an `onRetain` hook\n * directly on a state declaration (see: [[StateDeclaration.onRetain]]).\n *\n * Note: A state declaration's `onRetain` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onRetain(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is exited.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being exited.\n *\n * Since this hook is run only when the specific state is being *exited*, it can be useful for\n * performing tasks when leaving a submodule/feature area such as cleaning up a stateful service,\n * or for preventing the user from leaving a state or submodule until some criteria is satisfied.\n *\n * See [[TransitionStateHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onExit` hooks generally specify `{ exiting: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onExit` hooks are invoked when the Transition is exiting a state.\n * States are exited after any `onStart` phase is complete.\n * If more than one state is being exited, the child states are exited first.\n * The registered `onExit` hooks for a state are invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onExit` hooks using the [[TransitionService]], you may define an `onExit` hook\n * directly on a state declaration (see: [[StateDeclaration.onExit]]).\n *\n * Note: A state declaration's `onExit` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onExit(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called *just before a transition finishes*.\n *\n * Registers a transition lifecycle hook, which is invoked just before a transition finishes.\n * This hook is a last chance to cancel or redirect a transition.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onFinish` hooks are invoked after the `onEnter` phase is complete.\n * These hooks are invoked just before the transition is \"committed\".\n * Each hook is invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onFinish(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called after a successful transition completed.\n *\n * Registers a transition lifecycle hook, which is invoked after a transition successfully completes.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onSuccess` hooks are chained off the Transition's promise (see [[Transition.promise]]).\n * If the Transition is successful and its promise is resolved, then the `onSuccess` hooks are invoked.\n * Since these hooks are run after the transition is over, their return value is ignored.\n * The `onSuccess` hooks are invoked in priority order.\n *\n * ### Return value\n *\n * Since the Transition is already completed, the hook's return value is ignored\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onSuccess(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called after a transition has errored.\n *\n * Registers a transition lifecycle hook, which is invoked after a transition has been rejected for any reason.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * The `onError` hooks are chained off the Transition's promise (see [[Transition.promise]]).\n * If a Transition fails, its promise is rejected and the `onError` hooks are invoked.\n * The `onError` hooks are invoked in priority order.\n *\n * Since these hooks are run after the transition is over, their return value is ignored.\n *\n * A transition \"errors\" if it was started, but failed to complete (for any reason).\n * A *non-exhaustive list* of reasons a transition can error:\n *\n * - A transition was cancelled because a new transition started while it was still running (`Transition superseded`)\n * - A transition was cancelled by a Transition Hook returning false\n * - A transition was redirected by a Transition Hook returning a [[TargetState]]\n * - A Transition Hook or resolve function threw an error\n * - A Transition Hook returned a rejected promise\n * - A resolve function returned a rejected promise\n *\n * To check the failure reason, inspect the return value of [[Transition.error]].\n *\n * Note: `onError` should be used for targeted error handling, or error recovery.\n * For simple catch-all error reporting, use [[StateService.defaultErrorHandler]].\n *\n * ### Return value\n *\n * Since the Transition is already completed, the hook's return value is ignored\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onError(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Returns all the registered hooks of a given `hookName` type\n *\n * #### Example:\n * ```\n * $transitions.getHooks(\"onEnter\")\n * ```\n */\n getHooks(hookName: string): RegisteredHook[];\n\n /** @hidden place to store the hooks */\n _registeredHooks: { [key: string]: RegisteredHook[] };\n}\n\n/** A predicate type which tests if a [[StateObject]] passes some test. Returns a boolean. */\nexport type IStateMatch = Predicate;\n\n/**\n * This object is used to configure whether or not a Transition Hook is invoked for a particular transition,\n * based on the Transition's \"to state\" and \"from state\".\n *\n * Each property (`to`, `from`, `exiting`, `retained`, and `entering`) can be a state [[Glob]] string,\n * a boolean, or a function that takes a state and returns a boolean (see [[HookMatchCriterion]])\n *\n * All properties are optional. If any property is omitted, it is replaced with the value `true`, and always matches.\n * To match any transition, use an empty criteria object `{}`.\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from the `parent` state and going to the `parent.child` state.\n * var match = {\n * to: 'parent',\n * from: 'parent.child'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any substate of `parent` and going directly to the `parent` state.\n * var match = {\n * to: 'parent',\n * from: 'parent.**'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any state and going to any substate of `mymodule`\n * var match = {\n * to: 'mymodule.**'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any state and going to any state that has `data.authRequired`\n * // set to a truthy value.\n * var match = {\n * to: function(state) {\n * return state.data != null && state.data.authRequired === true;\n * }\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition that is exiting `parent.child`\n * var match = {\n * exiting: 'parent.child'\n * }\n * ```\n */\nexport interface HookMatchCriteria {\n [key: string]: HookMatchCriterion | undefined;\n\n /** A [[HookMatchCriterion]] to match the destination state */\n to?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match the original (from) state */\n from?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be exiting */\n exiting?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be retained */\n retained?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be entering */\n entering?: HookMatchCriterion;\n}\n\nexport interface IMatchingNodes {\n [key: string]: PathNode[];\n\n to: PathNode[];\n from: PathNode[];\n exiting: PathNode[];\n retained: PathNode[];\n entering: PathNode[];\n}\n\n/** @hidden */\nexport interface RegisteredHooks {\n [key: string]: RegisteredHook[];\n}\n\n/** @hidden */\nexport interface PathTypes {\n [key: string]: PathType;\n\n to: PathType;\n from: PathType;\n exiting: PathType;\n retained: PathType;\n entering: PathType;\n}\n\n/** @hidden */\nexport interface PathType {\n name: string;\n scope: TransitionHookScope;\n}\n\n/**\n * Hook Criterion used to match a transition.\n *\n * A [[Glob]] string that matches the name of a state.\n *\n * Or, a function with the signature `function(state) { return matches; }`\n * which should return a boolean to indicate if a state matches.\n *\n * Or, `true` to always match\n */\nexport type HookMatchCriterion = (string|IStateMatch|boolean)\n\nexport enum TransitionHookPhase { CREATE, BEFORE, RUN, SUCCESS, ERROR }\nexport enum TransitionHookScope { TRANSITION, STATE }\n", - "/**\n * @coreapi\n * @module state\n */ /** for typedoc */\n\nimport { StateDeclaration, StateOrName, TargetStateDef } from \"./interface\";\nimport { TransitionOptions } from \"../transition/interface\";\nimport { StateObject } from \"./stateObject\";\nimport { isString } from \"../common/predicates\";\nimport { stringify } from '../common/strings';\nimport { extend } from '../common';\nimport { StateRegistry } from './stateRegistry';\nimport { RawParams } from '../params';\n\n/**\n * Encapsulate the target (destination) state/params/options of a [[Transition]].\n *\n * This class is frequently used to redirect a transition to a new destination.\n *\n * See:\n *\n * - [[HookResult]]\n * - [[TransitionHookFn]]\n * - [[TransitionService.onStart]]\n *\n * To create a `TargetState`, use [[StateService.target]].\n *\n * ---\n *\n * This class wraps:\n *\n * 1) an identifier for a state\n * 2) a set of parameters\n * 3) and transition options\n * 4) the registered state object (the [[StateDeclaration]])\n *\n * Many UI-Router APIs such as [[StateService.go]] take a [[StateOrName]] argument which can\n * either be a *state object* (a [[StateDeclaration]] or [[StateObject]]) or a *state name* (a string).\n * The `TargetState` class normalizes those options.\n *\n * A `TargetState` may be valid (the state being targeted exists in the registry)\n * or invalid (the state being targeted is not registered).\n */\nexport class TargetState {\n private _definition: StateObject;\n private _params: RawParams;\n private _options: TransitionOptions;\n\n /**\n * The TargetState constructor\n *\n * Note: Do not construct a `TargetState` manually.\n * To create a `TargetState`, use the [[StateService.target]] factory method.\n *\n * @param _stateRegistry The StateRegistry to use to look up the _definition\n * @param _identifier An identifier for a state.\n * Either a fully-qualified state name, or the object used to define the state.\n * @param _params Parameters for the target state\n * @param _options Transition options.\n *\n * @internalapi\n */\n constructor(\n private _stateRegistry: StateRegistry,\n private _identifier: StateOrName,\n _params?: RawParams,\n _options?: TransitionOptions,\n ) {\n this._identifier = _identifier;\n this._params = extend({}, _params || {});\n this._options = extend({}, _options || {});\n this._definition = _stateRegistry.matcher.find(_identifier, this._options.relative);\n }\n\n /** The name of the state this object targets */\n name(): string {\n return this._definition && this._definition.name || this._identifier;\n }\n\n /** The identifier used when creating this TargetState */\n identifier(): StateOrName {\n return this._identifier;\n }\n\n /** The target parameter values */\n params(): RawParams {\n return this._params;\n }\n\n /** The internal state object (if it was found) */\n $state(): StateObject {\n return this._definition;\n }\n\n /** The internal state declaration (if it was found) */\n state(): StateDeclaration {\n return this._definition && this._definition.self;\n }\n\n /** The target options */\n options() {\n return this._options;\n }\n\n /** True if the target state was found */\n exists(): boolean {\n return !!(this._definition && this._definition.self);\n }\n\n /** True if the object is valid */\n valid(): boolean {\n return !this.error();\n }\n\n /** If the object is invalid, returns the reason why */\n error(): string {\n let base = this.options().relative;\n if (!this._definition && !!base) {\n let stateName = base.name ? base.name : base;\n return `Could not resolve '${this.name()}' from state '${stateName}'`;\n }\n if (!this._definition)\n return `No such state '${this.name()}'`;\n if (!this._definition.self)\n return `State '${this.name()}' has an invalid definition`;\n }\n\n toString() {\n return `'${this.name()}'${stringify(this.params())}`;\n }\n\n /** Returns true if the object has a state property that might be a state or state name */\n static isDef = (obj): obj is TargetStateDef =>\n obj && obj.state && (isString(obj.state) || isString(obj.state.name));\n\n /**\n * Returns a copy of this TargetState which targets a different state.\n * The new TargetState has the same parameter values and transition options.\n *\n * @param state The new state that should be targeted\n */\n withState(state: StateOrName): TargetState {\n return new TargetState(this._stateRegistry, state, this._params, this._options);\n }\n\n /**\n * Returns a copy of this TargetState, using the specified parameter values.\n *\n * @param params the new parameter values to use\n * @param replace When false (default) the new parameter values will be merged with the current values.\n * When true the parameter values will be used instead of the current values.\n */\n withParams(params: RawParams, replace = false): TargetState {\n const newParams: RawParams = replace ? params : extend({}, this._params, params);\n return new TargetState(this._stateRegistry, this._identifier, newParams, this._options);\n }\n\n /**\n * Returns a copy of this TargetState, using the specified Transition Options.\n *\n * @param options the new options to use\n * @param replace When false (default) the new options will be merged with the current options.\n * When true the options will be used instead of the current options.\n */\n withOptions(options: TransitionOptions, replace = false): TargetState {\n const newOpts = replace ? options : extend({}, this._options, options);\n return new TargetState(this._stateRegistry, this._identifier, this._params, newOpts);\n }\n}\n", - "/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport { TransitionHookOptions, HookResult, TransitionHookPhase } from './interface';\nimport { defaults, noop, silentRejection } from '../common/common';\nimport { fnToString, maxLength } from '../common/strings';\nimport { isPromise } from '../common/predicates';\nimport { is, parse } from '../common/hof';\nimport { trace } from '../common/trace';\nimport { services } from '../common/coreservices';\nimport { Rejection } from './rejectFactory';\nimport { TargetState } from '../state/targetState';\nimport { Transition } from './transition';\nimport { TransitionEventType } from './transitionEventType';\nimport { RegisteredHook } from './hookRegistry';\nimport { StateDeclaration } from '../state/interface';\n\nlet defaultOptions: TransitionHookOptions = {\n current: noop,\n transition: null,\n traceData: {},\n bind: null,\n};\n\nexport type GetResultHandler = (hook: TransitionHook) => ResultHandler;\nexport type GetErrorHandler = (hook: TransitionHook) => ErrorHandler;\n\nexport type ResultHandler = (result: HookResult) => Promise;\nexport type ErrorHandler = (error: any) => Promise;\n\n/** @hidden */\nexport class TransitionHook {\n type: TransitionEventType;\n constructor(private transition: Transition,\n private stateContext: StateDeclaration,\n private registeredHook: RegisteredHook,\n private options: TransitionHookOptions) {\n this.options = defaults(options, defaultOptions);\n this.type = registeredHook.eventType;\n }\n\n /**\n * These GetResultHandler(s) are used by [[invokeHook]] below\n * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]])\n */\n static HANDLE_RESULT: GetResultHandler = (hook: TransitionHook) => (result: HookResult) =>\n hook.handleHookResult(result);\n\n /**\n * If the result is a promise rejection, log it.\n * Otherwise, ignore the result.\n */\n static LOG_REJECTED_RESULT: GetResultHandler = (hook: TransitionHook) => (result: HookResult) => {\n isPromise(result) && result.catch(err =>\n hook.logError(Rejection.normalize(err)));\n return undefined;\n }\n\n /**\n * These GetErrorHandler(s) are used by [[invokeHook]] below\n * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]])\n */\n static LOG_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) =>\n hook.logError(error);\n\n static REJECT_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) =>\n silentRejection(error);\n\n static THROW_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) => {\n throw error;\n }\n\n private isSuperseded = () =>\n this.type.hookPhase === TransitionHookPhase.RUN && !this.options.transition.isActive();\n\n logError(err): any {\n this.transition.router.stateService.defaultErrorHandler()(err);\n }\n\n invokeHook(): Promise | void {\n let hook = this.registeredHook;\n if (hook._deregistered) return;\n\n let notCurrent = this.getNotCurrentRejection();\n if (notCurrent) return notCurrent;\n\n let options = this.options;\n trace.traceHookInvocation(this, this.transition, options);\n\n const invokeCallback = () =>\n hook.callback.call(options.bind, this.transition, this.stateContext);\n\n const normalizeErr = err =>\n Rejection.normalize(err).toPromise();\n\n const handleError = err =>\n hook.eventType.getErrorHandler(this)(err);\n\n const handleResult = result =>\n hook.eventType.getResultHandler(this)(result);\n\n try {\n let result = invokeCallback();\n\n if (!this.type.synchronous && isPromise(result)) {\n return result.catch(normalizeErr)\n .then(handleResult, handleError);\n } else {\n return handleResult(result);\n }\n } catch (err) {\n // If callback throws (synchronously)\n return handleError(Rejection.normalize(err));\n } finally {\n if (hook.invokeLimit && ++hook.invokeCount >= hook.invokeLimit) {\n hook.deregister();\n }\n }\n }\n\n /**\n * This method handles the return value of a Transition Hook.\n *\n * A hook can return false (cancel), a TargetState (redirect),\n * or a promise (which may later resolve to false or a redirect)\n *\n * This also handles \"transition superseded\" -- when a new transition\n * was started while the hook was still running\n */\n handleHookResult(result: HookResult): Promise {\n let notCurrent = this.getNotCurrentRejection();\n if (notCurrent) return notCurrent;\n\n // Hook returned a promise\n if (isPromise(result)) {\n // Wait for the promise, then reprocess with the resulting value\n return result.then(val => this.handleHookResult(val));\n }\n\n trace.traceHookResult(result, this.transition, this.options);\n\n // Hook returned false\n if (result === false) {\n // Abort this Transition\n return Rejection.aborted(\"Hook aborted transition\").toPromise();\n }\n\n const isTargetState = is(TargetState);\n // hook returned a TargetState\n if (isTargetState(result)) {\n // Halt the current Transition and redirect (a new Transition) to the TargetState.\n return Rejection.redirected(result).toPromise();\n }\n }\n\n\n /**\n * Return a Rejection promise if the transition is no longer current due\n * to a stopped router (disposed), or a new transition has started and superseded this one.\n */\n private getNotCurrentRejection() {\n let router = this.transition.router;\n\n // The router is stopped\n if (router._disposed) {\n return Rejection.aborted(`UIRouter instance #${router.$id} has been stopped (disposed)`).toPromise();\n }\n\n if (this.transition._aborted) {\n return Rejection.aborted().toPromise();\n }\n\n // This transition is no longer current.\n // Another transition started while this hook was still running.\n if (this.isSuperseded()) {\n // Abort this transition\n return Rejection.superseded(this.options.current()).toPromise();\n }\n }\n\n toString() {\n let { options, registeredHook } = this;\n let event = parse(\"traceData.hookType\")(options) || \"internal\",\n context = parse(\"traceData.context.state.name\")(options) || parse(\"traceData.context\")(options) || \"unknown\",\n name = fnToString(registeredHook.callback);\n return `${event} context: ${context}, ${maxLength(200, name)}`;\n }\n\n /**\n * Chains together an array of TransitionHooks.\n *\n * Given a list of [[TransitionHook]] objects, chains them together.\n * Each hook is invoked after the previous one completes.\n *\n * #### Example:\n * ```js\n * var hooks: TransitionHook[] = getHooks();\n * let promise: Promise = TransitionHook.chain(hooks);\n *\n * promise.then(handleSuccess, handleError);\n * ```\n *\n * @param hooks the list of hooks to chain together\n * @param waitFor if provided, the chain is `.then()`'ed off this promise\n * @returns a `Promise` for sequentially invoking the hooks (in order)\n */\n static chain(hooks: TransitionHook[], waitFor?: Promise): Promise {\n // Chain the next hook off the previous\n const createHookChainR = (prev: Promise, nextHook: TransitionHook) =>\n prev.then(() => nextHook.invokeHook());\n return hooks.reduce(createHookChainR, waitFor || services.$q.when());\n }\n\n\n /**\n * Invokes all the provided TransitionHooks, in order.\n * Each hook's return value is checked.\n * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned.\n * If no hook returns a promise, then all hooks are processed synchronously.\n *\n * @param hooks the list of TransitionHooks to invoke\n * @param doneCallback a callback that is invoked after all the hooks have successfully completed\n *\n * @returns a promise for the async result, or the result of the callback\n */\n static invokeHooks(hooks: TransitionHook[], doneCallback: (result?: HookResult) => T): Promise | T {\n for (let idx = 0; idx < hooks.length; idx++) {\n let hookResult = hooks[idx].invokeHook();\n\n if (isPromise(hookResult)) {\n let remainingHooks = hooks.slice(idx + 1);\n\n return TransitionHook.chain(remainingHooks, hookResult)\n .then(doneCallback);\n }\n }\n\n return doneCallback();\n }\n\n /**\n * Run all TransitionHooks, ignoring their return value.\n */\n static runAllHooks(hooks: TransitionHook[]): void {\n hooks.forEach(hook => hook.invokeHook());\n }\n\n}\n", - "/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\nimport { extend, removeFrom, tail, values, identity, map } from \"../common/common\";\nimport {isString, isFunction} from \"../common/predicates\";\nimport {PathNode} from \"../path/pathNode\";\nimport {\n TransitionStateHookFn, TransitionHookFn, TransitionHookPhase, TransitionHookScope, IHookRegistry, PathType,\n} from \"./interface\"; // has or is using\n\nimport {\n HookRegOptions, HookMatchCriteria, TreeChanges,\n HookMatchCriterion, IMatchingNodes, HookFn,\n} from \"./interface\";\nimport {Glob} from \"../common/glob\";\nimport {StateObject} from \"../state/stateObject\";\nimport {TransitionEventType} from \"./transitionEventType\";\nimport { TransitionService } from \"./transitionService\";\n\n/**\n * Determines if the given state matches the matchCriteria\n *\n * @hidden\n *\n * @param state a State Object to test against\n * @param criterion\n * - If a string, matchState uses the string as a glob-matcher against the state name\n * - If an array (of strings), matchState uses each string in the array as a glob-matchers against the state name\n * and returns a positive match if any of the globs match.\n * - If a function, matchState calls the function with the state and returns true if the function's result is truthy.\n * @returns {boolean}\n */\nexport function matchState(state: StateObject, criterion: HookMatchCriterion) {\n let toMatch = isString(criterion) ? [criterion] : criterion;\n\n function matchGlobs(_state: StateObject) {\n let globStrings = toMatch;\n for (let i = 0; i < globStrings.length; i++) {\n let glob = new Glob(globStrings[i]);\n\n if ((glob && glob.matches(_state.name)) || (!glob && globStrings[i] === _state.name)) {\n return true;\n }\n }\n return false;\n }\n\n let matchFn = (isFunction(toMatch) ? toMatch : matchGlobs);\n return !!matchFn(state);\n}\n\n/**\n * @internalapi\n * The registration data for a registered transition hook\n */\nexport class RegisteredHook {\n priority: number;\n bind: any;\n invokeCount = 0;\n invokeLimit: number;\n _deregistered = false;\n\n constructor(public tranSvc: TransitionService,\n public eventType: TransitionEventType,\n public callback: HookFn,\n public matchCriteria: HookMatchCriteria,\n public removeHookFromRegistry: (hook: RegisteredHook) => void,\n options: HookRegOptions = {} as any) {\n this.priority = options.priority || 0;\n this.bind = options.bind || null;\n this.invokeLimit = options.invokeLimit;\n }\n\n /**\n * Gets the matching [[PathNode]]s\n *\n * Given an array of [[PathNode]]s, and a [[HookMatchCriterion]], returns an array containing\n * the [[PathNode]]s that the criteria matches, or `null` if there were no matching nodes.\n *\n * Returning `null` is significant to distinguish between the default\n * \"match-all criterion value\" of `true` compared to a `() => true` function,\n * when the nodes is an empty array.\n *\n * This is useful to allow a transition match criteria of `entering: true`\n * to still match a transition, even when `entering === []`. Contrast that\n * with `entering: (state) => true` which only matches when a state is actually\n * being entered.\n */\n private _matchingNodes(nodes: PathNode[], criterion: HookMatchCriterion): PathNode[] {\n if (criterion === true) return nodes;\n let matching = nodes.filter(node => matchState(node.state, criterion));\n return matching.length ? matching : null;\n }\n\n /**\n * Gets the default match criteria (all `true`)\n *\n * Returns an object which has all the criteria match paths as keys and `true` as values, i.e.:\n *\n * ```js\n * {\n * to: true,\n * from: true,\n * entering: true,\n * exiting: true,\n * retained: true,\n * }\n */\n private _getDefaultMatchCriteria(): HookMatchCriteria {\n return map(this.tranSvc._pluginapi._getPathTypes(), () => true);\n }\n\n /**\n * Gets matching nodes as [[IMatchingNodes]]\n *\n * Create a IMatchingNodes object from the TransitionHookTypes that is roughly equivalent to:\n *\n * ```js\n * let matches: IMatchingNodes = {\n * to: _matchingNodes([tail(treeChanges.to)], mc.to),\n * from: _matchingNodes([tail(treeChanges.from)], mc.from),\n * exiting: _matchingNodes(treeChanges.exiting, mc.exiting),\n * retained: _matchingNodes(treeChanges.retained, mc.retained),\n * entering: _matchingNodes(treeChanges.entering, mc.entering),\n * };\n * ```\n */\n private _getMatchingNodes(treeChanges: TreeChanges): IMatchingNodes {\n let criteria = extend(this._getDefaultMatchCriteria(), this.matchCriteria);\n let paths: PathType[] = values(this.tranSvc._pluginapi._getPathTypes());\n\n return paths.reduce((mn: IMatchingNodes, pathtype: PathType) => {\n // STATE scope criteria matches against every node in the path.\n // TRANSITION scope criteria matches against only the last node in the path\n let isStateHook = pathtype.scope === TransitionHookScope.STATE;\n let path = treeChanges[pathtype.name] || [];\n let nodes: PathNode[] = isStateHook ? path : [tail(path)];\n\n mn[pathtype.name] = this._matchingNodes(nodes, criteria[pathtype.name]);\n return mn;\n }, {} as IMatchingNodes);\n }\n\n /**\n * Determines if this hook's [[matchCriteria]] match the given [[TreeChanges]]\n *\n * @returns an IMatchingNodes object, or null. If an IMatchingNodes object is returned, its values\n * are the matching [[PathNode]]s for each [[HookMatchCriterion]] (to, from, exiting, retained, entering)\n */\n matches(treeChanges: TreeChanges): IMatchingNodes {\n let matches = this._getMatchingNodes(treeChanges);\n\n // Check if all the criteria matched the TreeChanges object\n let allMatched = values(matches).every(identity);\n return allMatched ? matches : null;\n }\n\n deregister() {\n this.removeHookFromRegistry(this);\n this._deregistered = true;\n }\n}\n\n/** @hidden Return a registration function of the requested type. */\nexport function makeEvent(registry: IHookRegistry, transitionService: TransitionService, eventType: TransitionEventType) {\n // Create the object which holds the registered transition hooks.\n const _registeredHooks = registry._registeredHooks = (registry._registeredHooks || {});\n const hooks = _registeredHooks[eventType.name] = [];\n const removeHookFn: (hook: RegisteredHook) => void = removeFrom(hooks);\n\n // Create hook registration function on the IHookRegistry for the event\n registry[eventType.name] = hookRegistrationFn;\n\n function hookRegistrationFn(matchObject, callback, options = {}) {\n const registeredHook = new RegisteredHook(transitionService, eventType, callback, matchObject, removeHookFn, options);\n hooks.push(registeredHook);\n return registeredHook.deregister.bind(registeredHook);\n }\n\n return hookRegistrationFn;\n}\n", - "/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\n\nimport {extend, tail, assertPredicate, unnestR, identity} from \"../common/common\";\nimport {isArray} from \"../common/predicates\";\n\nimport {\n TransitionOptions, TransitionHookOptions, IHookRegistry, TreeChanges, IMatchingNodes,\n TransitionHookPhase, TransitionHookScope\n} from \"./interface\";\n\nimport {Transition} from \"./transition\";\nimport {TransitionHook} from \"./transitionHook\";\nimport {StateObject} from \"../state/stateObject\";\nimport {PathNode} from \"../path/pathNode\";\nimport {TransitionService} from \"./transitionService\";\nimport {TransitionEventType} from \"./transitionEventType\";\nimport {RegisteredHook} from \"./hookRegistry\";\n\n/**\n * This class returns applicable TransitionHooks for a specific Transition instance.\n *\n * Hooks ([[RegisteredHook]]) may be registered globally, e.g., $transitions.onEnter(...), or locally, e.g.\n * myTransition.onEnter(...). The HookBuilder finds matching RegisteredHooks (where the match criteria is\n * determined by the type of hook)\n *\n * The HookBuilder also converts RegisteredHooks objects to TransitionHook objects, which are used to run a Transition.\n *\n * The HookBuilder constructor is given the $transitions service and a Transition instance. Thus, a HookBuilder\n * instance may only be used for one specific Transition object. (side note: the _treeChanges accessor is private\n * in the Transition class, so we must also provide the Transition's _treeChanges)\n *\n */\nexport class HookBuilder {\n constructor(private transition: Transition) { }\n\n buildHooksForPhase(phase: TransitionHookPhase): TransitionHook[] {\n let $transitions = this.transition.router.transitionService;\n return $transitions._pluginapi._getEvents(phase)\n .map(type => this.buildHooks(type))\n .reduce(unnestR, [])\n .filter(identity);\n }\n\n /**\n * Returns an array of newly built TransitionHook objects.\n *\n * - Finds all RegisteredHooks registered for the given `hookType` which matched the transition's [[TreeChanges]].\n * - Finds [[PathNode]] (or `PathNode[]`) to use as the TransitionHook context(s)\n * - For each of the [[PathNode]]s, creates a TransitionHook\n *\n * @param hookType the type of the hook registration function, e.g., 'onEnter', 'onFinish'.\n */\n buildHooks(hookType: TransitionEventType): TransitionHook[] {\n let transition = this.transition;\n let treeChanges = transition.treeChanges();\n\n // Find all the matching registered hooks for a given hook type\n let matchingHooks = this.getMatchingHooks(hookType, treeChanges);\n if (!matchingHooks) return [];\n\n let baseHookOptions = {\n transition: transition,\n current: transition.options().current\n };\n\n const makeTransitionHooks = (hook: RegisteredHook) => {\n // Fetch the Nodes that caused this hook to match.\n let matches: IMatchingNodes = hook.matches(treeChanges);\n // Select the PathNode[] that will be used as TransitionHook context objects\n let matchingNodes: PathNode[] = matches[hookType.criteriaMatchPath.name];\n\n // Return an array of HookTuples\n return matchingNodes.map(node => {\n let _options = extend({\n bind: hook.bind,\n traceData: { hookType: hookType.name, context: node }\n }, baseHookOptions);\n\n let state = hookType.criteriaMatchPath.scope === TransitionHookScope.STATE ? node.state.self : null;\n let transitionHook = new TransitionHook(transition, state, hook, _options);\n return { hook, node, transitionHook };\n });\n };\n\n return matchingHooks.map(makeTransitionHooks)\n .reduce(unnestR, [])\n .sort(tupleSort(hookType.reverseSort))\n .map(tuple => tuple.transitionHook);\n }\n\n /**\n * Finds all RegisteredHooks from:\n * - The Transition object instance hook registry\n * - The TransitionService ($transitions) global hook registry\n *\n * which matched:\n * - the eventType\n * - the matchCriteria (to, from, exiting, retained, entering)\n *\n * @returns an array of matched [[RegisteredHook]]s\n */\n public getMatchingHooks(hookType: TransitionEventType, treeChanges: TreeChanges): RegisteredHook[] {\n let isCreate = hookType.hookPhase === TransitionHookPhase.CREATE;\n\n // Instance and Global hook registries\n let $transitions = this.transition.router.transitionService;\n let registries = isCreate ? [ $transitions ] : [ this.transition, $transitions ];\n\n return registries.map((reg: IHookRegistry) => reg.getHooks(hookType.name)) // Get named hooks from registries\n .filter(assertPredicate(isArray, `broken event named: ${hookType.name}`)) // Sanity check\n .reduce(unnestR, []) // Un-nest RegisteredHook[][] to RegisteredHook[] array\n .filter(hook => hook.matches(treeChanges)); // Only those satisfying matchCriteria\n }\n}\n\ninterface HookTuple { hook: RegisteredHook, node: PathNode, transitionHook: TransitionHook }\n\n/**\n * A factory for a sort function for HookTuples.\n *\n * The sort function first compares the PathNode depth (how deep in the state tree a node is), then compares\n * the EventHook priority.\n *\n * @param reverseDepthSort a boolean, when true, reverses the sort order for the node depth\n * @returns a tuple sort function\n */\nfunction tupleSort(reverseDepthSort = false) {\n return function nodeDepthThenPriority(l: HookTuple, r: HookTuple): number {\n let factor = reverseDepthSort ? -1 : 1;\n let depthDelta = (l.node.state.path.length - r.node.state.path.length) * factor;\n return depthDelta !== 0 ? depthDelta : r.hook.priority - l.hook.priority;\n }\n}", - "/**\n * @coreapi\n * @module params\n */\n/** */\nimport {extend, filter, map} from \"../common/common\";\nimport {isArray, isDefined} from \"../common/predicates\";\nimport {ParamTypeDefinition} from \"./interface\";\n\n/**\n * An internal class which implements [[ParamTypeDefinition]].\n *\n * A [[ParamTypeDefinition]] is a plain javascript object used to register custom parameter types.\n * When a param type definition is registered, an instance of this class is created internally.\n *\n * This class has naive implementations for all the [[ParamTypeDefinition]] methods.\n *\n * Used by [[UrlMatcher]] when matching or formatting URLs, or comparing and validating parameter values.\n *\n * #### Example:\n * ```js\n * var paramTypeDef = {\n * decode: function(val) { return parseInt(val, 10); },\n * encode: function(val) { return val && val.toString(); },\n * equals: function(a, b) { return this.is(a) && a === b; },\n * is: function(val) { return angular.isNumber(val) && isFinite(val) && val % 1 === 0; },\n * pattern: /\\d+/\n * }\n *\n * var paramType = new ParamType(paramTypeDef);\n * ```\n * @internalapi\n */\nexport class ParamType implements ParamTypeDefinition {\n /** @inheritdoc */\n pattern: RegExp = /.*/;\n /** The name/id of the parameter type */\n name: string;\n /** @inheritdoc */\n raw: boolean;\n /** @inheritdoc */\n dynamic: boolean;\n /** @inheritdoc */\n inherit = true;\n\n /**\n * @param def A configuration object which contains the custom type definition. The object's\n * properties will override the default methods and/or pattern in `ParamType`'s public interface.\n * @returns a new ParamType object\n */\n constructor(def: ParamTypeDefinition) {\n extend(this, def);\n }\n\n\n // consider these four methods to be \"abstract methods\" that should be overridden\n /** @inheritdoc */\n is(val: any, key?: string): boolean { return true; }\n /** @inheritdoc */\n encode(val: any, key?: string): (string|string[]) { return val; }\n /** @inheritdoc */\n decode(val: string, key?: string): any { return val; }\n /** @inheritdoc */\n equals(a: any, b: any): boolean { return a == b; }\n\n\n $subPattern() {\n let sub = this.pattern.toString();\n return sub.substr(1, sub.length - 2);\n }\n\n toString() {\n return `{ParamType:${this.name}}`;\n }\n\n /** Given an encoded string, or a decoded object, returns a decoded object */\n $normalize(val: any) {\n return this.is(val) ? val : this.decode(val);\n }\n\n /**\n * Wraps an existing custom ParamType as an array of ParamType, depending on 'mode'.\n * e.g.:\n * - urlmatcher pattern \"/path?{queryParam[]:int}\"\n * - url: \"/path?queryParam=1&queryParam=2\n * - $stateParams.queryParam will be [1, 2]\n * if `mode` is \"auto\", then\n * - url: \"/path?queryParam=1 will create $stateParams.queryParam: 1\n * - url: \"/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2]\n */\n $asArray(mode: (boolean|\"auto\"), isSearch: boolean) {\n if (!mode) return this;\n if (mode === \"auto\" && !isSearch) throw new Error(\"'auto' array mode is for query parameters only\");\n return new ( ArrayType)(this, mode);\n }\n}\n\n/**\n * Wraps up a `ParamType` object to handle array values.\n * @internalapi\n */\nfunction ArrayType(type: ParamType, mode: (boolean|\"auto\")) {\n // Wrap non-array value as array\n function arrayWrap(val: any): any[] {\n return isArray(val) ? val : (isDefined(val) ? [ val ] : []);\n }\n\n // Unwrap array value for \"auto\" mode. Return undefined for empty array.\n function arrayUnwrap(val: any) {\n switch (val.length) {\n case 0: return undefined;\n case 1: return mode === \"auto\" ? val[0] : val;\n default: return val;\n }\n }\n\n // Wraps type (.is/.encode/.decode) functions to operate on each value of an array\n function arrayHandler(callback: (x: any) => any, allTruthyMode?: boolean) {\n return function handleArray(val: any) {\n if (isArray(val) && val.length === 0) return val;\n let arr = arrayWrap(val);\n let result = map(arr, callback);\n return (allTruthyMode === true) ? filter(result, x => !x).length === 0 : arrayUnwrap(result);\n };\n }\n\n // Wraps type (.equals) functions to operate on each value of an array\n function arrayEqualsHandler(callback: (l: any, r: any) => boolean) {\n return function handleArray(val1: any, val2: any) {\n let left = arrayWrap(val1), right = arrayWrap(val2);\n if (left.length !== right.length) return false;\n for (let i = 0; i < left.length; i++) {\n if (!callback(left[i], right[i])) return false;\n }\n return true;\n };\n }\n\n ['encode', 'decode', 'equals', '$normalize'].forEach(name => {\n var paramTypeFn = type[name].bind(type);\n var wrapperFn: Function = name === 'equals' ? arrayEqualsHandler : arrayHandler;\n this[name] = wrapperFn(paramTypeFn);\n });\n\n extend(this, {\n dynamic: type.dynamic,\n name: type.name,\n pattern: type.pattern,\n inherit: type.inherit,\n is: arrayHandler(type.is.bind(type), true),\n $arrayMode: mode\n });\n}\n", - "/**\n * @coreapi\n * @module params\n */ /** for typedoc */\nimport { extend, filter, map, allTrueR } from \"../common/common\";\nimport { prop } from \"../common/hof\";\nimport { isInjectable, isDefined, isString, isArray, isUndefined } from \"../common/predicates\";\nimport { RawParams, ParamDeclaration } from \"../params/interface\";\nimport { services } from \"../common/coreservices\";\nimport { ParamType } from \"./paramType\";\nimport { ParamTypes } from \"./paramTypes\";\nimport { UrlMatcherFactory } from \"../url/urlMatcherFactory\";\n\n/** @hidden */ let hasOwn = Object.prototype.hasOwnProperty;\n/** @hidden */ let isShorthand = (cfg: ParamDeclaration) =>\n [\"value\", \"type\", \"squash\", \"array\", \"dynamic\"].filter(hasOwn.bind(cfg || {})).length === 0;\n\n/** @internalapi */\nexport enum DefType {\n PATH,\n SEARCH,\n CONFIG,\n}\n\n/** @hidden */\nfunction unwrapShorthand(cfg: ParamDeclaration): ParamDeclaration {\n cfg = isShorthand(cfg) && { value: cfg } as any || cfg;\n\n getStaticDefaultValue['__cacheable'] = true;\n function getStaticDefaultValue() {\n return cfg.value;\n }\n\n return extend(cfg, {\n $$fn: isInjectable(cfg.value) ? cfg.value : getStaticDefaultValue,\n });\n}\n\n/** @hidden */\nfunction getType(cfg: ParamDeclaration, urlType: ParamType, location: DefType, id: string, paramTypes: ParamTypes) {\n if (cfg.type && urlType && urlType.name !== 'string') throw new Error(`Param '${id}' has two type configurations.`);\n if (cfg.type && urlType && urlType.name === 'string' && paramTypes.type(cfg.type as string)) return paramTypes.type(cfg.type as string);\n if (urlType) return urlType;\n if (!cfg.type) {\n let type = location === DefType.CONFIG ? \"any\" :\n location === DefType.PATH ? \"path\" :\n location === DefType.SEARCH ? \"query\" : \"string\";\n return paramTypes.type(type);\n }\n return cfg.type instanceof ParamType ? cfg.type : paramTypes.type(cfg.type as string);\n}\n\n/**\n * @internalapi\n * returns false, true, or the squash value to indicate the \"default parameter url squash policy\".\n */\nfunction getSquashPolicy(config: ParamDeclaration, isOptional: boolean, defaultPolicy: (boolean|string)) {\n let squash = config.squash;\n if (!isOptional || squash === false) return false;\n if (!isDefined(squash) || squash == null) return defaultPolicy;\n if (squash === true || isString(squash)) return squash;\n throw new Error(`Invalid squash policy: '${squash}'. Valid policies: false, true, or arbitrary string`);\n}\n\n/** @internalapi */\nfunction getReplace(config: ParamDeclaration, arrayMode: boolean, isOptional: boolean, squash: (string|boolean)) {\n let replace: any, configuredKeys: string[], defaultPolicy = [\n {from: \"\", to: (isOptional || arrayMode ? undefined : \"\")},\n {from: null, to: (isOptional || arrayMode ? undefined : \"\")},\n ];\n replace = isArray(config.replace) ? config.replace : [];\n if (isString(squash)) replace.push({ from: squash, to: undefined });\n configuredKeys = map(replace, prop(\"from\"));\n return filter(defaultPolicy, item => configuredKeys.indexOf(item.from) === -1).concat(replace);\n}\n\n\n/** @internalapi */\nexport class Param {\n id: string;\n type: ParamType;\n location: DefType;\n isOptional: boolean;\n dynamic: boolean;\n raw: boolean;\n squash: (boolean|string);\n replace: [{ to: any, from: any }];\n inherit: boolean;\n array: boolean;\n config: any;\n /** Cache the default value if it is a static value */\n _defaultValueCache: {\n defaultValue: any,\n };\n\n constructor(id: string, type: ParamType, config: ParamDeclaration, location: DefType, urlMatcherFactory: UrlMatcherFactory) {\n config = unwrapShorthand(config);\n type = getType(config, type, location, id, urlMatcherFactory.paramTypes);\n let arrayMode = getArrayMode();\n type = arrayMode ? type.$asArray(arrayMode, location === DefType.SEARCH) : type;\n let isOptional = config.value !== undefined || location === DefType.SEARCH;\n let dynamic = isDefined(config.dynamic) ? !!config.dynamic : !!type.dynamic;\n let raw = isDefined(config.raw) ? !!config.raw : !!type.raw;\n let squash = getSquashPolicy(config, isOptional, urlMatcherFactory.defaultSquashPolicy());\n let replace = getReplace(config, arrayMode, isOptional, squash);\n let inherit = isDefined(config.inherit) ? !!config.inherit : !!type.inherit;\n\n // array config: param name (param[]) overrides default settings. explicit config overrides param name.\n function getArrayMode() {\n let arrayDefaults = { array: (location === DefType.SEARCH ? \"auto\" : false) };\n let arrayParamNomenclature = id.match(/\\[\\]$/) ? { array: true } : {};\n return extend(arrayDefaults, arrayParamNomenclature, config).array;\n }\n\n extend(this, {id, type, location, isOptional, dynamic, raw, squash, replace, inherit, array: arrayMode, config });\n }\n\n isDefaultValue(value: any): boolean {\n return this.isOptional && this.type.equals(this.value(), value);\n }\n\n /**\n * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the\n * default value, which may be the result of an injectable function.\n */\n value(value?: any): any {\n /**\n * [Internal] Get the default value of a parameter, which may be an injectable function.\n */\n const getDefaultValue = () => {\n if (this._defaultValueCache) return this._defaultValueCache.defaultValue;\n\n if (!services.$injector) throw new Error(\"Injectable functions cannot be called at configuration time\");\n\n let defaultValue = services.$injector.invoke(this.config.$$fn);\n\n if (defaultValue !== null && defaultValue !== undefined && !this.type.is(defaultValue))\n throw new Error(`Default value (${defaultValue}) for parameter '${this.id}' is not an instance of ParamType (${this.type.name})`);\n\n if (this.config.$$fn['__cacheable']) {\n this._defaultValueCache = { defaultValue };\n }\n\n return defaultValue;\n };\n\n const replaceSpecialValues = (val: any) => {\n for (let tuple of this.replace) {\n if (tuple.from === val) return tuple.to;\n }\n return val;\n };\n\n value = replaceSpecialValues(value);\n\n return isUndefined(value) ? getDefaultValue() : this.type.$normalize(value);\n }\n\n isSearch(): boolean {\n return this.location === DefType.SEARCH;\n }\n\n validates(value: any): boolean {\n // There was no parameter value, but the param is optional\n if ((isUndefined(value) || value === null) && this.isOptional) return true;\n\n // The value was not of the correct ParamType, and could not be decoded to the correct ParamType\n const normalized = this.type.$normalize(value);\n if (!this.type.is(normalized)) return false;\n\n // The value was of the correct type, but when encoded, did not match the ParamType's regexp\n const encoded = this.type.encode(normalized);\n return !(isString(encoded) && !this.type.pattern.exec( encoded));\n }\n\n toString() {\n return `{Param:${this.id} ${this.type} squash: '${this.squash}' optional: ${this.isOptional}}`;\n }\n\n static values(params: Param[], values: RawParams = {}): RawParams {\n const paramValues = {} as RawParams;\n for (let param of params) {\n paramValues[param.id] = param.value(values[param.id]);\n }\n return paramValues;\n }\n\n /**\n * Finds [[Param]] objects which have different param values\n *\n * Filters a list of [[Param]] objects to only those whose parameter values differ in two param value objects\n *\n * @param params: The list of Param objects to filter\n * @param values1: The first set of parameter values\n * @param values2: the second set of parameter values\n *\n * @returns any Param objects whose values were different between values1 and values2\n */\n static changed(params: Param[], values1: RawParams = {}, values2: RawParams = {}): Param[] {\n return params.filter(param => !param.type.equals(values1[param.id], values2[param.id]));\n }\n\n /**\n * Checks if two param value objects are equal (for a set of [[Param]] objects)\n *\n * @param params The list of [[Param]] objects to check\n * @param values1 The first set of param values\n * @param values2 The second set of param values\n *\n * @returns true if the param values in values1 and values2 are equal\n */\n static equals(params: Param[], values1 = {}, values2 = {}): boolean {\n return Param.changed(params, values1, values2).length === 0;\n }\n\n /** Returns true if a the parameter values are valid, according to the Param definitions */\n static validates(params: Param[], values: RawParams = {}): boolean {\n return params.map(param => param.validates(values[param.id])).reduce(allTrueR, true);\n }\n}", - "/** @module path */ /** for typedoc */\nimport {extend, applyPairs, find, allTrueR, pairs, arrayTuples} from \"../common/common\";\nimport {propEq} from \"../common/hof\";\nimport {StateObject} from \"../state/stateObject\";\nimport {RawParams} from \"../params/interface\";\nimport {Param} from \"../params/param\";\nimport {Resolvable} from \"../resolve/resolvable\";\nimport {ViewConfig} from \"../view/interface\";\n\n/**\n * @internalapi\n *\n * A node in a [[TreeChanges]] path\n *\n * For a [[TreeChanges]] path, this class holds the stateful information for a single node in the path.\n * Each PathNode corresponds to a state being entered, exited, or retained.\n * The stateful information includes parameter values and resolve data.\n */\nexport class PathNode {\n /** The state being entered, exited, or retained */\n public state: StateObject;\n /** The parameters declared on the state */\n public paramSchema: Param[];\n /** The parameter values that belong to the state */\n public paramValues: { [key: string]: any };\n /** The individual (stateful) resolvable objects that belong to the state */\n public resolvables: Resolvable[];\n /** The state's declared view configuration objects */\n public views: ViewConfig[];\n\n /** Creates a copy of a PathNode */\n constructor(node: PathNode);\n /** Creates a new (empty) PathNode for a State */\n constructor(state: StateObject);\n constructor(stateOrNode: any) {\n if (stateOrNode instanceof PathNode) {\n let node: PathNode = stateOrNode;\n this.state = node.state;\n this.paramSchema = node.paramSchema.slice();\n this.paramValues = extend({}, node.paramValues);\n this.resolvables = node.resolvables.slice();\n this.views = node.views && node.views.slice();\n } else {\n let state: StateObject = stateOrNode;\n this.state = state;\n this.paramSchema = state.parameters({ inherit: false });\n this.paramValues = {};\n this.resolvables = state.resolvables.map(res => res.clone());\n }\n }\n\n /** Sets [[paramValues]] for the node, from the values of an object hash */\n applyRawParams(params: RawParams): PathNode {\n const getParamVal = (paramDef: Param) => [ paramDef.id, paramDef.value(params[paramDef.id]) ];\n this.paramValues = this.paramSchema.reduce((memo, pDef) => applyPairs(memo, getParamVal(pDef)), {});\n return this;\n }\n\n /** Gets a specific [[Param]] metadata that belongs to the node */\n parameter(name: string): Param {\n return find(this.paramSchema, propEq(\"id\", name));\n }\n\n /**\n * @returns true if the state and parameter values for another PathNode are\n * equal to the state and param values for this PathNode\n */\n equals(node: PathNode, paramsFn?: GetParamsFn): boolean {\n const diff = this.diff(node, paramsFn);\n return diff && diff.length === 0;\n }\n\n /**\n * Finds Params with different parameter values on another PathNode.\n *\n * Given another node (of the same state), finds the parameter values which differ.\n * Returns the [[Param]] (schema objects) whose parameter values differ.\n *\n * Given another node for a different state, returns `false`\n *\n * @param node The node to compare to\n * @param paramsFn A function that returns which parameters should be compared.\n * @returns The [[Param]]s which differ, or null if the two nodes are for different states\n */\n diff(node: PathNode, paramsFn?: GetParamsFn): Param[] | false {\n if (this.state !== node.state) return false;\n\n const params: Param[] = paramsFn ? paramsFn(this) : this.paramSchema;\n return Param.changed(params, this.paramValues, node.paramValues);\n }\n\n /** Returns a clone of the PathNode */\n static clone(node: PathNode) {\n return new PathNode(node);\n }\n}\n\n/** @hidden */\nexport type GetParamsFn = (pathNode: PathNode) => Param[];", - "/** @module path */ /** for typedoc */\n\nimport {\n extend, find, pick, omit, tail, mergeR, values, unnestR, Predicate, inArray, arrayTuples,\n} from \"../common/common\";\nimport {prop, propEq, not} from \"../common/hof\";\n\nimport {RawParams} from \"../params/interface\";\nimport {TreeChanges} from \"../transition/interface\";\nimport {ViewConfig} from \"../view/interface\";\nimport {_ViewDeclaration} from \"../state/interface\";\n\nimport {StateObject} from \"../state/stateObject\";\nimport {TargetState} from \"../state/targetState\";\nimport {GetParamsFn, PathNode} from \"./pathNode\";\nimport {ViewService} from \"../view/view\";\nimport { Param } from '../params/param';\nimport { StateRegistry } from '../state';\n\n/**\n * This class contains functions which convert TargetStates, Nodes and paths from one type to another.\n */\nexport class PathUtils {\n\n constructor() { }\n\n /** Given a PathNode[], create an TargetState */\n static makeTargetState(registry: StateRegistry, path: PathNode[]): TargetState {\n let state = tail(path).state;\n return new TargetState(registry, state, path.map(prop(\"paramValues\")).reduce(mergeR, {}), {});\n }\n\n static buildPath(targetState: TargetState) {\n let toParams = targetState.params();\n return targetState.$state().path.map(state => new PathNode(state).applyRawParams(toParams));\n }\n\n /** Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[] */\n static buildToPath(fromPath: PathNode[], targetState: TargetState): PathNode[] {\n let toPath: PathNode[] = PathUtils.buildPath(targetState);\n if (targetState.options().inherit) {\n return PathUtils.inheritParams(fromPath, toPath, Object.keys(targetState.params()));\n }\n return toPath;\n }\n\n /**\n * Creates ViewConfig objects and adds to nodes.\n *\n * On each [[PathNode]], creates ViewConfig objects from the views: property of the node's state\n */\n static applyViewConfigs($view: ViewService, path: PathNode[], states: StateObject[]) {\n // Only apply the viewConfigs to the nodes for the given states\n path.filter(node => inArray(states, node.state)).forEach(node => {\n let viewDecls: _ViewDeclaration[] = values(node.state.views || {});\n let subPath = PathUtils.subPath(path, n => n === node);\n let viewConfigs: ViewConfig[][] = viewDecls.map(view => $view.createViewConfig(subPath, view));\n node.views = viewConfigs.reduce(unnestR, []);\n });\n }\n\n /**\n * Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath\n *\n * For a parameter in a node to be inherited from the from path:\n * - The toPath's node must have a matching node in the fromPath (by state).\n * - The parameter name must not be found in the toKeys parameter array.\n *\n * Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some\n * caller, for instance, $state.transitionTo(..., toParams). If a key was found in toParams,\n * it is not inherited from the fromPath.\n */\n static inheritParams(fromPath: PathNode[], toPath: PathNode[], toKeys: string[] = []): PathNode[] {\n function nodeParamVals(path: PathNode[], state: StateObject): RawParams {\n let node: PathNode = find(path, propEq('state', state));\n return extend({}, node && node.paramValues);\n }\n\n let noInherit = fromPath.map(node => node.paramSchema)\n .reduce(unnestR, [])\n .filter(param => !param.inherit)\n .map(prop('id'));\n\n /**\n * Given an [[PathNode]] \"toNode\", return a new [[PathNode]] with param values inherited from the\n * matching node in fromPath. Only inherit keys that aren't found in \"toKeys\" from the node in \"fromPath\"\"\n */\n function makeInheritedParamsNode(toNode: PathNode): PathNode {\n // All param values for the node (may include default key/vals, when key was not found in toParams)\n let toParamVals = extend({}, toNode && toNode.paramValues);\n // limited to only those keys found in toParams\n let incomingParamVals = pick(toParamVals, toKeys);\n toParamVals = omit(toParamVals, toKeys);\n let fromParamVals = omit(nodeParamVals(fromPath, toNode.state) || {}, noInherit);\n // extend toParamVals with any fromParamVals, then override any of those those with incomingParamVals\n let ownParamVals: RawParams = extend(toParamVals, fromParamVals, incomingParamVals);\n return new PathNode(toNode.state).applyRawParams(ownParamVals);\n }\n\n // The param keys specified by the incoming toParams\n return toPath.map(makeInheritedParamsNode);\n }\n\n static nonDynamicParams = (node: PathNode): Param[] =>\n node.state.parameters({ inherit: false })\n .filter(param => !param.dynamic);\n\n /**\n * Computes the tree changes (entering, exiting) between a fromPath and toPath.\n */\n static treeChanges(fromPath: PathNode[], toPath: PathNode[], reloadState: StateObject): TreeChanges {\n let keep = 0, max = Math.min(fromPath.length, toPath.length);\n\n const nodesMatch = (node1: PathNode, node2: PathNode) =>\n node1.equals(node2, PathUtils.nonDynamicParams);\n\n while (keep < max && fromPath[keep].state !== reloadState && nodesMatch(fromPath[keep], toPath[keep])) {\n keep++;\n }\n\n /** Given a retained node, return a new node which uses the to node's param values */\n function applyToParams(retainedNode: PathNode, idx: number): PathNode {\n let cloned = PathNode.clone(retainedNode);\n cloned.paramValues = toPath[idx].paramValues;\n return cloned;\n }\n\n let from: PathNode[], retained: PathNode[], exiting: PathNode[], entering: PathNode[], to: PathNode[];\n\n from = fromPath;\n retained = from.slice(0, keep);\n exiting = from.slice(keep);\n\n // Create a new retained path (with shallow copies of nodes) which have the params of the toPath mapped\n let retainedWithToParams = retained.map(applyToParams);\n entering = toPath.slice(keep);\n to = (retainedWithToParams).concat(entering);\n\n return { from, to, retained, exiting, entering };\n }\n\n /**\n * Returns a new path which is: the subpath of the first path which matches the second path.\n *\n * The new path starts from root and contains any nodes that match the nodes in the second path.\n * It stops before the first non-matching node.\n *\n * Nodes are compared using their state property and their parameter values.\n * If a `paramsFn` is provided, only the [[Param]] returned by the function will be considered when comparing nodes.\n *\n * @param pathA the first path\n * @param pathB the second path\n * @param paramsFn a function which returns the parameters to consider when comparing\n *\n * @returns an array of PathNodes from the first path which match the nodes in the second path\n */\n static matching(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): PathNode[] {\n let done = false;\n let tuples: PathNode[][] = arrayTuples(pathA, pathB);\n return tuples.reduce((matching, [nodeA, nodeB]) => {\n done = done || !nodeA.equals(nodeB, paramsFn);\n return done ? matching : matching.concat(nodeA);\n }, []);\n }\n\n /**\n * Returns true if two paths are identical.\n *\n * @param pathA\n * @param pathB\n * @param paramsFn a function which returns the parameters to consider when comparing\n * @returns true if the the states and parameter values for both paths are identical\n */\n static equals(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): boolean {\n return pathA.length === pathB.length &&\n PathUtils.matching(pathA, pathB, paramsFn).length === pathA.length;\n }\n\n /**\n * Return a subpath of a path, which stops at the first matching node\n *\n * Given an array of nodes, returns a subset of the array starting from the first node,\n * stopping when the first node matches the predicate.\n *\n * @param path a path of [[PathNode]]s\n * @param predicate a [[Predicate]] fn that matches [[PathNode]]s\n * @returns a subpath up to the matching node, or undefined if no match is found\n */\n static subPath(path: PathNode[], predicate: Predicate): PathNode[] {\n let node = find(path, predicate);\n let elementIdx = path.indexOf(node);\n return elementIdx === -1 ? undefined : path.slice(0, elementIdx + 1);\n }\n\n /** Gets the raw parameter values from a path */\n static paramValues = (path: PathNode[]) =>\n path.reduce((acc, node) => extend(acc, node.paramValues), {});\n}\n", - "/**\n * @coreapi\n * @module resolve\n */ /** for typedoc */\nimport {extend, equals, inArray, identity} from \"../common/common\";\nimport {services} from \"../common/coreservices\";\nimport {trace} from \"../common/trace\";\nimport {ResolvePolicy, ResolvableLiteral, resolvePolicies} from \"./interface\";\n\nimport {ResolveContext} from \"./resolveContext\";\nimport {stringify} from \"../common/strings\";\nimport {isFunction, isObject} from \"../common/predicates\";\nimport {Transition} from \"../transition/transition\";\nimport {StateObject} from \"../state/stateObject\";\nimport {PathNode} from \"../path/pathNode\";\nimport { isNullOrUndefined } from '../common';\n\n\n// TODO: explicitly make this user configurable\nexport let defaultResolvePolicy: ResolvePolicy = {\n when: \"LAZY\",\n async: \"WAIT\"\n};\n\n/**\n * The basic building block for the resolve system.\n *\n * Resolvables encapsulate a state's resolve's resolveFn, the resolveFn's declared dependencies, the wrapped (.promise),\n * and the unwrapped-when-complete (.data) result of the resolveFn.\n *\n * Resolvable.get() either retrieves the Resolvable's existing promise, or else invokes resolve() (which invokes the\n * resolveFn) and returns the resulting promise.\n *\n * Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first\n * parameter to those fns.\n */\nexport class Resolvable implements ResolvableLiteral {\n token: any;\n policy: ResolvePolicy;\n resolveFn: Function;\n deps: any[];\n\n data: any;\n resolved: boolean = false;\n promise: Promise = undefined;\n\n /** This constructor creates a Resolvable copy */\n constructor(resolvable: Resolvable)\n\n /** This constructor creates a new Resolvable from the plain old [[ResolvableLiteral]] javascript object */\n constructor(resolvable: ResolvableLiteral)\n\n /**\n * This constructor creates a new `Resolvable`\n *\n * #### Example:\n * ```js\n * var resolvable1 = new Resolvable('mytoken', http => http.get('foo.json').toPromise(), [Http]);\n *\n * var resolvable2 = new Resolvable(UserService, dep => new UserService(dep.data), [SomeDependency]);\n *\n * var resolvable1Clone = new Resolvable(resolvable1);\n * ```\n *\n * @param token The new resolvable's injection token, such as `\"userList\"` (a string) or `UserService` (a class).\n * When this token is used during injection, the resolved value will be injected.\n * @param resolveFn The function that returns the resolved value, or a promise for the resolved value\n * @param deps An array of dependencies, which will be injected into the `resolveFn`\n * @param policy the [[ResolvePolicy]] defines when and how the Resolvable is processed\n * @param data Pre-resolved data. If the resolve value is already known, it may be provided here.\n */\n constructor(token: any, resolveFn: Function, deps?: any[], policy?: ResolvePolicy, data?: any)\n constructor(arg1: any, resolveFn?: Function, deps?: any[], policy?: ResolvePolicy, data?: any) {\n if (arg1 instanceof Resolvable) {\n extend(this, arg1);\n } else if (isFunction(resolveFn)) {\n if (isNullOrUndefined(arg1)) throw new Error(\"new Resolvable(): token argument is required\");\n if (!isFunction(resolveFn)) throw new Error(\"new Resolvable(): resolveFn argument must be a function\");\n\n this.token = arg1;\n this.policy = policy;\n this.resolveFn = resolveFn;\n this.deps = deps || [];\n\n this.data = data;\n this.resolved = data !== undefined;\n this.promise = this.resolved ? services.$q.when(this.data) : undefined;\n } else if (isObject(arg1) && arg1.token && isFunction(arg1.resolveFn)) {\n let literal = arg1;\n return new Resolvable(literal.token, literal.resolveFn, literal.deps, literal.policy, literal.data);\n }\n }\n\n getPolicy(state: StateObject): ResolvePolicy {\n let thisPolicy = this.policy || {};\n let statePolicy = state && state.resolvePolicy || {};\n return {\n when: thisPolicy.when || statePolicy.when || defaultResolvePolicy.when,\n async: thisPolicy.async || statePolicy.async || defaultResolvePolicy.async,\n };\n }\n\n /**\n * Asynchronously resolve this Resolvable's data\n *\n * Given a ResolveContext that this Resolvable is found in:\n * Wait for this Resolvable's dependencies, then invoke this Resolvable's function\n * and update the Resolvable's state\n */\n resolve(resolveContext: ResolveContext, trans?: Transition) {\n let $q = services.$q;\n\n // Gets all dependencies from ResolveContext and wait for them to be resolved\n const getResolvableDependencies = () =>\n $q.all(resolveContext.getDependencies(this).map(resolvable =>\n resolvable.get(resolveContext, trans))) as Promise;\n\n // Invokes the resolve function passing the resolved dependencies as arguments\n const invokeResolveFn = (resolvedDeps: any[]) =>\n this.resolveFn.apply(null, resolvedDeps);\n\n /**\n * For RXWAIT policy:\n *\n * Given an observable returned from a resolve function:\n * - enables .cache() mode (this allows multicast subscribers)\n * - then calls toPromise() (this triggers subscribe() and thus fetches)\n * - Waits for the promise, then return the cached observable (not the first emitted value).\n */\n const waitForRx = (observable$: any) => {\n let cached = observable$.cache(1);\n return cached.take(1).toPromise().then(() => cached);\n };\n\n // If the resolve policy is RXWAIT, wait for the observable to emit something. otherwise pass through.\n let node: PathNode = resolveContext.findNode(this);\n let state: StateObject = node && node.state;\n let maybeWaitForRx = this.getPolicy(state).async === \"RXWAIT\" ? waitForRx : identity;\n\n // After the final value has been resolved, update the state of the Resolvable\n const applyResolvedValue = (resolvedValue: any) => {\n this.data = resolvedValue;\n this.resolved = true;\n trace.traceResolvableResolved(this, trans);\n return this.data;\n };\n\n // Sets the promise property first, then getsResolvableDependencies in the context of the promise chain. Always waits one tick.\n return this.promise = $q.when()\n .then(getResolvableDependencies)\n .then(invokeResolveFn)\n .then(maybeWaitForRx)\n .then(applyResolvedValue);\n }\n\n /**\n * Gets a promise for this Resolvable's data.\n *\n * Fetches the data and returns a promise.\n * Returns the existing promise if it has already been fetched once.\n */\n get(resolveContext: ResolveContext, trans?: Transition): Promise {\n return this.promise || this.resolve(resolveContext, trans);\n }\n\n toString() {\n return `Resolvable(token: ${stringify(this.token)}, requires: [${this.deps.map(stringify)}])`;\n }\n\n clone(): Resolvable {\n return new Resolvable(this);\n }\n \n static fromData = (token: any, data: any) => \n new Resolvable(token, () => data, null, null, data);\n}\n", - "/**\n * # The Resolve subsystem\n *\n * This subsystem is an asynchronous, hierarchical Dependency Injection system.\n *\n * Typically, resolve is configured on a state using a [[StateDeclaration.resolve]] declaration.\n *\n * @coreapi\n * @module resolve\n */ /** for typedoc */\nimport {Resolvable} from \"./resolvable\";\n\n/**\n * An interface which is similar to an Angular 2 `Provider`\n */\nexport interface ProviderLike {\n provide: any,\n useClass?: any,\n useFactory?: Function,\n useValue?: any,\n useExisting?: any,\n deps?: any[]\n}\n\n/**\n * A plain object used to describe a [[Resolvable]]\n *\n * These objects may be used in the [[StateDeclaration.resolve]] array to declare\n * async data that the state or substates require.\n *\n * #### Example:\n * ```js\n *\n * var state = {\n * name: 'main',\n * resolve: [\n * { token: 'myData', deps: [MyDataApi], resolveFn: (myDataApi) => myDataApi.getData() },\n * ],\n * }\n * ```\n */\nexport interface ResolvableLiteral {\n /**\n * A Dependency Injection token\n *\n * This Resolvable's DI token.\n * The Resolvable will be injectable elsewhere using the token.\n */\n token: any;\n\n /**\n * A function which fetches the Resolvable's data\n *\n * A function which returns one of:\n *\n * - The resolved value (synchronously)\n * - A promise for the resolved value\n * - An Observable of the resolved value(s)\n *\n * This function will be provided the dependencies listed in [[deps]] as its arguments.\n * The resolve system will asynchronously fetch the dependencies before invoking this function.\n */\n resolveFn: Function;\n\n /**\n * Defines the Resolve Policy\n *\n * A policy that defines when to invoke the resolve,\n * and whether to wait for async and unwrap the data\n */\n policy?: ResolvePolicy;\n\n /**\n * The Dependency Injection tokens\n *\n * This is an array of Dependency Injection tokens for the dependencies of the [[resolveFn]].\n *\n * The DI tokens are references to other `Resolvables`, or to other\n * services from the native DI system.\n */\n deps?: any[];\n\n /** Pre-resolved data. */\n data?: any\n}\n\n/**\n * Defines how a resolve is processed during a transition\n *\n * This object is the [[StateDeclaration.resolvePolicy]] property.\n *\n * #### Example:\n * ```js\n * // Fetched when the resolve's state is being entered.\n * // Wait for the promise to resolve.\n * var policy1 = { when: \"LAZY\", async: \"WAIT\" }\n *\n * // Fetched when the Transition is starting.\n * // Do not wait for the returned promise to resolve.\n * // Inject the raw promise/value\n * var policy2 = { when: \"EAGER\", async: \"NOWAIT\" }\n * ```\n *\n * The policy for a given Resolvable is merged from three sources (highest priority first):\n *\n * - 1) Individual resolve definition\n * - 2) State definition\n * - 3) Global default\n *\n * #### Example:\n * ```js\n * // Wait for an Observable to emit one item.\n * // Since `wait` is not specified, it uses the `wait`\n * // policy defined on the state, or the global default\n * // if no `wait` policy is defined on the state\n * var myResolvablePolicy = { async: \"RXWAIT\" }\n * ```\n */\nexport interface ResolvePolicy {\n /**\n * Defines when a Resolvable is resolved (fetched) during a transition\n *\n * - `LAZY` (default)\n * - Resolved as the resolve's state is being entered\n * - `EAGER`\n * - Resolved as the transition is starting\n *\n * #### Example:\n * Resolves for `main` and `main.home` are fetched when each state is entered.\n * All of `main` resolves are processed before fetching `main.home` resolves.\n * ```js\n * var state = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { when: 'LAZY' }, // default\n * }\n *\n * var state = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { when: 'LAZY' }, // default\n * }\n * ```\n *\n * #### Example:\n * Resolves for `main` and `main.home` are fetched at the same time when the transition starts.\n * This happens earlier in the lifecycle than when states are entered.\n * All of the `main` and `main.home` resolves are fetched as soon as possible.\n * ```js\n * var mainState = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { when: 'EAGER' },\n * }\n *\n * var homeState = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { when: 'EAGER' },\n * }\n * ```\n */\n when?: PolicyWhen;\n\n /**\n * Determines the unwrapping behavior of asynchronous resolve values.\n *\n * - `WAIT` (default)\n * - If a promise is returned from the resolveFn, wait for the promise before proceeding\n * - The unwrapped value from the promise\n * - `NOWAIT`\n * - If a promise is returned from the resolve, do not wait for the promise.\n * - Any other value returned is wrapped in a promise.\n * - The promise will not be unwrapped.\n * - The promise itself will be provided when the resolve is injected or bound elsewhere.\n * - `RXWAIT`\n * - When an Observable is returned from the resolveFn, wait until the Observable emits at least one item.\n * - The Observable item will not be unwrapped.\n * - The Observable stream itself will be provided when the resolve is injected or bound elsewhere.\n *\n * #### Example:\n * The `Transition` will not wait for the resolve promise(s) from `main` to settle before continuing.\n * Resolves for `main` will be provided to components wrapped in a `Promise`.\n *\n * The `Transition` will wait for the `main.home` resolve promises.\n * Resolved values will be unwrapped before being provided to components.\n * ```js\n * var mainState = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { async: 'NOWAIT' },\n * }\n * var homeState = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { async: 'WAIT' }, // default\n * }\n * ```\n */\n async?: PolicyAsync;\n}\n\nexport type PolicyWhen = \"LAZY\" | \"EAGER\" ;\nexport type PolicyAsync = \"WAIT\" | \"NOWAIT\" | \"RXWAIT\" ;\n\n/** @internalapi */\nexport let resolvePolicies = {\n when: {\n LAZY: \"LAZY\",\n EAGER: \"EAGER\"\n },\n async: {\n WAIT: \"WAIT\",\n NOWAIT: \"NOWAIT\",\n RXWAIT: \"RXWAIT\"\n }\n};\n", - "/** @module resolve */\n/** for typedoc */\nimport { find, tail, uniqR, unnestR, inArray } from \"../common/common\";\nimport { propEq, not } from \"../common/hof\";\nimport { trace } from \"../common/trace\";\nimport { services, $InjectorLike } from \"../common/coreservices\";\nimport { resolvePolicies, PolicyWhen, ResolvePolicy } from \"./interface\";\nimport { PathNode } from \"../path/pathNode\";\nimport { Resolvable } from \"./resolvable\";\nimport { StateObject } from \"../state/stateObject\";\nimport { PathUtils } from \"../path/pathFactory\";\nimport { stringify } from \"../common/strings\";\nimport { Transition } from \"../transition/transition\";\nimport { UIInjector } from \"../interface\";\nimport { isUndefined } from '../common';\n\nconst whens = resolvePolicies.when;\nconst ALL_WHENS = [whens.EAGER, whens.LAZY];\nconst EAGER_WHENS = [whens.EAGER];\n\nexport const NATIVE_INJECTOR_TOKEN: string = \"Native Injector\";\n\n/**\n * Encapsulates Dependency Injection for a path of nodes\n *\n * UI-Router states are organized as a tree.\n * A nested state has a path of ancestors to the root of the tree.\n * When a state is being activated, each element in the path is wrapped as a [[PathNode]].\n * A `PathNode` is a stateful object that holds things like parameters and resolvables for the state being activated.\n *\n * The ResolveContext closes over the [[PathNode]]s, and provides DI for the last node in the path.\n */\nexport class ResolveContext {\n _injector: UIInjector;\n\n constructor(private _path: PathNode[]) { }\n\n /** Gets all the tokens found in the resolve context, de-duplicated */\n getTokens(): any[] {\n return this._path.reduce((acc, node) => acc.concat(node.resolvables.map(r => r.token)), []).reduce(uniqR, []);\n }\n\n /**\n * Gets the Resolvable that matches the token\n *\n * Gets the last Resolvable that matches the token in this context, or undefined.\n * Throws an error if it doesn't exist in the ResolveContext\n */\n getResolvable(token: any): Resolvable {\n let matching = this._path.map(node => node.resolvables)\n .reduce(unnestR, [])\n .filter((r: Resolvable) => r.token === token);\n return tail(matching);\n }\n\n /** Returns the [[ResolvePolicy]] for the given [[Resolvable]] */\n getPolicy(resolvable: Resolvable): ResolvePolicy {\n let node = this.findNode(resolvable);\n return resolvable.getPolicy(node.state);\n }\n\n /**\n * Returns a ResolveContext that includes a portion of this one\n *\n * Given a state, this method creates a new ResolveContext from this one.\n * The new context starts at the first node (root) and stops at the node for the `state` parameter.\n *\n * #### Why\n *\n * When a transition is created, the nodes in the \"To Path\" are injected from a ResolveContext.\n * A ResolveContext closes over a path of [[PathNode]]s and processes the resolvables.\n * The \"To State\" can inject values from its own resolvables, as well as those from all its ancestor state's (node's).\n * This method is used to create a narrower context when injecting ancestor nodes.\n *\n * @example\n * `let ABCD = new ResolveContext([A, B, C, D]);`\n *\n * Given a path `[A, B, C, D]`, where `A`, `B`, `C` and `D` are nodes for states `a`, `b`, `c`, `d`:\n * When injecting `D`, `D` should have access to all resolvables from `A`, `B`, `C`, `D`.\n * However, `B` should only be able to access resolvables from `A`, `B`.\n *\n * When resolving for the `B` node, first take the full \"To Path\" Context `[A,B,C,D]` and limit to the subpath `[A,B]`.\n * `let AB = ABCD.subcontext(a)`\n */\n subContext(state: StateObject): ResolveContext {\n return new ResolveContext(PathUtils.subPath(this._path, node => node.state === state));\n }\n\n /**\n * Adds Resolvables to the node that matches the state\n *\n * This adds a [[Resolvable]] (generally one created on the fly; not declared on a [[StateDeclaration.resolve]] block).\n * The resolvable is added to the node matching the `state` parameter.\n *\n * These new resolvables are not automatically fetched.\n * The calling code should either fetch them, fetch something that depends on them,\n * or rely on [[resolvePath]] being called when some state is being entered.\n *\n * Note: each resolvable's [[ResolvePolicy]] is merged with the state's policy, and the global default.\n *\n * @param newResolvables the new Resolvables\n * @param state Used to find the node to put the resolvable on\n */\n addResolvables(newResolvables: Resolvable[], state: StateObject) {\n let node = find(this._path, propEq('state', state));\n let keys = newResolvables.map(r => r.token);\n node.resolvables = node.resolvables.filter(r => keys.indexOf(r.token) === -1).concat(newResolvables);\n }\n\n /**\n * Returns a promise for an array of resolved path Element promises\n *\n * @param when\n * @param trans\n * @returns {Promise|any}\n */\n resolvePath(when: PolicyWhen = \"LAZY\", trans?: Transition): Promise<{ token: any, value: any }[]> {\n // This option determines which 'when' policy Resolvables we are about to fetch.\n let whenOption: string = inArray(ALL_WHENS, when) ? when : \"LAZY\";\n // If the caller specified EAGER, only the EAGER Resolvables are fetched.\n // if the caller specified LAZY, both EAGER and LAZY Resolvables are fetched.`\n let matchedWhens = whenOption === resolvePolicies.when.EAGER ? EAGER_WHENS : ALL_WHENS;\n\n // get the subpath to the state argument, if provided\n trace.traceResolvePath(this._path, when, trans);\n\n const matchesPolicy = (acceptedVals: string[], whenOrAsync: \"when\"|\"async\") =>\n (resolvable: Resolvable) =>\n inArray(acceptedVals, this.getPolicy(resolvable)[whenOrAsync]);\n\n // Trigger all the (matching) Resolvables in the path\n // Reduce all the \"WAIT\" Resolvables into an array\n let promises: Promise[] = this._path.reduce((acc, node) => {\n let nodeResolvables = node.resolvables.filter(matchesPolicy(matchedWhens, 'when'));\n let nowait = nodeResolvables.filter(matchesPolicy(['NOWAIT'], 'async'));\n let wait = nodeResolvables.filter(not(matchesPolicy(['NOWAIT'], 'async')));\n\n // For the matching Resolvables, start their async fetch process.\n let subContext = this.subContext(node.state);\n let getResult = (r: Resolvable) => r.get(subContext, trans)\n // Return a tuple that includes the Resolvable's token\n .then(value => ({ token: r.token, value: value }));\n nowait.forEach(getResult);\n return acc.concat(wait.map(getResult));\n }, []);\n\n // Wait for all the \"WAIT\" resolvables\n return services.$q.all(promises);\n }\n\n injector(): UIInjector {\n return this._injector || (this._injector = new UIInjectorImpl(this));\n }\n\n findNode(resolvable: Resolvable): PathNode {\n return find(this._path, (node: PathNode) => inArray(node.resolvables, resolvable));\n }\n\n /**\n * Gets the async dependencies of a Resolvable\n *\n * Given a Resolvable, returns its dependencies as a Resolvable[]\n */\n getDependencies(resolvable: Resolvable): Resolvable[] {\n let node = this.findNode(resolvable);\n // Find which other resolvables are \"visible\" to the `resolvable` argument\n // subpath stopping at resolvable's node, or the whole path (if the resolvable isn't in the path)\n let subPath: PathNode[] = PathUtils.subPath(this._path, x => x === node) || this._path;\n let availableResolvables: Resolvable[] = subPath\n .reduce((acc, _node) => acc.concat(_node.resolvables), []) //all of subpath's resolvables\n .filter(res => res !== resolvable); // filter out the `resolvable` argument\n\n const getDependency = (token: any) => {\n let matching = availableResolvables.filter(r => r.token === token);\n if (matching.length) return tail(matching);\n\n let fromInjector = this.injector().getNative(token);\n if (isUndefined(fromInjector)) {\n throw new Error(\"Could not find Dependency Injection token: \" + stringify(token));\n }\n\n return new Resolvable(token, () => fromInjector, [], fromInjector);\n };\n\n return resolvable.deps.map(getDependency);\n }\n}\n\nclass UIInjectorImpl implements UIInjector {\n native: $InjectorLike;\n\n constructor(public context: ResolveContext) {\n this.native = this.get(NATIVE_INJECTOR_TOKEN) || services.$injector;\n }\n\n get(token: any) {\n let resolvable = this.context.getResolvable(token);\n if (resolvable) {\n if (this.context.getPolicy(resolvable).async === 'NOWAIT') {\n return resolvable.get(this.context);\n }\n\n if (!resolvable.resolved) {\n throw new Error(\"Resolvable async .get() not complete:\" + stringify(resolvable.token))\n }\n return resolvable.data;\n }\n\n return this.getNative(token);\n }\n\n getAsync(token: any) {\n let resolvable = this.context.getResolvable(token);\n if (resolvable) return resolvable.get(this.context);\n return services.$q.when(this.native.get(token));\n }\n\n getNative(token: any) {\n return this.native && this.native.get(token);\n }\n}\n", - "/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport { trace } from '../common/trace';\nimport { services } from '../common/coreservices';\nimport { stringify } from '../common/strings';\nimport { map, find, extend, mergeR, tail, omit, arrayTuples, unnestR, identity, anyTrueR } from '../common/common';\nimport {isObject, isUndefined} from '../common/predicates';\nimport { prop, propEq, val, not, is } from '../common/hof';\nimport { StateDeclaration, StateOrName } from '../state/interface';\nimport {\n TransitionOptions, TreeChanges, IHookRegistry, TransitionHookPhase, RegisteredHooks, HookRegOptions,\n HookMatchCriteria, TransitionStateHookFn, TransitionHookFn,\n} from './interface'; // has or is using\nimport { TransitionHook } from './transitionHook';\nimport { matchState, makeEvent, RegisteredHook } from './hookRegistry';\nimport { HookBuilder } from './hookBuilder';\nimport { PathNode } from '../path/pathNode';\nimport { PathUtils } from '../path/pathFactory';\nimport { StateObject } from '../state/stateObject';\nimport { TargetState } from '../state/targetState';\nimport { Param } from '../params/param';\nimport { Resolvable } from '../resolve/resolvable';\nimport { ViewConfig } from '../view/interface';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { UIRouter } from '../router';\nimport { UIInjector } from '../interface';\nimport { RawParams } from '../params/interface';\nimport { ResolvableLiteral } from '../resolve/interface';\n\n/** @hidden */\nconst stateSelf: (_state: StateObject) => StateDeclaration = prop(\"self\");\n\n/**\n * Represents a transition between two states.\n *\n * When navigating to a state, we are transitioning **from** the current state **to** the new state.\n *\n * This object contains all contextual information about the to/from states, parameters, resolves.\n * It has information about all states being entered and exited as a result of the transition.\n */\nexport class Transition implements IHookRegistry {\n\n /** @hidden */\n static diToken = Transition;\n\n /**\n * A unique identifier for the transition.\n *\n * This is an auto incrementing integer, starting from `0`.\n */\n $id: number;\n\n /**\n * A reference to the [[UIRouter]] instance\n *\n * This reference can be used to access the router services, such as the [[StateService]]\n */\n router: UIRouter;\n\n /** @hidden */\n private _deferred = services.$q.defer();\n /**\n * This promise is resolved or rejected based on the outcome of the Transition.\n *\n * When the transition is successful, the promise is resolved\n * When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error\n */\n promise: Promise = this._deferred.promise;\n /**\n * A boolean which indicates if the transition was successful\n *\n * After a successful transition, this value is set to true.\n * After an unsuccessful transition, this value is set to false.\n *\n * The value will be undefined if the transition is not complete\n */\n success: boolean;\n /** @hidden */\n _aborted: boolean;\n /** @hidden */\n private _error: any;\n\n /** @hidden Holds the hook registration functions such as those passed to Transition.onStart() */\n _registeredHooks: RegisteredHooks = { };\n\n /** @hidden */\n private _options: TransitionOptions;\n /** @hidden */\n private _treeChanges: TreeChanges;\n /** @hidden */\n private _targetState: TargetState;\n /** @hidden */\n private _hookBuilder = new HookBuilder(this);\n\n\n /** @hidden */\n onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n\n /** @hidden\n * Creates the transition-level hook registration functions\n * (which can then be used to register hooks)\n */\n private createTransitionHookRegFns() {\n this.router.transitionService._pluginapi._getEvents()\n .filter(type => type.hookPhase !== TransitionHookPhase.CREATE)\n .forEach(type => makeEvent(this, this.router.transitionService, type));\n }\n\n /** @internalapi */\n getHooks(hookName: string): RegisteredHook[] {\n return this._registeredHooks[hookName];\n }\n\n /**\n * Creates a new Transition object.\n *\n * If the target state is not valid, an error is thrown.\n *\n * @internalapi\n *\n * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`\n * encapsulates the \"from state\".\n * @param targetState The target state and parameters being transitioned to (also, the transition options)\n * @param router The [[UIRouter]] instance\n */\n constructor(fromPath: PathNode[], targetState: TargetState, router: UIRouter) {\n this.router = router;\n this._targetState = targetState;\n\n if (!targetState.valid()) {\n throw new Error(targetState.error());\n }\n\n // current() is assumed to come from targetState.options, but provide a naive implementation otherwise.\n this._options = extend({ current: val(this) }, targetState.options());\n this.$id = router.transitionService._transitionCount++;\n let toPath = PathUtils.buildToPath(fromPath, targetState);\n this._treeChanges = PathUtils.treeChanges(fromPath, toPath, this._options.reloadState);\n this.createTransitionHookRegFns();\n\n let onCreateHooks = this._hookBuilder.buildHooksForPhase(TransitionHookPhase.CREATE);\n TransitionHook.invokeHooks(onCreateHooks, () => null);\n\n this.applyViewConfigs(router);\n }\n\n private applyViewConfigs(router: UIRouter) {\n let enteringStates = this._treeChanges.entering.map(node => node.state);\n PathUtils.applyViewConfigs(router.transitionService.$view, this._treeChanges.to, enteringStates);\n }\n\n /**\n * @internalapi\n *\n * @returns the internal from [State] object\n */\n $from() {\n return tail(this._treeChanges.from).state;\n }\n\n /**\n * @internalapi\n *\n * @returns the internal to [State] object\n */\n $to() {\n return tail(this._treeChanges.to).state;\n }\n\n /**\n * Returns the \"from state\"\n *\n * Returns the state that the transition is coming *from*.\n *\n * @returns The state declaration object for the Transition's (\"from state\").\n */\n from(): StateDeclaration {\n return this.$from().self;\n }\n\n /**\n * Returns the \"to state\"\n *\n * Returns the state that the transition is going *to*.\n *\n * @returns The state declaration object for the Transition's target state (\"to state\").\n */\n to(): StateDeclaration {\n return this.$to().self;\n }\n\n /**\n * Gets the Target State\n *\n * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object.\n *\n * @returns the [[TargetState]] of this Transition\n */\n targetState() {\n return this._targetState;\n }\n\n /**\n * Determines whether two transitions are equivalent.\n * @deprecated\n */\n is(compare: (Transition|{to?: any, from?: any})): boolean {\n if (compare instanceof Transition) {\n // TODO: Also compare parameters\n return this.is({ to: compare.$to().name, from: compare.$from().name });\n }\n return !(\n (compare.to && !matchState(this.$to(), compare.to)) ||\n (compare.from && !matchState(this.$from(), compare.from))\n );\n }\n\n /**\n * Gets transition parameter values\n *\n * Returns the parameter values for a transition as key/value pairs.\n * This object is immutable.\n *\n * By default, returns the new parameter values (for the \"to state\").\n *\n * #### Example:\n * ```js\n * var toParams = transition.params();\n * ```\n *\n * To return the previous parameter values, supply `'from'` as the `pathname` argument.\n *\n * #### Example:\n * ```js\n * var fromParams = transition.params('from');\n * ```\n *\n * @param pathname the name of the treeChanges path to get parameter values for:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n *\n * @returns transition parameter values for the desired path.\n */\n params(pathname?: string): any;\n params(pathname?: string): T;\n params(pathname: string = \"to\") {\n return Object.freeze(this._treeChanges[pathname].map(prop(\"paramValues\")).reduce(mergeR, {}));\n }\n\n\n /**\n * Creates a [[UIInjector]] Dependency Injector\n *\n * Returns a Dependency Injector for the Transition's target state (to state).\n * The injector provides resolve values which the target state has access to.\n *\n * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2).\n *\n * #### Example:\n * ```js\n * .onEnter({ entering: 'myState' }, trans => {\n * var myResolveValue = trans.injector().get('myResolve');\n * // Inject a global service from the global/native injector (if it exists)\n * var MyService = trans.injector().get('MyService');\n * })\n * ```\n *\n * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched.\n * You can use [[UIInjector.getAsync]] to get a promise for the data.\n * #### Example:\n * ```js\n * .onBefore({}, trans => {\n * return trans.injector().getAsync('myResolve').then(myResolveValue =>\n * return myResolveValue !== 'ABORT';\n * });\n * });\n * ```\n *\n * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to.\n * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`.\n * #### Example:\n * ```js\n * .onEnter({ to: 'foo.bar' }, trans => {\n * // returns result of `foo` state's `myResolve` resolve\n * // even though `foo.bar` also has a `myResolve` resolve\n * var fooData = trans.injector('foo').get('myResolve');\n * });\n * ```\n *\n * If you need resolve data from the exiting states, pass `'from'` as `pathName`.\n * The resolve data from the `from` path will be returned.\n * #### Example:\n * ```js\n * .onExit({ exiting: 'foo.bar' }, trans => {\n * // Gets the resolve value of `myResolve` from the state being exited\n * var fooData = trans.injector(null, 'from').get('myResolve');\n * });\n * ```\n *\n *\n * @param state Limits the resolves provided to only the resolves the provided state has access to.\n * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states.\n *\n * @returns a [[UIInjector]]\n */\n injector(state?: StateOrName, pathName = \"to\"): UIInjector {\n let path: PathNode[] = this._treeChanges[pathName];\n if (state) path = PathUtils.subPath(path, node => node.state === state || node.state.name === state);\n return new ResolveContext(path).injector();\n }\n\n /**\n * Gets all available resolve tokens (keys)\n *\n * This method can be used in conjunction with [[injector]] to inspect the resolve values\n * available to the Transition.\n *\n * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states\n * in the Transition's [[TreeChanges.to]] path.\n *\n * #### Example:\n * This example logs all resolve values\n * ```js\n * let tokens = trans.getResolveTokens();\n * tokens.forEach(token => console.log(token + \" = \" + trans.injector().get(token)));\n * ```\n *\n * #### Example:\n * This example creates promises for each resolve value.\n * This triggers fetches of resolves (if any have not yet been fetched).\n * When all promises have all settled, it logs the resolve values.\n * ```js\n * let tokens = trans.getResolveTokens();\n * let promise = tokens.map(token => trans.injector().getAsync(token));\n * Promise.all(promises).then(values => console.log(\"Resolved values: \" + values));\n * ```\n *\n * Note: Angular 1 users whould use `$q.all()`\n *\n * @param pathname resolve context's path name (e.g., `to` or `from`)\n *\n * @returns an array of resolve tokens (keys)\n */\n getResolveTokens(pathname: string = \"to\"): any[] {\n return new ResolveContext(this._treeChanges[pathname]).getTokens();\n }\n\n /**\n * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition.\n *\n * Allows a transition hook to dynamically add a Resolvable to this Transition.\n *\n * Use the [[Transition.injector]] to retrieve the resolved data in subsequent hooks ([[UIInjector.get]]).\n *\n * If a `state` argument is provided, the Resolvable is processed when that state is being entered.\n * If no `state` is provided then the root state is used.\n * If the given `state` has already been entered, the Resolvable is processed when any child state is entered.\n * If no child states will be entered, the Resolvable is processed during the `onFinish` phase of the Transition.\n *\n * The `state` argument also scopes the resolved data.\n * The resolved data is available from the injector for that `state` and any children states.\n *\n * #### Example:\n * ```js\n * transitionService.onBefore({}, transition => {\n * transition.addResolvable({\n * token: 'myResolve',\n * deps: ['MyService'],\n * resolveFn: myService => myService.getData()\n * });\n * });\n * ```\n *\n * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]])\n * @param state the state in the \"to path\" which should receive the new resolve (otherwise, the root state)\n */\n addResolvable(resolvable: Resolvable|ResolvableLiteral, state: StateOrName = \"\"): void {\n resolvable = is(Resolvable)(resolvable) ? resolvable : new Resolvable(resolvable);\n\n let stateName: string = (typeof state === \"string\") ? state : state.name;\n let topath = this._treeChanges.to;\n let targetNode = find(topath, node => node.state.name === stateName);\n let resolveContext: ResolveContext = new ResolveContext(topath);\n resolveContext.addResolvables([resolvable as Resolvable], targetNode.state);\n }\n\n /**\n * Gets the transition from which this transition was redirected.\n *\n * If the current transition is a redirect, this method returns the transition that was redirected.\n *\n * #### Example:\n * ```js\n * let transitionA = $state.go('A').transition\n * transitionA.onStart({}, () => $state.target('B'));\n * $transitions.onSuccess({ to: 'B' }, (trans) => {\n * trans.to().name === 'B'; // true\n * trans.redirectedFrom() === transitionA; // true\n * });\n * ```\n *\n * @returns The previous Transition, or null if this Transition is not the result of a redirection\n */\n redirectedFrom(): Transition {\n return this._options.redirectedFrom || null;\n }\n\n /**\n * Gets the original transition in a redirect chain\n *\n * A transition might belong to a long chain of multiple redirects.\n * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain.\n *\n * #### Example:\n * ```js\n * // states\n * registry.register({ name: 'A', redirectTo: 'B' });\n * registry.register({ name: 'B', redirectTo: 'C' });\n * registry.register({ name: 'C', redirectTo: 'D' });\n * registry.register({ name: 'D' });\n *\n * let transitionA = $state.go('A').transition\n *\n * $transitions.onSuccess({ to: 'D' }, (trans) => {\n * trans.to().name === 'D'; // true\n * trans.redirectedFrom().to().name === 'C'; // true\n * trans.originalTransition() === transitionA; // true\n * trans.originalTransition().to().name === 'A'; // true\n * });\n * ```\n *\n * @returns The original Transition that started a redirect chain\n */\n originalTransition(): Transition {\n let rf = this.redirectedFrom();\n return (rf && rf.originalTransition()) || this;\n }\n\n /**\n * Get the transition options\n *\n * @returns the options for this Transition.\n */\n options(): TransitionOptions {\n return this._options;\n }\n\n /**\n * Gets the states being entered.\n *\n * @returns an array of states that will be entered during this transition.\n */\n entering(): StateDeclaration[] {\n return map(this._treeChanges.entering, prop('state')).map(stateSelf);\n }\n\n /**\n * Gets the states being exited.\n *\n * @returns an array of states that will be exited during this transition.\n */\n exiting(): StateDeclaration[] {\n return map(this._treeChanges.exiting, prop('state')).map(stateSelf).reverse();\n }\n\n /**\n * Gets the states being retained.\n *\n * @returns an array of states that are already entered from a previous Transition, that will not be\n * exited during this Transition\n */\n retained(): StateDeclaration[] {\n return map(this._treeChanges.retained, prop('state')).map(stateSelf);\n }\n\n /**\n * Get the [[ViewConfig]]s associated with this Transition\n *\n * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects.\n * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., \"to\" or \"entering\").\n *\n * @param pathname the name of the path to fetch views for:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n * @param state If provided, only returns the `ViewConfig`s for a single state in the path\n *\n * @returns a list of ViewConfig objects for the given path.\n */\n views(pathname: string = \"entering\", state?: StateObject): ViewConfig[] {\n let path = this._treeChanges[pathname];\n path = !state ? path : path.filter(propEq('state', state));\n return path.map(prop(\"views\")).filter(identity).reduce(unnestR, []);\n }\n\n /**\n * Return the transition's tree changes\n *\n * A transition goes from one state/parameters to another state/parameters.\n * During a transition, states are entered and/or exited.\n *\n * This function returns various branches (paths) which represent the changes to the\n * active state tree that are caused by the transition.\n *\n * @param pathname The name of the tree changes path to get:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n */\n treeChanges(pathname: string): PathNode[];\n treeChanges(): TreeChanges;\n treeChanges(pathname?: string) {\n return pathname ? this._treeChanges[pathname] : this._treeChanges;\n }\n\n /**\n * Creates a new transition that is a redirection of the current one.\n *\n * This transition can be returned from a [[TransitionService]] hook to\n * redirect a transition to a new state and/or set of parameters.\n *\n * @internalapi\n *\n * @returns Returns a new [[Transition]] instance.\n */\n redirect(targetState: TargetState): Transition {\n let redirects = 1, trans: Transition = this;\n while ((trans = trans.redirectedFrom()) != null) {\n if (++redirects > 20) throw new Error(`Too many consecutive Transition redirects (20+)`);\n }\n\n let redirectOpts: TransitionOptions = { redirectedFrom: this, source: \"redirect\" };\n // If the original transition was caused by URL sync, then use { location: 'replace' }\n // on the new transition (unless the target state explicitly specifies location: false).\n // This causes the original url to be replaced with the url for the redirect target\n // so the original url disappears from the browser history.\n if (this.options().source === 'url' && targetState.options().location !== false) {\n redirectOpts.location = 'replace';\n }\n\n let newOptions = extend({}, this.options(), targetState.options(), redirectOpts);\n targetState = targetState.withOptions(newOptions, true);\n\n let newTransition = this.router.transitionService.create(this._treeChanges.from, targetState);\n let originalEnteringNodes = this._treeChanges.entering;\n let redirectEnteringNodes = newTransition._treeChanges.entering;\n\n // --- Re-use resolve data from original transition ---\n // When redirecting from a parent state to a child state where the parent parameter values haven't changed\n // (because of the redirect), the resolves fetched by the original transition are still valid in the\n // redirected transition.\n //\n // This allows you to define a redirect on a parent state which depends on an async resolve value.\n // You can wait for the resolve, then redirect to a child state based on the result.\n // The redirected transition does not have to re-fetch the resolve.\n // ---------------------------------------------------------\n\n const nodeIsReloading = (reloadState: StateObject) => (node: PathNode) => {\n return reloadState && node.state.includes[reloadState.name];\n };\n\n // Find any \"entering\" nodes in the redirect path that match the original path and aren't being reloaded\n let matchingEnteringNodes: PathNode[] = PathUtils.matching(redirectEnteringNodes, originalEnteringNodes, PathUtils.nonDynamicParams)\n .filter(not(nodeIsReloading(targetState.options().reloadState)));\n\n // Use the existing (possibly pre-resolved) resolvables for the matching entering nodes.\n matchingEnteringNodes.forEach((node, idx) => {\n node.resolvables = originalEnteringNodes[idx].resolvables;\n });\n\n return newTransition;\n }\n\n /** @hidden If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */\n private _changedParams(): Param[] {\n let tc = this._treeChanges;\n\n /** Return undefined if it's not a \"dynamic\" transition, for the following reasons */\n // If user explicitly wants a reload\n if (this._options.reload) return undefined;\n // If any states are exiting or entering\n if (tc.exiting.length || tc.entering.length) return undefined;\n // If to/from path lengths differ\n if (tc.to.length !== tc.from.length) return undefined;\n // If the to/from paths are different\n let pathsDiffer: boolean = arrayTuples(tc.to, tc.from)\n .map(tuple => tuple[0].state !== tuple[1].state)\n .reduce(anyTrueR, false);\n if (pathsDiffer) return undefined;\n\n // Find any parameter values that differ\n let nodeSchemas: Param[][] = tc.to.map((node: PathNode) => node.paramSchema);\n let [toValues, fromValues] = [tc.to, tc.from].map(path => path.map(x => x.paramValues));\n let tuples = arrayTuples(nodeSchemas, toValues, fromValues);\n\n return tuples.map(([schema, toVals, fromVals]) => Param.changed(schema, toVals, fromVals)).reduce(unnestR, []);\n }\n\n /**\n * Returns true if the transition is dynamic.\n *\n * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed.\n *\n * @returns true if the Transition is dynamic\n */\n dynamic(): boolean {\n let changes = this._changedParams();\n return !changes ? false : changes.map(x => x.dynamic).reduce(anyTrueR, false);\n }\n\n /**\n * Returns true if the transition is ignored.\n *\n * A transition is ignored if no states are entered nor exited, and no parameter values have changed.\n *\n * @returns true if the Transition is ignored.\n */\n ignored(): boolean {\n return !!this._ignoredReason();\n }\n\n /** @hidden */\n _ignoredReason(): \"SameAsCurrent\"|\"SameAsPending\"|undefined {\n const pending = this.router.globals.transition;\n const reloadState = this._options.reloadState;\n\n const same = (pathA, pathB) => {\n if (pathA.length !== pathB.length) return false;\n const matching = PathUtils.matching(pathA, pathB);\n return pathA.length === matching.filter(node => !reloadState || !node.state.includes[reloadState.name]).length;\n };\n\n let newTC = this.treeChanges();\n let pendTC = pending && pending.treeChanges();\n\n if (pendTC && same(pendTC.to, newTC.to) && same(pendTC.exiting, newTC.exiting)) return \"SameAsPending\";\n if (newTC.exiting.length === 0 && newTC.entering.length === 0 && same(newTC.from, newTC.to)) return \"SameAsCurrent\";\n }\n\n /**\n * Runs the transition\n *\n * This method is generally called from the [[StateService.transitionTo]]\n *\n * @internalapi\n *\n * @returns a promise for a successful transition.\n */\n run(): Promise {\n let runAllHooks = TransitionHook.runAllHooks;\n\n // Gets transition hooks array for the given phase\n const getHooksFor = (phase: TransitionHookPhase) =>\n this._hookBuilder.buildHooksForPhase(phase);\n\n // When the chain is complete, then resolve or reject the deferred\n const transitionSuccess = () => {\n trace.traceSuccess(this.$to(), this);\n this.success = true;\n this._deferred.resolve(this.to());\n runAllHooks(getHooksFor(TransitionHookPhase.SUCCESS));\n };\n\n const transitionError = (reason: any) => {\n trace.traceError(reason, this);\n this.success = false;\n this._deferred.reject(reason);\n this._error = reason;\n runAllHooks(getHooksFor(TransitionHookPhase.ERROR));\n };\n\n const runTransition = () => {\n // Wait to build the RUN hook chain until the BEFORE hooks are done\n // This allows a BEFORE hook to dynamically add additional RUN hooks via the Transition object.\n let allRunHooks = getHooksFor(TransitionHookPhase.RUN);\n let done = () => services.$q.when(undefined);\n return TransitionHook.invokeHooks(allRunHooks, done);\n };\n\n const startTransition = () => {\n let globals = this.router.globals;\n\n globals.lastStartedTransitionId = this.$id;\n globals.transition = this;\n globals.transitionHistory.enqueue(this);\n\n trace.traceTransitionStart(this);\n\n return services.$q.when(undefined);\n };\n\n let allBeforeHooks = getHooksFor(TransitionHookPhase.BEFORE);\n TransitionHook.invokeHooks(allBeforeHooks, startTransition)\n .then(runTransition)\n .then(transitionSuccess, transitionError);\n\n return this.promise;\n }\n\n /** Checks if this transition is currently active/running. */\n isActive = () =>\n this.router.globals.transition === this;\n\n /**\n * Checks if the Transition is valid\n *\n * @returns true if the Transition is valid\n */\n valid() {\n return !this.error() || this.success !== undefined;\n }\n\n /**\n * Aborts this transition\n *\n * Imperative API to abort a Transition.\n * This only applies to Transitions that are not yet complete.\n */\n abort() {\n // Do not set flag if the transition is already complete\n if (isUndefined(this.success)) {\n this._aborted = true;\n }\n }\n\n /**\n * The Transition error reason.\n *\n * If the transition is invalid (and could not be run), returns the reason the transition is invalid.\n * If the transition was valid and ran, but was not successful, returns the reason the transition failed.\n *\n * @returns an error message explaining why the transition is invalid, or the reason the transition failed.\n */\n error() {\n let state: StateObject = this.$to();\n\n if (state.self.abstract)\n return `Cannot transition to abstract state '${state.name}'`;\n\n const paramDefs = state.parameters(), values = this.params();\n const invalidParams = paramDefs.filter(param => !param.validates(values[param.id]));\n if (invalidParams.length) {\n return `Param values not valid for state '${state.name}'. Invalid params: [ ${invalidParams.map(param => param.id).join(', ')} ]`;\n }\n\n if (this.success === false)\n return this._error;\n }\n\n /**\n * A string representation of the Transition\n *\n * @returns A string representation of the Transition\n */\n toString () {\n let fromStateOrName = this.from();\n let toStateOrName = this.to();\n\n const avoidEmptyHash = (params: RawParams) =>\n (params[\"#\"] !== null && params[\"#\"] !== undefined) ? params : omit(params, [\"#\"]);\n\n // (X) means the to state is invalid.\n let id = this.$id,\n from = isObject(fromStateOrName) ? fromStateOrName.name : fromStateOrName,\n fromParams = stringify(avoidEmptyHash(this._treeChanges.from.map(prop('paramValues')).reduce(mergeR, {}))),\n toValid = this.valid() ? \"\" : \"(X) \",\n to = isObject(toStateOrName) ? toStateOrName.name : toStateOrName,\n toParams = stringify(avoidEmptyHash(this.params()));\n\n return `Transition#${id}( '${from}'${fromParams} -> ${toValid}'${to}'${toParams} )`;\n }\n}\n", - "/**\n * Functions that manipulate strings\n *\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_strings\n */ /** */\n\nimport { isString, isArray, isDefined, isNull, isPromise, isInjectable, isObject } from \"./predicates\";\nimport { Rejection } from \"../transition/rejectFactory\";\nimport { IInjectable, identity, Obj, tail, pushR } from \"./common\";\nimport { pattern, is, not, val, invoke } from \"./hof\";\nimport { Transition } from \"../transition/transition\";\nimport { Resolvable } from \"../resolve/resolvable\";\n\n/**\n * Returns a string shortened to a maximum length\n *\n * If the string is already less than the `max` length, return the string.\n * Else return the string, shortened to `max - 3` and append three dots (\"...\").\n *\n * @param max the maximum length of the string to return\n * @param str the input string\n */\nexport function maxLength(max: number, str: string) {\n if (str.length <= max) return str;\n return str.substr(0, max - 3) + \"...\";\n}\n\n/**\n * Returns a string, with spaces added to the end, up to a desired str length\n *\n * If the string is already longer than the desired length, return the string.\n * Else returns the string, with extra spaces on the end, such that it reaches `length` characters.\n *\n * @param length the desired length of the string to return\n * @param str the input string\n */\nexport function padString(length: number, str: string) {\n while (str.length < length) str += \" \";\n return str;\n}\n\nexport function kebobString(camelCase: string) {\n return camelCase\n .replace(/^([A-Z])/, $1 => $1.toLowerCase()) // replace first char\n .replace(/([A-Z])/g, $1 => \"-\" + $1.toLowerCase()); // replace rest\n}\n\nfunction _toJson(obj: Obj) {\n return JSON.stringify(obj);\n}\n\nfunction _fromJson(json: string) {\n return isString(json) ? JSON.parse(json) : json;\n}\n\n\nfunction promiseToString(p: Promise) {\n return `Promise(${JSON.stringify(p)})`;\n}\n\nexport function functionToString(fn: Function) {\n let fnStr = fnToString(fn);\n let namedFunctionMatch = fnStr.match(/^(function [^ ]+\\([^)]*\\))/);\n let toStr = namedFunctionMatch ? namedFunctionMatch[1] : fnStr;\n\n let fnName = fn['name'] || \"\";\n if (fnName && toStr.match(/function \\(/)) {\n return 'function ' + fnName + toStr.substr(9);\n }\n return toStr;\n}\n\nexport function fnToString(fn: IInjectable) {\n let _fn = isArray(fn) ? fn.slice(-1)[0] : fn;\n return _fn && _fn.toString() || \"undefined\";\n}\n\nlet stringifyPatternFn: (val: any) => string = null;\nlet stringifyPattern = function(value: any) {\n let isRejection = Rejection.isRejectionPromise;\n\n stringifyPatternFn = stringifyPatternFn || pattern([\n [not(isDefined), val(\"undefined\")],\n [isNull, val(\"null\")],\n [isPromise, val(\"[Promise]\")],\n [isRejection, (x: any) => x._transitionRejection.toString()],\n [is(Rejection), invoke(\"toString\")],\n [is(Transition), invoke(\"toString\")],\n [is(Resolvable), invoke(\"toString\")],\n [isInjectable, functionToString],\n [val(true), identity]\n ]);\n\n return stringifyPatternFn(value);\n};\n\nexport function stringify(o: any) {\n var seen: any[] = [];\n\n function format(val: any) {\n if (isObject(val)) {\n if (seen.indexOf(val) !== -1) return '[circular ref]';\n seen.push(val);\n }\n return stringifyPattern(val);\n }\n\n return JSON.stringify(o, (key, val) => format(val)).replace(/\\\\\"/g, '\"');\n}\n\n/** Returns a function that splits a string on a character or substring */\nexport const beforeAfterSubstr = (char: string) => (str: string): string[] => {\n if (!str) return [\"\", \"\"];\n let idx = str.indexOf(char);\n if (idx === -1) return [str, \"\"];\n return [str.substr(0, idx), str.substr(idx + 1)];\n};\n\nexport const hostRegex = new RegExp('^(?:[a-z]+:)?//[^/]+/');\nexport const stripLastPathElement = (str: string) => str.replace(/\\/[^/]*$/, '');\nexport const splitHash = beforeAfterSubstr(\"#\");\nexport const splitQuery = beforeAfterSubstr(\"?\");\nexport const splitEqual = beforeAfterSubstr(\"=\");\nexport const trimHashVal = (str: string) => str ? str.replace(/^#/, \"\") : \"\";\n\n/**\n * Splits on a delimiter, but returns the delimiters in the array\n *\n * #### Example:\n * ```js\n * var splitOnSlashes = splitOnDelim('/');\n * splitOnSlashes(\"/foo\"); // [\"/\", \"foo\"]\n * splitOnSlashes(\"/foo/\"); // [\"/\", \"foo\", \"/\"]\n * ```\n */\nexport function splitOnDelim(delim: string) {\n let re = new RegExp(\"(\" + delim + \")\", \"g\");\n return (str: string) =>\n str.split(re).filter(identity);\n};\n\n\n/**\n * Reduce fn that joins neighboring strings\n *\n * Given an array of strings, returns a new array\n * where all neighboring strings have been joined.\n *\n * #### Example:\n * ```js\n * let arr = [\"foo\", \"bar\", 1, \"baz\", \"\", \"qux\" ];\n * arr.reduce(joinNeighborsR, []) // [\"foobar\", 1, \"bazqux\" ]\n * ```\n */\nexport function joinNeighborsR(acc: any[], x: any) {\n if (isString(tail(acc)) && isString(x))\n return acc.slice(0, -1).concat(tail(acc)+ x);\n return pushR(acc, x);\n};\n\n", - "/** @module common */ /** for typedoc */\nexport * from \"./common\";\nexport * from \"./coreservices\";\nexport * from \"./glob\";\nexport * from \"./hof\";\nexport * from \"./predicates\";\nexport * from \"./queue\";\nexport * from \"./strings\";\nexport * from \"./trace\";\n", - "/**\n * @coreapi\n * @module params\n */\n/** */\nimport { fromJson, toJson, identity, equals, inherit, map, extend, pick } from \"../common/common\";\nimport { isDefined, isNullOrUndefined } from \"../common/predicates\";\nimport { is } from \"../common/hof\";\nimport { services } from \"../common/coreservices\";\nimport { ParamType } from \"./paramType\";\nimport { ParamTypeDefinition } from \"./interface\";\n\n/**\n * A registry for parameter types.\n *\n * This registry manages the built-in (and custom) parameter types.\n *\n * The built-in parameter types are:\n *\n * - [[string]]\n * - [[path]]\n * - [[query]]\n * - [[hash]]\n * - [[int]]\n * - [[bool]]\n * - [[date]]\n * - [[json]]\n * - [[any]]\n */\nexport class ParamTypes {\n /** @hidden */\n types: any;\n /** @hidden */\n enqueue: boolean = true;\n /** @hidden */\n typeQueue: any[] = [];\n\n /**\n * Built-in parameter type: `string`\n *\n * This parameter type coerces values to strings.\n * It matches anything (`new RegExp(\".*\")`) in the URL\n */\n static string: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `path`\n *\n * This parameter type is the default type for path parameters.\n * A path parameter is any parameter declared in the path portion of a url\n *\n * - `/foo/:param1/:param2`: two path parameters\n *\n * This parameter type behaves exactly like the [[string]] type with one exception.\n * When matching parameter values in the URL, the `path` type does not match forward slashes `/`.\n *\n * #### Angular 1 note:\n * In ng1, this type is overridden with one that pre-encodes slashes as `~2F` instead of `%2F`.\n * For more details about this angular 1 behavior, see: https://github.com/angular-ui/ui-router/issues/2598\n */\n static path: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `query`\n *\n * This parameter type is the default type for query/search parameters.\n * It behaves the same as the [[string]] parameter type.\n *\n * A query parameter is any parameter declared in the query/search portion of a url\n *\n * - `/bar?param2`: a query parameter\n */\n static query: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `hash`\n *\n * This parameter type is used for the `#` parameter (the hash)\n * It behaves the same as the [[string]] parameter type.\n * @coreapi\n */\n static hash: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `int`\n *\n * This parameter type serializes javascript integers (`number`s which represent an integer) to the URL.\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'user',\n * url: '/user/{id:int}'\n * });\n * ```\n * ```js\n * $state.go('user', { id: 1298547 });\n * ```\n *\n * The URL will serialize to: `/user/1298547`.\n *\n * When the parameter value is read, it will be the `number` `1298547`, not the string `\"1298547\"`.\n */\n static int: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `bool`\n *\n * This parameter type serializes `true`/`false` as `1`/`0`\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'inbox',\n * url: '/inbox?{unread:bool}'\n * });\n * ```\n * ```js\n * $state.go('inbox', { unread: true });\n * ```\n *\n * The URL will serialize to: `/inbox?unread=1`.\n *\n * Conversely, if the url is `/inbox?unread=0`, the value of the `unread` parameter will be a `false`.\n */\n static bool: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `date`\n *\n * This parameter type can be used to serialize Javascript dates as parameter values.\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'search',\n * url: '/search?{start:date}'\n * });\n * ```\n * ```js\n * $state.go('search', { start: new Date(2000, 0, 1) });\n * ```\n *\n * The URL will serialize to: `/search?start=2000-01-01`.\n *\n * Conversely, if the url is `/search?start=2016-12-25`, the value of the `start` parameter will be a `Date` object where:\n *\n * - `date.getFullYear() === 2016`\n * - `date.getMonth() === 11` (month is 0-based)\n * - `date.getDate() === 25`\n */\n static date: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `json`\n *\n * This parameter type can be used to serialize javascript objects into the URL using JSON serialization.\n *\n * #### Example:\n * This example serializes an plain javascript object to the URL\n * ```js\n * .state({\n * name: 'map',\n * url: '/map/{coords:json}'\n * });\n * ```\n * ```js\n * $state.go('map', { coords: { x: 10399.2, y: 49071 });\n * ```\n *\n * The URL will serialize to: `/map/%7B%22x%22%3A10399.2%2C%22y%22%3A49071%7D`\n */\n static json: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `any`\n *\n * This parameter type is used by default for url-less parameters (parameters that do not appear in the URL).\n * This type does not encode or decode.\n * It is compared using a deep `equals` comparison.\n *\n * #### Example:\n * This example defines a non-url parameter on a [[StateDeclaration]].\n * ```js\n * .state({\n * name: 'new',\n * url: '/new',\n * params: {\n * inrepyto: null\n * }\n * });\n * ```\n * ```js\n * $state.go('new', { inreplyto: currentMessage });\n * ```\n */\n static any: ParamTypeDefinition;\n\n\n /** @internalapi */\n private defaultTypes: any = pick(ParamTypes.prototype, [\"hash\", \"string\", \"query\", \"path\", \"int\", \"bool\", \"date\", \"json\", \"any\"]);\n\n /** @internalapi */\n constructor() {\n // Register default types. Store them in the prototype of this.types.\n const makeType = (definition: ParamTypeDefinition, name: string) =>\n new ParamType(extend({ name }, definition));\n this.types = inherit(map(this.defaultTypes, makeType), {});\n }\n\n /** @internalapi */\n dispose() {\n this.types = {};\n }\n\n /**\n * Registers a parameter type\n *\n * End users should call [[UrlMatcherFactory.type]], which delegates to this method.\n */\n type(name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {\n if (!isDefined(definition)) return this.types[name];\n if (this.types.hasOwnProperty(name)) throw new Error(`A type named '${name}' has already been defined.`);\n\n this.types[name] = new ParamType(extend({ name }, definition));\n\n if (definitionFn) {\n this.typeQueue.push({ name, def: definitionFn });\n if (!this.enqueue) this._flushTypeQueue();\n }\n\n return this;\n }\n\n /** @internalapi */\n _flushTypeQueue() {\n while (this.typeQueue.length) {\n let type = this.typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n extend(this.types[type.name], services.$injector.invoke(type.def));\n }\n }\n}\n\n/** @hidden */\nfunction initDefaultTypes() {\n\n const makeDefaultType = (def) => {\n const valToString = (val: any) =>\n val != null ? val.toString() : val;\n\n const defaultTypeBase = {\n encode: valToString,\n decode: valToString,\n is: is(String),\n pattern: /.*/,\n equals: (a: any, b: any) => a == b, // allow coersion for null/undefined/\"\"\n };\n\n return extend({}, defaultTypeBase, def) as ParamTypeDefinition;\n };\n\n // Default Parameter Type Definitions\n extend(ParamTypes.prototype, {\n string: makeDefaultType({}),\n\n path: makeDefaultType({\n pattern: /[^/]*/,\n }),\n\n query: makeDefaultType({}),\n\n hash: makeDefaultType({\n inherit: false,\n }),\n\n int: makeDefaultType({\n decode: (val: string) => parseInt(val, 10),\n is: function(val: any) {\n return !isNullOrUndefined(val) && this.decode(val.toString()) === val;\n },\n pattern: /-?\\d+/,\n }),\n\n bool: makeDefaultType({\n encode: (val: any) => val && 1 || 0,\n decode: (val: string) => parseInt(val, 10) !== 0,\n is: is(Boolean),\n pattern: /0|1/,\n }),\n\n date: makeDefaultType({\n encode: function(val: any) {\n return !this.is(val) ? undefined : [\n val.getFullYear(),\n ('0' + (val.getMonth() + 1)).slice(-2),\n ('0' + val.getDate()).slice(-2),\n ].join(\"-\");\n },\n decode: function(val: string) {\n if (this.is(val)) return val as Date;\n let match = this.capture.exec(val);\n return match ? new Date(match[1], match[2] - 1, match[3]) : undefined;\n },\n is: (val: any) => val instanceof Date && !isNaN(val.valueOf()),\n equals(l: any, r: any) {\n return ['getFullYear', 'getMonth', 'getDate']\n .reduce((acc, fn) => acc && l[fn]() === r[fn](), true);\n },\n pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,\n capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/,\n }),\n\n json: makeDefaultType({\n encode: toJson,\n decode: fromJson,\n is: is(Object),\n equals: equals,\n pattern: /[^/]*/,\n }),\n\n // does not encode/decode\n any: makeDefaultType({\n encode: identity,\n decode: identity,\n is: () => true,\n equals: equals,\n }),\n });\n}\n\ninitDefaultTypes();\n\n", - "/**\n * @coreapi\n * @module params\n */\n/** */\nimport {extend, ancestors, Obj} from \"../common/common\";\nimport {StateObject} from \"../state/stateObject\";\n\n/** @internalapi */\nexport class StateParams {\n [key: string]: any;\n\n constructor(params: Obj = {}) {\n extend(this, params);\n }\n\n /**\n * Merges a set of parameters with all parameters inherited between the common parents of the\n * current state and a given destination state.\n *\n * @param {Object} newParams The set of parameters which will be composited with inherited params.\n * @param {Object} $current Internal definition of object representing the current state.\n * @param {Object} $to Internal definition of object representing state to transition to.\n */\n $inherit(newParams: Obj, $current: StateObject, $to: StateObject) {\n let parents = ancestors($current, $to),\n parentParams: string[],\n inherited: Obj = {},\n inheritList: string[] = [];\n\n for (let i in parents) {\n if (!parents[i] || !parents[i].params) continue;\n parentParams = Object.keys(parents[i].params);\n if (!parentParams.length) continue;\n\n for (let j in parentParams) {\n if (inheritList.indexOf(parentParams[j]) >= 0) continue;\n inheritList.push(parentParams[j]);\n inherited[parentParams[j]] = this[parentParams[j]];\n }\n }\n return extend({}, inherited, newParams);\n };\n}\n\n", - "/** @module path */ /** for typedoc */\nexport * from \"./pathNode\";\nexport * from \"./pathFactory\";", - "/** @module resolve */ /** for typedoc */\nexport * from \"./interface\";\nexport * from \"./resolvable\";\nexport * from \"./resolveContext\";\n", - "/** @module state */ /** for typedoc */\nimport {Obj, omit, noop, extend, inherit, values, applyPairs, tail, mapObj, identity} from \"../common/common\";\nimport {isDefined, isFunction, isString, isArray} from \"../common/predicates\";\nimport {stringify} from \"../common/strings\";\nimport {prop, pattern, is, pipe, val} from \"../common/hof\";\nimport {StateDeclaration} from \"./interface\";\n\nimport {StateObject} from \"./stateObject\";\nimport {StateMatcher} from \"./stateMatcher\";\nimport {Param} from \"../params/param\";\nimport {UrlMatcherFactory} from \"../url/urlMatcherFactory\";\nimport {UrlMatcher} from \"../url/urlMatcher\";\nimport {Resolvable} from \"../resolve/resolvable\";\nimport {services} from \"../common/coreservices\";\nimport {ResolvePolicy} from \"../resolve/interface\";\nimport { ParamFactory } from \"../url/interface\";\n\nconst parseUrl = (url: string): any => {\n if (!isString(url)) return false;\n let root = url.charAt(0) === '^';\n return { val: root ? url.substring(1) : url, root };\n};\n\nexport type BuilderFunction = (state: StateObject, parent?: BuilderFunction) => any;\n\ninterface Builders {\n [key: string]: BuilderFunction[];\n\n name: BuilderFunction[];\n parent: BuilderFunction[];\n data: BuilderFunction[];\n url: BuilderFunction[];\n navigable: BuilderFunction[];\n params: BuilderFunction[];\n views: BuilderFunction[];\n path: BuilderFunction[];\n includes: BuilderFunction[];\n resolvables: BuilderFunction[];\n}\n\n\nfunction nameBuilder(state: StateObject) {\n return state.name;\n}\n\nfunction selfBuilder(state: StateObject) {\n state.self.$$state = () => state;\n return state.self;\n}\n\nfunction dataBuilder(state: StateObject) {\n if (state.parent && state.parent.data) {\n state.data = state.self.data = inherit(state.parent.data, state.data);\n }\n return state.data;\n}\n\nconst getUrlBuilder = ($urlMatcherFactoryProvider: UrlMatcherFactory, root: () => StateObject) =>\nfunction urlBuilder(state: StateObject) {\n let stateDec: StateDeclaration = state;\n\n // For future states, i.e., states whose name ends with `.**`,\n // match anything that starts with the url prefix\n if (stateDec && stateDec.url && stateDec.name && stateDec.name.match(/\\.\\*\\*$/)) {\n stateDec.url += \"{remainder:any}\"; // match any path (.*)\n }\n\n const parsed = parseUrl(stateDec.url), parent = state.parent;\n const url = !parsed ? stateDec.url : $urlMatcherFactoryProvider.compile(parsed.val, {\n params: state.params || {},\n paramMap: function (paramConfig: any, isSearch: boolean) {\n if (stateDec.reloadOnSearch === false && isSearch) paramConfig = extend(paramConfig || {}, {dynamic: true});\n return paramConfig;\n }\n });\n\n if (!url) return null;\n if (!$urlMatcherFactoryProvider.isMatcher(url)) throw new Error(`Invalid url '${url}' in state '${state}'`);\n return (parsed && parsed.root) ? url : ((parent && parent.navigable) || root()).url.append( url);\n};\n\nconst getNavigableBuilder = (isRoot: (state: StateObject) => boolean) =>\nfunction navigableBuilder(state: StateObject) {\n return !isRoot(state) && state.url ? state : (state.parent ? state.parent.navigable : null);\n};\n\nconst getParamsBuilder = (paramFactory: ParamFactory) =>\nfunction paramsBuilder(state: StateObject): { [key: string]: Param } {\n const makeConfigParam = (config: any, id: string) => paramFactory.fromConfig(id, null, config);\n let urlParams: Param[] = (state.url && state.url.parameters({inherit: false})) || [];\n let nonUrlParams: Param[] = values(mapObj(omit(state.params || {}, urlParams.map(prop('id'))), makeConfigParam));\n return urlParams.concat(nonUrlParams).map(p => [p.id, p]).reduce(applyPairs, {});\n};\n\nfunction pathBuilder(state: StateObject) {\n return state.parent ? state.parent.path.concat(state) : /*root*/ [state];\n}\n\nfunction includesBuilder(state: StateObject) {\n let includes = state.parent ? extend({}, state.parent.includes) : {};\n includes[state.name] = true;\n return includes;\n}\n\n/**\n * This is a [[StateBuilder.builder]] function for the `resolve:` block on a [[StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * validates the `resolve` property and converts it to a [[Resolvable]] array.\n *\n * resolve: input value can be:\n *\n * {\n * // analyzed but not injected\n * myFooResolve: function() { return \"myFooData\"; },\n *\n * // function.toString() parsed, \"DependencyName\" dep as string (not min-safe)\n * myBarResolve: function(DependencyName) { return DependencyName.fetchSomethingAsPromise() },\n *\n * // Array split; \"DependencyName\" dep as string\n * myBazResolve: [ \"DependencyName\", function(dep) { return dep.fetchSomethingAsPromise() },\n *\n * // Array split; DependencyType dep as token (compared using ===)\n * myQuxResolve: [ DependencyType, function(dep) { return dep.fetchSometingAsPromise() },\n *\n * // val.$inject used as deps\n * // where:\n * // corgeResolve.$inject = [\"DependencyName\"];\n * // function corgeResolve(dep) { dep.fetchSometingAsPromise() }\n * // then \"DependencyName\" dep as string\n * myCorgeResolve: corgeResolve,\n *\n * // inject service by name\n * // When a string is found, desugar creating a resolve that injects the named service\n * myGraultResolve: \"SomeService\"\n * }\n *\n * or:\n *\n * [\n * new Resolvable(\"myFooResolve\", function() { return \"myFooData\" }),\n * new Resolvable(\"myBarResolve\", function(dep) { return dep.fetchSomethingAsPromise() }, [ \"DependencyName\" ]),\n * { provide: \"myBazResolve\", useFactory: function(dep) { dep.fetchSomethingAsPromise() }, deps: [ \"DependencyName\" ] }\n * ]\n */\nexport function resolvablesBuilder(state: StateObject): Resolvable[] {\n interface Tuple { token: any, val: any, deps: any[], policy: ResolvePolicy }\n \n /** convert resolve: {} and resolvePolicy: {} objects to an array of tuples */\n const objects2Tuples = (resolveObj: Obj, resolvePolicies: { [key: string]: ResolvePolicy }) =>\n Object.keys(resolveObj || {}).map(token => ({token, val: resolveObj[token], deps: undefined, policy: resolvePolicies[token]}));\n\n /** fetch DI annotations from a function or ng1-style array */\n const annotate = (fn: Function) => {\n let $injector = services.$injector;\n // ng1 doesn't have an $injector until runtime.\n // If the $injector doesn't exist, use \"deferred\" literal as a\n // marker indicating they should be annotated when runtime starts\n return fn['$inject'] || ($injector && $injector.annotate(fn, $injector.strictDi)) || \"deferred\";\n };\n\n /** true if the object has both `token` and `resolveFn`, and is probably a [[ResolveLiteral]] */\n const isResolveLiteral = (obj: any) => !!(obj.token && obj.resolveFn);\n\n /** true if the object looks like a provide literal, or a ng2 Provider */\n const isLikeNg2Provider = (obj: any) => !!((obj.provide || obj.token) && (obj.useValue || obj.useFactory || obj.useExisting || obj.useClass));\n\n /** true if the object looks like a tuple from obj2Tuples */\n const isTupleFromObj = (obj: any) => !!(obj && obj.val && (isString(obj.val) || isArray(obj.val) || isFunction(obj.val)));\n\n /** extracts the token from a Provider or provide literal */\n const token = (p: any) => p.provide || p.token;\n\n /** Given a literal resolve or provider object, returns a Resolvable */\n const literal2Resolvable = pattern([\n [prop('resolveFn'), p => new Resolvable(token(p), p.resolveFn, p.deps, p.policy)],\n [prop('useFactory'), p => new Resolvable(token(p), p.useFactory, (p.deps || p.dependencies), p.policy)],\n [prop('useClass'), p => new Resolvable(token(p), () => new (p.useClass)(), [], p.policy)],\n [prop('useValue'), p => new Resolvable(token(p), () => p.useValue, [], p.policy, p.useValue)],\n [prop('useExisting'), p => new Resolvable(token(p), identity, [p.useExisting], p.policy)],\n ]);\n\n const tuple2Resolvable = pattern([\n [pipe(prop(\"val\"), isString), (tuple: Tuple) => new Resolvable(tuple.token, identity, [ tuple.val ], tuple.policy)],\n [pipe(prop(\"val\"), isArray), (tuple: Tuple) => new Resolvable(tuple.token, tail( tuple.val), tuple.val.slice(0, -1), tuple.policy)],\n [pipe(prop(\"val\"), isFunction), (tuple: Tuple) => new Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy)],\n ]);\n\n const item2Resolvable = <(obj: any) => Resolvable> pattern([\n [is(Resolvable), (r: Resolvable) => r],\n [isResolveLiteral, literal2Resolvable],\n [isLikeNg2Provider, literal2Resolvable],\n [isTupleFromObj, tuple2Resolvable],\n [val(true), (obj: any) => { throw new Error(\"Invalid resolve value: \" + stringify(obj)) }]\n ]);\n\n // If resolveBlock is already an array, use it as-is.\n // Otherwise, assume it's an object and convert to an Array of tuples\n let decl = state.resolve;\n let items: any[] = isArray(decl) ? decl : objects2Tuples(decl, state.resolvePolicy || {});\n return items.map(item2Resolvable);\n}\n\n/**\n * @internalapi A internal global service\n *\n * StateBuilder is a factory for the internal [[StateObject]] objects.\n *\n * When you register a state with the [[StateRegistry]], you register a plain old javascript object which\n * conforms to the [[StateDeclaration]] interface. This factory takes that object and builds the corresponding\n * [[StateObject]] object, which has an API and is used internally.\n *\n * Custom properties or API may be added to the internal [[StateObject]] object by registering a decorator function\n * using the [[builder]] method.\n */\nexport class StateBuilder {\n /** An object that contains all the BuilderFunctions registered, key'd by the name of the State property they build */\n private builders: Builders;\n\n constructor(private matcher: StateMatcher, urlMatcherFactory: UrlMatcherFactory) {\n let self = this;\n\n const root = () => matcher.find(\"\");\n const isRoot = (state: StateObject) => state.name === \"\";\n\n function parentBuilder(state: StateObject) {\n if (isRoot(state)) return null;\n return matcher.find(self.parentName(state)) || root();\n }\n\n this.builders = {\n name: [ nameBuilder ],\n self: [ selfBuilder ],\n parent: [ parentBuilder ],\n data: [ dataBuilder ],\n // Build a URLMatcher if necessary, either via a relative or absolute URL\n url: [ getUrlBuilder(urlMatcherFactory, root) ],\n // Keep track of the closest ancestor state that has a URL (i.e. is navigable)\n navigable: [ getNavigableBuilder(isRoot) ],\n params: [ getParamsBuilder(urlMatcherFactory.paramFactory) ],\n // Each framework-specific ui-router implementation should define its own `views` builder\n // e.g., src/ng1/statebuilders/views.ts\n views: [],\n // Keep a full path from the root down to this state as this is needed for state activation.\n path: [ pathBuilder ],\n // Speed up $state.includes() as it's used a lot\n includes: [ includesBuilder ],\n resolvables: [ resolvablesBuilder ]\n };\n }\n\n /**\n * Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`).\n * More than one BuilderFunction can be registered for a given property.\n *\n * The BuilderFunction(s) will be used to define the property on any subsequently built [[StateObject]] objects.\n *\n * @param name The name of the State property being registered for.\n * @param fn The BuilderFunction which will be used to build the State property\n * @returns a function which deregisters the BuilderFunction\n */\n builder(name: string, fn: BuilderFunction): (BuilderFunction|BuilderFunction[]|Function) {\n let builders = this.builders;\n let array = builders[name] || [];\n // Backwards compat: if only one builder exists, return it, else return whole arary.\n if (isString(name) && !isDefined(fn)) return array.length > 1 ? array : array[0];\n if (!isString(name) || !isFunction(fn)) return;\n\n builders[name] = array;\n builders[name].push(fn);\n return () => builders[name].splice(builders[name].indexOf(fn, 1)) && null;\n }\n\n /**\n * Builds all of the properties on an essentially blank State object, returning a State object which has all its\n * properties and API built.\n *\n * @param state an uninitialized State object\n * @returns the built State object\n */\n build(state: StateObject): StateObject {\n let {matcher, builders} = this;\n let parent = this.parentName(state);\n\n if (parent && !matcher.find(parent, undefined, false)) {\n return null;\n }\n\n for (let key in builders) {\n if (!builders.hasOwnProperty(key)) continue;\n let chain = builders[key].reduce((parentFn: BuilderFunction, step: BuilderFunction) => (_state) => step(_state, parentFn), noop);\n state[key] = chain(state);\n }\n return state;\n }\n\n parentName(state: StateObject) {\n // name = 'foo.bar.baz.**'\n let name = state.name || \"\";\n // segments = ['foo', 'bar', 'baz', '.**']\n let segments = name.split('.');\n // segments = ['foo', 'bar', 'baz']\n let lastSegment = segments.pop();\n // segments = ['foo', 'bar'] (ignore .** segment for future states)\n if (lastSegment === '**') segments.pop();\n\n if (segments.length) {\n if (state.parent) {\n throw new Error(`States that specify the 'parent:' property should not have a '.' in their name (${name})`);\n }\n\n // 'foo.bar'\n return segments.join(\".\");\n }\n\n if (!state.parent) return \"\";\n return isString(state.parent) ? state.parent : state.parent.name;\n }\n\n name(state: StateObject) {\n let name = state.name;\n if (name.indexOf('.') !== -1 || !state.parent) return name;\n\n let parentName = isString(state.parent) ? state.parent : state.parent.name;\n return parentName ? parentName + \".\" + name : name;\n }\n}\n", - "/** @module state */ /** for typedoc */\nimport {isString} from \"../common/predicates\";\nimport {StateOrName} from \"./interface\";\nimport {StateObject} from \"./stateObject\";\nimport {values} from \"../common/common\";\n\nexport class StateMatcher {\n constructor (private _states: { [key: string]: StateObject }) { }\n \n isRelative(stateName: string) {\n stateName = stateName || \"\";\n return stateName.indexOf(\".\") === 0 || stateName.indexOf(\"^\") === 0;\n }\n\n\n find(stateOrName: StateOrName, base?: StateOrName, matchGlob = true): StateObject {\n if (!stateOrName && stateOrName !== \"\") return undefined;\n let isStr = isString(stateOrName);\n let name: string = isStr ? stateOrName : (stateOrName).name;\n\n if (this.isRelative(name)) name = this.resolvePath(name, base);\n let state = this._states[name];\n\n if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {\n return state;\n } else if (isStr && matchGlob) {\n let _states = values(this._states);\n let matches = _states.filter(state =>\n state.__stateObjectCache.nameGlob &&\n state.__stateObjectCache.nameGlob.matches(name)\n );\n\n if (matches.length > 1) {\n console.log(`stateMatcher.find: Found multiple matches for ${name} using glob: `, matches.map(match => match.name));\n }\n return matches[0];\n }\n return undefined;\n }\n\n resolvePath(name: string, base: StateOrName) {\n if (!base) throw new Error(`No reference point given for path '${name}'`);\n \n let baseState: StateObject = this.find(base);\n\n let splitName = name.split(\".\"), i = 0, pathLength = splitName.length, current = baseState;\n\n for (; i < pathLength; i++) {\n if (splitName[i] === \"\" && i === 0) {\n current = baseState;\n continue;\n }\n if (splitName[i] === \"^\") {\n if (!current.parent) throw new Error(`Path '${name}' not valid for state '${baseState.name}'`);\n current = current.parent;\n continue;\n }\n break;\n }\n let relName = splitName.slice(i).join(\".\");\n return current.name + (current.name && relName ? \".\" : \"\") + relName;\n }\n}\n", - "/** @module state */ /** for typedoc */\nimport { inArray } from \"../common/common\";\nimport { isString } from \"../common/predicates\";\nimport { StateDeclaration, _StateDeclaration } from \"./interface\";\nimport { StateObject } from \"./stateObject\";\nimport { StateBuilder } from \"./stateBuilder\";\nimport { StateRegistryListener, StateRegistry } from \"./stateRegistry\";\nimport { Disposable } from \"../interface\";\nimport { UrlRouter } from \"../url/urlRouter\";\nimport { prop } from \"../common/hof\";\nimport { StateMatcher } from \"./stateMatcher\";\n\n/** @internalapi */\nexport class StateQueueManager implements Disposable {\n queue: StateObject[];\n matcher: StateMatcher;\n\n constructor(\n private $registry: StateRegistry,\n private $urlRouter: UrlRouter,\n public states: { [key: string]: StateObject; },\n public builder: StateBuilder,\n public listeners: StateRegistryListener[]) {\n this.queue = [];\n this.matcher = $registry.matcher;\n }\n\n /** @internalapi */\n dispose() {\n this.queue = [];\n }\n\n register(stateDecl: _StateDeclaration) {\n let queue = this.queue;\n let state = StateObject.create(stateDecl);\n let name = state.name;\n\n if (!isString(name)) throw new Error(\"State must have a valid name\");\n if (this.states.hasOwnProperty(name) || inArray(queue.map(prop('name')), name))\n throw new Error(`State '${name}' is already defined`);\n\n queue.push(state);\n this.flush();\n\n return state;\n }\n\n flush() {\n let {queue, states, builder} = this;\n let registered: StateObject[] = [], // states that got registered\n orphans: StateObject[] = [], // states that don't yet have a parent registered\n previousQueueLength = {}; // keep track of how long the queue when an orphan was first encountered\n const getState = (name) =>\n this.states.hasOwnProperty(name) && this.states[name];\n\n while (queue.length > 0) {\n let state: StateObject = queue.shift();\n let name = state.name;\n let result: StateObject = builder.build(state);\n let orphanIdx: number = orphans.indexOf(state);\n\n if (result) {\n let existingState = getState(name);\n if (existingState && existingState.name === name) {\n throw new Error(`State '${name}' is already defined`);\n }\n\n let existingFutureState = getState(name + \".**\");\n if (existingFutureState) {\n // Remove future state of the same name\n this.$registry.deregister(existingFutureState);\n }\n\n states[name] = state;\n this.attachRoute(state);\n if (orphanIdx >= 0) orphans.splice(orphanIdx, 1);\n registered.push(state);\n continue;\n }\n\n let prev = previousQueueLength[name];\n previousQueueLength[name] = queue.length;\n if (orphanIdx >= 0 && prev === queue.length) {\n // Wait until two consecutive iterations where no additional states were dequeued successfully.\n // throw new Error(`Cannot register orphaned state '${name}'`);\n queue.push(state);\n return states;\n } else if (orphanIdx < 0) {\n orphans.push(state);\n }\n\n queue.push(state);\n }\n\n if (registered.length) {\n this.listeners.forEach(listener => listener(\"registered\", registered.map(s => s.self)));\n }\n\n return states;\n }\n\n attachRoute(state: StateObject) {\n if (state.abstract || !state.url) return;\n\n this.$urlRouter.rule(this.$urlRouter.urlRuleFactory.create(state));\n }\n}\n", - "/**\n * @coreapi\n * @module state\n */ /** for typedoc */\n\nimport { StateObject } from \"./stateObject\";\nimport { StateMatcher } from \"./stateMatcher\";\nimport { StateBuilder } from \"./stateBuilder\";\nimport { StateQueueManager } from \"./stateQueueManager\";\nimport { StateDeclaration, _StateDeclaration } from \"./interface\";\nimport { BuilderFunction } from \"./stateBuilder\";\nimport { StateOrName } from \"./interface\";\nimport { removeFrom } from \"../common/common\";\nimport { UIRouter } from \"../router\";\nimport { propEq } from \"../common/hof\";\n\n/**\n * The signature for the callback function provided to [[StateRegistry.onStatesChanged]].\n *\n * This callback receives two parameters:\n *\n * @param event a string; either \"registered\" or \"deregistered\"\n * @param states the list of [[StateDeclaration]]s that were registered (or deregistered).\n */\nexport type StateRegistryListener = (event: \"registered\"|\"deregistered\", states: StateDeclaration[]) => void;\n\nexport class StateRegistry {\n private _root: StateObject;\n private states: { [key: string]: StateObject } = {};\n\n matcher: StateMatcher;\n private builder: StateBuilder;\n stateQueue: StateQueueManager;\n\n listeners: StateRegistryListener[] = [];\n\n /** @internalapi */\n constructor(private _router: UIRouter) {\n this.matcher = new StateMatcher(this.states);\n this.builder = new StateBuilder(this.matcher, _router.urlMatcherFactory);\n this.stateQueue = new StateQueueManager(this, _router.urlRouter, this.states, this.builder, this.listeners);\n this._registerRoot();\n }\n\n /** @internalapi */\n private _registerRoot() {\n let rootStateDef: StateDeclaration = {\n name: '',\n url: '^',\n views: null,\n params: {\n '#': { value: null, type: 'hash', dynamic: true }\n },\n abstract: true\n };\n\n let _root = this._root = this.stateQueue.register(rootStateDef);\n _root.navigable = null;\n }\n\n /** @internalapi */\n dispose() {\n this.stateQueue.dispose();\n this.listeners = [];\n this.get().forEach(state => this.get(state) && this.deregister(state));\n }\n\n /**\n * Listen for a State Registry events\n *\n * Adds a callback that is invoked when states are registered or deregistered with the StateRegistry.\n *\n * #### Example:\n * ```js\n * let allStates = registry.get();\n *\n * // Later, invoke deregisterFn() to remove the listener\n * let deregisterFn = registry.onStatesChanged((event, states) => {\n * switch(event) {\n * case: 'registered':\n * states.forEach(state => allStates.push(state));\n * break;\n * case: 'deregistered':\n * states.forEach(state => {\n * let idx = allStates.indexOf(state);\n * if (idx !== -1) allStates.splice(idx, 1);\n * });\n * break;\n * }\n * });\n * ```\n *\n * @param listener a callback function invoked when the registered states changes.\n * The function receives two parameters, `event` and `state`.\n * See [[StateRegistryListener]]\n * @return a function that deregisters the listener\n */\n onStatesChanged(listener: StateRegistryListener): () => void {\n this.listeners.push(listener);\n return function deregisterListener() {\n removeFrom(this.listeners)(listener);\n }.bind(this);\n }\n\n /**\n * Gets the implicit root state\n *\n * Gets the root of the state tree.\n * The root state is implicitly created by UI-Router.\n * Note: this returns the internal [[StateObject]] representation, not a [[StateDeclaration]]\n *\n * @return the root [[StateObject]]\n */\n root() {\n return this._root;\n }\n\n /**\n * Adds a state to the registry\n *\n * Registers a [[StateDeclaration]] or queues it for registration.\n *\n * Note: a state will be queued if the state's parent isn't yet registered.\n *\n * @param stateDefinition the definition of the state to register.\n * @returns the internal [[StateObject]] object.\n * If the state was successfully registered, then the object is fully built (See: [[StateBuilder]]).\n * If the state was only queued, then the object is not fully built.\n */\n register(stateDefinition: _StateDeclaration): StateObject {\n return this.stateQueue.register(stateDefinition);\n }\n\n /** @hidden */\n private _deregisterTree(state: StateObject) {\n let all = this.get().map(s => s.$$state());\n const getChildren = (states: StateObject[]) => {\n let children = all.filter(s => states.indexOf(s.parent) !== -1);\n return children.length === 0 ? children : children.concat(getChildren(children));\n };\n\n let children = getChildren([state]);\n let deregistered: StateObject[] = [state].concat(children).reverse();\n\n deregistered.forEach(state => {\n let $ur = this._router.urlRouter;\n // Remove URL rule\n $ur.rules().filter(propEq(\"state\", state)).forEach($ur.removeRule.bind($ur));\n // Remove state from registry\n delete this.states[state.name];\n });\n\n return deregistered;\n }\n\n /**\n * Removes a state from the registry\n *\n * This removes a state from the registry.\n * If the state has children, they are are also removed from the registry.\n *\n * @param stateOrName the state's name or object representation\n * @returns {StateObject[]} a list of removed states\n */\n deregister(stateOrName: StateOrName) {\n let _state = this.get(stateOrName);\n if (!_state) throw new Error(\"Can't deregister state; not found: \" + stateOrName);\n let deregisteredStates = this._deregisterTree(_state.$$state());\n\n this.listeners.forEach(listener => listener(\"deregistered\", deregisteredStates.map(s => s.self)));\n return deregisteredStates;\n }\n\n /**\n * Gets all registered states\n *\n * Calling this method with no arguments will return a list of all the states that are currently registered.\n * Note: this does not return states that are *queued* but not yet registered.\n *\n * @return a list of [[StateDeclaration]]s\n */\n get(): StateDeclaration[];\n\n /**\n * Gets a registered state\n *\n * Given a state or a name, finds and returns the [[StateDeclaration]] from the registry.\n * Note: this does not return states that are *queued* but not yet registered.\n *\n * @param stateOrName either the name of a state, or a state object.\n * @param base the base state to use when stateOrName is relative.\n * @return a registered [[StateDeclaration]] that matched the `stateOrName`, or null if the state isn't registered.\n */\n get(stateOrName: StateOrName, base?: StateOrName): StateDeclaration;\n get(stateOrName?: StateOrName, base?: StateOrName): any {\n if (arguments.length === 0)\n return Object.keys(this.states).map(name => this.states[name].self);\n let found = this.matcher.find(stateOrName, base);\n return found && found.self || null;\n }\n\n decorator(name: string, func: BuilderFunction) {\n return this.builder.builder(name, func);\n }\n}\n", - "/**\n * @coreapi\n * @module url\n */\n/** for typedoc */\nimport {\n map, defaults, inherit, identity, unnest, tail, find, Obj, pairs, allTrueR, unnestR, arrayTuples\n} from \"../common/common\";\nimport { prop, propEq } from \"../common/hof\";\nimport { isArray, isString, isDefined } from \"../common/predicates\";\nimport { Param, DefType } from \"../params/param\";\nimport { ParamTypes } from \"../params/paramTypes\";\nimport { RawParams } from \"../params/interface\";\nimport { ParamFactory } from \"./interface\";\nimport { joinNeighborsR, splitOnDelim } from \"../common/strings\";\n\n/** @hidden */\nfunction quoteRegExp(string: any, param?: any) {\n let surroundPattern = ['', ''], result = string.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, \"\\\\$&\");\n if (!param) return result;\n\n switch (param.squash) {\n case false:\n surroundPattern = ['(', ')' + (param.isOptional ? '?' : '')]; break;\n case true:\n result = result.replace(/\\/$/, '');\n surroundPattern = ['(?:\\/(', ')|\\/)?'];\n break;\n default:\n surroundPattern = [`(${param.squash}|`, ')?']; break;\n }\n return result + surroundPattern[0] + param.type.pattern.source + surroundPattern[1];\n}\n\n/** @hidden */\nconst memoizeTo = (obj: Obj, prop: string, fn: Function) =>\n obj[prop] = obj[prop] || fn();\n\n/** @hidden */\nconst splitOnSlash = splitOnDelim('/');\n\n/** @hidden */\ninterface UrlMatcherCache {\n segments?: any[];\n weights?: number[];\n path?: UrlMatcher[];\n parent?: UrlMatcher;\n pattern?: RegExp;\n}\n\n/**\n * Matches URLs against patterns.\n *\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL.\n *\n * A URL pattern consists of a path pattern, optionally followed by '?' and a list of search (query)\n * parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by [[UrlMatcher.exec]].\n *\n * - *Path parameters* are defined using curly brace placeholders (`/somepath/{param}`)\n * or colon placeholders (`/somePath/:param`).\n *\n * - *A parameter RegExp* may be defined for a param after a colon\n * (`/somePath/{param:[a-zA-Z0-9]+}`) in a curly brace placeholder.\n * The regexp must match for the url to be matched.\n * Should the regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Note: a RegExp parameter will encode its value using either [[ParamTypes.path]] or [[ParamTypes.query]].\n *\n * - *Custom parameter types* may also be specified after a colon (`/somePath/{param:int}`) in curly brace parameters.\n * See [[UrlMatcherFactory.type]] for more information.\n *\n * - *Catch-all parameters* are defined using an asterisk placeholder (`/somepath/*catchallparam`).\n * A catch-all * parameter value will contain the remainder of the URL.\n *\n * ---\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters).\n * A path parameter matches any number of characters other than '/'. For catch-all\n * placeholders the path parameter matches any number of characters.\n *\n * Examples:\n *\n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n * trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n * '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n * parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n * path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n * * `'/calendar/{start:date}'` - Matches \"/calendar/2014-11-12\" (because the pattern defined\n * in the built-in `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start\n *\n */\nexport class UrlMatcher {\n /** @hidden */\n static nameValidator: RegExp = /^\\w+([-.]+\\w+)*(?:\\[\\])?$/;\n\n /** @hidden */\n private _cache: UrlMatcherCache = { path: [this] };\n /** @hidden */\n private _children: UrlMatcher[] = [];\n /** @hidden */\n private _params: Param[] = [];\n /** @hidden */\n private _segments: string[] = [];\n /** @hidden */\n private _compiled: string[] = [];\n\n /** The pattern that was passed into the constructor */\n public pattern: string;\n\n /**\n * @param pattern The pattern to compile into a matcher.\n * @param paramTypes The [[ParamTypes]] registry\n * @param config A configuration object\n * - `caseInsensitive` - `true` if URL matching should be case insensitive, otherwise `false`, the default value (for backward compatibility) is `false`.\n * - `strict` - `false` if matching against a URL with a trailing slash should be treated as equivalent to a URL without a trailing slash, the default value is `true`.\n */\n constructor(pattern: string, paramTypes: ParamTypes, paramFactory: ParamFactory, public config?: any) {\n this.pattern = pattern;\n this.config = defaults(this.config, {\n params: {},\n strict: true,\n caseInsensitive: false,\n paramMap: identity\n });\n\n // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n // '*' name\n // ':' name\n // '{' name '}'\n // '{' name ':' regexp '}'\n // The regular expression is somewhat complicated due to the need to allow curly braces\n // inside the regular expression. The placeholder regexp breaks down as follows:\n // ([:*])([\\w\\[\\]]+) - classic placeholder ($1 / $2) (search version has - for snake-case)\n // \\{([\\w\\[\\]]+)(?:\\:\\s*( ... ))?\\} - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case\n // (?: ... | ... | ... )+ - the regexp consists of any number of atoms, an atom being either\n // [^{}\\\\]+ - anything other than curly braces or backslash\n // \\\\. - a backslash escape\n // \\{(?:[^{}\\\\]+|\\\\.)*\\} - a matched set of curly braces containing other atoms\n let placeholder = /([:*])([\\w\\[\\]]+)|\\{([\\w\\[\\]]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n searchPlaceholder = /([:]?)([\\w\\[\\].-]+)|\\{([\\w\\[\\].-]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n last = 0, m: RegExpExecArray, patterns: any[][] = [];\n\n const checkParamErrors = (id: string) => {\n if (!UrlMatcher.nameValidator.test(id)) throw new Error(`Invalid parameter name '${id}' in pattern '${pattern}'`);\n if (find(this._params, propEq('id', id))) throw new Error(`Duplicate parameter name '${id}' in pattern '${pattern}'`);\n };\n\n // Split into static segments separated by path parameter placeholders.\n // The number of segments is always 1 more than the number of parameters.\n const matchDetails = (m: RegExpExecArray, isSearch: boolean) => {\n // IE[78] returns '' for unmatched groups instead of null\n let id = m[2] || m[3];\n let regexp = isSearch ? m[4] : m[4] || (m[1] === '*' ? '[\\\\s\\\\S]*' : null);\n\n const makeRegexpType = (regexp) => inherit(paramTypes.type(isSearch ? \"query\" : \"path\"), {\n pattern: new RegExp(regexp, this.config.caseInsensitive ? 'i' : undefined)\n });\n\n return {\n id,\n regexp,\n cfg: this.config.params[id],\n segment: pattern.substring(last, m.index),\n type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp)\n };\n };\n\n let p: any, segment: string;\n\n while ((m = placeholder.exec(pattern))) {\n p = matchDetails(m, false);\n if (p.segment.indexOf('?') >= 0) break; // we're into the search part\n\n checkParamErrors(p.id);\n this._params.push(paramFactory.fromPath(p.id, p.type, this.config.paramMap(p.cfg, false)));\n this._segments.push(p.segment);\n patterns.push([p.segment, tail(this._params)]);\n last = placeholder.lastIndex;\n }\n segment = pattern.substring(last);\n\n // Find any search parameter names and remove them from the last segment\n let i = segment.indexOf('?');\n\n if (i >= 0) {\n let search = segment.substring(i);\n segment = segment.substring(0, i);\n\n if (search.length > 0) {\n last = 0;\n\n while ((m = searchPlaceholder.exec(search))) {\n p = matchDetails(m, true);\n checkParamErrors(p.id);\n this._params.push(paramFactory.fromSearch(p.id, p.type, this.config.paramMap(p.cfg, true)));\n last = placeholder.lastIndex;\n // check if ?&\n }\n }\n }\n\n this._segments.push(segment);\n this._compiled = patterns.map(pattern => quoteRegExp.apply(null, pattern)).concat(quoteRegExp(segment));\n }\n\n /**\n * Creates a new concatenated UrlMatcher\n *\n * Builds a new UrlMatcher by appending another UrlMatcher to this one.\n *\n * @param url A `UrlMatcher` instance to append as a child of the current `UrlMatcher`.\n */\n append(url: UrlMatcher): UrlMatcher {\n this._children.push(url);\n url._cache = {\n path: this._cache.path.concat(url),\n parent: this,\n pattern: null,\n };\n return url;\n }\n\n /** @hidden */\n isRoot(): boolean {\n return this._cache.path[0] === this;\n }\n\n /** Returns the input pattern string */\n toString(): string {\n return this.pattern;\n }\n\n /**\n * Tests the specified url/path against this matcher.\n *\n * Tests if the given url matches this matcher's pattern, and returns an object containing the captured\n * parameter values. Returns null if the path does not match.\n *\n * The returned object contains the values\n * of any search parameters that are mentioned in the pattern, but their value may be null if\n * they are not present in `search`. This means that search parameters are always treated\n * as optional.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', {\n * x: '1', q: 'hello'\n * });\n * // returns { id: 'bob', q: 'hello', r: null }\n * ```\n *\n * @param path The URL path to match, e.g. `$location.path()`.\n * @param search URL search parameters, e.g. `$location.search()`.\n * @param hash URL hash e.g. `$location.hash()`.\n * @param options\n *\n * @returns The captured parameter values.\n */\n exec(path: string, search: any = {}, hash?: string, options: any = {}): RawParams {\n let match = memoizeTo(this._cache, 'pattern', () => {\n return new RegExp([\n '^',\n unnest(this._cache.path.map(prop('_compiled'))).join(''),\n this.config.strict === false ? '\\/?' : '',\n '$'\n ].join(''), this.config.caseInsensitive ? 'i' : undefined);\n }).exec(path);\n\n if (!match) return null;\n\n //options = defaults(options, { isolate: false });\n\n let allParams: Param[] = this.parameters(),\n pathParams: Param[] = allParams.filter(param => !param.isSearch()),\n searchParams: Param[] = allParams.filter(param => param.isSearch()),\n nPathSegments = this._cache.path.map(urlm => urlm._segments.length - 1).reduce((a, x) => a + x),\n values: RawParams = {};\n\n if (nPathSegments !== match.length - 1)\n throw new Error(`Unbalanced capture group in route '${this.pattern}'`);\n\n function decodePathArray(string: string) {\n const reverseString = (str: string) => str.split(\"\").reverse().join(\"\");\n const unquoteDashes = (str: string) => str.replace(/\\\\-/g, \"-\");\n\n let split = reverseString(string).split(/-(?!\\\\)/);\n let allReversed = map(split, reverseString);\n return map(allReversed, unquoteDashes).reverse();\n }\n\n for (let i = 0; i < nPathSegments; i++) {\n let param: Param = pathParams[i];\n let value: (any|any[]) = match[i + 1];\n\n // if the param value matches a pre-replace pair, replace the value before decoding.\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n if (value && param.array === true) value = decodePathArray(value);\n if (isDefined(value)) value = param.type.decode(value);\n values[param.id] = param.value(value);\n }\n searchParams.forEach(param => {\n let value = search[param.id];\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n if (isDefined(value)) value = param.type.decode(value);\n values[param.id] = param.value(value);\n });\n\n if (hash) values[\"#\"] = hash;\n\n return values;\n }\n\n /**\n * @hidden\n * Returns all the [[Param]] objects of all path and search parameters of this pattern in order of appearance.\n *\n * @returns {Array.} An array of [[Param]] objects. Must be treated as read-only. If the\n * pattern has no parameters, an empty array is returned.\n */\n parameters(opts: any = {}): Param[] {\n if (opts.inherit === false) return this._params;\n return unnest(this._cache.path.map(matcher => matcher._params));\n }\n\n /**\n * @hidden\n * Returns a single parameter from this UrlMatcher by id\n *\n * @param id\n * @param opts\n * @returns {T|Param|any|boolean|UrlMatcher|null}\n */\n parameter(id: string, opts: any = {}): Param {\n const findParam = () => {\n for (let param of this._params) {\n if (param.id === id) return param;\n }\n };\n\n let parent = this._cache.parent;\n return findParam() || (opts.inherit !== false && parent && parent.parameter(id, opts)) || null;\n }\n\n /**\n * Validates the input parameter values against this UrlMatcher\n *\n * Checks an object hash of parameters to validate their correctness according to the parameter\n * types of this `UrlMatcher`.\n *\n * @param params The object hash of parameters to validate.\n * @returns Returns `true` if `params` validates, otherwise `false`.\n */\n validates(params: RawParams): boolean {\n const validParamVal = (param: Param, val: any) =>\n !param || param.validates(val);\n\n params = params || {};\n\n // I'm not sure why this checks only the param keys passed in, and not all the params known to the matcher\n let paramSchema = this.parameters().filter(paramDef => params.hasOwnProperty(paramDef.id));\n return paramSchema.map(paramDef => validParamVal(paramDef, params[paramDef.id])).reduce(allTrueR, true);\n }\n\n /**\n * Given a set of parameter values, creates a URL from this UrlMatcher.\n *\n * Creates a URL that matches this pattern by substituting the specified values\n * for the path and search parameters.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n * // returns '/user/bob?q=yes'\n * ```\n *\n * @param values the values to substitute for the parameters in this pattern.\n * @returns the formatted URL (path and optionally search part).\n */\n format(values: RawParams = {}) {\n // Build the full path of UrlMatchers (including all parent UrlMatchers)\n let urlMatchers = this._cache.path;\n\n // Extract all the static segments and Params (processed as ParamDetails)\n // into an ordered array\n let pathSegmentsAndParams: Array = urlMatchers.map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .map(x => isString(x) ? x : getDetails(x));\n\n // Extract the query params into a separate array\n let queryParams: Array = urlMatchers.map(UrlMatcher.queryParams)\n .reduce(unnestR, [])\n .map(getDetails);\n\n const isInvalid = (param: ParamDetails) => param.isValid === false;\n if (pathSegmentsAndParams.concat(queryParams).filter(isInvalid).length) {\n return null;\n }\n\n /**\n * Given a Param, applies the parameter value, then returns detailed information about it\n */\n function getDetails(param: Param): ParamDetails {\n // Normalize to typed value\n let value = param.value(values[param.id]);\n let isValid = param.validates(value);\n let isDefaultValue = param.isDefaultValue(value);\n // Check if we're in squash mode for the parameter\n let squash = isDefaultValue ? param.squash : false;\n // Allow the Parameter's Type to encode the value\n let encoded = param.type.encode(value);\n\n return { param, value, isValid, isDefaultValue, squash, encoded };\n }\n\n // Build up the path-portion from the list of static segments and parameters\n let pathString = pathSegmentsAndParams.reduce((acc: string, x: string|ParamDetails) => {\n // The element is a static segment (a raw string); just append it\n if (isString(x)) return acc + x;\n\n // Otherwise, it's a ParamDetails.\n let { squash, encoded, param } = x;\n\n // If squash is === true, try to remove a slash from the path\n if (squash === true) return (acc.match(/\\/$/)) ? acc.slice(0, -1) : acc;\n // If squash is a string, use the string for the param value\n if (isString(squash)) return acc + squash;\n if (squash !== false) return acc; // ?\n if (encoded == null) return acc;\n // If this parameter value is an array, encode the value using encodeDashes\n if (isArray(encoded)) return acc + map( encoded, UrlMatcher.encodeDashes).join(\"-\");\n // If the parameter type is \"raw\", then do not encodeURIComponent\n if (param.raw) return acc + encoded;\n // Encode the value\n return acc + encodeURIComponent( encoded);\n }, \"\");\n\n // Build the query string by applying parameter values (array or regular)\n // then mapping to key=value, then flattening and joining using \"&\"\n let queryString = queryParams.map((paramDetails: ParamDetails) => {\n let { param, squash, encoded, isDefaultValue } = paramDetails;\n if (encoded == null || (isDefaultValue && squash !== false)) return;\n if (!isArray(encoded)) encoded = [ encoded];\n if (encoded.length === 0) return;\n if (!param.raw) encoded = map( encoded, encodeURIComponent);\n\n return ( encoded).map(val => `${param.id}=${val}`);\n }).filter(identity).reduce(unnestR, []).join(\"&\");\n\n // Concat the pathstring with the queryString (if exists) and the hashString (if exists)\n return pathString + (queryString ? `?${queryString}` : \"\") + (values[\"#\"] ? \"#\" + values[\"#\"] : \"\");\n }\n\n /** @hidden */\n static encodeDashes(str: string) { // Replace dashes with encoded \"\\-\"\n return encodeURIComponent(str).replace(/-/g, c => `%5C%${c.charCodeAt(0).toString(16).toUpperCase()}`);\n }\n\n /** @hidden Given a matcher, return an array with the matcher's path segments and path params, in order */\n static pathSegmentsAndParams(matcher: UrlMatcher) {\n let staticSegments = matcher._segments;\n let pathParams = matcher._params.filter(p => p.location === DefType.PATH);\n return arrayTuples(staticSegments, pathParams.concat(undefined))\n .reduce(unnestR, [])\n .filter(x => x !== \"\" && isDefined(x));\n }\n\n /** @hidden Given a matcher, return an array with the matcher's query params */\n static queryParams(matcher: UrlMatcher): Param[] {\n return matcher._params.filter(p => p.location === DefType.SEARCH);\n }\n\n /**\n * Compare two UrlMatchers\n *\n * This comparison function converts a UrlMatcher into static and dynamic path segments.\n * Each static path segment is a static string between a path separator (slash character).\n * Each dynamic segment is a path parameter.\n *\n * The comparison function sorts static segments before dynamic ones.\n */\n static compare(a: UrlMatcher, b: UrlMatcher): number {\n /**\n * Turn a UrlMatcher and all its parent matchers into an array\n * of slash literals '/', string literals, and Param objects\n *\n * This example matcher matches strings like \"/foo/:param/tail\":\n * var matcher = $umf.compile(\"/foo\").append($umf.compile(\"/:param\")).append($umf.compile(\"/\")).append($umf.compile(\"tail\"));\n * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ]\n *\n * Caches the result as `matcher._cache.segments`\n */\n const segments = (matcher: UrlMatcher) =>\n matcher._cache.segments = matcher._cache.segments ||\n matcher._cache.path.map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .reduce(joinNeighborsR, [])\n .map(x => isString(x) ? splitOnSlash(x) : x)\n .reduce(unnestR, []);\n\n /**\n * Gets the sort weight for each segment of a UrlMatcher\n *\n * Caches the result as `matcher._cache.weights`\n */\n const weights = (matcher: UrlMatcher) =>\n matcher._cache.weights = matcher._cache.weights ||\n segments(matcher).map(segment => {\n // Sort slashes first, then static strings, the Params\n if (segment === '/') return 1;\n if (isString(segment)) return 2;\n if (segment instanceof Param) return 3;\n });\n\n /**\n * Pads shorter array in-place (mutates)\n */\n const padArrays = (l: any[], r: any[], padVal: any) => {\n const len = Math.max(l.length, r.length);\n while (l.length < len) l.push(padVal);\n while (r.length < len) r.push(padVal);\n };\n\n const weightsA = weights(a), weightsB = weights(b);\n padArrays(weightsA, weightsB, 0);\n let cmp, i, pairs = arrayTuples(weightsA, weightsB);\n\n for (i = 0; i < pairs.length; i++) {\n cmp = pairs[i][0] - pairs[i][1];\n if (cmp !== 0) return cmp;\n }\n\n return 0;\n }\n}\n\n/** @hidden */\ninterface ParamDetails {\n param: Param;\n value: any;\n isValid: boolean;\n isDefaultValue: boolean;\n squash: (boolean|string);\n encoded: (string|string[]);\n}\n", - "/**\n * @internalapi\n * @module url\n */ /** for typedoc */\nimport { forEach, extend } from \"../common/common\";\nimport { isObject, isDefined, isFunction, isString } from \"../common/predicates\";\nimport { UrlMatcher } from \"./urlMatcher\";\nimport { Param, DefType } from \"../params/param\";\nimport { ParamTypes } from \"../params/paramTypes\";\nimport { ParamTypeDefinition } from \"../params/interface\";\nimport { Disposable } from \"../interface\";\nimport { ParamType } from \"../params/paramType\";\nimport { ParamFactory, UrlMatcherConfig } from \"./interface\";\n\n/**\n * Factory for [[UrlMatcher]] instances.\n *\n * The factory is available to ng1 services as\n * `$urlMatcherFactory` or ng1 providers as `$urlMatcherFactoryProvider`.\n */\nexport class UrlMatcherFactory implements Disposable, UrlMatcherConfig {\n /** @hidden */ paramTypes = new ParamTypes();\n /** @hidden */ _isCaseInsensitive: boolean = false;\n /** @hidden */ _isStrictMode: boolean = true;\n /** @hidden */ _defaultSquashPolicy: (boolean|string) = false;\n\n constructor() {\n extend(this, { UrlMatcher, Param });\n }\n\n /** @inheritdoc */\n caseInsensitive(value?: boolean): boolean {\n return this._isCaseInsensitive = isDefined(value) ? value : this._isCaseInsensitive;\n }\n\n /** @inheritdoc */\n strictMode(value?: boolean): boolean {\n return this._isStrictMode = isDefined(value) ? value : this._isStrictMode;\n }\n\n /** @inheritdoc */\n defaultSquashPolicy(value?: (boolean|string)) {\n if (isDefined(value) && value !== true && value !== false && !isString(value))\n throw new Error(`Invalid squash policy: ${value}. Valid policies: false, true, arbitrary-string`);\n return this._defaultSquashPolicy = isDefined(value) ? value : this._defaultSquashPolicy;\n }\n\n /** @hidden */\n private _getConfig = (config) =>\n extend({ strict: this._isStrictMode, caseInsensitive: this._isCaseInsensitive }, config);\n\n /**\n * Creates a [[UrlMatcher]] for the specified pattern.\n *\n * @param pattern The URL pattern.\n * @param config The config object hash.\n * @returns The UrlMatcher.\n */\n compile(pattern: string, config?: { [key: string]: any }) {\n return new UrlMatcher(pattern, this.paramTypes, this.paramFactory, this._getConfig(config));\n }\n\n /**\n * Returns true if the specified object is a [[UrlMatcher]], or false otherwise.\n *\n * @param object The object to perform the type check against.\n * @returns `true` if the object matches the `UrlMatcher` interface, by\n * implementing all the same methods.\n */\n isMatcher(object: any): boolean {\n // TODO: typeof?\n if (!isObject(object)) return false;\n let result = true;\n\n forEach(UrlMatcher.prototype, (val, name) => {\n if (isFunction(val)) result = result && (isDefined(object[name]) && isFunction(object[name]));\n });\n return result;\n };\n\n /**\n * Creates and registers a custom [[ParamType]] object\n *\n * A [[ParamType]] can be used to generate URLs with typed parameters.\n *\n * @param name The type name.\n * @param definition The type definition. See [[ParamTypeDefinition]] for information on the values accepted.\n * @param definitionFn A function that is injected before the app runtime starts.\n * The result of this function should be a [[ParamTypeDefinition]].\n * The result is merged into the existing `definition`.\n * See [[ParamType]] for information on the values accepted.\n *\n * @returns - if a type was registered: the [[UrlMatcherFactory]]\n * - if only the `name` parameter was specified: the currently registered [[ParamType]] object, or undefined\n *\n * Note: Register custom types *before using them* in a state definition.\n *\n * See [[ParamTypeDefinition]] for examples\n */\n type(name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {\n let type = this.paramTypes.type(name, definition, definitionFn);\n return !isDefined(definition) ? type : this;\n };\n\n /** @hidden */\n $get() {\n this.paramTypes.enqueue = false;\n this.paramTypes._flushTypeQueue();\n return this;\n };\n\n /** @internalapi Creates a new [[Param]] for a given location (DefType) */\n paramFactory: ParamFactory = {\n /** Creates a new [[Param]] from a CONFIG block */\n fromConfig: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.CONFIG, this),\n\n /** Creates a new [[Param]] from a url PATH */\n fromPath: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.PATH, this),\n\n /** Creates a new [[Param]] from a url SEARCH */\n fromSearch: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.SEARCH, this),\n };\n\n /** @internalapi */\n dispose() {\n this.paramTypes.dispose();\n }\n}\n", - "/**\n * @coreapi\n * @module url\n */ /** */\nimport { UrlMatcher } from \"./urlMatcher\";\nimport { isString, isDefined, isFunction, isState } from \"../common/predicates\";\nimport { UIRouter } from \"../router\";\nimport { identity, extend } from \"../common/common\";\nimport { is, pattern } from \"../common/hof\";\nimport { StateObject } from \"../state/stateObject\";\nimport { RawParams } from \"../params/interface\";\nimport {\n UrlRule, UrlRuleMatchFn, UrlRuleHandlerFn, UrlRuleType, UrlParts, MatcherUrlRule, StateRule, RegExpRule\n} from \"./interface\";\n\n/**\n * Creates a [[UrlRule]]\n *\n * Creates a [[UrlRule]] from a:\n *\n * - `string`\n * - [[UrlMatcher]]\n * - `RegExp`\n * - [[StateObject]]\n * @internalapi\n */\nexport class UrlRuleFactory {\n constructor(public router: UIRouter) { }\n\n compile(str: string) {\n return this.router.urlMatcherFactory.compile(str);\n }\n\n static isUrlRule = obj =>\n obj && ['type', 'match', 'handler'].every(key => isDefined(obj[key]));\n\n create(what: string|UrlMatcher|StateObject|RegExp|UrlRuleMatchFn, handler?: string|UrlRuleHandlerFn): UrlRule {\n const makeRule = pattern([\n [isString, (_what: string) => makeRule(this.compile(_what))],\n [is(UrlMatcher), (_what: UrlMatcher) => this.fromUrlMatcher(_what, handler)],\n [isState, (_what: StateObject) => this.fromState(_what, this.router)],\n [is(RegExp), (_what: RegExp) => this.fromRegExp(_what, handler)],\n [isFunction, (_what: UrlRuleMatchFn) => new BaseUrlRule(_what, handler as UrlRuleHandlerFn)],\n ]);\n\n let rule = makeRule(what);\n if (!rule) throw new Error(\"invalid 'what' in when()\");\n return rule;\n }\n\n /**\n * A UrlRule which matches based on a UrlMatcher\n *\n * The `handler` may be either a `string`, a [[UrlRuleHandlerFn]] or another [[UrlMatcher]]\n *\n * ## Handler as a function\n *\n * If `handler` is a function, the function is invoked with:\n *\n * - matched parameter values ([[RawParams]] from [[UrlMatcher.exec]])\n * - url: the current Url ([[UrlParts]])\n * - router: the router object ([[UIRouter]])\n *\n * #### Example:\n * ```js\n * var urlMatcher = $umf.compile(\"/foo/:fooId/:barId\");\n * var rule = factory.fromUrlMatcher(urlMatcher, match => \"/home/\" + match.fooId + \"/\" + match.barId);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match); // '/home/123/456'\n * ```\n *\n * ## Handler as UrlMatcher\n *\n * If `handler` is a UrlMatcher, the handler matcher is used to create the new url.\n * The `handler` UrlMatcher is formatted using the matched param from the first matcher.\n * The url is replaced with the result.\n *\n * #### Example:\n * ```js\n * var urlMatcher = $umf.compile(\"/foo/:fooId/:barId\");\n * var handler = $umf.compile(\"/home/:fooId/:barId\");\n * var rule = factory.fromUrlMatcher(urlMatcher, handler);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match); // '/home/123/456'\n * ```\n */\n fromUrlMatcher(urlMatcher: UrlMatcher, handler: string|UrlMatcher|UrlRuleHandlerFn): MatcherUrlRule {\n let _handler: UrlRuleHandlerFn = handler as any;\n if (isString(handler)) handler = this.router.urlMatcherFactory.compile(handler);\n if (is(UrlMatcher)(handler)) _handler = (match: RawParams) => (handler as UrlMatcher).format(match);\n\n function match(url: UrlParts) {\n let match = urlMatcher.exec(url.path, url.search, url.hash);\n return urlMatcher.validates(match) && match;\n }\n\n // Prioritize URLs, lowest to highest:\n // - Some optional URL parameters, but none matched\n // - No optional parameters in URL\n // - Some optional parameters, some matched\n // - Some optional parameters, all matched\n function matchPriority(params: RawParams): number {\n let optional = urlMatcher.parameters().filter(param => param.isOptional);\n if (!optional.length) return 0.000001;\n let matched = optional.filter(param => params[param.id]);\n return matched.length / optional.length;\n }\n\n let details = { urlMatcher, matchPriority, type: \"URLMATCHER\" };\n return extend(new BaseUrlRule(match, _handler), details) as MatcherUrlRule;\n }\n\n\n /**\n * A UrlRule which matches a state by its url\n *\n * #### Example:\n * ```js\n * var rule = factory.fromState($state.get('foo'), router);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match);\n * // Starts a transition to 'foo' with params: { fooId: '123', barId: '456' }\n * ```\n */\n fromState(state: StateObject, router: UIRouter): StateRule {\n /**\n * Handles match by transitioning to matched state\n *\n * First checks if the router should start a new transition.\n * A new transition is not required if the current state's URL\n * and the new URL are already identical\n */\n const handler = (match: RawParams) => {\n let $state = router.stateService;\n let globals = router.globals;\n if ($state.href(state, match) !== $state.href(globals.current, globals.params)) {\n $state.transitionTo(state, match, { inherit: true, source: \"url\" });\n }\n };\n\n let details = { state, type: \"STATE\" };\n return extend(this.fromUrlMatcher(state.url, handler), details) as StateRule;\n }\n\n /**\n * A UrlRule which matches based on a regular expression\n *\n * The `handler` may be either a [[UrlRuleHandlerFn]] or a string.\n *\n * ## Handler as a function\n *\n * If `handler` is a function, the function is invoked with:\n *\n * - regexp match array (from `regexp`)\n * - url: the current Url ([[UrlParts]])\n * - router: the router object ([[UIRouter]])\n *\n * #### Example:\n * ```js\n * var rule = factory.fromRegExp(/^\\/foo\\/(bar|baz)$/, match => \"/home/\" + match[1])\n * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ]\n * var result = rule.handler(match); // '/home/bar'\n * ```\n *\n * ## Handler as string\n *\n * If `handler` is a string, the url is *replaced by the string* when the Rule is invoked.\n * The string is first interpolated using `string.replace()` style pattern.\n *\n * #### Example:\n * ```js\n * var rule = factory.fromRegExp(/^\\/foo\\/(bar|baz)$/, \"/home/$1\")\n * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ]\n * var result = rule.handler(match); // '/home/bar'\n * ```\n */\n fromRegExp(regexp: RegExp, handler: string|UrlRuleHandlerFn): RegExpRule {\n if (regexp.global || regexp.sticky) throw new Error(\"Rule RegExp must not be global or sticky\");\n\n /**\n * If handler is a string, the url will be replaced by the string.\n * If the string has any String.replace() style variables in it (like `$2`),\n * they will be replaced by the captures from [[match]]\n */\n const redirectUrlTo = (match: RegExpExecArray) =>\n // Interpolates matched values into $1 $2, etc using a String.replace()-style pattern\n (handler as string).replace(/\\$(\\$|\\d{1,2})/, (m, what) =>\n match[what === '$' ? 0 : Number(what)]);\n\n const _handler = isString(handler) ? redirectUrlTo : handler;\n\n const match = (url: UrlParts): RegExpExecArray =>\n regexp.exec(url.path);\n\n let details = { regexp, type: \"REGEXP\" };\n return extend(new BaseUrlRule(match, _handler), details) as RegExpRule\n }\n}\n\n/**\n * A base rule which calls `match`\n *\n * The value from the `match` function is passed through to the `handler`.\n * @internalapi\n */\nexport class BaseUrlRule implements UrlRule {\n $id: number;\n priority: number;\n type: UrlRuleType = \"RAW\";\n handler: UrlRuleHandlerFn;\n matchPriority = (match) => 0 - this.$id;\n\n constructor(public match: UrlRuleMatchFn, handler?: UrlRuleHandlerFn) {\n this.handler = handler || identity;\n }\n}", - "/**\n * @internalapi\n * @module url\n */\n/** for typedoc */\nimport { createProxyFunctions, extend, removeFrom } from '../common/common';\nimport { isDefined, isFunction, isString } from '../common/predicates';\nimport { UrlMatcher } from './urlMatcher';\nimport { RawParams } from '../params/interface';\nimport { Disposable } from '../interface';\nimport { UIRouter } from '../router';\nimport { is, pattern, val } from '../common/hof';\nimport { UrlRuleFactory } from './urlRule';\nimport { TargetState } from '../state/targetState';\nimport { MatcherUrlRule, MatchResult, UrlParts, UrlRule, UrlRuleHandlerFn, UrlRuleMatchFn, UrlRulesApi, UrlSyncApi, } from './interface';\nimport { TargetStateDef } from '../state/interface';\nimport { stripLastPathElement } from '../common';\n\n/** @hidden */\nfunction appendBasePath(url: string, isHtml5: boolean, absolute: boolean, baseHref: string): string {\n if (baseHref === '/') return url;\n if (isHtml5) return stripLastPathElement(baseHref) + url;\n if (absolute) return baseHref.slice(1) + url;\n return url;\n}\n\n/** @hidden */\nconst prioritySort = (a: UrlRule, b: UrlRule) =>\n (b.priority || 0) - (a.priority || 0);\n\n/** @hidden */\nconst typeSort = (a: UrlRule, b: UrlRule) => {\n const weights = { \"STATE\": 4, \"URLMATCHER\": 4, \"REGEXP\": 3, \"RAW\": 2, \"OTHER\": 1 };\n return (weights[a.type] || 0) - (weights[b.type] || 0);\n};\n\n/** @hidden */\nconst urlMatcherSort = (a: MatcherUrlRule, b: MatcherUrlRule) =>\n !a.urlMatcher || !b.urlMatcher ? 0 : UrlMatcher.compare(a.urlMatcher, b.urlMatcher);\n\n/** @hidden */\nconst idSort = (a: UrlRule, b: UrlRule) => {\n // Identically sorted STATE and URLMATCHER best rule will be chosen by `matchPriority` after each rule matches the URL\n const useMatchPriority = { STATE: true, URLMATCHER: true };\n const equal = useMatchPriority[a.type] && useMatchPriority[b.type];\n return equal ? 0 : (a.$id || 0) - (b.$id || 0);\n};\n\n/**\n * Default rule priority sorting function.\n *\n * Sorts rules by:\n *\n * - Explicit priority (set rule priority using [[UrlRulesApi.when]])\n * - Rule type (STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1)\n * - `UrlMatcher` specificity ([[UrlMatcher.compare]]): works for STATE and URLMATCHER types to pick the most specific rule.\n * - Rule registration order (for rule types other than STATE and URLMATCHER)\n * - Equally sorted State and UrlMatcher rules will each match the URL.\n * Then, the *best* match is chosen based on how many parameter values were matched.\n *\n * @coreapi\n */\nlet defaultRuleSortFn: (a: UrlRule, b: UrlRule) => number;\ndefaultRuleSortFn = (a, b) => {\n let cmp = prioritySort(a, b);\n if (cmp !== 0) return cmp;\n\n cmp = typeSort(a, b);\n if (cmp !== 0) return cmp;\n\n cmp = urlMatcherSort(a as MatcherUrlRule, b as MatcherUrlRule);\n if (cmp !== 0) return cmp;\n\n return idSort(a, b);\n};\n\n/**\n * Updates URL and responds to URL changes\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class updates the URL when the state changes.\n * It also responds to changes in the URL.\n */\nexport class UrlRouter implements UrlRulesApi, UrlSyncApi, Disposable {\n /** used to create [[UrlRule]] objects for common cases */\n public urlRuleFactory: UrlRuleFactory;\n\n /** @hidden */ private _router: UIRouter;\n /** @hidden */ private location: string;\n /** @hidden */ private _sortFn = defaultRuleSortFn;\n /** @hidden */ private _stopFn: Function;\n /** @hidden */ _rules: UrlRule[] = [];\n /** @hidden */ private _otherwiseFn: UrlRule;\n /** @hidden */ interceptDeferred = false;\n /** @hidden */ private _id = 0;\n /** @hidden */ private _sorted = false;\n\n /** @hidden */\n constructor(router: UIRouter) {\n this._router = router;\n this.urlRuleFactory = new UrlRuleFactory(router);\n createProxyFunctions(val(UrlRouter.prototype), this, val(this));\n }\n\n /** @internalapi */\n dispose() {\n this.listen(false);\n this._rules = [];\n delete this._otherwiseFn;\n }\n\n /** @inheritdoc */\n sort(compareFn?: (a: UrlRule, b: UrlRule) => number) {\n this._rules = this.stableSort(this._rules, this._sortFn = compareFn || this._sortFn);\n this._sorted = true;\n }\n\n private ensureSorted() {\n this._sorted || this.sort();\n }\n\n private stableSort(arr, compareFn) {\n const arrOfWrapper = arr.map((elem, idx) => ({ elem, idx }));\n\n arrOfWrapper.sort((wrapperA, wrapperB) => {\n const cmpDiff = compareFn(wrapperA.elem, wrapperB.elem);\n return cmpDiff === 0\n ? wrapperA.idx - wrapperB.idx\n : cmpDiff;\n });\n\n return arrOfWrapper.map(wrapper => wrapper.elem);\n }\n\n /**\n * Given a URL, check all rules and return the best [[MatchResult]]\n * @param url\n * @returns {MatchResult}\n */\n match(url: UrlParts): MatchResult {\n this.ensureSorted();\n\n url = extend({path: '', search: {}, hash: '' }, url);\n let rules = this.rules();\n if (this._otherwiseFn) rules.push(this._otherwiseFn);\n\n // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined\n\n let checkRule = (rule: UrlRule): MatchResult => {\n let match = rule.match(url, this._router);\n return match && { match, rule, weight: rule.matchPriority(match) };\n };\n\n // The rules are pre-sorted.\n // - Find the first matching rule.\n // - Find any other matching rule that sorted *exactly the same*, according to `.sort()`.\n // - Choose the rule with the highest match weight.\n let best: MatchResult;\n for (let i = 0; i < rules.length; i++) {\n // Stop when there is a 'best' rule and the next rule sorts differently than it.\n if (best && this._sortFn(rules[i], best.rule) !== 0) break;\n\n let current = checkRule(rules[i]);\n // Pick the best MatchResult\n best = (!best || current && current.weight > best.weight) ? current : best;\n }\n\n return best;\n }\n\n /** @inheritdoc */\n sync(evt?) {\n if (evt && evt.defaultPrevented) return;\n\n let router = this._router,\n $url = router.urlService,\n $state = router.stateService;\n\n let url: UrlParts = {\n path: $url.path(), search: $url.search(), hash: $url.hash(),\n };\n\n let best = this.match(url);\n\n let applyResult = pattern([\n [isString, (newurl: string) => $url.url(newurl, true)],\n [TargetState.isDef, (def: TargetStateDef) => $state.go(def.state, def.params, def.options)],\n [is(TargetState), (target: TargetState) => $state.go(target.state(), target.params(), target.options())],\n ]);\n\n applyResult(best && best.rule.handler(best.match, url, router));\n }\n\n /** @inheritdoc */\n listen(enabled?: boolean): Function {\n if (enabled === false) {\n this._stopFn && this._stopFn();\n delete this._stopFn;\n } else {\n return this._stopFn = this._stopFn || this._router.urlService.onChange(evt => this.sync(evt));\n }\n }\n\n /**\n * Internal API.\n * @internalapi\n */\n update(read?: boolean) {\n let $url = this._router.locationService;\n if (read) {\n this.location = $url.url();\n return;\n }\n if ($url.url() === this.location) return;\n\n $url.url(this.location, true);\n }\n\n /**\n * Internal API.\n *\n * Pushes a new location to the browser history.\n *\n * @internalapi\n * @param urlMatcher\n * @param params\n * @param options\n */\n push(urlMatcher: UrlMatcher, params?: RawParams, options?: { replace?: (string|boolean) }) {\n let replace = options && !!options.replace;\n this._router.urlService.url(urlMatcher.format(params || {}), replace);\n }\n\n /**\n * Builds and returns a URL with interpolated parameters\n *\n * #### Example:\n * ```js\n * matcher = $umf.compile(\"/about/:person\");\n * params = { person: \"bob\" };\n * $bob = $urlRouter.href(matcher, params);\n * // $bob == \"/about/bob\";\n * ```\n *\n * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate.\n * @param params An object of parameter values to fill the matcher's required parameters.\n * @param options Options object. The options are:\n *\n * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n *\n * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`\n */\n href(urlMatcher: UrlMatcher, params?: any, options?: { absolute: boolean }): string {\n let url = urlMatcher.format(params);\n if (url == null) return null;\n\n options = options || { absolute: false };\n\n let cfg = this._router.urlService.config;\n let isHtml5 = cfg.html5Mode();\n if (!isHtml5 && url !== null) {\n url = \"#\" + cfg.hashPrefix() + url;\n }\n url = appendBasePath(url, isHtml5, options.absolute, cfg.baseHref());\n\n if (!options.absolute || !url) {\n return url;\n }\n\n let slash = (!isHtml5 && url ? '/' : ''), port = cfg.port();\n port = (port === 80 || port === 443 ? '' : ':' + port);\n\n return [cfg.protocol(), '://', cfg.host(), port, slash, url].join('');\n }\n\n\n /**\n * Manually adds a URL Rule.\n *\n * Usually, a url rule is added using [[StateDeclaration.url]] or [[when]].\n * This api can be used directly for more control (to register a [[BaseUrlRule]], for example).\n * Rules can be created using [[UrlRouter.urlRuleFactory]], or create manually as simple objects.\n *\n * A rule should have a `match` function which returns truthy if the rule matched.\n * It should also have a `handler` function which is invoked if the rule is the best match.\n *\n * @return a function that deregisters the rule\n */\n rule(rule: UrlRule): Function {\n if (!UrlRuleFactory.isUrlRule(rule)) throw new Error(\"invalid rule\");\n rule.$id = this._id++;\n rule.priority = rule.priority || 0;\n\n this._rules.push(rule);\n this._sorted = false;\n\n return () => this.removeRule(rule);\n }\n\n /** @inheritdoc */\n removeRule(rule): void {\n removeFrom(this._rules, rule);\n }\n\n /** @inheritdoc */\n rules(): UrlRule[] {\n this.ensureSorted();\n return this._rules.slice();\n }\n\n /** @inheritdoc */\n otherwise(handler: string|UrlRuleHandlerFn|TargetState|TargetStateDef) {\n let handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n this._otherwiseFn = this.urlRuleFactory.create(val(true), handlerFn);\n this._sorted = false;\n };\n\n /** @inheritdoc */\n initial(handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef) {\n let handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n let matchFn: UrlRuleMatchFn = (urlParts, router) =>\n router.globals.transitionHistory.size() === 0 && !!/^\\/?$/.exec(urlParts.path);\n\n this.rule(this.urlRuleFactory.create(matchFn, handlerFn));\n };\n\n /** @inheritdoc */\n when(matcher: (RegExp|UrlMatcher|string), handler: string|UrlRuleHandlerFn, options?: { priority: number }): UrlRule {\n let rule = this.urlRuleFactory.create(matcher, handler);\n if (isDefined(options && options.priority)) rule.priority = options.priority;\n this.rule(rule);\n return rule;\n };\n\n /** @inheritdoc */\n deferIntercept(defer?: boolean) {\n if (defer === undefined) defer = true;\n this.interceptDeferred = defer;\n };\n}\n\nfunction getHandlerFn(handler: string|UrlRuleHandlerFn|TargetState|TargetStateDef): UrlRuleHandlerFn {\n if (!isFunction(handler) && !isString(handler) && !is(TargetState)(handler) && !TargetState.isDef(handler)) {\n throw new Error(\"'handler' must be a string, function, TargetState, or have a state: 'newtarget' property\");\n }\n return isFunction(handler) ? handler as UrlRuleHandlerFn : val(handler);\n}\n", - "/**\n * @coreapi\n * @module view\n */ /** for typedoc */\nimport { equals, applyPairs, removeFrom, TypedMap, inArray } from \"../common/common\";\nimport { curry, prop } from \"../common/hof\";\nimport { isString, isArray } from \"../common/predicates\";\nimport { trace } from \"../common/trace\";\nimport { PathNode } from \"../path/pathNode\";\nimport { ActiveUIView, ViewContext, ViewConfig } from \"./interface\";\nimport { _ViewDeclaration } from \"../state/interface\";\n\nexport type ViewConfigFactory = (path: PathNode[], decl: _ViewDeclaration) => ViewConfig|ViewConfig[];\n\nexport interface ViewServicePluginAPI {\n _rootViewContext(context?: ViewContext): ViewContext;\n _viewConfigFactory(viewType: string, factory: ViewConfigFactory);\n _registeredUIViews(): ActiveUIView[];\n _activeViewConfigs(): ViewConfig[];\n _onSync(listener: ViewSyncListener): Function;\n}\n\n// A uiView and its matching viewConfig\nexport interface ViewTuple {\n uiView: ActiveUIView;\n viewConfig: ViewConfig;\n}\n\nexport interface ViewSyncListener {\n (viewTuples: ViewTuple[]): void;\n}\n\n/**\n * The View service\n *\n * This service pairs existing `ui-view` components (which live in the DOM)\n * with view configs (from the state declaration objects: [[StateDeclaration.views]]).\n *\n * - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]].\n * The views from exited states are deactivated via [[deactivateViewConfig]].\n * (See: the [[registerActivateViews]] Transition Hook)\n *\n * - As `ui-view` components pop in and out of existence, they register themselves using [[registerUIView]].\n *\n * - When the [[sync]] function is called, the registered `ui-view`(s) ([[ActiveUIView]])\n * are configured with the matching [[ViewConfig]](s)\n *\n */\nexport class ViewService {\n private _uiViews: ActiveUIView[] = [];\n private _viewConfigs: ViewConfig[] = [];\n private _rootContext: ViewContext;\n private _viewConfigFactories: { [key: string]: ViewConfigFactory } = {};\n private _listeners: ViewSyncListener[] = [];\n\n constructor() { }\n\n public _pluginapi: ViewServicePluginAPI = {\n _rootViewContext: this._rootViewContext.bind(this),\n _viewConfigFactory: this._viewConfigFactory.bind(this),\n _registeredUIViews: () => this._uiViews,\n _activeViewConfigs: () => this._viewConfigs,\n _onSync: (listener: ViewSyncListener) => {\n this._listeners.push(listener);\n return () => removeFrom(this._listeners, listener);\n },\n };\n\n private _rootViewContext(context?: ViewContext): ViewContext {\n return this._rootContext = context || this._rootContext;\n };\n\n private _viewConfigFactory(viewType: string, factory: ViewConfigFactory) {\n this._viewConfigFactories[viewType] = factory;\n }\n\n createViewConfig(path: PathNode[], decl: _ViewDeclaration): ViewConfig[] {\n let cfgFactory = this._viewConfigFactories[decl.$type];\n if (!cfgFactory) throw new Error(\"ViewService: No view config factory registered for type \" + decl.$type);\n let cfgs = cfgFactory(path, decl);\n return isArray(cfgs) ? cfgs : [cfgs];\n }\n\n /**\n * Deactivates a ViewConfig.\n *\n * This function deactivates a `ViewConfig`.\n * After calling [[sync]], it will un-pair from any `ui-view` with which it is currently paired.\n *\n * @param viewConfig The ViewConfig view to deregister.\n */\n deactivateViewConfig(viewConfig: ViewConfig) {\n trace.traceViewServiceEvent(\"<- Removing\", viewConfig);\n removeFrom(this._viewConfigs, viewConfig);\n }\n\n activateViewConfig(viewConfig: ViewConfig) {\n trace.traceViewServiceEvent(\"-> Registering\", viewConfig);\n this._viewConfigs.push(viewConfig);\n }\n\n /**\n * Given a ui-view and a ViewConfig, determines if they \"match\".\n *\n * A ui-view has a fully qualified name (fqn) and a context object. The fqn is built from its overall location in\n * the DOM, describing its nesting relationship to any parent ui-view tags it is nested inside of.\n *\n * A ViewConfig has a target ui-view name and a context anchor. The ui-view name can be a simple name, or\n * can be a segmented ui-view path, describing a portion of a ui-view fqn.\n *\n * In order for a ui-view to match ViewConfig, ui-view's $type must match the ViewConfig's $type\n *\n * If the ViewConfig's target ui-view name is a simple name (no dots), then a ui-view matches if:\n * - the ui-view's name matches the ViewConfig's target name\n * - the ui-view's context matches the ViewConfig's anchor\n *\n * If the ViewConfig's target ui-view name is a segmented name (with dots), then a ui-view matches if:\n * - There exists a parent ui-view where:\n * - the parent ui-view's name matches the first segment (index 0) of the ViewConfig's target name\n * - the parent ui-view's context matches the ViewConfig's anchor\n * - And the remaining segments (index 1..n) of the ViewConfig's target name match the tail of the ui-view's fqn\n *\n * Example:\n *\n * DOM:\n * \n * \n * \n * \n * \n * \n * \n * \n *\n * uiViews: [\n * { fqn: \"$default\", creationContext: { name: \"\" } },\n * { fqn: \"$default.foo\", creationContext: { name: \"A\" } },\n * { fqn: \"$default.foo.$default\", creationContext: { name: \"A.B\" } }\n * { fqn: \"$default.foo.$default.bar\", creationContext: { name: \"A.B.C\" } }\n * ]\n *\n * These four view configs all match the ui-view with the fqn: \"$default.foo.$default.bar\":\n *\n * - ViewConfig1: { uiViewName: \"bar\", uiViewContextAnchor: \"A.B.C\" }\n * - ViewConfig2: { uiViewName: \"$default.bar\", uiViewContextAnchor: \"A.B\" }\n * - ViewConfig3: { uiViewName: \"foo.$default.bar\", uiViewContextAnchor: \"A\" }\n * - ViewConfig4: { uiViewName: \"$default.foo.$default.bar\", uiViewContextAnchor: \"\" }\n *\n * Using ViewConfig3 as an example, it matches the ui-view with fqn \"$default.foo.$default.bar\" because:\n * - The ViewConfig's segmented target name is: [ \"foo\", \"$default\", \"bar\" ]\n * - There exists a parent ui-view (which has fqn: \"$default.foo\") where:\n * - the parent ui-view's name \"foo\" matches the first segment \"foo\" of the ViewConfig's target name\n * - the parent ui-view's context \"A\" matches the ViewConfig's anchor context \"A\"\n * - And the remaining segments [ \"$default\", \"bar\" ].join(\".\"_ of the ViewConfig's target name match\n * the tail of the ui-view's fqn \"default.bar\"\n *\n * @internalapi\n */\n static matches = (uiViewsByFqn: TypedMap, uiView: ActiveUIView) => (viewConfig: ViewConfig) => {\n // Don't supply an ng1 ui-view with an ng2 ViewConfig, etc\n if (uiView.$type !== viewConfig.viewDecl.$type) return false;\n\n // Split names apart from both viewConfig and uiView into segments\n let vc = viewConfig.viewDecl;\n let vcSegments = vc.$uiViewName.split(\".\");\n let uivSegments = uiView.fqn.split(\".\");\n\n // Check if the tails of the segment arrays match. ex, these arrays' tails match:\n // vc: [\"foo\", \"bar\"], uiv fqn: [\"$default\", \"foo\", \"bar\"]\n if (!equals(vcSegments, uivSegments.slice(0 - vcSegments.length)))\n return false;\n\n // Now check if the fqn ending at the first segment of the viewConfig matches the context:\n // [\"$default\", \"foo\"].join(\".\") == \"$default.foo\", does the ui-view $default.foo context match?\n let negOffset = (1 - vcSegments.length) || undefined;\n let fqnToFirstSegment = uivSegments.slice(0, negOffset).join(\".\");\n let uiViewContext = uiViewsByFqn[fqnToFirstSegment].creationContext;\n return vc.$uiViewContextAnchor === (uiViewContext && uiViewContext.name);\n }\n\n sync() {\n let uiViewsByFqn: TypedMap =\n this._uiViews.map(uiv => [uiv.fqn, uiv]).reduce(applyPairs, {});\n\n // Return a weighted depth value for a uiView.\n // The depth is the nesting depth of ui-views (based on FQN; times 10,000)\n // plus the depth of the state that is populating the uiView\n function uiViewDepth(uiView: ActiveUIView) {\n const stateDepth = (context: ViewContext) =>\n context && context.parent ? stateDepth(context.parent) + 1 : 1;\n return (uiView.fqn.split(\".\").length * 10000) + stateDepth(uiView.creationContext);\n }\n\n // Return the ViewConfig's context's depth in the context tree.\n function viewConfigDepth(config: ViewConfig) {\n let context: ViewContext = config.viewDecl.$context, count = 0;\n while (++count && context.parent) context = context.parent;\n return count;\n }\n\n // Given a depth function, returns a compare function which can return either ascending or descending order\n const depthCompare = curry((depthFn, posNeg, left, right) => posNeg * (depthFn(left) - depthFn(right)));\n\n const matchingConfigPair = (uiView: ActiveUIView): ViewTuple => {\n let matchingConfigs = this._viewConfigs.filter(ViewService.matches(uiViewsByFqn, uiView));\n if (matchingConfigs.length > 1) {\n // This is OK. Child states can target a ui-view that the parent state also targets (the child wins)\n // Sort by depth and return the match from the deepest child\n // console.log(`Multiple matching view configs for ${uiView.fqn}`, matchingConfigs);\n matchingConfigs.sort(depthCompare(viewConfigDepth, -1)); // descending\n }\n return { uiView, viewConfig: matchingConfigs[0] };\n };\n\n const configureUIView = (tuple: ViewTuple) => {\n // If a parent ui-view is reconfigured, it could destroy child ui-views.\n // Before configuring a child ui-view, make sure it's still in the active uiViews array.\n if (this._uiViews.indexOf(tuple.uiView) !== -1)\n tuple.uiView.configUpdated(tuple.viewConfig);\n };\n\n // Sort views by FQN and state depth. Process uiviews nearest the root first.\n const uiViewTuples = this._uiViews.sort(depthCompare(uiViewDepth, 1)).map(matchingConfigPair);\n const matchedViewConfigs = uiViewTuples.map(tuple => tuple.viewConfig);\n const unmatchedConfigTuples = this._viewConfigs\n .filter(config => inArray(matchedViewConfigs, config))\n .map(viewConfig => ({ uiView: undefined, viewConfig }));\n\n const allTuples: ViewTuple[] = uiViewTuples.concat(unmatchedConfigTuples);\n\n uiViewTuples.forEach(configureUIView);\n\n this._listeners.forEach(cb => cb(allTuples));\n trace.traceViewSync(allTuples);\n };\n\n /**\n * Registers a `ui-view` component\n *\n * When a `ui-view` component is created, it uses this method to register itself.\n * After registration the [[sync]] method is used to ensure all `ui-view` are configured with the proper [[ViewConfig]].\n *\n * Note: the `ui-view` component uses the `ViewConfig` to determine what view should be loaded inside the `ui-view`,\n * and what the view's state context is.\n *\n * Note: There is no corresponding `deregisterUIView`.\n * A `ui-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself.\n *\n * @param uiView The metadata for a UIView\n * @return a de-registration function used when the view is destroyed.\n */\n registerUIView(uiView: ActiveUIView) {\n trace.traceViewServiceUIViewEvent(\"-> Registering\", uiView);\n let uiViews = this._uiViews;\n const fqnAndTypeMatches = (uiv: ActiveUIView) => uiv.fqn === uiView.fqn && uiv.$type === uiView.$type;\n if (uiViews.filter(fqnAndTypeMatches).length)\n trace.traceViewServiceUIViewEvent(\"!!!! duplicate uiView named:\", uiView);\n\n uiViews.push(uiView);\n this.sync();\n\n return () => {\n let idx = uiViews.indexOf(uiView);\n if (idx === -1) {\n trace.traceViewServiceUIViewEvent(\"Tried removing non-registered uiView\", uiView);\n return;\n }\n trace.traceViewServiceUIViewEvent(\"<- Deregistering\", uiView);\n removeFrom(uiViews)(uiView);\n };\n };\n\n /**\n * Returns the list of views currently available on the page, by fully-qualified name.\n *\n * @return {Array} Returns an array of fully-qualified view names.\n */\n available() {\n return this._uiViews.map(prop(\"fqn\"));\n }\n\n /**\n * Returns the list of views on the page containing loaded content.\n *\n * @return {Array} Returns an array of fully-qualified view names.\n */\n active() {\n return this._uiViews.filter(prop(\"$config\")).map(prop(\"name\"));\n }\n\n /**\n * Normalizes a view's name from a state.views configuration block.\n *\n * This should be used by a framework implementation to calculate the values for\n * [[_ViewDeclaration.$uiViewName]] and [[_ViewDeclaration.$uiViewContextAnchor]].\n *\n * @param context the context object (state declaration) that the view belongs to\n * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]]\n *\n * @returns the normalized uiViewName and uiViewContextAnchor that the view targets\n */\n static normalizeUIViewTarget(context: ViewContext, rawViewName = \"\") {\n // TODO: Validate incoming view name with a regexp to allow:\n // ex: \"view.name@foo.bar\" , \"^.^.view.name\" , \"view.name@^.^\" , \"\" ,\n // \"@\" , \"$default@^\" , \"!$default.$default\" , \"!foo.bar\"\n let viewAtContext: string[] = rawViewName.split(\"@\");\n let uiViewName = viewAtContext[0] || \"$default\"; // default to unnamed view\n let uiViewContextAnchor = isString(viewAtContext[1]) ? viewAtContext[1] : \"^\"; // default to parent context\n\n // Handle relative view-name sugar syntax.\n // Matches rawViewName \"^.^.^.foo.bar\" into array: [\"^.^.^.foo.bar\", \"^.^.^\", \"foo.bar\"],\n let relativeViewNameSugar = /^(\\^(?:\\.\\^)*)\\.(.*$)/.exec(uiViewName);\n if (relativeViewNameSugar) {\n // Clobbers existing contextAnchor (rawViewName validation will fix this)\n uiViewContextAnchor = relativeViewNameSugar[1]; // set anchor to \"^.^.^\"\n uiViewName = relativeViewNameSugar[2]; // set view-name to \"foo.bar\"\n }\n\n if (uiViewName.charAt(0) === '!') {\n uiViewName = uiViewName.substr(1);\n uiViewContextAnchor = \"\"; // target absolutely from root\n }\n\n // handle parent relative targeting \"^.^.^\"\n let relativeMatch = /^(\\^(?:\\.\\^)*)$/;\n if (relativeMatch.exec(uiViewContextAnchor)) {\n let anchor = uiViewContextAnchor.split(\".\").reduce(((anchor, x) => anchor.parent), context);\n uiViewContextAnchor = anchor.name;\n } else if (uiViewContextAnchor === '.') {\n uiViewContextAnchor = context.name;\n }\n\n return {uiViewName, uiViewContextAnchor};\n }\n}\n", - "/**\n * @coreapi\n * @module core\n */ /** */\nimport {StateParams} from \"./params/stateParams\";\nimport {StateDeclaration} from \"./state/interface\";\nimport {StateObject} from \"./state/stateObject\";\nimport {Transition} from \"./transition/transition\";\nimport {Queue} from \"./common/queue\";\nimport { Disposable } from './interface';\n\n/**\n * Global router state\n *\n * This is where we hold the global mutable state such as current state, current\n * params, current transition, etc.\n */\nexport class UIRouterGlobals implements Disposable {\n /**\n * Current parameter values\n *\n * The parameter values from the latest successful transition\n */\n params: StateParams = new StateParams();\n\n /**\n * Current state\n *\n * The to-state from the latest successful transition\n */\n current: StateDeclaration;\n\n /**\n * Current state (internal object)\n *\n * The to-state from the latest successful transition\n * @internalapi\n */\n $current: StateObject;\n\n /**\n * The current started/running transition.\n * This transition has reached at least the onStart phase, but is not yet complete\n */\n transition: Transition;\n\n /** @internalapi */\n lastStartedTransitionId: number = -1;\n\n /** @internalapi */\n transitionHistory = new Queue([], 1);\n\n /** @internalapi */\n successfulTransitions = new Queue([], 1);\n\n dispose() {\n this.transitionHistory.clear();\n this.successfulTransitions.clear();\n this.transition = null;\n }\n}\n", - "/**\n * @coreapi\n * @module url\n */ /** */\n\nimport { UIRouter } from \"../router\";\nimport { LocationServices, notImplemented, LocationConfig } from \"../common/coreservices\";\nimport { noop, createProxyFunctions } from \"../common/common\";\nimport { UrlConfigApi, UrlSyncApi, UrlRulesApi, UrlParts, MatchResult } from \"./interface\";\n\n/** @hidden */\nconst makeStub = (keys: string[]): any =>\n keys.reduce((acc, key) => (acc[key] = notImplemented(key), acc), { dispose: noop });\n\n/** @hidden */ const locationServicesFns = [\"url\", \"path\", \"search\", \"hash\", \"onChange\"];\n/** @hidden */ const locationConfigFns = [\"port\", \"protocol\", \"host\", \"baseHref\", \"html5Mode\", \"hashPrefix\"];\n/** @hidden */ const umfFns = [\"type\", \"caseInsensitive\", \"strictMode\", \"defaultSquashPolicy\"];\n/** @hidden */ const rulesFns = [\"sort\", \"when\", \"initial\", \"otherwise\", \"rules\", \"rule\", \"removeRule\"];\n/** @hidden */ const syncFns = [\"deferIntercept\", \"listen\", \"sync\", \"match\"];\n\n/**\n * API for URL management\n */\nexport class UrlService implements LocationServices, UrlSyncApi {\n /** @hidden */\n static locationServiceStub: LocationServices = makeStub(locationServicesFns);\n /** @hidden */\n static locationConfigStub: LocationConfig = makeStub(locationConfigFns);\n\n /** @inheritdoc */\n url(): string;\n /** @inheritdoc */\n url(newurl: string, replace?: boolean, state?): void;\n url(newurl?, replace?, state?): any { return };\n /** @inheritdoc */\n path(): string { return };\n /** @inheritdoc */\n search(): { [key: string]: any } { return };\n /** @inheritdoc */\n hash(): string { return };\n /** @inheritdoc */\n onChange(callback: Function): Function { return };\n\n\n /**\n * Returns the current URL parts\n *\n * This method returns the current URL components as a [[UrlParts]] object.\n *\n * @returns the current url parts\n */\n parts(): UrlParts {\n return { path: this.path(), search: this.search(), hash: this.hash() }\n }\n\n dispose() { }\n\n /** @inheritdoc */\n sync(evt?) { return }\n /** @inheritdoc */\n listen(enabled?: boolean): Function { return };\n /** @inheritdoc */\n deferIntercept(defer?: boolean) { return }\n /** @inheritdoc */\n match(urlParts: UrlParts): MatchResult { return }\n\n /**\n * A nested API for managing URL rules and rewrites\n *\n * See: [[UrlRulesApi]] for details\n */\n rules: UrlRulesApi;\n\n /**\n * A nested API to configure the URL and retrieve URL information\n *\n * See: [[UrlConfigApi]] for details\n */\n config: UrlConfigApi;\n\n /** @hidden */\n private router: UIRouter;\n\n /** @hidden */\n constructor(router: UIRouter, lateBind = true) {\n this.router = router;\n this.rules = {} as any;\n this.config = {} as any;\n\n // proxy function calls from UrlService to the LocationService/LocationConfig\n const locationServices = () => router.locationService;\n createProxyFunctions(locationServices, this, locationServices, locationServicesFns, lateBind);\n\n const locationConfig = () => router.locationConfig;\n createProxyFunctions(locationConfig, this.config, locationConfig, locationConfigFns, lateBind);\n\n const umf = () => router.urlMatcherFactory;\n createProxyFunctions(umf, this.config, umf, umfFns);\n\n const urlRouter = () => router.urlRouter;\n createProxyFunctions(urlRouter, this.rules, urlRouter, rulesFns);\n createProxyFunctions(urlRouter, this, urlRouter, syncFns);\n }\n}\n", - "/**\n * @coreapi\n * @module core\n */ /** */\nimport { UrlMatcherFactory } from \"./url/urlMatcherFactory\";\nimport { UrlRouter } from \"./url/urlRouter\";\nimport { TransitionService } from \"./transition/transitionService\";\nimport { ViewService } from \"./view/view\";\nimport { StateRegistry } from \"./state/stateRegistry\";\nimport { StateService } from \"./state/stateService\";\nimport { UIRouterGlobals } from \"./globals\";\nimport { UIRouterPlugin, Disposable } from \"./interface\";\nimport { values, removeFrom } from \"./common/common\";\nimport { isFunction } from \"./common/predicates\";\nimport { UrlService } from \"./url/urlService\";\nimport { LocationServices, LocationConfig } from \"./common/coreservices\";\nimport { Trace, trace } from \"./common/trace\";\n\n/** @hidden */\nlet _routerInstance = 0;\n\n/**\n * The master class used to instantiate an instance of UI-Router.\n *\n * UI-Router (for each specific framework) will create an instance of this class during bootstrap.\n * This class instantiates and wires the UI-Router services together.\n *\n * After a new instance of the UIRouter class is created, it should be configured for your app.\n * For instance, app states should be registered with the [[UIRouter.stateRegistry]].\n *\n * ---\n *\n * Normally the framework code will bootstrap UI-Router.\n * If you are bootstrapping UIRouter manually, tell it to monitor the URL by calling\n * [[UrlService.listen]] then [[UrlService.sync]].\n */\nexport class UIRouter {\n /** @hidden */ $id = _routerInstance++;\n /** @hidden */ _disposed = false;\n /** @hidden */ private _disposables: Disposable[] = [];\n\n /** Provides trace information to the console */\n trace: Trace = trace;\n\n /** Provides services related to ui-view synchronization */\n viewService = new ViewService();\n\n /** Provides services related to Transitions */\n transitionService: TransitionService = new TransitionService(this);\n\n /** Global router state */\n globals: UIRouterGlobals = new UIRouterGlobals();\n\n /**\n * Deprecated for public use. Use [[urlService]] instead.\n * @deprecated Use [[urlService]] instead\n */\n urlMatcherFactory: UrlMatcherFactory = new UrlMatcherFactory();\n\n /**\n * Deprecated for public use. Use [[urlService]] instead.\n * @deprecated Use [[urlService]] instead\n */\n urlRouter: UrlRouter = new UrlRouter(this);\n\n /** Provides a registry for states, and related registration services */\n stateRegistry: StateRegistry = new StateRegistry(this);\n\n /** Provides services related to states */\n stateService = new StateService(this);\n\n /** Provides services related to the URL */\n urlService: UrlService = new UrlService(this);\n\n\n /** Registers an object to be notified when the router is disposed */\n disposable(disposable: Disposable) {\n this._disposables.push(disposable);\n }\n\n /**\n * Disposes this router instance\n *\n * When called, clears resources retained by the router by calling `dispose(this)` on all\n * registered [[disposable]] objects.\n *\n * Or, if a `disposable` object is provided, calls `dispose(this)` on that object only.\n *\n * @param disposable (optional) the disposable to dispose\n */\n dispose(disposable?: any): void {\n if (disposable && isFunction(disposable.dispose)) {\n disposable.dispose(this);\n return undefined;\n }\n\n this._disposed = true;\n this._disposables.slice().forEach(d => {\n try {\n typeof d.dispose === 'function' && d.dispose(this);\n removeFrom(this._disposables, d);\n } catch (ignored) {}\n });\n }\n\n /**\n * Creates a new `UIRouter` object\n *\n * @param locationService a [[LocationServices]] implementation\n * @param locationConfig a [[LocationConfig]] implementation\n * @internalapi\n */\n constructor(\n public locationService: LocationServices = UrlService.locationServiceStub,\n public locationConfig: LocationConfig = UrlService.locationConfigStub\n ) {\n\n this.viewService._pluginapi._rootViewContext(this.stateRegistry.root());\n this.globals.$current = this.stateRegistry.root();\n this.globals.current = this.globals.$current.self;\n\n this.disposable(this.globals);\n this.disposable(this.stateService);\n this.disposable(this.stateRegistry);\n this.disposable(this.transitionService);\n this.disposable(this.urlRouter);\n this.disposable(locationService);\n this.disposable(locationConfig);\n }\n\n /** @hidden */\n private _plugins: { [key: string]: UIRouterPlugin } = {};\n\n /** Add plugin (as ES6 class) */\n plugin(plugin: { new(router: UIRouter, options?: any): T }, options?: any): T;\n /** Add plugin (as javascript constructor function) */\n plugin(plugin: { (router: UIRouter, options?: any): void }, options?: any): T;\n /** Add plugin (as javascript factory function) */\n plugin(plugin: PluginFactory, options?: any): T;\n /**\n * Adds a plugin to UI-Router\n *\n * This method adds a UI-Router Plugin.\n * A plugin can enhance or change UI-Router behavior using any public API.\n *\n * #### Example:\n * ```js\n * import { MyCoolPlugin } from \"ui-router-cool-plugin\";\n *\n * var plugin = router.addPlugin(MyCoolPlugin);\n * ```\n *\n * ### Plugin authoring\n *\n * A plugin is simply a class (or constructor function) which accepts a [[UIRouter]] instance and (optionally) an options object.\n *\n * The plugin can implement its functionality using any of the public APIs of [[UIRouter]].\n * For example, it may configure router options or add a Transition Hook.\n *\n * The plugin can then be published as a separate module.\n *\n * #### Example:\n * ```js\n * export class MyAuthPlugin implements UIRouterPlugin {\n * constructor(router: UIRouter, options: any) {\n * this.name = \"MyAuthPlugin\";\n * let $transitions = router.transitionService;\n * let $state = router.stateService;\n *\n * let authCriteria = {\n * to: (state) => state.data && state.data.requiresAuth\n * };\n *\n * function authHook(transition: Transition) {\n * let authService = transition.injector().get('AuthService');\n * if (!authService.isAuthenticated()) {\n * return $state.target('login');\n * }\n * }\n *\n * $transitions.onStart(authCriteria, authHook);\n * }\n * }\n * ```\n *\n * @param plugin one of:\n * - a plugin class which implements [[UIRouterPlugin]]\n * - a constructor function for a [[UIRouterPlugin]] which accepts a [[UIRouter]] instance\n * - a factory function which accepts a [[UIRouter]] instance and returns a [[UIRouterPlugin]] instance\n * @param options options to pass to the plugin class/factory\n * @returns the registered plugin instance\n */\n plugin(plugin: any, options: any = {}): T {\n let pluginInstance = new plugin(this, options);\n if (!pluginInstance.name) throw new Error(\"Required property `name` missing on plugin: \" + pluginInstance);\n this._disposables.push(pluginInstance);\n return this._plugins[pluginInstance.name] = pluginInstance;\n }\n\n /**\n * Returns registered plugins\n *\n * Returns the registered plugin of the given `pluginName`.\n * If no `pluginName` is given, returns all registered plugins\n *\n * @param pluginName (optional) the name of the plugin to get\n * @return the named plugin (undefined if not found), or all plugins (if `pluginName` is omitted)\n */\n getPlugin(pluginName: string): UIRouterPlugin;\n getPlugin(): UIRouterPlugin[];\n getPlugin(pluginName?: string): UIRouterPlugin|UIRouterPlugin[] {\n return pluginName ? this._plugins[pluginName] : values(this._plugins);\n }\n}\n\n/** @internalapi */\nexport type PluginFactory = (router: UIRouter, options?: any) => T;\n", - "/** @module hooks */ /** */\nimport { Transition } from \"../transition/transition\";\nimport { UIRouter } from \"../router\";\nimport { TransitionService } from \"../transition/transitionService\";\n\nfunction addCoreResolvables(trans: Transition) {\n trans.addResolvable({ token: UIRouter, deps: [], resolveFn: () => trans.router, data: trans.router }, \"\");\n trans.addResolvable({ token: Transition, deps: [], resolveFn: () => trans, data: trans }, \"\");\n trans.addResolvable({ token: '$transition$', deps: [], resolveFn: () => trans, data: trans }, \"\");\n trans.addResolvable({ token: '$stateParams', deps: [], resolveFn: () => trans.params(), data: trans.params() }, \"\");\n\n trans.entering().forEach(state => {\n trans.addResolvable({ token: '$state$', deps: [], resolveFn: () => state, data: state }, state);\n });\n}\n\nexport const registerAddCoreResolvables = (transitionService: TransitionService) =>\n transitionService.onCreate({}, addCoreResolvables);\n", - "/** @module hooks */ /** */\nimport {isString, isFunction} from \"../common/predicates\"\nimport {Transition} from \"../transition/transition\";\nimport {services} from \"../common/coreservices\";\nimport {TargetState} from \"../state/targetState\";\nimport {TransitionService} from \"../transition/transitionService\";\nimport {TransitionHookFn} from \"../transition/interface\";\n\n/**\n * A [[TransitionHookFn]] that redirects to a different state or params\n *\n * Registered using `transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectHook);`\n * \n * See [[StateDeclaration.redirectTo]]\n */\nconst redirectToHook: TransitionHookFn = (trans: Transition) => {\n let redirect = trans.to().redirectTo;\n if (!redirect) return;\n\n let $state = trans.router.stateService;\n\n function handleResult(result: any) {\n if (!result) return;\n if (result instanceof TargetState) return result;\n if (isString(result)) return $state.target( result, trans.params(), trans.options());\n if (result['state'] || result['params'])\n return $state.target(result['state'] || trans.to(), result['params'] || trans.params(), trans.options());\n }\n\n if (isFunction(redirect)) {\n return services.$q.when(redirect(trans)).then(handleResult);\n }\n return handleResult(redirect);\n};\n\nexport const registerRedirectToHook = (transitionService: TransitionService) =>\n transitionService.onStart({to: (state) => !!state.redirectTo}, redirectToHook);\n", - "/** @module hooks */\n/** for typedoc */\nimport { TransitionStateHookFn } from '../transition/interface';\nimport { Transition } from '../transition/transition';\nimport { TransitionService } from '../transition/transitionService';\nimport { StateDeclaration } from '../state/interface';\nimport { StateObject } from '../state/stateObject';\n\n/**\n * A factory which creates an onEnter, onExit or onRetain transition hook function\n *\n * The returned function invokes the (for instance) state.onEnter hook when the\n * state is being entered.\n *\n * @hidden\n */\nfunction makeEnterExitRetainHook(hookName: string): TransitionStateHookFn {\n return (transition: Transition, state: StateDeclaration) => {\n let _state: StateObject = state.$$state();\n let hookFn: TransitionStateHookFn = _state[hookName];\n return hookFn(transition, state);\n }\n}\n\n/**\n * The [[TransitionStateHookFn]] for onExit\n *\n * When the state is being exited, the state's .onExit function is invoked.\n *\n * Registered using `transitionService.onExit({ exiting: (state) => !!state.onExit }, onExitHook);`\n *\n * See: [[IHookRegistry.onExit]]\n */\nconst onExitHook: TransitionStateHookFn = makeEnterExitRetainHook('onExit');\nexport const registerOnExitHook = (transitionService: TransitionService) =>\n transitionService.onExit({exiting: state => !!state.onExit}, onExitHook);\n\n/**\n * The [[TransitionStateHookFn]] for onRetain\n *\n * When the state was already entered, and is not being exited or re-entered, the state's .onRetain function is invoked.\n *\n * Registered using `transitionService.onRetain({ retained: (state) => !!state.onRetain }, onRetainHook);`\n *\n * See: [[IHookRegistry.onRetain]]\n */\nconst onRetainHook: TransitionStateHookFn = makeEnterExitRetainHook('onRetain');\nexport const registerOnRetainHook = (transitionService: TransitionService) =>\n transitionService.onRetain({retained: state => !!state.onRetain}, onRetainHook);\n\n/**\n * The [[TransitionStateHookFn]] for onEnter\n *\n * When the state is being entered, the state's .onEnter function is invoked.\n *\n * Registered using `transitionService.onEnter({ entering: (state) => !!state.onEnter }, onEnterHook);`\n *\n * See: [[IHookRegistry.onEnter]]\n */\nconst onEnterHook: TransitionStateHookFn = makeEnterExitRetainHook('onEnter');\nexport const registerOnEnterHook = (transitionService: TransitionService) =>\n transitionService.onEnter({entering: state => !!state.onEnter}, onEnterHook);\n\n", - "/** @module hooks */\n/** for typedoc */\nimport { noop } from '../common/common';\nimport { Transition } from '../transition/transition';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { TransitionStateHookFn, TransitionHookFn } from '../transition/interface';\nimport { TransitionService } from '../transition/transitionService';\nimport { val } from '../common/hof';\nimport { StateDeclaration } from '../state/interface';\n\nexport const RESOLVE_HOOK_PRIORITY = 1000;\n\n/**\n * A [[TransitionHookFn]] which resolves all EAGER Resolvables in the To Path\n *\n * Registered using `transitionService.onStart({}, eagerResolvePath, { priority: 1000 });`\n *\n * When a Transition starts, this hook resolves all the EAGER Resolvables, which the transition then waits for.\n *\n * See [[StateDeclaration.resolve]]\n */\nconst eagerResolvePath: TransitionHookFn = (trans: Transition) =>\n new ResolveContext(trans.treeChanges().to)\n .resolvePath(\"EAGER\", trans)\n .then(noop);\n\nexport const registerEagerResolvePath = (transitionService: TransitionService) =>\n transitionService.onStart({}, eagerResolvePath, {priority: RESOLVE_HOOK_PRIORITY});\n\n/**\n * A [[TransitionHookFn]] which resolves all LAZY Resolvables for the state (and all its ancestors) in the To Path\n *\n * Registered using `transitionService.onEnter({ entering: () => true }, lazyResolveState, { priority: 1000 });`\n *\n * When a State is being entered, this hook resolves all the Resolvables for this state, which the transition then waits for.\n *\n * See [[StateDeclaration.resolve]]\n */\nconst lazyResolveState: TransitionStateHookFn = (trans: Transition, state: StateDeclaration) =>\n new ResolveContext(trans.treeChanges().to)\n .subContext(state.$$state())\n .resolvePath(\"LAZY\", trans)\n .then(noop);\n\nexport const registerLazyResolveState = (transitionService: TransitionService) =>\n transitionService.onEnter({ entering: val(true) }, lazyResolveState, {priority: RESOLVE_HOOK_PRIORITY});\n\n\n/**\n * A [[TransitionHookFn]] which resolves any dynamically added (LAZY or EAGER) Resolvables.\n *\n * Registered using `transitionService.onFinish({}, eagerResolvePath, { priority: 1000 });`\n *\n * After all entering states have been entered, this hook resolves any remaining Resolvables.\n * These are typically dynamic resolves which were added by some Transition Hook using [[Transition.addResolvable]].\n *\n * See [[StateDeclaration.resolve]]\n */\nconst resolveRemaining: TransitionHookFn = (trans: Transition) =>\n new ResolveContext(trans.treeChanges().to)\n .resolvePath(\"LAZY\", trans)\n .then(noop);\n\nexport const registerResolveRemaining = (transitionService: TransitionService) =>\n transitionService.onFinish({}, resolveRemaining, {priority: RESOLVE_HOOK_PRIORITY});\n", - "/** @module hooks */ /** for typedoc */\nimport {noop} from \"../common/common\";\nimport {services} from \"../common/coreservices\";\nimport {Transition} from \"../transition/transition\";\nimport {ViewService} from \"../view/view\";\nimport {ViewConfig} from \"../view/interface\";\nimport {TransitionHookFn} from \"../transition/interface\";\nimport {TransitionService} from \"../transition/transitionService\";\n\n\n/**\n * A [[TransitionHookFn]] which waits for the views to load\n *\n * Registered using `transitionService.onStart({}, loadEnteringViews);`\n *\n * Allows the views to do async work in [[ViewConfig.load]] before the transition continues.\n * In angular 1, this includes loading the templates.\n */\nconst loadEnteringViews: TransitionHookFn = (transition: Transition) => {\n let $q = services.$q;\n let enteringViews = transition.views(\"entering\");\n if (!enteringViews.length) return;\n return $q.all(enteringViews.map(view => $q.when(view.load()))).then(noop);\n};\n\nexport const registerLoadEnteringViews = (transitionService: TransitionService) =>\n transitionService.onFinish({}, loadEnteringViews);\n\n/**\n * A [[TransitionHookFn]] which activates the new views when a transition is successful.\n *\n * Registered using `transitionService.onSuccess({}, activateViews);`\n *\n * After a transition is complete, this hook deactivates the old views from the previous state,\n * and activates the new views from the destination state.\n *\n * See [[ViewService]]\n */\nconst activateViews: TransitionHookFn = (transition: Transition) => {\n let enteringViews = transition.views(\"entering\");\n let exitingViews = transition.views(\"exiting\");\n if (!enteringViews.length && !exitingViews.length) return;\n\n let $view: ViewService = transition.router.viewService;\n\n exitingViews.forEach((vc: ViewConfig) => $view.deactivateViewConfig(vc));\n enteringViews.forEach((vc: ViewConfig) => $view.activateViewConfig(vc));\n\n $view.sync();\n};\n\nexport const registerActivateViews = (transitionService: TransitionService) =>\n transitionService.onSuccess({}, activateViews);\n", - "/** @module hooks */\n/** for typedoc */\nimport { Transition } from '../transition/transition';\nimport { copy } from '../common/common';\nimport { TransitionService } from '../transition/transitionService';\n\n/**\n * A [[TransitionHookFn]] which updates global UI-Router state\n *\n * Registered using `transitionService.onBefore({}, updateGlobalState);`\n *\n * Before a [[Transition]] starts, updates the global value of \"the current transition\" ([[Globals.transition]]).\n * After a successful [[Transition]], updates the global values of \"the current state\"\n * ([[Globals.current]] and [[Globals.$current]]) and \"the current param values\" ([[Globals.params]]).\n *\n * See also the deprecated properties:\n * [[StateService.transition]], [[StateService.current]], [[StateService.params]]\n */\nconst updateGlobalState = (trans: Transition) => {\n let globals = trans.router.globals;\n\n const transitionSuccessful = () => {\n globals.successfulTransitions.enqueue(trans);\n globals.$current = trans.$to();\n globals.current = globals.$current.self;\n\n copy(trans.params(), globals.params);\n };\n\n const clearCurrentTransition = () => {\n // Do not clear globals.transition if a different transition has started in the meantime\n if (globals.transition === trans) globals.transition = null;\n };\n\n trans.onSuccess({}, transitionSuccessful, { priority: 10000 });\n trans.promise.then(clearCurrentTransition, clearCurrentTransition);\n};\n\nexport const registerUpdateGlobalState = (transitionService: TransitionService) =>\n transitionService.onCreate({}, updateGlobalState);\n", - "/** @module hooks */ /** */\nimport {UrlRouter} from \"../url/urlRouter\";\nimport {StateService} from \"../state/stateService\";\nimport {Transition} from \"../transition/transition\";\nimport {TransitionHookFn} from \"../transition/interface\";\nimport {TransitionService} from \"../transition/transitionService\";\n\n/** \n * A [[TransitionHookFn]] which updates the URL after a successful transition\n * \n * Registered using `transitionService.onSuccess({}, updateUrl);`\n */\nconst updateUrl: TransitionHookFn = (transition: Transition) => {\n let options = transition.options();\n let $state: StateService = transition.router.stateService;\n let $urlRouter: UrlRouter = transition.router.urlRouter;\n\n // Dont update the url in these situations:\n // The transition was triggered by a URL sync (options.source === 'url')\n // The user doesn't want the url to update (options.location === false)\n // The destination state, and all parents have no navigable url\n if (options.source !== 'url' && options.location && $state.$current.navigable) {\n var urlOptions = {replace: options.location === 'replace'};\n $urlRouter.push($state.$current.navigable.url, $state.params, urlOptions);\n }\n\n $urlRouter.update(true);\n};\n\nexport const registerUpdateUrl = (transitionService: TransitionService) =>\n transitionService.onSuccess({}, updateUrl, {priority: 9999});\n", - "/** @module hooks */ /** */\nimport {Transition} from \"../transition/transition\";\nimport {TransitionService} from \"../transition/transitionService\";\nimport {TransitionHookFn} from \"../transition/interface\";\nimport {StateDeclaration, LazyLoadResult} from \"../state/interface\";\nimport {services} from \"../common/coreservices\";\nimport { StateRule } from \"../url/interface\";\n\n/**\n * A [[TransitionHookFn]] that performs lazy loading\n *\n * When entering a state \"abc\" which has a `lazyLoad` function defined:\n * - Invoke the `lazyLoad` function (unless it is already in process)\n * - Flag the hook function as \"in process\"\n * - The function should return a promise (that resolves when lazy loading is complete)\n * - Wait for the promise to settle\n * - If the promise resolves to a [[LazyLoadResult]], then register those states\n * - Flag the hook function as \"not in process\"\n * - If the hook was successful\n * - Remove the `lazyLoad` function from the state declaration\n * - If all the hooks were successful\n * - Retry the transition (by returning a TargetState)\n *\n * ```\n * .state('abc', {\n * component: 'fooComponent',\n * lazyLoad: () => System.import('./fooComponent')\n * });\n * ```\n *\n * See [[StateDeclaration.lazyLoad]]\n */\nconst lazyLoadHook: TransitionHookFn = (transition: Transition) => {\n let router = transition.router;\n\n function retryTransition() {\n if (transition.originalTransition().options().source !== 'url') {\n // The original transition was not triggered via url sync\n // The lazy state should be loaded now, so re-try the original transition\n let orig = transition.targetState();\n return router.stateService.target(orig.identifier(), orig.params(), orig.options());\n }\n\n // The original transition was triggered via url sync\n // Run the URL rules and find the best match\n let $url = router.urlService;\n let result = $url.match($url.parts());\n let rule = result && result.rule;\n\n // If the best match is a state, redirect the transition (instead\n // of calling sync() which supersedes the current transition)\n if (rule && rule.type === \"STATE\") {\n let state = (rule as StateRule).state;\n let params = result.match;\n return router.stateService.target(state, params, transition.options());\n }\n\n // No matching state found, so let .sync() choose the best non-state match/otherwise\n router.urlService.sync();\n }\n\n let promises = transition.entering()\n .filter(state => !!state.$$state().lazyLoad)\n .map(state => lazyLoadState(transition, state));\n\n return services.$q.all(promises).then(retryTransition);\n};\n\nexport const registerLazyLoadHook = (transitionService: TransitionService) =>\n transitionService.onBefore({ entering: (state) => !!state.lazyLoad }, lazyLoadHook);\n\n\n/**\n * Invokes a state's lazy load function\n *\n * @param transition a Transition context\n * @param state the state to lazy load\n * @returns A promise for the lazy load result\n */\nexport function lazyLoadState(transition: Transition, state: StateDeclaration): Promise {\n let lazyLoadFn = state.$$state().lazyLoad;\n\n // Store/get the lazy load promise on/from the hookfn so it doesn't get re-invoked\n let promise = lazyLoadFn['_promise'];\n if (!promise) {\n const success = (result) => {\n delete state.lazyLoad;\n delete state.$$state().lazyLoad;\n delete lazyLoadFn['_promise'];\n return result;\n };\n\n const error = (err) => {\n delete lazyLoadFn['_promise'];\n return services.$q.reject(err);\n };\n\n promise = lazyLoadFn['_promise'] =\n services.$q.when(lazyLoadFn(transition, state))\n .then(updateStateRegistry)\n .then(success, error);\n }\n\n /** Register any lazy loaded state definitions */\n function updateStateRegistry(result: LazyLoadResult) {\n if (result && Array.isArray(result.states)) {\n result.states.forEach(state => transition.router.stateRegistry.register(state));\n }\n return result;\n }\n\n return promise;\n}\n", - "/** @module transition */ /** */\nimport { TransitionHookPhase, PathType } from \"./interface\";\nimport { GetErrorHandler, GetResultHandler, TransitionHook } from \"./transitionHook\";\n/**\n * This class defines a type of hook, such as `onBefore` or `onEnter`.\n * Plugins can define custom hook types, such as sticky states does for `onInactive`.\n *\n * @interalapi\n */\nexport class TransitionEventType {\n\n constructor(public name: string,\n public hookPhase: TransitionHookPhase,\n public hookOrder: number,\n public criteriaMatchPath: PathType,\n public reverseSort: boolean = false,\n public getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,\n public getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,\n public synchronous: boolean = false,\n ) { }\n}\n", + "/**\n * @hidden\n * @module ng1\n */ /** */\ndeclare var angular;\nimport * as ng_from_import from 'angular';\nconst ng_from_global = angular;\n\nexport const ng = (ng_from_import && ng_from_import.module) ? ng_from_import : ng_from_global;\n", + "/**\n * Higher order functions\n *\n * These utility functions are exported, but are subject to change without notice.\n *\n * @module common_hof\n */ /** */\n\nimport { Predicate } from './common';\n/**\n * Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function.\n *\n * Given a function with N parameters, returns a new function that supports partial application.\n * The new function accepts anywhere from 1 to N parameters. When that function is called with M parameters,\n * where M is less than N, it returns a new function that accepts the remaining parameters. It continues to\n * accept more parameters until all N parameters have been supplied.\n *\n *\n * This contrived example uses a partially applied function as an predicate, which returns true\n * if an object is found in both arrays.\n * @example\n * ```\n * // returns true if an object is in both of the two arrays\n * function inBoth(array1, array2, object) {\n * return array1.indexOf(object) !== -1 &&\n * array2.indexOf(object) !== 1;\n * }\n * let obj1, obj2, obj3, obj4, obj5, obj6, obj7\n * let foos = [obj1, obj3]\n * let bars = [obj3, obj4, obj5]\n *\n * // A curried \"copy\" of inBoth\n * let curriedInBoth = curry(inBoth);\n * // Partially apply both the array1 and array2\n * let inFoosAndBars = curriedInBoth(foos, bars);\n *\n * // Supply the final argument; since all arguments are\n * // supplied, the original inBoth function is then called.\n * let obj1InBoth = inFoosAndBars(obj1); // false\n *\n * // Use the inFoosAndBars as a predicate.\n * // Filter, on each iteration, supplies the final argument\n * let allObjs = [ obj1, obj2, obj3, obj4, obj5, obj6, obj7 ];\n * let foundInBoth = allObjs.filter(inFoosAndBars); // [ obj3 ]\n *\n * ```\n *\n * Stolen from: http://stackoverflow.com/questions/4394747/javascript-curry-function\n *\n * @param fn\n * @returns {*|function(): (*|any)}\n */\nexport function curry(fn: Function): Function {\n const initial_args = [].slice.apply(arguments, [1]);\n const func_args_length = fn.length;\n\n function curried(args: any[]) {\n if (args.length >= func_args_length)\n return fn.apply(null, args);\n return function () {\n return curried(args.concat([].slice.apply(arguments)));\n };\n }\n return curried(initial_args);\n}\n\n\n\n/**\n * Given a varargs list of functions, returns a function that composes the argument functions, right-to-left\n * given: f(x), g(x), h(x)\n * let composed = compose(f,g,h)\n * then, composed is: f(g(h(x)))\n */\nexport function compose() {\n const args = arguments;\n const start = args.length - 1;\n return function() {\n let i = start, result = args[start].apply(this, arguments);\n while (i--) result = args[i].call(this, result);\n return result;\n };\n}\n\n/**\n * Given a varargs list of functions, returns a function that is composes the argument functions, left-to-right\n * given: f(x), g(x), h(x)\n * let piped = pipe(f,g,h);\n * then, piped is: h(g(f(x)))\n */\nexport function pipe(...funcs: Function[]): (obj: any) => any {\n return compose.apply(null, [].slice.call(arguments).reverse());\n}\n\n/**\n * Given a property name, returns a function that returns that property from an object\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = prop(\"name\");\n * getName(obj) === \"blarg\"\n */\nexport const prop = (name: string) =>\n (obj: any) => obj && obj[name];\n\n/**\n * Given a property name and a value, returns a function that returns a boolean based on whether\n * the passed object has a property that matches the value\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = propEq(\"name\", \"blarg\");\n * getName(obj) === true\n */\nexport const propEq = curry((name: string, _val: any, obj: any) => obj && obj[name] === _val);\n\n/**\n * Given a dotted property name, returns a function that returns a nested property from an object, or undefined\n * let obj = { id: 1, nestedObj: { foo: 1, name: \"blarg\" }, };\n * let getName = prop(\"nestedObj.name\");\n * getName(obj) === \"blarg\"\n * let propNotFound = prop(\"this.property.doesnt.exist\");\n * propNotFound(obj) === undefined\n */\nexport const parse = (name: string) =>\n pipe.apply(null, name.split('.').map(prop));\n\n/**\n * Given a function that returns a truthy or falsey value, returns a\n * function that returns the opposite (falsey or truthy) value given the same inputs\n */\nexport const not: (fn: Predicate) => Predicate = (fn: Predicate) =>\n (...args: any[]) => !fn.apply(null, args);\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if both functions return truthy for the given arguments\n */\nexport function and(fn1: Predicate, fn2: Predicate): Predicate {\n return (...args: any[]) => fn1.apply(null, args) && fn2.apply(null, args);\n}\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if at least one of the functions returns truthy for the given arguments\n */\nexport function or(fn1: Predicate, fn2: Predicate): Predicate {\n return (...args: any[]) => fn1.apply(null, args) || fn2.apply(null, args);\n}\n\n/**\n * Check if all the elements of an array match a predicate function\n *\n * @param fn1 a predicate function `fn1`\n * @returns a function which takes an array and returns true if `fn1` is true for all elements of the array\n */\nexport const all = (fn1: Predicate) =>\n (arr: any[]) => arr.reduce((b, x) => b && !!fn1(x), true) as boolean;\n\n// tslint:disable-next-line:variable-name\nexport const any = (fn1: Predicate) =>\n (arr: any[]) => arr.reduce((b, x) => b || !!fn1(x), false) as boolean;\n\n/** Given a class, returns a Predicate function that returns true if the object is of that class */\nexport const is = (ctor: { new(...args): T }) =>\n (obj: any): obj is T =>\n (obj != null && obj.constructor === ctor || obj instanceof ctor);\n\n/** Given a value, returns a Predicate function that returns true if another value is === equal to the original value */\nexport const eq: (comp: any) => Predicate = (value: any) => (other: any) =>\n value === other;\n\n/** Given a value, returns a function which returns the value */\nexport const val = (v: T) => () => v;\n\n\n\nexport function invoke(fnName: string): Function;\nexport function invoke(fnName: string, args: any[]): Function;\nexport function invoke(fnName: string, args?: any[]): Function {\n return (obj: any) =>\n obj[fnName].apply(obj, args);\n}\n\n/**\n * Sorta like Pattern Matching (a functional programming conditional construct)\n *\n * See http://c2.com/cgi/wiki?PatternMatching\n *\n * This is a conditional construct which allows a series of predicates and output functions\n * to be checked and then applied. Each predicate receives the input. If the predicate\n * returns truthy, then its matching output function (mapping function) is provided with\n * the input and, then the result is returned.\n *\n * Each combination (2-tuple) of predicate + output function should be placed in an array\n * of size 2: [ predicate, mapFn ]\n *\n * These 2-tuples should be put in an outer array.\n *\n * @example\n * ```\n *\n * // Here's a 2-tuple where the first element is the isString predicate\n * // and the second element is a function that returns a description of the input\n * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];\n *\n * // Second tuple: predicate \"isNumber\", mapfn returns a description\n * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];\n *\n * let third = [ (input) => input === null, (input) => `Oh, null...` ];\n *\n * let fourth = [ (input) => input === undefined, (input) => `notdefined` ];\n *\n * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);\n *\n * console.log(descriptionOf(undefined)); // 'notdefined'\n * console.log(descriptionOf(55)); // '(55) That's a number!'\n * console.log(descriptionOf(\"foo\")); // 'Here's your string foo'\n * ```\n *\n * @param struct A 2D array. Each element of the array should be an array, a 2-tuple,\n * with a Predicate and a mapping/output function\n * @returns {function(any): *}\n */\nexport function pattern(struct: Function[][]): Function {\n return function(x: any) {\n for (let i = 0; i < struct.length; i++) {\n if (struct[i][0](x)) return struct[i][1](x);\n }\n };\n}\n\n", + "/**\n * @coreapi\n * @module core\n */\n/**\n * Matches state names using glob-like pattern strings.\n *\n * Globs can be used in specific APIs including:\n *\n * - [[StateService.is]]\n * - [[StateService.includes]]\n * - The first argument to Hook Registration functions like [[TransitionService.onStart]]\n * - [[HookMatchCriteria]] and [[HookMatchCriterion]]\n *\n * A `Glob` string is a pattern which matches state names.\n * Nested state names are split into segments (separated by a dot) when processing.\n * The state named `foo.bar.baz` is split into three segments ['foo', 'bar', 'baz']\n *\n * Globs work according to the following rules:\n *\n * ### Exact match:\n *\n * The glob `'A.B'` matches the state named exactly `'A.B'`.\n *\n * | Glob |Matches states named|Does not match state named|\n * |:------------|:--------------------|:---------------------|\n * | `'A'` | `'A'` | `'B'` , `'A.C'` |\n * | `'A.B'` | `'A.B'` | `'A'` , `'A.B.C'` |\n * | `'foo'` | `'foo'` | `'FOO'` , `'foo.bar'`|\n *\n * ### Single star (`*`)\n *\n * A single star (`*`) is a wildcard that matches exactly one segment.\n *\n * | Glob |Matches states named |Does not match state named |\n * |:------------|:---------------------|:--------------------------|\n * | `'*'` | `'A'` , `'Z'` | `'A.B'` , `'Z.Y.X'` |\n * | `'A.*'` | `'A.B'` , `'A.C'` | `'A'` , `'A.B.C'` |\n * | `'A.*.*'` | `'A.B.C'` , `'A.X.Y'`| `'A'`, `'A.B'` , `'Z.Y.X'`|\n *\n * ### Double star (`**`)\n *\n * A double star (`'**'`) is a wildcard that matches *zero or more segments*\n *\n * | Glob |Matches states named |Does not match state named |\n * |:------------|:----------------------------------------------|:----------------------------------|\n * | `'**'` | `'A'` , `'A.B'`, `'Z.Y.X'` | (matches all states) |\n * | `'A.**'` | `'A'` , `'A.B'` , `'A.C.X'` | `'Z.Y.X'` |\n * | `'**.X'` | `'X'` , `'A.X'` , `'Z.Y.X'` | `'A'` , `'A.login.Z'` |\n * | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` |\n *\n */\nexport class Glob {\n text: string;\n glob: Array;\n regexp: RegExp;\n\n /** Returns true if the string has glob-like characters in it */\n static is(text: string) {\n return !!/[!,*]+/.exec(text);\n }\n\n /** Returns a glob from the string, or null if the string isn't Glob-like */\n static fromString(text: string) {\n return Glob.is(text) ? new Glob(text) : null;\n }\n\n constructor(text: string) {\n this.text = text;\n this.glob = text.split('.');\n\n const regexpString = this.text.split('.')\n .map(seg => {\n if (seg === '**') return '(?:|(?:\\\\.[^.]*)*)';\n if (seg === '*') return '\\\\.[^.]*';\n return '\\\\.' + seg;\n }).join('');\n\n this.regexp = new RegExp('^' + regexpString + '$');\n }\n\n matches(name: string) {\n return this.regexp.test('.' + name);\n }\n}\n", + "/**\n * @coreapi\n * @module state\n */\n/** for typedoc */\nimport { StateDeclaration, _ViewDeclaration, _StateDeclaration, LazyLoadResult } from './interface';\nimport { defaults, values, find, inherit } from '../common/common';\nimport { propEq } from '../common/hof';\nimport { Param } from '../params/param';\nimport { UrlMatcher } from '../url/urlMatcher';\nimport { Resolvable } from '../resolve/resolvable';\nimport { TransitionStateHookFn } from '../transition/interface';\nimport { TargetState } from './targetState';\nimport { Transition } from '../transition/transition';\nimport { Glob } from '../common/glob';\nimport { isObject, isFunction } from '../common/predicates';\n\n/**\n * Internal representation of a UI-Router state.\n *\n * Instances of this class are created when a [[StateDeclaration]] is registered with the [[StateRegistry]].\n *\n * A registered [[StateDeclaration]] is augmented with a getter ([[StateDeclaration.$$state]]) which returns the corresponding [[StateObject]] object.\n *\n * This class prototypally inherits from the corresponding [[StateDeclaration]].\n * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]].\n */\nexport class StateObject {\n /** The parent [[StateObject]] */\n public parent: StateObject;\n\n /** The name used to register the state */\n public name: string;\n\n /** Prototypally inherits from [[StateDeclaration.abstract]] */\n public abstract: boolean;\n\n /** Prototypally inherits from [[StateDeclaration.resolve]] */\n public resolve: ({ [key: string]: (string|any[]|Function) }|any[]);\n\n /** A list of [[Resolvable]] objects. The internal representation of [[resolve]]. */\n public resolvables: Resolvable[];\n\n /** Prototypally inherits from [[StateDeclaration.resolvePolicy]] */\n public resolvePolicy: any;\n\n /** A compiled URLMatcher which detects when the state's URL is matched */\n public url: UrlMatcher;\n\n /** The parameters for the state, built from the URL and [[StateDeclaration.params]] */\n public params: { [key: string]: Param };\n\n /**\n * The views for the state.\n * Note: `@uirouter/core` does not register a builder for views.\n * The framework specific code should register a `views` builder.\n */\n public views: { [key: string]: _ViewDeclaration; };\n\n /**\n * The original [[StateDeclaration]] used to build this [[StateObject]].\n * Note: `this` object also prototypally inherits from the `self` declaration object.\n */\n public self: StateDeclaration;\n\n /** The nearest parent [[StateObject]] which has a URL */\n public navigable: StateObject;\n\n /** The parent [[StateObject]] objects from this state up to the root */\n public path: StateObject[];\n\n /**\n * Prototypally inherits from [[StateDeclaration.data]]\n * Note: This is the only field on the [[StateDeclaration]] which is mutated.\n * The definition object's `data` field is replaced with a new object\n * which prototypally inherits from the parent state definition's `data` field.\n */\n public data: any;\n\n /**\n * An object containing the parent States' names as keys and\n * true as their values.\n */\n public includes: { [name: string]: boolean };\n\n /** Prototypally inherits from [[StateDeclaration.onExit]] */\n public onExit: TransitionStateHookFn;\n /** Prototypally inherits from [[StateDeclaration.onRetain]] */\n public onRetain: TransitionStateHookFn;\n /** Prototypally inherits from [[StateDeclaration.onEnter]] */\n public onEnter: TransitionStateHookFn;\n\n /** Prototypally inherits from [[StateDeclaration.lazyLoad]] */\n public lazyLoad: (transition: Transition, state: StateDeclaration) => Promise;\n\n /** Prototypally inherits from [[StateDeclaration.redirectTo]] */\n redirectTo: (\n string |\n (($transition$: Transition) => TargetState) |\n { state: (string|StateDeclaration), params: { [key: string]: any }}\n );\n\n /** @hidden */\n __stateObjectCache: {\n /** Might be null */\n nameGlob?: Glob,\n };\n\n /**\n * Create a state object to put the private/internal implementation details onto.\n * The object's prototype chain looks like:\n * (Internal State Object) -> (Copy of State.prototype) -> (State Declaration object) -> (State Declaration's prototype...)\n *\n * @param stateDecl the user-supplied State Declaration\n * @returns {StateObject} an internal State object\n */\n static create(stateDecl: _StateDeclaration): StateObject {\n stateDecl = StateObject.isStateClass(stateDecl) ? new stateDecl() : stateDecl;\n\n const state = inherit(inherit(stateDecl, StateObject.prototype)) as StateObject;\n stateDecl.$$state = () => state;\n state.self = stateDecl;\n state.__stateObjectCache = {\n nameGlob: Glob.fromString(state.name), // might return null\n };\n return state;\n }\n\n /** Predicate which returns true if the object is an class with @State() decorator */\n static isStateClass = (stateDecl: _StateDeclaration): stateDecl is ({ new (): StateDeclaration }) =>\n isFunction(stateDecl) && stateDecl['__uiRouterState'] === true;\n\n /** Predicate which returns true if the object is an internal [[StateObject]] object */\n static isState = (obj: any): obj is StateObject =>\n isObject(obj['__stateObjectCache']);\n\n\n /** @deprecated use State.create() */\n constructor(config?: StateDeclaration) {\n return StateObject.create(config || {});\n }\n\n /**\n * Returns true if the provided parameter is the same state.\n *\n * Compares the identity of the state against the passed value, which is either an object\n * reference to the actual `State` instance, the original definition object passed to\n * `$stateProvider.state()`, or the fully-qualified name.\n *\n * @param ref Can be one of (a) a `State` instance, (b) an object that was passed\n * into `$stateProvider.state()`, (c) the fully-qualified name of a state as a string.\n * @returns Returns `true` if `ref` matches the current `State` instance.\n */\n is(ref: StateObject|StateDeclaration|string): boolean {\n return this === ref || this.self === ref || this.fqn() === ref;\n }\n\n /**\n * @deprecated this does not properly handle dot notation\n * @returns Returns a dot-separated name of the state.\n */\n fqn(): string {\n if (!this.parent || !(this.parent instanceof this.constructor)) return this.name;\n const name = this.parent.fqn();\n return name ? name + '.' + this.name : this.name;\n }\n\n /**\n * Returns the root node of this state's tree.\n *\n * @returns The root of this state's tree.\n */\n root(): StateObject {\n return this.parent && this.parent.root() || this;\n }\n\n /**\n * Gets the state's `Param` objects\n *\n * Gets the list of [[Param]] objects owned by the state.\n * If `opts.inherit` is true, it also includes the ancestor states' [[Param]] objects.\n * If `opts.matchingKeys` exists, returns only `Param`s whose `id` is a key on the `matchingKeys` object\n *\n * @param opts options\n */\n parameters(opts?: { inherit?: boolean, matchingKeys?: any }): Param[] {\n opts = defaults(opts, { inherit: true, matchingKeys: null });\n const inherited = opts.inherit && this.parent && this.parent.parameters() || [];\n return inherited.concat(values(this.params))\n .filter(param => !opts.matchingKeys || opts.matchingKeys.hasOwnProperty(param.id));\n }\n\n /**\n * Returns a single [[Param]] that is owned by the state\n *\n * If `opts.inherit` is true, it also searches the ancestor states` [[Param]]s.\n * @param id the name of the [[Param]] to return\n * @param opts options\n */\n parameter(id: string, opts: { inherit?: boolean } = {}): Param {\n return (\n this.url && this.url.parameter(id, opts) ||\n find(values(this.params), propEq('id', id)) ||\n opts.inherit && this.parent && this.parent.parameter(id)\n );\n }\n\n toString() {\n return this.fqn();\n }\n}\n", + "/** Predicates\n *\n * These predicates return true/false based on the input.\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_predicates\n */\n/** */\nimport { and, not, pipe, prop, or } from './hof';\nimport { Predicate } from './common'; // has or is using\nimport { StateObject } from '../state/stateObject';\n\nconst toStr = Object.prototype.toString;\nconst tis = (t: string) => (x: any) => typeof(x) === t;\nexport const isUndefined = tis('undefined');\nexport const isDefined = not(isUndefined);\nexport const isNull = (o: any) => o === null;\nexport const isNullOrUndefined = or(isNull, isUndefined);\nexport const isFunction: (x: any) => x is Function = tis('function');\nexport const isNumber: (x: any) => x is number = tis('number');\nexport const isString = <(x: any) => x is string> tis('string');\nexport const isObject = (x: any) => x !== null && typeof x === 'object';\nexport const isArray = Array.isArray;\nexport const isDate: (x: any) => x is Date = ((x: any) => toStr.call(x) === '[object Date]');\nexport const isRegExp: (x: any) => x is RegExp = ((x: any) => toStr.call(x) === '[object RegExp]');\nexport const isState: (x: any) => x is StateObject = StateObject.isState;\n\n/**\n * Predicate which checks if a value is injectable\n *\n * A value is \"injectable\" if it is a function, or if it is an ng1 array-notation-style array\n * where all the elements in the array are Strings, except the last one, which is a Function\n */\nexport function isInjectable(val: any) {\n if (isArray(val) && val.length) {\n const head = val.slice(0, -1), tail = val.slice(-1);\n return !(head.filter(not(isString)).length || tail.filter(not(isFunction)).length);\n }\n return isFunction(val);\n}\n\n/**\n * Predicate which checks if a value looks like a Promise\n *\n * It is probably a Promise if it's an object, and it has a `then` property which is a Function\n */\nexport const isPromise = <(x: any) => x is Promise> and(isObject, pipe(prop('then'), isFunction));\n\n", + "/**\n * This module is a stub for core services such as Dependency Injection or Browser Location.\n * Core services may be implemented by a specific framework, such as ng1 or ng2, or be pure javascript.\n *\n * @module common\n */\n/** for typedoc */\nimport { IInjectable, Obj } from './common';\nimport { Disposable } from '../interface';\nimport { UrlParts } from '../url/interface';\n\nexport let notImplemented = (fnname: string) => () => {\n throw new Error(`${fnname}(): No coreservices implementation for UI-Router is loaded.`);\n};\n\nconst services: CoreServices = {\n $q: undefined,\n $injector: undefined,\n};\n\nexport interface $QLikeDeferred {\n resolve: (val?: any) => void;\n reject: (reason?: any) => void;\n promise: Promise;\n}\n\nexport interface $QLike {\n when(value?: T | PromiseLike): Promise;\n reject(reason: any): Promise;\n defer(): $QLikeDeferred;\n all(promises: { [key: string]: Promise }): Promise;\n all(promises: Promise[]): Promise;\n}\n\nexport interface $InjectorLike {\n strictDi?: boolean;\n get(token: any): any;\n get(token: any): T;\n has(token: any): boolean;\n invoke(fn: IInjectable, context?: any, locals?: Obj): any;\n annotate(fn: IInjectable, strictDi?: boolean): any[];\n}\n\nexport interface CoreServices {\n $q: $QLike;\n $injector: $InjectorLike;\n}\n\nexport interface LocationServices extends Disposable {\n /**\n * Gets the current url string\n *\n * The URL is normalized using the internal [[path]]/[[search]]/[[hash]] values.\n *\n * For example, the URL may be stored in the hash ([[HashLocationServices]]) or\n * have a base HREF prepended ([[PushStateLocationServices]]).\n *\n * The raw URL in the browser might be:\n *\n * ```\n * http://mysite.com/somepath/index.html#/internal/path/123?param1=foo#anchor\n * ```\n *\n * or\n *\n * ```\n * http://mysite.com/basepath/internal/path/123?param1=foo#anchor\n * ```\n *\n * then this method returns:\n *\n * ```\n * /internal/path/123?param1=foo#anchor\n * ```\n *\n *\n * #### Example:\n * ```js\n * locationServices.url(); // \"/some/path?query=value#anchor\"\n * ```\n *\n * @returns the current value of the url, as a string.\n */\n url(): string;\n\n /**\n * Updates the url, or gets the current url\n *\n * Updates the url, changing it to the value in `newurl`\n *\n * #### Example:\n * ```js\n * locationServices.url(\"/some/path?query=value#anchor\", true);\n * ```\n *\n * @param newurl The new value for the URL.\n * This url should reflect only the new internal [[path]], [[search]], and [[hash]] values.\n * It should not include the protocol, site, port, or base path of an absolute HREF.\n * @param replace When true, replaces the current history entry (instead of appending it) with this new url\n * @param state The history's state object, i.e., pushState (if the LocationServices implementation supports it)\n * @return the url (after potentially being processed)\n */\n url(newurl: string, replace?: boolean, state?: any): string;\n\n /**\n * Gets the path part of the current url\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`\n *\n * @return the path portion of the url\n */\n path(): string;\n\n /**\n * Gets the search part of the current url as an object\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`\n *\n * @return the search (querystring) portion of the url, as an object\n */\n search(): { [key: string]: any };\n\n /**\n * Gets the hash part of the current url\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `anchor`\n *\n * @return the hash (anchor) portion of the url\n */\n hash(): string;\n\n /**\n * Registers a url change handler\n *\n * #### Example:\n * ```js\n * let deregisterFn = locationServices.onChange((evt) => console.log(\"url change\", evt));\n * ```\n *\n * @param callback a function that will be called when the url is changing\n * @return a function that de-registers the callback\n */\n onChange(callback: Function): Function;\n}\n\n/**\n * This service returns the location configuration\n *\n * This service returns information about the location configuration.\n * This service is primarily used when building URLs (e.g., for `hrefs`)\n */\nexport interface LocationConfig extends Disposable {\n /**\n * Gets the port, e.g., `80`\n *\n * @return the port number\n */\n port(): number;\n /**\n * Gets the protocol, e.g., `http`\n *\n * @return the protocol\n */\n protocol(): string;\n /**\n * Gets the host, e.g., `localhost`\n *\n * @return the protocol\n */\n host(): string;\n /**\n * Gets the base Href, e.g., `http://localhost/approot/`\n *\n * @return the application's base href\n */\n baseHref(): string;\n /**\n * Returns true when running in pushstate mode\n *\n * @return true when running in pushstate mode\n */\n html5Mode(): boolean;\n /**\n * Gets the hashPrefix (when not running in pushstate mode)\n *\n * If the current url is `http://localhost/app#!/uirouter/path/#anchor`, it returns `!` which is the prefix for the \"hashbang\" portion.\n *\n * @return the hash prefix\n */\n hashPrefix(): string;\n /**\n * Sets the hashPrefix (when not running in pushstate mode)\n *\n * @return the new hash prefix\n */\n hashPrefix(newprefix: string): string;\n}\n\nexport { services };\n", + "/**\n * Random utility functions used in the UI-Router code\n *\n * These functions are exported, but are subject to change without notice.\n *\n * @preferred\n * @module common\n */\n/** for typedoc */\nimport { isFunction, isString, isArray, isRegExp, isDate } from './predicates';\nimport { all, any, prop, curry, not } from './hof';\nimport { services } from './coreservices';\nimport { StateObject } from '../state/stateObject';\n\ndeclare const global;\nexport const root: any = (typeof self === 'object' && self.self === self && self) ||\n (typeof global === 'object' && global.global === global && global) || this;\nconst angular = root.angular || {};\n\nexport const fromJson = angular.fromJson || JSON.parse.bind(JSON);\nexport const toJson = angular.toJson || JSON.stringify.bind(JSON);\nexport const forEach = angular.forEach || _forEach;\nexport const extend = Object.assign || _extend;\nexport const equals = angular.equals || _equals;\nexport function identity(x: any) { return x; }\nexport function noop(): any {}\n\nexport type Mapper = (x: X, key?: (string|number)) => T;\nexport interface TypedMap { [key: string]: T; }\nexport type Predicate = (x?: X) => boolean;\n/**\n * An ng1-style injectable\n *\n * This could be a (non-minified) function such as:\n * ```js\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an explicitly annotated function (minify safe)\n * ```js\n * injectableFunction.$inject = [ 'SomeDependency' ];\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an array style annotated function (minify safe)\n * ```js\n * ['SomeDependency', function injectableFunction(SomeDependency) {\n *\n * }];\n * ```\n *\n * @publicapi\n */\nexport type IInjectable = (Function|any[]);\n\nexport interface Obj extends Object {\n [key: string]: any;\n}\n\n/**\n * Builds proxy functions on the `to` object which pass through to the `from` object.\n *\n * For each key in `fnNames`, creates a proxy function on the `to` object.\n * The proxy function calls the real function on the `from` object.\n *\n *\n * #### Example:\n * This example creates an new class instance whose functions are prebound to the new'd object.\n * ```js\n * class Foo {\n * constructor(data) {\n * // Binds all functions from Foo.prototype to 'this',\n * // then copies them to 'this'\n * bindFunctions(Foo.prototype, this, this);\n * this.data = data;\n * }\n *\n * log() {\n * console.log(this.data);\n * }\n * }\n *\n * let myFoo = new Foo([1,2,3]);\n * var logit = myFoo.log;\n * logit(); // logs [1, 2, 3] from the myFoo 'this' instance\n * ```\n *\n * #### Example:\n * This example creates a bound version of a service function, and copies it to another object\n * ```\n *\n * var SomeService = {\n * this.data = [3, 4, 5];\n * this.log = function() {\n * console.log(this.data);\n * }\n * }\n *\n * // Constructor fn\n * function OtherThing() {\n * // Binds all functions from SomeService to SomeService,\n * // then copies them to 'this'\n * bindFunctions(SomeService, this, SomeService);\n * }\n *\n * let myOtherThing = new OtherThing();\n * myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this'\n * ```\n *\n * @param source A function that returns the source object which contains the original functions to be bound\n * @param target A function that returns the target object which will receive the bound functions\n * @param bind A function that returns the object which the functions will be bound to\n * @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object)\n * @param latebind If true, the binding of the function is delayed until the first time it's invoked\n */\nexport function createProxyFunctions(source: Function, target: Obj, bind: Function, fnNames?: string[], latebind = false): Obj {\n const bindFunction = (fnName) =>\n source()[fnName].bind(bind());\n\n const makeLateRebindFn = fnName => function lateRebindFunction() {\n target[fnName] = bindFunction(fnName);\n return target[fnName].apply(null, arguments);\n };\n\n fnNames = fnNames || Object.keys(source());\n\n return fnNames.reduce((acc, name) => {\n acc[name] = latebind ? makeLateRebindFn(name) : bindFunction(name);\n return acc;\n }, target);\n}\n\n\n/**\n * prototypal inheritance helper.\n * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it\n */\nexport const inherit = (parent: Obj, extra?: Obj) =>\n extend(Object.create(parent), extra);\n\n/** Given an array, returns true if the object is found in the array, (using indexOf) */\nexport const inArray: typeof _inArray = curry(_inArray) as any;\nexport function _inArray(array: any[], obj: any): boolean;\nexport function _inArray(array: any[]): (obj: any) => boolean;\nexport function _inArray(array, obj?): any {\n return array.indexOf(obj) !== -1;\n}\n\n/**\n * Given an array, and an item, if the item is found in the array, it removes it (in-place).\n * The same array is returned\n */\nexport const removeFrom: typeof _removeFrom = curry(_removeFrom) as any;\nexport function _removeFrom(array: T[], obj: T): T[];\nexport function _removeFrom(array: T[]): (obj: T) => T[];\nexport function _removeFrom(array, obj?) {\n const idx = array.indexOf(obj);\n if (idx >= 0) array.splice(idx, 1);\n return array;\n}\n\n/** pushes a values to an array and returns the value */\nexport const pushTo: typeof _pushTo = curry(_pushTo) as any;\nexport function _pushTo(arr: T[], val: T): T ;\nexport function _pushTo(arr: T[]): (val: T) => T ;\nexport function _pushTo(arr, val?): any {\n return (arr.push(val), val);\n}\n\n/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */\nexport const deregAll = (functions: Function[]) =>\n functions.slice().forEach(fn => {\n typeof fn === 'function' && fn();\n removeFrom(functions, fn);\n });\n/**\n * Applies a set of defaults to an options object. The options object is filtered\n * to only those properties of the objects in the defaultsList.\n * Earlier objects in the defaultsList take precedence when applying defaults.\n */\nexport function defaults(opts, ...defaultsList: Obj[]) {\n const _defaultsList = defaultsList.concat({}).reverse();\n const defaultVals = extend.apply(null, _defaultsList);\n return extend({}, defaultVals, pick(opts || {}, Object.keys(defaultVals)));\n}\n\n/** Reduce function that merges each element of the list into a single object, using extend */\nexport const mergeR = (memo: Obj, item: Obj) => extend(memo, item);\n\n/**\n * Finds the common ancestor path between two states.\n *\n * @param {Object} first The first state.\n * @param {Object} second The second state.\n * @return {Array} Returns an array of state names in descending order, not including the root.\n */\nexport function ancestors(first: StateObject, second: StateObject) {\n const path: StateObject[] = [];\n\n for (const n in first.path) { // tslint:disable-line:forin\n if (first.path[n] !== second.path[n]) break;\n path.push(first.path[n]);\n }\n return path;\n}\n\n/**\n * Return a copy of the object only containing the whitelisted properties.\n *\n * #### Example:\n * ```\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the whitelisted property names\n */\nexport function pick(obj: Obj, propNames: string[]): Obj {\n const objCopy = {};\n for (const _prop in obj) {\n if (propNames.indexOf(_prop) !== -1) {\n objCopy[_prop] = obj[_prop];\n }\n }\n return objCopy;\n}\n\n/**\n * Return a copy of the object omitting the blacklisted properties.\n *\n * @example\n * ```\n *\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = omit(foo, ['a', 'b']); // { c: 3 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the blacklisted property names\n */\nexport function omit(obj: Obj, propNames: string[]): Obj {\n return Object.keys(obj)\n .filter(not(inArray(propNames)))\n .reduce((acc, key) => (acc[key] = obj[key], acc), {});\n}\n\n\n/** Given an array of objects, maps each element to a named property of the element. */\nexport function pluck(collection: Obj[], propName: string): T[];\n/** Given an object, maps each property of the object to a named property of the property. */\nexport function pluck(collection: { [key: string]: any }, propName: string): { [key: string]: any };\n/**\n * Maps an array, or object to a property (by name)\n */\nexport function pluck(collection: any, propName: string): any {\n return map(collection, > prop(propName));\n}\n\n\n/** Given an array of objects, returns a new array containing only the elements which passed the callback predicate */\nexport function filter(collection: T[], callback: (t: T, key?: number) => boolean): T[];\n/** Given an object, returns a new object with only those properties that passed the callback predicate */\nexport function filter(collection: TypedMap, callback: (t: T, key?: string) => boolean): TypedMap;\n/** Filters an Array or an Object's properties based on a predicate */\nexport function filter(collection: any, callback: Function): T {\n const arr = isArray(collection), result: any = arr ? [] : {};\n const accept = arr ? x => result.push(x) : (x, key) => result[key] = x;\n forEach(collection, function(item, i) {\n if (callback(item, i)) accept(item, i);\n });\n return result;\n}\n\n\n/** Given an object, return the first property of that object which passed the callback predicate */\nexport function find(collection: TypedMap, callback: Predicate): T;\n/** Given an array of objects, returns the first object which passed the callback predicate */\nexport function find(collection: T[], callback: Predicate): T;\n/** Finds an object from an array, or a property of an object, that matches a predicate */\nexport function find(collection: any, callback: any) {\n let result;\n\n forEach(collection, function(item, i) {\n if (result) return;\n if (callback(item, i)) result = item;\n });\n\n return result;\n}\n\n/** Given an object, returns a new object, where each property is transformed by the callback function */\nexport let mapObj: (collection: { [key: string]: T }, callback: Mapper) => { [key: string]: U } = map;\n/** Given an array, returns a new array, where each element is transformed by the callback function */\nexport function map(collection: T[], callback: Mapper): U[];\nexport function map(collection: { [key: string]: T }, callback: Mapper): { [key: string]: U };\n/** Maps an array or object properties using a callback function */\nexport function map(collection: any, callback: any): any {\n const result = isArray(collection) ? [] : {};\n forEach(collection, (item, i) => result[i] = callback(item, i));\n return result;\n}\n\n/**\n * Given an object, return its enumerable property values\n *\n * @example\n * ```\n *\n * let foo = { a: 1, b: 2, c: 3 }\n * let vals = values(foo); // [ 1, 2, 3 ]\n * ```\n */\nexport const values: ( (obj: TypedMap) => T[]) = (obj: Obj) =>\n Object.keys(obj).map(key => obj[key]);\n\n/**\n * Reduce function that returns true if all of the values are truthy.\n *\n * @example\n * ```\n *\n * let vals = [ 1, true, {}, \"hello world\"];\n * vals.reduce(allTrueR, true); // true\n *\n * vals.push(0);\n * vals.reduce(allTrueR, true); // false\n * ```\n */\nexport const allTrueR = (memo: boolean, elem: any) => memo && elem;\n\n/**\n * Reduce function that returns true if any of the values are truthy.\n *\n * * @example\n * ```\n *\n * let vals = [ 0, null, undefined ];\n * vals.reduce(anyTrueR, true); // false\n *\n * vals.push(\"hello world\");\n * vals.reduce(anyTrueR, true); // true\n * ```\n */\nexport const anyTrueR = (memo: boolean, elem: any) => memo || elem;\n\n/**\n * Reduce function which un-nests a single level of arrays\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnestR = (memo: any[], elem: any[]) => memo.concat(elem);\n\n/**\n * Reduce function which recursively un-nests all arrays\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flattenR = (memo: any[], elem: any) =>\n isArray(elem) ? memo.concat(elem.reduce(flattenR, [])) : pushR(memo, elem);\n\n/**\n * Reduce function that pushes an object to an array, then returns the array.\n * Mostly just for [[flattenR]] and [[uniqR]]\n */\nexport function pushR(arr: any[], obj: any) {\n arr.push(obj);\n return arr;\n}\n\n/** Reduce function that filters out duplicates */\nexport const uniqR = (acc: T[], token: T): T[] =>\n inArray(acc, token) ? acc : pushR(acc, token);\n\n/**\n * Return a new array with a single level of arrays unnested.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * unnest(input) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnest = (arr: any[]) => arr.reduce(unnestR, []);\n/**\n * Return a completely flattened version of an array.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * flatten(input) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flatten = (arr: any[]) => arr.reduce(flattenR, []);\n\n/**\n * Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass.\n * @example\n * ```\n *\n * let isNumber = (obj) => typeof(obj) === 'number';\n * let allNumbers = [ 1, 2, 3, 4, 5 ];\n * allNumbers.filter(assertPredicate(isNumber)); //OK\n *\n * let oneString = [ 1, 2, 3, 4, \"5\" ];\n * oneString.filter(assertPredicate(isNumber, \"Not all numbers\")); // throws Error(\"\"Not all numbers\"\");\n * ```\n */\nexport const assertPredicate: (predicate: Predicate, errMsg: (string|Function)) => Predicate = assertFn;\n/**\n * Given a .map function, builds a .map function which throws an error if any mapped elements do not pass a truthyness test.\n * @example\n * ```\n *\n * var data = { foo: 1, bar: 2 };\n *\n * let keys = [ 'foo', 'bar' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // values is [1, 2]\n *\n * let keys = [ 'foo', 'bar', 'baz' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // throws Error(\"Key not found\")\n * ```\n */\nexport const assertMap: (mapFn: (t: T) => U, errMsg: (string|Function)) => (t: T) => U = assertFn;\nexport function assertFn(predicateOrMap: Function, errMsg: (string|Function) = 'assert failure'): any {\n return (obj) => {\n const result = predicateOrMap(obj);\n if (!result) {\n throw new Error(isFunction(errMsg) ? ( errMsg)(obj) : errMsg);\n }\n return result;\n };\n}\n\n/**\n * Like _.pairs: Given an object, returns an array of key/value pairs\n *\n * @example\n * ```\n *\n * pairs({ foo: \"FOO\", bar: \"BAR }) // [ [ \"foo\", \"FOO\" ], [ \"bar\": \"BAR\" ] ]\n * ```\n */\nexport const pairs = (obj: Obj) =>\n Object.keys(obj).map(key => [ key, obj[key]] );\n\n/**\n * Given two or more parallel arrays, returns an array of tuples where\n * each tuple is composed of [ a[i], b[i], ... z[i] ]\n *\n * @example\n * ```\n *\n * let foo = [ 0, 2, 4, 6 ];\n * let bar = [ 1, 3, 5, 7 ];\n * let baz = [ 10, 30, 50, 70 ];\n * arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ]\n * arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ]\n * ```\n */\nexport function arrayTuples(...args: any[]): any[] {\n if (args.length === 0) return [];\n const maxArrayLen = args.reduce((min, arr) => Math.min(arr.length, min), 9007199254740991); // aka 2^53 − 1 aka Number.MAX_SAFE_INTEGER\n const result = [];\n\n for (let i = 0; i < maxArrayLen; i++) {\n // This is a hot function\n // Unroll when there are 1-4 arguments\n switch (args.length) {\n case 1: result.push([args[0][i]]); break;\n case 2: result.push([args[0][i], args[1][i]]); break;\n case 3: result.push([args[0][i], args[1][i], args[2][i]]); break;\n case 4: result.push([args[0][i], args[1][i], args[2][i], args[3][i]]); break;\n default:\n result.push(args.map(array => array[i])); break;\n }\n }\n\n return result;\n}\n\n/**\n * Reduce function which builds an object from an array of [key, value] pairs.\n *\n * Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration.\n *\n * Each keyValueTuple should be an array with values [ key: string, value: any ]\n *\n * @example\n * ```\n *\n * var pairs = [ [\"fookey\", \"fooval\"], [\"barkey\", \"barval\"] ]\n *\n * var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n *\n * // Or, more simply:\n * var pairsToObj = pairs.reduce(applyPairs, {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n * ```\n */\nexport function applyPairs(memo: TypedMap, keyValTuple: any[]) {\n let key: string, value: any;\n if (isArray(keyValTuple)) [key, value] = keyValTuple;\n if (!isString(key)) throw new Error('invalid parameters to applyPairs');\n memo[key] = value;\n return memo;\n}\n\n/** Get the last element of an array */\nexport function tail(arr: T[]): T {\n return arr.length && arr[arr.length - 1] || undefined;\n}\n\n/**\n * shallow copy from src to dest\n */\nexport function copy(src: Obj, dest?: Obj) {\n if (dest) Object.keys(dest).forEach(key => delete dest[key]);\n if (!dest) dest = {};\n return extend(dest, src);\n}\n\n/** Naive forEach implementation works with Objects or Arrays */\nfunction _forEach(obj: (any[]|any), cb: (el, idx?) => void, _this: Obj) {\n if (isArray(obj)) return obj.forEach(cb, _this);\n Object.keys(obj).forEach(key => cb(obj[key], key));\n}\n\n/** Like Object.assign() */\nexport function _extend(toObj: Obj, ...fromObjs: Obj[]): any;\nexport function _extend(toObj: Obj): any {\n for (let i = 1; i < arguments.length; i++) {\n const obj = arguments[i];\n if (!obj) continue;\n const keys = Object.keys(obj);\n\n for (let j = 0; j < keys.length; j++) {\n toObj[keys[j]] = obj[keys[j]];\n }\n }\n\n return toObj;\n}\n\nfunction _equals(o1: any, o2: any): boolean {\n if (o1 === o2) return true;\n if (o1 === null || o2 === null) return false;\n if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN\n const t1 = typeof o1, t2 = typeof o2;\n if (t1 !== t2 || t1 !== 'object') return false;\n\n const tup = [o1, o2];\n if (all(isArray)(tup)) return _arraysEq(o1, o2);\n if (all(isDate)(tup)) return o1.getTime() === o2.getTime();\n if (all(isRegExp)(tup)) return o1.toString() === o2.toString();\n if (all(isFunction)(tup)) return true; // meh\n\n const predicates = [isFunction, isArray, isDate, isRegExp];\n if (predicates.map(any).reduce((b, fn) => b || !!fn(tup), false)) return false;\n\n const keys: { [i: string]: boolean } = {};\n for (const key in o1) { // tslint:disable-line:forin\n if (!_equals(o1[key], o2[key])) return false;\n keys[key] = true;\n }\n for (const key in o2) {\n if (!keys[key]) return false;\n }\n\n return true;\n}\n\nfunction _arraysEq(a1: any[], a2: any[]) {\n if (a1.length !== a2.length) return false;\n return arrayTuples(a1, a2).reduce((b, t) => b && _equals(t[0], t[1]), true);\n}\n\n// issue #2676\nexport const silenceUncaughtInPromise = (promise: Promise) =>\n promise.catch(e => 0) && promise;\nexport const silentRejection = (error: any) =>\n silenceUncaughtInPromise(services.$q.reject(error));\n", + "/**\n * @module common\n */ /** for typedoc */\n\nexport class Queue {\n constructor(private _items: T[] = [], private _limit: number = null) { }\n\n enqueue(item: T) {\n const items = this._items;\n items.push(item);\n if (this._limit && items.length > this._limit) items.shift();\n return item;\n }\n\n dequeue(): T {\n if (this.size())\n return this._items.splice(0, 1)[0];\n }\n\n clear(): Array {\n const current = this._items;\n this._items = [];\n return current;\n }\n\n size(): number {\n return this._items.length;\n }\n\n remove(item: T) {\n const idx = this._items.indexOf(item);\n return idx > -1 && this._items.splice(idx, 1)[0];\n }\n\n peekTail(): T {\n return this._items[this._items.length - 1];\n }\n\n peekHead(): T {\n if (this.size())\n return this._items[0];\n }\n}\n", + "/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\n'use strict';\nimport { extend, silentRejection } from '../common/common';\nimport { stringify } from '../common/strings';\nimport { is } from '../common/hof';\n\nexport enum RejectType {\n SUPERSEDED = 2, ABORTED = 3, INVALID = 4, IGNORED = 5, ERROR = 6,\n}\n\n/** @hidden */\nlet id = 0;\n\nexport class Rejection {\n $id = id++;\n type: number;\n message: string;\n detail: any;\n redirected: boolean;\n\n /** Returns true if the obj is a rejected promise created from the `asPromise` factory */\n static isRejectionPromise(obj: any): boolean {\n return obj && (typeof obj.then === 'function') && is(Rejection)(obj._transitionRejection);\n }\n\n /** Returns a Rejection due to transition superseded */\n static superseded(detail?: any, options?: any): Rejection {\n const message = 'The transition has been superseded by a different transition';\n const rejection = new Rejection(RejectType.SUPERSEDED, message, detail);\n if (options && options.redirected) {\n rejection.redirected = true;\n }\n return rejection;\n }\n\n /** Returns a Rejection due to redirected transition */\n static redirected(detail?: any): Rejection {\n return Rejection.superseded(detail, { redirected: true });\n }\n\n /** Returns a Rejection due to invalid transition */\n static invalid(detail?: any): Rejection {\n const message = 'This transition is invalid';\n return new Rejection(RejectType.INVALID, message, detail);\n }\n\n /** Returns a Rejection due to ignored transition */\n static ignored(detail?: any): Rejection {\n const message = 'The transition was ignored';\n return new Rejection(RejectType.IGNORED, message, detail);\n }\n\n /** Returns a Rejection due to aborted transition */\n static aborted(detail?: any): Rejection {\n const message = 'The transition has been aborted';\n return new Rejection(RejectType.ABORTED, message, detail);\n }\n\n /** Returns a Rejection due to aborted transition */\n static errored(detail?: any): Rejection {\n const message = 'The transition errored';\n return new Rejection(RejectType.ERROR, message, detail);\n }\n\n /**\n * Returns a Rejection\n *\n * Normalizes a value as a Rejection.\n * If the value is already a Rejection, returns it.\n * Otherwise, wraps and returns the value as a Rejection (Rejection type: ERROR).\n *\n * @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection.\n */\n static normalize(detail?: Rejection | Error | any): Rejection {\n return is(Rejection)(detail) ? detail : Rejection.errored(detail);\n }\n\n constructor(type: number, message?: string, detail?: any) {\n this.type = type;\n this.message = message;\n this.detail = detail;\n }\n\n toString() {\n const detailString = (d: any) =>\n d && d.toString !== Object.prototype.toString ? d.toString() : stringify(d);\n const detail = detailString(this.detail);\n const { $id, type, message } = this;\n return `Transition Rejection($id: ${$id} type: ${type}, message: ${message}, detail: ${detail})`;\n }\n\n toPromise(): Promise {\n return extend(silentRejection(this), { _transitionRejection: this });\n }\n}\n", + "/**\n * # Transition tracing (debug)\n *\n * Enable transition tracing to print transition information to the console,\n * in order to help debug your application.\n * Tracing logs detailed information about each Transition to your console.\n *\n * To enable tracing, import the [[Trace]] singleton and enable one or more categories.\n *\n * ### ES6\n * ```js\n * import {trace} from \"ui-router-ng2\"; // or \"angular-ui-router\"\n * trace.enable(1, 5); // TRANSITION and VIEWCONFIG\n * ```\n *\n * ### CJS\n * ```js\n * let trace = require(\"angular-ui-router\").trace; // or \"ui-router-ng2\"\n * trace.enable(\"TRANSITION\", \"VIEWCONFIG\");\n * ```\n *\n * ### Globals\n * ```js\n * let trace = window[\"angular-ui-router\"].trace; // or \"ui-router-ng2\"\n * trace.enable(); // Trace everything (very verbose)\n * ```\n *\n * ### Angular 1:\n * ```js\n * app.run($trace => $trace.enable());\n * ```\n *\n * @coreapi\n * @module trace\n */\n/* tslint:disable:no-console */\nimport { parse } from '../common/hof';\nimport { isFunction, isNumber } from '../common/predicates';\nimport { Transition } from '../transition/transition';\nimport { ViewTuple } from '../view';\nimport { ActiveUIView, ViewConfig, ViewContext } from '../view/interface';\nimport { stringify, functionToString, maxLength, padString } from './strings';\nimport { Resolvable } from '../resolve/resolvable';\nimport { PathNode } from '../path/pathNode';\nimport { PolicyWhen } from '../resolve/interface';\nimport { TransitionHook } from '../transition/transitionHook';\nimport { HookResult } from '../transition/interface';\nimport { StateObject } from '../state/stateObject';\n\n/** @hidden */\nfunction uiViewString (uiview: ActiveUIView) {\n if (!uiview) return 'ui-view (defunct)';\n const state = uiview.creationContext ? uiview.creationContext.name || '(root)' : '(none)';\n return `[ui-view#${uiview.id} ${uiview.$type}:${uiview.fqn} (${uiview.name}@${state})]`;\n}\n\n/** @hidden */\nconst viewConfigString = (viewConfig: ViewConfig) => {\n const view = viewConfig.viewDecl;\n const state = view.$context.name || '(root)';\n return `[View#${viewConfig.$id} from '${state}' state]: target ui-view: '${view.$uiViewName}@${view.$uiViewContextAnchor}'`;\n};\n\n/** @hidden */\nfunction normalizedCat(input: Category|string): string {\n return isNumber(input) ? Category[input] : Category[Category[input]];\n}\n\n/** @hidden */\nconst consoleLog = Function.prototype.bind.call(console.log, console);\n\n/** @hidden */\nconst consoletable = isFunction(console.table) ? console.table.bind(console) : consoleLog.bind(console);\n\n\n/**\n * Trace categories Enum\n *\n * Enable or disable a category using [[Trace.enable]] or [[Trace.disable]]\n *\n * `trace.enable(Category.TRANSITION)`\n *\n * These can also be provided using a matching string, or position ordinal\n *\n * `trace.enable(\"TRANSITION\")`\n *\n * `trace.enable(1)`\n */\nexport enum Category {\n RESOLVE, TRANSITION, HOOK, UIVIEW, VIEWCONFIG,\n}\n\n/** @hidden */\nconst _tid = parse('$id');\n\n/** @hidden */\nconst _rid = parse('router.$id');\n\n/** @hidden */\nconst transLbl = (trans) => `Transition #${_tid(trans)}-${_rid(trans)}`;\n\n/**\n * Prints UI-Router Transition trace information to the console.\n */\nexport class Trace {\n /** @hidden */\n approximateDigests: number;\n\n /** @hidden */\n private _enabled: { [key: string]: boolean } = {};\n\n /** @hidden */\n constructor() {\n this.approximateDigests = 0;\n }\n\n /** @hidden */\n private _set(enabled: boolean, categories: Category[]) {\n if (!categories.length) {\n categories = Object.keys(Category)\n .map(k => parseInt(k, 10))\n .filter(k => !isNaN(k))\n .map(key => Category[key]);\n }\n categories.map(normalizedCat).forEach(category => this._enabled[category] = enabled);\n }\n\n /**\n * Enables a trace [[Category]]\n *\n * ```js\n * trace.enable(\"TRANSITION\");\n * ```\n *\n * @param categories categories to enable. If `categories` is omitted, all categories are enabled.\n * Also takes strings (category name) or ordinal (category position)\n */\n enable(...categories: (Category|string|number)[]);\n enable(...categories: any[]) { this._set(true, categories); }\n /**\n * Disables a trace [[Category]]\n *\n * ```js\n * trace.disable(\"VIEWCONFIG\");\n * ```\n *\n * @param categories categories to disable. If `categories` is omitted, all categories are disabled.\n * Also takes strings (category name) or ordinal (category position)\n */\n disable(...categories: (Category|string|number)[]);\n disable(...categories: any[]) { this._set(false, categories); }\n\n /**\n * Retrieves the enabled stateus of a [[Category]]\n *\n * ```js\n * trace.enabled(\"VIEWCONFIG\"); // true or false\n * ```\n *\n * @returns boolean true if the category is enabled\n */\n enabled(category: (Category|string|number)): boolean {\n return !!this._enabled[normalizedCat(category)];\n }\n\n /** @internalapi called by ui-router code */\n traceTransitionStart(trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: Started -> ${stringify(trans)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceTransitionIgnored(trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: Ignored <> ${stringify(trans)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceHookInvocation(step: TransitionHook, trans: Transition, options: any) {\n if (!this.enabled(Category.HOOK)) return;\n const event = parse('traceData.hookType')(options) || 'internal',\n context = parse('traceData.context.state.name')(options) || parse('traceData.context')(options) || 'unknown',\n name = functionToString((step as any).registeredHook.callback);\n console.log(`${transLbl(trans)}: Hook -> ${event} context: ${context}, ${maxLength(200, name)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceHookResult(hookResult: HookResult, trans: Transition, transitionOptions: any) {\n if (!this.enabled(Category.HOOK)) return;\n console.log(`${transLbl(trans)}: <- Hook returned: ${maxLength(200, stringify(hookResult))}`);\n }\n\n /** @internalapi called by ui-router code */\n traceResolvePath(path: PathNode[], when: PolicyWhen, trans?: Transition) {\n if (!this.enabled(Category.RESOLVE)) return;\n console.log(`${transLbl(trans)}: Resolving ${path} (${when})`);\n }\n\n /** @internalapi called by ui-router code */\n traceResolvableResolved(resolvable: Resolvable, trans?: Transition) {\n if (!this.enabled(Category.RESOLVE)) return;\n console.log(`${transLbl(trans)}: <- Resolved ${resolvable} to: ${maxLength(200, stringify(resolvable.data))}`);\n }\n\n /** @internalapi called by ui-router code */\n traceError(reason: any, trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: <- Rejected ${stringify(trans)}, reason: ${reason}`);\n }\n\n /** @internalapi called by ui-router code */\n traceSuccess(finalState: StateObject, trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: <- Success ${stringify(trans)}, final state: ${finalState.name}`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewEvent(event: string, viewData: ActiveUIView, extra = '') {\n if (!this.enabled(Category.UIVIEW)) return;\n console.log(`ui-view: ${padString(30, event)} ${uiViewString(viewData)}${extra}`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewConfigUpdated(viewData: ActiveUIView, context: ViewContext) {\n if (!this.enabled(Category.UIVIEW)) return;\n this.traceUIViewEvent('Updating', viewData, ` with ViewConfig from context='${context}'`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewFill(viewData: ActiveUIView, html: string) {\n if (!this.enabled(Category.UIVIEW)) return;\n this.traceUIViewEvent('Fill', viewData, ` with: ${maxLength(200, html)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceViewSync(pairs: ViewTuple[]) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n const uivheader = 'uiview component fqn';\n const cfgheader = 'view config state (view name)';\n const mapping = pairs.map(({ uiView, viewConfig }) => {\n const uiv = uiView && uiView.fqn;\n const cfg = viewConfig && `${viewConfig.viewDecl.$context.name}: (${viewConfig.viewDecl.$name})`;\n return { [uivheader]: uiv, [cfgheader]: cfg };\n }).sort((a, b) => (a[uivheader] || '').localeCompare(b[uivheader] || ''));\n\n consoletable(mapping);\n }\n\n /** @internalapi called by ui-router code */\n traceViewServiceEvent(event: string, viewConfig: ViewConfig) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n console.log(`VIEWCONFIG: ${event} ${viewConfigString(viewConfig)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceViewServiceUIViewEvent(event: string, viewData: ActiveUIView) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n console.log(`VIEWCONFIG: ${event} ${uiViewString(viewData)}`);\n }\n}\n\n/**\n * The [[Trace]] singleton\n *\n * #### Example:\n * ```js\n * import {trace} from \"angular-ui-router\";\n * trace.enable(1, 5);\n * ```\n */\nconst trace = new Trace();\nexport { trace };\n", + "/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\nimport { StateDeclaration } from '../state/interface';\nimport { Predicate } from '../common/common';\n\nimport { Transition } from './transition';\nimport { StateObject } from '../state/stateObject';\nimport { PathNode } from '../path/pathNode';\nimport { TargetState } from '../state/targetState';\nimport { RegisteredHook } from './hookRegistry';\n\n/**\n * The TransitionOptions object can be used to change the behavior of a transition.\n *\n * It is passed as the third argument to [[StateService.go]], [[StateService.transitionTo]].\n * It can also be used with a `uiSref`.\n */\nexport interface TransitionOptions {\n /**\n * This option changes how the Transition interacts with the browser's location bar (URL).\n *\n * - If `true`, it will update the url in the location bar.\n * - If `false`, it will not update the url in the location bar.\n * - If it is the string `\"replace\"`, it will update the url and also replace the last history record.\n *\n * @default `true`\n */\n location ?: (boolean|string);\n\n /**\n * When transitioning to relative path (e.g '`^`'), this option defines which state to be relative from.\n * @default `$state.current`\n */\n relative ?: (string|StateDeclaration|StateObject);\n\n /**\n * This option sets whether or not the transition's parameter values should be inherited from\n * the current parameter values.\n *\n * - If `true`, it will inherit parameter values from the current parameter values.\n * - If `false`, only the parameters which are provided to `transitionTo` will be used.\n *\n * @default `false`\n */\n inherit ?: boolean;\n\n /**\n * @deprecated\n */\n notify ?: boolean;\n\n /**\n * This option may be used to force states which are currently active to reload.\n *\n * During a normal transition, a state is \"retained\" if:\n * - It was previously active\n * - The state's parameter values have not changed\n * - All the parent states' parameter values have not changed\n *\n * Forcing a reload of a state will cause it to be exited and entered, which will:\n * - Refetch that state's resolve data\n * - Exit the state (onExit hook)\n * - Re-enter the state (onEnter hook)\n * - Re-render the views (controllers and templates)\n *\n * - When `true`, the destination state (and all parent states) will be reloaded.\n * - When it is a string and is the name of a state, or when it is a State object,\n * that state and any children states will be reloaded.\n *\n * @default `false`\n */\n reload ?: (boolean|string|StateDeclaration|StateObject);\n /**\n * You can define your own Transition Options inside this property and use them, e.g., from a Transition Hook\n */\n custom ?: any;\n /** @internalapi */\n reloadState ?: (StateObject);\n /** @internalapi\n * If this transition is a redirect, this property should be the original Transition (which was redirected to this one)\n */\n redirectedFrom?: Transition;\n /** @internalapi */\n current ?: () => Transition;\n /** @internalapi */\n source ?: 'sref' | 'url' | 'redirect' | 'otherwise' | 'unknown';\n}\n\n/** @internalapi */\nexport interface TransitionHookOptions {\n current ?: () => Transition; // path?\n transition ?: Transition;\n hookType ?: string;\n target ?: any;\n traceData ?: any;\n bind ?: any;\n stateHook ?: boolean;\n}\n\n/**\n * TreeChanges encapsulates the various Paths that are involved in a Transition.\n *\n * Get a TreeChanges object using [[Transition.treeChanges]]\n *\n * A UI-Router Transition is from one Path in a State Tree to another Path. For a given Transition,\n * this object stores the \"to\" and \"from\" paths, as well as subsets of those: the \"retained\",\n * \"exiting\" and \"entering\" paths.\n *\n * Each path in TreeChanges is an array of [[PathNode]] objects. Each PathNode in the array corresponds to a portion\n * of a nested state.\n *\n * For example, if you had a nested state named `foo.bar.baz`, it would have three\n * portions, `foo, bar, baz`. If you transitioned **to** `foo.bar.baz` and inspected the [[TreeChanges.to]]\n * Path, you would find a node in the array for each portion: `foo`, `bar`, and `baz`.\n *\n * ---\n *\n * @todo show visual state tree\n */\nexport interface TreeChanges {\n /** @nodoc */\n [key: string]: PathNode[];\n\n /** The path of nodes in the state tree that the transition is coming *from* */\n from: PathNode[];\n\n /** The path of nodes in the state tree that the transition is going *to* */\n to: PathNode[];\n\n /**\n * The path of active nodes that the transition is retaining.\n *\n * These nodes are neither exited, nor entered.\n * Before and after the transition is successful, these nodes are active.\n */\n retained: PathNode[];\n\n /**\n * The path of previously active nodes that the transition is exiting.\n *\n * After the Transition is successful, these nodes are no longer active.\n *\n * Note that a state that is being reloaded (due to parameter values changing, or `reload: true`) may be in both the\n * `exiting` and `entering` paths.\n */\n exiting: PathNode[];\n\n /**\n * The path of nodes that the transition is entering.\n *\n * After the Transition is successful, these nodes will be active.\n * Because they are entering, they have their resolves fetched, `onEnter` hooks run, and their views\n * (component(s) or controller(s)+template(s)) refreshed.\n *\n * Note that a state that is reloaded (due to parameter values changing, or `reload: true`) may be in both the\n * `exiting` and `entering` paths.\n */\n entering: PathNode[];\n}\n\nexport type IHookRegistration = (matchCriteria: HookMatchCriteria, callback: HookFn, options?: HookRegOptions) => Function;\n\n/**\n * The signature for Transition Hooks.\n *\n * Transition hooks are callback functions that hook into the lifecycle of transitions.\n * As a transition runs, it reaches certain lifecycle events.\n * As each event occurs, the hooks which are registered for the event are called (in priority order).\n *\n * A transition hook may alter a Transition by returning a [[HookResult]].\n *\n * #### See:\n *\n * - [[IHookRegistry.onBefore]]\n * - [[IHookRegistry.onStart]]\n * - [[IHookRegistry.onFinish]]\n * - [[IHookRegistry.onSuccess]]\n * - [[IHookRegistry.onError]]\n *\n * @param transition the current [[Transition]]\n * @param injector (for ng1 or ng2 only) the injector service\n *\n * @returns a [[HookResult]] which may alter the transition\n *\n */\nexport interface TransitionHookFn {\n (transition: Transition): HookResult;\n}\n\n/**\n * The signature for Transition State Hooks.\n *\n * A function which hooks into a lifecycle event for a specific state.\n *\n * Transition State Hooks are callback functions that hook into the lifecycle events of specific states during a transition.\n * As a transition runs, it may exit some states, retain (keep) states, and enter states.\n * As each lifecycle event occurs, the hooks which are registered for the event and that state are called (in priority order).\n *\n * #### See:\n *\n * - [[IHookRegistry.onExit]]\n * - [[IHookRegistry.onRetain]]\n * - [[IHookRegistry.onEnter]]\n *\n * @param transition the current [[Transition]]\n * @param state the [[StateObject]] that the hook is bound to\n * @param injector (for ng1 or ng2 only) the injector service\n *\n * @returns a [[HookResult]] which may alter the transition\n */\nexport interface TransitionStateHookFn {\n (transition: Transition, state: StateDeclaration): HookResult;\n}\n\n/**\n * The signature for Transition onCreate Hooks.\n *\n * Transition onCreate Hooks are callbacks that allow customization or preprocessing of\n * a Transition before it is returned from [[TransitionService.create]]\n *\n * @param transition the [[Transition]] that was just created\n * @return a [[Transition]] which will then be returned from [[TransitionService.create]]\n */\nexport interface TransitionCreateHookFn {\n (transition: Transition): void;\n}\n\nexport type HookFn = (TransitionHookFn|TransitionStateHookFn|TransitionCreateHookFn);\n\n/**\n * The return value of a [[TransitionHookFn]] or [[TransitionStateHookFn]]\n *\n * When returned from a [[TransitionHookFn]] or [[TransitionStateHookFn]], these values alter the running [[Transition]]:\n *\n * - `false`: the transition will be cancelled.\n * - [[TargetState]]: the transition will be redirected to the new target state (see: [[StateService.target]])\n * - `Promise`: the transition will wait for the promise to resolve or reject\n * - If the promise is rejected (or resolves to `false`), the transition will be cancelled\n * - If the promise resolves to a [[TargetState]], the transition will be redirected\n * - If the promise resolves to anything else, the transition will resume\n * - Anything else: the transition will resume\n */\nexport type HookResult = (boolean | TargetState | void | Promise);\n\n/**\n * These options may be provided when registering a Transition Hook (such as `onStart`)\n */\nexport interface HookRegOptions {\n /**\n * Sets the priority of the registered hook\n *\n * Hooks of the same type (onBefore, onStart, etc) are invoked in priority order. A hook with a higher priority\n * is invoked before a hook with a lower priority.\n *\n * The default hook priority is 0\n */\n priority?: number;\n\n /**\n * Specifies what `this` is bound to during hook invocation.\n */\n bind?: any;\n\n /**\n * Limits the number of times that the hook will be invoked.\n * Once the hook has been invoked this many times, it is automatically deregistered.\n */\n invokeLimit?: number;\n}\n\n/**\n * This interface specifies the api for registering Transition Hooks. Both the\n * [[TransitionService]] and also the [[Transition]] object itself implement this interface.\n * Note: the Transition object only allows hooks to be registered before the Transition is started.\n */\nexport interface IHookRegistry {\n /** @hidden place to store the hooks */\n _registeredHooks: { [key: string]: RegisteredHook[] };\n\n /**\n * Registers a [[TransitionHookFn]], called *before a transition starts*.\n *\n * Registers a transition lifecycle hook, which is invoked before a transition even begins.\n * This hook can be useful to implement logic which prevents a transition from even starting, such\n * as authentication, redirection\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onBefore` hooks are invoked *before a Transition starts*.\n * No resolves have been fetched yet.\n * Each `onBefore` hook is invoked synchronously, in the same call stack as [[StateService.transitionTo]].\n * The registered `onBefore` hooks are invoked in priority order.\n *\n * Note: during the `onBefore` phase, additional hooks can be added to the specific [[Transition]] instance.\n * These \"on-the-fly\" hooks only affect the currently running transition..\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * If any hook modifies the transition *synchronously* (by throwing, returning `false`, or returning\n * a [[TargetState]]), the remainder of the hooks are skipped.\n * If a hook returns a promise, the remainder of the `onBefore` hooks are still invoked synchronously.\n * All promises are resolved, and processed asynchronously before the `onStart` phase of the Transition.\n *\n * ### Examples\n *\n * #### Default Substate\n *\n * This example redirects any transition from 'home' to 'home.dashboard'. This is commonly referred to as a\n * \"default substate\".\n *\n * @example\n * ```js\n * // ng2\n * transitionService.onBefore({ to: 'home' }, (trans: Transition) =>\n * trans.router.stateService.target(\"home.dashboard\"));\n * ```\n *\n * #### Data Driven Default Substate\n *\n * This example provides data-driven default substate functionality. It matches on a transition to any state\n * which has `defaultSubstate: \"some.sub.state\"` defined. See: [[Transition.to]] which returns the \"to state\"\n * definition.\n *\n * @example\n * ```js\n * // ng1\n * // state declaration\n * {\n * name: 'home',\n * template: '
',\n * defaultSubstate: 'home.dashboard'\n * }\n *\n * var criteria = {\n * to: function(state) {\n * return state.defaultSubstate != null;\n * }\n * }\n *\n * $transitions.onBefore(criteria, function(trans: Transition) {\n * var substate = trans.to().defaultSubstate;\n * return trans.router.stateService.target(substate);\n * });\n * ```\n *\n *\n * #### Require authentication\n *\n * This example cancels a transition to a state which requires authentication, if the user is not currently authenticated.\n *\n * This example assumes a state tree where all states which require authentication are children of a parent `'requireauth'` state.\n * This example assumes `MyAuthService` synchronously returns a boolean from `isAuthenticated()`.\n *\n * #### Example:\n * ```js\n * // ng1\n * $transitions.onBefore( { to: 'requireauth.**' }, function(trans) {\n * var myAuthService = trans.injector().get('MyAuthService');\n * // If isAuthenticated returns false, the transition is cancelled.\n * return myAuthService.isAuthenticated();\n * });\n * ```\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be invoked.\n * @returns a function which deregisters the hook.\n */\n onBefore(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called when a transition starts.\n *\n * Registers a transition lifecycle hook, which is invoked as a transition starts running.\n * This hook can be useful to perform some asynchronous action before completing a transition.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onStart` hooks are invoked asynchronously when the Transition starts running.\n * This happens after the `onBefore` phase is complete.\n * At this point, the Transition has not yet exited nor entered any states.\n * The registered `onStart` hooks are invoked in priority order.\n *\n * Note: A built-in `onStart` hook with high priority is used to fetch any eager resolve data.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Example\n *\n * #### Login during transition\n *\n * This example intercepts any transition to a state which requires authentication, when the user is\n * not currently authenticated. It allows the user to authenticate asynchronously, then resumes the\n * transition. If the user did not authenticate successfully, it redirects to the \"guest\" state, which\n * does not require authentication.\n *\n * This example assumes:\n * - a state tree where all states which require authentication are children of a parent `'auth'` state.\n * - `MyAuthService.isAuthenticated()` synchronously returns a boolean.\n * - `MyAuthService.authenticate()` presents a login dialog, and returns a promise which is resolved\n * or rejected, whether or not the login attempt was successful.\n *\n * #### Example:\n * ```js\n * // ng1\n * $transitions.onStart( { to: 'auth.**' }, function(trans) {\n * var $state = trans.router.stateService;\n * var MyAuthService = trans.injector().get('MyAuthService');\n *\n * // If the user is not authenticated\n * if (!MyAuthService.isAuthenticated()) {\n *\n * // Then return a promise for a successful login.\n * // The transition will wait for this promise to settle\n *\n * return MyAuthService.authenticate().catch(function() {\n *\n * // If the authenticate() method failed for whatever reason,\n * // redirect to a 'guest' state which doesn't require auth.\n * return $state.target(\"guest\");\n * });\n * }\n * });\n * ```\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onStart(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is entered.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being entered.\n *\n * Since this hook is run only when the specific state is being *entered*, it can be useful for\n * performing tasks when entering a submodule/feature area such as initializing a stateful service,\n * or for guarding access to a submodule/feature area.\n *\n * See [[TransitionStateHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onEnter` hooks generally specify `{ entering: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onEnter` hooks are invoked when the Transition is entering a state.\n * States are entered after the `onRetain` phase is complete.\n * If more than one state is being entered, the parent state is entered first.\n * The registered `onEnter` hooks for a state are invoked in priority order.\n *\n * Note: A built-in `onEnter` hook with high priority is used to fetch lazy resolve data for states being entered.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onEnter` hooks using the [[TransitionService]], you may define an `onEnter` hook\n * directly on a state declaration (see: [[StateDeclaration.onEnter]]).\n *\n *\n * ### Examples\n *\n * #### Audit Log\n *\n * This example uses a service to log that a user has entered the admin section of an app.\n * This assumes that there are substates of the \"admin\" state, such as \"admin.users\", \"admin.pages\", etc.\n * @example\n * ```\n *\n * $transitions.onEnter({ entering: 'admin' }, function(transition, state) {\n * var AuditService = trans.injector().get('AuditService');\n * AuditService.log(\"Entered \" + state.name + \" module while transitioning to \" + transition.to().name);\n * }\n * ```\n *\n * #### Audit Log (inside a state declaration)\n *\n * The `onEnter` inside this state declaration is syntactic sugar for the previous Audit Log example.\n * ```\n * {\n * name: 'admin',\n * component: 'admin',\n * onEnter: function($transition$, $state$) {\n * var AuditService = $transition$.injector().get('AuditService');\n * AuditService.log(\"Entered \" + state.name + \" module while transitioning to \" + transition.to().name);\n * }\n * }\n * ```\n *\n * Note: A state declaration's `onEnter` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onEnter(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is retained/kept.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) for\n * a specific state that was previously active will remain active (is not being entered nor exited).\n *\n * This hook is invoked when a state is \"retained\" or \"kept\".\n * It means the transition is coming *from* a substate of the retained state *to* a substate of the retained state.\n * This hook can be used to perform actions when the user moves from one substate to another, such as between steps in a wizard.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onRetain` hooks generally specify `{ retained: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onRetain` hooks are invoked after any `onExit` hooks have been fired.\n * If more than one state is retained, the child states' `onRetain` hooks are invoked first.\n * The registered `onRetain` hooks for a state are invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onRetain` hooks using the [[TransitionService]], you may define an `onRetain` hook\n * directly on a state declaration (see: [[StateDeclaration.onRetain]]).\n *\n * Note: A state declaration's `onRetain` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onRetain(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is exited.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being exited.\n *\n * Since this hook is run only when the specific state is being *exited*, it can be useful for\n * performing tasks when leaving a submodule/feature area such as cleaning up a stateful service,\n * or for preventing the user from leaving a state or submodule until some criteria is satisfied.\n *\n * See [[TransitionStateHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onExit` hooks generally specify `{ exiting: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onExit` hooks are invoked when the Transition is exiting a state.\n * States are exited after any `onStart` phase is complete.\n * If more than one state is being exited, the child states are exited first.\n * The registered `onExit` hooks for a state are invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onExit` hooks using the [[TransitionService]], you may define an `onExit` hook\n * directly on a state declaration (see: [[StateDeclaration.onExit]]).\n *\n * Note: A state declaration's `onExit` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onExit(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called *just before a transition finishes*.\n *\n * Registers a transition lifecycle hook, which is invoked just before a transition finishes.\n * This hook is a last chance to cancel or redirect a transition.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onFinish` hooks are invoked after the `onEnter` phase is complete.\n * These hooks are invoked just before the transition is \"committed\".\n * Each hook is invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onFinish(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called after a successful transition completed.\n *\n * Registers a transition lifecycle hook, which is invoked after a transition successfully completes.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onSuccess` hooks are chained off the Transition's promise (see [[Transition.promise]]).\n * If the Transition is successful and its promise is resolved, then the `onSuccess` hooks are invoked.\n * Since these hooks are run after the transition is over, their return value is ignored.\n * The `onSuccess` hooks are invoked in priority order.\n *\n * ### Return value\n *\n * Since the Transition is already completed, the hook's return value is ignored\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onSuccess(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called after a transition has errored.\n *\n * Registers a transition lifecycle hook, which is invoked after a transition has been rejected for any reason.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * The `onError` hooks are chained off the Transition's promise (see [[Transition.promise]]).\n * If a Transition fails, its promise is rejected and the `onError` hooks are invoked.\n * The `onError` hooks are invoked in priority order.\n *\n * Since these hooks are run after the transition is over, their return value is ignored.\n *\n * A transition \"errors\" if it was started, but failed to complete (for any reason).\n * A *non-exhaustive list* of reasons a transition can error:\n *\n * - A transition was cancelled because a new transition started while it was still running (`Transition superseded`)\n * - A transition was cancelled by a Transition Hook returning false\n * - A transition was redirected by a Transition Hook returning a [[TargetState]]\n * - A Transition Hook or resolve function threw an error\n * - A Transition Hook returned a rejected promise\n * - A resolve function returned a rejected promise\n *\n * To check the failure reason, inspect the return value of [[Transition.error]].\n *\n * Note: `onError` should be used for targeted error handling, or error recovery.\n * For simple catch-all error reporting, use [[StateService.defaultErrorHandler]].\n *\n * ### Return value\n *\n * Since the Transition is already completed, the hook's return value is ignored\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onError(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Returns all the registered hooks of a given `hookName` type\n *\n * #### Example:\n * ```\n * $transitions.getHooks(\"onEnter\")\n * ```\n */\n getHooks(hookName: string): RegisteredHook[];\n}\n\n/** A predicate type which tests if a [[StateObject]] passes some test. Returns a boolean. */\nexport type IStateMatch = Predicate;\n\n/**\n * This object is used to configure whether or not a Transition Hook is invoked for a particular transition,\n * based on the Transition's \"to state\" and \"from state\".\n *\n * Each property (`to`, `from`, `exiting`, `retained`, and `entering`) can be a state [[Glob]] string,\n * a boolean, or a function that takes a state and returns a boolean (see [[HookMatchCriterion]])\n *\n * All properties are optional. If any property is omitted, it is replaced with the value `true`, and always matches.\n * To match any transition, use an empty criteria object `{}`.\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from the `parent` state and going to the `parent.child` state.\n * var match = {\n * to: 'parent',\n * from: 'parent.child'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any substate of `parent` and going directly to the `parent` state.\n * var match = {\n * to: 'parent',\n * from: 'parent.**'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any state and going to any substate of `mymodule`\n * var match = {\n * to: 'mymodule.**'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any state and going to any state that has `data.authRequired`\n * // set to a truthy value.\n * var match = {\n * to: function(state) {\n * return state.data != null && state.data.authRequired === true;\n * }\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition that is exiting `parent.child`\n * var match = {\n * exiting: 'parent.child'\n * }\n * ```\n */\nexport interface HookMatchCriteria {\n [key: string]: HookMatchCriterion | undefined;\n\n /** A [[HookMatchCriterion]] to match the destination state */\n to?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match the original (from) state */\n from?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be exiting */\n exiting?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be retained */\n retained?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be entering */\n entering?: HookMatchCriterion;\n}\n\nexport interface IMatchingNodes {\n [key: string]: PathNode[];\n\n to: PathNode[];\n from: PathNode[];\n exiting: PathNode[];\n retained: PathNode[];\n entering: PathNode[];\n}\n\n/** @hidden */\nexport interface RegisteredHooks {\n [key: string]: RegisteredHook[];\n}\n\n/** @hidden */\nexport interface PathTypes {\n [key: string]: PathType;\n\n to: PathType;\n from: PathType;\n exiting: PathType;\n retained: PathType;\n entering: PathType;\n}\n\n/** @hidden */\nexport interface PathType {\n name: string;\n scope: TransitionHookScope;\n}\n\n/**\n * Hook Criterion used to match a transition.\n *\n * A [[Glob]] string that matches the name of a state.\n *\n * Or, a function with the signature `function(state) { return matches; }`\n * which should return a boolean to indicate if a state matches.\n *\n * Or, `true` to always match\n */\nexport type HookMatchCriterion = (string|IStateMatch|boolean);\n\nexport enum TransitionHookPhase { CREATE, BEFORE, RUN, SUCCESS, ERROR }\nexport enum TransitionHookScope { TRANSITION, STATE }\n", + "/**\n * @coreapi\n * @module state\n */ /** for typedoc */\n\nimport { StateDeclaration, StateOrName, TargetStateDef } from './interface';\nimport { TransitionOptions } from '../transition/interface';\nimport { StateObject } from './stateObject';\nimport { isString } from '../common/predicates';\nimport { stringify } from '../common/strings';\nimport { extend } from '../common';\nimport { StateRegistry } from './stateRegistry';\nimport { RawParams } from '../params';\n\n/**\n * Encapsulate the target (destination) state/params/options of a [[Transition]].\n *\n * This class is frequently used to redirect a transition to a new destination.\n *\n * See:\n *\n * - [[HookResult]]\n * - [[TransitionHookFn]]\n * - [[TransitionService.onStart]]\n *\n * To create a `TargetState`, use [[StateService.target]].\n *\n * ---\n *\n * This class wraps:\n *\n * 1) an identifier for a state\n * 2) a set of parameters\n * 3) and transition options\n * 4) the registered state object (the [[StateDeclaration]])\n *\n * Many UI-Router APIs such as [[StateService.go]] take a [[StateOrName]] argument which can\n * either be a *state object* (a [[StateDeclaration]] or [[StateObject]]) or a *state name* (a string).\n * The `TargetState` class normalizes those options.\n *\n * A `TargetState` may be valid (the state being targeted exists in the registry)\n * or invalid (the state being targeted is not registered).\n */\nexport class TargetState {\n private _definition: StateObject;\n private _params: RawParams;\n private _options: TransitionOptions;\n\n /** Returns true if the object has a state property that might be a state or state name */\n static isDef = (obj): obj is TargetStateDef =>\n obj && obj.state && (isString(obj.state) || isString(obj.state.name));\n\n /**\n * The TargetState constructor\n *\n * Note: Do not construct a `TargetState` manually.\n * To create a `TargetState`, use the [[StateService.target]] factory method.\n *\n * @param _stateRegistry The StateRegistry to use to look up the _definition\n * @param _identifier An identifier for a state.\n * Either a fully-qualified state name, or the object used to define the state.\n * @param _params Parameters for the target state\n * @param _options Transition options.\n *\n * @internalapi\n */\n constructor(\n private _stateRegistry: StateRegistry,\n private _identifier: StateOrName,\n _params?: RawParams,\n _options?: TransitionOptions,\n ) {\n this._identifier = _identifier;\n this._params = extend({}, _params || {});\n this._options = extend({}, _options || {});\n this._definition = _stateRegistry.matcher.find(_identifier, this._options.relative);\n }\n\n /** The name of the state this object targets */\n name(): string {\n return this._definition && this._definition.name || this._identifier;\n }\n\n /** The identifier used when creating this TargetState */\n identifier(): StateOrName {\n return this._identifier;\n }\n\n /** The target parameter values */\n params(): RawParams {\n return this._params;\n }\n\n /** The internal state object (if it was found) */\n $state(): StateObject {\n return this._definition;\n }\n\n /** The internal state declaration (if it was found) */\n state(): StateDeclaration {\n return this._definition && this._definition.self;\n }\n\n /** The target options */\n options() {\n return this._options;\n }\n\n /** True if the target state was found */\n exists(): boolean {\n return !!(this._definition && this._definition.self);\n }\n\n /** True if the object is valid */\n valid(): boolean {\n return !this.error();\n }\n\n /** If the object is invalid, returns the reason why */\n error(): string {\n const base = this.options().relative;\n if (!this._definition && !!base) {\n const stateName = base.name ? base.name : base;\n return `Could not resolve '${this.name()}' from state '${stateName}'`;\n }\n if (!this._definition)\n return `No such state '${this.name()}'`;\n if (!this._definition.self)\n return `State '${this.name()}' has an invalid definition`;\n }\n\n toString() {\n return `'${this.name()}'${stringify(this.params())}`;\n }\n\n /**\n * Returns a copy of this TargetState which targets a different state.\n * The new TargetState has the same parameter values and transition options.\n *\n * @param state The new state that should be targeted\n */\n withState(state: StateOrName): TargetState {\n return new TargetState(this._stateRegistry, state, this._params, this._options);\n }\n\n /**\n * Returns a copy of this TargetState, using the specified parameter values.\n *\n * @param params the new parameter values to use\n * @param replace When false (default) the new parameter values will be merged with the current values.\n * When true the parameter values will be used instead of the current values.\n */\n withParams(params: RawParams, replace = false): TargetState {\n const newParams: RawParams = replace ? params : extend({}, this._params, params);\n return new TargetState(this._stateRegistry, this._identifier, newParams, this._options);\n }\n\n /**\n * Returns a copy of this TargetState, using the specified Transition Options.\n *\n * @param options the new options to use\n * @param replace When false (default) the new options will be merged with the current options.\n * When true the options will be used instead of the current options.\n */\n withOptions(options: TransitionOptions, replace = false): TargetState {\n const newOpts = replace ? options : extend({}, this._options, options);\n return new TargetState(this._stateRegistry, this._identifier, this._params, newOpts);\n }\n}\n", + "/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport { TransitionHookOptions, HookResult, TransitionHookPhase } from './interface';\nimport { defaults, noop, silentRejection } from '../common/common';\nimport { fnToString, maxLength } from '../common/strings';\nimport { isPromise } from '../common/predicates';\nimport { is, parse } from '../common/hof';\nimport { trace } from '../common/trace';\nimport { services } from '../common/coreservices';\nimport { Rejection } from './rejectFactory';\nimport { TargetState } from '../state/targetState';\nimport { Transition } from './transition';\nimport { TransitionEventType } from './transitionEventType';\nimport { RegisteredHook } from './hookRegistry';\nimport { StateDeclaration } from '../state/interface';\n\nconst defaultOptions: TransitionHookOptions = {\n current: noop,\n transition: null,\n traceData: {},\n bind: null,\n};\n\nexport type GetResultHandler = (hook: TransitionHook) => ResultHandler;\nexport type GetErrorHandler = (hook: TransitionHook) => ErrorHandler;\n\nexport type ResultHandler = (result: HookResult) => Promise;\nexport type ErrorHandler = (error: any) => Promise;\n\n/** @hidden */\nexport class TransitionHook {\n type: TransitionEventType;\n\n /**\n * These GetResultHandler(s) are used by [[invokeHook]] below\n * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]])\n */\n static HANDLE_RESULT: GetResultHandler = (hook: TransitionHook) => (result: HookResult) =>\n hook.handleHookResult(result);\n\n /**\n * If the result is a promise rejection, log it.\n * Otherwise, ignore the result.\n */\n static LOG_REJECTED_RESULT: GetResultHandler = (hook: TransitionHook) => (result: HookResult) => {\n isPromise(result) && result.catch(err =>\n hook.logError(Rejection.normalize(err)));\n return undefined;\n }\n\n /**\n * These GetErrorHandler(s) are used by [[invokeHook]] below\n * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]])\n */\n static LOG_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) =>\n hook.logError(error);\n\n static REJECT_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) =>\n silentRejection(error);\n\n static THROW_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) => {\n throw error;\n }\n\n /**\n * Chains together an array of TransitionHooks.\n *\n * Given a list of [[TransitionHook]] objects, chains them together.\n * Each hook is invoked after the previous one completes.\n *\n * #### Example:\n * ```js\n * var hooks: TransitionHook[] = getHooks();\n * let promise: Promise = TransitionHook.chain(hooks);\n *\n * promise.then(handleSuccess, handleError);\n * ```\n *\n * @param hooks the list of hooks to chain together\n * @param waitFor if provided, the chain is `.then()`'ed off this promise\n * @returns a `Promise` for sequentially invoking the hooks (in order)\n */\n static chain(hooks: TransitionHook[], waitFor?: Promise): Promise {\n // Chain the next hook off the previous\n const createHookChainR = (prev: Promise, nextHook: TransitionHook) =>\n prev.then(() => nextHook.invokeHook());\n return hooks.reduce(createHookChainR, waitFor || services.$q.when());\n }\n\n\n /**\n * Invokes all the provided TransitionHooks, in order.\n * Each hook's return value is checked.\n * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned.\n * If no hook returns a promise, then all hooks are processed synchronously.\n *\n * @param hooks the list of TransitionHooks to invoke\n * @param doneCallback a callback that is invoked after all the hooks have successfully completed\n *\n * @returns a promise for the async result, or the result of the callback\n */\n static invokeHooks(hooks: TransitionHook[], doneCallback: (result?: HookResult) => T): Promise | T {\n for (let idx = 0; idx < hooks.length; idx++) {\n const hookResult = hooks[idx].invokeHook();\n\n if (isPromise(hookResult)) {\n const remainingHooks = hooks.slice(idx + 1);\n\n return TransitionHook.chain(remainingHooks, hookResult)\n .then(doneCallback);\n }\n }\n\n return doneCallback();\n }\n\n /**\n * Run all TransitionHooks, ignoring their return value.\n */\n static runAllHooks(hooks: TransitionHook[]): void {\n hooks.forEach(hook => hook.invokeHook());\n }\n\n constructor(private transition: Transition,\n private stateContext: StateDeclaration,\n private registeredHook: RegisteredHook,\n private options: TransitionHookOptions) {\n this.options = defaults(options, defaultOptions);\n this.type = registeredHook.eventType;\n }\n\n private isSuperseded = () =>\n this.type.hookPhase === TransitionHookPhase.RUN && !this.options.transition.isActive();\n\n logError(err): any {\n this.transition.router.stateService.defaultErrorHandler()(err);\n }\n\n invokeHook(): Promise | void {\n const hook = this.registeredHook;\n if (hook._deregistered) return;\n\n const notCurrent = this.getNotCurrentRejection();\n if (notCurrent) return notCurrent;\n\n const options = this.options;\n trace.traceHookInvocation(this, this.transition, options);\n\n const invokeCallback = () =>\n hook.callback.call(options.bind, this.transition, this.stateContext);\n\n const normalizeErr = err =>\n Rejection.normalize(err).toPromise();\n\n const handleError = err =>\n hook.eventType.getErrorHandler(this)(err);\n\n const handleResult = result =>\n hook.eventType.getResultHandler(this)(result);\n\n try {\n const result = invokeCallback();\n\n if (!this.type.synchronous && isPromise(result)) {\n return result.catch(normalizeErr)\n .then(handleResult, handleError);\n } else {\n return handleResult(result);\n }\n } catch (err) {\n // If callback throws (synchronously)\n return handleError(Rejection.normalize(err));\n } finally {\n if (hook.invokeLimit && ++hook.invokeCount >= hook.invokeLimit) {\n hook.deregister();\n }\n }\n }\n\n /**\n * This method handles the return value of a Transition Hook.\n *\n * A hook can return false (cancel), a TargetState (redirect),\n * or a promise (which may later resolve to false or a redirect)\n *\n * This also handles \"transition superseded\" -- when a new transition\n * was started while the hook was still running\n */\n handleHookResult(result: HookResult): Promise {\n const notCurrent = this.getNotCurrentRejection();\n if (notCurrent) return notCurrent;\n\n // Hook returned a promise\n if (isPromise(result)) {\n // Wait for the promise, then reprocess with the resulting value\n return result.then(val => this.handleHookResult(val));\n }\n\n trace.traceHookResult(result, this.transition, this.options);\n\n // Hook returned false\n if (result === false) {\n // Abort this Transition\n return Rejection.aborted('Hook aborted transition').toPromise();\n }\n\n const isTargetState = is(TargetState);\n // hook returned a TargetState\n if (isTargetState(result)) {\n // Halt the current Transition and redirect (a new Transition) to the TargetState.\n return Rejection.redirected(result).toPromise();\n }\n }\n\n\n /**\n * Return a Rejection promise if the transition is no longer current due\n * to a stopped router (disposed), or a new transition has started and superseded this one.\n */\n private getNotCurrentRejection() {\n const router = this.transition.router;\n\n // The router is stopped\n if (router._disposed) {\n return Rejection.aborted(`UIRouter instance #${router.$id} has been stopped (disposed)`).toPromise();\n }\n\n if (this.transition._aborted) {\n return Rejection.aborted().toPromise();\n }\n\n // This transition is no longer current.\n // Another transition started while this hook was still running.\n if (this.isSuperseded()) {\n // Abort this transition\n return Rejection.superseded(this.options.current()).toPromise();\n }\n }\n\n toString() {\n const { options, registeredHook } = this;\n const event = parse('traceData.hookType')(options) || 'internal',\n context = parse('traceData.context.state.name')(options) || parse('traceData.context')(options) || 'unknown',\n name = fnToString(registeredHook.callback);\n return `${event} context: ${context}, ${maxLength(200, name)}`;\n }\n\n}\n", + "/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\nimport { extend, removeFrom, tail, values, identity, map } from '../common/common';\nimport { isString, isFunction } from '../common/predicates';\nimport { PathNode } from '../path/pathNode';\nimport {\n TransitionStateHookFn, TransitionHookFn, TransitionHookPhase, TransitionHookScope, IHookRegistry, PathType,\n} from './interface'; // has or is using\n\nimport {\n HookRegOptions, HookMatchCriteria, TreeChanges,\n HookMatchCriterion, IMatchingNodes, HookFn,\n} from './interface';\nimport { Glob } from '../common/glob';\nimport { StateObject } from '../state/stateObject';\nimport { TransitionEventType } from './transitionEventType';\nimport { TransitionService } from './transitionService';\n\n/**\n * Determines if the given state matches the matchCriteria\n *\n * @hidden\n *\n * @param state a State Object to test against\n * @param criterion\n * - If a string, matchState uses the string as a glob-matcher against the state name\n * - If an array (of strings), matchState uses each string in the array as a glob-matchers against the state name\n * and returns a positive match if any of the globs match.\n * - If a function, matchState calls the function with the state and returns true if the function's result is truthy.\n * @returns {boolean}\n */\nexport function matchState(state: StateObject, criterion: HookMatchCriterion) {\n const toMatch = isString(criterion) ? [criterion] : criterion;\n\n function matchGlobs(_state: StateObject) {\n const globStrings = toMatch;\n for (let i = 0; i < globStrings.length; i++) {\n const glob = new Glob(globStrings[i]);\n\n if ((glob && glob.matches(_state.name)) || (!glob && globStrings[i] === _state.name)) {\n return true;\n }\n }\n return false;\n }\n\n const matchFn = (isFunction(toMatch) ? toMatch : matchGlobs);\n return !!matchFn(state);\n}\n\n/**\n * @internalapi\n * The registration data for a registered transition hook\n */\nexport class RegisteredHook {\n priority: number;\n bind: any;\n invokeCount = 0;\n invokeLimit: number;\n _deregistered = false;\n\n constructor(public tranSvc: TransitionService,\n public eventType: TransitionEventType,\n public callback: HookFn,\n public matchCriteria: HookMatchCriteria,\n public removeHookFromRegistry: (hook: RegisteredHook) => void,\n options: HookRegOptions = {} as any) {\n this.priority = options.priority || 0;\n this.bind = options.bind || null;\n this.invokeLimit = options.invokeLimit;\n }\n\n /**\n * Gets the matching [[PathNode]]s\n *\n * Given an array of [[PathNode]]s, and a [[HookMatchCriterion]], returns an array containing\n * the [[PathNode]]s that the criteria matches, or `null` if there were no matching nodes.\n *\n * Returning `null` is significant to distinguish between the default\n * \"match-all criterion value\" of `true` compared to a `() => true` function,\n * when the nodes is an empty array.\n *\n * This is useful to allow a transition match criteria of `entering: true`\n * to still match a transition, even when `entering === []`. Contrast that\n * with `entering: (state) => true` which only matches when a state is actually\n * being entered.\n */\n private _matchingNodes(nodes: PathNode[], criterion: HookMatchCriterion): PathNode[] {\n if (criterion === true) return nodes;\n const matching = nodes.filter(node => matchState(node.state, criterion));\n return matching.length ? matching : null;\n }\n\n /**\n * Gets the default match criteria (all `true`)\n *\n * Returns an object which has all the criteria match paths as keys and `true` as values, i.e.:\n *\n * ```js\n * {\n * to: true,\n * from: true,\n * entering: true,\n * exiting: true,\n * retained: true,\n * }\n */\n private _getDefaultMatchCriteria(): HookMatchCriteria {\n return map(this.tranSvc._pluginapi._getPathTypes(), () => true);\n }\n\n /**\n * Gets matching nodes as [[IMatchingNodes]]\n *\n * Create a IMatchingNodes object from the TransitionHookTypes that is roughly equivalent to:\n *\n * ```js\n * let matches: IMatchingNodes = {\n * to: _matchingNodes([tail(treeChanges.to)], mc.to),\n * from: _matchingNodes([tail(treeChanges.from)], mc.from),\n * exiting: _matchingNodes(treeChanges.exiting, mc.exiting),\n * retained: _matchingNodes(treeChanges.retained, mc.retained),\n * entering: _matchingNodes(treeChanges.entering, mc.entering),\n * };\n * ```\n */\n private _getMatchingNodes(treeChanges: TreeChanges): IMatchingNodes {\n const criteria = extend(this._getDefaultMatchCriteria(), this.matchCriteria);\n const paths: PathType[] = values(this.tranSvc._pluginapi._getPathTypes());\n\n return paths.reduce((mn: IMatchingNodes, pathtype: PathType) => {\n // STATE scope criteria matches against every node in the path.\n // TRANSITION scope criteria matches against only the last node in the path\n const isStateHook = pathtype.scope === TransitionHookScope.STATE;\n const path = treeChanges[pathtype.name] || [];\n const nodes: PathNode[] = isStateHook ? path : [tail(path)];\n\n mn[pathtype.name] = this._matchingNodes(nodes, criteria[pathtype.name]);\n return mn;\n }, {} as IMatchingNodes);\n }\n\n /**\n * Determines if this hook's [[matchCriteria]] match the given [[TreeChanges]]\n *\n * @returns an IMatchingNodes object, or null. If an IMatchingNodes object is returned, its values\n * are the matching [[PathNode]]s for each [[HookMatchCriterion]] (to, from, exiting, retained, entering)\n */\n matches(treeChanges: TreeChanges): IMatchingNodes {\n const matches = this._getMatchingNodes(treeChanges);\n\n // Check if all the criteria matched the TreeChanges object\n const allMatched = values(matches).every(identity);\n return allMatched ? matches : null;\n }\n\n deregister() {\n this.removeHookFromRegistry(this);\n this._deregistered = true;\n }\n}\n\n/** @hidden Return a registration function of the requested type. */\nexport function makeEvent(registry: IHookRegistry, transitionService: TransitionService, eventType: TransitionEventType) {\n // Create the object which holds the registered transition hooks.\n const _registeredHooks = registry._registeredHooks = (registry._registeredHooks || {});\n const hooks = _registeredHooks[eventType.name] = [];\n const removeHookFn: (hook: RegisteredHook) => void = removeFrom(hooks);\n\n // Create hook registration function on the IHookRegistry for the event\n registry[eventType.name] = hookRegistrationFn;\n\n function hookRegistrationFn(matchObject, callback, options = {}) {\n const registeredHook = new RegisteredHook(transitionService, eventType, callback, matchObject, removeHookFn, options);\n hooks.push(registeredHook);\n return registeredHook.deregister.bind(registeredHook);\n }\n\n return hookRegistrationFn;\n}\n", + "/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\n\nimport { extend, tail, assertPredicate, unnestR, identity } from '../common/common';\nimport { isArray } from '../common/predicates';\n\nimport {\n TransitionOptions, TransitionHookOptions, IHookRegistry, TreeChanges, IMatchingNodes,\n TransitionHookPhase, TransitionHookScope,\n} from './interface';\n\nimport { Transition } from './transition';\nimport { TransitionHook } from './transitionHook';\nimport { StateObject } from '../state/stateObject';\nimport { PathNode } from '../path/pathNode';\nimport { TransitionService } from './transitionService';\nimport { TransitionEventType } from './transitionEventType';\nimport { RegisteredHook } from './hookRegistry';\n\n/**\n * This class returns applicable TransitionHooks for a specific Transition instance.\n *\n * Hooks ([[RegisteredHook]]) may be registered globally, e.g., $transitions.onEnter(...), or locally, e.g.\n * myTransition.onEnter(...). The HookBuilder finds matching RegisteredHooks (where the match criteria is\n * determined by the type of hook)\n *\n * The HookBuilder also converts RegisteredHooks objects to TransitionHook objects, which are used to run a Transition.\n *\n * The HookBuilder constructor is given the $transitions service and a Transition instance. Thus, a HookBuilder\n * instance may only be used for one specific Transition object. (side note: the _treeChanges accessor is private\n * in the Transition class, so we must also provide the Transition's _treeChanges)\n *\n */\nexport class HookBuilder {\n constructor(private transition: Transition) { }\n\n buildHooksForPhase(phase: TransitionHookPhase): TransitionHook[] {\n const $transitions = this.transition.router.transitionService;\n return $transitions._pluginapi._getEvents(phase)\n .map(type => this.buildHooks(type))\n .reduce(unnestR, [])\n .filter(identity);\n }\n\n /**\n * Returns an array of newly built TransitionHook objects.\n *\n * - Finds all RegisteredHooks registered for the given `hookType` which matched the transition's [[TreeChanges]].\n * - Finds [[PathNode]] (or `PathNode[]`) to use as the TransitionHook context(s)\n * - For each of the [[PathNode]]s, creates a TransitionHook\n *\n * @param hookType the type of the hook registration function, e.g., 'onEnter', 'onFinish'.\n */\n buildHooks(hookType: TransitionEventType): TransitionHook[] {\n const transition = this.transition;\n const treeChanges = transition.treeChanges();\n\n // Find all the matching registered hooks for a given hook type\n const matchingHooks = this.getMatchingHooks(hookType, treeChanges);\n if (!matchingHooks) return [];\n\n const baseHookOptions = {\n transition: transition,\n current: transition.options().current,\n };\n\n const makeTransitionHooks = (hook: RegisteredHook) => {\n // Fetch the Nodes that caused this hook to match.\n const matches: IMatchingNodes = hook.matches(treeChanges);\n // Select the PathNode[] that will be used as TransitionHook context objects\n const matchingNodes: PathNode[] = matches[hookType.criteriaMatchPath.name];\n\n // Return an array of HookTuples\n return matchingNodes.map(node => {\n const _options = extend({\n bind: hook.bind,\n traceData: { hookType: hookType.name, context: node },\n }, baseHookOptions);\n\n const state = hookType.criteriaMatchPath.scope === TransitionHookScope.STATE ? node.state.self : null;\n const transitionHook = new TransitionHook(transition, state, hook, _options);\n return { hook, node, transitionHook };\n });\n };\n\n return matchingHooks.map(makeTransitionHooks)\n .reduce(unnestR, [])\n .sort(tupleSort(hookType.reverseSort))\n .map(tuple => tuple.transitionHook);\n }\n\n /**\n * Finds all RegisteredHooks from:\n * - The Transition object instance hook registry\n * - The TransitionService ($transitions) global hook registry\n *\n * which matched:\n * - the eventType\n * - the matchCriteria (to, from, exiting, retained, entering)\n *\n * @returns an array of matched [[RegisteredHook]]s\n */\n public getMatchingHooks(hookType: TransitionEventType, treeChanges: TreeChanges): RegisteredHook[] {\n const isCreate = hookType.hookPhase === TransitionHookPhase.CREATE;\n\n // Instance and Global hook registries\n const $transitions = this.transition.router.transitionService;\n const registries = isCreate ? [ $transitions ] : [ this.transition, $transitions ];\n\n return registries.map((reg: IHookRegistry) => reg.getHooks(hookType.name)) // Get named hooks from registries\n .filter(assertPredicate(isArray, `broken event named: ${hookType.name}`)) // Sanity check\n .reduce(unnestR, []) // Un-nest RegisteredHook[][] to RegisteredHook[] array\n .filter(hook => hook.matches(treeChanges)); // Only those satisfying matchCriteria\n }\n}\n\ninterface HookTuple { hook: RegisteredHook, node: PathNode, transitionHook: TransitionHook }\n\n/**\n * A factory for a sort function for HookTuples.\n *\n * The sort function first compares the PathNode depth (how deep in the state tree a node is), then compares\n * the EventHook priority.\n *\n * @param reverseDepthSort a boolean, when true, reverses the sort order for the node depth\n * @returns a tuple sort function\n */\nfunction tupleSort(reverseDepthSort = false) {\n return function nodeDepthThenPriority(l: HookTuple, r: HookTuple): number {\n const factor = reverseDepthSort ? -1 : 1;\n const depthDelta = (l.node.state.path.length - r.node.state.path.length) * factor;\n return depthDelta !== 0 ? depthDelta : r.hook.priority - l.hook.priority;\n };\n}\n", + "/**\n * @coreapi\n * @module params\n */\n/** */\nimport { extend, filter, map } from '../common/common';\nimport { isArray, isDefined } from '../common/predicates';\nimport { ParamTypeDefinition } from './interface';\n\n/**\n * An internal class which implements [[ParamTypeDefinition]].\n *\n * A [[ParamTypeDefinition]] is a plain javascript object used to register custom parameter types.\n * When a param type definition is registered, an instance of this class is created internally.\n *\n * This class has naive implementations for all the [[ParamTypeDefinition]] methods.\n *\n * Used by [[UrlMatcher]] when matching or formatting URLs, or comparing and validating parameter values.\n *\n * #### Example:\n * ```js\n * var paramTypeDef = {\n * decode: function(val) { return parseInt(val, 10); },\n * encode: function(val) { return val && val.toString(); },\n * equals: function(a, b) { return this.is(a) && a === b; },\n * is: function(val) { return angular.isNumber(val) && isFinite(val) && val % 1 === 0; },\n * pattern: /\\d+/\n * }\n *\n * var paramType = new ParamType(paramTypeDef);\n * ```\n * @internalapi\n */\nexport class ParamType implements ParamTypeDefinition {\n /** @inheritdoc */\n pattern: RegExp = /.*/;\n /** The name/id of the parameter type */\n name: string;\n /** @inheritdoc */\n raw: boolean;\n /** @inheritdoc */\n dynamic: boolean;\n /** @inheritdoc */\n inherit = true;\n\n /**\n * @param def A configuration object which contains the custom type definition. The object's\n * properties will override the default methods and/or pattern in `ParamType`'s public interface.\n * @returns a new ParamType object\n */\n constructor(def: ParamTypeDefinition) {\n extend(this, def);\n }\n\n\n // consider these four methods to be \"abstract methods\" that should be overridden\n /** @inheritdoc */\n is(val: any, key?: string): boolean { return true; }\n /** @inheritdoc */\n encode(val: any, key?: string): (string|string[]) { return val; }\n /** @inheritdoc */\n decode(val: string, key?: string): any { return val; }\n /** @inheritdoc */\n equals(a: any, b: any): boolean { return a == b; } // tslint:disable-line:triple-equals\n\n\n $subPattern() {\n const sub = this.pattern.toString();\n return sub.substr(1, sub.length - 2);\n }\n\n toString() {\n return `{ParamType:${this.name}}`;\n }\n\n /** Given an encoded string, or a decoded object, returns a decoded object */\n $normalize(val: any) {\n return this.is(val) ? val : this.decode(val);\n }\n\n /**\n * Wraps an existing custom ParamType as an array of ParamType, depending on 'mode'.\n * e.g.:\n * - urlmatcher pattern \"/path?{queryParam[]:int}\"\n * - url: \"/path?queryParam=1&queryParam=2\n * - $stateParams.queryParam will be [1, 2]\n * if `mode` is \"auto\", then\n * - url: \"/path?queryParam=1 will create $stateParams.queryParam: 1\n * - url: \"/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2]\n */\n $asArray(mode: (boolean|'auto'), isSearch: boolean) {\n if (!mode) return this;\n if (mode === 'auto' && !isSearch) throw new Error(\"'auto' array mode is for query parameters only\");\n return new ( ArrayType)(this, mode);\n }\n}\n\n/**\n * Wraps up a `ParamType` object to handle array values.\n * @internalapi\n */\nfunction ArrayType(type: ParamType, mode: (boolean|'auto')) {\n // Wrap non-array value as array\n function arrayWrap(val: any): any[] {\n return isArray(val) ? val : (isDefined(val) ? [ val ] : []);\n }\n\n // Unwrap array value for \"auto\" mode. Return undefined for empty array.\n function arrayUnwrap(val: any) {\n switch (val.length) {\n case 0: return undefined;\n case 1: return mode === 'auto' ? val[0] : val;\n default: return val;\n }\n }\n\n // Wraps type (.is/.encode/.decode) functions to operate on each value of an array\n function arrayHandler(callback: (x: any) => any, allTruthyMode?: boolean) {\n return function handleArray(val: any) {\n if (isArray(val) && val.length === 0) return val;\n const arr = arrayWrap(val);\n const result = map(arr, callback);\n return (allTruthyMode === true) ? filter(result, x => !x).length === 0 : arrayUnwrap(result);\n };\n }\n\n // Wraps type (.equals) functions to operate on each value of an array\n function arrayEqualsHandler(callback: (l: any, r: any) => boolean) {\n return function handleArray(val1: any, val2: any) {\n const left = arrayWrap(val1), right = arrayWrap(val2);\n if (left.length !== right.length) return false;\n for (let i = 0; i < left.length; i++) {\n if (!callback(left[i], right[i])) return false;\n }\n return true;\n };\n }\n\n ['encode', 'decode', 'equals', '$normalize'].forEach(name => {\n const paramTypeFn = type[name].bind(type);\n const wrapperFn: Function = name === 'equals' ? arrayEqualsHandler : arrayHandler;\n this[name] = wrapperFn(paramTypeFn);\n });\n\n extend(this, {\n dynamic: type.dynamic,\n name: type.name,\n pattern: type.pattern,\n inherit: type.inherit,\n is: arrayHandler(type.is.bind(type), true),\n $arrayMode: mode,\n });\n}\n", + "/**\n * @coreapi\n * @module params\n */ /** for typedoc */\nimport { extend, filter, map, allTrueR } from '../common/common';\nimport { prop } from '../common/hof';\nimport { isInjectable, isDefined, isString, isArray, isUndefined } from '../common/predicates';\nimport { RawParams, ParamDeclaration } from '../params/interface';\nimport { services } from '../common/coreservices';\nimport { ParamType } from './paramType';\nimport { ParamTypes } from './paramTypes';\nimport { UrlMatcherFactory } from '../url/urlMatcherFactory';\n\n/** @hidden */\nconst hasOwn = Object.prototype.hasOwnProperty;\n\n/** @hidden */\nconst isShorthand = (cfg: ParamDeclaration) =>\n ['value', 'type', 'squash', 'array', 'dynamic'].filter(hasOwn.bind(cfg || {})).length === 0;\n\n/** @internalapi */\nexport enum DefType {\n PATH,\n SEARCH,\n CONFIG,\n}\n\n/** @hidden */\nfunction unwrapShorthand(cfg: ParamDeclaration): ParamDeclaration {\n cfg = isShorthand(cfg) && { value: cfg } as any || cfg;\n\n getStaticDefaultValue['__cacheable'] = true;\n function getStaticDefaultValue() {\n return cfg.value;\n }\n\n return extend(cfg, {\n $$fn: isInjectable(cfg.value) ? cfg.value : getStaticDefaultValue,\n });\n}\n\n/** @hidden */\nfunction getType(cfg: ParamDeclaration, urlType: ParamType, location: DefType, id: string, paramTypes: ParamTypes) {\n if (cfg.type && urlType && urlType.name !== 'string') throw new Error(`Param '${id}' has two type configurations.`);\n if (cfg.type && urlType && urlType.name === 'string' && paramTypes.type(cfg.type as string)) return paramTypes.type(cfg.type as string);\n if (urlType) return urlType;\n if (!cfg.type) {\n const type = location === DefType.CONFIG ? 'any' :\n location === DefType.PATH ? 'path' :\n location === DefType.SEARCH ? 'query' : 'string';\n return paramTypes.type(type);\n }\n return cfg.type instanceof ParamType ? cfg.type : paramTypes.type(cfg.type as string);\n}\n\n/**\n * @internalapi\n * returns false, true, or the squash value to indicate the \"default parameter url squash policy\".\n */\nfunction getSquashPolicy(config: ParamDeclaration, isOptional: boolean, defaultPolicy: (boolean|string)) {\n const squash = config.squash;\n if (!isOptional || squash === false) return false;\n if (!isDefined(squash) || squash == null) return defaultPolicy;\n if (squash === true || isString(squash)) return squash;\n throw new Error(`Invalid squash policy: '${squash}'. Valid policies: false, true, or arbitrary string`);\n}\n\n/** @internalapi */\nfunction getReplace(config: ParamDeclaration, arrayMode: boolean, isOptional: boolean, squash: (string|boolean)) {\n const defaultPolicy = [\n { from: '', to: (isOptional || arrayMode ? undefined : '') },\n { from: null, to: (isOptional || arrayMode ? undefined : '') },\n ];\n\n const replace = isArray(config.replace) ? config.replace : [];\n if (isString(squash)) replace.push({ from: squash, to: undefined });\n\n const configuredKeys = map(replace, prop('from'));\n return filter(defaultPolicy, item => configuredKeys.indexOf(item.from) === -1).concat(replace);\n}\n\n\n/** @internalapi */\nexport class Param {\n id: string;\n type: ParamType;\n location: DefType;\n isOptional: boolean;\n dynamic: boolean;\n raw: boolean;\n squash: (boolean|string);\n replace: [{ to: any, from: any }];\n inherit: boolean;\n array: boolean;\n config: any;\n /** Cache the default value if it is a static value */\n _defaultValueCache: {\n defaultValue: any,\n };\n\n static values(params: Param[], values: RawParams = {}): RawParams {\n const paramValues = {} as RawParams;\n for (const param of params) {\n paramValues[param.id] = param.value(values[param.id]);\n }\n return paramValues;\n }\n\n /**\n * Finds [[Param]] objects which have different param values\n *\n * Filters a list of [[Param]] objects to only those whose parameter values differ in two param value objects\n *\n * @param params: The list of Param objects to filter\n * @param values1: The first set of parameter values\n * @param values2: the second set of parameter values\n *\n * @returns any Param objects whose values were different between values1 and values2\n */\n static changed(params: Param[], values1: RawParams = {}, values2: RawParams = {}): Param[] {\n return params.filter(param => !param.type.equals(values1[param.id], values2[param.id]));\n }\n\n /**\n * Checks if two param value objects are equal (for a set of [[Param]] objects)\n *\n * @param params The list of [[Param]] objects to check\n * @param values1 The first set of param values\n * @param values2 The second set of param values\n *\n * @returns true if the param values in values1 and values2 are equal\n */\n static equals(params: Param[], values1 = {}, values2 = {}): boolean {\n return Param.changed(params, values1, values2).length === 0;\n }\n\n /** Returns true if a the parameter values are valid, according to the Param definitions */\n static validates(params: Param[], values: RawParams = {}): boolean {\n return params.map(param => param.validates(values[param.id])).reduce(allTrueR, true);\n }\n\n constructor(id: string, type: ParamType, config: ParamDeclaration, location: DefType, urlMatcherFactory: UrlMatcherFactory) {\n config = unwrapShorthand(config);\n type = getType(config, type, location, id, urlMatcherFactory.paramTypes);\n const arrayMode = getArrayMode();\n type = arrayMode ? type.$asArray(arrayMode, location === DefType.SEARCH) : type;\n const isOptional = config.value !== undefined || location === DefType.SEARCH;\n const dynamic = isDefined(config.dynamic) ? !!config.dynamic : !!type.dynamic;\n const raw = isDefined(config.raw) ? !!config.raw : !!type.raw;\n const squash = getSquashPolicy(config, isOptional, urlMatcherFactory.defaultSquashPolicy());\n const replace = getReplace(config, arrayMode, isOptional, squash);\n const inherit = isDefined(config.inherit) ? !!config.inherit : !!type.inherit;\n\n // array config: param name (param[]) overrides default settings. explicit config overrides param name.\n function getArrayMode() {\n const arrayDefaults = { array: (location === DefType.SEARCH ? 'auto' : false) };\n const arrayParamNomenclature = id.match(/\\[\\]$/) ? { array: true } : {};\n return extend(arrayDefaults, arrayParamNomenclature, config).array;\n }\n\n extend(this, { id, type, location, isOptional, dynamic, raw, squash, replace, inherit, array: arrayMode, config });\n }\n\n isDefaultValue(value: any): boolean {\n return this.isOptional && this.type.equals(this.value(), value);\n }\n\n /**\n * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the\n * default value, which may be the result of an injectable function.\n */\n value(value?: any): any {\n /**\n * [Internal] Get the default value of a parameter, which may be an injectable function.\n */\n const getDefaultValue = () => {\n if (this._defaultValueCache) return this._defaultValueCache.defaultValue;\n\n if (!services.$injector) throw new Error('Injectable functions cannot be called at configuration time');\n\n const defaultValue = services.$injector.invoke(this.config.$$fn);\n\n if (defaultValue !== null && defaultValue !== undefined && !this.type.is(defaultValue))\n throw new Error(`Default value (${defaultValue}) for parameter '${this.id}' is not an instance of ParamType (${this.type.name})`);\n\n if (this.config.$$fn['__cacheable']) {\n this._defaultValueCache = { defaultValue };\n }\n\n return defaultValue;\n };\n\n const replaceSpecialValues = (val: any) => {\n for (const tuple of this.replace) {\n if (tuple.from === val) return tuple.to;\n }\n return val;\n };\n\n value = replaceSpecialValues(value);\n\n return isUndefined(value) ? getDefaultValue() : this.type.$normalize(value);\n }\n\n isSearch(): boolean {\n return this.location === DefType.SEARCH;\n }\n\n validates(value: any): boolean {\n // There was no parameter value, but the param is optional\n if ((isUndefined(value) || value === null) && this.isOptional) return true;\n\n // The value was not of the correct ParamType, and could not be decoded to the correct ParamType\n const normalized = this.type.$normalize(value);\n if (!this.type.is(normalized)) return false;\n\n // The value was of the correct type, but when encoded, did not match the ParamType's regexp\n const encoded = this.type.encode(normalized);\n return !(isString(encoded) && !this.type.pattern.exec( encoded));\n }\n\n toString() {\n return `{Param:${this.id} ${this.type} squash: '${this.squash}' optional: ${this.isOptional}}`;\n }\n}\n", + "/** @module path */ /** for typedoc */\nimport { extend, applyPairs, find, allTrueR, pairs, arrayTuples } from '../common/common';\nimport { propEq } from '../common/hof';\nimport { StateObject } from '../state/stateObject';\nimport { RawParams } from '../params/interface';\nimport { Param } from '../params/param';\nimport { Resolvable } from '../resolve/resolvable';\nimport { ViewConfig } from '../view/interface';\n\n/**\n * @internalapi\n *\n * A node in a [[TreeChanges]] path\n *\n * For a [[TreeChanges]] path, this class holds the stateful information for a single node in the path.\n * Each PathNode corresponds to a state being entered, exited, or retained.\n * The stateful information includes parameter values and resolve data.\n */\nexport class PathNode {\n /** The state being entered, exited, or retained */\n public state: StateObject;\n /** The parameters declared on the state */\n public paramSchema: Param[];\n /** The parameter values that belong to the state */\n public paramValues: { [key: string]: any };\n /** The individual (stateful) resolvable objects that belong to the state */\n public resolvables: Resolvable[];\n /** The state's declared view configuration objects */\n public views: ViewConfig[];\n\n /** Returns a clone of the PathNode */\n static clone(node: PathNode) {\n return new PathNode(node);\n }\n\n /** Creates a copy of a PathNode */\n constructor(node: PathNode);\n /** Creates a new (empty) PathNode for a State */\n constructor(state: StateObject);\n constructor(stateOrNode: any) {\n if (stateOrNode instanceof PathNode) {\n const node: PathNode = stateOrNode;\n this.state = node.state;\n this.paramSchema = node.paramSchema.slice();\n this.paramValues = extend({}, node.paramValues);\n this.resolvables = node.resolvables.slice();\n this.views = node.views && node.views.slice();\n } else {\n const state: StateObject = stateOrNode;\n this.state = state;\n this.paramSchema = state.parameters({ inherit: false });\n this.paramValues = {};\n this.resolvables = state.resolvables.map(res => res.clone());\n }\n }\n\n /** Sets [[paramValues]] for the node, from the values of an object hash */\n applyRawParams(params: RawParams): PathNode {\n const getParamVal = (paramDef: Param) => [ paramDef.id, paramDef.value(params[paramDef.id]) ];\n this.paramValues = this.paramSchema.reduce((memo, pDef) => applyPairs(memo, getParamVal(pDef)), {});\n return this;\n }\n\n /** Gets a specific [[Param]] metadata that belongs to the node */\n parameter(name: string): Param {\n return find(this.paramSchema, propEq('id', name));\n }\n\n /**\n * @returns true if the state and parameter values for another PathNode are\n * equal to the state and param values for this PathNode\n */\n equals(node: PathNode, paramsFn?: GetParamsFn): boolean {\n const diff = this.diff(node, paramsFn);\n return diff && diff.length === 0;\n }\n\n /**\n * Finds Params with different parameter values on another PathNode.\n *\n * Given another node (of the same state), finds the parameter values which differ.\n * Returns the [[Param]] (schema objects) whose parameter values differ.\n *\n * Given another node for a different state, returns `false`\n *\n * @param node The node to compare to\n * @param paramsFn A function that returns which parameters should be compared.\n * @returns The [[Param]]s which differ, or null if the two nodes are for different states\n */\n diff(node: PathNode, paramsFn?: GetParamsFn): Param[] | false {\n if (this.state !== node.state) return false;\n\n const params: Param[] = paramsFn ? paramsFn(this) : this.paramSchema;\n return Param.changed(params, this.paramValues, node.paramValues);\n }\n}\n\n/** @hidden */\nexport type GetParamsFn = (pathNode: PathNode) => Param[];\n", + "/** @module path */ /** for typedoc */\n\nimport {\n extend, find, pick, omit, tail, mergeR, values, unnestR, Predicate, inArray, arrayTuples,\n} from '../common/common';\nimport { prop, propEq, not } from '../common/hof';\n\nimport { RawParams } from '../params/interface';\nimport { TreeChanges } from '../transition/interface';\nimport { ViewConfig } from '../view/interface';\nimport { _ViewDeclaration } from '../state/interface';\n\nimport { StateObject } from '../state/stateObject';\nimport { TargetState } from '../state/targetState';\nimport { GetParamsFn, PathNode } from './pathNode';\nimport { ViewService } from '../view/view';\nimport { Param } from '../params/param';\nimport { StateRegistry } from '../state';\n\n/**\n * This class contains functions which convert TargetStates, Nodes and paths from one type to another.\n */\nexport class PathUtils {\n /** Given a PathNode[], create an TargetState */\n static makeTargetState(registry: StateRegistry, path: PathNode[]): TargetState {\n const state = tail(path).state;\n return new TargetState(registry, state, path.map(prop('paramValues')).reduce(mergeR, {}), {});\n }\n\n static buildPath(targetState: TargetState) {\n const toParams = targetState.params();\n return targetState.$state().path.map(state => new PathNode(state).applyRawParams(toParams));\n }\n\n /** Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[] */\n static buildToPath(fromPath: PathNode[], targetState: TargetState): PathNode[] {\n const toPath: PathNode[] = PathUtils.buildPath(targetState);\n if (targetState.options().inherit) {\n return PathUtils.inheritParams(fromPath, toPath, Object.keys(targetState.params()));\n }\n return toPath;\n }\n\n /**\n * Creates ViewConfig objects and adds to nodes.\n *\n * On each [[PathNode]], creates ViewConfig objects from the views: property of the node's state\n */\n static applyViewConfigs($view: ViewService, path: PathNode[], states: StateObject[]) {\n // Only apply the viewConfigs to the nodes for the given states\n path.filter(node => inArray(states, node.state)).forEach(node => {\n const viewDecls: _ViewDeclaration[] = values(node.state.views || {});\n const subPath = PathUtils.subPath(path, n => n === node);\n const viewConfigs: ViewConfig[][] = viewDecls.map(view => $view.createViewConfig(subPath, view));\n node.views = viewConfigs.reduce(unnestR, []);\n });\n }\n\n /**\n * Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath\n *\n * For a parameter in a node to be inherited from the from path:\n * - The toPath's node must have a matching node in the fromPath (by state).\n * - The parameter name must not be found in the toKeys parameter array.\n *\n * Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some\n * caller, for instance, $state.transitionTo(..., toParams). If a key was found in toParams,\n * it is not inherited from the fromPath.\n */\n static inheritParams(fromPath: PathNode[], toPath: PathNode[], toKeys: string[] = []): PathNode[] {\n function nodeParamVals(path: PathNode[], state: StateObject): RawParams {\n const node: PathNode = find(path, propEq('state', state));\n return extend({}, node && node.paramValues);\n }\n\n const noInherit = fromPath.map(node => node.paramSchema)\n .reduce(unnestR, [])\n .filter(param => !param.inherit)\n .map(prop('id'));\n\n /**\n * Given an [[PathNode]] \"toNode\", return a new [[PathNode]] with param values inherited from the\n * matching node in fromPath. Only inherit keys that aren't found in \"toKeys\" from the node in \"fromPath\"\"\n */\n function makeInheritedParamsNode(toNode: PathNode): PathNode {\n // All param values for the node (may include default key/vals, when key was not found in toParams)\n let toParamVals = extend({}, toNode && toNode.paramValues);\n // limited to only those keys found in toParams\n const incomingParamVals = pick(toParamVals, toKeys);\n toParamVals = omit(toParamVals, toKeys);\n const fromParamVals = omit(nodeParamVals(fromPath, toNode.state) || {}, noInherit);\n // extend toParamVals with any fromParamVals, then override any of those those with incomingParamVals\n const ownParamVals: RawParams = extend(toParamVals, fromParamVals, incomingParamVals);\n return new PathNode(toNode.state).applyRawParams(ownParamVals);\n }\n\n // The param keys specified by the incoming toParams\n return toPath.map(makeInheritedParamsNode);\n }\n\n static nonDynamicParams = (node: PathNode): Param[] =>\n node.state.parameters({ inherit: false })\n .filter(param => !param.dynamic);\n\n /**\n * Computes the tree changes (entering, exiting) between a fromPath and toPath.\n */\n static treeChanges(fromPath: PathNode[], toPath: PathNode[], reloadState: StateObject): TreeChanges {\n const max = Math.min(fromPath.length, toPath.length);\n let keep = 0;\n\n const nodesMatch = (node1: PathNode, node2: PathNode) =>\n node1.equals(node2, PathUtils.nonDynamicParams);\n\n while (keep < max && fromPath[keep].state !== reloadState && nodesMatch(fromPath[keep], toPath[keep])) {\n keep++;\n }\n\n /** Given a retained node, return a new node which uses the to node's param values */\n function applyToParams(retainedNode: PathNode, idx: number): PathNode {\n const cloned = PathNode.clone(retainedNode);\n cloned.paramValues = toPath[idx].paramValues;\n return cloned;\n }\n\n let from: PathNode[], retained: PathNode[], exiting: PathNode[], entering: PathNode[], to: PathNode[];\n\n from = fromPath;\n retained = from.slice(0, keep).map(applyToParams); // applyToParams to update dynamic params\n exiting = from.slice(keep);\n entering = toPath.slice(keep);\n to = (retained).concat(entering);\n\n return { from, to, retained, exiting, entering };\n }\n\n /**\n * Returns a new path which is: the subpath of the first path which matches the second path.\n *\n * The new path starts from root and contains any nodes that match the nodes in the second path.\n * It stops before the first non-matching node.\n *\n * Nodes are compared using their state property and their parameter values.\n * If a `paramsFn` is provided, only the [[Param]] returned by the function will be considered when comparing nodes.\n *\n * @param pathA the first path\n * @param pathB the second path\n * @param paramsFn a function which returns the parameters to consider when comparing\n *\n * @returns an array of PathNodes from the first path which match the nodes in the second path\n */\n static matching(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): PathNode[] {\n let done = false;\n const tuples: PathNode[][] = arrayTuples(pathA, pathB);\n return tuples.reduce((matching, [nodeA, nodeB]) => {\n done = done || !nodeA.equals(nodeB, paramsFn);\n return done ? matching : matching.concat(nodeA);\n }, []);\n }\n\n /**\n * Returns true if two paths are identical.\n *\n * @param pathA\n * @param pathB\n * @param paramsFn a function which returns the parameters to consider when comparing\n * @returns true if the the states and parameter values for both paths are identical\n */\n static equals(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): boolean {\n return pathA.length === pathB.length &&\n PathUtils.matching(pathA, pathB, paramsFn).length === pathA.length;\n }\n\n /**\n * Return a subpath of a path, which stops at the first matching node\n *\n * Given an array of nodes, returns a subset of the array starting from the first node,\n * stopping when the first node matches the predicate.\n *\n * @param path a path of [[PathNode]]s\n * @param predicate a [[Predicate]] fn that matches [[PathNode]]s\n * @returns a subpath up to the matching node, or undefined if no match is found\n */\n static subPath(path: PathNode[], predicate: Predicate): PathNode[] {\n const node = find(path, predicate);\n const elementIdx = path.indexOf(node);\n return elementIdx === -1 ? undefined : path.slice(0, elementIdx + 1);\n }\n\n /** Gets the raw parameter values from a path */\n static paramValues = (path: PathNode[]) =>\n path.reduce((acc, node) => extend(acc, node.paramValues), {});\n}\n", + "/**\n * @coreapi\n * @module resolve\n */ /** for typedoc */\nimport { extend, equals, inArray, identity } from '../common/common';\nimport { services } from '../common/coreservices';\nimport { trace } from '../common/trace';\nimport { ResolvePolicy, ResolvableLiteral, resolvePolicies } from './interface';\n\nimport { ResolveContext } from './resolveContext';\nimport { stringify } from '../common/strings';\nimport { isFunction, isObject } from '../common/predicates';\nimport { Transition } from '../transition/transition';\nimport { StateObject } from '../state/stateObject';\nimport { PathNode } from '../path/pathNode';\nimport { isNullOrUndefined } from '../common/predicates';\n\n\n// TODO: explicitly make this user configurable\nexport let defaultResolvePolicy: ResolvePolicy = {\n when: 'LAZY',\n async: 'WAIT',\n};\n\n/**\n * The basic building block for the resolve system.\n *\n * Resolvables encapsulate a state's resolve's resolveFn, the resolveFn's declared dependencies, the wrapped (.promise),\n * and the unwrapped-when-complete (.data) result of the resolveFn.\n *\n * Resolvable.get() either retrieves the Resolvable's existing promise, or else invokes resolve() (which invokes the\n * resolveFn) and returns the resulting promise.\n *\n * Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first\n * parameter to those fns.\n */\nexport class Resolvable implements ResolvableLiteral {\n token: any;\n policy: ResolvePolicy;\n resolveFn: Function;\n deps: any[];\n\n data: any;\n resolved = false;\n promise: Promise = undefined;\n\n static fromData = (token: any, data: any) =>\n new Resolvable(token, () => data, null, null, data);\n\n /** This constructor creates a Resolvable copy */\n constructor(resolvable: Resolvable)\n\n /** This constructor creates a new Resolvable from the plain old [[ResolvableLiteral]] javascript object */\n constructor(resolvable: ResolvableLiteral)\n\n /**\n * This constructor creates a new `Resolvable`\n *\n * #### Example:\n * ```js\n * var resolvable1 = new Resolvable('mytoken', http => http.get('foo.json').toPromise(), [Http]);\n *\n * var resolvable2 = new Resolvable(UserService, dep => new UserService(dep.data), [SomeDependency]);\n *\n * var resolvable1Clone = new Resolvable(resolvable1);\n * ```\n *\n * @param token The new resolvable's injection token, such as `\"userList\"` (a string) or `UserService` (a class).\n * When this token is used during injection, the resolved value will be injected.\n * @param resolveFn The function that returns the resolved value, or a promise for the resolved value\n * @param deps An array of dependencies, which will be injected into the `resolveFn`\n * @param policy the [[ResolvePolicy]] defines when and how the Resolvable is processed\n * @param data Pre-resolved data. If the resolve value is already known, it may be provided here.\n */\n constructor(token: any, resolveFn: Function, deps?: any[], policy?: ResolvePolicy, data?: any)\n constructor(arg1: any, resolveFn?: Function, deps?: any[], policy?: ResolvePolicy, data?: any) {\n if (arg1 instanceof Resolvable) {\n extend(this, arg1);\n } else if (isFunction(resolveFn)) {\n if (isNullOrUndefined(arg1)) throw new Error('new Resolvable(): token argument is required');\n if (!isFunction(resolveFn)) throw new Error('new Resolvable(): resolveFn argument must be a function');\n\n this.token = arg1;\n this.policy = policy;\n this.resolveFn = resolveFn;\n this.deps = deps || [];\n\n this.data = data;\n this.resolved = data !== undefined;\n this.promise = this.resolved ? services.$q.when(this.data) : undefined;\n } else if (isObject(arg1) && arg1.token && isFunction(arg1.resolveFn)) {\n const literal = arg1;\n return new Resolvable(literal.token, literal.resolveFn, literal.deps, literal.policy, literal.data);\n }\n }\n\n getPolicy(state: StateObject): ResolvePolicy {\n const thisPolicy = this.policy || {};\n const statePolicy = state && state.resolvePolicy || {};\n return {\n when: thisPolicy.when || statePolicy.when || defaultResolvePolicy.when,\n async: thisPolicy.async || statePolicy.async || defaultResolvePolicy.async,\n };\n }\n\n /**\n * Asynchronously resolve this Resolvable's data\n *\n * Given a ResolveContext that this Resolvable is found in:\n * Wait for this Resolvable's dependencies, then invoke this Resolvable's function\n * and update the Resolvable's state\n */\n resolve(resolveContext: ResolveContext, trans?: Transition) {\n const $q = services.$q;\n\n // Gets all dependencies from ResolveContext and wait for them to be resolved\n const getResolvableDependencies = () =>\n $q.all(resolveContext.getDependencies(this).map(resolvable =>\n resolvable.get(resolveContext, trans))) as Promise;\n\n // Invokes the resolve function passing the resolved dependencies as arguments\n const invokeResolveFn = (resolvedDeps: any[]) =>\n this.resolveFn.apply(null, resolvedDeps);\n\n /**\n * For RXWAIT policy:\n *\n * Given an observable returned from a resolve function:\n * - enables .cache() mode (this allows multicast subscribers)\n * - then calls toPromise() (this triggers subscribe() and thus fetches)\n * - Waits for the promise, then return the cached observable (not the first emitted value).\n */\n const waitForRx = (observable$: any) => {\n const cached = observable$.cache(1);\n return cached.take(1).toPromise().then(() => cached);\n };\n\n // If the resolve policy is RXWAIT, wait for the observable to emit something. otherwise pass through.\n const node: PathNode = resolveContext.findNode(this);\n const state: StateObject = node && node.state;\n const maybeWaitForRx = this.getPolicy(state).async === 'RXWAIT' ? waitForRx : identity;\n\n // After the final value has been resolved, update the state of the Resolvable\n const applyResolvedValue = (resolvedValue: any) => {\n this.data = resolvedValue;\n this.resolved = true;\n trace.traceResolvableResolved(this, trans);\n return this.data;\n };\n\n // Sets the promise property first, then getsResolvableDependencies in the context of the promise chain. Always waits one tick.\n return this.promise = $q.when()\n .then(getResolvableDependencies)\n .then(invokeResolveFn)\n .then(maybeWaitForRx)\n .then(applyResolvedValue);\n }\n\n /**\n * Gets a promise for this Resolvable's data.\n *\n * Fetches the data and returns a promise.\n * Returns the existing promise if it has already been fetched once.\n */\n get(resolveContext: ResolveContext, trans?: Transition): Promise {\n return this.promise || this.resolve(resolveContext, trans);\n }\n\n toString() {\n return `Resolvable(token: ${stringify(this.token)}, requires: [${this.deps.map(stringify)}])`;\n }\n\n clone(): Resolvable {\n return new Resolvable(this);\n }\n}\n", + "/**\n * # The Resolve subsystem\n *\n * This subsystem is an asynchronous, hierarchical Dependency Injection system.\n *\n * Typically, resolve is configured on a state using a [[StateDeclaration.resolve]] declaration.\n *\n * @coreapi\n * @module resolve\n */ /** for typedoc */\nimport { Resolvable } from './resolvable';\n\n/**\n * An interface which is similar to an Angular 2 `Provider`\n */\nexport interface ProviderLike {\n provide: any,\n useClass?: any,\n useFactory?: Function,\n useValue?: any,\n useExisting?: any,\n deps?: any[]\n}\n\n/**\n * A plain object used to describe a [[Resolvable]]\n *\n * These objects may be used in the [[StateDeclaration.resolve]] array to declare\n * async data that the state or substates require.\n *\n * #### Example:\n * ```js\n *\n * var state = {\n * name: 'main',\n * resolve: [\n * { token: 'myData', deps: [MyDataApi], resolveFn: (myDataApi) => myDataApi.getData() },\n * ],\n * }\n * ```\n */\nexport interface ResolvableLiteral {\n /**\n * A Dependency Injection token\n *\n * This Resolvable's DI token.\n * The Resolvable will be injectable elsewhere using the token.\n */\n token: any;\n\n /**\n * A function which fetches the Resolvable's data\n *\n * A function which returns one of:\n *\n * - The resolved value (synchronously)\n * - A promise for the resolved value\n * - An Observable of the resolved value(s)\n *\n * This function will be provided the dependencies listed in [[deps]] as its arguments.\n * The resolve system will asynchronously fetch the dependencies before invoking this function.\n */\n resolveFn: Function;\n\n /**\n * Defines the Resolve Policy\n *\n * A policy that defines when to invoke the resolve,\n * and whether to wait for async and unwrap the data\n */\n policy?: ResolvePolicy;\n\n /**\n * The Dependency Injection tokens\n *\n * This is an array of Dependency Injection tokens for the dependencies of the [[resolveFn]].\n *\n * The DI tokens are references to other `Resolvables`, or to other\n * services from the native DI system.\n */\n deps?: any[];\n\n /** Pre-resolved data. */\n data?: any\n}\n\n/**\n * Defines how a resolve is processed during a transition\n *\n * This object is the [[StateDeclaration.resolvePolicy]] property.\n *\n * #### Example:\n * ```js\n * // Fetched when the resolve's state is being entered.\n * // Wait for the promise to resolve.\n * var policy1 = { when: \"LAZY\", async: \"WAIT\" }\n *\n * // Fetched when the Transition is starting.\n * // Do not wait for the returned promise to resolve.\n * // Inject the raw promise/value\n * var policy2 = { when: \"EAGER\", async: \"NOWAIT\" }\n * ```\n *\n * The policy for a given Resolvable is merged from three sources (highest priority first):\n *\n * - 1) Individual resolve definition\n * - 2) State definition\n * - 3) Global default\n *\n * #### Example:\n * ```js\n * // Wait for an Observable to emit one item.\n * // Since `wait` is not specified, it uses the `wait`\n * // policy defined on the state, or the global default\n * // if no `wait` policy is defined on the state\n * var myResolvablePolicy = { async: \"RXWAIT\" }\n * ```\n */\nexport interface ResolvePolicy {\n /**\n * Defines when a Resolvable is resolved (fetched) during a transition\n *\n * - `LAZY` (default)\n * - Resolved as the resolve's state is being entered\n * - `EAGER`\n * - Resolved as the transition is starting\n *\n * #### Example:\n * Resolves for `main` and `main.home` are fetched when each state is entered.\n * All of `main` resolves are processed before fetching `main.home` resolves.\n * ```js\n * var state = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { when: 'LAZY' }, // default\n * }\n *\n * var state = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { when: 'LAZY' }, // default\n * }\n * ```\n *\n * #### Example:\n * Resolves for `main` and `main.home` are fetched at the same time when the transition starts.\n * This happens earlier in the lifecycle than when states are entered.\n * All of the `main` and `main.home` resolves are fetched as soon as possible.\n * ```js\n * var mainState = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { when: 'EAGER' },\n * }\n *\n * var homeState = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { when: 'EAGER' },\n * }\n * ```\n */\n when?: PolicyWhen;\n\n /**\n * Determines the unwrapping behavior of asynchronous resolve values.\n *\n * - `WAIT` (default)\n * - If a promise is returned from the resolveFn, wait for the promise before proceeding\n * - The unwrapped value from the promise\n * - `NOWAIT`\n * - If a promise is returned from the resolve, do not wait for the promise.\n * - Any other value returned is wrapped in a promise.\n * - The promise will not be unwrapped.\n * - The promise itself will be provided when the resolve is injected or bound elsewhere.\n * - `RXWAIT`\n * - When an Observable is returned from the resolveFn, wait until the Observable emits at least one item.\n * - The Observable item will not be unwrapped.\n * - The Observable stream itself will be provided when the resolve is injected or bound elsewhere.\n *\n * #### Example:\n * The `Transition` will not wait for the resolve promise(s) from `main` to settle before continuing.\n * Resolves for `main` will be provided to components wrapped in a `Promise`.\n *\n * The `Transition` will wait for the `main.home` resolve promises.\n * Resolved values will be unwrapped before being provided to components.\n * ```js\n * var mainState = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { async: 'NOWAIT' },\n * }\n * var homeState = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { async: 'WAIT' }, // default\n * }\n * ```\n */\n async?: PolicyAsync;\n}\n\nexport type PolicyWhen = 'LAZY' | 'EAGER' ;\nexport type PolicyAsync = 'WAIT' | 'NOWAIT' | 'RXWAIT' ;\n\n/** @internalapi */\nexport let resolvePolicies = {\n when: {\n LAZY: 'LAZY',\n EAGER: 'EAGER',\n },\n async: {\n WAIT: 'WAIT',\n NOWAIT: 'NOWAIT',\n RXWAIT: 'RXWAIT',\n },\n};\n", + "/** @module resolve */\n/** for typedoc */\nimport { find, tail, uniqR, unnestR, inArray } from '../common/common';\nimport { propEq, not } from '../common/hof';\nimport { trace } from '../common/trace';\nimport { services, $InjectorLike } from '../common/coreservices';\nimport { resolvePolicies, PolicyWhen, ResolvePolicy } from './interface';\nimport { PathNode } from '../path/pathNode';\nimport { Resolvable } from './resolvable';\nimport { StateObject } from '../state/stateObject';\nimport { PathUtils } from '../path/pathUtils';\nimport { stringify } from '../common/strings';\nimport { Transition } from '../transition/transition';\nimport { UIInjector } from '../interface';\nimport { isUndefined } from '../common';\n\nconst whens = resolvePolicies.when;\nconst ALL_WHENS = [whens.EAGER, whens.LAZY];\nconst EAGER_WHENS = [whens.EAGER];\n\n// tslint:disable-next-line:no-inferrable-types\nexport const NATIVE_INJECTOR_TOKEN: string = 'Native Injector';\n\n/**\n * Encapsulates Dependency Injection for a path of nodes\n *\n * UI-Router states are organized as a tree.\n * A nested state has a path of ancestors to the root of the tree.\n * When a state is being activated, each element in the path is wrapped as a [[PathNode]].\n * A `PathNode` is a stateful object that holds things like parameters and resolvables for the state being activated.\n *\n * The ResolveContext closes over the [[PathNode]]s, and provides DI for the last node in the path.\n */\nexport class ResolveContext {\n _injector: UIInjector;\n\n constructor(private _path: PathNode[]) { }\n\n /** Gets all the tokens found in the resolve context, de-duplicated */\n getTokens(): any[] {\n return this._path.reduce((acc, node) => acc.concat(node.resolvables.map(r => r.token)), []).reduce(uniqR, []);\n }\n\n /**\n * Gets the Resolvable that matches the token\n *\n * Gets the last Resolvable that matches the token in this context, or undefined.\n * Throws an error if it doesn't exist in the ResolveContext\n */\n getResolvable(token: any): Resolvable {\n const matching = this._path.map(node => node.resolvables)\n .reduce(unnestR, [])\n .filter((r: Resolvable) => r.token === token);\n return tail(matching);\n }\n\n /** Returns the [[ResolvePolicy]] for the given [[Resolvable]] */\n getPolicy(resolvable: Resolvable): ResolvePolicy {\n const node = this.findNode(resolvable);\n return resolvable.getPolicy(node.state);\n }\n\n /**\n * Returns a ResolveContext that includes a portion of this one\n *\n * Given a state, this method creates a new ResolveContext from this one.\n * The new context starts at the first node (root) and stops at the node for the `state` parameter.\n *\n * #### Why\n *\n * When a transition is created, the nodes in the \"To Path\" are injected from a ResolveContext.\n * A ResolveContext closes over a path of [[PathNode]]s and processes the resolvables.\n * The \"To State\" can inject values from its own resolvables, as well as those from all its ancestor state's (node's).\n * This method is used to create a narrower context when injecting ancestor nodes.\n *\n * @example\n * `let ABCD = new ResolveContext([A, B, C, D]);`\n *\n * Given a path `[A, B, C, D]`, where `A`, `B`, `C` and `D` are nodes for states `a`, `b`, `c`, `d`:\n * When injecting `D`, `D` should have access to all resolvables from `A`, `B`, `C`, `D`.\n * However, `B` should only be able to access resolvables from `A`, `B`.\n *\n * When resolving for the `B` node, first take the full \"To Path\" Context `[A,B,C,D]` and limit to the subpath `[A,B]`.\n * `let AB = ABCD.subcontext(a)`\n */\n subContext(state: StateObject): ResolveContext {\n return new ResolveContext(PathUtils.subPath(this._path, node => node.state === state));\n }\n\n /**\n * Adds Resolvables to the node that matches the state\n *\n * This adds a [[Resolvable]] (generally one created on the fly; not declared on a [[StateDeclaration.resolve]] block).\n * The resolvable is added to the node matching the `state` parameter.\n *\n * These new resolvables are not automatically fetched.\n * The calling code should either fetch them, fetch something that depends on them,\n * or rely on [[resolvePath]] being called when some state is being entered.\n *\n * Note: each resolvable's [[ResolvePolicy]] is merged with the state's policy, and the global default.\n *\n * @param newResolvables the new Resolvables\n * @param state Used to find the node to put the resolvable on\n */\n addResolvables(newResolvables: Resolvable[], state: StateObject) {\n const node = find(this._path, propEq('state', state));\n const keys = newResolvables.map(r => r.token);\n node.resolvables = node.resolvables.filter(r => keys.indexOf(r.token) === -1).concat(newResolvables);\n }\n\n /**\n * Returns a promise for an array of resolved path Element promises\n *\n * @param when\n * @param trans\n * @returns {Promise|any}\n */\n resolvePath(when: PolicyWhen = 'LAZY', trans?: Transition): Promise<{ token: any, value: any }[]> {\n // This option determines which 'when' policy Resolvables we are about to fetch.\n const whenOption: string = inArray(ALL_WHENS, when) ? when : 'LAZY';\n // If the caller specified EAGER, only the EAGER Resolvables are fetched.\n // if the caller specified LAZY, both EAGER and LAZY Resolvables are fetched.`\n const matchedWhens = whenOption === resolvePolicies.when.EAGER ? EAGER_WHENS : ALL_WHENS;\n\n // get the subpath to the state argument, if provided\n trace.traceResolvePath(this._path, when, trans);\n\n const matchesPolicy = (acceptedVals: string[], whenOrAsync: 'when'|'async') =>\n (resolvable: Resolvable) =>\n inArray(acceptedVals, this.getPolicy(resolvable)[whenOrAsync]);\n\n // Trigger all the (matching) Resolvables in the path\n // Reduce all the \"WAIT\" Resolvables into an array\n const promises: Promise[] = this._path.reduce((acc, node) => {\n const nodeResolvables = node.resolvables.filter(matchesPolicy(matchedWhens, 'when'));\n const nowait = nodeResolvables.filter(matchesPolicy(['NOWAIT'], 'async'));\n const wait = nodeResolvables.filter(not(matchesPolicy(['NOWAIT'], 'async')));\n\n // For the matching Resolvables, start their async fetch process.\n const subContext = this.subContext(node.state);\n const getResult = (r: Resolvable) => r.get(subContext, trans)\n // Return a tuple that includes the Resolvable's token\n .then(value => ({ token: r.token, value: value }));\n nowait.forEach(getResult);\n return acc.concat(wait.map(getResult));\n }, []);\n\n // Wait for all the \"WAIT\" resolvables\n return services.$q.all(promises);\n }\n\n injector(): UIInjector {\n return this._injector || (this._injector = new UIInjectorImpl(this));\n }\n\n findNode(resolvable: Resolvable): PathNode {\n return find(this._path, (node: PathNode) => inArray(node.resolvables, resolvable));\n }\n\n /**\n * Gets the async dependencies of a Resolvable\n *\n * Given a Resolvable, returns its dependencies as a Resolvable[]\n */\n getDependencies(resolvable: Resolvable): Resolvable[] {\n const node = this.findNode(resolvable);\n // Find which other resolvables are \"visible\" to the `resolvable` argument\n // subpath stopping at resolvable's node, or the whole path (if the resolvable isn't in the path)\n const subPath: PathNode[] = PathUtils.subPath(this._path, x => x === node) || this._path;\n const availableResolvables: Resolvable[] = subPath\n .reduce((acc, _node) => acc.concat(_node.resolvables), []) // all of subpath's resolvables\n .filter(res => res !== resolvable); // filter out the `resolvable` argument\n\n const getDependency = (token: any) => {\n const matching = availableResolvables.filter(r => r.token === token);\n if (matching.length) return tail(matching);\n\n const fromInjector = this.injector().getNative(token);\n if (isUndefined(fromInjector)) {\n throw new Error('Could not find Dependency Injection token: ' + stringify(token));\n }\n\n return new Resolvable(token, () => fromInjector, [], fromInjector);\n };\n\n return resolvable.deps.map(getDependency);\n }\n}\n\nclass UIInjectorImpl implements UIInjector {\n native: $InjectorLike;\n\n constructor(public context: ResolveContext) {\n this.native = this.get(NATIVE_INJECTOR_TOKEN) || services.$injector;\n }\n\n get(token: any) {\n const resolvable = this.context.getResolvable(token);\n if (resolvable) {\n if (this.context.getPolicy(resolvable).async === 'NOWAIT') {\n return resolvable.get(this.context);\n }\n\n if (!resolvable.resolved) {\n throw new Error('Resolvable async .get() not complete:' + stringify(resolvable.token));\n }\n return resolvable.data;\n }\n\n return this.getNative(token);\n }\n\n getAsync(token: any) {\n const resolvable = this.context.getResolvable(token);\n if (resolvable) return resolvable.get(this.context);\n return services.$q.when(this.native.get(token));\n }\n\n getNative(token: any) {\n return this.native && this.native.get(token);\n }\n}\n", + "/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport { trace } from '../common/trace';\nimport { services } from '../common/coreservices';\nimport { stringify } from '../common/strings';\nimport { map, find, extend, mergeR, tail, omit, arrayTuples, unnestR, identity, anyTrueR } from '../common/common';\nimport { isObject, isUndefined } from '../common/predicates';\nimport { prop, propEq, val, not, is } from '../common/hof';\nimport { StateDeclaration, StateOrName } from '../state/interface';\nimport {\n TransitionOptions, TreeChanges, IHookRegistry, TransitionHookPhase, RegisteredHooks, HookRegOptions,\n HookMatchCriteria, TransitionStateHookFn, TransitionHookFn,\n} from './interface'; // has or is using\nimport { TransitionHook } from './transitionHook';\nimport { matchState, makeEvent, RegisteredHook } from './hookRegistry';\nimport { HookBuilder } from './hookBuilder';\nimport { PathNode } from '../path/pathNode';\nimport { PathUtils } from '../path/pathUtils';\nimport { StateObject } from '../state/stateObject';\nimport { TargetState } from '../state/targetState';\nimport { Param } from '../params/param';\nimport { Resolvable } from '../resolve/resolvable';\nimport { ViewConfig } from '../view/interface';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { UIRouter } from '../router';\nimport { UIInjector } from '../interface';\nimport { RawParams } from '../params/interface';\nimport { ResolvableLiteral } from '../resolve/interface';\n\n/** @hidden */\nconst stateSelf: (_state: StateObject) => StateDeclaration = prop('self');\n\n/**\n * Represents a transition between two states.\n *\n * When navigating to a state, we are transitioning **from** the current state **to** the new state.\n *\n * This object contains all contextual information about the to/from states, parameters, resolves.\n * It has information about all states being entered and exited as a result of the transition.\n */\nexport class Transition implements IHookRegistry {\n\n /** @hidden */\n static diToken = Transition;\n\n /**\n * A unique identifier for the transition.\n *\n * This is an auto incrementing integer, starting from `0`.\n */\n $id: number;\n\n /**\n * A reference to the [[UIRouter]] instance\n *\n * This reference can be used to access the router services, such as the [[StateService]]\n */\n router: UIRouter;\n\n /** @hidden */\n private _deferred = services.$q.defer();\n /**\n * This promise is resolved or rejected based on the outcome of the Transition.\n *\n * When the transition is successful, the promise is resolved\n * When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error\n */\n promise: Promise = this._deferred.promise;\n /**\n * A boolean which indicates if the transition was successful\n *\n * After a successful transition, this value is set to true.\n * After an unsuccessful transition, this value is set to false.\n *\n * The value will be undefined if the transition is not complete\n */\n success: boolean;\n /** @hidden */\n _aborted: boolean;\n /** @hidden */\n private _error: any;\n\n /** @hidden Holds the hook registration functions such as those passed to Transition.onStart() */\n _registeredHooks: RegisteredHooks = { };\n\n /** @hidden */\n private _options: TransitionOptions;\n /** @hidden */\n private _treeChanges: TreeChanges;\n /** @hidden */\n private _targetState: TargetState;\n /** @hidden */\n private _hookBuilder = new HookBuilder(this);\n\n\n /** @hidden */\n onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n\n /** @hidden\n * Creates the transition-level hook registration functions\n * (which can then be used to register hooks)\n */\n private createTransitionHookRegFns() {\n this.router.transitionService._pluginapi._getEvents()\n .filter(type => type.hookPhase !== TransitionHookPhase.CREATE)\n .forEach(type => makeEvent(this, this.router.transitionService, type));\n }\n\n /** @internalapi */\n getHooks(hookName: string): RegisteredHook[] {\n return this._registeredHooks[hookName];\n }\n\n /**\n * Creates a new Transition object.\n *\n * If the target state is not valid, an error is thrown.\n *\n * @internalapi\n *\n * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`\n * encapsulates the \"from state\".\n * @param targetState The target state and parameters being transitioned to (also, the transition options)\n * @param router The [[UIRouter]] instance\n */\n constructor(fromPath: PathNode[], targetState: TargetState, router: UIRouter) {\n this.router = router;\n this._targetState = targetState;\n\n if (!targetState.valid()) {\n throw new Error(targetState.error());\n }\n\n // current() is assumed to come from targetState.options, but provide a naive implementation otherwise.\n this._options = extend({ current: val(this) }, targetState.options());\n this.$id = router.transitionService._transitionCount++;\n const toPath = PathUtils.buildToPath(fromPath, targetState);\n this._treeChanges = PathUtils.treeChanges(fromPath, toPath, this._options.reloadState);\n this.createTransitionHookRegFns();\n\n const onCreateHooks = this._hookBuilder.buildHooksForPhase(TransitionHookPhase.CREATE);\n TransitionHook.invokeHooks(onCreateHooks, () => null);\n\n this.applyViewConfigs(router);\n }\n\n private applyViewConfigs(router: UIRouter) {\n const enteringStates = this._treeChanges.entering.map(node => node.state);\n PathUtils.applyViewConfigs(router.transitionService.$view, this._treeChanges.to, enteringStates);\n }\n\n /**\n * @internalapi\n *\n * @returns the internal from [State] object\n */\n $from() {\n return tail(this._treeChanges.from).state;\n }\n\n /**\n * @internalapi\n *\n * @returns the internal to [State] object\n */\n $to() {\n return tail(this._treeChanges.to).state;\n }\n\n /**\n * Returns the \"from state\"\n *\n * Returns the state that the transition is coming *from*.\n *\n * @returns The state declaration object for the Transition's (\"from state\").\n */\n from(): StateDeclaration {\n return this.$from().self;\n }\n\n /**\n * Returns the \"to state\"\n *\n * Returns the state that the transition is going *to*.\n *\n * @returns The state declaration object for the Transition's target state (\"to state\").\n */\n to(): StateDeclaration {\n return this.$to().self;\n }\n\n /**\n * Gets the Target State\n *\n * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object.\n *\n * @returns the [[TargetState]] of this Transition\n */\n targetState() {\n return this._targetState;\n }\n\n /**\n * Determines whether two transitions are equivalent.\n * @deprecated\n */\n is(compare: (Transition|{to?: any, from?: any})): boolean {\n if (compare instanceof Transition) {\n // TODO: Also compare parameters\n return this.is({ to: compare.$to().name, from: compare.$from().name });\n }\n return !(\n (compare.to && !matchState(this.$to(), compare.to)) ||\n (compare.from && !matchState(this.$from(), compare.from))\n );\n }\n\n /**\n * Gets transition parameter values\n *\n * Returns the parameter values for a transition as key/value pairs.\n * This object is immutable.\n *\n * By default, returns the new parameter values (for the \"to state\").\n *\n * #### Example:\n * ```js\n * var toParams = transition.params();\n * ```\n *\n * To return the previous parameter values, supply `'from'` as the `pathname` argument.\n *\n * #### Example:\n * ```js\n * var fromParams = transition.params('from');\n * ```\n *\n * @param pathname the name of the treeChanges path to get parameter values for:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n *\n * @returns transition parameter values for the desired path.\n */\n params(pathname?: string): any;\n params(pathname?: string): T;\n params(pathname = 'to') {\n return Object.freeze(this._treeChanges[pathname].map(prop('paramValues')).reduce(mergeR, {}));\n }\n\n\n /**\n * Creates a [[UIInjector]] Dependency Injector\n *\n * Returns a Dependency Injector for the Transition's target state (to state).\n * The injector provides resolve values which the target state has access to.\n *\n * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2).\n *\n * #### Example:\n * ```js\n * .onEnter({ entering: 'myState' }, trans => {\n * var myResolveValue = trans.injector().get('myResolve');\n * // Inject a global service from the global/native injector (if it exists)\n * var MyService = trans.injector().get('MyService');\n * })\n * ```\n *\n * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched.\n * You can use [[UIInjector.getAsync]] to get a promise for the data.\n * #### Example:\n * ```js\n * .onBefore({}, trans => {\n * return trans.injector().getAsync('myResolve').then(myResolveValue =>\n * return myResolveValue !== 'ABORT';\n * });\n * });\n * ```\n *\n * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to.\n * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`.\n * #### Example:\n * ```js\n * .onEnter({ to: 'foo.bar' }, trans => {\n * // returns result of `foo` state's `myResolve` resolve\n * // even though `foo.bar` also has a `myResolve` resolve\n * var fooData = trans.injector('foo').get('myResolve');\n * });\n * ```\n *\n * If you need resolve data from the exiting states, pass `'from'` as `pathName`.\n * The resolve data from the `from` path will be returned.\n * #### Example:\n * ```js\n * .onExit({ exiting: 'foo.bar' }, trans => {\n * // Gets the resolve value of `myResolve` from the state being exited\n * var fooData = trans.injector(null, 'from').get('myResolve');\n * });\n * ```\n *\n *\n * @param state Limits the resolves provided to only the resolves the provided state has access to.\n * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states.\n *\n * @returns a [[UIInjector]]\n */\n injector(state?: StateOrName, pathName = 'to'): UIInjector {\n let path: PathNode[] = this._treeChanges[pathName];\n if (state) path = PathUtils.subPath(path, node => node.state === state || node.state.name === state);\n return new ResolveContext(path).injector();\n }\n\n /**\n * Gets all available resolve tokens (keys)\n *\n * This method can be used in conjunction with [[injector]] to inspect the resolve values\n * available to the Transition.\n *\n * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states\n * in the Transition's [[TreeChanges.to]] path.\n *\n * #### Example:\n * This example logs all resolve values\n * ```js\n * let tokens = trans.getResolveTokens();\n * tokens.forEach(token => console.log(token + \" = \" + trans.injector().get(token)));\n * ```\n *\n * #### Example:\n * This example creates promises for each resolve value.\n * This triggers fetches of resolves (if any have not yet been fetched).\n * When all promises have all settled, it logs the resolve values.\n * ```js\n * let tokens = trans.getResolveTokens();\n * let promise = tokens.map(token => trans.injector().getAsync(token));\n * Promise.all(promises).then(values => console.log(\"Resolved values: \" + values));\n * ```\n *\n * Note: Angular 1 users whould use `$q.all()`\n *\n * @param pathname resolve context's path name (e.g., `to` or `from`)\n *\n * @returns an array of resolve tokens (keys)\n */\n getResolveTokens(pathname = 'to'): any[] {\n return new ResolveContext(this._treeChanges[pathname]).getTokens();\n }\n\n /**\n * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition.\n *\n * Allows a transition hook to dynamically add a Resolvable to this Transition.\n *\n * Use the [[Transition.injector]] to retrieve the resolved data in subsequent hooks ([[UIInjector.get]]).\n *\n * If a `state` argument is provided, the Resolvable is processed when that state is being entered.\n * If no `state` is provided then the root state is used.\n * If the given `state` has already been entered, the Resolvable is processed when any child state is entered.\n * If no child states will be entered, the Resolvable is processed during the `onFinish` phase of the Transition.\n *\n * The `state` argument also scopes the resolved data.\n * The resolved data is available from the injector for that `state` and any children states.\n *\n * #### Example:\n * ```js\n * transitionService.onBefore({}, transition => {\n * transition.addResolvable({\n * token: 'myResolve',\n * deps: ['MyService'],\n * resolveFn: myService => myService.getData()\n * });\n * });\n * ```\n *\n * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]])\n * @param state the state in the \"to path\" which should receive the new resolve (otherwise, the root state)\n */\n addResolvable(resolvable: Resolvable|ResolvableLiteral, state: StateOrName = ''): void {\n resolvable = is(Resolvable)(resolvable) ? resolvable : new Resolvable(resolvable);\n\n const stateName: string = (typeof state === 'string') ? state : state.name;\n const topath = this._treeChanges.to;\n const targetNode = find(topath, node => node.state.name === stateName);\n const resolveContext: ResolveContext = new ResolveContext(topath);\n resolveContext.addResolvables([resolvable as Resolvable], targetNode.state);\n }\n\n /**\n * Gets the transition from which this transition was redirected.\n *\n * If the current transition is a redirect, this method returns the transition that was redirected.\n *\n * #### Example:\n * ```js\n * let transitionA = $state.go('A').transition\n * transitionA.onStart({}, () => $state.target('B'));\n * $transitions.onSuccess({ to: 'B' }, (trans) => {\n * trans.to().name === 'B'; // true\n * trans.redirectedFrom() === transitionA; // true\n * });\n * ```\n *\n * @returns The previous Transition, or null if this Transition is not the result of a redirection\n */\n redirectedFrom(): Transition {\n return this._options.redirectedFrom || null;\n }\n\n /**\n * Gets the original transition in a redirect chain\n *\n * A transition might belong to a long chain of multiple redirects.\n * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain.\n *\n * #### Example:\n * ```js\n * // states\n * registry.register({ name: 'A', redirectTo: 'B' });\n * registry.register({ name: 'B', redirectTo: 'C' });\n * registry.register({ name: 'C', redirectTo: 'D' });\n * registry.register({ name: 'D' });\n *\n * let transitionA = $state.go('A').transition\n *\n * $transitions.onSuccess({ to: 'D' }, (trans) => {\n * trans.to().name === 'D'; // true\n * trans.redirectedFrom().to().name === 'C'; // true\n * trans.originalTransition() === transitionA; // true\n * trans.originalTransition().to().name === 'A'; // true\n * });\n * ```\n *\n * @returns The original Transition that started a redirect chain\n */\n originalTransition(): Transition {\n const rf = this.redirectedFrom();\n return (rf && rf.originalTransition()) || this;\n }\n\n /**\n * Get the transition options\n *\n * @returns the options for this Transition.\n */\n options(): TransitionOptions {\n return this._options;\n }\n\n /**\n * Gets the states being entered.\n *\n * @returns an array of states that will be entered during this transition.\n */\n entering(): StateDeclaration[] {\n return map(this._treeChanges.entering, prop('state')).map(stateSelf);\n }\n\n /**\n * Gets the states being exited.\n *\n * @returns an array of states that will be exited during this transition.\n */\n exiting(): StateDeclaration[] {\n return map(this._treeChanges.exiting, prop('state')).map(stateSelf).reverse();\n }\n\n /**\n * Gets the states being retained.\n *\n * @returns an array of states that are already entered from a previous Transition, that will not be\n * exited during this Transition\n */\n retained(): StateDeclaration[] {\n return map(this._treeChanges.retained, prop('state')).map(stateSelf);\n }\n\n /**\n * Get the [[ViewConfig]]s associated with this Transition\n *\n * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects.\n * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., \"to\" or \"entering\").\n *\n * @param pathname the name of the path to fetch views for:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n * @param state If provided, only returns the `ViewConfig`s for a single state in the path\n *\n * @returns a list of ViewConfig objects for the given path.\n */\n views(pathname = 'entering', state?: StateObject): ViewConfig[] {\n let path = this._treeChanges[pathname];\n path = !state ? path : path.filter(propEq('state', state));\n return path.map(prop('views')).filter(identity).reduce(unnestR, []);\n }\n\n /**\n * Return the transition's tree changes\n *\n * A transition goes from one state/parameters to another state/parameters.\n * During a transition, states are entered and/or exited.\n *\n * This function returns various branches (paths) which represent the changes to the\n * active state tree that are caused by the transition.\n *\n * @param pathname The name of the tree changes path to get:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n */\n treeChanges(pathname: string): PathNode[];\n treeChanges(): TreeChanges;\n treeChanges(pathname?: string) {\n return pathname ? this._treeChanges[pathname] : this._treeChanges;\n }\n\n /**\n * Creates a new transition that is a redirection of the current one.\n *\n * This transition can be returned from a [[TransitionService]] hook to\n * redirect a transition to a new state and/or set of parameters.\n *\n * @internalapi\n *\n * @returns Returns a new [[Transition]] instance.\n */\n redirect(targetState: TargetState): Transition {\n let redirects = 1, trans: Transition = this;\n // tslint:disable-next-line:no-conditional-assignment\n while ((trans = trans.redirectedFrom()) != null) {\n if (++redirects > 20) throw new Error(`Too many consecutive Transition redirects (20+)`);\n }\n\n const redirectOpts: TransitionOptions = { redirectedFrom: this, source: 'redirect' };\n // If the original transition was caused by URL sync, then use { location: 'replace' }\n // on the new transition (unless the target state explicitly specifies location: false).\n // This causes the original url to be replaced with the url for the redirect target\n // so the original url disappears from the browser history.\n if (this.options().source === 'url' && targetState.options().location !== false) {\n redirectOpts.location = 'replace';\n }\n\n const newOptions = extend({}, this.options(), targetState.options(), redirectOpts);\n targetState = targetState.withOptions(newOptions, true);\n\n const newTransition = this.router.transitionService.create(this._treeChanges.from, targetState);\n const originalEnteringNodes = this._treeChanges.entering;\n const redirectEnteringNodes = newTransition._treeChanges.entering;\n\n // --- Re-use resolve data from original transition ---\n // When redirecting from a parent state to a child state where the parent parameter values haven't changed\n // (because of the redirect), the resolves fetched by the original transition are still valid in the\n // redirected transition.\n //\n // This allows you to define a redirect on a parent state which depends on an async resolve value.\n // You can wait for the resolve, then redirect to a child state based on the result.\n // The redirected transition does not have to re-fetch the resolve.\n // ---------------------------------------------------------\n\n const nodeIsReloading = (reloadState: StateObject) => (node: PathNode) => {\n return reloadState && node.state.includes[reloadState.name];\n };\n\n // Find any \"entering\" nodes in the redirect path that match the original path and aren't being reloaded\n const matchingEnteringNodes: PathNode[] = PathUtils.matching(redirectEnteringNodes, originalEnteringNodes, PathUtils.nonDynamicParams)\n .filter(not(nodeIsReloading(targetState.options().reloadState)));\n\n // Use the existing (possibly pre-resolved) resolvables for the matching entering nodes.\n matchingEnteringNodes.forEach((node, idx) => {\n node.resolvables = originalEnteringNodes[idx].resolvables;\n });\n\n return newTransition;\n }\n\n /** @hidden If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */\n private _changedParams(): Param[] {\n const tc = this._treeChanges;\n\n /** Return undefined if it's not a \"dynamic\" transition, for the following reasons */\n // If user explicitly wants a reload\n if (this._options.reload) return undefined;\n // If any states are exiting or entering\n if (tc.exiting.length || tc.entering.length) return undefined;\n // If to/from path lengths differ\n if (tc.to.length !== tc.from.length) return undefined;\n // If the to/from paths are different\n const pathsDiffer: boolean = arrayTuples(tc.to, tc.from)\n .map(tuple => tuple[0].state !== tuple[1].state)\n .reduce(anyTrueR, false);\n if (pathsDiffer) return undefined;\n\n // Find any parameter values that differ\n const nodeSchemas: Param[][] = tc.to.map((node: PathNode) => node.paramSchema);\n const [toValues, fromValues] = [tc.to, tc.from].map(path => path.map(x => x.paramValues));\n const tuples = arrayTuples(nodeSchemas, toValues, fromValues);\n\n return tuples.map(([schema, toVals, fromVals]) => Param.changed(schema, toVals, fromVals)).reduce(unnestR, []);\n }\n\n /**\n * Returns true if the transition is dynamic.\n *\n * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed.\n *\n * @returns true if the Transition is dynamic\n */\n dynamic(): boolean {\n const changes = this._changedParams();\n return !changes ? false : changes.map(x => x.dynamic).reduce(anyTrueR, false);\n }\n\n /**\n * Returns true if the transition is ignored.\n *\n * A transition is ignored if no states are entered nor exited, and no parameter values have changed.\n *\n * @returns true if the Transition is ignored.\n */\n ignored(): boolean {\n return !!this._ignoredReason();\n }\n\n /** @hidden */\n _ignoredReason(): 'SameAsCurrent'|'SameAsPending'|undefined {\n const pending = this.router.globals.transition;\n const reloadState = this._options.reloadState;\n\n const same = (pathA, pathB) => {\n if (pathA.length !== pathB.length) return false;\n const matching = PathUtils.matching(pathA, pathB);\n return pathA.length === matching.filter(node => !reloadState || !node.state.includes[reloadState.name]).length;\n };\n\n const newTC = this.treeChanges();\n const pendTC = pending && pending.treeChanges();\n\n if (pendTC && same(pendTC.to, newTC.to) && same(pendTC.exiting, newTC.exiting)) return 'SameAsPending';\n if (newTC.exiting.length === 0 && newTC.entering.length === 0 && same(newTC.from, newTC.to)) return 'SameAsCurrent';\n }\n\n /**\n * Runs the transition\n *\n * This method is generally called from the [[StateService.transitionTo]]\n *\n * @internalapi\n *\n * @returns a promise for a successful transition.\n */\n run(): Promise {\n const runAllHooks = TransitionHook.runAllHooks;\n\n // Gets transition hooks array for the given phase\n const getHooksFor = (phase: TransitionHookPhase) =>\n this._hookBuilder.buildHooksForPhase(phase);\n\n // When the chain is complete, then resolve or reject the deferred\n const transitionSuccess = () => {\n trace.traceSuccess(this.$to(), this);\n this.success = true;\n this._deferred.resolve(this.to());\n runAllHooks(getHooksFor(TransitionHookPhase.SUCCESS));\n };\n\n const transitionError = (reason: any) => {\n trace.traceError(reason, this);\n this.success = false;\n this._deferred.reject(reason);\n this._error = reason;\n runAllHooks(getHooksFor(TransitionHookPhase.ERROR));\n };\n\n const runTransition = () => {\n // Wait to build the RUN hook chain until the BEFORE hooks are done\n // This allows a BEFORE hook to dynamically add additional RUN hooks via the Transition object.\n const allRunHooks = getHooksFor(TransitionHookPhase.RUN);\n const done = () => services.$q.when(undefined);\n return TransitionHook.invokeHooks(allRunHooks, done);\n };\n\n const startTransition = () => {\n const globals = this.router.globals;\n\n globals.lastStartedTransitionId = this.$id;\n globals.transition = this;\n globals.transitionHistory.enqueue(this);\n\n trace.traceTransitionStart(this);\n\n return services.$q.when(undefined);\n };\n\n const allBeforeHooks = getHooksFor(TransitionHookPhase.BEFORE);\n TransitionHook.invokeHooks(allBeforeHooks, startTransition)\n .then(runTransition)\n .then(transitionSuccess, transitionError);\n\n return this.promise;\n }\n\n /** Checks if this transition is currently active/running. */\n isActive = () =>\n this.router.globals.transition === this;\n\n /**\n * Checks if the Transition is valid\n *\n * @returns true if the Transition is valid\n */\n valid() {\n return !this.error() || this.success !== undefined;\n }\n\n /**\n * Aborts this transition\n *\n * Imperative API to abort a Transition.\n * This only applies to Transitions that are not yet complete.\n */\n abort() {\n // Do not set flag if the transition is already complete\n if (isUndefined(this.success)) {\n this._aborted = true;\n }\n }\n\n /**\n * The Transition error reason.\n *\n * If the transition is invalid (and could not be run), returns the reason the transition is invalid.\n * If the transition was valid and ran, but was not successful, returns the reason the transition failed.\n *\n * @returns an error message explaining why the transition is invalid, or the reason the transition failed.\n */\n error() {\n const state: StateObject = this.$to();\n\n if (state.self.abstract)\n return `Cannot transition to abstract state '${state.name}'`;\n\n const paramDefs = state.parameters(), values = this.params();\n const invalidParams = paramDefs.filter(param => !param.validates(values[param.id]));\n if (invalidParams.length) {\n return `Param values not valid for state '${state.name}'. Invalid params: [ ${invalidParams.map(param => param.id).join(', ')} ]`;\n }\n\n if (this.success === false)\n return this._error;\n }\n\n /**\n * A string representation of the Transition\n *\n * @returns A string representation of the Transition\n */\n toString () {\n const fromStateOrName = this.from();\n const toStateOrName = this.to();\n\n const avoidEmptyHash = (params: RawParams) =>\n (params['#'] !== null && params['#'] !== undefined) ? params : omit(params, ['#']);\n\n // (X) means the to state is invalid.\n const id = this.$id,\n from = isObject(fromStateOrName) ? fromStateOrName.name : fromStateOrName,\n fromParams = stringify(avoidEmptyHash(this._treeChanges.from.map(prop('paramValues')).reduce(mergeR, {}))),\n toValid = this.valid() ? '' : '(X) ',\n to = isObject(toStateOrName) ? toStateOrName.name : toStateOrName,\n toParams = stringify(avoidEmptyHash(this.params()));\n\n return `Transition#${id}( '${from}'${fromParams} -> ${toValid}'${to}'${toParams} )`;\n }\n}\n", + "/**\n * Functions that manipulate strings\n *\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_strings\n */ /** */\n\nimport { isString, isArray, isDefined, isNull, isPromise, isInjectable, isObject } from './predicates';\nimport { Rejection } from '../transition/rejectFactory';\nimport { IInjectable, identity, Obj, tail, pushR } from './common';\nimport { pattern, is, not, val, invoke } from './hof';\nimport { Transition } from '../transition/transition';\nimport { Resolvable } from '../resolve/resolvable';\n\n/**\n * Returns a string shortened to a maximum length\n *\n * If the string is already less than the `max` length, return the string.\n * Else return the string, shortened to `max - 3` and append three dots (\"...\").\n *\n * @param max the maximum length of the string to return\n * @param str the input string\n */\nexport function maxLength(max: number, str: string) {\n if (str.length <= max) return str;\n return str.substr(0, max - 3) + '...';\n}\n\n/**\n * Returns a string, with spaces added to the end, up to a desired str length\n *\n * If the string is already longer than the desired length, return the string.\n * Else returns the string, with extra spaces on the end, such that it reaches `length` characters.\n *\n * @param length the desired length of the string to return\n * @param str the input string\n */\nexport function padString(length: number, str: string) {\n while (str.length < length) str += ' ';\n return str;\n}\n\nexport function kebobString(camelCase: string) {\n return camelCase\n .replace(/^([A-Z])/, $1 => $1.toLowerCase()) // replace first char\n .replace(/([A-Z])/g, $1 => '-' + $1.toLowerCase()); // replace rest\n}\n\nfunction _toJson(obj: Obj) {\n return JSON.stringify(obj);\n}\n\nfunction _fromJson(json: string) {\n return isString(json) ? JSON.parse(json) : json;\n}\n\n\nfunction promiseToString(p: Promise) {\n return `Promise(${JSON.stringify(p)})`;\n}\n\nexport function functionToString(fn: Function) {\n const fnStr = fnToString(fn);\n const namedFunctionMatch = fnStr.match(/^(function [^ ]+\\([^)]*\\))/);\n const toStr = namedFunctionMatch ? namedFunctionMatch[1] : fnStr;\n\n const fnName = fn['name'] || '';\n if (fnName && toStr.match(/function \\(/)) {\n return 'function ' + fnName + toStr.substr(9);\n }\n return toStr;\n}\n\nexport function fnToString(fn: IInjectable) {\n const _fn = isArray(fn) ? fn.slice(-1)[0] : fn;\n return _fn && _fn.toString() || 'undefined';\n}\n\nlet stringifyPatternFn: (val: any) => string = null;\nconst stringifyPattern = function(value: any) {\n const isRejection = Rejection.isRejectionPromise;\n\n stringifyPatternFn = stringifyPatternFn || pattern([\n [not(isDefined), val('undefined')],\n [isNull, val('null')],\n [isPromise, val('[Promise]')],\n [isRejection, (x: any) => x._transitionRejection.toString()],\n [is(Rejection), invoke('toString')],\n [is(Transition), invoke('toString')],\n [is(Resolvable), invoke('toString')],\n [isInjectable, functionToString],\n [val(true), identity],\n ]);\n\n return stringifyPatternFn(value);\n};\n\nexport function stringify(o: any) {\n const seen: any[] = [];\n\n function format(value: any) {\n if (isObject(value)) {\n if (seen.indexOf(value) !== -1) return '[circular ref]';\n seen.push(value);\n }\n return stringifyPattern(value);\n }\n\n return JSON.stringify(o, (key, value) => format(value)).replace(/\\\\\"/g, '\"');\n}\n\n/** Returns a function that splits a string on a character or substring */\nexport const beforeAfterSubstr = (char: string) => (str: string): string[] => {\n if (!str) return ['', ''];\n const idx = str.indexOf(char);\n if (idx === -1) return [str, ''];\n return [str.substr(0, idx), str.substr(idx + 1)];\n};\n\nexport const hostRegex = new RegExp('^(?:[a-z]+:)?//[^/]+/');\nexport const stripLastPathElement = (str: string) => str.replace(/\\/[^/]*$/, '');\nexport const splitHash = beforeAfterSubstr('#');\nexport const splitQuery = beforeAfterSubstr('?');\nexport const splitEqual = beforeAfterSubstr('=');\nexport const trimHashVal = (str: string) => str ? str.replace(/^#/, '') : '';\n\n/**\n * Splits on a delimiter, but returns the delimiters in the array\n *\n * #### Example:\n * ```js\n * var splitOnSlashes = splitOnDelim('/');\n * splitOnSlashes(\"/foo\"); // [\"/\", \"foo\"]\n * splitOnSlashes(\"/foo/\"); // [\"/\", \"foo\", \"/\"]\n * ```\n */\nexport function splitOnDelim(delim: string) {\n const re = new RegExp('(' + delim + ')', 'g');\n return (str: string) =>\n str.split(re).filter(identity);\n}\n\n\n/**\n * Reduce fn that joins neighboring strings\n *\n * Given an array of strings, returns a new array\n * where all neighboring strings have been joined.\n *\n * #### Example:\n * ```js\n * let arr = [\"foo\", \"bar\", 1, \"baz\", \"\", \"qux\" ];\n * arr.reduce(joinNeighborsR, []) // [\"foobar\", 1, \"bazqux\" ]\n * ```\n */\nexport function joinNeighborsR(acc: any[], x: any) {\n if (isString(tail(acc)) && isString(x))\n return acc.slice(0, -1).concat(tail(acc) + x);\n return pushR(acc, x);\n}\n\n", + "/** @module common */ /** for typedoc */\nexport * from './common';\nexport * from './coreservices';\nexport * from './glob';\nexport * from './hof';\nexport * from './predicates';\nexport * from './queue';\nexport * from './strings';\nexport * from './trace';\n", + "/**\n * @coreapi\n * @module params\n */\n/** */\nimport { fromJson, toJson, identity, equals, inherit, map, extend, pick } from '../common/common';\nimport { isDefined, isNullOrUndefined } from '../common/predicates';\nimport { is } from '../common/hof';\nimport { services } from '../common/coreservices';\nimport { ParamType } from './paramType';\nimport { ParamTypeDefinition } from './interface';\n\n/**\n * A registry for parameter types.\n *\n * This registry manages the built-in (and custom) parameter types.\n *\n * The built-in parameter types are:\n *\n * - [[string]]\n * - [[path]]\n * - [[query]]\n * - [[hash]]\n * - [[int]]\n * - [[bool]]\n * - [[date]]\n * - [[json]]\n * - [[any]]\n */\nexport class ParamTypes {\n /**\n * Built-in parameter type: `string`\n *\n * This parameter type coerces values to strings.\n * It matches anything (`new RegExp(\".*\")`) in the URL\n */\n static string: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `path`\n *\n * This parameter type is the default type for path parameters.\n * A path parameter is any parameter declared in the path portion of a url\n *\n * - `/foo/:param1/:param2`: two path parameters\n *\n * This parameter type behaves exactly like the [[string]] type with one exception.\n * When matching parameter values in the URL, the `path` type does not match forward slashes `/`.\n *\n * #### Angular 1 note:\n * In ng1, this type is overridden with one that pre-encodes slashes as `~2F` instead of `%2F`.\n * For more details about this angular 1 behavior, see: https://github.com/angular-ui/ui-router/issues/2598\n */\n static path: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `query`\n *\n * This parameter type is the default type for query/search parameters.\n * It behaves the same as the [[string]] parameter type.\n *\n * A query parameter is any parameter declared in the query/search portion of a url\n *\n * - `/bar?param2`: a query parameter\n */\n static query: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `hash`\n *\n * This parameter type is used for the `#` parameter (the hash)\n * It behaves the same as the [[string]] parameter type.\n * @coreapi\n */\n static hash: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `int`\n *\n * This parameter type serializes javascript integers (`number`s which represent an integer) to the URL.\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'user',\n * url: '/user/{id:int}'\n * });\n * ```\n * ```js\n * $state.go('user', { id: 1298547 });\n * ```\n *\n * The URL will serialize to: `/user/1298547`.\n *\n * When the parameter value is read, it will be the `number` `1298547`, not the string `\"1298547\"`.\n */\n static int: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `bool`\n *\n * This parameter type serializes `true`/`false` as `1`/`0`\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'inbox',\n * url: '/inbox?{unread:bool}'\n * });\n * ```\n * ```js\n * $state.go('inbox', { unread: true });\n * ```\n *\n * The URL will serialize to: `/inbox?unread=1`.\n *\n * Conversely, if the url is `/inbox?unread=0`, the value of the `unread` parameter will be a `false`.\n */\n static bool: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `date`\n *\n * This parameter type can be used to serialize Javascript dates as parameter values.\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'search',\n * url: '/search?{start:date}'\n * });\n * ```\n * ```js\n * $state.go('search', { start: new Date(2000, 0, 1) });\n * ```\n *\n * The URL will serialize to: `/search?start=2000-01-01`.\n *\n * Conversely, if the url is `/search?start=2016-12-25`, the value of the `start` parameter will be a `Date` object where:\n *\n * - `date.getFullYear() === 2016`\n * - `date.getMonth() === 11` (month is 0-based)\n * - `date.getDate() === 25`\n */\n static date: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `json`\n *\n * This parameter type can be used to serialize javascript objects into the URL using JSON serialization.\n *\n * #### Example:\n * This example serializes an plain javascript object to the URL\n * ```js\n * .state({\n * name: 'map',\n * url: '/map/{coords:json}'\n * });\n * ```\n * ```js\n * $state.go('map', { coords: { x: 10399.2, y: 49071 });\n * ```\n *\n * The URL will serialize to: `/map/%7B%22x%22%3A10399.2%2C%22y%22%3A49071%7D`\n */\n static json: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `any`\n *\n * This parameter type is used by default for url-less parameters (parameters that do not appear in the URL).\n * This type does not encode or decode.\n * It is compared using a deep `equals` comparison.\n *\n * #### Example:\n * This example defines a non-url parameter on a [[StateDeclaration]].\n * ```js\n * .state({\n * name: 'new',\n * url: '/new',\n * params: {\n * inrepyto: null\n * }\n * });\n * ```\n * ```js\n * $state.go('new', { inreplyto: currentMessage });\n * ```\n */\n static any: ParamTypeDefinition;\n\n\n /** @hidden */\n types: any;\n /** @hidden */\n enqueue = true;\n /** @hidden */\n typeQueue: any[] = [];\n\n /** @internalapi */\n private defaultTypes: any = pick(ParamTypes.prototype, ['hash', 'string', 'query', 'path', 'int', 'bool', 'date', 'json', 'any']);\n\n /** @internalapi */\n constructor() {\n // Register default types. Store them in the prototype of this.types.\n const makeType = (definition: ParamTypeDefinition, name: string) =>\n new ParamType(extend({ name }, definition));\n this.types = inherit(map(this.defaultTypes, makeType), {});\n }\n\n /** @internalapi */\n dispose() {\n this.types = {};\n }\n\n /**\n * Registers a parameter type\n *\n * End users should call [[UrlMatcherFactory.type]], which delegates to this method.\n */\n type(name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {\n if (!isDefined(definition)) return this.types[name];\n if (this.types.hasOwnProperty(name)) throw new Error(`A type named '${name}' has already been defined.`);\n\n this.types[name] = new ParamType(extend({ name }, definition));\n\n if (definitionFn) {\n this.typeQueue.push({ name, def: definitionFn });\n if (!this.enqueue) this._flushTypeQueue();\n }\n\n return this;\n }\n\n /** @internalapi */\n _flushTypeQueue() {\n while (this.typeQueue.length) {\n const type = this.typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n extend(this.types[type.name], services.$injector.invoke(type.def));\n }\n }\n}\n\n/** @hidden */\nfunction initDefaultTypes() {\n\n const makeDefaultType = (def) => {\n const valToString = (val: any) =>\n val != null ? val.toString() : val;\n\n const defaultTypeBase = {\n encode: valToString,\n decode: valToString,\n is: is(String),\n pattern: /.*/,\n // tslint:disable-next-line:triple-equals\n equals: (a: any, b: any) => a == b, // allow coersion for null/undefined/\"\"\n };\n\n return extend({}, defaultTypeBase, def) as ParamTypeDefinition;\n };\n\n // Default Parameter Type Definitions\n extend(ParamTypes.prototype, {\n string: makeDefaultType({}),\n\n path: makeDefaultType({\n pattern: /[^/]*/,\n }),\n\n query: makeDefaultType({}),\n\n hash: makeDefaultType({\n inherit: false,\n }),\n\n int: makeDefaultType({\n decode: (val: string) => parseInt(val, 10),\n is: function(val: any) {\n return !isNullOrUndefined(val) && this.decode(val.toString()) === val;\n },\n pattern: /-?\\d+/,\n }),\n\n bool: makeDefaultType({\n encode: (val: any) => val && 1 || 0,\n decode: (val: string) => parseInt(val, 10) !== 0,\n is: is(Boolean),\n pattern: /0|1/,\n }),\n\n date: makeDefaultType({\n encode: function(val: any) {\n return !this.is(val) ? undefined : [\n val.getFullYear(),\n ('0' + (val.getMonth() + 1)).slice(-2),\n ('0' + val.getDate()).slice(-2),\n ].join('-');\n },\n decode: function(val: string) {\n if (this.is(val)) return val as Date;\n const match = this.capture.exec(val);\n return match ? new Date(match[1], match[2] - 1, match[3]) : undefined;\n },\n is: (val: any) => val instanceof Date && !isNaN(val.valueOf()),\n equals(l: any, r: any) {\n return ['getFullYear', 'getMonth', 'getDate']\n .reduce((acc, fn) => acc && l[fn]() === r[fn](), true);\n },\n pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,\n capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/,\n }),\n\n json: makeDefaultType({\n encode: toJson,\n decode: fromJson,\n is: is(Object),\n equals: equals,\n pattern: /[^/]*/,\n }),\n\n // does not encode/decode\n any: makeDefaultType({\n encode: identity,\n decode: identity,\n is: () => true,\n equals: equals,\n }),\n });\n}\n\ninitDefaultTypes();\n\n", + "/**\n * @coreapi\n * @module params\n */\n/** */\nimport { extend, ancestors, Obj } from '../common/common';\nimport { StateObject } from '../state/stateObject';\n\n/** @internalapi */\nexport class StateParams {\n [key: string]: any;\n\n constructor(params: Obj = {}) {\n extend(this, params);\n }\n\n /**\n * Merges a set of parameters with all parameters inherited between the common parents of the\n * current state and a given destination state.\n *\n * @param {Object} newParams The set of parameters which will be composited with inherited params.\n * @param {Object} $current Internal definition of object representing the current state.\n * @param {Object} $to Internal definition of object representing state to transition to.\n */\n $inherit(newParams: Obj, $current: StateObject, $to: StateObject) {\n let parentParams: string[];\n const parents = ancestors($current, $to),\n inherited: Obj = {},\n inheritList: string[] = [];\n\n for (const i in parents) {\n if (!parents[i] || !parents[i].params) continue;\n parentParams = Object.keys(parents[i].params);\n if (!parentParams.length) continue;\n\n for (const j in parentParams) {\n if (inheritList.indexOf(parentParams[j]) >= 0) continue;\n inheritList.push(parentParams[j]);\n inherited[parentParams[j]] = this[parentParams[j]];\n }\n }\n return extend({}, inherited, newParams);\n }\n}\n\n", + "/** @module path */ /** for typedoc */\nexport * from './pathNode';\nexport * from './pathUtils';\n", + "/** @module resolve */ /** for typedoc */\nexport * from './interface';\nexport * from './resolvable';\nexport * from './resolveContext';\n", + "/** @module state */ /** for typedoc */\nimport { Obj, omit, noop, extend, inherit, values, applyPairs, tail, mapObj, identity } from '../common/common';\nimport { isDefined, isFunction, isString, isArray } from '../common/predicates';\nimport { stringify } from '../common/strings';\nimport { prop, pattern, is, pipe, val } from '../common/hof';\nimport { StateDeclaration } from './interface';\n\nimport { StateObject } from './stateObject';\nimport { StateMatcher } from './stateMatcher';\nimport { Param } from '../params/param';\nimport { UrlMatcherFactory } from '../url/urlMatcherFactory';\nimport { UrlMatcher } from '../url/urlMatcher';\nimport { Resolvable } from '../resolve/resolvable';\nimport { services } from '../common/coreservices';\nimport { ResolvePolicy } from '../resolve/interface';\nimport { ParamFactory } from '../url/interface';\n\nconst parseUrl = (url: string): any => {\n if (!isString(url)) return false;\n const root = url.charAt(0) === '^';\n return { val: root ? url.substring(1) : url, root };\n};\n\nexport type BuilderFunction = (state: StateObject, parent?: BuilderFunction) => any;\n\ninterface Builders {\n [key: string]: BuilderFunction[];\n\n name: BuilderFunction[];\n parent: BuilderFunction[];\n data: BuilderFunction[];\n url: BuilderFunction[];\n navigable: BuilderFunction[];\n params: BuilderFunction[];\n views: BuilderFunction[];\n path: BuilderFunction[];\n includes: BuilderFunction[];\n resolvables: BuilderFunction[];\n}\n\n\nfunction nameBuilder(state: StateObject) {\n return state.name;\n}\n\nfunction selfBuilder(state: StateObject) {\n state.self.$$state = () => state;\n return state.self;\n}\n\nfunction dataBuilder(state: StateObject) {\n if (state.parent && state.parent.data) {\n state.data = state.self.data = inherit(state.parent.data, state.data);\n }\n return state.data;\n}\n\nconst getUrlBuilder = ($urlMatcherFactoryProvider: UrlMatcherFactory, root: () => StateObject) =>\nfunction urlBuilder(state: StateObject) {\n const stateDec: StateDeclaration = state;\n\n // For future states, i.e., states whose name ends with `.**`,\n // match anything that starts with the url prefix\n if (stateDec && stateDec.url && stateDec.name && stateDec.name.match(/\\.\\*\\*$/)) {\n stateDec.url += '{remainder:any}'; // match any path (.*)\n }\n\n const parsed = parseUrl(stateDec.url), parent = state.parent;\n const url = !parsed ? stateDec.url : $urlMatcherFactoryProvider.compile(parsed.val, {\n params: state.params || {},\n paramMap: function (paramConfig: any, isSearch: boolean) {\n if (stateDec.reloadOnSearch === false && isSearch) paramConfig = extend(paramConfig || {}, { dynamic: true });\n return paramConfig;\n },\n });\n\n if (!url) return null;\n if (!$urlMatcherFactoryProvider.isMatcher(url)) throw new Error(`Invalid url '${url}' in state '${state}'`);\n return (parsed && parsed.root) ? url : ((parent && parent.navigable) || root()).url.append( url);\n};\n\nconst getNavigableBuilder = (isRoot: (state: StateObject) => boolean) =>\nfunction navigableBuilder(state: StateObject) {\n return !isRoot(state) && state.url ? state : (state.parent ? state.parent.navigable : null);\n};\n\nconst getParamsBuilder = (paramFactory: ParamFactory) =>\nfunction paramsBuilder(state: StateObject): { [key: string]: Param } {\n const makeConfigParam = (config: any, id: string) => paramFactory.fromConfig(id, null, config);\n const urlParams: Param[] = (state.url && state.url.parameters({ inherit: false })) || [];\n const nonUrlParams: Param[] = values(mapObj(omit(state.params || {}, urlParams.map(prop('id'))), makeConfigParam));\n return urlParams.concat(nonUrlParams).map(p => [p.id, p]).reduce(applyPairs, {});\n};\n\nfunction pathBuilder(state: StateObject) {\n return state.parent ? state.parent.path.concat(state) : /*root*/ [state];\n}\n\nfunction includesBuilder(state: StateObject) {\n const includes = state.parent ? extend({}, state.parent.includes) : {};\n includes[state.name] = true;\n return includes;\n}\n\n/**\n * This is a [[StateBuilder.builder]] function for the `resolve:` block on a [[StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * validates the `resolve` property and converts it to a [[Resolvable]] array.\n *\n * resolve: input value can be:\n *\n * {\n * // analyzed but not injected\n * myFooResolve: function() { return \"myFooData\"; },\n *\n * // function.toString() parsed, \"DependencyName\" dep as string (not min-safe)\n * myBarResolve: function(DependencyName) { return DependencyName.fetchSomethingAsPromise() },\n *\n * // Array split; \"DependencyName\" dep as string\n * myBazResolve: [ \"DependencyName\", function(dep) { return dep.fetchSomethingAsPromise() },\n *\n * // Array split; DependencyType dep as token (compared using ===)\n * myQuxResolve: [ DependencyType, function(dep) { return dep.fetchSometingAsPromise() },\n *\n * // val.$inject used as deps\n * // where:\n * // corgeResolve.$inject = [\"DependencyName\"];\n * // function corgeResolve(dep) { dep.fetchSometingAsPromise() }\n * // then \"DependencyName\" dep as string\n * myCorgeResolve: corgeResolve,\n *\n * // inject service by name\n * // When a string is found, desugar creating a resolve that injects the named service\n * myGraultResolve: \"SomeService\"\n * }\n *\n * or:\n *\n * [\n * new Resolvable(\"myFooResolve\", function() { return \"myFooData\" }),\n * new Resolvable(\"myBarResolve\", function(dep) { return dep.fetchSomethingAsPromise() }, [ \"DependencyName\" ]),\n * { provide: \"myBazResolve\", useFactory: function(dep) { dep.fetchSomethingAsPromise() }, deps: [ \"DependencyName\" ] }\n * ]\n */\nexport function resolvablesBuilder(state: StateObject): Resolvable[] {\n interface Tuple { token: any, val: any, deps: any[], policy: ResolvePolicy }\n\n /** convert resolve: {} and resolvePolicy: {} objects to an array of tuples */\n const objects2Tuples = (resolveObj: Obj, resolvePolicies: { [key: string]: ResolvePolicy }) =>\n Object.keys(resolveObj || {}).map(token => ({ token, val: resolveObj[token], deps: undefined, policy: resolvePolicies[token] }));\n\n /** fetch DI annotations from a function or ng1-style array */\n const annotate = (fn: Function) => {\n const $injector = services.$injector;\n // ng1 doesn't have an $injector until runtime.\n // If the $injector doesn't exist, use \"deferred\" literal as a\n // marker indicating they should be annotated when runtime starts\n return fn['$inject'] || ($injector && $injector.annotate(fn, $injector.strictDi)) || 'deferred';\n };\n\n /** true if the object has both `token` and `resolveFn`, and is probably a [[ResolveLiteral]] */\n const isResolveLiteral = (obj: any) => !!(obj.token && obj.resolveFn);\n\n /** true if the object looks like a provide literal, or a ng2 Provider */\n const isLikeNg2Provider = (obj: any) => !!((obj.provide || obj.token) && (obj.useValue || obj.useFactory || obj.useExisting || obj.useClass));\n\n /** true if the object looks like a tuple from obj2Tuples */\n const isTupleFromObj = (obj: any) => !!(obj && obj.val && (isString(obj.val) || isArray(obj.val) || isFunction(obj.val)));\n\n /** extracts the token from a Provider or provide literal */\n const getToken = (p: any) => p.provide || p.token;\n\n /** Given a literal resolve or provider object, returns a Resolvable */\n const literal2Resolvable = pattern([\n [prop('resolveFn'), p => new Resolvable(getToken(p), p.resolveFn, p.deps, p.policy)],\n [prop('useFactory'), p => new Resolvable(getToken(p), p.useFactory, (p.deps || p.dependencies), p.policy)],\n [prop('useClass'), p => new Resolvable(getToken(p), () => new (p.useClass)(), [], p.policy)],\n [prop('useValue'), p => new Resolvable(getToken(p), () => p.useValue, [], p.policy, p.useValue)],\n [prop('useExisting'), p => new Resolvable(getToken(p), identity, [p.useExisting], p.policy)],\n ]);\n\n const tuple2Resolvable = pattern([\n [pipe(prop('val'), isString), (tuple: Tuple) => new Resolvable(tuple.token, identity, [ tuple.val ], tuple.policy)],\n [pipe(prop('val'), isArray), (tuple: Tuple) => new Resolvable(tuple.token, tail( tuple.val), tuple.val.slice(0, -1), tuple.policy)],\n [pipe(prop('val'), isFunction), (tuple: Tuple) => new Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy)],\n ]);\n\n const item2Resolvable = <(obj: any) => Resolvable> pattern([\n [is(Resolvable), (r: Resolvable) => r],\n [isResolveLiteral, literal2Resolvable],\n [isLikeNg2Provider, literal2Resolvable],\n [isTupleFromObj, tuple2Resolvable],\n [val(true), (obj: any) => { throw new Error('Invalid resolve value: ' + stringify(obj)); }],\n ]);\n\n // If resolveBlock is already an array, use it as-is.\n // Otherwise, assume it's an object and convert to an Array of tuples\n const decl = state.resolve;\n const items: any[] = isArray(decl) ? decl : objects2Tuples(decl, state.resolvePolicy || {});\n return items.map(item2Resolvable);\n}\n\n/**\n * @internalapi A internal global service\n *\n * StateBuilder is a factory for the internal [[StateObject]] objects.\n *\n * When you register a state with the [[StateRegistry]], you register a plain old javascript object which\n * conforms to the [[StateDeclaration]] interface. This factory takes that object and builds the corresponding\n * [[StateObject]] object, which has an API and is used internally.\n *\n * Custom properties or API may be added to the internal [[StateObject]] object by registering a decorator function\n * using the [[builder]] method.\n */\nexport class StateBuilder {\n /** An object that contains all the BuilderFunctions registered, key'd by the name of the State property they build */\n private builders: Builders;\n\n constructor(private matcher: StateMatcher, urlMatcherFactory: UrlMatcherFactory) {\n const self = this;\n\n const root = () => matcher.find('');\n const isRoot = (state: StateObject) => state.name === '';\n\n function parentBuilder(state: StateObject) {\n if (isRoot(state)) return null;\n return matcher.find(self.parentName(state)) || root();\n }\n\n this.builders = {\n name: [ nameBuilder ],\n self: [ selfBuilder ],\n parent: [ parentBuilder ],\n data: [ dataBuilder ],\n // Build a URLMatcher if necessary, either via a relative or absolute URL\n url: [ getUrlBuilder(urlMatcherFactory, root) ],\n // Keep track of the closest ancestor state that has a URL (i.e. is navigable)\n navigable: [ getNavigableBuilder(isRoot) ],\n params: [ getParamsBuilder(urlMatcherFactory.paramFactory) ],\n // Each framework-specific ui-router implementation should define its own `views` builder\n // e.g., src/ng1/statebuilders/views.ts\n views: [],\n // Keep a full path from the root down to this state as this is needed for state activation.\n path: [ pathBuilder ],\n // Speed up $state.includes() as it's used a lot\n includes: [ includesBuilder ],\n resolvables: [ resolvablesBuilder ],\n };\n }\n\n /**\n * Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`).\n * More than one BuilderFunction can be registered for a given property.\n *\n * The BuilderFunction(s) will be used to define the property on any subsequently built [[StateObject]] objects.\n *\n * @param name The name of the State property being registered for.\n * @param fn The BuilderFunction which will be used to build the State property\n * @returns a function which deregisters the BuilderFunction\n */\n builder(name: string, fn: BuilderFunction): (BuilderFunction|BuilderFunction[]|Function) {\n const builders = this.builders;\n const array = builders[name] || [];\n // Backwards compat: if only one builder exists, return it, else return whole arary.\n if (isString(name) && !isDefined(fn)) return array.length > 1 ? array : array[0];\n if (!isString(name) || !isFunction(fn)) return;\n\n builders[name] = array;\n builders[name].push(fn);\n return () => builders[name].splice(builders[name].indexOf(fn, 1)) && null;\n }\n\n /**\n * Builds all of the properties on an essentially blank State object, returning a State object which has all its\n * properties and API built.\n *\n * @param state an uninitialized State object\n * @returns the built State object\n */\n build(state: StateObject): StateObject {\n const { matcher, builders } = this;\n const parent = this.parentName(state);\n\n if (parent && !matcher.find(parent, undefined, false)) {\n return null;\n }\n\n for (const key in builders) {\n if (!builders.hasOwnProperty(key)) continue;\n const chain = builders[key].reduce((parentFn: BuilderFunction, step: BuilderFunction) => (_state) => step(_state, parentFn), noop);\n state[key] = chain(state);\n }\n return state;\n }\n\n parentName(state: StateObject) {\n // name = 'foo.bar.baz.**'\n const name = state.name || '';\n // segments = ['foo', 'bar', 'baz', '.**']\n const segments = name.split('.');\n // segments = ['foo', 'bar', 'baz']\n const lastSegment = segments.pop();\n // segments = ['foo', 'bar'] (ignore .** segment for future states)\n if (lastSegment === '**') segments.pop();\n\n if (segments.length) {\n if (state.parent) {\n throw new Error(`States that specify the 'parent:' property should not have a '.' in their name (${name})`);\n }\n\n // 'foo.bar'\n return segments.join('.');\n }\n\n if (!state.parent) return '';\n return isString(state.parent) ? state.parent : state.parent.name;\n }\n\n name(state: StateObject) {\n const name = state.name;\n if (name.indexOf('.') !== -1 || !state.parent) return name;\n\n const parentName = isString(state.parent) ? state.parent : state.parent.name;\n return parentName ? parentName + '.' + name : name;\n }\n}\n", + "/** @module state */ /** for typedoc */\nimport { isString } from '../common/predicates';\nimport { StateOrName } from './interface';\nimport { StateObject } from './stateObject';\nimport { values } from '../common/common';\n\nexport class StateMatcher {\n constructor (private _states: { [key: string]: StateObject }) { }\n\n isRelative(stateName: string) {\n stateName = stateName || '';\n return stateName.indexOf('.') === 0 || stateName.indexOf('^') === 0;\n }\n\n\n find(stateOrName: StateOrName, base?: StateOrName, matchGlob = true): StateObject {\n if (!stateOrName && stateOrName !== '') return undefined;\n const isStr = isString(stateOrName);\n let name: string = isStr ? stateOrName : (stateOrName).name;\n\n if (this.isRelative(name)) name = this.resolvePath(name, base);\n const state = this._states[name];\n\n if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {\n return state;\n } else if (isStr && matchGlob) {\n const _states = values(this._states);\n const matches = _states.filter(_state =>\n _state.__stateObjectCache.nameGlob &&\n _state.__stateObjectCache.nameGlob.matches(name),\n );\n\n if (matches.length > 1) {\n // tslint:disable-next-line:no-console\n console.log(`stateMatcher.find: Found multiple matches for ${name} using glob: `, matches.map(match => match.name));\n }\n return matches[0];\n }\n return undefined;\n }\n\n resolvePath(name: string, base: StateOrName) {\n if (!base) throw new Error(`No reference point given for path '${name}'`);\n\n const baseState: StateObject = this.find(base);\n\n const splitName = name.split('.');\n const pathLength = splitName.length;\n let i = 0, current = baseState;\n\n for (; i < pathLength; i++) {\n if (splitName[i] === '' && i === 0) {\n current = baseState;\n continue;\n }\n if (splitName[i] === '^') {\n if (!current.parent) throw new Error(`Path '${name}' not valid for state '${baseState.name}'`);\n current = current.parent;\n continue;\n }\n break;\n }\n const relName = splitName.slice(i).join('.');\n return current.name + (current.name && relName ? '.' : '') + relName;\n }\n}\n", + "/** @module state */ /** for typedoc */\nimport { inArray } from '../common/common';\nimport { isString } from '../common/predicates';\nimport { StateDeclaration, _StateDeclaration } from './interface';\nimport { StateObject } from './stateObject';\nimport { StateBuilder } from './stateBuilder';\nimport { StateRegistryListener, StateRegistry } from './stateRegistry';\nimport { Disposable } from '../interface';\nimport { UrlRouter } from '../url/urlRouter';\nimport { prop } from '../common/hof';\nimport { StateMatcher } from './stateMatcher';\n\n/** @internalapi */\nexport class StateQueueManager implements Disposable {\n queue: StateObject[];\n matcher: StateMatcher;\n\n constructor(\n private $registry: StateRegistry,\n private $urlRouter: UrlRouter,\n public states: { [key: string]: StateObject; },\n public builder: StateBuilder,\n public listeners: StateRegistryListener[]) {\n this.queue = [];\n this.matcher = $registry.matcher;\n }\n\n /** @internalapi */\n dispose() {\n this.queue = [];\n }\n\n register(stateDecl: _StateDeclaration) {\n const queue = this.queue;\n const state = StateObject.create(stateDecl);\n const name = state.name;\n\n if (!isString(name)) throw new Error('State must have a valid name');\n if (this.states.hasOwnProperty(name) || inArray(queue.map(prop('name')), name))\n throw new Error(`State '${name}' is already defined`);\n\n queue.push(state);\n this.flush();\n\n return state;\n }\n\n flush() {\n const { queue, states, builder } = this;\n const registered: StateObject[] = [], // states that got registered\n orphans: StateObject[] = [], // states that don't yet have a parent registered\n previousQueueLength = {}; // keep track of how long the queue when an orphan was first encountered\n const getState = (name) =>\n this.states.hasOwnProperty(name) && this.states[name];\n\n while (queue.length > 0) {\n const state: StateObject = queue.shift();\n const name = state.name;\n const result: StateObject = builder.build(state);\n const orphanIdx: number = orphans.indexOf(state);\n\n if (result) {\n const existingState = getState(name);\n if (existingState && existingState.name === name) {\n throw new Error(`State '${name}' is already defined`);\n }\n\n const existingFutureState = getState(name + '.**');\n if (existingFutureState) {\n // Remove future state of the same name\n this.$registry.deregister(existingFutureState);\n }\n\n states[name] = state;\n this.attachRoute(state);\n if (orphanIdx >= 0) orphans.splice(orphanIdx, 1);\n registered.push(state);\n continue;\n }\n\n const prev = previousQueueLength[name];\n previousQueueLength[name] = queue.length;\n if (orphanIdx >= 0 && prev === queue.length) {\n // Wait until two consecutive iterations where no additional states were dequeued successfully.\n // throw new Error(`Cannot register orphaned state '${name}'`);\n queue.push(state);\n return states;\n } else if (orphanIdx < 0) {\n orphans.push(state);\n }\n\n queue.push(state);\n }\n\n if (registered.length) {\n this.listeners.forEach(listener => listener('registered', registered.map(s => s.self)));\n }\n\n return states;\n }\n\n attachRoute(state: StateObject) {\n if (state.abstract || !state.url) return;\n\n this.$urlRouter.rule(this.$urlRouter.urlRuleFactory.create(state));\n }\n}\n", + "/**\n * @coreapi\n * @module state\n */ /** for typedoc */\n\nimport { StateObject } from './stateObject';\nimport { StateMatcher } from './stateMatcher';\nimport { StateBuilder } from './stateBuilder';\nimport { StateQueueManager } from './stateQueueManager';\nimport { StateDeclaration, _StateDeclaration } from './interface';\nimport { BuilderFunction } from './stateBuilder';\nimport { StateOrName } from './interface';\nimport { removeFrom } from '../common/common';\nimport { UIRouter } from '../router';\nimport { propEq } from '../common/hof';\n\n/**\n * The signature for the callback function provided to [[StateRegistry.onStatesChanged]].\n *\n * This callback receives two parameters:\n *\n * @param event a string; either \"registered\" or \"deregistered\"\n * @param states the list of [[StateDeclaration]]s that were registered (or deregistered).\n */\nexport type StateRegistryListener = (event: 'registered'|'deregistered', states: StateDeclaration[]) => void;\n\nexport class StateRegistry {\n private _root: StateObject;\n private states: { [key: string]: StateObject } = {};\n\n matcher: StateMatcher;\n private builder: StateBuilder;\n stateQueue: StateQueueManager;\n\n listeners: StateRegistryListener[] = [];\n\n /** @internalapi */\n constructor(private _router: UIRouter) {\n this.matcher = new StateMatcher(this.states);\n this.builder = new StateBuilder(this.matcher, _router.urlMatcherFactory);\n this.stateQueue = new StateQueueManager(this, _router.urlRouter, this.states, this.builder, this.listeners);\n this._registerRoot();\n }\n\n /** @internalapi */\n private _registerRoot() {\n const rootStateDef: StateDeclaration = {\n name: '',\n url: '^',\n views: null,\n params: {\n '#': { value: null, type: 'hash', dynamic: true },\n },\n abstract: true,\n };\n\n const _root = this._root = this.stateQueue.register(rootStateDef);\n _root.navigable = null;\n }\n\n /** @internalapi */\n dispose() {\n this.stateQueue.dispose();\n this.listeners = [];\n this.get().forEach(state => this.get(state) && this.deregister(state));\n }\n\n /**\n * Listen for a State Registry events\n *\n * Adds a callback that is invoked when states are registered or deregistered with the StateRegistry.\n *\n * #### Example:\n * ```js\n * let allStates = registry.get();\n *\n * // Later, invoke deregisterFn() to remove the listener\n * let deregisterFn = registry.onStatesChanged((event, states) => {\n * switch(event) {\n * case: 'registered':\n * states.forEach(state => allStates.push(state));\n * break;\n * case: 'deregistered':\n * states.forEach(state => {\n * let idx = allStates.indexOf(state);\n * if (idx !== -1) allStates.splice(idx, 1);\n * });\n * break;\n * }\n * });\n * ```\n *\n * @param listener a callback function invoked when the registered states changes.\n * The function receives two parameters, `event` and `state`.\n * See [[StateRegistryListener]]\n * @return a function that deregisters the listener\n */\n onStatesChanged(listener: StateRegistryListener): () => void {\n this.listeners.push(listener);\n return function deregisterListener() {\n removeFrom(this.listeners)(listener);\n }.bind(this);\n }\n\n /**\n * Gets the implicit root state\n *\n * Gets the root of the state tree.\n * The root state is implicitly created by UI-Router.\n * Note: this returns the internal [[StateObject]] representation, not a [[StateDeclaration]]\n *\n * @return the root [[StateObject]]\n */\n root() {\n return this._root;\n }\n\n /**\n * Adds a state to the registry\n *\n * Registers a [[StateDeclaration]] or queues it for registration.\n *\n * Note: a state will be queued if the state's parent isn't yet registered.\n *\n * @param stateDefinition the definition of the state to register.\n * @returns the internal [[StateObject]] object.\n * If the state was successfully registered, then the object is fully built (See: [[StateBuilder]]).\n * If the state was only queued, then the object is not fully built.\n */\n register(stateDefinition: _StateDeclaration): StateObject {\n return this.stateQueue.register(stateDefinition);\n }\n\n /** @hidden */\n private _deregisterTree(state: StateObject) {\n const all = this.get().map(s => s.$$state());\n const getChildren = (states: StateObject[]) => {\n const _children = all.filter(s => states.indexOf(s.parent) !== -1);\n return _children.length === 0 ? _children : _children.concat(getChildren(_children));\n };\n\n const children = getChildren([state]);\n const deregistered: StateObject[] = [state].concat(children).reverse();\n\n deregistered.forEach(_state => {\n const $ur = this._router.urlRouter;\n // Remove URL rule\n $ur.rules().filter(propEq('state', _state)).forEach($ur.removeRule.bind($ur));\n // Remove state from registry\n delete this.states[_state.name];\n });\n\n return deregistered;\n }\n\n /**\n * Removes a state from the registry\n *\n * This removes a state from the registry.\n * If the state has children, they are are also removed from the registry.\n *\n * @param stateOrName the state's name or object representation\n * @returns {StateObject[]} a list of removed states\n */\n deregister(stateOrName: StateOrName) {\n const _state = this.get(stateOrName);\n if (!_state) throw new Error(\"Can't deregister state; not found: \" + stateOrName);\n const deregisteredStates = this._deregisterTree(_state.$$state());\n\n this.listeners.forEach(listener => listener('deregistered', deregisteredStates.map(s => s.self)));\n return deregisteredStates;\n }\n\n /**\n * Gets all registered states\n *\n * Calling this method with no arguments will return a list of all the states that are currently registered.\n * Note: this does not return states that are *queued* but not yet registered.\n *\n * @return a list of [[StateDeclaration]]s\n */\n get(): StateDeclaration[];\n\n /**\n * Gets a registered state\n *\n * Given a state or a name, finds and returns the [[StateDeclaration]] from the registry.\n * Note: this does not return states that are *queued* but not yet registered.\n *\n * @param stateOrName either the name of a state, or a state object.\n * @param base the base state to use when stateOrName is relative.\n * @return a registered [[StateDeclaration]] that matched the `stateOrName`, or null if the state isn't registered.\n */\n get(stateOrName: StateOrName, base?: StateOrName): StateDeclaration;\n get(stateOrName?: StateOrName, base?: StateOrName): any {\n if (arguments.length === 0)\n return Object.keys(this.states).map(name => this.states[name].self);\n const found = this.matcher.find(stateOrName, base);\n return found && found.self || null;\n }\n\n decorator(name: string, func: BuilderFunction) {\n return this.builder.builder(name, func);\n }\n}\n", + "/**\n * @coreapi\n * @module url\n */\n/** for typedoc */\nimport {\n map, defaults, inherit, identity, unnest, tail, find, Obj, pairs, allTrueR, unnestR, arrayTuples,\n} from '../common/common';\nimport { prop, propEq } from '../common/hof';\nimport { isArray, isString, isDefined } from '../common/predicates';\nimport { Param, DefType } from '../params/param';\nimport { ParamTypes } from '../params/paramTypes';\nimport { RawParams } from '../params/interface';\nimport { ParamFactory } from './interface';\nimport { joinNeighborsR, splitOnDelim } from '../common/strings';\n\n/** @hidden */\nfunction quoteRegExp(str: any, param?: any) {\n let surroundPattern = ['', ''], result = str.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, '\\\\$&');\n if (!param) return result;\n\n switch (param.squash) {\n case false:\n surroundPattern = ['(', ')' + (param.isOptional ? '?' : '')]; break;\n case true:\n result = result.replace(/\\/$/, '');\n surroundPattern = ['(?:\\/(', ')|\\/)?'];\n break;\n default:\n surroundPattern = [`(${param.squash}|`, ')?']; break;\n }\n return result + surroundPattern[0] + param.type.pattern.source + surroundPattern[1];\n}\n\n/** @hidden */\nconst memoizeTo = (obj: Obj, _prop: string, fn: Function) =>\n obj[_prop] = obj[_prop] || fn();\n\n/** @hidden */\nconst splitOnSlash = splitOnDelim('/');\n\n/** @hidden */\ninterface UrlMatcherCache {\n segments?: any[];\n weights?: number[];\n path?: UrlMatcher[];\n parent?: UrlMatcher;\n pattern?: RegExp;\n}\n\n/**\n * Matches URLs against patterns.\n *\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL.\n *\n * A URL pattern consists of a path pattern, optionally followed by '?' and a list of search (query)\n * parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by [[UrlMatcher.exec]].\n *\n * - *Path parameters* are defined using curly brace placeholders (`/somepath/{param}`)\n * or colon placeholders (`/somePath/:param`).\n *\n * - *A parameter RegExp* may be defined for a param after a colon\n * (`/somePath/{param:[a-zA-Z0-9]+}`) in a curly brace placeholder.\n * The regexp must match for the url to be matched.\n * Should the regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Note: a RegExp parameter will encode its value using either [[ParamTypes.path]] or [[ParamTypes.query]].\n *\n * - *Custom parameter types* may also be specified after a colon (`/somePath/{param:int}`) in curly brace parameters.\n * See [[UrlMatcherFactory.type]] for more information.\n *\n * - *Catch-all parameters* are defined using an asterisk placeholder (`/somepath/*catchallparam`).\n * A catch-all * parameter value will contain the remainder of the URL.\n *\n * ---\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters).\n * A path parameter matches any number of characters other than '/'. For catch-all\n * placeholders the path parameter matches any number of characters.\n *\n * Examples:\n *\n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n * trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n * '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n * parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n * path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n * * `'/calendar/{start:date}'` - Matches \"/calendar/2014-11-12\" (because the pattern defined\n * in the built-in `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start\n *\n */\nexport class UrlMatcher {\n /** @hidden */\n static nameValidator: RegExp = /^\\w+([-.]+\\w+)*(?:\\[\\])?$/;\n\n /** @hidden */\n private _cache: UrlMatcherCache = { path: [this] };\n /** @hidden */\n private _children: UrlMatcher[] = [];\n /** @hidden */\n private _params: Param[] = [];\n /** @hidden */\n private _segments: string[] = [];\n /** @hidden */\n private _compiled: string[] = [];\n\n /** The pattern that was passed into the constructor */\n public pattern: string;\n\n /** @hidden */\n static encodeDashes(str: string) { // Replace dashes with encoded \"\\-\"\n return encodeURIComponent(str).replace(/-/g, c => `%5C%${c.charCodeAt(0).toString(16).toUpperCase()}`);\n }\n\n /** @hidden Given a matcher, return an array with the matcher's path segments and path params, in order */\n static pathSegmentsAndParams(matcher: UrlMatcher) {\n const staticSegments = matcher._segments;\n const pathParams = matcher._params.filter(p => p.location === DefType.PATH);\n return arrayTuples(staticSegments, pathParams.concat(undefined))\n .reduce(unnestR, [])\n .filter(x => x !== '' && isDefined(x));\n }\n\n /** @hidden Given a matcher, return an array with the matcher's query params */\n static queryParams(matcher: UrlMatcher): Param[] {\n return matcher._params.filter(p => p.location === DefType.SEARCH);\n }\n\n /**\n * Compare two UrlMatchers\n *\n * This comparison function converts a UrlMatcher into static and dynamic path segments.\n * Each static path segment is a static string between a path separator (slash character).\n * Each dynamic segment is a path parameter.\n *\n * The comparison function sorts static segments before dynamic ones.\n */\n static compare(a: UrlMatcher, b: UrlMatcher): number {\n /**\n * Turn a UrlMatcher and all its parent matchers into an array\n * of slash literals '/', string literals, and Param objects\n *\n * This example matcher matches strings like \"/foo/:param/tail\":\n * var matcher = $umf.compile(\"/foo\").append($umf.compile(\"/:param\")).append($umf.compile(\"/\")).append($umf.compile(\"tail\"));\n * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ]\n *\n * Caches the result as `matcher._cache.segments`\n */\n const segments = (matcher: UrlMatcher) =>\n matcher._cache.segments = matcher._cache.segments ||\n matcher._cache.path.map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .reduce(joinNeighborsR, [])\n .map(x => isString(x) ? splitOnSlash(x) : x)\n .reduce(unnestR, []);\n\n /**\n * Gets the sort weight for each segment of a UrlMatcher\n *\n * Caches the result as `matcher._cache.weights`\n */\n const weights = (matcher: UrlMatcher) =>\n matcher._cache.weights = matcher._cache.weights ||\n segments(matcher).map(segment => {\n // Sort slashes first, then static strings, the Params\n if (segment === '/') return 1;\n if (isString(segment)) return 2;\n if (segment instanceof Param) return 3;\n });\n\n /**\n * Pads shorter array in-place (mutates)\n */\n const padArrays = (l: any[], r: any[], padVal: any) => {\n const len = Math.max(l.length, r.length);\n while (l.length < len) l.push(padVal);\n while (r.length < len) r.push(padVal);\n };\n\n const weightsA = weights(a), weightsB = weights(b);\n padArrays(weightsA, weightsB, 0);\n\n const _pairs = arrayTuples(weightsA, weightsB);\n let cmp, i;\n\n for (i = 0; i < _pairs.length; i++) {\n cmp = _pairs[i][0] - _pairs[i][1];\n if (cmp !== 0) return cmp;\n }\n\n return 0;\n }\n\n /**\n * @param pattern The pattern to compile into a matcher.\n * @param paramTypes The [[ParamTypes]] registry\n * @param config A configuration object\n * - `caseInsensitive` - `true` if URL matching should be case insensitive, otherwise `false`, the default value (for backward compatibility) is `false`.\n * - `strict` - `false` if matching against a URL with a trailing slash should be treated as equivalent to a URL without a trailing slash, the default value is `true`.\n */\n constructor(pattern: string, paramTypes: ParamTypes, paramFactory: ParamFactory, public config?: any) {\n this.pattern = pattern;\n this.config = defaults(this.config, {\n params: {},\n strict: true,\n caseInsensitive: false,\n paramMap: identity,\n });\n\n // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n // '*' name\n // ':' name\n // '{' name '}'\n // '{' name ':' regexp '}'\n // The regular expression is somewhat complicated due to the need to allow curly braces\n // inside the regular expression. The placeholder regexp breaks down as follows:\n // ([:*])([\\w\\[\\]]+) - classic placeholder ($1 / $2) (search version has - for snake-case)\n // \\{([\\w\\[\\]]+)(?:\\:\\s*( ... ))?\\} - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case\n // (?: ... | ... | ... )+ - the regexp consists of any number of atoms, an atom being either\n // [^{}\\\\]+ - anything other than curly braces or backslash\n // \\\\. - a backslash escape\n // \\{(?:[^{}\\\\]+|\\\\.)*\\} - a matched set of curly braces containing other atoms\n const placeholder = /([:*])([\\w\\[\\]]+)|\\{([\\w\\[\\]]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g;\n const searchPlaceholder = /([:]?)([\\w\\[\\].-]+)|\\{([\\w\\[\\].-]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g;\n const patterns: any[][] = [];\n let last = 0, matchArray: RegExpExecArray;\n\n const checkParamErrors = (id: string) => {\n if (!UrlMatcher.nameValidator.test(id)) throw new Error(`Invalid parameter name '${id}' in pattern '${pattern}'`);\n if (find(this._params, propEq('id', id))) throw new Error(`Duplicate parameter name '${id}' in pattern '${pattern}'`);\n };\n\n // Split into static segments separated by path parameter placeholders.\n // The number of segments is always 1 more than the number of parameters.\n const matchDetails = (m: RegExpExecArray, isSearch: boolean) => {\n // IE[78] returns '' for unmatched groups instead of null\n const id: string = m[2] || m[3];\n const regexp: string = isSearch ? m[4] : m[4] || (m[1] === '*' ? '[\\\\s\\\\S]*' : null);\n\n const makeRegexpType = (str) => inherit(paramTypes.type(isSearch ? 'query' : 'path'), {\n pattern: new RegExp(str, this.config.caseInsensitive ? 'i' : undefined),\n });\n\n return {\n id,\n regexp,\n cfg: this.config.params[id],\n segment: pattern.substring(last, m.index),\n type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp),\n };\n };\n\n let p: any, segment: string;\n\n // tslint:disable-next-line:no-conditional-assignment\n while ((matchArray = placeholder.exec(pattern))) {\n p = matchDetails(matchArray, false);\n if (p.segment.indexOf('?') >= 0) break; // we're into the search part\n\n checkParamErrors(p.id);\n this._params.push(paramFactory.fromPath(p.id, p.type, this.config.paramMap(p.cfg, false)));\n this._segments.push(p.segment);\n patterns.push([p.segment, tail(this._params)]);\n last = placeholder.lastIndex;\n }\n segment = pattern.substring(last);\n\n // Find any search parameter names and remove them from the last segment\n const i = segment.indexOf('?');\n\n if (i >= 0) {\n const search = segment.substring(i);\n segment = segment.substring(0, i);\n\n if (search.length > 0) {\n last = 0;\n\n // tslint:disable-next-line:no-conditional-assignment\n while ((matchArray = searchPlaceholder.exec(search))) {\n p = matchDetails(matchArray, true);\n checkParamErrors(p.id);\n this._params.push(paramFactory.fromSearch(p.id, p.type, this.config.paramMap(p.cfg, true)));\n last = placeholder.lastIndex;\n // check if ?&\n }\n }\n }\n\n this._segments.push(segment);\n this._compiled = patterns.map(_pattern => quoteRegExp.apply(null, _pattern)).concat(quoteRegExp(segment));\n }\n\n /**\n * Creates a new concatenated UrlMatcher\n *\n * Builds a new UrlMatcher by appending another UrlMatcher to this one.\n *\n * @param url A `UrlMatcher` instance to append as a child of the current `UrlMatcher`.\n */\n append(url: UrlMatcher): UrlMatcher {\n this._children.push(url);\n url._cache = {\n path: this._cache.path.concat(url),\n parent: this,\n pattern: null,\n };\n return url;\n }\n\n /** @hidden */\n isRoot(): boolean {\n return this._cache.path[0] === this;\n }\n\n /** Returns the input pattern string */\n toString(): string {\n return this.pattern;\n }\n\n /**\n * Tests the specified url/path against this matcher.\n *\n * Tests if the given url matches this matcher's pattern, and returns an object containing the captured\n * parameter values. Returns null if the path does not match.\n *\n * The returned object contains the values\n * of any search parameters that are mentioned in the pattern, but their value may be null if\n * they are not present in `search`. This means that search parameters are always treated\n * as optional.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', {\n * x: '1', q: 'hello'\n * });\n * // returns { id: 'bob', q: 'hello', r: null }\n * ```\n *\n * @param path The URL path to match, e.g. `$location.path()`.\n * @param search URL search parameters, e.g. `$location.search()`.\n * @param hash URL hash e.g. `$location.hash()`.\n * @param options\n *\n * @returns The captured parameter values.\n */\n exec(path: string, search: any = {}, hash?: string, options: any = {}): RawParams {\n const match = memoizeTo(this._cache, 'pattern', () => {\n return new RegExp([\n '^',\n unnest(this._cache.path.map(prop('_compiled'))).join(''),\n this.config.strict === false ? '\\/?' : '',\n '$',\n ].join(''), this.config.caseInsensitive ? 'i' : undefined);\n }).exec(path);\n\n if (!match) return null;\n\n // options = defaults(options, { isolate: false });\n\n const allParams: Param[] = this.parameters(),\n pathParams: Param[] = allParams.filter(param => !param.isSearch()),\n searchParams: Param[] = allParams.filter(param => param.isSearch()),\n nPathSegments = this._cache.path.map(urlm => urlm._segments.length - 1).reduce((a, x) => a + x),\n values: RawParams = {};\n\n if (nPathSegments !== match.length - 1)\n throw new Error(`Unbalanced capture group in route '${this.pattern}'`);\n\n function decodePathArray(paramVal: string) {\n const reverseString = (str: string) => str.split('').reverse().join('');\n const unquoteDashes = (str: string) => str.replace(/\\\\-/g, '-');\n\n const split = reverseString(paramVal).split(/-(?!\\\\)/);\n const allReversed = map(split, reverseString);\n return map(allReversed, unquoteDashes).reverse();\n }\n\n for (let i = 0; i < nPathSegments; i++) {\n const param: Param = pathParams[i];\n let value: (any|any[]) = match[i + 1];\n\n // if the param value matches a pre-replace pair, replace the value before decoding.\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n if (value && param.array === true) value = decodePathArray(value);\n if (isDefined(value)) value = param.type.decode(value);\n values[param.id] = param.value(value);\n }\n searchParams.forEach(param => {\n let value = search[param.id];\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n if (isDefined(value)) value = param.type.decode(value);\n values[param.id] = param.value(value);\n });\n\n if (hash) values['#'] = hash;\n\n return values;\n }\n\n /**\n * @hidden\n * Returns all the [[Param]] objects of all path and search parameters of this pattern in order of appearance.\n *\n * @returns {Array.} An array of [[Param]] objects. Must be treated as read-only. If the\n * pattern has no parameters, an empty array is returned.\n */\n parameters(opts: any = {}): Param[] {\n if (opts.inherit === false) return this._params;\n return unnest(this._cache.path.map(matcher => matcher._params));\n }\n\n /**\n * @hidden\n * Returns a single parameter from this UrlMatcher by id\n *\n * @param id\n * @param opts\n * @returns {T|Param|any|boolean|UrlMatcher|null}\n */\n parameter(id: string, opts: any = {}): Param {\n const findParam = () => {\n for (const param of this._params) {\n if (param.id === id) return param;\n }\n };\n\n const parent = this._cache.parent;\n return findParam() || (opts.inherit !== false && parent && parent.parameter(id, opts)) || null;\n }\n\n /**\n * Validates the input parameter values against this UrlMatcher\n *\n * Checks an object hash of parameters to validate their correctness according to the parameter\n * types of this `UrlMatcher`.\n *\n * @param params The object hash of parameters to validate.\n * @returns Returns `true` if `params` validates, otherwise `false`.\n */\n validates(params: RawParams): boolean {\n const validParamVal = (param: Param, val: any) =>\n !param || param.validates(val);\n\n params = params || {};\n\n // I'm not sure why this checks only the param keys passed in, and not all the params known to the matcher\n const paramSchema = this.parameters().filter(paramDef => params.hasOwnProperty(paramDef.id));\n return paramSchema.map(paramDef => validParamVal(paramDef, params[paramDef.id])).reduce(allTrueR, true);\n }\n\n /**\n * Given a set of parameter values, creates a URL from this UrlMatcher.\n *\n * Creates a URL that matches this pattern by substituting the specified values\n * for the path and search parameters.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n * // returns '/user/bob?q=yes'\n * ```\n *\n * @param values the values to substitute for the parameters in this pattern.\n * @returns the formatted URL (path and optionally search part).\n */\n format(values: RawParams = {}) {\n // Build the full path of UrlMatchers (including all parent UrlMatchers)\n const urlMatchers = this._cache.path;\n\n // Extract all the static segments and Params (processed as ParamDetails)\n // into an ordered array\n const pathSegmentsAndParams: Array = urlMatchers.map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .map(x => isString(x) ? x : getDetails(x));\n\n // Extract the query params into a separate array\n const queryParams: Array = urlMatchers.map(UrlMatcher.queryParams)\n .reduce(unnestR, [])\n .map(getDetails);\n\n const isInvalid = (param: ParamDetails) => param.isValid === false;\n if (pathSegmentsAndParams.concat(queryParams).filter(isInvalid).length) {\n return null;\n }\n\n /**\n * Given a Param, applies the parameter value, then returns detailed information about it\n */\n function getDetails(param: Param): ParamDetails {\n // Normalize to typed value\n const value = param.value(values[param.id]);\n const isValid = param.validates(value);\n const isDefaultValue = param.isDefaultValue(value);\n // Check if we're in squash mode for the parameter\n const squash = isDefaultValue ? param.squash : false;\n // Allow the Parameter's Type to encode the value\n const encoded = param.type.encode(value);\n\n return { param, value, isValid, isDefaultValue, squash, encoded };\n }\n\n // Build up the path-portion from the list of static segments and parameters\n const pathString = pathSegmentsAndParams.reduce((acc: string, x: string|ParamDetails) => {\n // The element is a static segment (a raw string); just append it\n if (isString(x)) return acc + x;\n\n // Otherwise, it's a ParamDetails.\n const { squash, encoded, param } = x;\n\n // If squash is === true, try to remove a slash from the path\n if (squash === true) return (acc.match(/\\/$/)) ? acc.slice(0, -1) : acc;\n // If squash is a string, use the string for the param value\n if (isString(squash)) return acc + squash;\n if (squash !== false) return acc; // ?\n if (encoded == null) return acc;\n // If this parameter value is an array, encode the value using encodeDashes\n if (isArray(encoded)) return acc + map( encoded, UrlMatcher.encodeDashes).join('-');\n // If the parameter type is \"raw\", then do not encodeURIComponent\n if (param.raw) return acc + encoded;\n // Encode the value\n return acc + encodeURIComponent( encoded);\n }, '');\n\n // Build the query string by applying parameter values (array or regular)\n // then mapping to key=value, then flattening and joining using \"&\"\n const queryString = queryParams.map((paramDetails: ParamDetails) => {\n let { param, squash, encoded, isDefaultValue } = paramDetails;\n if (encoded == null || (isDefaultValue && squash !== false)) return;\n if (!isArray(encoded)) encoded = [ encoded];\n if (encoded.length === 0) return;\n if (!param.raw) encoded = map( encoded, encodeURIComponent);\n\n return ( encoded).map(val => `${param.id}=${val}`);\n }).filter(identity).reduce(unnestR, []).join('&');\n\n // Concat the pathstring with the queryString (if exists) and the hashString (if exists)\n return pathString + (queryString ? `?${queryString}` : '') + (values['#'] ? '#' + values['#'] : '');\n }\n}\n\n/** @hidden */\ninterface ParamDetails {\n param: Param;\n value: any;\n isValid: boolean;\n isDefaultValue: boolean;\n squash: (boolean|string);\n encoded: (string|string[]);\n}\n", + "/**\n * @internalapi\n * @module url\n */ /** for typedoc */\nimport { forEach, extend } from '../common/common';\nimport { isObject, isDefined, isFunction, isString } from '../common/predicates';\nimport { UrlMatcher } from './urlMatcher';\nimport { Param, DefType } from '../params/param';\nimport { ParamTypes } from '../params/paramTypes';\nimport { ParamTypeDefinition } from '../params/interface';\nimport { Disposable } from '../interface';\nimport { ParamType } from '../params/paramType';\nimport { ParamFactory, UrlMatcherConfig } from './interface';\n\n/**\n * Factory for [[UrlMatcher]] instances.\n *\n * The factory is available to ng1 services as\n * `$urlMatcherFactory` or ng1 providers as `$urlMatcherFactoryProvider`.\n */\nexport class UrlMatcherFactory implements Disposable, UrlMatcherConfig {\n /** @hidden */ paramTypes = new ParamTypes();\n /** @hidden */ _isCaseInsensitive = false;\n /** @hidden */ _isStrictMode = true;\n /** @hidden */ _defaultSquashPolicy: (boolean|string) = false;\n\n /** @internalapi Creates a new [[Param]] for a given location (DefType) */\n paramFactory: ParamFactory = {\n /** Creates a new [[Param]] from a CONFIG block */\n fromConfig: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.CONFIG, this),\n\n /** Creates a new [[Param]] from a url PATH */\n fromPath: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.PATH, this),\n\n /** Creates a new [[Param]] from a url SEARCH */\n fromSearch: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.SEARCH, this),\n };\n\n constructor() {\n extend(this, { UrlMatcher, Param });\n }\n\n /** @inheritdoc */\n caseInsensitive(value?: boolean): boolean {\n return this._isCaseInsensitive = isDefined(value) ? value : this._isCaseInsensitive;\n }\n\n /** @inheritdoc */\n strictMode(value?: boolean): boolean {\n return this._isStrictMode = isDefined(value) ? value : this._isStrictMode;\n }\n\n /** @inheritdoc */\n defaultSquashPolicy(value?: (boolean|string)) {\n if (isDefined(value) && value !== true && value !== false && !isString(value))\n throw new Error(`Invalid squash policy: ${value}. Valid policies: false, true, arbitrary-string`);\n return this._defaultSquashPolicy = isDefined(value) ? value : this._defaultSquashPolicy;\n }\n\n /** @hidden */\n private _getConfig = (config) =>\n extend({ strict: this._isStrictMode, caseInsensitive: this._isCaseInsensitive }, config);\n\n /**\n * Creates a [[UrlMatcher]] for the specified pattern.\n *\n * @param pattern The URL pattern.\n * @param config The config object hash.\n * @returns The UrlMatcher.\n */\n compile(pattern: string, config?: { [key: string]: any }) {\n return new UrlMatcher(pattern, this.paramTypes, this.paramFactory, this._getConfig(config));\n }\n\n /**\n * Returns true if the specified object is a [[UrlMatcher]], or false otherwise.\n *\n * @param object The object to perform the type check against.\n * @returns `true` if the object matches the `UrlMatcher` interface, by\n * implementing all the same methods.\n */\n isMatcher(object: any): boolean {\n // TODO: typeof?\n if (!isObject(object)) return false;\n let result = true;\n\n forEach(UrlMatcher.prototype, (val, name) => {\n if (isFunction(val)) result = result && (isDefined(object[name]) && isFunction(object[name]));\n });\n return result;\n }\n\n /**\n * Creates and registers a custom [[ParamType]] object\n *\n * A [[ParamType]] can be used to generate URLs with typed parameters.\n *\n * @param name The type name.\n * @param definition The type definition. See [[ParamTypeDefinition]] for information on the values accepted.\n * @param definitionFn A function that is injected before the app runtime starts.\n * The result of this function should be a [[ParamTypeDefinition]].\n * The result is merged into the existing `definition`.\n * See [[ParamType]] for information on the values accepted.\n *\n * @returns - if a type was registered: the [[UrlMatcherFactory]]\n * - if only the `name` parameter was specified: the currently registered [[ParamType]] object, or undefined\n *\n * Note: Register custom types *before using them* in a state definition.\n *\n * See [[ParamTypeDefinition]] for examples\n */\n type(name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {\n const type = this.paramTypes.type(name, definition, definitionFn);\n return !isDefined(definition) ? type : this;\n }\n\n /** @hidden */\n $get() {\n this.paramTypes.enqueue = false;\n this.paramTypes._flushTypeQueue();\n return this;\n }\n\n /** @internalapi */\n dispose() {\n this.paramTypes.dispose();\n }\n}\n", + "/**\n * @coreapi\n * @module url\n */ /** */\nimport { UrlMatcher } from './urlMatcher';\nimport { isString, isDefined, isFunction, isState } from '../common/predicates';\nimport { UIRouter } from '../router';\nimport { identity, extend } from '../common/common';\nimport { is, pattern } from '../common/hof';\nimport { StateObject } from '../state/stateObject';\nimport { RawParams } from '../params/interface';\nimport {\n UrlRule, UrlRuleMatchFn, UrlRuleHandlerFn, UrlRuleType, UrlParts, MatcherUrlRule, StateRule, RegExpRule,\n} from './interface';\n\n/**\n * Creates a [[UrlRule]]\n *\n * Creates a [[UrlRule]] from a:\n *\n * - `string`\n * - [[UrlMatcher]]\n * - `RegExp`\n * - [[StateObject]]\n * @internalapi\n */\nexport class UrlRuleFactory {\n static isUrlRule = obj =>\n obj && ['type', 'match', 'handler'].every(key => isDefined(obj[key]));\n\n constructor(public router: UIRouter) { }\n\n compile(str: string) {\n return this.router.urlMatcherFactory.compile(str);\n }\n\n create(what: string|UrlMatcher|StateObject|RegExp|UrlRuleMatchFn, handler?: string|UrlRuleHandlerFn): UrlRule {\n const makeRule = pattern([\n [isString, (_what: string) => makeRule(this.compile(_what))],\n [is(UrlMatcher), (_what: UrlMatcher) => this.fromUrlMatcher(_what, handler)],\n [isState, (_what: StateObject) => this.fromState(_what, this.router)],\n [is(RegExp), (_what: RegExp) => this.fromRegExp(_what, handler)],\n [isFunction, (_what: UrlRuleMatchFn) => new BaseUrlRule(_what, handler as UrlRuleHandlerFn)],\n ]);\n\n const rule = makeRule(what);\n if (!rule) throw new Error(\"invalid 'what' in when()\");\n return rule;\n }\n\n /**\n * A UrlRule which matches based on a UrlMatcher\n *\n * The `handler` may be either a `string`, a [[UrlRuleHandlerFn]] or another [[UrlMatcher]]\n *\n * ## Handler as a function\n *\n * If `handler` is a function, the function is invoked with:\n *\n * - matched parameter values ([[RawParams]] from [[UrlMatcher.exec]])\n * - url: the current Url ([[UrlParts]])\n * - router: the router object ([[UIRouter]])\n *\n * #### Example:\n * ```js\n * var urlMatcher = $umf.compile(\"/foo/:fooId/:barId\");\n * var rule = factory.fromUrlMatcher(urlMatcher, match => \"/home/\" + match.fooId + \"/\" + match.barId);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match); // '/home/123/456'\n * ```\n *\n * ## Handler as UrlMatcher\n *\n * If `handler` is a UrlMatcher, the handler matcher is used to create the new url.\n * The `handler` UrlMatcher is formatted using the matched param from the first matcher.\n * The url is replaced with the result.\n *\n * #### Example:\n * ```js\n * var urlMatcher = $umf.compile(\"/foo/:fooId/:barId\");\n * var handler = $umf.compile(\"/home/:fooId/:barId\");\n * var rule = factory.fromUrlMatcher(urlMatcher, handler);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match); // '/home/123/456'\n * ```\n */\n fromUrlMatcher(urlMatcher: UrlMatcher, handler: string|UrlMatcher|UrlRuleHandlerFn): MatcherUrlRule {\n let _handler: UrlRuleHandlerFn = handler as any;\n if (isString(handler)) handler = this.router.urlMatcherFactory.compile(handler);\n if (is(UrlMatcher)(handler)) _handler = (match: RawParams) => (handler as UrlMatcher).format(match);\n\n function matchUrlParamters(url: UrlParts): RawParams {\n const params = urlMatcher.exec(url.path, url.search, url.hash);\n return urlMatcher.validates(params) && params;\n }\n\n // Prioritize URLs, lowest to highest:\n // - Some optional URL parameters, but none matched\n // - No optional parameters in URL\n // - Some optional parameters, some matched\n // - Some optional parameters, all matched\n function matchPriority(params: RawParams): number {\n const optional = urlMatcher.parameters().filter(param => param.isOptional);\n if (!optional.length) return 0.000001;\n const matched = optional.filter(param => params[param.id]);\n return matched.length / optional.length;\n }\n\n const details = { urlMatcher, matchPriority, type: 'URLMATCHER' };\n return extend(new BaseUrlRule(matchUrlParamters, _handler), details) as MatcherUrlRule;\n }\n\n\n /**\n * A UrlRule which matches a state by its url\n *\n * #### Example:\n * ```js\n * var rule = factory.fromState($state.get('foo'), router);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match);\n * // Starts a transition to 'foo' with params: { fooId: '123', barId: '456' }\n * ```\n */\n fromState(state: StateObject, router: UIRouter): StateRule {\n /**\n * Handles match by transitioning to matched state\n *\n * First checks if the router should start a new transition.\n * A new transition is not required if the current state's URL\n * and the new URL are already identical\n */\n const handler = (match: RawParams) => {\n const $state = router.stateService;\n const globals = router.globals;\n if ($state.href(state, match) !== $state.href(globals.current, globals.params)) {\n $state.transitionTo(state, match, { inherit: true, source: 'url' });\n }\n };\n\n const details = { state, type: 'STATE' };\n return extend(this.fromUrlMatcher(state.url, handler), details) as StateRule;\n }\n\n /**\n * A UrlRule which matches based on a regular expression\n *\n * The `handler` may be either a [[UrlRuleHandlerFn]] or a string.\n *\n * ## Handler as a function\n *\n * If `handler` is a function, the function is invoked with:\n *\n * - regexp match array (from `regexp`)\n * - url: the current Url ([[UrlParts]])\n * - router: the router object ([[UIRouter]])\n *\n * #### Example:\n * ```js\n * var rule = factory.fromRegExp(/^\\/foo\\/(bar|baz)$/, match => \"/home/\" + match[1])\n * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ]\n * var result = rule.handler(match); // '/home/bar'\n * ```\n *\n * ## Handler as string\n *\n * If `handler` is a string, the url is *replaced by the string* when the Rule is invoked.\n * The string is first interpolated using `string.replace()` style pattern.\n *\n * #### Example:\n * ```js\n * var rule = factory.fromRegExp(/^\\/foo\\/(bar|baz)$/, \"/home/$1\")\n * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ]\n * var result = rule.handler(match); // '/home/bar'\n * ```\n */\n fromRegExp(regexp: RegExp, handler: string|UrlRuleHandlerFn): RegExpRule {\n if (regexp.global || regexp.sticky) throw new Error('Rule RegExp must not be global or sticky');\n\n /**\n * If handler is a string, the url will be replaced by the string.\n * If the string has any String.replace() style variables in it (like `$2`),\n * they will be replaced by the captures from [[match]]\n */\n const redirectUrlTo = (match: RegExpExecArray) =>\n // Interpolates matched values into $1 $2, etc using a String.replace()-style pattern\n (handler as string).replace(/\\$(\\$|\\d{1,2})/, (m, what) =>\n match[what === '$' ? 0 : Number(what)]);\n\n const _handler = isString(handler) ? redirectUrlTo : handler;\n\n const matchParamsFromRegexp = (url: UrlParts): RegExpExecArray =>\n regexp.exec(url.path);\n\n const details = { regexp, type: 'REGEXP' };\n return extend(new BaseUrlRule(matchParamsFromRegexp, _handler), details) as RegExpRule;\n }\n}\n\n/**\n * A base rule which calls `match`\n *\n * The value from the `match` function is passed through to the `handler`.\n * @internalapi\n */\nexport class BaseUrlRule implements UrlRule {\n $id: number;\n priority: number;\n type: UrlRuleType = 'RAW';\n handler: UrlRuleHandlerFn;\n matchPriority = (match) => 0 - this.$id;\n\n constructor(public match: UrlRuleMatchFn, handler?: UrlRuleHandlerFn) {\n this.handler = handler || identity;\n }\n}\n", + "/**\n * @internalapi\n * @module url\n */\n/** for typedoc */\nimport { createProxyFunctions, extend, removeFrom } from '../common/common';\nimport { isDefined, isFunction, isString } from '../common/predicates';\nimport { UrlMatcher } from './urlMatcher';\nimport { RawParams } from '../params/interface';\nimport { Disposable } from '../interface';\nimport { UIRouter } from '../router';\nimport { is, pattern, val } from '../common/hof';\nimport { UrlRuleFactory } from './urlRule';\nimport { TargetState } from '../state/targetState';\nimport { MatcherUrlRule, MatchResult, UrlParts, UrlRule, UrlRuleHandlerFn, UrlRuleMatchFn, UrlRulesApi, UrlSyncApi } from './interface';\nimport { TargetStateDef } from '../state/interface';\nimport { stripLastPathElement } from '../common';\n\n/** @hidden */\nfunction appendBasePath(url: string, isHtml5: boolean, absolute: boolean, baseHref: string): string {\n if (baseHref === '/') return url;\n if (isHtml5) return stripLastPathElement(baseHref) + url;\n if (absolute) return baseHref.slice(1) + url;\n return url;\n}\n\n/** @hidden */\nconst prioritySort = (a: UrlRule, b: UrlRule) =>\n (b.priority || 0) - (a.priority || 0);\n\n/** @hidden */\nconst typeSort = (a: UrlRule, b: UrlRule) => {\n const weights = { 'STATE': 4, 'URLMATCHER': 4, 'REGEXP': 3, 'RAW': 2, 'OTHER': 1 };\n return (weights[a.type] || 0) - (weights[b.type] || 0);\n};\n\n/** @hidden */\nconst urlMatcherSort = (a: MatcherUrlRule, b: MatcherUrlRule) =>\n !a.urlMatcher || !b.urlMatcher ? 0 : UrlMatcher.compare(a.urlMatcher, b.urlMatcher);\n\n/** @hidden */\nconst idSort = (a: UrlRule, b: UrlRule) => {\n // Identically sorted STATE and URLMATCHER best rule will be chosen by `matchPriority` after each rule matches the URL\n const useMatchPriority = { STATE: true, URLMATCHER: true };\n const equal = useMatchPriority[a.type] && useMatchPriority[b.type];\n return equal ? 0 : (a.$id || 0) - (b.$id || 0);\n};\n\n/**\n * Default rule priority sorting function.\n *\n * Sorts rules by:\n *\n * - Explicit priority (set rule priority using [[UrlRulesApi.when]])\n * - Rule type (STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1)\n * - `UrlMatcher` specificity ([[UrlMatcher.compare]]): works for STATE and URLMATCHER types to pick the most specific rule.\n * - Rule registration order (for rule types other than STATE and URLMATCHER)\n * - Equally sorted State and UrlMatcher rules will each match the URL.\n * Then, the *best* match is chosen based on how many parameter values were matched.\n *\n * @coreapi\n */\nlet defaultRuleSortFn: (a: UrlRule, b: UrlRule) => number;\ndefaultRuleSortFn = (a, b) => {\n let cmp = prioritySort(a, b);\n if (cmp !== 0) return cmp;\n\n cmp = typeSort(a, b);\n if (cmp !== 0) return cmp;\n\n cmp = urlMatcherSort(a as MatcherUrlRule, b as MatcherUrlRule);\n if (cmp !== 0) return cmp;\n\n return idSort(a, b);\n};\n\n/**\n * Updates URL and responds to URL changes\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class updates the URL when the state changes.\n * It also responds to changes in the URL.\n */\nexport class UrlRouter implements UrlRulesApi, UrlSyncApi, Disposable {\n /** used to create [[UrlRule]] objects for common cases */\n public urlRuleFactory: UrlRuleFactory;\n\n /** @hidden */ private _router: UIRouter;\n /** @hidden */ private location: string;\n /** @hidden */ private _sortFn = defaultRuleSortFn;\n /** @hidden */ private _stopFn: Function;\n /** @hidden */ _rules: UrlRule[] = [];\n /** @hidden */ private _otherwiseFn: UrlRule;\n /** @hidden */ interceptDeferred = false;\n /** @hidden */ private _id = 0;\n /** @hidden */ private _sorted = false;\n\n /** @hidden */\n constructor(router: UIRouter) {\n this._router = router;\n this.urlRuleFactory = new UrlRuleFactory(router);\n createProxyFunctions(val(UrlRouter.prototype), this, val(this));\n }\n\n /** @internalapi */\n dispose() {\n this.listen(false);\n this._rules = [];\n delete this._otherwiseFn;\n }\n\n /** @inheritdoc */\n sort(compareFn?: (a: UrlRule, b: UrlRule) => number) {\n this._rules = this.stableSort(this._rules, this._sortFn = compareFn || this._sortFn);\n this._sorted = true;\n }\n\n private ensureSorted() {\n this._sorted || this.sort();\n }\n\n private stableSort(arr, compareFn) {\n const arrOfWrapper = arr.map((elem, idx) => ({ elem, idx }));\n\n arrOfWrapper.sort((wrapperA, wrapperB) => {\n const cmpDiff = compareFn(wrapperA.elem, wrapperB.elem);\n return cmpDiff === 0\n ? wrapperA.idx - wrapperB.idx\n : cmpDiff;\n });\n\n return arrOfWrapper.map(wrapper => wrapper.elem);\n }\n\n /**\n * Given a URL, check all rules and return the best [[MatchResult]]\n * @param url\n * @returns {MatchResult}\n */\n match(url: UrlParts): MatchResult {\n this.ensureSorted();\n\n url = extend({ path: '', search: {}, hash: '' }, url);\n const rules = this.rules();\n if (this._otherwiseFn) rules.push(this._otherwiseFn);\n\n // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined\n\n const checkRule = (rule: UrlRule): MatchResult => {\n const match = rule.match(url, this._router);\n return match && { match, rule, weight: rule.matchPriority(match) };\n };\n\n // The rules are pre-sorted.\n // - Find the first matching rule.\n // - Find any other matching rule that sorted *exactly the same*, according to `.sort()`.\n // - Choose the rule with the highest match weight.\n let best: MatchResult;\n for (let i = 0; i < rules.length; i++) {\n // Stop when there is a 'best' rule and the next rule sorts differently than it.\n if (best && this._sortFn(rules[i], best.rule) !== 0) break;\n\n const current = checkRule(rules[i]);\n // Pick the best MatchResult\n best = (!best || current && current.weight > best.weight) ? current : best;\n }\n\n return best;\n }\n\n /** @inheritdoc */\n sync(evt?) {\n if (evt && evt.defaultPrevented) return;\n\n const router = this._router,\n $url = router.urlService,\n $state = router.stateService;\n\n const url: UrlParts = {\n path: $url.path(), search: $url.search(), hash: $url.hash(),\n };\n\n const best = this.match(url);\n\n const applyResult = pattern([\n [isString, (newurl: string) => $url.url(newurl, true)],\n [TargetState.isDef, (def: TargetStateDef) => $state.go(def.state, def.params, def.options)],\n [is(TargetState), (target: TargetState) => $state.go(target.state(), target.params(), target.options())],\n ]);\n\n applyResult(best && best.rule.handler(best.match, url, router));\n }\n\n /** @inheritdoc */\n listen(enabled?: boolean): Function {\n if (enabled === false) {\n this._stopFn && this._stopFn();\n delete this._stopFn;\n } else {\n return this._stopFn = this._stopFn || this._router.urlService.onChange(evt => this.sync(evt));\n }\n }\n\n /**\n * Internal API.\n * @internalapi\n */\n update(read?: boolean) {\n const $url = this._router.locationService;\n if (read) {\n this.location = $url.url();\n return;\n }\n if ($url.url() === this.location) return;\n\n $url.url(this.location, true);\n }\n\n /**\n * Internal API.\n *\n * Pushes a new location to the browser history.\n *\n * @internalapi\n * @param urlMatcher\n * @param params\n * @param options\n */\n push(urlMatcher: UrlMatcher, params?: RawParams, options?: { replace?: (string|boolean) }) {\n const replace = options && !!options.replace;\n this._router.urlService.url(urlMatcher.format(params || {}), replace);\n }\n\n /**\n * Builds and returns a URL with interpolated parameters\n *\n * #### Example:\n * ```js\n * matcher = $umf.compile(\"/about/:person\");\n * params = { person: \"bob\" };\n * $bob = $urlRouter.href(matcher, params);\n * // $bob == \"/about/bob\";\n * ```\n *\n * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate.\n * @param params An object of parameter values to fill the matcher's required parameters.\n * @param options Options object. The options are:\n *\n * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n *\n * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`\n */\n href(urlMatcher: UrlMatcher, params?: any, options?: { absolute: boolean }): string {\n let url = urlMatcher.format(params);\n if (url == null) return null;\n\n options = options || { absolute: false };\n\n const cfg = this._router.urlService.config;\n const isHtml5 = cfg.html5Mode();\n if (!isHtml5 && url !== null) {\n url = '#' + cfg.hashPrefix() + url;\n }\n url = appendBasePath(url, isHtml5, options.absolute, cfg.baseHref());\n\n if (!options.absolute || !url) {\n return url;\n }\n\n const slash = (!isHtml5 && url ? '/' : '');\n const cfgPort = cfg.port();\n const port = (cfgPort === 80 || cfgPort === 443 ? '' : ':' + cfgPort);\n\n return [cfg.protocol(), '://', cfg.host(), port, slash, url].join('');\n }\n\n\n /**\n * Manually adds a URL Rule.\n *\n * Usually, a url rule is added using [[StateDeclaration.url]] or [[when]].\n * This api can be used directly for more control (to register a [[BaseUrlRule]], for example).\n * Rules can be created using [[UrlRouter.urlRuleFactory]], or create manually as simple objects.\n *\n * A rule should have a `match` function which returns truthy if the rule matched.\n * It should also have a `handler` function which is invoked if the rule is the best match.\n *\n * @return a function that deregisters the rule\n */\n rule(rule: UrlRule): Function {\n if (!UrlRuleFactory.isUrlRule(rule)) throw new Error('invalid rule');\n rule.$id = this._id++;\n rule.priority = rule.priority || 0;\n\n this._rules.push(rule);\n this._sorted = false;\n\n return () => this.removeRule(rule);\n }\n\n /** @inheritdoc */\n removeRule(rule): void {\n removeFrom(this._rules, rule);\n }\n\n /** @inheritdoc */\n rules(): UrlRule[] {\n this.ensureSorted();\n return this._rules.slice();\n }\n\n /** @inheritdoc */\n otherwise(handler: string|UrlRuleHandlerFn|TargetState|TargetStateDef) {\n const handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n this._otherwiseFn = this.urlRuleFactory.create(val(true), handlerFn);\n this._sorted = false;\n }\n\n /** @inheritdoc */\n initial(handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef) {\n const handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n const matchFn: UrlRuleMatchFn = (urlParts, router) =>\n router.globals.transitionHistory.size() === 0 && !!/^\\/?$/.exec(urlParts.path);\n\n this.rule(this.urlRuleFactory.create(matchFn, handlerFn));\n }\n\n /** @inheritdoc */\n when(matcher: (RegExp|UrlMatcher|string), handler: string|UrlRuleHandlerFn, options?: { priority: number }): UrlRule {\n const rule = this.urlRuleFactory.create(matcher, handler);\n if (isDefined(options && options.priority)) rule.priority = options.priority;\n this.rule(rule);\n return rule;\n }\n\n /** @inheritdoc */\n deferIntercept(defer?: boolean) {\n if (defer === undefined) defer = true;\n this.interceptDeferred = defer;\n }\n}\n\nfunction getHandlerFn(handler: string|UrlRuleHandlerFn|TargetState|TargetStateDef): UrlRuleHandlerFn {\n if (!isFunction(handler) && !isString(handler) && !is(TargetState)(handler) && !TargetState.isDef(handler)) {\n throw new Error(\"'handler' must be a string, function, TargetState, or have a state: 'newtarget' property\");\n }\n return isFunction(handler) ? handler as UrlRuleHandlerFn : val(handler);\n}\n", + "/**\n * @coreapi\n * @module view\n */ /** for typedoc */\nimport { equals, applyPairs, removeFrom, TypedMap, inArray } from '../common/common';\nimport { curry, prop } from '../common/hof';\nimport { isString, isArray } from '../common/predicates';\nimport { trace } from '../common/trace';\nimport { PathNode } from '../path/pathNode';\nimport { ActiveUIView, ViewContext, ViewConfig } from './interface';\nimport { _ViewDeclaration } from '../state/interface';\n\nexport type ViewConfigFactory = (path: PathNode[], decl: _ViewDeclaration) => ViewConfig|ViewConfig[];\n\nexport interface ViewServicePluginAPI {\n _rootViewContext(context?: ViewContext): ViewContext;\n _viewConfigFactory(viewType: string, factory: ViewConfigFactory);\n _registeredUIViews(): ActiveUIView[];\n _activeViewConfigs(): ViewConfig[];\n _onSync(listener: ViewSyncListener): Function;\n}\n\n// A uiView and its matching viewConfig\nexport interface ViewTuple {\n uiView: ActiveUIView;\n viewConfig: ViewConfig;\n}\n\nexport interface ViewSyncListener {\n (viewTuples: ViewTuple[]): void;\n}\n\n/**\n * The View service\n *\n * This service pairs existing `ui-view` components (which live in the DOM)\n * with view configs (from the state declaration objects: [[StateDeclaration.views]]).\n *\n * - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]].\n * The views from exited states are deactivated via [[deactivateViewConfig]].\n * (See: the [[registerActivateViews]] Transition Hook)\n *\n * - As `ui-view` components pop in and out of existence, they register themselves using [[registerUIView]].\n *\n * - When the [[sync]] function is called, the registered `ui-view`(s) ([[ActiveUIView]])\n * are configured with the matching [[ViewConfig]](s)\n *\n */\nexport class ViewService {\n private _uiViews: ActiveUIView[] = [];\n private _viewConfigs: ViewConfig[] = [];\n private _rootContext: ViewContext;\n private _viewConfigFactories: { [key: string]: ViewConfigFactory } = {};\n private _listeners: ViewSyncListener[] = [];\n\n public _pluginapi: ViewServicePluginAPI = {\n _rootViewContext: this._rootViewContext.bind(this),\n _viewConfigFactory: this._viewConfigFactory.bind(this),\n _registeredUIViews: () => this._uiViews,\n _activeViewConfigs: () => this._viewConfigs,\n _onSync: (listener: ViewSyncListener) => {\n this._listeners.push(listener);\n return () => removeFrom(this._listeners, listener);\n },\n };\n\n /**\n * Given a ui-view and a ViewConfig, determines if they \"match\".\n *\n * A ui-view has a fully qualified name (fqn) and a context object. The fqn is built from its overall location in\n * the DOM, describing its nesting relationship to any parent ui-view tags it is nested inside of.\n *\n * A ViewConfig has a target ui-view name and a context anchor. The ui-view name can be a simple name, or\n * can be a segmented ui-view path, describing a portion of a ui-view fqn.\n *\n * In order for a ui-view to match ViewConfig, ui-view's $type must match the ViewConfig's $type\n *\n * If the ViewConfig's target ui-view name is a simple name (no dots), then a ui-view matches if:\n * - the ui-view's name matches the ViewConfig's target name\n * - the ui-view's context matches the ViewConfig's anchor\n *\n * If the ViewConfig's target ui-view name is a segmented name (with dots), then a ui-view matches if:\n * - There exists a parent ui-view where:\n * - the parent ui-view's name matches the first segment (index 0) of the ViewConfig's target name\n * - the parent ui-view's context matches the ViewConfig's anchor\n * - And the remaining segments (index 1..n) of the ViewConfig's target name match the tail of the ui-view's fqn\n *\n * Example:\n *\n * DOM:\n * \n * \n * \n * \n * \n * \n * \n * \n *\n * uiViews: [\n * { fqn: \"$default\", creationContext: { name: \"\" } },\n * { fqn: \"$default.foo\", creationContext: { name: \"A\" } },\n * { fqn: \"$default.foo.$default\", creationContext: { name: \"A.B\" } }\n * { fqn: \"$default.foo.$default.bar\", creationContext: { name: \"A.B.C\" } }\n * ]\n *\n * These four view configs all match the ui-view with the fqn: \"$default.foo.$default.bar\":\n *\n * - ViewConfig1: { uiViewName: \"bar\", uiViewContextAnchor: \"A.B.C\" }\n * - ViewConfig2: { uiViewName: \"$default.bar\", uiViewContextAnchor: \"A.B\" }\n * - ViewConfig3: { uiViewName: \"foo.$default.bar\", uiViewContextAnchor: \"A\" }\n * - ViewConfig4: { uiViewName: \"$default.foo.$default.bar\", uiViewContextAnchor: \"\" }\n *\n * Using ViewConfig3 as an example, it matches the ui-view with fqn \"$default.foo.$default.bar\" because:\n * - The ViewConfig's segmented target name is: [ \"foo\", \"$default\", \"bar\" ]\n * - There exists a parent ui-view (which has fqn: \"$default.foo\") where:\n * - the parent ui-view's name \"foo\" matches the first segment \"foo\" of the ViewConfig's target name\n * - the parent ui-view's context \"A\" matches the ViewConfig's anchor context \"A\"\n * - And the remaining segments [ \"$default\", \"bar\" ].join(\".\"_ of the ViewConfig's target name match\n * the tail of the ui-view's fqn \"default.bar\"\n *\n * @internalapi\n */\n static matches = (uiViewsByFqn: TypedMap, uiView: ActiveUIView) => (viewConfig: ViewConfig) => {\n // Don't supply an ng1 ui-view with an ng2 ViewConfig, etc\n if (uiView.$type !== viewConfig.viewDecl.$type) return false;\n\n // Split names apart from both viewConfig and uiView into segments\n const vc = viewConfig.viewDecl;\n const vcSegments = vc.$uiViewName.split('.');\n const uivSegments = uiView.fqn.split('.');\n\n // Check if the tails of the segment arrays match. ex, these arrays' tails match:\n // vc: [\"foo\", \"bar\"], uiv fqn: [\"$default\", \"foo\", \"bar\"]\n if (!equals(vcSegments, uivSegments.slice(0 - vcSegments.length)))\n return false;\n\n // Now check if the fqn ending at the first segment of the viewConfig matches the context:\n // [\"$default\", \"foo\"].join(\".\") == \"$default.foo\", does the ui-view $default.foo context match?\n const negOffset = (1 - vcSegments.length) || undefined;\n const fqnToFirstSegment = uivSegments.slice(0, negOffset).join('.');\n const uiViewContext = uiViewsByFqn[fqnToFirstSegment].creationContext;\n return vc.$uiViewContextAnchor === (uiViewContext && uiViewContext.name);\n }\n\n /**\n * Normalizes a view's name from a state.views configuration block.\n *\n * This should be used by a framework implementation to calculate the values for\n * [[_ViewDeclaration.$uiViewName]] and [[_ViewDeclaration.$uiViewContextAnchor]].\n *\n * @param context the context object (state declaration) that the view belongs to\n * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]]\n *\n * @returns the normalized uiViewName and uiViewContextAnchor that the view targets\n */\n static normalizeUIViewTarget(context: ViewContext, rawViewName = '') {\n // TODO: Validate incoming view name with a regexp to allow:\n // ex: \"view.name@foo.bar\" , \"^.^.view.name\" , \"view.name@^.^\" , \"\" ,\n // \"@\" , \"$default@^\" , \"!$default.$default\" , \"!foo.bar\"\n const viewAtContext: string[] = rawViewName.split('@');\n let uiViewName = viewAtContext[0] || '$default'; // default to unnamed view\n let uiViewContextAnchor = isString(viewAtContext[1]) ? viewAtContext[1] : '^'; // default to parent context\n\n // Handle relative view-name sugar syntax.\n // Matches rawViewName \"^.^.^.foo.bar\" into array: [\"^.^.^.foo.bar\", \"^.^.^\", \"foo.bar\"],\n const relativeViewNameSugar = /^(\\^(?:\\.\\^)*)\\.(.*$)/.exec(uiViewName);\n if (relativeViewNameSugar) {\n // Clobbers existing contextAnchor (rawViewName validation will fix this)\n uiViewContextAnchor = relativeViewNameSugar[1]; // set anchor to \"^.^.^\"\n uiViewName = relativeViewNameSugar[2]; // set view-name to \"foo.bar\"\n }\n\n if (uiViewName.charAt(0) === '!') {\n uiViewName = uiViewName.substr(1);\n uiViewContextAnchor = ''; // target absolutely from root\n }\n\n // handle parent relative targeting \"^.^.^\"\n const relativeMatch = /^(\\^(?:\\.\\^)*)$/;\n if (relativeMatch.exec(uiViewContextAnchor)) {\n const anchorState = uiViewContextAnchor.split('.')\n .reduce(((anchor, x) => anchor.parent), context);\n uiViewContextAnchor = anchorState.name;\n } else if (uiViewContextAnchor === '.') {\n uiViewContextAnchor = context.name;\n }\n\n return { uiViewName, uiViewContextAnchor };\n }\n\n constructor() { }\n\n private _rootViewContext(context?: ViewContext): ViewContext {\n return this._rootContext = context || this._rootContext;\n }\n\n private _viewConfigFactory(viewType: string, factory: ViewConfigFactory) {\n this._viewConfigFactories[viewType] = factory;\n }\n\n createViewConfig(path: PathNode[], decl: _ViewDeclaration): ViewConfig[] {\n const cfgFactory = this._viewConfigFactories[decl.$type];\n if (!cfgFactory) throw new Error('ViewService: No view config factory registered for type ' + decl.$type);\n const cfgs = cfgFactory(path, decl);\n return isArray(cfgs) ? cfgs : [cfgs];\n }\n\n /**\n * Deactivates a ViewConfig.\n *\n * This function deactivates a `ViewConfig`.\n * After calling [[sync]], it will un-pair from any `ui-view` with which it is currently paired.\n *\n * @param viewConfig The ViewConfig view to deregister.\n */\n deactivateViewConfig(viewConfig: ViewConfig) {\n trace.traceViewServiceEvent('<- Removing', viewConfig);\n removeFrom(this._viewConfigs, viewConfig);\n }\n\n activateViewConfig(viewConfig: ViewConfig) {\n trace.traceViewServiceEvent('-> Registering', viewConfig);\n this._viewConfigs.push(viewConfig);\n }\n\n\n sync() {\n const uiViewsByFqn: TypedMap =\n this._uiViews.map(uiv => [uiv.fqn, uiv]).reduce(applyPairs, {});\n\n // Return a weighted depth value for a uiView.\n // The depth is the nesting depth of ui-views (based on FQN; times 10,000)\n // plus the depth of the state that is populating the uiView\n function uiViewDepth(uiView: ActiveUIView) {\n const stateDepth = (context: ViewContext) =>\n context && context.parent ? stateDepth(context.parent) + 1 : 1;\n return (uiView.fqn.split('.').length * 10000) + stateDepth(uiView.creationContext);\n }\n\n // Return the ViewConfig's context's depth in the context tree.\n function viewConfigDepth(config: ViewConfig) {\n let context: ViewContext = config.viewDecl.$context, count = 0;\n while (++count && context.parent) context = context.parent;\n return count;\n }\n\n // Given a depth function, returns a compare function which can return either ascending or descending order\n const depthCompare = curry((depthFn, posNeg, left, right) => posNeg * (depthFn(left) - depthFn(right)));\n\n const matchingConfigPair = (uiView: ActiveUIView): ViewTuple => {\n const matchingConfigs = this._viewConfigs.filter(ViewService.matches(uiViewsByFqn, uiView));\n if (matchingConfigs.length > 1) {\n // This is OK. Child states can target a ui-view that the parent state also targets (the child wins)\n // Sort by depth and return the match from the deepest child\n // console.log(`Multiple matching view configs for ${uiView.fqn}`, matchingConfigs);\n matchingConfigs.sort(depthCompare(viewConfigDepth, -1)); // descending\n }\n return { uiView, viewConfig: matchingConfigs[0] };\n };\n\n const configureUIView = (tuple: ViewTuple) => {\n // If a parent ui-view is reconfigured, it could destroy child ui-views.\n // Before configuring a child ui-view, make sure it's still in the active uiViews array.\n if (this._uiViews.indexOf(tuple.uiView) !== -1)\n tuple.uiView.configUpdated(tuple.viewConfig);\n };\n\n // Sort views by FQN and state depth. Process uiviews nearest the root first.\n const uiViewTuples = this._uiViews.sort(depthCompare(uiViewDepth, 1)).map(matchingConfigPair);\n const matchedViewConfigs = uiViewTuples.map(tuple => tuple.viewConfig);\n const unmatchedConfigTuples = this._viewConfigs\n .filter(config => !inArray(matchedViewConfigs, config))\n .map(viewConfig => ({ uiView: undefined, viewConfig }));\n\n uiViewTuples.forEach(configureUIView);\n\n const allTuples: ViewTuple[] = uiViewTuples.concat(unmatchedConfigTuples);\n this._listeners.forEach(cb => cb(allTuples));\n trace.traceViewSync(allTuples);\n }\n\n /**\n * Registers a `ui-view` component\n *\n * When a `ui-view` component is created, it uses this method to register itself.\n * After registration the [[sync]] method is used to ensure all `ui-view` are configured with the proper [[ViewConfig]].\n *\n * Note: the `ui-view` component uses the `ViewConfig` to determine what view should be loaded inside the `ui-view`,\n * and what the view's state context is.\n *\n * Note: There is no corresponding `deregisterUIView`.\n * A `ui-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself.\n *\n * @param uiView The metadata for a UIView\n * @return a de-registration function used when the view is destroyed.\n */\n registerUIView(uiView: ActiveUIView) {\n trace.traceViewServiceUIViewEvent('-> Registering', uiView);\n const uiViews = this._uiViews;\n const fqnAndTypeMatches = (uiv: ActiveUIView) => uiv.fqn === uiView.fqn && uiv.$type === uiView.$type;\n if (uiViews.filter(fqnAndTypeMatches).length)\n trace.traceViewServiceUIViewEvent('!!!! duplicate uiView named:', uiView);\n\n uiViews.push(uiView);\n this.sync();\n\n return () => {\n const idx = uiViews.indexOf(uiView);\n if (idx === -1) {\n trace.traceViewServiceUIViewEvent('Tried removing non-registered uiView', uiView);\n return;\n }\n trace.traceViewServiceUIViewEvent('<- Deregistering', uiView);\n removeFrom(uiViews)(uiView);\n };\n }\n\n /**\n * Returns the list of views currently available on the page, by fully-qualified name.\n *\n * @return {Array} Returns an array of fully-qualified view names.\n */\n available() {\n return this._uiViews.map(prop('fqn'));\n }\n\n /**\n * Returns the list of views on the page containing loaded content.\n *\n * @return {Array} Returns an array of fully-qualified view names.\n */\n active() {\n return this._uiViews.filter(prop('$config')).map(prop('name'));\n }\n\n}\n", + "/**\n * @coreapi\n * @module core\n */ /** */\nimport { StateParams } from './params/stateParams';\nimport { StateDeclaration } from './state/interface';\nimport { StateObject } from './state/stateObject';\nimport { Transition } from './transition/transition';\nimport { Queue } from './common/queue';\nimport { Disposable } from './interface';\n\n/**\n * Global router state\n *\n * This is where we hold the global mutable state such as current state, current\n * params, current transition, etc.\n */\nexport class UIRouterGlobals implements Disposable {\n /**\n * Current parameter values\n *\n * The parameter values from the latest successful transition\n */\n params: StateParams = new StateParams();\n\n /**\n * Current state\n *\n * The to-state from the latest successful transition\n */\n current: StateDeclaration;\n\n /**\n * Current state (internal object)\n *\n * The to-state from the latest successful transition\n * @internalapi\n */\n $current: StateObject;\n\n /**\n * The current started/running transition.\n * This transition has reached at least the onStart phase, but is not yet complete\n */\n transition: Transition;\n\n /** @internalapi */\n lastStartedTransitionId = -1;\n\n /** @internalapi */\n transitionHistory = new Queue([], 1);\n\n /** @internalapi */\n successfulTransitions = new Queue([], 1);\n\n dispose() {\n this.transitionHistory.clear();\n this.successfulTransitions.clear();\n this.transition = null;\n }\n}\n", + "/**\n * @coreapi\n * @module url\n */ /** */\n\nimport { UIRouter } from '../router';\nimport { LocationServices, notImplemented, LocationConfig } from '../common/coreservices';\nimport { noop, createProxyFunctions } from '../common/common';\nimport { UrlConfigApi, UrlSyncApi, UrlRulesApi, UrlParts, MatchResult } from './interface';\n\n/** @hidden */\nconst makeStub = (keys: string[]): any =>\n keys.reduce((acc, key) => (acc[key] = notImplemented(key), acc), { dispose: noop });\n\n/* tslint:disable:align */\n/** @hidden */ const locationServicesFns = ['url', 'path', 'search', 'hash', 'onChange'];\n/** @hidden */ const locationConfigFns = ['port', 'protocol', 'host', 'baseHref', 'html5Mode', 'hashPrefix'];\n/** @hidden */ const umfFns = ['type', 'caseInsensitive', 'strictMode', 'defaultSquashPolicy'];\n/** @hidden */ const rulesFns = ['sort', 'when', 'initial', 'otherwise', 'rules', 'rule', 'removeRule'];\n/** @hidden */ const syncFns = ['deferIntercept', 'listen', 'sync', 'match'];\n/* tslint:enable:align */\n\n/**\n * API for URL management\n */\nexport class UrlService implements LocationServices, UrlSyncApi {\n /** @hidden */\n static locationServiceStub: LocationServices = makeStub(locationServicesFns);\n /** @hidden */\n static locationConfigStub: LocationConfig = makeStub(locationConfigFns);\n\n /**\n * A nested API for managing URL rules and rewrites\n *\n * See: [[UrlRulesApi]] for details\n */\n rules: UrlRulesApi;\n\n /**\n * A nested API to configure the URL and retrieve URL information\n *\n * See: [[UrlConfigApi]] for details\n */\n config: UrlConfigApi;\n\n /** @hidden */\n private router: UIRouter;\n\n /** @hidden */\n constructor(router: UIRouter, lateBind = true) {\n this.router = router;\n this.rules = {} as any;\n this.config = {} as any;\n\n // proxy function calls from UrlService to the LocationService/LocationConfig\n const locationServices = () => router.locationService;\n createProxyFunctions(locationServices, this, locationServices, locationServicesFns, lateBind);\n\n const locationConfig = () => router.locationConfig;\n createProxyFunctions(locationConfig, this.config, locationConfig, locationConfigFns, lateBind);\n\n const umf = () => router.urlMatcherFactory;\n createProxyFunctions(umf, this.config, umf, umfFns);\n\n const urlRouter = () => router.urlRouter;\n createProxyFunctions(urlRouter, this.rules, urlRouter, rulesFns);\n createProxyFunctions(urlRouter, this, urlRouter, syncFns);\n }\n\n /** @inheritdoc */\n url(): string;\n /** @inheritdoc */\n url(newurl: string, replace?: boolean, state?): void;\n url(newurl?, replace?, state?): any { return; }\n /** @inheritdoc */\n path(): string { return; }\n /** @inheritdoc */\n search(): { [key: string]: any } { return; }\n /** @inheritdoc */\n hash(): string { return; }\n /** @inheritdoc */\n onChange(callback: Function): Function { return; }\n\n\n /**\n * Returns the current URL parts\n *\n * This method returns the current URL components as a [[UrlParts]] object.\n *\n * @returns the current url parts\n */\n parts(): UrlParts {\n return { path: this.path(), search: this.search(), hash: this.hash() };\n }\n\n dispose() { }\n\n /** @inheritdoc */\n sync(evt?) { return; }\n /** @inheritdoc */\n listen(enabled?: boolean): Function { return; }\n /** @inheritdoc */\n deferIntercept(defer?: boolean) { return; }\n /** @inheritdoc */\n match(urlParts: UrlParts): MatchResult { return; }\n\n}\n", + "/**\n * @coreapi\n * @module core\n */ /** */\nimport { UrlMatcherFactory } from './url/urlMatcherFactory';\nimport { UrlRouter } from './url/urlRouter';\nimport { TransitionService } from './transition/transitionService';\nimport { ViewService } from './view/view';\nimport { StateRegistry } from './state/stateRegistry';\nimport { StateService } from './state/stateService';\nimport { UIRouterGlobals } from './globals';\nimport { UIRouterPlugin, Disposable } from './interface';\nimport { values, removeFrom } from './common/common';\nimport { isFunction } from './common/predicates';\nimport { UrlService } from './url/urlService';\nimport { LocationServices, LocationConfig } from './common/coreservices';\nimport { Trace, trace } from './common/trace';\n\n/** @hidden */\nlet _routerInstance = 0;\n\n/**\n * The master class used to instantiate an instance of UI-Router.\n *\n * UI-Router (for each specific framework) will create an instance of this class during bootstrap.\n * This class instantiates and wires the UI-Router services together.\n *\n * After a new instance of the UIRouter class is created, it should be configured for your app.\n * For instance, app states should be registered with the [[UIRouter.stateRegistry]].\n *\n * ---\n *\n * Normally the framework code will bootstrap UI-Router.\n * If you are bootstrapping UIRouter manually, tell it to monitor the URL by calling\n * [[UrlService.listen]] then [[UrlService.sync]].\n */\nexport class UIRouter {\n /** @hidden */ $id = _routerInstance++;\n /** @hidden */ _disposed = false;\n /** @hidden */ private _disposables: Disposable[] = [];\n\n /** Provides trace information to the console */\n trace: Trace = trace;\n\n /** Provides services related to ui-view synchronization */\n viewService = new ViewService();\n\n /** Provides services related to Transitions */\n transitionService: TransitionService = new TransitionService(this);\n\n /** Global router state */\n globals: UIRouterGlobals = new UIRouterGlobals();\n\n /**\n * Deprecated for public use. Use [[urlService]] instead.\n * @deprecated Use [[urlService]] instead\n */\n urlMatcherFactory: UrlMatcherFactory = new UrlMatcherFactory();\n\n /**\n * Deprecated for public use. Use [[urlService]] instead.\n * @deprecated Use [[urlService]] instead\n */\n urlRouter: UrlRouter = new UrlRouter(this);\n\n /** Provides a registry for states, and related registration services */\n stateRegistry: StateRegistry = new StateRegistry(this);\n\n /** Provides services related to states */\n stateService = new StateService(this);\n\n /** Provides services related to the URL */\n urlService: UrlService = new UrlService(this);\n\n /** @hidden plugin instances are registered here */\n private _plugins: { [key: string]: UIRouterPlugin } = {};\n\n\n /** Registers an object to be notified when the router is disposed */\n disposable(disposable: Disposable) {\n this._disposables.push(disposable);\n }\n\n /**\n * Disposes this router instance\n *\n * When called, clears resources retained by the router by calling `dispose(this)` on all\n * registered [[disposable]] objects.\n *\n * Or, if a `disposable` object is provided, calls `dispose(this)` on that object only.\n *\n * @param disposable (optional) the disposable to dispose\n */\n dispose(disposable?: any): void {\n if (disposable && isFunction(disposable.dispose)) {\n disposable.dispose(this);\n return undefined;\n }\n\n this._disposed = true;\n this._disposables.slice().forEach(d => {\n try {\n typeof d.dispose === 'function' && d.dispose(this);\n removeFrom(this._disposables, d);\n } catch (ignored) {}\n });\n }\n\n /**\n * Creates a new `UIRouter` object\n *\n * @param locationService a [[LocationServices]] implementation\n * @param locationConfig a [[LocationConfig]] implementation\n * @internalapi\n */\n constructor(\n public locationService: LocationServices = UrlService.locationServiceStub,\n public locationConfig: LocationConfig = UrlService.locationConfigStub,\n ) {\n\n this.viewService._pluginapi._rootViewContext(this.stateRegistry.root());\n this.globals.$current = this.stateRegistry.root();\n this.globals.current = this.globals.$current.self;\n\n this.disposable(this.globals);\n this.disposable(this.stateService);\n this.disposable(this.stateRegistry);\n this.disposable(this.transitionService);\n this.disposable(this.urlRouter);\n this.disposable(locationService);\n this.disposable(locationConfig);\n }\n\n /** Add plugin (as ES6 class) */\n plugin(plugin: { new(router: UIRouter, options?: any): T }, options?: any): T;\n /** Add plugin (as javascript constructor function) */\n plugin(plugin: { (router: UIRouter, options?: any): void }, options?: any): T;\n /** Add plugin (as javascript factory function) */\n plugin(plugin: PluginFactory, options?: any): T;\n /**\n * Adds a plugin to UI-Router\n *\n * This method adds a UI-Router Plugin.\n * A plugin can enhance or change UI-Router behavior using any public API.\n *\n * #### Example:\n * ```js\n * import { MyCoolPlugin } from \"ui-router-cool-plugin\";\n *\n * var plugin = router.addPlugin(MyCoolPlugin);\n * ```\n *\n * ### Plugin authoring\n *\n * A plugin is simply a class (or constructor function) which accepts a [[UIRouter]] instance and (optionally) an options object.\n *\n * The plugin can implement its functionality using any of the public APIs of [[UIRouter]].\n * For example, it may configure router options or add a Transition Hook.\n *\n * The plugin can then be published as a separate module.\n *\n * #### Example:\n * ```js\n * export class MyAuthPlugin implements UIRouterPlugin {\n * constructor(router: UIRouter, options: any) {\n * this.name = \"MyAuthPlugin\";\n * let $transitions = router.transitionService;\n * let $state = router.stateService;\n *\n * let authCriteria = {\n * to: (state) => state.data && state.data.requiresAuth\n * };\n *\n * function authHook(transition: Transition) {\n * let authService = transition.injector().get('AuthService');\n * if (!authService.isAuthenticated()) {\n * return $state.target('login');\n * }\n * }\n *\n * $transitions.onStart(authCriteria, authHook);\n * }\n * }\n * ```\n *\n * @param plugin one of:\n * - a plugin class which implements [[UIRouterPlugin]]\n * - a constructor function for a [[UIRouterPlugin]] which accepts a [[UIRouter]] instance\n * - a factory function which accepts a [[UIRouter]] instance and returns a [[UIRouterPlugin]] instance\n * @param options options to pass to the plugin class/factory\n * @returns the registered plugin instance\n */\n plugin(plugin: any, options: any = {}): T {\n const pluginInstance = new plugin(this, options);\n if (!pluginInstance.name) throw new Error('Required property `name` missing on plugin: ' + pluginInstance);\n this._disposables.push(pluginInstance);\n return this._plugins[pluginInstance.name] = pluginInstance;\n }\n\n /**\n * Returns registered plugins\n *\n * Returns the registered plugin of the given `pluginName`.\n * If no `pluginName` is given, returns all registered plugins\n *\n * @param pluginName (optional) the name of the plugin to get\n * @return the named plugin (undefined if not found), or all plugins (if `pluginName` is omitted)\n */\n getPlugin(pluginName: string): UIRouterPlugin;\n getPlugin(): UIRouterPlugin[];\n getPlugin(pluginName?: string): UIRouterPlugin|UIRouterPlugin[] {\n return pluginName ? this._plugins[pluginName] : values(this._plugins);\n }\n}\n\n/** @internalapi */\nexport type PluginFactory = (router: UIRouter, options?: any) => T;\n", + "/** @module hooks */ /** */\nimport { Transition } from '../transition/transition';\nimport { UIRouter } from '../router';\nimport { TransitionService } from '../transition/transitionService';\n\nfunction addCoreResolvables(trans: Transition) {\n trans.addResolvable({ token: UIRouter, deps: [], resolveFn: () => trans.router, data: trans.router }, '');\n trans.addResolvable({ token: Transition, deps: [], resolveFn: () => trans, data: trans }, '');\n trans.addResolvable({ token: '$transition$', deps: [], resolveFn: () => trans, data: trans }, '');\n trans.addResolvable({ token: '$stateParams', deps: [], resolveFn: () => trans.params(), data: trans.params() }, '');\n\n trans.entering().forEach(state => {\n trans.addResolvable({ token: '$state$', deps: [], resolveFn: () => state, data: state }, state);\n });\n}\n\nexport const registerAddCoreResolvables = (transitionService: TransitionService) =>\n transitionService.onCreate({}, addCoreResolvables);\n", + "/** @module hooks */ /** */\nimport { isString, isFunction } from '../common/predicates';\nimport { Transition } from '../transition/transition';\nimport { services } from '../common/coreservices';\nimport { TargetState } from '../state/targetState';\nimport { TransitionService } from '../transition/transitionService';\nimport { TransitionHookFn } from '../transition/interface';\n\n/**\n * A [[TransitionHookFn]] that redirects to a different state or params\n *\n * Registered using `transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectHook);`\n *\n * See [[StateDeclaration.redirectTo]]\n */\nconst redirectToHook: TransitionHookFn = (trans: Transition) => {\n const redirect = trans.to().redirectTo;\n if (!redirect) return;\n\n const $state = trans.router.stateService;\n\n function handleResult(result: any) {\n if (!result) return;\n if (result instanceof TargetState) return result;\n if (isString(result)) return $state.target( result, trans.params(), trans.options());\n if (result['state'] || result['params'])\n return $state.target(result['state'] || trans.to(), result['params'] || trans.params(), trans.options());\n }\n\n if (isFunction(redirect)) {\n return services.$q.when(redirect(trans)).then(handleResult);\n }\n return handleResult(redirect);\n};\n\nexport const registerRedirectToHook = (transitionService: TransitionService) =>\n transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectToHook);\n", + "/** @module hooks */\n/** for typedoc */\nimport { TransitionStateHookFn } from '../transition/interface';\nimport { Transition } from '../transition/transition';\nimport { TransitionService } from '../transition/transitionService';\nimport { StateDeclaration } from '../state/interface';\nimport { StateObject } from '../state/stateObject';\n\n/**\n * A factory which creates an onEnter, onExit or onRetain transition hook function\n *\n * The returned function invokes the (for instance) state.onEnter hook when the\n * state is being entered.\n *\n * @hidden\n */\nfunction makeEnterExitRetainHook(hookName: string): TransitionStateHookFn {\n return (transition: Transition, state: StateDeclaration) => {\n const _state: StateObject = state.$$state();\n const hookFn: TransitionStateHookFn = _state[hookName];\n return hookFn(transition, state);\n };\n}\n\n/**\n * The [[TransitionStateHookFn]] for onExit\n *\n * When the state is being exited, the state's .onExit function is invoked.\n *\n * Registered using `transitionService.onExit({ exiting: (state) => !!state.onExit }, onExitHook);`\n *\n * See: [[IHookRegistry.onExit]]\n */\nconst onExitHook: TransitionStateHookFn = makeEnterExitRetainHook('onExit');\nexport const registerOnExitHook = (transitionService: TransitionService) =>\n transitionService.onExit({ exiting: state => !!state.onExit }, onExitHook);\n\n/**\n * The [[TransitionStateHookFn]] for onRetain\n *\n * When the state was already entered, and is not being exited or re-entered, the state's .onRetain function is invoked.\n *\n * Registered using `transitionService.onRetain({ retained: (state) => !!state.onRetain }, onRetainHook);`\n *\n * See: [[IHookRegistry.onRetain]]\n */\nconst onRetainHook: TransitionStateHookFn = makeEnterExitRetainHook('onRetain');\nexport const registerOnRetainHook = (transitionService: TransitionService) =>\n transitionService.onRetain({ retained: state => !!state.onRetain }, onRetainHook);\n\n/**\n * The [[TransitionStateHookFn]] for onEnter\n *\n * When the state is being entered, the state's .onEnter function is invoked.\n *\n * Registered using `transitionService.onEnter({ entering: (state) => !!state.onEnter }, onEnterHook);`\n *\n * See: [[IHookRegistry.onEnter]]\n */\nconst onEnterHook: TransitionStateHookFn = makeEnterExitRetainHook('onEnter');\nexport const registerOnEnterHook = (transitionService: TransitionService) =>\n transitionService.onEnter({ entering: state => !!state.onEnter }, onEnterHook);\n\n", + "/** @module hooks */\n/** for typedoc */\nimport { noop } from '../common/common';\nimport { Transition } from '../transition/transition';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { TransitionStateHookFn, TransitionHookFn } from '../transition/interface';\nimport { TransitionService } from '../transition/transitionService';\nimport { val } from '../common/hof';\nimport { StateDeclaration } from '../state/interface';\n\nexport const RESOLVE_HOOK_PRIORITY = 1000;\n\n/**\n * A [[TransitionHookFn]] which resolves all EAGER Resolvables in the To Path\n *\n * Registered using `transitionService.onStart({}, eagerResolvePath, { priority: 1000 });`\n *\n * When a Transition starts, this hook resolves all the EAGER Resolvables, which the transition then waits for.\n *\n * See [[StateDeclaration.resolve]]\n */\nconst eagerResolvePath: TransitionHookFn = (trans: Transition) =>\n new ResolveContext(trans.treeChanges().to)\n .resolvePath('EAGER', trans)\n .then(noop);\n\nexport const registerEagerResolvePath = (transitionService: TransitionService) =>\n transitionService.onStart({}, eagerResolvePath, { priority: RESOLVE_HOOK_PRIORITY });\n\n/**\n * A [[TransitionHookFn]] which resolves all LAZY Resolvables for the state (and all its ancestors) in the To Path\n *\n * Registered using `transitionService.onEnter({ entering: () => true }, lazyResolveState, { priority: 1000 });`\n *\n * When a State is being entered, this hook resolves all the Resolvables for this state, which the transition then waits for.\n *\n * See [[StateDeclaration.resolve]]\n */\nconst lazyResolveState: TransitionStateHookFn = (trans: Transition, state: StateDeclaration) =>\n new ResolveContext(trans.treeChanges().to)\n .subContext(state.$$state())\n .resolvePath('LAZY', trans)\n .then(noop);\n\nexport const registerLazyResolveState = (transitionService: TransitionService) =>\n transitionService.onEnter({ entering: val(true) }, lazyResolveState, { priority: RESOLVE_HOOK_PRIORITY });\n\n\n/**\n * A [[TransitionHookFn]] which resolves any dynamically added (LAZY or EAGER) Resolvables.\n *\n * Registered using `transitionService.onFinish({}, eagerResolvePath, { priority: 1000 });`\n *\n * After all entering states have been entered, this hook resolves any remaining Resolvables.\n * These are typically dynamic resolves which were added by some Transition Hook using [[Transition.addResolvable]].\n *\n * See [[StateDeclaration.resolve]]\n */\nconst resolveRemaining: TransitionHookFn = (trans: Transition) =>\n new ResolveContext(trans.treeChanges().to)\n .resolvePath('LAZY', trans)\n .then(noop);\n\nexport const registerResolveRemaining = (transitionService: TransitionService) =>\n transitionService.onFinish({}, resolveRemaining, { priority: RESOLVE_HOOK_PRIORITY });\n", + "/** @module hooks */ /** for typedoc */\nimport { noop } from '../common/common';\nimport { services } from '../common/coreservices';\nimport { Transition } from '../transition/transition';\nimport { ViewService } from '../view/view';\nimport { ViewConfig } from '../view/interface';\nimport { TransitionHookFn } from '../transition/interface';\nimport { TransitionService } from '../transition/transitionService';\n\n\n/**\n * A [[TransitionHookFn]] which waits for the views to load\n *\n * Registered using `transitionService.onStart({}, loadEnteringViews);`\n *\n * Allows the views to do async work in [[ViewConfig.load]] before the transition continues.\n * In angular 1, this includes loading the templates.\n */\nconst loadEnteringViews: TransitionHookFn = (transition: Transition) => {\n const $q = services.$q;\n const enteringViews = transition.views('entering');\n if (!enteringViews.length) return;\n return $q.all(enteringViews.map(view => $q.when(view.load()))).then(noop);\n};\n\nexport const registerLoadEnteringViews = (transitionService: TransitionService) =>\n transitionService.onFinish({}, loadEnteringViews);\n\n/**\n * A [[TransitionHookFn]] which activates the new views when a transition is successful.\n *\n * Registered using `transitionService.onSuccess({}, activateViews);`\n *\n * After a transition is complete, this hook deactivates the old views from the previous state,\n * and activates the new views from the destination state.\n *\n * See [[ViewService]]\n */\nconst activateViews: TransitionHookFn = (transition: Transition) => {\n const enteringViews = transition.views('entering');\n const exitingViews = transition.views('exiting');\n if (!enteringViews.length && !exitingViews.length) return;\n\n const $view: ViewService = transition.router.viewService;\n\n exitingViews.forEach((vc: ViewConfig) => $view.deactivateViewConfig(vc));\n enteringViews.forEach((vc: ViewConfig) => $view.activateViewConfig(vc));\n\n $view.sync();\n};\n\nexport const registerActivateViews = (transitionService: TransitionService) =>\n transitionService.onSuccess({}, activateViews);\n", + "/** @module hooks */\n/** for typedoc */\nimport { Transition } from '../transition/transition';\nimport { copy } from '../common/common';\nimport { TransitionService } from '../transition/transitionService';\n\n/**\n * A [[TransitionHookFn]] which updates global UI-Router state\n *\n * Registered using `transitionService.onBefore({}, updateGlobalState);`\n *\n * Before a [[Transition]] starts, updates the global value of \"the current transition\" ([[Globals.transition]]).\n * After a successful [[Transition]], updates the global values of \"the current state\"\n * ([[Globals.current]] and [[Globals.$current]]) and \"the current param values\" ([[Globals.params]]).\n *\n * See also the deprecated properties:\n * [[StateService.transition]], [[StateService.current]], [[StateService.params]]\n */\nconst updateGlobalState = (trans: Transition) => {\n const globals = trans.router.globals;\n\n const transitionSuccessful = () => {\n globals.successfulTransitions.enqueue(trans);\n globals.$current = trans.$to();\n globals.current = globals.$current.self;\n\n copy(trans.params(), globals.params);\n };\n\n const clearCurrentTransition = () => {\n // Do not clear globals.transition if a different transition has started in the meantime\n if (globals.transition === trans) globals.transition = null;\n };\n\n trans.onSuccess({}, transitionSuccessful, { priority: 10000 });\n trans.promise.then(clearCurrentTransition, clearCurrentTransition);\n};\n\nexport const registerUpdateGlobalState = (transitionService: TransitionService) =>\n transitionService.onCreate({}, updateGlobalState);\n", + "/** @module hooks */ /** */\nimport { UrlRouter } from '../url/urlRouter';\nimport { StateService } from '../state/stateService';\nimport { Transition } from '../transition/transition';\nimport { TransitionHookFn } from '../transition/interface';\nimport { TransitionService } from '../transition/transitionService';\n\n/**\n * A [[TransitionHookFn]] which updates the URL after a successful transition\n *\n * Registered using `transitionService.onSuccess({}, updateUrl);`\n */\nconst updateUrl: TransitionHookFn = (transition: Transition) => {\n const options = transition.options();\n const $state: StateService = transition.router.stateService;\n const $urlRouter: UrlRouter = transition.router.urlRouter;\n\n // Dont update the url in these situations:\n // The transition was triggered by a URL sync (options.source === 'url')\n // The user doesn't want the url to update (options.location === false)\n // The destination state, and all parents have no navigable url\n if (options.source !== 'url' && options.location && $state.$current.navigable) {\n const urlOptions = { replace: options.location === 'replace' };\n $urlRouter.push($state.$current.navigable.url, $state.params, urlOptions);\n }\n\n $urlRouter.update(true);\n};\n\nexport const registerUpdateUrl = (transitionService: TransitionService) =>\n transitionService.onSuccess({}, updateUrl, { priority: 9999 });\n", + "/** @module hooks */ /** */\nimport { Transition } from '../transition/transition';\nimport { TransitionService } from '../transition/transitionService';\nimport { TransitionHookFn } from '../transition/interface';\nimport { StateDeclaration, LazyLoadResult } from '../state/interface';\nimport { services } from '../common/coreservices';\nimport { StateRule } from '../url/interface';\n\n/**\n * A [[TransitionHookFn]] that performs lazy loading\n *\n * When entering a state \"abc\" which has a `lazyLoad` function defined:\n * - Invoke the `lazyLoad` function (unless it is already in process)\n * - Flag the hook function as \"in process\"\n * - The function should return a promise (that resolves when lazy loading is complete)\n * - Wait for the promise to settle\n * - If the promise resolves to a [[LazyLoadResult]], then register those states\n * - Flag the hook function as \"not in process\"\n * - If the hook was successful\n * - Remove the `lazyLoad` function from the state declaration\n * - If all the hooks were successful\n * - Retry the transition (by returning a TargetState)\n *\n * ```\n * .state('abc', {\n * component: 'fooComponent',\n * lazyLoad: () => System.import('./fooComponent')\n * });\n * ```\n *\n * See [[StateDeclaration.lazyLoad]]\n */\nconst lazyLoadHook: TransitionHookFn = (transition: Transition) => {\n const router = transition.router;\n\n function retryTransition() {\n if (transition.originalTransition().options().source !== 'url') {\n // The original transition was not triggered via url sync\n // The lazy state should be loaded now, so re-try the original transition\n const orig = transition.targetState();\n return router.stateService.target(orig.identifier(), orig.params(), orig.options());\n }\n\n // The original transition was triggered via url sync\n // Run the URL rules and find the best match\n const $url = router.urlService;\n const result = $url.match($url.parts());\n const rule = result && result.rule;\n\n // If the best match is a state, redirect the transition (instead\n // of calling sync() which supersedes the current transition)\n if (rule && rule.type === 'STATE') {\n const state = (rule as StateRule).state;\n const params = result.match;\n return router.stateService.target(state, params, transition.options());\n }\n\n // No matching state found, so let .sync() choose the best non-state match/otherwise\n router.urlService.sync();\n }\n\n const promises = transition.entering()\n .filter(state => !!state.$$state().lazyLoad)\n .map(state => lazyLoadState(transition, state));\n\n return services.$q.all(promises).then(retryTransition);\n};\n\nexport const registerLazyLoadHook = (transitionService: TransitionService) =>\n transitionService.onBefore({ entering: (state) => !!state.lazyLoad }, lazyLoadHook);\n\n\n/**\n * Invokes a state's lazy load function\n *\n * @param transition a Transition context\n * @param state the state to lazy load\n * @returns A promise for the lazy load result\n */\nexport function lazyLoadState(transition: Transition, state: StateDeclaration): Promise {\n const lazyLoadFn = state.$$state().lazyLoad;\n\n // Store/get the lazy load promise on/from the hookfn so it doesn't get re-invoked\n let promise = lazyLoadFn['_promise'];\n if (!promise) {\n const success = (result) => {\n delete state.lazyLoad;\n delete state.$$state().lazyLoad;\n delete lazyLoadFn['_promise'];\n return result;\n };\n\n const error = (err) => {\n delete lazyLoadFn['_promise'];\n return services.$q.reject(err);\n };\n\n promise = lazyLoadFn['_promise'] =\n services.$q.when(lazyLoadFn(transition, state))\n .then(updateStateRegistry)\n .then(success, error);\n }\n\n /** Register any lazy loaded state definitions */\n function updateStateRegistry(result: LazyLoadResult) {\n if (result && Array.isArray(result.states)) {\n result.states.forEach(_state => transition.router.stateRegistry.register(_state));\n }\n return result;\n }\n\n return promise;\n}\n", + "/** @module transition */ /** */\nimport { TransitionHookPhase, PathType } from './interface';\nimport { GetErrorHandler, GetResultHandler, TransitionHook } from './transitionHook';\n/**\n * This class defines a type of hook, such as `onBefore` or `onEnter`.\n * Plugins can define custom hook types, such as sticky states does for `onInactive`.\n *\n * @interalapi\n */\nexport class TransitionEventType {\n /* tslint:disable:no-inferrable-types */\n constructor(public name: string,\n public hookPhase: TransitionHookPhase,\n public hookOrder: number,\n public criteriaMatchPath: PathType,\n public reverseSort: boolean = false,\n public getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,\n public getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,\n public synchronous: boolean = false,\n ) { }\n}\n", "/** @module hooks */ /** */\n\nimport { trace } from '../common/trace';\nimport { Rejection } from '../transition/rejectFactory';\nimport { TransitionService } from '../transition/transitionService';\nimport { Transition } from '../transition/transition';\n\n/**\n * A [[TransitionHookFn]] that skips a transition if it should be ignored\n *\n * This hook is invoked at the end of the onBefore phase.\n *\n * If the transition should be ignored (because no parameter or states changed)\n * then the transition is ignored and not processed.\n */\nfunction ignoredHook(trans: Transition) {\n const ignoredReason = trans._ignoredReason();\n if (!ignoredReason) return;\n\n trace.traceTransitionIgnored(trans);\n\n const pending = trans.router.globals.transition;\n\n // The user clicked a link going back to the *current state* ('A')\n // However, there is also a pending transition in flight (to 'B')\n // Abort the transition to 'B' because the user now wants to be back at 'A'.\n if (ignoredReason === 'SameAsCurrent' && pending) {\n pending.abort();\n }\n\n return Rejection.ignored().toPromise();\n}\n\nexport const registerIgnoredTransitionHook = (transitionService: TransitionService) =>\n transitionService.onBefore({}, ignoredHook, { priority: -9999 });\n", "/** @module hooks */ /** */\n\nimport { TransitionService } from '../transition/transitionService';\nimport { Transition } from '../transition/transition';\n\n/**\n * A [[TransitionHookFn]] that rejects the Transition if it is invalid\n *\n * This hook is invoked at the end of the onBefore phase.\n * If the transition is invalid (for example, param values do not validate)\n * then the transition is rejected.\n */\nfunction invalidTransitionHook(trans: Transition) {\n if (!trans.valid()) {\n throw new Error(trans.error());\n }\n}\n\nexport const registerInvalidTransitionHook = (transitionService: TransitionService) =>\n transitionService.onBefore({}, invalidTransitionHook, { priority: -10000 });\n", - "/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport {\n IHookRegistry, TransitionOptions, TransitionHookScope, TransitionHookPhase, TransitionCreateHookFn, HookMatchCriteria,\n HookRegOptions, PathTypes, PathType, RegisteredHooks, TransitionHookFn, TransitionStateHookFn,\n} from \"./interface\";\nimport { Transition } from \"./transition\";\nimport { makeEvent, RegisteredHook } from \"./hookRegistry\";\nimport { TargetState } from \"../state/targetState\";\nimport { PathNode } from \"../path/pathNode\";\nimport { ViewService } from \"../view/view\";\nimport { UIRouter } from \"../router\";\nimport { registerAddCoreResolvables } from \"../hooks/coreResolvables\";\nimport { registerRedirectToHook } from \"../hooks/redirectTo\";\nimport { registerOnExitHook, registerOnRetainHook, registerOnEnterHook } from \"../hooks/onEnterExitRetain\";\nimport { registerEagerResolvePath, registerLazyResolveState, registerResolveRemaining } from \"../hooks/resolve\";\nimport { registerLoadEnteringViews, registerActivateViews } from \"../hooks/views\";\nimport { registerUpdateGlobalState } from \"../hooks/updateGlobals\";\nimport { registerUpdateUrl } from \"../hooks/url\";\nimport { registerLazyLoadHook } from \"../hooks/lazyLoad\";\nimport { TransitionEventType } from \"./transitionEventType\";\nimport { TransitionHook, GetResultHandler, GetErrorHandler } from \"./transitionHook\";\nimport { isDefined } from \"../common/predicates\";\nimport { removeFrom, values, createProxyFunctions } from \"../common/common\";\nimport { Disposable } from \"../interface\"; // has or is using\nimport { val } from \"../common/hof\";\nimport { registerIgnoredTransitionHook } from '../hooks/ignoredTransition';\nimport { registerInvalidTransitionHook } from '../hooks/invalidTransition';\n\n/**\n * The default [[Transition]] options.\n *\n * Include this object when applying custom defaults:\n * let reloadOpts = { reload: true, notify: true }\n * let options = defaults(theirOpts, customDefaults, defaultOptions);\n */\nexport let defaultTransOpts: TransitionOptions = {\n location : true,\n relative : null,\n inherit : false,\n notify : true,\n reload : false,\n custom : {},\n current : () => null,\n source : \"unknown\",\n};\n\n\n/**\n * Plugin API for Transition Service\n * @internalapi\n */\nexport interface TransitionServicePluginAPI {\n /**\n * Adds a Path to be used as a criterion against a TreeChanges path\n *\n * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.\n * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`\n * Each state in the exiting path is checked against the criteria and returned as part of the match.\n *\n * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.\n * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`\n * Only the tail of the `to` path is checked against the criteria and returned as part of the match.\n */\n _definePathType(name: string, hookScope: TransitionHookScope);\n\n /**\n * Gets a Path definition used as a criterion against a TreeChanges path\n */\n _getPathTypes(): PathTypes;\n\n /**\n * Defines a transition hook type and returns a transition hook registration\n * function (which can then be used to register hooks of this type).\n */\n _defineEvent(name: string,\n hookPhase: TransitionHookPhase,\n hookOrder: number,\n criteriaMatchPath: PathType,\n reverseSort?: boolean,\n getResultHandler?: GetResultHandler,\n getErrorHandler?: GetErrorHandler,\n rejectIfSuperseded?: boolean);\n\n /**\n * Returns the known event types, such as `onBefore`\n * If a phase argument is provided, returns only events for the given phase.\n */\n _getEvents(phase?: TransitionHookPhase): TransitionEventType[];\n\n /** Returns the hooks registered for the given hook name */\n getHooks(hookName: string): RegisteredHook[];\n}\n\n/**\n * This class provides services related to Transitions.\n *\n * - Most importantly, it allows global Transition Hooks to be registered.\n * - It allows the default transition error handler to be set.\n * - It also has a factory function for creating new [[Transition]] objects, (used internally by the [[StateService]]).\n *\n * At bootstrap, [[UIRouter]] creates a single instance (singleton) of this class.\n */\nexport class TransitionService implements IHookRegistry, Disposable {\n /** @hidden */\n _transitionCount = 0;\n\n /**\n * Registers a [[TransitionHookFn]], called *while a transition is being constructed*.\n *\n * Registers a transition lifecycle hook, which is invoked during transition construction.\n *\n * This low level hook should only be used by plugins.\n * This can be a useful time for plugins to add resolves or mutate the transition as needed.\n * The Sticky States plugin uses this hook to modify the treechanges.\n *\n * ### Lifecycle\n *\n * `onCreate` hooks are invoked *while a transition is being constructed*.\n *\n * ### Return value\n *\n * The hook's return value is ignored\n *\n * @internalapi\n * @param criteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be invoked.\n * @param options the registration options\n * @returns a function which deregisters the hook.\n */\n onCreate(criteria: HookMatchCriteria, callback: TransitionCreateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n\n /** @hidden */\n public $view: ViewService;\n\n /** @hidden The transition hook types, such as `onEnter`, `onStart`, etc */\n private _eventTypes: TransitionEventType[] = [];\n /** @hidden The registered transition hooks */\n _registeredHooks = { } as RegisteredHooks;\n /** @hidden The paths on a criteria object */\n private _criteriaPaths = { } as PathTypes;\n /** @hidden */\n private _router: UIRouter;\n\n /** @internalapi */\n _pluginapi: TransitionServicePluginAPI;\n\n /**\n * This object has hook de-registration functions for the built-in hooks.\n * This can be used by third parties libraries that wish to customize the behaviors\n *\n * @hidden\n */\n _deregisterHookFns: {\n addCoreResolves: Function;\n ignored: Function;\n invalid: Function;\n redirectTo: Function;\n onExit: Function;\n onRetain: Function;\n onEnter: Function;\n eagerResolve: Function;\n lazyResolve: Function;\n resolveAll: Function;\n loadViews: Function;\n activateViews: Function;\n updateGlobals: Function;\n updateUrl: Function;\n lazyLoad: Function;\n };\n\n /** @hidden */\n constructor(_router: UIRouter) {\n this._router = _router;\n this.$view = _router.viewService;\n this._deregisterHookFns = {};\n this._pluginapi = createProxyFunctions(val(this), {}, val(this), [\n '_definePathType',\n '_defineEvent',\n '_getPathTypes',\n '_getEvents',\n 'getHooks',\n ]);\n\n this._defineCorePaths();\n this._defineCoreEvents();\n this._registerCoreTransitionHooks();\n }\n\n /**\n * dispose\n * @internalapi\n */\n dispose(router: UIRouter) {\n values(this._registeredHooks).forEach((hooksArray: RegisteredHook[]) => hooksArray.forEach(hook => {\n hook._deregistered = true;\n removeFrom(hooksArray, hook);\n }));\n }\n\n /**\n * Creates a new [[Transition]] object\n *\n * This is a factory function for creating new Transition objects.\n * It is used internally by the [[StateService]] and should generally not be called by application code.\n *\n * @param fromPath the path to the current state (the from state)\n * @param targetState the target state (destination)\n * @returns a Transition\n */\n create(fromPath: PathNode[], targetState: TargetState): Transition {\n return new Transition(fromPath, targetState, this._router);\n }\n\n /** @hidden */\n private _defineCoreEvents() {\n const Phase = TransitionHookPhase;\n const TH = TransitionHook;\n const paths = this._criteriaPaths;\n const NORMAL_SORT = false, REVERSE_SORT = true;\n const SYNCHRONOUS = true;\n\n this._defineEvent(\"onCreate\", Phase.CREATE, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.THROW_ERROR, SYNCHRONOUS);\n\n this._defineEvent(\"onBefore\", Phase.BEFORE, 0, paths.to);\n\n this._defineEvent(\"onStart\", Phase.RUN, 0, paths.to);\n this._defineEvent(\"onExit\", Phase.RUN, 100, paths.exiting, REVERSE_SORT);\n this._defineEvent(\"onRetain\", Phase.RUN, 200, paths.retained);\n this._defineEvent(\"onEnter\", Phase.RUN, 300, paths.entering);\n this._defineEvent(\"onFinish\", Phase.RUN, 400, paths.to);\n\n this._defineEvent(\"onSuccess\", Phase.SUCCESS, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS);\n this._defineEvent(\"onError\", Phase.ERROR, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS);\n }\n\n /** @hidden */\n private _defineCorePaths() {\n const { STATE, TRANSITION } = TransitionHookScope;\n\n this._definePathType(\"to\", TRANSITION);\n this._definePathType(\"from\", TRANSITION);\n this._definePathType(\"exiting\", STATE);\n this._definePathType(\"retained\", STATE);\n this._definePathType(\"entering\", STATE);\n }\n\n /** @hidden */\n _defineEvent(name: string,\n hookPhase: TransitionHookPhase,\n hookOrder: number,\n criteriaMatchPath: PathType,\n reverseSort: boolean = false,\n getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,\n getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,\n synchronous: boolean = false) {\n let eventType = new TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous);\n\n this._eventTypes.push(eventType);\n makeEvent(this, this, eventType);\n }\n\n /** @hidden */ // tslint:disable-next-line\n private _getEvents(phase?: TransitionHookPhase): TransitionEventType[] {\n let transitionHookTypes = isDefined(phase) ?\n this._eventTypes.filter(type => type.hookPhase === phase) :\n this._eventTypes.slice();\n\n return transitionHookTypes.sort((l, r) => {\n let cmpByPhase = l.hookPhase - r.hookPhase;\n return cmpByPhase === 0 ? l.hookOrder - r.hookOrder : cmpByPhase;\n });\n }\n\n /**\n * Adds a Path to be used as a criterion against a TreeChanges path\n *\n * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.\n * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`\n * Each state in the exiting path is checked against the criteria and returned as part of the match.\n *\n * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.\n * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`\n * Only the tail of the `to` path is checked against the criteria and returned as part of the match.\n *\n * @hidden\n */\n private _definePathType(name: string, hookScope: TransitionHookScope) {\n this._criteriaPaths[name] = { name, scope: hookScope };\n }\n\n /** * @hidden */ // tslint:disable-next-line\n private _getPathTypes(): PathTypes {\n return this._criteriaPaths;\n }\n\n /** @hidden */\n public getHooks(hookName: string): RegisteredHook[] {\n return this._registeredHooks[hookName];\n }\n\n /** @hidden */\n private _registerCoreTransitionHooks() {\n let fns = this._deregisterHookFns;\n\n fns.addCoreResolves = registerAddCoreResolvables(this);\n fns.ignored = registerIgnoredTransitionHook(this);\n fns.invalid = registerInvalidTransitionHook(this);\n\n // Wire up redirectTo hook\n fns.redirectTo = registerRedirectToHook(this);\n\n // Wire up onExit/Retain/Enter state hooks\n fns.onExit = registerOnExitHook(this);\n fns.onRetain = registerOnRetainHook(this);\n fns.onEnter = registerOnEnterHook(this);\n\n // Wire up Resolve hooks\n fns.eagerResolve = registerEagerResolvePath(this);\n fns.lazyResolve = registerLazyResolveState(this);\n fns.resolveAll = registerResolveRemaining(this);\n\n // Wire up the View management hooks\n fns.loadViews = registerLoadEnteringViews(this);\n fns.activateViews = registerActivateViews(this);\n\n // Updates global state after a transition\n fns.updateGlobals = registerUpdateGlobalState(this);\n\n // After globals.current is updated at priority: 10000\n fns.updateUrl = registerUpdateUrl(this);\n\n // Lazy load state trees\n fns.lazyLoad = registerLazyLoadHook(this);\n }\n}\n", - "/**\n * @coreapi\n * @module state\n */\n/** */\nimport { createProxyFunctions, defaults, extend, inArray, noop, removeFrom, silenceUncaughtInPromise, silentRejection } from '../common/common';\nimport { isDefined, isObject, isString } from '../common/predicates';\nimport { Queue } from '../common/queue';\nimport { services } from '../common/coreservices';\n\nimport { PathUtils } from '../path/pathFactory';\nimport { PathNode } from '../path/pathNode';\n\nimport { HookResult, TransitionOptions } from '../transition/interface';\nimport { defaultTransOpts } from '../transition/transitionService';\nimport { Rejection, RejectType } from '../transition/rejectFactory';\nimport { Transition } from '../transition/transition';\n\nimport { HrefOptions, LazyLoadResult, StateDeclaration, StateOrName, TransitionPromise } from './interface';\nimport { StateObject } from './stateObject';\nimport { TargetState } from './targetState';\n\nimport { RawParams } from '../params/interface';\nimport { Param } from '../params/param';\nimport { Glob } from '../common/glob';\nimport { UIRouter } from '../router';\nimport { UIInjector } from '../interface';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { lazyLoadState } from '../hooks/lazyLoad';\nimport { not, val } from '../common/hof';\nimport { StateParams } from '../params/stateParams';\n\nexport type OnInvalidCallback =\n (toState?: TargetState, fromState?: TargetState, injector?: UIInjector) => HookResult;\n\n/**\n * Provides state related service functions\n *\n * This class provides services related to ui-router states.\n * An instance of this class is located on the global [[UIRouter]] object.\n */\nexport class StateService {\n /** @internalapi */\n invalidCallbacks: OnInvalidCallback[] = [];\n\n /**\n * The [[Transition]] currently in progress (or null)\n *\n * This is a passthrough through to [[UIRouterGlobals.transition]]\n */\n get transition() { return this.router.globals.transition; }\n /**\n * The latest successful state parameters\n *\n * This is a passthrough through to [[UIRouterGlobals.params]]\n */\n get params(): StateParams { return this.router.globals.params; }\n /**\n * The current [[StateDeclaration]]\n *\n * This is a passthrough through to [[UIRouterGlobals.current]]\n */\n get current() { return this.router.globals.current; }\n /**\n * The current [[StateObject]]\n *\n * This is a passthrough through to [[UIRouterGlobals.$current]]\n */\n get $current() { return this.router.globals.$current; }\n\n /** @internalapi */\n constructor(private router: UIRouter) {\n let getters = ['current', '$current', 'params', 'transition'];\n let boundFns = Object.keys(StateService.prototype).filter(not(inArray(getters)));\n createProxyFunctions(val(StateService.prototype), this, val(this), boundFns);\n }\n\n /** @internalapi */\n dispose() {\n this.defaultErrorHandler(noop);\n this.invalidCallbacks = [];\n }\n\n /**\n * Handler for when [[transitionTo]] is called with an invalid state.\n *\n * Invokes the [[onInvalid]] callbacks, in natural order.\n * Each callback's return value is checked in sequence until one of them returns an instance of TargetState.\n * The results of the callbacks are wrapped in $q.when(), so the callbacks may return promises.\n *\n * If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned.\n *\n * @internalapi\n */\n private _handleInvalidTargetState(fromPath: PathNode[], toState: TargetState) {\n let fromState = PathUtils.makeTargetState(this.router.stateRegistry, fromPath);\n let globals = this.router.globals;\n const latestThing = () => globals.transitionHistory.peekTail();\n let latest = latestThing();\n let callbackQueue = new Queue(this.invalidCallbacks.slice());\n let injector = new ResolveContext(fromPath).injector();\n\n const checkForRedirect = (result: HookResult) => {\n if (!(result instanceof TargetState)) {\n return;\n }\n\n let target = result;\n // Recreate the TargetState, in case the state is now defined.\n target = this.target(target.identifier(), target.params(), target.options());\n\n if (!target.valid()) {\n return Rejection.invalid(target.error()).toPromise();\n }\n\n if (latestThing() !== latest) {\n return Rejection.superseded().toPromise();\n }\n\n return this.transitionTo(target.identifier(), target.params(), target.options());\n };\n\n function invokeNextCallback() {\n let nextCallback = callbackQueue.dequeue();\n if (nextCallback === undefined) return Rejection.invalid(toState.error()).toPromise();\n\n let callbackResult = services.$q.when(nextCallback(toState, fromState, injector));\n return callbackResult.then(checkForRedirect).then(result => result || invokeNextCallback());\n }\n\n return invokeNextCallback();\n }\n\n /**\n * Registers an Invalid State handler\n *\n * Registers a [[OnInvalidCallback]] function to be invoked when [[StateService.transitionTo]]\n * has been called with an invalid state reference parameter\n *\n * Example:\n * ```js\n * stateService.onInvalid(function(to, from, injector) {\n * if (to.name() === 'foo') {\n * let lazyLoader = injector.get('LazyLoadService');\n * return lazyLoader.load('foo')\n * .then(() => stateService.target('foo'));\n * }\n * });\n * ```\n *\n * @param {function} callback invoked when the toState is invalid\n * This function receives the (invalid) toState, the fromState, and an injector.\n * The function may optionally return a [[TargetState]] or a Promise for a TargetState.\n * If one is returned, it is treated as a redirect.\n *\n * @returns a function which deregisters the callback\n */\n onInvalid(callback: OnInvalidCallback): Function {\n this.invalidCallbacks.push(callback);\n return function deregisterListener() {\n removeFrom(this.invalidCallbacks)(callback);\n }.bind(this);\n }\n\n\n /**\n * Reloads the current state\n *\n * A method that force reloads the current state, or a partial state hierarchy.\n * All resolves are re-resolved, and components reinstantiated.\n *\n * #### Example:\n * ```js\n * let app angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.reload = function(){\n * $state.reload();\n * }\n * });\n * ```\n *\n * Note: `reload()` is just an alias for:\n *\n * ```js\n * $state.transitionTo($state.current, $state.params, {\n * reload: true, inherit: false\n * });\n * ```\n *\n * @param reloadState A state name or a state object.\n * If present, this state and all its children will be reloaded, but ancestors will not reload.\n *\n * #### Example:\n * ```js\n * //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item'\n * //and current state is 'contacts.detail.item'\n * let app angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.reload = function(){\n * //will reload 'contact.detail' and nested 'contact.detail.item' states\n * $state.reload('contact.detail');\n * }\n * });\n * ```\n *\n * @returns A promise representing the state of the new transition. See [[StateService.go]]\n */\n reload(reloadState?: StateOrName): Promise {\n return this.transitionTo(this.current, this.params, {\n reload: isDefined(reloadState) ? reloadState : true,\n inherit: false,\n notify: false,\n });\n };\n\n /**\n * Transition to a different state and/or parameters\n *\n * Convenience method for transitioning to a new state.\n *\n * `$state.go` calls `$state.transitionTo` internally but automatically sets options to\n * `{ location: true, inherit: true, relative: router.globals.$current, notify: true }`.\n * This allows you to use either an absolute or relative `to` argument (because of `relative: router.globals.$current`).\n * It also allows you to specify * only the parameters you'd like to update, while letting unspecified parameters\n * inherit from the current parameter values (because of `inherit: true`).\n *\n * #### Example:\n * ```js\n * let app = angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.changeState = function () {\n * $state.go('contact.detail');\n * };\n * });\n * ```\n *\n * @param to Absolute state name, state object, or relative state path (relative to current state).\n *\n * Some examples:\n *\n * - `$state.go('contact.detail')` - will go to the `contact.detail` state\n * - `$state.go('^')` - will go to the parent state\n * - `$state.go('^.sibling')` - if current state is `home.child`, will go to the `home.sibling` state\n * - `$state.go('.child.grandchild')` - if current state is home, will go to the `home.child.grandchild` state\n *\n * @param params A map of the parameters that will be sent to the state, will populate $stateParams.\n *\n * Any parameters that are not specified will be inherited from current parameter values (because of `inherit: true`).\n * This allows, for example, going to a sibling state that shares parameters defined by a parent state.\n *\n * @param options Transition options\n *\n * @returns {promise} A promise representing the state of the new transition.\n */\n go(to: StateOrName, params?: RawParams, options?: TransitionOptions): TransitionPromise {\n let defautGoOpts = { relative: this.$current, inherit: true };\n let transOpts = defaults(options, defautGoOpts, defaultTransOpts);\n return this.transitionTo(to, params, transOpts);\n };\n\n /**\n * Creates a [[TargetState]]\n *\n * This is a factory method for creating a TargetState\n *\n * This may be returned from a Transition Hook to redirect a transition, for example.\n */\n target(identifier: StateOrName, params?: RawParams, options: TransitionOptions = {}): TargetState {\n // If we're reloading, find the state object to reload from\n if (isObject(options.reload) && !(options.reload).name)\n throw new Error('Invalid reload state object');\n let reg = this.router.stateRegistry;\n options.reloadState = options.reload === true ? reg.root() : reg.matcher.find( options.reload, options.relative);\n\n if (options.reload && !options.reloadState)\n throw new Error(`No such reload state '${(isString(options.reload) ? options.reload : (options.reload).name)}'`);\n\n return new TargetState(this.router.stateRegistry, identifier, params, options);\n };\n\n private getCurrentPath(): PathNode[] {\n let globals = this.router.globals;\n let latestSuccess: Transition = globals.successfulTransitions.peekTail();\n const rootPath = () => [ new PathNode(this.router.stateRegistry.root()) ];\n return latestSuccess ? latestSuccess.treeChanges().to : rootPath();\n }\n\n /**\n * Low-level method for transitioning to a new state.\n *\n * The [[go]] method (which uses `transitionTo` internally) is recommended in most situations.\n *\n * #### Example:\n * ```js\n * let app = angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.changeState = function () {\n * $state.transitionTo('contact.detail');\n * };\n * });\n * ```\n *\n * @param to State name or state object.\n * @param toParams A map of the parameters that will be sent to the state,\n * will populate $stateParams.\n * @param options Transition options\n *\n * @returns A promise representing the state of the new transition. See [[go]]\n */\n transitionTo(to: StateOrName, toParams: RawParams = {}, options: TransitionOptions = {}): TransitionPromise {\n let router = this.router;\n let globals = router.globals;\n options = defaults(options, defaultTransOpts);\n const getCurrent = () =>\n globals.transition;\n options = extend(options, { current: getCurrent });\n\n let ref: TargetState = this.target(to, toParams, options);\n let currentPath = this.getCurrentPath();\n\n if (!ref.exists())\n return this._handleInvalidTargetState(currentPath, ref);\n\n if (!ref.valid())\n return silentRejection(ref.error());\n\n /**\n * Special handling for Ignored, Aborted, and Redirected transitions\n *\n * The semantics for the transition.run() promise and the StateService.transitionTo()\n * promise differ. For instance, the run() promise may be rejected because it was\n * IGNORED, but the transitionTo() promise is resolved because from the user perspective\n * no error occurred. Likewise, the transition.run() promise may be rejected because of\n * a Redirect, but the transitionTo() promise is chained to the new Transition's promise.\n */\n const rejectedTransitionHandler = (transition: Transition) => (error: any): Promise => {\n if (error instanceof Rejection) {\n const isLatest = router.globals.lastStartedTransitionId === transition.$id;\n\n if (error.type === RejectType.IGNORED) {\n isLatest && router.urlRouter.update();\n // Consider ignored `Transition.run()` as a successful `transitionTo`\n return services.$q.when(globals.current);\n }\n\n const detail: any = error.detail;\n if (error.type === RejectType.SUPERSEDED && error.redirected && detail instanceof TargetState) {\n // If `Transition.run()` was redirected, allow the `transitionTo()` promise to resolve successfully\n // by returning the promise for the new (redirect) `Transition.run()`.\n let redirect: Transition = transition.redirect(detail);\n return redirect.run().catch(rejectedTransitionHandler(redirect));\n }\n\n if (error.type === RejectType.ABORTED) {\n isLatest && router.urlRouter.update();\n return services.$q.reject(error);\n }\n }\n\n let errorHandler = this.defaultErrorHandler();\n errorHandler(error);\n\n return services.$q.reject(error);\n };\n\n let transition = this.router.transitionService.create(currentPath, ref);\n let transitionToPromise = transition.run().catch(rejectedTransitionHandler(transition));\n silenceUncaughtInPromise(transitionToPromise); // issue #2676\n\n // Return a promise for the transition, which also has the transition object on it.\n return extend(transitionToPromise, { transition });\n };\n\n /**\n * Checks if the current state *is* the provided state\n *\n * Similar to [[includes]] but only checks for the full state name.\n * If params is supplied then it will be tested for strict equality against the current\n * active params object, so all params must match with none missing and no extras.\n *\n * #### Example:\n * ```js\n * $state.$current.name = 'contacts.details.item';\n *\n * // absolute name\n * $state.is('contact.details.item'); // returns true\n * $state.is(contactDetailItemStateObject); // returns true\n * ```\n *\n * // relative name (. and ^), typically from a template\n * // E.g. from the 'contacts.details' template\n * ```html\n *
Item
\n * ```\n *\n * @param stateOrName The state name (absolute or relative) or state object you'd like to check.\n * @param params A param object, e.g. `{sectionId: section.id}`, that you'd like\n * to test against the current active state.\n * @param options An options object. The options are:\n * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will\n * test relative to `options.relative` state (or name).\n *\n * @returns Returns true if it is the state.\n */\n is(stateOrName: StateOrName, params?: RawParams, options?: { relative?: StateOrName }): boolean {\n options = defaults(options, { relative: this.$current });\n let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);\n if (!isDefined(state)) return undefined;\n if (this.$current !== state) return false;\n if (!params) return true;\n\n let schema: Param[] = state.parameters({ inherit: true, matchingKeys: params });\n return Param.equals(schema, Param.values(schema, params), this.params);\n };\n\n /**\n * Checks if the current state *includes* the provided state\n *\n * A method to determine if the current active state is equal to or is the child of the\n * state stateName. If any params are passed then they will be tested for a match as well.\n * Not all the parameters need to be passed, just the ones you'd like to test for equality.\n *\n * #### Example when `$state.$current.name === 'contacts.details.item'`\n * ```js\n * // Using partial names\n * $state.includes(\"contacts\"); // returns true\n * $state.includes(\"contacts.details\"); // returns true\n * $state.includes(\"contacts.details.item\"); // returns true\n * $state.includes(\"contacts.list\"); // returns false\n * $state.includes(\"about\"); // returns false\n * ```\n *\n * #### Glob Examples when `* $state.$current.name === 'contacts.details.item.url'`:\n * ```js\n * $state.includes(\"*.details.*.*\"); // returns true\n * $state.includes(\"*.details.**\"); // returns true\n * $state.includes(\"**.item.**\"); // returns true\n * $state.includes(\"*.details.item.url\"); // returns true\n * $state.includes(\"*.details.*.url\"); // returns true\n * $state.includes(\"*.details.*\"); // returns false\n * $state.includes(\"item.**\"); // returns false\n * ```\n *\n * @param stateOrName A partial name, relative name, glob pattern,\n * or state object to be searched for within the current state name.\n * @param params A param object, e.g. `{sectionId: section.id}`,\n * that you'd like to test against the current active state.\n * @param options An options object. The options are:\n * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will\n * test relative to `options.relative` state (or name).\n *\n * @returns {boolean} Returns true if it does include the state\n */\n includes(stateOrName: StateOrName, params?: RawParams, options?: TransitionOptions): boolean {\n options = defaults(options, { relative: this.$current });\n let glob = isString(stateOrName) && Glob.fromString( stateOrName);\n\n if (glob) {\n if (!glob.matches(this.$current.name)) return false;\n stateOrName = this.$current.name;\n }\n let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative), include = this.$current.includes;\n\n if (!isDefined(state)) return undefined;\n if (!isDefined(include[state.name])) return false;\n if (!params) return true;\n\n let schema: Param[] = state.parameters({ inherit: true, matchingKeys: params });\n return Param.equals(schema, Param.values(schema, params), this.params);\n };\n\n\n /**\n * Generates a URL for a state and parameters\n *\n * Returns the url for the given state populated with the given params.\n *\n * #### Example:\n * ```js\n * expect($state.href(\"about.person\", { person: \"bob\" })).toEqual(\"/about/bob\");\n * ```\n *\n * @param stateOrName The state name or state object you'd like to generate a url from.\n * @param params An object of parameter values to fill the state's required parameters.\n * @param options Options object. The options are:\n *\n * @returns {string} compiled state url\n */\n href(stateOrName: StateOrName, params: RawParams, options?: HrefOptions): string {\n let defaultHrefOpts = {\n lossy: true,\n inherit: true,\n absolute: false,\n relative: this.$current,\n };\n options = defaults(options, defaultHrefOpts);\n params = params || {};\n\n let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);\n\n if (!isDefined(state)) return null;\n if (options.inherit) params = this.params.$inherit(params, this.$current, state);\n\n let nav = (state && options.lossy) ? state.navigable : state;\n\n if (!nav || nav.url === undefined || nav.url === null) {\n return null;\n }\n return this.router.urlRouter.href(nav.url, params, {\n absolute: options.absolute,\n });\n };\n\n /** @hidden */\n private _defaultErrorHandler: ((_error: any) => void) = function $defaultErrorHandler($error$) {\n if ($error$ instanceof Error && $error$.stack) {\n console.error($error$);\n console.error($error$.stack);\n } else if ($error$ instanceof Rejection) {\n console.error($error$.toString());\n if ($error$.detail && $error$.detail.stack)\n console.error($error$.detail.stack);\n } else {\n console.error($error$);\n }\n };\n\n /**\n * Sets or gets the default [[transitionTo]] error handler.\n *\n * The error handler is called when a [[Transition]] is rejected or when any error occurred during the Transition.\n * This includes errors caused by resolves and transition hooks.\n *\n * Note:\n * This handler does not receive certain Transition rejections.\n * Redirected and Ignored Transitions are not considered to be errors by [[StateService.transitionTo]].\n *\n * The built-in default error handler logs the error to the console.\n *\n * You can provide your own custom handler.\n *\n * #### Example:\n * ```js\n * stateService.defaultErrorHandler(function() {\n * // Do not log transitionTo errors\n * });\n * ```\n *\n * @param handler a global error handler function\n * @returns the current global error handler\n */\n defaultErrorHandler(handler?: (error: any) => void): (error: any) => void {\n return this._defaultErrorHandler = handler || this._defaultErrorHandler;\n }\n\n /**\n * Gets a registered [[StateDeclaration]] object\n *\n * Returns the state declaration object for any specific state, or for all registered states.\n *\n * @param stateOrName (absolute or relative) If provided, will only get the declaration object for the requested state.\n * If not provided, returns an array of ALL states.\n * @param base When `stateOrName` is a relative state reference (such as `.bar.baz`), the state will be retrieved relative to this state.\n *\n * @returns a [[StateDeclaration]] object (or array of all registered [[StateDeclaration]] objects.)\n */\n get(stateOrName: StateOrName, base: StateOrName): StateDeclaration;\n get(stateOrName: StateOrName): StateDeclaration;\n get(): StateDeclaration[];\n get(stateOrName?: StateOrName, base?: StateOrName): any {\n let reg = this.router.stateRegistry;\n if (arguments.length === 0) return reg.get();\n return reg.get(stateOrName, base || this.$current);\n }\n\n /**\n * Lazy loads a state\n *\n * Explicitly runs a state's [[StateDeclaration.lazyLoad]] function.\n *\n * @param stateOrName the state that should be lazy loaded\n * @param transition the optional Transition context to use (if the lazyLoad function requires an injector, etc)\n * Note: If no transition is provided, a noop transition is created using the from the current state to the current state.\n * This noop transition is not actually run.\n *\n * @returns a promise to lazy load\n */\n lazyLoad(stateOrName: StateOrName, transition?: Transition): Promise {\n let state: StateDeclaration = this.get(stateOrName);\n if (!state || !state.lazyLoad) throw new Error(\"Can not lazy load \" + stateOrName);\n\n let currentPath = this.getCurrentPath();\n let target = PathUtils.makeTargetState(this.router.stateRegistry, currentPath);\n transition = transition || this.router.transitionService.create(currentPath, target);\n\n return lazyLoadState(transition, state);\n }\n}\n", - "/**\n * # Transition subsystem\n *\n * This module contains APIs related to a Transition.\n *\n * See:\n * - [[TransitionService]]\n * - [[Transition]]\n * - [[HookFn]], [[TransitionHookFn]], [[TransitionStateHookFn]], [[HookMatchCriteria]], [[HookResult]]\n *\n * @coreapi\n * @preferred\n * @module transition\n */ /** for typedoc */\nexport * from \"./interface\";\nexport * from \"./hookBuilder\";\nexport * from \"./hookRegistry\";\nexport * from \"./rejectFactory\";\nexport * from \"./transition\";\nexport * from \"./transitionHook\";\nexport * from \"./transitionEventType\";\nexport * from \"./transitionService\";\n\n", - "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { isArray, isObject, $QLike } from \"../common/index\";\n\n/**\n * An angular1-like promise api\n *\n * This object implements four methods similar to the\n * [angular 1 promise api](https://docs.angularjs.org/api/ng/service/$q)\n *\n * UI-Router evolved from an angular 1 library to a framework agnostic library.\n * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.\n *\n * This API provides native ES6 promise support wrapped as a $q-like API.\n * Internally, UI-Router uses this $q object to perform promise operations.\n * The `angular-ui-router` (ui-router for angular 1) uses the $q API provided by angular.\n *\n * $q-like promise api\n */\nexport const $q = {\n /** Normalizes a value as a promise */\n when: (val) => new Promise((resolve, reject) => resolve(val)),\n\n /** Normalizes a value as a promise rejection */\n reject: (val) => new Promise((resolve, reject) => { reject(val); }),\n\n /** @returns a deferred object, which has `resolve` and `reject` functions */\n defer: () => {\n let deferred: any = {};\n deferred.promise = new Promise((resolve, reject) => {\n deferred.resolve = resolve;\n deferred.reject = reject;\n });\n return deferred;\n },\n\n /** Like Promise.all(), but also supports object key/promise notation like $q */\n all: (promises: { [key: string]: Promise } | Promise[]) => {\n if (isArray(promises)) {\n return Promise.all(promises);\n }\n\n if (isObject(promises)) {\n // Convert promises map to promises array.\n // When each promise resolves, map it to a tuple { key: key, val: val }\n let chain = Object.keys(promises)\n .map(key => promises[key].then(val => ({key, val})));\n\n // Then wait for all promises to resolve, and convert them back to an object\n return $q.all(chain).then(values =>\n values.reduce((acc, tuple) => { acc[tuple.key] = tuple.val; return acc; }, {}));\n }\n }\n} as $QLike;", - "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport {\n extend, assertPredicate, isFunction, isArray, isInjectable, $InjectorLike, IInjectable\n} from \"../common/index\";\n\n// globally available injectables\nlet globals = {};\nlet STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg;\nlet ARGUMENT_NAMES = /([^\\s,]+)/g;\n\n/**\n * A basic angular1-like injector api\n *\n * This object implements four methods similar to the\n * [angular 1 dependency injector](https://docs.angularjs.org/api/auto/service/$injector)\n *\n * UI-Router evolved from an angular 1 library to a framework agnostic library.\n * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.\n *\n * This object provides a naive implementation of a globally scoped dependency injection system.\n * It supports the following DI approaches:\n *\n * ### Function parameter names\n *\n * A function's `.toString()` is called, and the parameter names are parsed.\n * This only works when the parameter names aren't \"mangled\" by a minifier such as UglifyJS.\n *\n * ```js\n * function injectedFunction(FooService, BarService) {\n * // FooService and BarService are injected\n * }\n * ```\n *\n * ### Function annotation\n *\n * A function may be annotated with an array of dependency names as the `$inject` property.\n *\n * ```js\n * injectedFunction.$inject = [ 'FooService', 'BarService' ];\n * function injectedFunction(fs, bs) {\n * // FooService and BarService are injected as fs and bs parameters\n * }\n * ```\n *\n * ### Array notation\n *\n * An array provides the names of the dependencies to inject (as strings).\n * The function is the last element of the array.\n *\n * ```js\n * [ 'FooService', 'BarService', function (fs, bs) {\n * // FooService and BarService are injected as fs and bs parameters\n * }]\n * ```\n *\n * @type {$InjectorLike}\n */\nexport const $injector = {\n /** Gets an object from DI based on a string token */\n get: name => globals[name],\n\n /** Returns true if an object named `name` exists in global DI */\n has: (name) => $injector.get(name) != null,\n\n /**\n * Injects a function\n *\n * @param fn the function to inject\n * @param context the function's `this` binding\n * @param locals An object with additional DI tokens and values, such as `{ someToken: { foo: 1 } }`\n */\n invoke: (fn: IInjectable, context?, locals?) => {\n let all = extend({}, globals, locals || {});\n let params = $injector.annotate(fn);\n let ensureExist = assertPredicate((key: string) => all.hasOwnProperty(key), key => `DI can't find injectable: '${key}'`);\n let args = params.filter(ensureExist).map(x => all[x]);\n if (isFunction(fn)) return fn.apply(context, args);\n else return (fn as any[]).slice(-1)[0].apply(context, args);\n },\n\n /**\n * Returns a function's dependencies\n *\n * Analyzes a function (or array) and returns an array of DI tokens that the function requires.\n * @return an array of `string`s\n */\n annotate: (fn: IInjectable): any[] => {\n if (!isInjectable(fn)) throw new Error(`Not an injectable function: ${fn}`);\n if (fn && (fn as any).$inject) return (fn as any).$inject;\n if (isArray(fn)) return fn.slice(0, -1);\n let fnStr = fn.toString().replace(STRIP_COMMENTS, '');\n let result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES);\n return result || [];\n }\n} as $InjectorLike;", - "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport {\n LocationConfig, LocationServices, identity, unnestR, isArray, splitEqual, splitHash, splitQuery\n} from \"../common\";\nimport { UIRouter } from \"../router\";\n\nexport const keyValsToObjectR = (accum, [key, val]) => {\n if (!accum.hasOwnProperty(key)) {\n accum[key] = val;\n } else if (isArray(accum[key])) {\n accum[key].push(val);\n } else {\n accum[key] = [accum[key], val]\n }\n return accum;\n};\n\nexport const getParams = (queryString: string): any =>\n queryString.split(\"&\").filter(identity).map(splitEqual).reduce(keyValsToObjectR, {});\n\nexport function parseUrl(url: string) {\n const orEmptyString = x => x || \"\";\n let [beforehash, hash] = splitHash(url).map(orEmptyString);\n let [path, search] = splitQuery(beforehash).map(orEmptyString);\n\n return { path, search, hash, url };\n}\n\nexport const buildUrl = (loc: LocationServices) => {\n let path = loc.path();\n let searchObject = loc.search();\n let hash = loc.hash();\n\n let search = Object.keys(searchObject).map(key => {\n let param = searchObject[key];\n let vals = isArray(param) ? param : [param];\n return vals.map(val => key + \"=\" + val);\n }).reduce(unnestR, []).join(\"&\");\n\n return path + (search ? \"?\" + search : \"\") + (hash ? \"#\" + hash : \"\");\n};\n\nexport function locationPluginFactory(\n name: string,\n isHtml5: boolean,\n serviceClass: { new(router?: UIRouter): LocationServices },\n configurationClass: { new(router?: UIRouter, isHtml5?: boolean): LocationConfig }\n) {\n return function(router: UIRouter) {\n let service = router.locationService = new serviceClass(router);\n let configuration = router.locationConfig = new configurationClass(router, isHtml5);\n\n function dispose(router: UIRouter) {\n router.dispose(service);\n router.dispose(configuration);\n }\n\n return { name, service, configuration, dispose };\n };\n}\n", - "/**\n * @internalapi\n * @module vanilla\n */ /** */\n\nimport { deregAll, isDefined, LocationServices, removeFrom, root } from '../common';\nimport { Disposable } from '../interface';\nimport { UIRouter } from '../router';\nimport { HistoryLike, LocationLike } from './interface';\nimport { buildUrl, getParams, parseUrl } from './utils';\n\n/** A base `LocationServices` */\nexport abstract class BaseLocationServices implements LocationServices, Disposable {\n constructor(router: UIRouter, public fireAfterUpdate: boolean) {\n this._location = root.location;\n this._history = root.history;\n }\n\n _listener = evt => this._listeners.forEach(cb => cb(evt));\n\n private _listeners: Function[] = [];\n _location: LocationLike;\n _history: HistoryLike;\n\n /**\n * This should return the current internal URL representation.\n *\n * The internal URL includes only the portion that UI-Router matches.\n * It does not include:\n * - protocol\n * - server\n * - port\n * - base href or hash\n */\n protected abstract _get(): string;\n\n /**\n * This should set the current URL.\n *\n * The `url` param should include only the portion that UI-Router matches on.\n * It should not include:\n * - protocol\n * - server\n * - port\n * - base href or hash\n *\n * However, after this function completes, the browser URL should reflect the entire (fully qualified)\n * HREF including those data.\n */\n protected abstract _set(state: any, title: string, url: string, replace: boolean);\n\n hash = () => parseUrl(this._get()).hash;\n path = () => parseUrl(this._get()).path;\n search = () => getParams(parseUrl(this._get()).search);\n\n url(url?: string, replace: boolean = true): string {\n if (isDefined(url) && url !== this._get()) {\n this._set(null, null, url, replace);\n\n if (this.fireAfterUpdate) {\n this._listeners.forEach(cb => cb({ url }));\n }\n }\n\n return buildUrl(this);\n }\n\n onChange(cb: EventListener) {\n this._listeners.push(cb);\n return () => removeFrom(this._listeners, cb);\n }\n\n dispose(router: UIRouter) {\n deregAll(this._listeners);\n }\n}\n", + "/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport {\n IHookRegistry, TransitionOptions, TransitionHookScope, TransitionHookPhase, TransitionCreateHookFn, HookMatchCriteria,\n HookRegOptions, PathTypes, PathType, RegisteredHooks, TransitionHookFn, TransitionStateHookFn,\n} from './interface';\nimport { Transition } from './transition';\nimport { makeEvent, RegisteredHook } from './hookRegistry';\nimport { TargetState } from '../state/targetState';\nimport { PathNode } from '../path/pathNode';\nimport { ViewService } from '../view/view';\nimport { UIRouter } from '../router';\nimport { registerAddCoreResolvables } from '../hooks/coreResolvables';\nimport { registerRedirectToHook } from '../hooks/redirectTo';\nimport { registerOnExitHook, registerOnRetainHook, registerOnEnterHook } from '../hooks/onEnterExitRetain';\nimport { registerEagerResolvePath, registerLazyResolveState, registerResolveRemaining } from '../hooks/resolve';\nimport { registerLoadEnteringViews, registerActivateViews } from '../hooks/views';\nimport { registerUpdateGlobalState } from '../hooks/updateGlobals';\nimport { registerUpdateUrl } from '../hooks/url';\nimport { registerLazyLoadHook } from '../hooks/lazyLoad';\nimport { TransitionEventType } from './transitionEventType';\nimport { TransitionHook, GetResultHandler, GetErrorHandler } from './transitionHook';\nimport { isDefined } from '../common/predicates';\nimport { removeFrom, values, createProxyFunctions } from '../common/common';\nimport { Disposable } from '../interface'; // has or is using\nimport { val } from '../common/hof';\nimport { registerIgnoredTransitionHook } from '../hooks/ignoredTransition';\nimport { registerInvalidTransitionHook } from '../hooks/invalidTransition';\n\n/**\n * The default [[Transition]] options.\n *\n * Include this object when applying custom defaults:\n * let reloadOpts = { reload: true, notify: true }\n * let options = defaults(theirOpts, customDefaults, defaultOptions);\n */\nexport let defaultTransOpts: TransitionOptions = {\n location : true,\n relative : null,\n inherit : false,\n notify : true,\n reload : false,\n custom : {},\n current : () => null,\n source : 'unknown',\n};\n\n\n/**\n * Plugin API for Transition Service\n * @internalapi\n */\nexport interface TransitionServicePluginAPI {\n /**\n * Adds a Path to be used as a criterion against a TreeChanges path\n *\n * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.\n * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`\n * Each state in the exiting path is checked against the criteria and returned as part of the match.\n *\n * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.\n * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`\n * Only the tail of the `to` path is checked against the criteria and returned as part of the match.\n */\n _definePathType(name: string, hookScope: TransitionHookScope);\n\n /**\n * Gets a Path definition used as a criterion against a TreeChanges path\n */\n _getPathTypes(): PathTypes;\n\n /**\n * Defines a transition hook type and returns a transition hook registration\n * function (which can then be used to register hooks of this type).\n */\n _defineEvent(name: string,\n hookPhase: TransitionHookPhase,\n hookOrder: number,\n criteriaMatchPath: PathType,\n reverseSort?: boolean,\n getResultHandler?: GetResultHandler,\n getErrorHandler?: GetErrorHandler,\n rejectIfSuperseded?: boolean);\n\n /**\n * Returns the known event types, such as `onBefore`\n * If a phase argument is provided, returns only events for the given phase.\n */\n _getEvents(phase?: TransitionHookPhase): TransitionEventType[];\n\n /** Returns the hooks registered for the given hook name */\n getHooks(hookName: string): RegisteredHook[];\n}\n\n/**\n * This class provides services related to Transitions.\n *\n * - Most importantly, it allows global Transition Hooks to be registered.\n * - It allows the default transition error handler to be set.\n * - It also has a factory function for creating new [[Transition]] objects, (used internally by the [[StateService]]).\n *\n * At bootstrap, [[UIRouter]] creates a single instance (singleton) of this class.\n */\nexport class TransitionService implements IHookRegistry, Disposable {\n /** @hidden */\n _transitionCount = 0;\n\n /** @hidden */\n public $view: ViewService;\n\n /** @hidden The transition hook types, such as `onEnter`, `onStart`, etc */\n private _eventTypes: TransitionEventType[] = [];\n /** @hidden The registered transition hooks */\n _registeredHooks = { } as RegisteredHooks;\n /** @hidden The paths on a criteria object */\n private _criteriaPaths = { } as PathTypes;\n /** @hidden */\n private _router: UIRouter;\n\n /** @internalapi */\n _pluginapi: TransitionServicePluginAPI;\n\n /**\n * This object has hook de-registration functions for the built-in hooks.\n * This can be used by third parties libraries that wish to customize the behaviors\n *\n * @hidden\n */\n _deregisterHookFns: {\n addCoreResolves: Function;\n ignored: Function;\n invalid: Function;\n redirectTo: Function;\n onExit: Function;\n onRetain: Function;\n onEnter: Function;\n eagerResolve: Function;\n lazyResolve: Function;\n resolveAll: Function;\n loadViews: Function;\n activateViews: Function;\n updateGlobals: Function;\n updateUrl: Function;\n lazyLoad: Function;\n };\n\n /** @hidden */\n constructor(_router: UIRouter) {\n this._router = _router;\n this.$view = _router.viewService;\n this._deregisterHookFns = {};\n this._pluginapi = createProxyFunctions(val(this), {}, val(this), [\n '_definePathType',\n '_defineEvent',\n '_getPathTypes',\n '_getEvents',\n 'getHooks',\n ]);\n\n this._defineCorePaths();\n this._defineCoreEvents();\n this._registerCoreTransitionHooks();\n }\n\n /**\n * Registers a [[TransitionHookFn]], called *while a transition is being constructed*.\n *\n * Registers a transition lifecycle hook, which is invoked during transition construction.\n *\n * This low level hook should only be used by plugins.\n * This can be a useful time for plugins to add resolves or mutate the transition as needed.\n * The Sticky States plugin uses this hook to modify the treechanges.\n *\n * ### Lifecycle\n *\n * `onCreate` hooks are invoked *while a transition is being constructed*.\n *\n * ### Return value\n *\n * The hook's return value is ignored\n *\n * @internalapi\n * @param criteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be invoked.\n * @param options the registration options\n * @returns a function which deregisters the hook.\n */\n onCreate(criteria: HookMatchCriteria, callback: TransitionCreateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n\n /**\n * dispose\n * @internalapi\n */\n dispose(router: UIRouter) {\n values(this._registeredHooks).forEach((hooksArray: RegisteredHook[]) => hooksArray.forEach(hook => {\n hook._deregistered = true;\n removeFrom(hooksArray, hook);\n }));\n }\n\n /**\n * Creates a new [[Transition]] object\n *\n * This is a factory function for creating new Transition objects.\n * It is used internally by the [[StateService]] and should generally not be called by application code.\n *\n * @param fromPath the path to the current state (the from state)\n * @param targetState the target state (destination)\n * @returns a Transition\n */\n create(fromPath: PathNode[], targetState: TargetState): Transition {\n return new Transition(fromPath, targetState, this._router);\n }\n\n /** @hidden */\n private _defineCoreEvents() {\n const Phase = TransitionHookPhase;\n const TH = TransitionHook;\n const paths = this._criteriaPaths;\n const NORMAL_SORT = false, REVERSE_SORT = true;\n const SYNCHRONOUS = true;\n\n this._defineEvent('onCreate', Phase.CREATE, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.THROW_ERROR, SYNCHRONOUS);\n\n this._defineEvent('onBefore', Phase.BEFORE, 0, paths.to);\n\n this._defineEvent('onStart', Phase.RUN, 0, paths.to);\n this._defineEvent('onExit', Phase.RUN, 100, paths.exiting, REVERSE_SORT);\n this._defineEvent('onRetain', Phase.RUN, 200, paths.retained);\n this._defineEvent('onEnter', Phase.RUN, 300, paths.entering);\n this._defineEvent('onFinish', Phase.RUN, 400, paths.to);\n\n this._defineEvent('onSuccess', Phase.SUCCESS, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS);\n this._defineEvent('onError', Phase.ERROR, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS);\n }\n\n /** @hidden */\n private _defineCorePaths() {\n const { STATE, TRANSITION } = TransitionHookScope;\n\n this._definePathType('to', TRANSITION);\n this._definePathType('from', TRANSITION);\n this._definePathType('exiting', STATE);\n this._definePathType('retained', STATE);\n this._definePathType('entering', STATE);\n }\n\n /** @hidden */\n _defineEvent(name: string,\n hookPhase: TransitionHookPhase,\n hookOrder: number,\n criteriaMatchPath: PathType,\n reverseSort = false,\n getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,\n getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,\n synchronous = false) {\n const eventType = new TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous);\n\n this._eventTypes.push(eventType);\n makeEvent(this, this, eventType);\n }\n\n /** @hidden */ // tslint:disable-next-line\n private _getEvents(phase?: TransitionHookPhase): TransitionEventType[] {\n const transitionHookTypes = isDefined(phase) ?\n this._eventTypes.filter(type => type.hookPhase === phase) :\n this._eventTypes.slice();\n\n return transitionHookTypes.sort((l, r) => {\n const cmpByPhase = l.hookPhase - r.hookPhase;\n return cmpByPhase === 0 ? l.hookOrder - r.hookOrder : cmpByPhase;\n });\n }\n\n /**\n * Adds a Path to be used as a criterion against a TreeChanges path\n *\n * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.\n * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`\n * Each state in the exiting path is checked against the criteria and returned as part of the match.\n *\n * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.\n * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`\n * Only the tail of the `to` path is checked against the criteria and returned as part of the match.\n *\n * @hidden\n */\n private _definePathType(name: string, hookScope: TransitionHookScope) {\n this._criteriaPaths[name] = { name, scope: hookScope };\n }\n\n /** * @hidden */ // tslint:disable-next-line\n private _getPathTypes(): PathTypes {\n return this._criteriaPaths;\n }\n\n /** @hidden */\n public getHooks(hookName: string): RegisteredHook[] {\n return this._registeredHooks[hookName];\n }\n\n /** @hidden */\n private _registerCoreTransitionHooks() {\n const fns = this._deregisterHookFns;\n\n fns.addCoreResolves = registerAddCoreResolvables(this);\n fns.ignored = registerIgnoredTransitionHook(this);\n fns.invalid = registerInvalidTransitionHook(this);\n\n // Wire up redirectTo hook\n fns.redirectTo = registerRedirectToHook(this);\n\n // Wire up onExit/Retain/Enter state hooks\n fns.onExit = registerOnExitHook(this);\n fns.onRetain = registerOnRetainHook(this);\n fns.onEnter = registerOnEnterHook(this);\n\n // Wire up Resolve hooks\n fns.eagerResolve = registerEagerResolvePath(this);\n fns.lazyResolve = registerLazyResolveState(this);\n fns.resolveAll = registerResolveRemaining(this);\n\n // Wire up the View management hooks\n fns.loadViews = registerLoadEnteringViews(this);\n fns.activateViews = registerActivateViews(this);\n\n // Updates global state after a transition\n fns.updateGlobals = registerUpdateGlobalState(this);\n\n // After globals.current is updated at priority: 10000\n fns.updateUrl = registerUpdateUrl(this);\n\n // Lazy load state trees\n fns.lazyLoad = registerLazyLoadHook(this);\n }\n}\n", + "/**\n * @coreapi\n * @module state\n */\n/** */\nimport { createProxyFunctions, defaults, extend, inArray, noop, removeFrom, silenceUncaughtInPromise, silentRejection } from '../common/common';\nimport { isDefined, isObject, isString } from '../common/predicates';\nimport { Queue } from '../common/queue';\nimport { services } from '../common/coreservices';\n\nimport { PathUtils } from '../path/pathUtils';\nimport { PathNode } from '../path/pathNode';\n\nimport { HookResult, TransitionOptions } from '../transition/interface';\nimport { defaultTransOpts } from '../transition/transitionService';\nimport { Rejection, RejectType } from '../transition/rejectFactory';\nimport { Transition } from '../transition/transition';\n\nimport { HrefOptions, LazyLoadResult, StateDeclaration, StateOrName, TransitionPromise } from './interface';\nimport { StateObject } from './stateObject';\nimport { TargetState } from './targetState';\n\nimport { RawParams } from '../params/interface';\nimport { Param } from '../params/param';\nimport { Glob } from '../common/glob';\nimport { UIRouter } from '../router';\nimport { UIInjector } from '../interface';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { lazyLoadState } from '../hooks/lazyLoad';\nimport { not, val } from '../common/hof';\nimport { StateParams } from '../params/stateParams';\n\nexport type OnInvalidCallback =\n (toState?: TargetState, fromState?: TargetState, injector?: UIInjector) => HookResult;\n\n/**\n * Provides state related service functions\n *\n * This class provides services related to ui-router states.\n * An instance of this class is located on the global [[UIRouter]] object.\n */\nexport class StateService {\n /** @internalapi */\n invalidCallbacks: OnInvalidCallback[] = [];\n\n /**\n * The [[Transition]] currently in progress (or null)\n *\n * This is a passthrough through to [[UIRouterGlobals.transition]]\n */\n get transition() { return this.router.globals.transition; }\n /**\n * The latest successful state parameters\n *\n * This is a passthrough through to [[UIRouterGlobals.params]]\n */\n get params(): StateParams { return this.router.globals.params; }\n /**\n * The current [[StateDeclaration]]\n *\n * This is a passthrough through to [[UIRouterGlobals.current]]\n */\n get current() { return this.router.globals.current; }\n /**\n * The current [[StateObject]]\n *\n * This is a passthrough through to [[UIRouterGlobals.$current]]\n */\n get $current() { return this.router.globals.$current; }\n\n /** @internalapi */\n constructor(private router: UIRouter) {\n const getters = ['current', '$current', 'params', 'transition'];\n const boundFns = Object.keys(StateService.prototype).filter(not(inArray(getters)));\n createProxyFunctions(val(StateService.prototype), this, val(this), boundFns);\n }\n\n /** @internalapi */\n dispose() {\n this.defaultErrorHandler(noop);\n this.invalidCallbacks = [];\n }\n\n /**\n * Handler for when [[transitionTo]] is called with an invalid state.\n *\n * Invokes the [[onInvalid]] callbacks, in natural order.\n * Each callback's return value is checked in sequence until one of them returns an instance of TargetState.\n * The results of the callbacks are wrapped in $q.when(), so the callbacks may return promises.\n *\n * If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned.\n *\n * @internalapi\n */\n private _handleInvalidTargetState(fromPath: PathNode[], toState: TargetState) {\n const fromState = PathUtils.makeTargetState(this.router.stateRegistry, fromPath);\n const globals = this.router.globals;\n const latestThing = () => globals.transitionHistory.peekTail();\n const latest = latestThing();\n const callbackQueue = new Queue(this.invalidCallbacks.slice());\n const injector = new ResolveContext(fromPath).injector();\n\n const checkForRedirect = (result: HookResult) => {\n if (!(result instanceof TargetState)) {\n return;\n }\n\n let target = result;\n // Recreate the TargetState, in case the state is now defined.\n target = this.target(target.identifier(), target.params(), target.options());\n\n if (!target.valid()) {\n return Rejection.invalid(target.error()).toPromise();\n }\n\n if (latestThing() !== latest) {\n return Rejection.superseded().toPromise();\n }\n\n return this.transitionTo(target.identifier(), target.params(), target.options());\n };\n\n function invokeNextCallback() {\n const nextCallback = callbackQueue.dequeue();\n if (nextCallback === undefined) return Rejection.invalid(toState.error()).toPromise();\n\n const callbackResult = services.$q.when(nextCallback(toState, fromState, injector));\n return callbackResult.then(checkForRedirect).then(result => result || invokeNextCallback());\n }\n\n return invokeNextCallback();\n }\n\n /**\n * Registers an Invalid State handler\n *\n * Registers a [[OnInvalidCallback]] function to be invoked when [[StateService.transitionTo]]\n * has been called with an invalid state reference parameter\n *\n * Example:\n * ```js\n * stateService.onInvalid(function(to, from, injector) {\n * if (to.name() === 'foo') {\n * let lazyLoader = injector.get('LazyLoadService');\n * return lazyLoader.load('foo')\n * .then(() => stateService.target('foo'));\n * }\n * });\n * ```\n *\n * @param {function} callback invoked when the toState is invalid\n * This function receives the (invalid) toState, the fromState, and an injector.\n * The function may optionally return a [[TargetState]] or a Promise for a TargetState.\n * If one is returned, it is treated as a redirect.\n *\n * @returns a function which deregisters the callback\n */\n onInvalid(callback: OnInvalidCallback): Function {\n this.invalidCallbacks.push(callback);\n return function deregisterListener() {\n removeFrom(this.invalidCallbacks)(callback);\n }.bind(this);\n }\n\n\n /**\n * Reloads the current state\n *\n * A method that force reloads the current state, or a partial state hierarchy.\n * All resolves are re-resolved, and components reinstantiated.\n *\n * #### Example:\n * ```js\n * let app angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.reload = function(){\n * $state.reload();\n * }\n * });\n * ```\n *\n * Note: `reload()` is just an alias for:\n *\n * ```js\n * $state.transitionTo($state.current, $state.params, {\n * reload: true, inherit: false\n * });\n * ```\n *\n * @param reloadState A state name or a state object.\n * If present, this state and all its children will be reloaded, but ancestors will not reload.\n *\n * #### Example:\n * ```js\n * //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item'\n * //and current state is 'contacts.detail.item'\n * let app angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.reload = function(){\n * //will reload 'contact.detail' and nested 'contact.detail.item' states\n * $state.reload('contact.detail');\n * }\n * });\n * ```\n *\n * @returns A promise representing the state of the new transition. See [[StateService.go]]\n */\n reload(reloadState?: StateOrName): Promise {\n return this.transitionTo(this.current, this.params, {\n reload: isDefined(reloadState) ? reloadState : true,\n inherit: false,\n notify: false,\n });\n }\n\n /**\n * Transition to a different state and/or parameters\n *\n * Convenience method for transitioning to a new state.\n *\n * `$state.go` calls `$state.transitionTo` internally but automatically sets options to\n * `{ location: true, inherit: true, relative: router.globals.$current, notify: true }`.\n * This allows you to use either an absolute or relative `to` argument (because of `relative: router.globals.$current`).\n * It also allows you to specify * only the parameters you'd like to update, while letting unspecified parameters\n * inherit from the current parameter values (because of `inherit: true`).\n *\n * #### Example:\n * ```js\n * let app = angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.changeState = function () {\n * $state.go('contact.detail');\n * };\n * });\n * ```\n *\n * @param to Absolute state name, state object, or relative state path (relative to current state).\n *\n * Some examples:\n *\n * - `$state.go('contact.detail')` - will go to the `contact.detail` state\n * - `$state.go('^')` - will go to the parent state\n * - `$state.go('^.sibling')` - if current state is `home.child`, will go to the `home.sibling` state\n * - `$state.go('.child.grandchild')` - if current state is home, will go to the `home.child.grandchild` state\n *\n * @param params A map of the parameters that will be sent to the state, will populate $stateParams.\n *\n * Any parameters that are not specified will be inherited from current parameter values (because of `inherit: true`).\n * This allows, for example, going to a sibling state that shares parameters defined by a parent state.\n *\n * @param options Transition options\n *\n * @returns {promise} A promise representing the state of the new transition.\n */\n go(to: StateOrName, params?: RawParams, options?: TransitionOptions): TransitionPromise {\n const defautGoOpts = { relative: this.$current, inherit: true };\n const transOpts = defaults(options, defautGoOpts, defaultTransOpts);\n return this.transitionTo(to, params, transOpts);\n }\n\n /**\n * Creates a [[TargetState]]\n *\n * This is a factory method for creating a TargetState\n *\n * This may be returned from a Transition Hook to redirect a transition, for example.\n */\n target(identifier: StateOrName, params?: RawParams, options: TransitionOptions = {}): TargetState {\n // If we're reloading, find the state object to reload from\n if (isObject(options.reload) && !(options.reload).name)\n throw new Error('Invalid reload state object');\n const reg = this.router.stateRegistry;\n options.reloadState = options.reload === true ? reg.root() : reg.matcher.find( options.reload, options.relative);\n\n if (options.reload && !options.reloadState)\n throw new Error(`No such reload state '${(isString(options.reload) ? options.reload : (options.reload).name)}'`);\n\n return new TargetState(this.router.stateRegistry, identifier, params, options);\n }\n\n private getCurrentPath(): PathNode[] {\n const globals = this.router.globals;\n const latestSuccess: Transition = globals.successfulTransitions.peekTail();\n const rootPath = () => [ new PathNode(this.router.stateRegistry.root()) ];\n return latestSuccess ? latestSuccess.treeChanges().to : rootPath();\n }\n\n /**\n * Low-level method for transitioning to a new state.\n *\n * The [[go]] method (which uses `transitionTo` internally) is recommended in most situations.\n *\n * #### Example:\n * ```js\n * let app = angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.changeState = function () {\n * $state.transitionTo('contact.detail');\n * };\n * });\n * ```\n *\n * @param to State name or state object.\n * @param toParams A map of the parameters that will be sent to the state,\n * will populate $stateParams.\n * @param options Transition options\n *\n * @returns A promise representing the state of the new transition. See [[go]]\n */\n transitionTo(to: StateOrName, toParams: RawParams = {}, options: TransitionOptions = {}): TransitionPromise {\n const router = this.router;\n const globals = router.globals;\n options = defaults(options, defaultTransOpts);\n const getCurrent = () =>\n globals.transition;\n options = extend(options, { current: getCurrent });\n\n const ref: TargetState = this.target(to, toParams, options);\n const currentPath = this.getCurrentPath();\n\n if (!ref.exists())\n return this._handleInvalidTargetState(currentPath, ref);\n\n if (!ref.valid())\n return silentRejection(ref.error());\n\n /**\n * Special handling for Ignored, Aborted, and Redirected transitions\n *\n * The semantics for the transition.run() promise and the StateService.transitionTo()\n * promise differ. For instance, the run() promise may be rejected because it was\n * IGNORED, but the transitionTo() promise is resolved because from the user perspective\n * no error occurred. Likewise, the transition.run() promise may be rejected because of\n * a Redirect, but the transitionTo() promise is chained to the new Transition's promise.\n */\n const rejectedTransitionHandler = (trans: Transition) => (error: any): Promise => {\n if (error instanceof Rejection) {\n const isLatest = router.globals.lastStartedTransitionId === trans.$id;\n\n if (error.type === RejectType.IGNORED) {\n isLatest && router.urlRouter.update();\n // Consider ignored `Transition.run()` as a successful `transitionTo`\n return services.$q.when(globals.current);\n }\n\n const detail: any = error.detail;\n if (error.type === RejectType.SUPERSEDED && error.redirected && detail instanceof TargetState) {\n // If `Transition.run()` was redirected, allow the `transitionTo()` promise to resolve successfully\n // by returning the promise for the new (redirect) `Transition.run()`.\n const redirect: Transition = trans.redirect(detail);\n return redirect.run().catch(rejectedTransitionHandler(redirect));\n }\n\n if (error.type === RejectType.ABORTED) {\n isLatest && router.urlRouter.update();\n return services.$q.reject(error);\n }\n }\n\n const errorHandler = this.defaultErrorHandler();\n errorHandler(error);\n\n return services.$q.reject(error);\n };\n\n const transition = this.router.transitionService.create(currentPath, ref);\n const transitionToPromise = transition.run().catch(rejectedTransitionHandler(transition));\n silenceUncaughtInPromise(transitionToPromise); // issue #2676\n\n // Return a promise for the transition, which also has the transition object on it.\n return extend(transitionToPromise, { transition });\n }\n\n /**\n * Checks if the current state *is* the provided state\n *\n * Similar to [[includes]] but only checks for the full state name.\n * If params is supplied then it will be tested for strict equality against the current\n * active params object, so all params must match with none missing and no extras.\n *\n * #### Example:\n * ```js\n * $state.$current.name = 'contacts.details.item';\n *\n * // absolute name\n * $state.is('contact.details.item'); // returns true\n * $state.is(contactDetailItemStateObject); // returns true\n * ```\n *\n * // relative name (. and ^), typically from a template\n * // E.g. from the 'contacts.details' template\n * ```html\n *
Item
\n * ```\n *\n * @param stateOrName The state name (absolute or relative) or state object you'd like to check.\n * @param params A param object, e.g. `{sectionId: section.id}`, that you'd like\n * to test against the current active state.\n * @param options An options object. The options are:\n * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will\n * test relative to `options.relative` state (or name).\n *\n * @returns Returns true if it is the state.\n */\n is(stateOrName: StateOrName, params?: RawParams, options?: { relative?: StateOrName }): boolean {\n options = defaults(options, { relative: this.$current });\n const state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);\n if (!isDefined(state)) return undefined;\n if (this.$current !== state) return false;\n if (!params) return true;\n\n const schema: Param[] = state.parameters({ inherit: true, matchingKeys: params });\n return Param.equals(schema, Param.values(schema, params), this.params);\n }\n\n /**\n * Checks if the current state *includes* the provided state\n *\n * A method to determine if the current active state is equal to or is the child of the\n * state stateName. If any params are passed then they will be tested for a match as well.\n * Not all the parameters need to be passed, just the ones you'd like to test for equality.\n *\n * #### Example when `$state.$current.name === 'contacts.details.item'`\n * ```js\n * // Using partial names\n * $state.includes(\"contacts\"); // returns true\n * $state.includes(\"contacts.details\"); // returns true\n * $state.includes(\"contacts.details.item\"); // returns true\n * $state.includes(\"contacts.list\"); // returns false\n * $state.includes(\"about\"); // returns false\n * ```\n *\n * #### Glob Examples when `* $state.$current.name === 'contacts.details.item.url'`:\n * ```js\n * $state.includes(\"*.details.*.*\"); // returns true\n * $state.includes(\"*.details.**\"); // returns true\n * $state.includes(\"**.item.**\"); // returns true\n * $state.includes(\"*.details.item.url\"); // returns true\n * $state.includes(\"*.details.*.url\"); // returns true\n * $state.includes(\"*.details.*\"); // returns false\n * $state.includes(\"item.**\"); // returns false\n * ```\n *\n * @param stateOrName A partial name, relative name, glob pattern,\n * or state object to be searched for within the current state name.\n * @param params A param object, e.g. `{sectionId: section.id}`,\n * that you'd like to test against the current active state.\n * @param options An options object. The options are:\n * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will\n * test relative to `options.relative` state (or name).\n *\n * @returns {boolean} Returns true if it does include the state\n */\n includes(stateOrName: StateOrName, params?: RawParams, options?: TransitionOptions): boolean {\n options = defaults(options, { relative: this.$current });\n const glob = isString(stateOrName) && Glob.fromString( stateOrName);\n\n if (glob) {\n if (!glob.matches(this.$current.name)) return false;\n stateOrName = this.$current.name;\n }\n const state = this.router.stateRegistry.matcher.find(stateOrName, options.relative), include = this.$current.includes;\n\n if (!isDefined(state)) return undefined;\n if (!isDefined(include[state.name])) return false;\n if (!params) return true;\n\n const schema: Param[] = state.parameters({ inherit: true, matchingKeys: params });\n return Param.equals(schema, Param.values(schema, params), this.params);\n }\n\n\n /**\n * Generates a URL for a state and parameters\n *\n * Returns the url for the given state populated with the given params.\n *\n * #### Example:\n * ```js\n * expect($state.href(\"about.person\", { person: \"bob\" })).toEqual(\"/about/bob\");\n * ```\n *\n * @param stateOrName The state name or state object you'd like to generate a url from.\n * @param params An object of parameter values to fill the state's required parameters.\n * @param options Options object. The options are:\n *\n * @returns {string} compiled state url\n */\n href(stateOrName: StateOrName, params: RawParams, options?: HrefOptions): string {\n const defaultHrefOpts = {\n lossy: true,\n inherit: true,\n absolute: false,\n relative: this.$current,\n };\n options = defaults(options, defaultHrefOpts);\n params = params || {};\n\n const state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);\n\n if (!isDefined(state)) return null;\n if (options.inherit) params = this.params.$inherit(params, this.$current, state);\n\n const nav = (state && options.lossy) ? state.navigable : state;\n\n if (!nav || nav.url === undefined || nav.url === null) {\n return null;\n }\n return this.router.urlRouter.href(nav.url, params, {\n absolute: options.absolute,\n });\n }\n\n /** @hidden */\n private _defaultErrorHandler: ((_error: any) => void) = function $defaultErrorHandler($error$) {\n if ($error$ instanceof Error && $error$.stack) {\n console.error($error$);\n console.error($error$.stack);\n } else if ($error$ instanceof Rejection) {\n console.error($error$.toString());\n if ($error$.detail && $error$.detail.stack)\n console.error($error$.detail.stack);\n } else {\n console.error($error$);\n }\n };\n\n /**\n * Sets or gets the default [[transitionTo]] error handler.\n *\n * The error handler is called when a [[Transition]] is rejected or when any error occurred during the Transition.\n * This includes errors caused by resolves and transition hooks.\n *\n * Note:\n * This handler does not receive certain Transition rejections.\n * Redirected and Ignored Transitions are not considered to be errors by [[StateService.transitionTo]].\n *\n * The built-in default error handler logs the error to the console.\n *\n * You can provide your own custom handler.\n *\n * #### Example:\n * ```js\n * stateService.defaultErrorHandler(function() {\n * // Do not log transitionTo errors\n * });\n * ```\n *\n * @param handler a global error handler function\n * @returns the current global error handler\n */\n defaultErrorHandler(handler?: (error: any) => void): (error: any) => void {\n return this._defaultErrorHandler = handler || this._defaultErrorHandler;\n }\n\n /**\n * Gets a registered [[StateDeclaration]] object\n *\n * Returns the state declaration object for any specific state, or for all registered states.\n *\n * @param stateOrName (absolute or relative) If provided, will only get the declaration object for the requested state.\n * If not provided, returns an array of ALL states.\n * @param base When `stateOrName` is a relative state reference (such as `.bar.baz`), the state will be retrieved relative to this state.\n *\n * @returns a [[StateDeclaration]] object (or array of all registered [[StateDeclaration]] objects.)\n */\n get(stateOrName: StateOrName, base: StateOrName): StateDeclaration;\n get(stateOrName: StateOrName): StateDeclaration;\n get(): StateDeclaration[];\n get(stateOrName?: StateOrName, base?: StateOrName): any {\n const reg = this.router.stateRegistry;\n if (arguments.length === 0) return reg.get();\n return reg.get(stateOrName, base || this.$current);\n }\n\n /**\n * Lazy loads a state\n *\n * Explicitly runs a state's [[StateDeclaration.lazyLoad]] function.\n *\n * @param stateOrName the state that should be lazy loaded\n * @param transition the optional Transition context to use (if the lazyLoad function requires an injector, etc)\n * Note: If no transition is provided, a noop transition is created using the from the current state to the current state.\n * This noop transition is not actually run.\n *\n * @returns a promise to lazy load\n */\n lazyLoad(stateOrName: StateOrName, transition?: Transition): Promise {\n const state: StateDeclaration = this.get(stateOrName);\n if (!state || !state.lazyLoad) throw new Error('Can not lazy load ' + stateOrName);\n\n const currentPath = this.getCurrentPath();\n const target = PathUtils.makeTargetState(this.router.stateRegistry, currentPath);\n transition = transition || this.router.transitionService.create(currentPath, target);\n\n return lazyLoadState(transition, state);\n }\n}\n", + "/**\n * # Transition subsystem\n *\n * This module contains APIs related to a Transition.\n *\n * See:\n * - [[TransitionService]]\n * - [[Transition]]\n * - [[HookFn]], [[TransitionHookFn]], [[TransitionStateHookFn]], [[HookMatchCriteria]], [[HookResult]]\n *\n * @coreapi\n * @preferred\n * @module transition\n */ /** for typedoc */\nexport * from './interface';\nexport * from './hookBuilder';\nexport * from './hookRegistry';\nexport * from './rejectFactory';\nexport * from './transition';\nexport * from './transitionHook';\nexport * from './transitionEventType';\nexport * from './transitionService';\n\n", + "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { isArray, isObject, $QLike } from '../common/index';\n\n/**\n * An angular1-like promise api\n *\n * This object implements four methods similar to the\n * [angular 1 promise api](https://docs.angularjs.org/api/ng/service/$q)\n *\n * UI-Router evolved from an angular 1 library to a framework agnostic library.\n * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.\n *\n * This API provides native ES6 promise support wrapped as a $q-like API.\n * Internally, UI-Router uses this $q object to perform promise operations.\n * The `angular-ui-router` (ui-router for angular 1) uses the $q API provided by angular.\n *\n * $q-like promise api\n */\nexport const $q = {\n /** Normalizes a value as a promise */\n when: (val) => new Promise((resolve, reject) => resolve(val)),\n\n /** Normalizes a value as a promise rejection */\n reject: (val) => new Promise((resolve, reject) => { reject(val); }),\n\n /** @returns a deferred object, which has `resolve` and `reject` functions */\n defer: () => {\n const deferred: any = {};\n deferred.promise = new Promise((resolve, reject) => {\n deferred.resolve = resolve;\n deferred.reject = reject;\n });\n return deferred;\n },\n\n /** Like Promise.all(), but also supports object key/promise notation like $q */\n all: (promises: { [key: string]: Promise } | Promise[]) => {\n if (isArray(promises)) {\n return Promise.all(promises);\n }\n\n if (isObject(promises)) {\n // Convert promises map to promises array.\n // When each promise resolves, map it to a tuple { key: key, val: val }\n const chain = Object.keys(promises)\n .map(key => promises[key].then(val => ({ key, val })));\n\n // Then wait for all promises to resolve, and convert them back to an object\n return $q.all(chain).then(values =>\n values.reduce((acc, tuple) => { acc[tuple.key] = tuple.val; return acc; }, {}));\n }\n },\n} as $QLike;\n", + "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport {\n extend, assertPredicate, isFunction, isArray, isInjectable, $InjectorLike, IInjectable,\n} from '../common/index';\n\n// globally available injectables\nconst globals = {};\nconst STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg;\nconst ARGUMENT_NAMES = /([^\\s,]+)/g;\n\n/**\n * A basic angular1-like injector api\n *\n * This object implements four methods similar to the\n * [angular 1 dependency injector](https://docs.angularjs.org/api/auto/service/$injector)\n *\n * UI-Router evolved from an angular 1 library to a framework agnostic library.\n * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.\n *\n * This object provides a naive implementation of a globally scoped dependency injection system.\n * It supports the following DI approaches:\n *\n * ### Function parameter names\n *\n * A function's `.toString()` is called, and the parameter names are parsed.\n * This only works when the parameter names aren't \"mangled\" by a minifier such as UglifyJS.\n *\n * ```js\n * function injectedFunction(FooService, BarService) {\n * // FooService and BarService are injected\n * }\n * ```\n *\n * ### Function annotation\n *\n * A function may be annotated with an array of dependency names as the `$inject` property.\n *\n * ```js\n * injectedFunction.$inject = [ 'FooService', 'BarService' ];\n * function injectedFunction(fs, bs) {\n * // FooService and BarService are injected as fs and bs parameters\n * }\n * ```\n *\n * ### Array notation\n *\n * An array provides the names of the dependencies to inject (as strings).\n * The function is the last element of the array.\n *\n * ```js\n * [ 'FooService', 'BarService', function (fs, bs) {\n * // FooService and BarService are injected as fs and bs parameters\n * }]\n * ```\n *\n * @type {$InjectorLike}\n */\nexport const $injector = {\n /** Gets an object from DI based on a string token */\n get: name => globals[name],\n\n /** Returns true if an object named `name` exists in global DI */\n has: (name) => $injector.get(name) != null,\n\n /**\n * Injects a function\n *\n * @param fn the function to inject\n * @param context the function's `this` binding\n * @param locals An object with additional DI tokens and values, such as `{ someToken: { foo: 1 } }`\n */\n invoke: (fn: IInjectable, context?, locals?) => {\n const all = extend({}, globals, locals || {});\n const params = $injector.annotate(fn);\n const ensureExist = assertPredicate((key: string) => all.hasOwnProperty(key), key => `DI can't find injectable: '${key}'`);\n const args = params.filter(ensureExist).map(x => all[x]);\n if (isFunction(fn)) return fn.apply(context, args);\n else return (fn as any[]).slice(-1)[0].apply(context, args);\n },\n\n /**\n * Returns a function's dependencies\n *\n * Analyzes a function (or array) and returns an array of DI tokens that the function requires.\n * @return an array of `string`s\n */\n annotate: (fn: IInjectable): any[] => {\n if (!isInjectable(fn)) throw new Error(`Not an injectable function: ${fn}`);\n if (fn && (fn as any).$inject) return (fn as any).$inject;\n if (isArray(fn)) return fn.slice(0, -1);\n const fnStr = fn.toString().replace(STRIP_COMMENTS, '');\n const result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES);\n return result || [];\n },\n} as $InjectorLike;\n", + "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport {\n LocationConfig, LocationServices, identity, unnestR, isArray, splitEqual, splitHash, splitQuery,\n} from '../common';\nimport { UIRouter } from '../router';\n\nexport const keyValsToObjectR = (accum, [key, val]) => {\n if (!accum.hasOwnProperty(key)) {\n accum[key] = val;\n } else if (isArray(accum[key])) {\n accum[key].push(val);\n } else {\n accum[key] = [accum[key], val];\n }\n return accum;\n};\n\nexport const getParams = (queryString: string): any =>\n queryString.split('&').filter(identity).map(splitEqual).reduce(keyValsToObjectR, {});\n\nexport function parseUrl(url: string) {\n const orEmptyString = x => x || '';\n const [beforehash, hash] = splitHash(url).map(orEmptyString);\n const [path, search] = splitQuery(beforehash).map(orEmptyString);\n\n return { path, search, hash, url };\n}\n\nexport const buildUrl = (loc: LocationServices) => {\n const path = loc.path();\n const searchObject = loc.search();\n const hash = loc.hash();\n\n const search = Object.keys(searchObject).map(key => {\n const param = searchObject[key];\n const vals = isArray(param) ? param : [param];\n return vals.map(val => key + '=' + val);\n }).reduce(unnestR, []).join('&');\n\n return path + (search ? '?' + search : '') + (hash ? '#' + hash : '');\n};\n\nexport function locationPluginFactory(\n name: string,\n isHtml5: boolean,\n serviceClass: { new(uiRouter?: UIRouter): LocationServices },\n configurationClass: { new(uiRouter?: UIRouter, isHtml5?: boolean): LocationConfig },\n) {\n return function(uiRouter: UIRouter) {\n const service = uiRouter.locationService = new serviceClass(uiRouter);\n const configuration = uiRouter.locationConfig = new configurationClass(uiRouter, isHtml5);\n\n function dispose(router: UIRouter) {\n router.dispose(service);\n router.dispose(configuration);\n }\n\n return { name, service, configuration, dispose };\n };\n}\n", + "/**\n * @internalapi\n * @module vanilla\n */ /** */\n\nimport { deregAll, isDefined, LocationServices, removeFrom, root } from '../common';\nimport { Disposable } from '../interface';\nimport { UIRouter } from '../router';\nimport { HistoryLike, LocationLike } from './interface';\nimport { buildUrl, getParams, parseUrl } from './utils';\n\n/** A base `LocationServices` */\nexport abstract class BaseLocationServices implements LocationServices, Disposable {\n private _listeners: Function[] = [];\n _location: LocationLike;\n _history: HistoryLike;\n\n _listener = evt => this._listeners.forEach(cb => cb(evt));\n\n constructor(router: UIRouter, public fireAfterUpdate: boolean) {\n this._location = root.location;\n this._history = root.history;\n }\n\n /**\n * This should return the current internal URL representation.\n *\n * The internal URL includes only the portion that UI-Router matches.\n * It does not include:\n * - protocol\n * - server\n * - port\n * - base href or hash\n */\n protected abstract _get(): string;\n\n /**\n * This should set the current URL.\n *\n * The `url` param should include only the portion that UI-Router matches on.\n * It should not include:\n * - protocol\n * - server\n * - port\n * - base href or hash\n *\n * However, after this function completes, the browser URL should reflect the entire (fully qualified)\n * HREF including those data.\n */\n protected abstract _set(state: any, title: string, url: string, replace: boolean);\n\n hash = () => parseUrl(this._get()).hash;\n path = () => parseUrl(this._get()).path;\n search = () => getParams(parseUrl(this._get()).search);\n\n url(url?: string, replace = true): string {\n if (isDefined(url) && url !== this._get()) {\n this._set(null, null, url, replace);\n\n if (this.fireAfterUpdate) {\n this._listeners.forEach(cb => cb({ url }));\n }\n }\n\n return buildUrl(this);\n }\n\n onChange(cb: EventListener) {\n this._listeners.push(cb);\n return () => removeFrom(this._listeners, cb);\n }\n\n dispose(router: UIRouter) {\n deregAll(this._listeners);\n }\n}\n", "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { root, trimHashVal } from '../common';\nimport { UIRouter } from '../router';\nimport { BaseLocationServices } from './baseLocationService';\n\n/** A `LocationServices` that uses the browser hash \"#\" to get/set the current location */\nexport class HashLocationService extends BaseLocationServices {\n constructor(router: UIRouter) {\n super(router, false);\n root.addEventListener('hashchange', this._listener, false);\n }\n\n _get() {\n return trimHashVal(this._location.hash);\n }\n _set(state: any, title: string, url: string, replace: boolean) {\n this._location.hash = url;\n }\n\n dispose (router: UIRouter) {\n super.dispose(router);\n root.removeEventListener('hashchange', this._listener);\n }\n}\n\n", "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { BaseLocationServices } from './baseLocationService';\nimport { UIRouter } from '../router';\n\n/** A `LocationServices` that gets/sets the current location from an in-memory object */\nexport class MemoryLocationService extends BaseLocationServices {\n _url: string;\n\n constructor(router: UIRouter) {\n super(router, true);\n }\n\n _get() {\n return this._url;\n }\n\n _set(state: any, title: string, url: string, replace: boolean) {\n this._url = url;\n }\n}\n", - "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { UIRouter } from '../router';\nimport { BaseLocationServices } from './baseLocationService';\nimport { LocationConfig, root, splitHash, splitQuery, stripLastPathElement } from '../common';\n\n/**\n * A `LocationServices` that gets/sets the current location using the browser's `location` and `history` apis\n *\n * Uses `history.pushState` and `history.replaceState`\n */\nexport class PushStateLocationService extends BaseLocationServices {\n _config: LocationConfig;\n\n constructor(router: UIRouter) {\n super(router, true);\n this._config = router.urlService.config;\n root.addEventListener('popstate', this._listener, false);\n };\n\n /**\n * Gets the base prefix without:\n * - trailing slash\n * - trailing filename\n * - protocol and hostname\n *\n * If , this returns '/base'.\n * If , this returns '/foo/base'.\n * If , this returns '/base'.\n * If , this returns '/base'.\n * If , this returns ''.\n * If , this returns ''.\n * If , this returns ''.\n *\n * See: https://html.spec.whatwg.org/dev/semantics.html#the-base-element\n */\n private _getBasePrefix() {\n return stripLastPathElement(this._config.baseHref());\n }\n\n protected _get() {\n let { pathname, hash, search } = this._location;\n search = splitQuery(search)[1]; // strip ? if found\n hash = splitHash(hash)[1]; // strip # if found\n\n const basePrefix = this._getBasePrefix();\n const exactBaseHrefMatch = pathname === this._config.baseHref();\n const startsWithBase = pathname.substr(0, basePrefix.length) === basePrefix;\n pathname = exactBaseHrefMatch ? '/' : startsWithBase ? pathname.substring(basePrefix.length) : pathname;\n\n return pathname + (search ? '?' + search : '') + (hash ? '#' + hash : '');\n }\n\n protected _set(state: any, title: string, url: string, replace: boolean) {\n const basePrefix = this._getBasePrefix();\n const slash = url && url[0] !== '/' ? '/' : '';\n const fullUrl = (url === '' || url === '/') ? this._config.baseHref() : basePrefix + slash + url;\n\n if (replace) {\n this._history.replaceState(state, title, fullUrl);\n } else {\n this._history.pushState(state, title, fullUrl);\n }\n }\n\n public dispose(router: UIRouter) {\n super.dispose(router);\n root.removeEventListener('popstate', this._listener);\n }\n}\n\n", - "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { LocationConfig } from \"../common/coreservices\";\nimport { isDefined } from \"../common/predicates\";\nimport { noop } from \"../common/common\";\n\n/** A `LocationConfig` mock that gets/sets all config from an in-memory object */\nexport class MemoryLocationConfig implements LocationConfig {\n _baseHref = '';\n _port = 80;\n _protocol = \"http\";\n _host = \"localhost\";\n _hashPrefix = \"\";\n\n port = () => this._port;\n protocol = () => this._protocol;\n host = () => this._host;\n baseHref = () => this._baseHref;\n html5Mode = () => false;\n hashPrefix = (newval?) => isDefined(newval) ? this._hashPrefix = newval : this._hashPrefix;\n dispose = noop;\n}", - "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { isDefined } from \"../common/predicates\";\nimport { LocationConfig } from \"../common/coreservices\";\n\n/** A `LocationConfig` that delegates to the browser's `location` object */\nexport class BrowserLocationConfig implements LocationConfig {\n private _baseHref = undefined;\n private _hashPrefix = \"\";\n\n constructor(router?, private _isHtml5 = false) { }\n\n port(): number {\n if (location.port) {\n return Number(location.port);\n }\n\n return this.protocol() === 'https' ? 443 : 80;\n }\n\n protocol(): string {\n return location.protocol.replace(/:/g, '');\n }\n\n host(): string {\n return location.hostname;\n }\n\n html5Mode(): boolean {\n return this._isHtml5;\n }\n\n hashPrefix(): string;\n hashPrefix(newprefix?: string): string {\n return isDefined(newprefix) ? this._hashPrefix = newprefix : this._hashPrefix;\n };\n\n baseHref(href?: string): string {\n return isDefined(href) ? this._baseHref = href :\n isDefined(this._baseHref) ? this._baseHref : this.applyDocumentBaseHref();\n }\n\n applyDocumentBaseHref() {\n let baseTag: HTMLBaseElement = document.getElementsByTagName(\"base\")[0];\n return this._baseHref = baseTag ? baseTag.href.substr(location.origin.length) : location.pathname || '/';\n }\n\n dispose() {}\n}\n", - "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { BrowserLocationConfig } from \"./browserLocationConfig\";\nimport { HashLocationService } from \"./hashLocationService\";\nimport { locationPluginFactory } from \"./utils\";\nimport { LocationPlugin, ServicesPlugin } from \"./interface\";\nimport { UIRouter } from \"../router\";\nimport { PushStateLocationService } from \"./pushStateLocationService\";\nimport { MemoryLocationService } from \"./memoryLocationService\";\nimport { MemoryLocationConfig } from \"./memoryLocationConfig\";\nimport { $injector } from \"./injector\";\nimport { $q } from \"./q\";\nimport { services } from \"../common/coreservices\";\n\nexport function servicesPlugin(router: UIRouter): ServicesPlugin {\n services.$injector = $injector;\n services.$q = $q;\n\n return { name: \"vanilla.services\", $q, $injector, dispose: () => null };\n}\n\n/** A `UIRouterPlugin` uses the browser hash to get/set the current location */\nexport const hashLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory('vanilla.hashBangLocation', false, HashLocationService, BrowserLocationConfig);\n\n/** A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis */\nexport const pushStateLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory(\"vanilla.pushStateLocation\", true, PushStateLocationService, BrowserLocationConfig);\n\n/** A `UIRouterPlugin` that gets/sets the current location from an in-memory object */\nexport const memoryLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory(\"vanilla.memoryLocation\", false, MemoryLocationService, MemoryLocationConfig);\n", - "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nexport * from \"./vanilla/index\";\n", - "/**\n * # Core classes and interfaces\n *\n * The classes and interfaces that are core to ui-router and do not belong\n * to a more specific subsystem (such as resolve).\n *\n * @coreapi\n * @preferred\n * @module core\n */ /** for typedoc */\n\n// Need to import or export at least one concrete something\nimport {noop} from \"./common/common\";\nimport {UIRouter} from \"./router\";\n\n/**\n * An interface for getting values from dependency injection.\n *\n * This is primarily used to get resolve values for a given token.\n * An instance of the `UIInjector` can be retrieved from the current transition using [[Transition.injector]].\n *\n * ---\n *\n * If no resolve is found for a token, then it will delegate to the native injector.\n * The native injector may be Angular 1 `$injector`, Angular 2 `Injector`, or a simple polyfill.\n *\n * In Angular 2, the native injector might be the root Injector,\n * or it might be a lazy loaded `NgModule` injector scoped to a lazy load state tree.\n */\nexport interface UIInjector {\n /**\n * Gets a value from the injector.\n *\n * For a given token, returns the value from the injector that matches the token.\n * If the token is for a resolve that has not yet been fetched, this throws an error.\n *\n * #### Example:\n * ```js\n * var myResolve = injector.get('myResolve');\n * ```\n *\n * #### ng1 Example:\n * ```js\n * // Fetch StateService\n * injector.get('$state').go('home');\n * ```\n *\n * #### ng2 Example:\n * ```js\n * import {StateService} from \"ui-router-ng2\";\n * // Fetch StateService\n * injector.get(StateService).go('home');\n * ```\n *\n * #### Typescript Example:\n * ```js\n * var stringArray = injector.get('myStringArray');\n * ```\n *\n * ### `NOWAIT` policy\n *\n * When using [[ResolvePolicy.async]] === `NOWAIT`, the value returned from `get()` is a promise for the result.\n * The promise is not automatically unwrapped.\n *\n * @param token the key for the value to get. May be a string, a class, or any arbitrary object.\n * @return the Dependency Injection value that matches the token\n */\n get(token: any): any;\n /** Gets a value as type `T` (generics parameter) */\n get(token: any): T;\n\n /**\n * Asynchronously gets a value from the injector\n *\n * For a given token, returns a promise for the value from the injector that matches the token.\n * If the token is for a resolve that has not yet been fetched, this triggers the resolve to load.\n *\n * #### Example:\n * ```js\n * return injector.getAsync('myResolve').then(value => {\n * if (value === 'declined') return false;\n * });\n * ```\n *\n * @param token the key for the value to get. May be a string or arbitrary object.\n * @return a Promise for the Dependency Injection value that matches the token\n */\n getAsync(token: any): Promise;\n /** Asynchronously gets a value as type `T` (generics parameter) */\n getAsync(token: any): Promise;\n\n /**\n * Gets a value from the native injector\n *\n * Returns a value from the native injector, bypassing anything in the [[ResolveContext]].\n *\n * Example:\n * ```js\n * let someThing = injector.getNative(SomeToken);\n * ```\n *\n * @param token the key for the value to get. May be a string or arbitrary object.\n * @return the Dependency Injection value that matches the token\n */\n getNative(token: any): any;\n getNative(token: any): T;\n}\n\n/** @internalapi */\nexport interface UIRouterPlugin extends Disposable {\n name: string;\n}\n\n/** @internalapi */\nexport abstract class UIRouterPluginBase implements UIRouterPlugin, Disposable {\n abstract name: string;\n dispose(router: UIRouter) { }\n}\n\n/** @internalapi */\nexport interface Disposable {\n /** Instructs the Disposable to clean up any resources */\n dispose(router?: UIRouter);\n}", - "/**\n * @coreapi\n * @module common\n */ /** */\n\nexport * from \"./common/index\";\nexport * from \"./params/index\";\nexport * from \"./path/index\";\nexport * from \"./resolve/index\";\nexport * from \"./state/index\";\nexport * from \"./transition/index\";\nexport * from \"./url/index\";\nexport * from \"./view/index\";\nexport * from \"./globals\";\n\nexport * from \"./router\";\nexport * from \"./vanilla\";\nexport * from \"./interface\";\n", - "/** @module ng1 */ /** */\nimport { ng as angular } from \"../angular\";\nimport {\n StateObject, pick, forEach, tail, extend,\n isArray, isInjectable, isDefined, isString, services, trace,\n ViewConfig, ViewService, ViewConfigFactory, PathNode, ResolveContext, Resolvable, IInjectable\n} from \"@uirouter/core\";\nimport { Ng1ViewDeclaration } from \"../interface\";\nimport { TemplateFactory } from \"../templateFactory\";\nimport IInjectorService = angular.auto.IInjectorService;\n\nexport function getNg1ViewConfigFactory(): ViewConfigFactory {\n let templateFactory: TemplateFactory = null;\n return (path, view) => {\n templateFactory = templateFactory || services.$injector.get(\"$templateFactory\");\n return [new Ng1ViewConfig(path, view, templateFactory)];\n };\n}\n\nconst hasAnyKey = (keys, obj) =>\n keys.reduce((acc, key) => acc || isDefined(obj[key]), false);\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `views`.\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * handles the `views` property with logic specific to @uirouter/angularjs (ng1).\n *\n * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object\n * and applies the state-level configuration to a view named `$default`.\n */\nexport function ng1ViewsBuilder(state: StateObject) {\n // Do not process root state\n if (!state.parent) return {};\n\n let tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'],\n ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'],\n compKeys = ['component', 'bindings', 'componentProvider'],\n nonCompKeys = tplKeys.concat(ctrlKeys),\n allViewKeys = compKeys.concat(nonCompKeys);\n\n // Do not allow a state to have both state-level props and also a `views: {}` property.\n // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state.\n // However, the `$default` approach should not be mixed with a separate `views: ` block.\n if (isDefined(state.views) && hasAnyKey(allViewKeys, state)) {\n throw new Error(`State '${state.name}' has a 'views' object. ` +\n `It cannot also have \"view properties\" at the state level. ` +\n `Move the following properties into a view (in the 'views' object): ` +\n ` ${allViewKeys.filter(key => isDefined(state[key])).join(\", \")}`);\n }\n\n let views: { [key: string]: Ng1ViewDeclaration } = {},\n viewsObject = state.views || { \"$default\": pick(state, allViewKeys) };\n\n forEach(viewsObject, function (config: Ng1ViewDeclaration, name: string) {\n // Account for views: { \"\": { template... } }\n name = name || \"$default\";\n // Account for views: { header: \"headerComponent\" }\n if (isString(config)) config = { component: config };\n\n // Make a shallow copy of the config object\n config = extend({}, config);\n\n // Do not allow a view to mix props for component-style view with props for template/controller-style view\n if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {\n throw new Error(`Cannot combine: ${compKeys.join(\"|\")} with: ${nonCompKeys.join(\"|\")} in stateview: '${name}@${state.name}'`);\n }\n\n config.resolveAs = config.resolveAs || '$resolve';\n config.$type = \"ng1\";\n config.$context = state;\n config.$name = name;\n\n let normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name);\n config.$uiViewName = normalized.uiViewName;\n config.$uiViewContextAnchor = normalized.uiViewContextAnchor;\n\n views[name] = config;\n });\n return views;\n}\n\nlet id = 0;\nexport class Ng1ViewConfig implements ViewConfig {\n $id = id++;\n loaded: boolean = false;\n controller: Function; // actually IInjectable|string\n template: string;\n component: string;\n locals: any; // TODO: delete me\n\n constructor(public path: PathNode[], public viewDecl: Ng1ViewDeclaration, public factory: TemplateFactory) { }\n\n load() {\n let $q = services.$q;\n let context = new ResolveContext(this.path);\n let params = this.path.reduce((acc, node) => extend(acc, node.paramValues), {});\n\n let promises: any = {\n template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)),\n controller: $q.when(this.getController(context))\n };\n\n return $q.all(promises).then((results) => {\n trace.traceViewServiceEvent(\"Loaded\", this);\n this.controller = results.controller;\n extend(this, results.template); // Either { template: \"tpl\" } or { component: \"cmpName\" }\n return this;\n });\n }\n\n getTemplate = (uiView, context: ResolveContext) =>\n this.component ? this.factory.makeComponentTemplate(uiView, context, this.component, this.viewDecl.bindings) : this.template;\n\n /**\n * Gets the controller for a view configuration.\n *\n * @returns {Function|Promise.} Returns a controller, or a promise that resolves to a controller.\n */\n getController(context: ResolveContext): (IInjectable|string|Promise) {\n let provider = this.viewDecl.controllerProvider;\n if (!isInjectable(provider)) return this.viewDecl.controller;\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n }\n}\n", - "/** @module view */\n/** for typedoc */\nimport { ng as angular } from \"./angular\";\nimport { IAugmentedJQuery } from \"angular\";\nimport {\n isArray, isDefined, isFunction, isObject, services, Obj, IInjectable, tail, kebobString, unnestR, ResolveContext,\n Resolvable, RawParams\n} from \"@uirouter/core\";\nimport { Ng1ViewDeclaration, TemplateFactoryProvider } from \"./interface\";\n\n/**\n * Service which manages loading of templates from a ViewConfig.\n */\nexport class TemplateFactory implements TemplateFactoryProvider {\n /** @hidden */ private _useHttp = angular.version.minor < 3;\n /** @hidden */ private $templateRequest;\n /** @hidden */ private $templateCache;\n /** @hidden */ private $http;\n\n /** @hidden */ $get = ['$http', '$templateCache', '$injector', ($http, $templateCache, $injector) => {\n this.$templateRequest = $injector.has && $injector.has('$templateRequest') && $injector.get('$templateRequest');\n this.$http = $http;\n this.$templateCache = $templateCache;\n return this;\n }];\n\n /** @hidden */\n useHttpService(value: boolean) {\n this._useHttp = value;\n };\n\n /**\n * Creates a template from a configuration object.\n *\n * @param config Configuration object for which to load a template.\n * The following properties are search in the specified order, and the first one\n * that is defined is used to create the template:\n *\n * @param params Parameters to pass to the template function.\n * @param context The resolve context associated with the template's view\n *\n * @return {string|object} The template html as a string, or a promise for\n * that string,or `null` if no template is configured.\n */\n fromConfig(config: Ng1ViewDeclaration, params: any, context: ResolveContext): Promise<{ template?: string, component?: string }> {\n const defaultTemplate = \"\";\n\n const asTemplate = (result) => services.$q.when(result).then(str => ({ template: str }));\n const asComponent = (result) => services.$q.when(result).then(str => ({ component: str }));\n\n return (\n isDefined(config.template) ? asTemplate(this.fromString(config.template, params)) :\n isDefined(config.templateUrl) ? asTemplate(this.fromUrl(config.templateUrl, params)) :\n isDefined(config.templateProvider) ? asTemplate(this.fromProvider(config.templateProvider, params, context)) :\n isDefined(config.component) ? asComponent(config.component) :\n isDefined(config.componentProvider) ? asComponent(this.fromComponentProvider(config.componentProvider, params, context)) :\n asTemplate(defaultTemplate)\n );\n };\n\n /**\n * Creates a template from a string or a function returning a string.\n *\n * @param template html template as a string or function that returns an html template as a string.\n * @param params Parameters to pass to the template function.\n *\n * @return {string|object} The template html as a string, or a promise for that\n * string.\n */\n fromString(template: (string | Function), params?: RawParams) {\n return isFunction(template) ? ( template)(params) : template;\n };\n\n /**\n * Loads a template from the a URL via `$http` and `$templateCache`.\n *\n * @param {string|Function} url url of the template to load, or a function\n * that returns a url.\n * @param {Object} params Parameters to pass to the url function.\n * @return {string|Promise.} The template html as a string, or a promise\n * for that string.\n */\n fromUrl(url: (string | Function), params: any) {\n if (isFunction(url)) url = ( url)(params);\n if (url == null) return null;\n\n if (this._useHttp) {\n return this.$http.get(url, { cache: this.$templateCache, headers: { Accept: 'text/html' } })\n .then(function (response) {\n return response.data;\n });\n }\n\n return this.$templateRequest(url);\n };\n\n /**\n * Creates a template by invoking an injectable provider function.\n *\n * @param provider Function to invoke via `locals`\n * @param {Function} injectFn a function used to invoke the template provider\n * @return {string|Promise.} The template html as a string, or a promise\n * for that string.\n */\n fromProvider(provider: IInjectable, params: any, context: ResolveContext) {\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n };\n\n /**\n * Creates a component's template by invoking an injectable provider function.\n *\n * @param provider Function to invoke via `locals`\n * @param {Function} injectFn a function used to invoke the template provider\n * @return {string} The template html as a string: \"\".\n */\n fromComponentProvider(provider: IInjectable, params: any, context: ResolveContext) {\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n };\n\n /**\n * Creates a template from a component's name\n *\n * This implements route-to-component.\n * It works by retrieving the component (directive) metadata from the injector.\n * It analyses the component's bindings, then constructs a template that instantiates the component.\n * The template wires input and output bindings to resolves or from the parent component.\n *\n * @param uiView {object} The parent ui-view (for binding outputs to callbacks)\n * @param context The ResolveContext (for binding outputs to callbacks returned from resolves)\n * @param component {string} Component's name in camel case.\n * @param bindings An object defining the component's bindings: {foo: '<'}\n * @return {string} The template as a string: \"\".\n */\n makeComponentTemplate(uiView: IAugmentedJQuery, context: ResolveContext, component: string, bindings?: any) {\n bindings = bindings || {};\n\n // Bind once prefix\n const prefix = angular.version.minor >= 3 ? \"::\" : \"\";\n // Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-`\n const kebob = (camelCase: string) => {\n const kebobed = kebobString(camelCase);\n return /^(x|data)-/.exec(kebobed) ? `x-${kebobed}` : kebobed;\n };\n\n\n const attributeTpl = (input: BindingTuple) => {\n let { name, type } = input;\n let attrName = kebob(name);\n // If the ui-view has an attribute which matches a binding on the routed component\n // then pass that attribute through to the routed component template.\n // Prefer ui-view wired mappings to resolve data, unless the resolve was explicitly bound using `bindings:`\n if (uiView.attr(attrName) && !bindings[name])\n return `${attrName}='${uiView.attr(attrName)}'`;\n\n let resolveName = bindings[name] || name;\n // Pre-evaluate the expression for \"@\" bindings by enclosing in {{ }}\n // some-attr=\"{{ ::$resolve.someResolveName }}\"\n if (type === '@')\n return `${attrName}='{{${prefix}$resolve.${resolveName}}}'`;\n\n // Wire \"&\" callbacks to resolves that return a callback function\n // Get the result of the resolve (should be a function) and annotate it to get its arguments.\n // some-attr=\"$resolve.someResolveResultName(foo, bar)\"\n if (type === '&') {\n let res = context.getResolvable(resolveName);\n let fn = res && res.data;\n let args = fn && services.$injector.annotate(fn) || [];\n // account for array style injection, i.e., ['foo', function(foo) {}]\n let arrayIdxStr = isArray(fn) ? `[${fn.length - 1}]` : '';\n return `${attrName}='$resolve.${resolveName}${arrayIdxStr}(${args.join(\",\")})'`;\n }\n\n // some-attr=\"::$resolve.someResolveName\"\n return `${attrName}='${prefix}$resolve.${resolveName}'`;\n };\n\n let attrs = getComponentBindings(component).map(attributeTpl).join(\" \");\n let kebobName = kebob(component);\n return `<${kebobName} ${attrs}>`;\n };\n}\n\n// Gets all the directive(s)' inputs ('@', '=', and '<') and outputs ('&')\nfunction getComponentBindings(name: string) {\n let cmpDefs = services.$injector.get(name + \"Directive\"); // could be multiple\n if (!cmpDefs || !cmpDefs.length) throw new Error(`Unable to find component named '${name}'`);\n return cmpDefs.map(getBindings).reduce(unnestR, []);\n}\n\n// Given a directive definition, find its object input attributes\n// Use different properties, depending on the type of directive (component, bindToController, normal)\nconst getBindings = (def: any) => {\n if (isObject(def.bindToController)) return scopeBindings(def.bindToController);\n return scopeBindings(def.scope);\n};\n\ninterface BindingTuple {\n name: string;\n type: string;\n}\n\n// for ng 1.2 style, process the scope: { input: \"=foo\" }\n// for ng 1.3 through ng 1.5, process the component's bindToController: { input: \"=foo\" } object\nconst scopeBindings = (bindingsObj: Obj) => Object.keys(bindingsObj || {})\n // [ 'input', [ '=foo', '=', 'foo' ] ]\n .map(key => [key, /^([=<@&])[?]?(.*)/.exec(bindingsObj[key])])\n // skip malformed values\n .filter(tuple => isDefined(tuple) && isArray(tuple[1]))\n // { name: ('foo' || 'input'), type: '=' }\n .map(tuple => ({ name: tuple[1][2] || tuple[0], type: tuple[1][1] } as BindingTuple));\n\n", - "/** @module ng1 */ /** for typedoc */\nimport {\n val, isObject, createProxyFunctions, BuilderFunction, StateRegistry, StateService, OnInvalidCallback\n} from \"@uirouter/core\";\nimport { Ng1StateDeclaration } from \"./interface\";\n\n/**\n * The Angular 1 `StateProvider`\n *\n * The `$stateProvider` works similar to Angular's v1 router, but it focuses purely\n * on state.\n *\n * A state corresponds to a \"place\" in the application in terms of the overall UI and\n * navigation. A state describes (via the controller / template / view properties) what\n * the UI looks like and does at that place.\n *\n * States often have things in common, and the primary way of factoring out these\n * commonalities in this model is via the state hierarchy, i.e. parent/child states aka\n * nested states.\n *\n * The `$stateProvider` provides interfaces to declare these states for your app.\n */\nexport class StateProvider {\n constructor(private stateRegistry: StateRegistry, private stateService: StateService) {\n createProxyFunctions(val(StateProvider.prototype), this, val(this));\n }\n\n /**\n * Decorates states when they are registered\n *\n * Allows you to extend (carefully) or override (at your own peril) the\n * `stateBuilder` object used internally by [[StateRegistry]].\n * This can be used to add custom functionality to ui-router,\n * for example inferring templateUrl based on the state name.\n *\n * When passing only a name, it returns the current (original or decorated) builder\n * function that matches `name`.\n *\n * The builder functions that can be decorated are listed below. Though not all\n * necessarily have a good use case for decoration, that is up to you to decide.\n *\n * In addition, users can attach custom decorators, which will generate new\n * properties within the state's internal definition. There is currently no clear\n * use-case for this beyond accessing internal states (i.e. $state.$current),\n * however, expect this to become increasingly relevant as we introduce additional\n * meta-programming features.\n *\n * **Warning**: Decorators should not be interdependent because the order of\n * execution of the builder functions in non-deterministic. Builder functions\n * should only be dependent on the state definition object and super function.\n *\n *\n * Existing builder functions and current return values:\n *\n * - **parent** `{object}` - returns the parent state object.\n * - **data** `{object}` - returns state data, including any inherited data that is not\n * overridden by own values (if any).\n * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}\n * or `null`.\n * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is\n * navigable).\n * - **params** `{object}` - returns an array of state params that are ensured to\n * be a super-set of parent's params.\n * - **views** `{object}` - returns a views object where each key is an absolute view\n * name (i.e. \"viewName@stateName\") and each value is the config object\n * (template, controller) for the view. Even when you don't use the views object\n * explicitly on a state config, one is still created for you internally.\n * So by decorating this builder function you have access to decorating template\n * and controller properties.\n * - **ownParams** `{object}` - returns an array of params that belong to the state,\n * not including any params defined by ancestor states.\n * - **path** `{string}` - returns the full path from the root down to this state.\n * Needed for state activation.\n * - **includes** `{object}` - returns an object that includes every state that\n * would pass a `$state.includes()` test.\n *\n * #### Example:\n * Override the internal 'views' builder with a function that takes the state\n * definition, and a reference to the internal function being overridden:\n * ```js\n * $stateProvider.decorator('views', function (state, parent) {\n * let result = {},\n * views = parent(state);\n *\n * angular.forEach(views, function (config, name) {\n * let autoName = (state.name + '.' + name).replace('.', '/');\n * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';\n * result[name] = config;\n * });\n * return result;\n * });\n *\n * $stateProvider.state('home', {\n * views: {\n * 'contact.list': { controller: 'ListController' },\n * 'contact.item': { controller: 'ItemController' }\n * }\n * });\n * ```\n *\n *\n * ```js\n * // Auto-populates list and item views with /partials/home/contact/list.html,\n * // and /partials/home/contact/item.html, respectively.\n * $state.go('home');\n * ```\n *\n * @param {string} name The name of the builder function to decorate.\n * @param {object} func A function that is responsible for decorating the original\n * builder function. The function receives two parameters:\n *\n * - `{object}` - state - The state config object.\n * - `{object}` - super - The original builder function.\n *\n * @return {object} $stateProvider - $stateProvider instance\n */\n decorator(name: string, func: BuilderFunction) {\n return this.stateRegistry.decorator(name, func) || this;\n }\n\n /**\n * Registers a state\n *\n * ### This is a passthrough to [[StateRegistry.register]].\n *\n * Registers a state configuration under a given state name.\n * The stateConfig object has the following acceptable properties.\n *\n *
\n *\n * - **`template`** - {string|function=} - html template as a string or a function that returns\n * an html template as a string which should be used by the uiView directives. This property\n * takes precedence over templateUrl.\n *\n * If `template` is a function, it will be called with the following parameters:\n *\n * - {array.<object>} - state parameters extracted from the current $location.path() by\n * applying the current state\n *\n * \n *\n * - **`templateUrl`** - {string|function=} - path or function that returns a path to an html\n * template that should be used by uiView.\n *\n * If `templateUrl` is a function, it will be called with the following parameters:\n *\n * - {array.<object>} - state parameters extracted from the current $location.path() by\n * applying the current state\n *\n * \n *\n * - **`templateProvider`** - {function=} - Provider function that returns HTML content\n * string.\n *\n * \n *\n * - **`controller`** - {string|function=} - Controller fn that should be associated with newly\n * related scope or the name of a registered controller if passed as a string.\n *\n * \n *\n * - **`controllerProvider`** - {function=} - Injectable provider function that returns\n * the actual controller or string.\n *\n * \n *\n * - **`controllerAs`** – {string=} – A controller alias name. If present the controller will be\n * published to scope under the controllerAs name.\n *\n * \n *\n * - **`resolve`** - {object.<string, function>=} - An optional map of dependencies which\n * should be injected into the controller. If any of these dependencies are promises,\n * the router will wait for them all to be resolved or one to be rejected before the\n * controller is instantiated. If all the promises are resolved successfully, the values\n * of the resolved promises are injected and $stateChangeSuccess event is fired. If any\n * of the promises are rejected the $stateChangeError event is fired. The map object is:\n *\n * - key - {string}: name of dependency to be injected into controller\n * - factory - {string|function}: If string then it is alias for service. Otherwise if function,\n * it is injected and return value it treated as dependency. If result is a promise, it is\n * resolved before its value is injected into controller.\n *\n * \n *\n * - **`url`** - {string=} - A url with optional parameters. When a state is navigated or\n * transitioned to, the `$stateParams` service will be populated with any\n * parameters that were passed.\n *\n * \n *\n * - **`params`** - {object=} - An array of parameter names or regular expressions. Only\n * use this within a state if you are not using url. Otherwise you can specify your\n * parameters within the url. When a state is navigated or transitioned to, the\n * $stateParams service will be populated with any parameters that were passed.\n *\n * \n *\n * - **`views`** - {object=} - Use the views property to set up multiple views or to target views\n * manually/explicitly.\n *\n * \n *\n * - **`abstract`** - {boolean=} - An abstract state will never be directly activated,\n * but can provide inherited properties to its common children states.\n *\n * \n *\n * - **`onEnter`** - {object=} - Callback function for when a state is entered. Good way\n * to trigger an action or dispatch an event, such as opening a dialog.\n * If minifying your scripts, make sure to use the `['injection1', 'injection2', function(injection1, injection2){}]` syntax.\n *\n * \n *\n * - **`onExit`** - {object=} - Callback function for when a state is exited. Good way to\n * trigger an action or dispatch an event, such as opening a dialog.\n * If minifying your scripts, make sure to use the `['injection1', 'injection2', function(injection1, injection2){}]` syntax.\n *\n * \n *\n * - **`reloadOnSearch = true`** - {boolean=} - If `false`, will not retrigger the same state\n * just because a search/query parameter has changed (via $location.search() or $location.hash()).\n * Useful for when you'd like to modify $location.search() without triggering a reload.\n *\n * \n *\n * - **`data`** - {object=} - Arbitrary data object, useful for custom configuration.\n *\n * #### Example:\n * Some state name examples\n * ```js\n * // stateName can be a single top-level name (must be unique).\n * $stateProvider.state(\"home\", {});\n *\n * // Or it can be a nested state name. This state is a child of the\n * // above \"home\" state.\n * $stateProvider.state(\"home.newest\", {});\n *\n * // Nest states as deeply as needed.\n * $stateProvider.state(\"home.newest.abc.xyz.inception\", {});\n *\n * // state() returns $stateProvider, so you can chain state declarations.\n * $stateProvider\n * .state(\"home\", {})\n * .state(\"about\", {})\n * .state(\"contacts\", {});\n * ```\n *\n * @param {string} name A unique state name, e.g. \"home\", \"about\", \"contacts\".\n * To create a parent/child state use a dot, e.g. \"about.sales\", \"home.newest\".\n * @param {object} definition State configuration object.\n */\n state(name: string, definition: Ng1StateDeclaration): StateProvider;\n state(definition: Ng1StateDeclaration): StateProvider;\n state(name: any, definition?: any) {\n if (isObject(name)) {\n definition = name;\n } else {\n definition.name = name;\n }\n this.stateRegistry.register(definition);\n return this;\n }\n\n /**\n * Registers an invalid state handler\n *\n * This is a passthrough to [[StateService.onInvalid]] for ng1.\n */\n\n onInvalid(callback: OnInvalidCallback): Function {\n return this.stateService.onInvalid(callback);\n }\n}\n", - "/** @module ng1 */ /** */\nimport {\n StateObject, TransitionStateHookFn, HookResult, Transition, services, ResolveContext, extend, BuilderFunction\n} from \"@uirouter/core\";\nimport { getLocals } from \"../services\";\nimport { Ng1StateDeclaration } from '../interface';\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`,\n * `onRetain` callback hooks on a [[Ng1StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * ensures that those hooks are injectable for @uirouter/angularjs (ng1).\n */\nexport const getStateHookBuilder = (hookName: \"onEnter\"|\"onExit\"|\"onRetain\") =>\nfunction stateHookBuilder(state: StateObject, parentFn: BuilderFunction): TransitionStateHookFn {\n const hook = state[hookName];\n const pathname = hookName === 'onExit' ? 'from' : 'to';\n\n function decoratedNg1Hook(trans: Transition, state: Ng1StateDeclaration): HookResult {\n const resolveContext = new ResolveContext(trans.treeChanges(pathname));\n const subContext = resolveContext.subContext(state.$$state());\n const locals = extend(getLocals(subContext), { $state$: state, $transition$: trans });\n return services.$injector.invoke(hook, this, locals);\n }\n\n return hook ? decoratedNg1Hook : undefined;\n};\n", - "/**\n * @internalapi\n * @module ng1\n */ /** */\nimport { LocationConfig, LocationServices, UIRouter, ParamType, isDefined } from \"@uirouter/core\";\nimport { val, createProxyFunctions, removeFrom, isObject } from \"@uirouter/core\";\nimport { ILocationService, ILocationProvider } from \"angular\";\n\n/**\n * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service\n */\nexport class Ng1LocationServices implements LocationConfig, LocationServices {\n private $locationProvider: ILocationProvider;\n private $location: ILocationService;\n private $sniffer;\n\n path;\n search;\n hash;\n hashPrefix;\n port;\n protocol;\n host;\n baseHref;\n\n // .onChange() registry\n private _urlListeners: Function[] = [];\n\n dispose() { }\n\n constructor($locationProvider: ILocationProvider) {\n this.$locationProvider = $locationProvider;\n let _lp = val($locationProvider);\n createProxyFunctions(_lp, this, _lp, ['hashPrefix']);\n }\n\n onChange(callback: Function) {\n this._urlListeners.push(callback);\n return () => removeFrom(this._urlListeners)(callback);\n }\n\n html5Mode() {\n let html5Mode: any = this.$locationProvider.html5Mode();\n html5Mode = isObject(html5Mode) ? html5Mode.enabled : html5Mode;\n return html5Mode && this.$sniffer.history;\n }\n\n url(newUrl?: string, replace = false, state?) {\n if (isDefined(newUrl)) this.$location.url(newUrl);\n if (replace) this.$location.replace();\n if (state) this.$location.state(state);\n return this.$location.url();\n }\n\n _runtimeServices($rootScope, $location: ILocationService, $sniffer, $browser) {\n this.$location = $location;\n this.$sniffer = $sniffer;\n\n // Bind $locationChangeSuccess to the listeners registered in LocationService.onChange\n $rootScope.$on(\"$locationChangeSuccess\", evt => this._urlListeners.forEach(fn => fn(evt)));\n let _loc = val($location);\n let _browser = val($browser);\n\n // Bind these LocationService functions to $location\n createProxyFunctions(_loc, this, _loc, [\"replace\", \"path\", \"search\", \"hash\"]);\n // Bind these LocationConfig functions to $location\n createProxyFunctions(_loc, this, _loc, ['port', 'protocol', 'host']);\n // Bind these LocationConfig functions to $browser\n createProxyFunctions(_browser, this, _browser, ['baseHref']);\n }\n\n /**\n * Applys ng1-specific path parameter encoding\n *\n * The Angular 1 `$location` service is a bit weird.\n * It doesn't allow slashes to be encoded/decoded bi-directionally.\n *\n * See the writeup at https://github.com/angular-ui/ui-router/issues/2598\n *\n * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F\n *\n * @param router\n */\n static monkeyPatchPathParameterType(router: UIRouter) {\n let pathType: ParamType = router.urlMatcherFactory.type('path');\n\n pathType.encode = (val: any) =>\n val != null ? val.toString().replace(/(~|\\/)/g, m => ({ '~': '~~', '/': '~2F' }[m])) : val;\n\n pathType.decode = (val: string) =>\n val != null ? val.toString().replace(/(~~|~2F)/g, m => ({ '~~': '~', '~2F': '/' }[m])) : val;\n\n }\n}\n", - "/** @module url */ /** */\nimport {\n UIRouter, UrlRouter, LocationServices, $InjectorLike, BaseUrlRule, UrlRuleHandlerFn, UrlMatcher,\n IInjectable\n} from \"@uirouter/core\";\nimport { services, isString, isFunction, isArray, identity } from \"@uirouter/core\";\n\nexport interface RawNg1RuleFunction {\n ($injector: $InjectorLike, $location: LocationServices): string|void;\n}\n\n/**\n * Manages rules for client-side URL\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class manages the router rules for what to do when the URL changes.\n *\n * This provider remains for backwards compatibility.\n *\n * @deprecated\n */\nexport class UrlRouterProvider {\n /** @hidden */ _router: UIRouter;\n /** @hidden */ _urlRouter: UrlRouter;\n\n /** @hidden */\n constructor(router: UIRouter) {\n this._router = router;\n this._urlRouter = router.urlRouter;\n }\n\n /** @hidden */\n $get() {\n let urlRouter = this._urlRouter;\n urlRouter.update(true);\n if (!urlRouter.interceptDeferred) urlRouter.listen();\n return urlRouter;\n }\n\n /**\n * Registers a url handler function.\n *\n * Registers a low level url handler (a `rule`).\n * A rule detects specific URL patterns and returns a redirect, or performs some action.\n *\n * If a rule returns a string, the URL is replaced with the string, and all rules are fired again.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // Here's an example of how you might allow case insensitive urls\n * $urlRouterProvider.rule(function ($injector, $location) {\n * var path = $location.path(),\n * normalized = path.toLowerCase();\n *\n * if (path !== normalized) {\n * return normalized;\n * }\n * });\n * });\n * ```\n *\n * @param ruleFn\n * Handler function that takes `$injector` and `$location` services as arguments.\n * You can use them to detect a url and return a different url as a string.\n *\n * @return [[UrlRouterProvider]] (`this`)\n */\n rule(ruleFn: RawNg1RuleFunction): UrlRouterProvider {\n if (!isFunction(ruleFn)) throw new Error(\"'rule' must be a function\");\n\n const match = () =>\n ruleFn(services.$injector, this._router.locationService);\n\n let rule = new BaseUrlRule(match, identity);\n this._urlRouter.rule(rule);\n return this;\n };\n\n /**\n * Defines the path or behavior to use when no url can be matched.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // if the path doesn't match any of the urls you configured\n * // otherwise will take care of routing the user to the\n * // specified url\n * $urlRouterProvider.otherwise('/index');\n *\n * // Example of using function rule as param\n * $urlRouterProvider.otherwise(function ($injector, $location) {\n * return '/a/valid/url';\n * });\n * });\n * ```\n *\n * @param rule\n * The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`.\n * The function version is passed two params: `$injector` and `$location` services, and should return a url string.\n *\n * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n */\n otherwise(rule: string | RawNg1RuleFunction): UrlRouterProvider {\n let urlRouter = this._urlRouter;\n\n if (isString(rule)) {\n urlRouter.otherwise(rule);\n } else if (isFunction(rule)) {\n urlRouter.otherwise(() => rule(services.$injector, this._router.locationService));\n } else {\n throw new Error(\"'rule' must be a string or function\");\n }\n\n return this;\n };\n\n /**\n * Registers a handler for a given url matching.\n *\n * If the handler is a string, it is\n * treated as a redirect, and is interpolated according to the syntax of match\n * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).\n *\n * If the handler is a function, it is injectable.\n * It gets invoked if `$location` matches.\n * You have the option of inject the match object as `$match`.\n *\n * The handler can return\n *\n * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n * will continue trying to find another one that matches.\n * - **string** which is treated as a redirect and passed to `$location.url()`\n * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n * if ($state.$current.navigable !== state ||\n * !equalForKeys($match, $stateParams) {\n * $state.transitionTo(state, $match, false);\n * }\n * });\n * });\n * ```\n *\n * @param what A pattern string to match, compiled as a [[UrlMatcher]].\n * @param handler The path (or function that returns a path) that you want to redirect your user to.\n * @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]]\n *\n * Note: the handler may also invoke arbitrary code, such as `$state.go()`\n */\n when(what: (RegExp|UrlMatcher|string), handler: string|IInjectable) {\n if (isArray(handler) || isFunction(handler)) {\n handler = UrlRouterProvider.injectableHandler(this._router, handler);\n }\n\n this._urlRouter.when(what, handler as any);\n return this;\n };\n\n static injectableHandler(router: UIRouter, handler): UrlRuleHandlerFn {\n return match =>\n services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params });\n }\n\n /**\n * Disables monitoring of the URL.\n *\n * Call this method before UI-Router has bootstrapped.\n * It will stop UI-Router from performing the initial url sync.\n *\n * This can be useful to perform some asynchronous initialization before the router starts.\n * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // Prevent $urlRouter from automatically intercepting URL changes;\n * $urlRouterProvider.deferIntercept();\n * })\n *\n * app.run(function (MyService, $urlRouter, $http) {\n * $http.get(\"/stuff\").then(function(resp) {\n * MyService.doStuff(resp.data);\n * $urlRouter.listen();\n * $urlRouter.sync();\n * });\n * });\n * ```\n *\n * @param defer Indicates whether to defer location change interception.\n * Passing no parameter is equivalent to `true`.\n */\n deferIntercept(defer?: boolean) {\n this._urlRouter.deferIntercept(defer);\n };\n}\n", - "/**\n * # Angular 1 types\n *\n * UI-Router core provides various Typescript types which you can use for code completion and validating parameter values, etc.\n * The customizations to the core types for Angular UI-Router are documented here.\n *\n * The optional [[$resolve]] service is also documented here.\n *\n * @module ng1\n * @preferred\n */\n/** for typedoc */\nimport { ng as angular } from \"./angular\";\nimport {\n IRootScopeService, IQService, ILocationService, ILocationProvider, IHttpService, ITemplateCacheService\n} from \"angular\";\nimport {\n services, applyPairs, isString, trace, extend, UIRouter, StateService, UrlRouter, UrlMatcherFactory, ResolveContext,\n unnestR, TypedMap\n} from \"@uirouter/core\";\nimport { ng1ViewsBuilder, getNg1ViewConfigFactory } from \"./statebuilders/views\";\nimport { TemplateFactory } from \"./templateFactory\";\nimport { StateProvider } from \"./stateProvider\";\nimport { getStateHookBuilder } from \"./statebuilders/onEnterExitRetain\";\nimport { Ng1LocationServices } from \"./locationServices\";\nimport { UrlRouterProvider } from \"./urlRouterProvider\";\nimport IInjectorService = angular.auto.IInjectorService; // tslint:disable-line\n\nangular.module(\"ui.router.angular1\", []);\nlet mod_init = angular.module('ui.router.init', []);\nlet mod_util = angular.module('ui.router.util', ['ng', 'ui.router.init']);\nlet mod_rtr = angular.module('ui.router.router', ['ui.router.util']);\nlet mod_state = angular.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']);\nlet mod_main = angular.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']);\nlet mod_cmpt = angular.module('ui.router.compat', ['ui.router']); // tslint:disable-line\n\ndeclare module '@uirouter/core/lib/router' {\n interface UIRouter {\n /** @hidden */\n stateProvider: StateProvider;\n /** @hidden */\n urlRouterProvider: UrlRouterProvider;\n }\n}\n\nlet router: UIRouter = null;\n\n$uiRouter.$inject = ['$locationProvider'];\n/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */\nfunction $uiRouter($locationProvider: ILocationProvider) {\n\n // Create a new instance of the Router when the $uiRouterProvider is initialized\n router = this.router = new UIRouter();\n router.stateProvider = new StateProvider(router.stateRegistry, router.stateService);\n\n // Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties\n router.stateRegistry.decorator(\"views\", ng1ViewsBuilder);\n router.stateRegistry.decorator(\"onExit\", getStateHookBuilder(\"onExit\"));\n router.stateRegistry.decorator(\"onRetain\", getStateHookBuilder(\"onRetain\"));\n router.stateRegistry.decorator(\"onEnter\", getStateHookBuilder(\"onEnter\"));\n\n router.viewService._pluginapi._viewConfigFactory('ng1', getNg1ViewConfigFactory());\n\n let ng1LocationService = router.locationService = router.locationConfig = new Ng1LocationServices($locationProvider);\n\n Ng1LocationServices.monkeyPatchPathParameterType(router);\n\n // backwards compat: also expose router instance as $uiRouterProvider.router\n router['router'] = router;\n router['$get'] = $get;\n $get.$inject = ['$location', '$browser', '$sniffer', '$rootScope', '$http', '$templateCache'];\n function $get($location: ILocationService, $browser: any, $sniffer: any, $rootScope: ng.IScope, $http: IHttpService, $templateCache: ITemplateCacheService) {\n ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser);\n delete router['router'];\n delete router['$get'];\n return router;\n }\n return router;\n}\n\nconst getProviderFor = (serviceName) => [ '$uiRouterProvider', ($urp) => {\n let service = $urp.router[serviceName];\n service[\"$get\"] = () => service;\n return service;\n}];\n\n// This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime)\nrunBlock.$inject = ['$injector', '$q', '$uiRouter'];\nfunction runBlock($injector: IInjectorService, $q: IQService, $uiRouter: UIRouter) {\n services.$injector = $injector;\n services.$q = $q;\n\n // The $injector is now available.\n // Find any resolvables that had dependency annotation deferred\n $uiRouter.stateRegistry.get()\n .map(x => x.$$state().resolvables)\n .reduce(unnestR, [])\n .filter(x => x.deps === \"deferred\")\n .forEach(resolvable => resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi));\n}\n\n// $urlRouter service and $urlRouterProvider\nconst getUrlRouterProvider = (uiRouter: UIRouter) =>\n uiRouter.urlRouterProvider = new UrlRouterProvider(uiRouter);\n\n// $state service and $stateProvider\n// $urlRouter service and $urlRouterProvider\nconst getStateProvider = () =>\n extend(router.stateProvider, { $get: () => router.stateService });\n\nwatchDigests.$inject = ['$rootScope'];\nexport function watchDigests($rootScope: IRootScopeService) {\n $rootScope.$watch(function() { trace.approximateDigests++; });\n}\n\nmod_init .provider(\"$uiRouter\", $uiRouter);\nmod_rtr .provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]);\nmod_util .provider('$urlService', getProviderFor('urlService'));\nmod_util .provider('$urlMatcherFactory', ['$uiRouterProvider', () => router.urlMatcherFactory]);\nmod_util .provider('$templateFactory', () => new TemplateFactory());\nmod_state.provider('$stateRegistry', getProviderFor('stateRegistry'));\nmod_state.provider('$uiRouterGlobals', getProviderFor('globals'));\nmod_state.provider('$transitions', getProviderFor('transitionService'));\nmod_state.provider('$state', ['$uiRouterProvider', getStateProvider]);\n\nmod_state.factory ('$stateParams', ['$uiRouter', ($uiRouter: UIRouter) => $uiRouter.globals.params]);\nmod_main .factory ('$view', () => router.viewService);\nmod_main .service (\"$trace\", () => trace);\n\nmod_main .run (watchDigests);\nmod_util .run (['$urlMatcherFactory', function ($urlMatcherFactory: UrlMatcherFactory) { }]);\nmod_state.run (['$state', function ($state: StateService) { }]);\nmod_rtr .run (['$urlRouter', function ($urlRouter: UrlRouter) { }]);\nmod_init .run (runBlock);\n\n/** @hidden TODO: find a place to move this */\nexport const getLocals = (ctx: ResolveContext): TypedMap => {\n let tokens = ctx.getTokens().filter(isString);\n\n let tuples = tokens .map(key => {\n let resolvable = ctx.getResolvable(key);\n let waitPolicy = ctx.getPolicy(resolvable).async;\n return [ key, waitPolicy === 'NOWAIT' ? resolvable.promise : resolvable.data ];\n });\n\n return tuples.reduce(applyPairs, {});\n};\n\n", - "/**\n * # Angular 1 injectable services\n *\n * This is a list of the objects which can be injected using angular's injector.\n *\n * There are three different kind of injectable objects:\n *\n * ## **Provider** objects\n * #### injectable into a `.config()` block during configtime\n *\n * - [[$uiRouterProvider]]: The UI-Router instance\n * - [[$stateProvider]]: State registration\n * - [[$transitionsProvider]]: Transition hooks\n * - [[$urlServiceProvider]]: All URL related public APIs\n *\n * - [[$uiViewScrollProvider]]: Disable ui-router view scrolling\n * - [[$urlRouterProvider]]: (deprecated) Url matching rules\n * - [[$urlMatcherFactoryProvider]]: (deprecated) Url parsing config\n *\n * ## **Service** objects\n * #### injectable globally during runtime\n *\n * - [[$uiRouter]]: The UI-Router instance\n * - [[$trace]]: Enable transition trace/debug\n * - [[$transitions]]: Transition hooks\n * - [[$state]]: Imperative state related APIs\n * - [[$stateRegistry]]: State registration\n * - [[$urlService]]: All URL related public APIs\n * - [[$uiRouterGlobals]]: Global variables\n * - [[$uiViewScroll]]: Scroll an element into view\n *\n * - [[$stateParams]]: (deprecated) Global state param values\n * - [[$urlRouter]]: (deprecated) URL synchronization\n * - [[$urlMatcherFactory]]: (deprecated) URL parsing config\n *\n * ## **Per-Transition** objects\n *\n * - These kind of objects are injectable into:\n * - Resolves ([[Ng1StateDeclaration.resolve]]),\n * - Transition Hooks ([[TransitionService.onStart]], etc),\n * - Routed Controllers ([[Ng1ViewDeclaration.controller]])\n *\n * #### Different instances are injected based on the [[Transition]]\n *\n * - [[$transition$]]: The current Transition object\n * - [[$stateParams]]: State param values for pending Transition (deprecated)\n * - Any resolve data defined using [[Ng1StateDeclaration.resolve]]\n *\n * @ng1api\n * @preferred\n * @module injectables\n */ /** */\n\nimport { StateProvider } from \"./stateProvider\";\nimport {\n StateService, TransitionService, Transition, UrlRouter, UrlMatcherFactory,\n StateParams, StateRegistry, UIRouterGlobals, UIRouter, Trace, UrlService\n} from \"@uirouter/core\";\nimport { UIViewScrollProvider } from \"./viewScroll\";\nimport { UrlRouterProvider } from \"./urlRouterProvider\";\n\n/**\n * The current (or pending) State Parameters\n *\n * An injectable global **Service Object** which holds the state parameters for the latest **SUCCESSFUL** transition.\n *\n * The values are not updated until *after* a `Transition` successfully completes.\n *\n * **Also:** an injectable **Per-Transition Object** object which holds the pending state parameters for the pending `Transition` currently running.\n *\n * ### Deprecation warning:\n *\n * The value injected for `$stateParams` is different depending on where it is injected.\n *\n * - When injected into an angular service, the object injected is the global **Service Object** with the parameter values for the latest successful `Transition`.\n * - When injected into transition hooks, resolves, or view controllers, the object is the **Per-Transition Object** with the parameter values for the running `Transition`.\n *\n * Because of these confusing details, this service is deprecated.\n *\n * ### Instead of using the global `$stateParams` service object,\n * inject [[$uiRouterGlobals]] and use [[UIRouterGlobals.params]]\n *\n * ```js\n * MyService.$inject = ['$uiRouterGlobals'];\n * function MyService($uiRouterGlobals) {\n * return {\n * paramValues: function () {\n * return $uiRouterGlobals.params;\n * }\n * }\n * }\n * ```\n *\n * ### Instead of using the per-transition `$stateParams` object,\n * inject the current `Transition` (as [[$transition$]]) and use [[Transition.params]]\n *\n * ```js\n * MyController.$inject = ['$transition$'];\n * function MyController($transition$) {\n * var username = $transition$.params().username;\n * // .. do something with username\n * }\n * ```\n *\n * ---\n *\n * This object can be injected into other services.\n *\n * #### Deprecated Example:\n * ```js\n * SomeService.$inject = ['$http', '$stateParams'];\n * function SomeService($http, $stateParams) {\n * return {\n * getUser: function() {\n * return $http.get('/api/users/' + $stateParams.username);\n * }\n * }\n * };\n * angular.service('SomeService', SomeService);\n * ```\n * @deprecated\n */\nvar $stateParams: StateParams;\n\n/**\n * Global UI-Router variables\n *\n * The router global state as a **Service Object** (injectable during runtime).\n *\n * This object contains globals such as the current state and current parameter values.\n */\nvar $uiRouterGlobals: UIRouterGlobals;\n\n/**\n * The UI-Router instance\n *\n * The [[UIRouter]] singleton (the router instance) as a **Service Object** (injectable during runtime).\n *\n * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap.\n * It has references to the other UI-Router services\n *\n * #### Note: This object is also exposed as [[$uiRouterProvider]] for injection during angular config time.\n */\nlet $uiRouter: UIRouter ;\n\n/**\n * The UI-Router instance\n *\n * The [[UIRouter]] singleton (the router instance) as a **Provider Object** (injectable during config phase).\n *\n * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap.\n * It has references to the other UI-Router services\n *\n * #### Note: This object is also exposed as [[$uiRouter]] for injection during runtime.\n */\nvar $uiRouterProvider: UIRouter;\n\n/**\n * Transition debug/tracing\n *\n * The [[Trace]] singleton as a **Service Object** (injectable during runtime).\n *\n * Enables or disables Transition tracing which can help to debug issues.\n */\nvar $trace: Trace;\n\n/**\n * The Transition Service\n *\n * The [[TransitionService]] singleton as a **Service Object** (injectable during runtime).\n *\n * This angular service exposes the [[TransitionService]] singleton, which is primarily\n * used to register global transition hooks.\n *\n * #### Note: This object is also exposed as [[$transitionsProvider]] for injection during the config phase.\n */\nvar $transitions: TransitionService;\n\n/**\n * The Transition Service\n *\n * The [[TransitionService]] singleton as a **Provider Object** (injectable during config phase)\n *\n * This angular service exposes the [[TransitionService]] singleton, which is primarily\n * used to register global transition hooks.\n *\n * #### Note: This object is also exposed as [[$transitions]] for injection during runtime.\n */\nvar $transitionsProvider: TransitionService;\n\n/**\n * The current [[Transition]] object\n *\n * The current [[Transition]] object as a **Per-Transition Object** (injectable into Resolve, Hooks, Controllers)\n *\n * This object returns information about the current transition, including:\n *\n * - To/from states\n * - To/from parameters\n * - Transition options\n * - States being entered, exited, and retained\n * - Resolve data\n * - A Promise for the transition\n * - Any transition failure information\n * - An injector for both Service and Per-Transition Objects\n */\nvar $transition$: Transition;\n\n/**\n * The State Service\n *\n * The [[StateService]] singleton as a **Service Object** (injectable during runtime).\n *\n * This service used to manage and query information on registered states.\n * It exposes state related APIs including:\n *\n * - Start a [[Transition]]\n * - Imperatively lazy load states\n * - Check if a state is currently active\n * - Look up states by name\n * - Build URLs for a state+parameters\n * - Configure the global Transition error handler\n *\n * This angular service exposes the [[StateService]] singleton.\n */\nvar $state: StateService;\n\n/**\n * The State Registry\n *\n * The [[StateRegistry]] singleton as a **Service Object** (injectable during runtime).\n *\n * This service is used to register/deregister states.\n * It has state registration related APIs including:\n *\n * - Register/deregister states\n * - Listen for state registration/deregistration\n * - Get states by name\n * - Add state decorators (to customize the state creation process)\n *\n * #### Note: This object is also exposed as [[$stateRegistryProvider]] for injection during the config phase.\n */\nvar $stateRegistry: StateRegistry;\n\n/**\n * The State Registry\n *\n * The [[StateRegistry]] singleton as a **Provider Object** (injectable during config time).\n *\n * This service is used to register/deregister states.\n * It has state registration related APIs including:\n *\n * - Register/deregister states\n * - Listen for state registration/deregistration\n * - Get states by name\n * - Add state decorators (to customize the state creation process)\n *\n * #### Note: This object is also exposed as [[$stateRegistry]] for injection during runtime.\n */\nvar $stateRegistryProvider: StateRegistry;\n\n/**\n * The View Scroll provider\n *\n * The [[UIViewScrollProvider]] as a **Provider Object** (injectable during config time).\n *\n * This angular service exposes the [[UIViewScrollProvider]] singleton and is\n * used to disable UI-Router's scroll behavior.\n */\nvar $uiViewScrollProvider: UIViewScrollProvider;\n\n/**\n * The View Scroll function\n *\n * The View Scroll function as a **Service Object** (injectable during runtime).\n *\n * This is a function that scrolls an element into view.\n * The element is scrolled after a `$timeout` so the DOM has time to refresh.\n *\n * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor,\n * this can be enabled by calling [[UIViewScrollProvider.useAnchorScroll]].\n *\n * Note: this function is used by the [[directives.uiView]] when the `autoscroll` expression evaluates to true.\n */\nvar $uiViewScroll: ($element: JQuery) => void;\n\n/**\n * The StateProvider\n *\n * An angular1-only [[StateProvider]] as a **Provider Object** (injectable during config time).\n *\n * This angular service exposes the [[StateProvider]] singleton.\n *\n * The `StateProvider` is primarily used to register states or add custom state decorators.\n *\n * ##### Note: This provider is a ng1 vestige.\n * It is a passthrough to [[$stateRegistry]] and [[$state]].\n */\nvar $stateProvider: StateProvider;\n\n/**\n * The URL Service Provider\n *\n * The [[UrlService]] singleton as a **Provider Object** (injectable during the angular config phase).\n *\n * A service used to configure and interact with the URL.\n * It has URL related APIs including:\n *\n * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]])\n * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]])\n * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]])\n * - delay initial URL synchronization [[UrlService.deferIntercept]].\n * - get or set the current url: [[UrlService.url]]\n *\n * ##### Note: This service can also be injected during runtime as [[$urlService]].\n */\nvar $urlServiceProvider: UrlService;\n\n/**\n * The URL Service\n *\n * The [[UrlService]] singleton as a **Service Object** (injectable during runtime).\n *\n * Note: This service can also be injected during the config phase as [[$urlServiceProvider]].\n *\n * Used to configure the URL.\n * It has URL related APIs including:\n *\n * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]])\n * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]])\n * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]])\n * - delay initial URL synchronization [[UrlService.deferIntercept]].\n * - get or set the current url: [[UrlService.url]]\n *\n * ##### Note: This service can also be injected during the config phase as [[$urlServiceProvider]].\n */\nvar $urlService: UrlService;\n\n/**\n * The URL Router Provider\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlServiceProvider]] instead.\n *\n * The [[UrlRouter]] singleton as a **Provider Object** (injectable during config time).\n *\n * #### Note: This object is also exposed as [[$urlRouter]] for injection during runtime.\n *\n * @deprecated\n */\nvar $urlRouterProvider: UrlRouterProvider;\n\n/**\n * The Url Router\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.\n *\n * The [[UrlRouter]] singleton as a **Service Object** (injectable during runtime).\n *\n * #### Note: This object is also exposed as [[$urlRouterProvider]] for injection during angular config time.\n *\n * @deprecated\n */\nvar $urlRouter: UrlRouter;\n\n/**\n * The URL Matcher Factory\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.\n *\n * The [[UrlMatcherFactory]] singleton as a **Service Object** (injectable during runtime).\n *\n * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects.\n *\n * #### Note: This object is also exposed as [[$urlMatcherFactoryProvider]] for injection during angular config time.\n *\n * @deprecated\n */\nvar $urlMatcherFactory: UrlMatcherFactory;\n\n/**\n * The URL Matcher Factory\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.\n *\n * The [[UrlMatcherFactory]] singleton as a **Provider Object** (injectable during config time).\n *\n * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects.\n *\n * #### Note: This object is also exposed as [[$urlMatcherFactory]] for injection during runtime.\n *\n * @deprecated\n */\nvar $urlMatcherFactoryProvider: UrlMatcherFactory;\n\n\n\n", - "/**\n * # Angular 1 Directives\n *\n * These are the directives included in UI-Router for Angular 1.\n * These directives are used in templates to create viewports and link/navigate to states.\n *\n * @ng1api\n * @preferred\n * @module directives\n */ /** for typedoc */\nimport { ng as angular } from \"../angular\";\nimport { IAugmentedJQuery, ITimeoutService, IScope, IInterpolateService } from \"angular\";\n\nimport {\n Obj, extend, forEach, tail, isString, isObject, isArray, parse, noop, unnestR, identity, uniqR, inArray, removeFrom,\n RawParams, PathNode, StateOrName, StateService, StateDeclaration, UIRouter\n} from \"@uirouter/core\";\nimport { UIViewData } from \"./viewDirective\";\n\n/** @hidden Used for typedoc */\nexport interface ng1_directive {}\n\n/** @hidden */\nfunction parseStateRef(ref: string) {\n let paramsOnly = ref.match(/^\\s*({[^}]*})\\s*$/), parsed;\n if (paramsOnly) ref = '(' + paramsOnly[1] + ')';\n\n parsed = ref.replace(/\\n/g, \" \").match(/^\\s*([^(]*?)\\s*(\\((.*)\\))?\\s*$/);\n if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n return { state: parsed[1] || null, paramExpr: parsed[3] || null };\n}\n\n/** @hidden */\nfunction stateContext(el: IAugmentedJQuery) {\n let $uiView: UIViewData = (el.parent() as IAugmentedJQuery).inheritedData('$uiView');\n let path: PathNode[] = parse('$cfg.path')($uiView);\n return path ? tail(path).state.name : undefined;\n}\n\n/** @hidden */\nfunction processedDef($state: StateService, $element: IAugmentedJQuery, def: Def): Def {\n let uiState = def.uiState || $state.current.name;\n let uiStateOpts = extend(defaultOpts($element, $state), def.uiStateOpts || {});\n let href = $state.href(uiState, def.uiStateParams, uiStateOpts);\n return { uiState, uiStateParams: def.uiStateParams, uiStateOpts, href };\n}\n\n/** @hidden */\ninterface TypeInfo {\n attr: string;\n isAnchor: boolean;\n clickable: boolean;\n}\n\n/** @hidden */\nfunction getTypeInfo(el: IAugmentedJQuery): TypeInfo {\n // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.\n var isSvg = Object.prototype.toString.call(el.prop('href')) === '[object SVGAnimatedString]';\n var isForm = el[0].nodeName === \"FORM\";\n\n return {\n attr: isForm ? \"action\" : (isSvg ? 'xlink:href' : 'href'),\n isAnchor: el.prop(\"tagName\").toUpperCase() === \"A\",\n clickable: !isForm\n };\n}\n\n/** @hidden */\nfunction clickHook(el: IAugmentedJQuery, $state: StateService, $timeout: ITimeoutService, type: TypeInfo, getDef: () => Def) {\n return function (e: JQueryMouseEventObject) {\n var button = e.which || e.button, target = getDef();\n\n if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || el.attr('target'))) {\n // HACK: This is to allow ng-clicks to be processed before the transition is initiated:\n var transition = $timeout(function () {\n $state.go(target.uiState, target.uiStateParams, target.uiStateOpts);\n });\n e.preventDefault();\n\n // if the state has no URL, ignore one preventDefault from the directive.\n var ignorePreventDefaultCount = type.isAnchor && !target.href ? 1 : 0;\n\n e.preventDefault = function () {\n if (ignorePreventDefaultCount-- <= 0) $timeout.cancel(transition);\n };\n }\n };\n}\n\n/** @hidden */\nfunction defaultOpts(el: IAugmentedJQuery, $state: StateService) {\n return {\n relative: stateContext(el) || $state.$current,\n inherit: true,\n source: \"sref\"\n };\n}\n\n/** @hidden */\nfunction bindEvents(element: IAugmentedJQuery, scope: IScope, hookFn: (e: JQueryMouseEventObject) => void, uiStateOpts: any): void {\n let events;\n\n if (uiStateOpts) {\n events = uiStateOpts.events;\n }\n\n if (!isArray(events)) {\n events = ['click'];\n }\n\n let on = element.on ? 'on' : 'bind';\n for (let event of events) {\n element[on](event, hookFn);\n }\n\n scope.$on('$destroy', function() {\n let off = element.off ? 'off' : 'unbind';\n for (let event of events) {\n element[off](event, hookFn);\n }\n });\n}\n\n/**\n * `ui-sref`: A directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of the `ui-sref` is the name of the state to link to.\n *\n * #### Example:\n * This will activate the `home` state when the link is clicked.\n * ```html\n * Home\n * ```\n *\n * ### Relative Links\n * You can also use relative state paths within `ui-sref`, just like a relative path passed to `$state.go()` ([[StateService.go]]).\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create a relative `ui-sref` which always targets the same destination.\n *\n * #### Example:\n * Both these links are relative to the parent state, even when a child state is currently active.\n * ```html\n * child 1 state\n * child 2 state\n * ```\n *\n * This link activates the parent state.\n * ```html\n * Return\n * ```\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]] method).\n *\n * #### Example:\n * Assuming the `users` state has a url of `/users/`\n * ```html\n * Users\n * ```\n *\n * ### Parameter Values\n * In addition to the state name, a `ui-sref` can include parameter values which are applied when activating the state.\n * Param values can be provided in the `ui-sref` value after the state name, enclosed by parentheses.\n * The content inside the parentheses is an expression, evaluated to the parameter values.\n *\n * #### Example:\n * This example renders a list of links to users.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n *
  • \n * {{ user.displayName }}\n *
  • \n * ```\n *\n * Note:\n * The parameter values expression is `$watch`ed for updates.\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-sref-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n *\n * #### Example:\n * ```html\n * Home\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-sref-opts` attribute.\n *\n * #### Example:\n * ```html\n * \n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Examples\n * If you have the following template:\n *\n * ```html\n * Home\n * About\n * Next page\n *\n * \n * ```\n *\n * Then (assuming the current state is `contacts`) the rendered html including hrefs would be:\n *\n * ```html\n * Home\n * About\n * Next page\n *\n *
      \n *
    • \n * Joe\n *
    • \n *
    • \n * Alice\n *
    • \n *
    • \n * Bob\n *
    • \n *
    \n *\n * Home\n * ```\n *\n * ### Notes\n *\n * - You can use `ui-sref` to change **only the parameter values** by omitting the state name and parentheses.\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * English\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n *\n * - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons).\n * If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive.\n */\nlet uiSref: ng1_directive;\nuiSref = ['$uiRouter', '$timeout',\n function $StateRefDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n let $state = $uiRouter.stateService;\n\n return {\n restrict: 'A',\n require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n link: function (scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n let type = getTypeInfo(element);\n let active = uiSrefActive[1] || uiSrefActive[0];\n let unlinkInfoFn: Function = null;\n let hookFn;\n\n let rawDef = {} as Def;\n let getDef = () => processedDef($state, element, rawDef);\n\n let ref = parseStateRef(attrs.uiSref);\n rawDef.uiState = ref.state;\n rawDef.uiStateOpts = attrs.uiSrefOpts ? scope.$eval(attrs.uiSrefOpts) : {};\n\n function update() {\n let def = getDef();\n if (unlinkInfoFn) unlinkInfoFn();\n if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n if (def.href != null) attrs.$set(type.attr, def.href);\n }\n\n if (ref.paramExpr) {\n scope.$watch(ref.paramExpr, function (val) {\n rawDef.uiStateParams = extend({}, val);\n update();\n }, true);\n rawDef.uiStateParams = extend({}, scope.$eval(ref.paramExpr));\n }\n\n update();\n\n scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update));\n scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update));\n\n if (!type.clickable) return;\n hookFn = clickHook(element, $state, $timeout, type, getDef);\n bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n }\n };\n }];\n\n/**\n * `ui-state`: A fully dynamic directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * **This directive is very similar to [[uiSref]], but it `$observe`s and `$watch`es/evaluates all its inputs.**\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of `ui-state` is an expression which is `$watch`ed and evaluated as the state to link to.\n * **This is in contrast with `ui-sref`, which takes a state name as a string literal.**\n *\n * #### Example:\n * Create a list of links.\n * ```html\n *
  • \n * {{ link.displayName }}\n *
  • \n * ```\n *\n * ### Relative Links\n * If the expression evaluates to a relative path, it is processed like [[uiSref]].\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create relative `ui-state` which always targets the same destination.\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]] method).\n *\n * ### Parameter Values\n * In addition to the state name expression, a `ui-state` can include parameter values which are applied when activating the state.\n * Param values should be provided using the `ui-state-params` attribute.\n * The `ui-state-params` attribute value is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * This example renders a list of links with param values.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n *
  • \n * {{ link.displayName }}\n *
  • \n * ```\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-state-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n * The value of the `ui-state-opts` is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * ```html\n * Home\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-state-opts` attribute.\n *\n * #### Example:\n * ```html\n * \n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Notes\n *\n * - You can use `ui-params` to change **only the parameter values** by omitting the state name and supplying only `ui-state-params`.\n * However, it might be simpler to use [[uiSref]] parameter-only links.\n *\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * English\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n * ```\n */\nlet uiState: ng1_directive;\nuiState = ['$uiRouter', '$timeout',\n function $StateRefDynamicDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n let $state = $uiRouter.stateService;\n\n return {\n restrict: 'A',\n require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n link: function (scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n let type = getTypeInfo(element);\n let active = uiSrefActive[1] || uiSrefActive[0];\n let unlinkInfoFn: Function = null;\n let hookFn;\n\n let rawDef = {} as Def;\n let getDef = () => processedDef($state, element, rawDef);\n\n let inputAttrs = ['uiState', 'uiStateParams', 'uiStateOpts'];\n let watchDeregFns = inputAttrs.reduce((acc, attr) => (acc[attr] = noop, acc), {});\n\n function update() {\n let def = getDef();\n if (unlinkInfoFn) unlinkInfoFn();\n if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n if (def.href != null) attrs.$set(type.attr, def.href);\n }\n\n inputAttrs.forEach((field) => {\n rawDef[field] = attrs[field] ? scope.$eval(attrs[field]) : null;\n\n attrs.$observe(field, (expr) => {\n watchDeregFns[field]();\n watchDeregFns[field] = scope.$watch(expr, (newval) => {\n rawDef[field] = newval;\n update();\n }, true);\n })\n });\n\n update();\n\n scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update));\n scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update));\n\n if (!type.clickable) return;\n hookFn = clickHook(element, $state, $timeout, type, getDef);\n bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n }\n };\n }];\n\n\n/**\n * `ui-sref-active` and `ui-sref-active-eq`: A directive that adds a CSS class when a `ui-sref` is active\n *\n * A directive working alongside [[uiSref]] and [[uiState]] to add classes to an element when the\n * related directive's state is active (and remove them when it is inactive).\n *\n * The primary use-case is to highlight the active link in navigation menus,\n * distinguishing it from the inactive menu items.\n *\n * ### Linking to a `ui-sref` or `ui-state`\n * `ui-sref-active` can live on the same element as `ui-sref`/`ui-state`, or it can be on a parent element.\n * If a `ui-sref-active` is a parent to more than one `ui-sref`/`ui-state`, it will apply the CSS class when **any of the links are active**.\n *\n * ### Matching\n *\n * The `ui-sref-active` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state **or any child state is active**.\n * This is a \"fuzzy match\" which uses [[StateService.includes]].\n *\n * The `ui-sref-active-eq` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state is directly active (not when child states are active).\n * This is an \"exact match\" which uses [[StateService.is]].\n *\n * ### Parameter values\n * If the `ui-sref`/`ui-state` includes parameter values, the current parameter values must match the link's values for the link to be highlighted.\n * This allows a list of links to the same state with different parameters to be rendered, and the correct one highlighted.\n *\n * #### Example:\n * ```html\n *
  • \n * {{ user.lastName }}\n *
  • \n * ```\n *\n * ### Examples\n *\n * Given the following template:\n * #### Example:\n * ```html\n * \n * ```\n *\n * When the app state is `app.user` (or any child state),\n * and contains the state parameter \"user\" with value \"bilbobaggins\",\n * the resulting HTML will appear as (note the 'active' class):\n *\n * ```html\n * \n * ```\n *\n * ### Glob mode\n *\n * It is possible to pass `ui-sref-active` an expression that evaluates to an object.\n * The objects keys represent active class names and values represent the respective state names/globs.\n * `ui-sref-active` will match if the current active state **includes** any of\n * the specified state names/globs, even the abstract ones.\n *\n * #### Example:\n * Given the following template, with \"admin\" being an abstract state:\n * ```html\n *
    \n * Roles\n *
    \n * ```\n *\n * When the current state is \"admin.roles\" the \"active\" class will be applied to both the `
    ` and `` elements.\n * It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`.\n *\n * ### Notes:\n *\n * - The class name is interpolated **once** during the directives link time (any further changes to the\n * interpolated value are ignored).\n *\n * - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'`\n */\nlet uiSrefActive: ng1_directive;\nuiSrefActive = ['$state', '$stateParams', '$interpolate', '$uiRouter',\n function $StateRefActiveDirective($state: StateService, $stateParams: Obj, $interpolate: IInterpolateService, $uiRouter: UIRouter) {\n return {\n restrict: \"A\",\n controller: ['$scope', '$element', '$attrs',\n function ($scope: IScope, $element: IAugmentedJQuery, $attrs: any) {\n let states: StateData[] = [],\n activeEqClass: string,\n uiSrefActive: any;\n\n // There probably isn't much point in $observing this\n // uiSrefActive and uiSrefActiveEq share the same directive object with some\n // slight difference in logic routing\n activeEqClass = $interpolate($attrs.uiSrefActiveEq || '', false)($scope);\n\n try {\n uiSrefActive = $scope.$eval($attrs.uiSrefActive);\n } catch (e) {\n // Do nothing. uiSrefActive is not a valid expression.\n // Fall back to using $interpolate below\n }\n uiSrefActive = uiSrefActive || $interpolate($attrs.uiSrefActive || '', false)($scope);\n if (isObject(uiSrefActive)) {\n forEach(uiSrefActive, function (stateOrName: StateOrName, activeClass: string) {\n if (isString(stateOrName)) {\n let ref = parseStateRef(stateOrName);\n addState(ref.state, $scope.$eval(ref.paramExpr), activeClass);\n }\n });\n }\n\n // Allow uiSref to communicate with uiSrefActive[Equals]\n this.$$addStateInfo = function (newState: string, newParams: Obj) {\n // we already got an explicit state provided by ui-sref-active, so we\n // shadow the one that comes from ui-sref\n if (isObject(uiSrefActive) && states.length > 0) {\n return;\n }\n let deregister = addState(newState, newParams, uiSrefActive);\n update();\n return deregister;\n };\n\n function updateAfterTransition(trans) {\n trans.promise.then(update, noop);\n }\n\n $scope.$on('$stateChangeSuccess', update);\n $scope.$on('$destroy', $uiRouter.transitionService.onStart({}, updateAfterTransition));\n if ($uiRouter.globals.transition) {\n updateAfterTransition($uiRouter.globals.transition);\n }\n\n function addState(stateName: string, stateParams: Obj, activeClass: string) {\n var state = $state.get(stateName, stateContext($element));\n\n var stateInfo = {\n state: state || { name: stateName },\n params: stateParams,\n activeClass: activeClass\n };\n\n states.push(stateInfo);\n\n return function removeState() {\n removeFrom(states)(stateInfo);\n }\n }\n\n // Update route state\n function update() {\n const splitClasses = str =>\n str.split(/\\s/).filter(identity);\n const getClasses = (stateList: StateData[]) =>\n stateList.map(x => x.activeClass).map(splitClasses).reduce(unnestR, []);\n\n let allClasses = getClasses(states).concat(splitClasses(activeEqClass)).reduce(uniqR, []);\n let fuzzyClasses = getClasses(states.filter(x => $state.includes(x.state.name, x.params)));\n let exactlyMatchesAny = !!states.filter(x => $state.is(x.state.name, x.params)).length;\n let exactClasses = exactlyMatchesAny ? splitClasses(activeEqClass) : [];\n\n let addClasses = fuzzyClasses.concat(exactClasses).reduce(uniqR, []);\n let removeClasses = allClasses.filter(cls => !inArray(addClasses, cls));\n\n $scope.$evalAsync(() => {\n addClasses.forEach(className => $element.addClass(className));\n removeClasses.forEach(className => $element.removeClass(className));\n });\n }\n\n update();\n }]\n };\n }];\n\n/** @hidden */\ninterface Def { uiState: string; href: string; uiStateParams: Obj; uiStateOpts: any; }\n/** @hidden */\ninterface StateData { state: StateDeclaration; params: RawParams; activeClass: string; }\n\nangular.module('ui.router.state')\n .directive('uiSref', uiSref)\n .directive('uiSrefActive', uiSrefActive)\n .directive('uiSrefActiveEq', uiSrefActive)\n .directive('uiState', uiState);\n", - "/** @module ng1 */ /** for typedoc */\n\nimport { ng as angular } from \"./angular\";\nimport { Obj, StateService, StateOrName } from \"@uirouter/core\";\n\n/**\n * `isState` Filter: truthy if the current state is the parameter\n *\n * Translates to [[StateService.is]] `$state.is(\"stateName\")`.\n *\n * #### Example:\n * ```html\n *
    show if state is 'stateName'
    \n * ```\n */\n$IsStateFilter.$inject = ['$state'];\nexport function $IsStateFilter($state: StateService) {\n var isFilter: any = function(state: StateOrName, params: Obj, options?: { relative?: StateOrName }) {\n return $state.is(state, params, options);\n };\n isFilter.$stateful = true;\n return isFilter;\n}\n\n/**\n * `includedByState` Filter: truthy if the current state includes the parameter\n *\n * Translates to [[StateService.includes]]` $state.is(\"fullOrPartialStateName\")`.\n *\n * #### Example:\n * ```html\n *
    show if state includes 'fullOrPartialStateName'
    \n * ```\n */\n$IncludedByStateFilter.$inject = ['$state'];\nexport function $IncludedByStateFilter($state: StateService) {\n var includesFilter: any = function(state: StateOrName, params: Obj, options: { relative?: StateOrName }) {\n return $state.includes(state, params, options);\n };\n includesFilter.$stateful = true;\n return includesFilter;\n}\n\nangular.module('ui.router.state')\n .filter('isState', $IsStateFilter)\n .filter('includedByState', $IncludedByStateFilter);\n", - "/** \n * @ng1api \n * @module directives \n */ /** for typedoc */\nimport { ng as angular } from \"../angular\";\nimport { IInterpolateService, IScope, ITranscludeFunction, IAugmentedJQuery, ITimeoutService } from \"angular\";\n\nimport {\n extend, unnestR, filter, tail, isDefined, isFunction, isString, trace, parse,\n ActiveUIView, TransitionService, ResolveContext, Transition, PathNode, StateDeclaration,\n Param, kebobString, HookRegOptions, ViewService, $QLike, Obj, TypedMap, noop,\n} from \"@uirouter/core\";\nimport {Ng1ViewConfig} from \"../statebuilders/views\";\nimport {Ng1Controller, Ng1StateDeclaration} from \"../interface\";\nimport {getLocals} from \"../services\";\nimport { ng1_directive } from \"./stateDirectives\";\n\n/** @hidden */\nexport type UIViewData = {\n $cfg: Ng1ViewConfig;\n $uiView: ActiveUIView;\n}\n\n/** @hidden */\nexport type UIViewAnimData = {\n $animEnter: Promise;\n $animLeave: Promise;\n $$animLeave: { resolve: () => any; } // \"deferred\"\n}\n\n/**\n * `ui-view`: A viewport directive which is filled in by a view from the active state.\n *\n * ### Attributes\n *\n * - `name`: (Optional) A view name.\n * The name should be unique amongst the other views in the same state.\n * You can have views of the same name that live in different states.\n * The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]).\n *\n * - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated.\n * Uses [[$uiViewScroll]] to do the scrolling.\n *\n * - `onload`: Expression to evaluate whenever the view updates.\n *\n * #### Example:\n * A view can be unnamed or named.\n * ```html\n * \n *
    \n *\n * \n *
    \n *\n * \n * \n * ```\n *\n * You can only have one unnamed view within any template (or root html). If you are only using a\n * single view and it is unnamed then you can populate it like so:\n *\n * ```html\n *
    \n * $stateProvider.state(\"home\", {\n * template: \"

    HELLO!

    \"\n * })\n * ```\n *\n * The above is a convenient shortcut equivalent to specifying your view explicitly with the\n * [[Ng1StateDeclaration.views]] config property, by name, in this case an empty name:\n *\n * ```js\n * $stateProvider.state(\"home\", {\n * views: {\n * \"\": {\n * template: \"

    HELLO!

    \"\n * }\n * }\n * })\n * ```\n *\n * But typically you'll only use the views property if you name your view or have more than one view\n * in the same template. There's not really a compelling reason to name a view if its the only one,\n * but you could if you wanted, like so:\n *\n * ```html\n *
    \n * ```\n *\n * ```js\n * $stateProvider.state(\"home\", {\n * views: {\n * \"main\": {\n * template: \"

    HELLO!

    \"\n * }\n * }\n * })\n * ```\n *\n * Really though, you'll use views to set up multiple views:\n *\n * ```html\n *
    \n *
    \n *
    \n * ```\n *\n * ```js\n * $stateProvider.state(\"home\", {\n * views: {\n * \"\": {\n * template: \"

    HELLO!

    \"\n * },\n * \"chart\": {\n * template: \"\"\n * },\n * \"data\": {\n * template: \"\"\n * }\n * }\n * })\n * ```\n *\n * #### Examples for `autoscroll`:\n * ```html\n * \n * \n *\n * \n * \n * \n * \n * ```\n *\n * Resolve data:\n *\n * The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this\n * can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template.\n *\n * Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the\n * controller is instantiated. The `$onInit()` hook can be used to perform initialization code which\n * depends on `$resolve` data.\n *\n * #### Example:\n * ```js\n * $stateProvider.state('home', {\n * template: '',\n * resolve: {\n * user: function(UserService) { return UserService.fetchUser(); }\n * }\n * });\n * ```\n */\nexport let uiView: ng1_directive;\nuiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q',\nfunction $ViewDirective($view: ViewService, $animate: any, $uiViewScroll: any, $interpolate: IInterpolateService, $q: $QLike) {\n\n function getRenderer(attrs: Obj, scope: IScope) {\n return {\n enter: function(element: JQuery, target: any, cb: Function) {\n if (angular.version.minor > 2) {\n $animate.enter(element, null, target).then(cb);\n } else {\n $animate.enter(element, null, target, cb);\n }\n },\n leave: function(element: JQuery, cb: Function) {\n if (angular.version.minor > 2) {\n $animate.leave(element).then(cb);\n } else {\n $animate.leave(element, cb);\n }\n }\n };\n }\n\n function configsEqual(config1: Ng1ViewConfig, config2: Ng1ViewConfig) {\n return config1 === config2;\n }\n\n let rootData = {\n $cfg: { viewDecl: { $context: $view._pluginapi._rootViewContext() } },\n $uiView: { }\n };\n\n let directive = {\n count: 0,\n restrict: 'ECA',\n terminal: true,\n priority: 400,\n transclude: 'element',\n compile: function (tElement: JQuery, tAttrs: Obj, $transclude: ITranscludeFunction) {\n\n return function (scope: IScope, $element: IAugmentedJQuery, attrs: Obj) {\n let previousEl: JQuery, currentEl: JQuery,\n currentScope: IScope, unregister: Function,\n onloadExp = attrs['onload'] || '',\n autoScrollExp = attrs['autoscroll'],\n renderer = getRenderer(attrs, scope),\n viewConfig = undefined as Ng1ViewConfig,\n inherited = $element.inheritedData('$uiView') || rootData,\n name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default';\n\n let activeUIView: ActiveUIView = {\n $type: 'ng1',\n id: directive.count++, // Global sequential ID for ui-view tags added to DOM\n name: name, // ui-view name (
    \n fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + \".\" + name : name, // fully qualified name, describes location in DOM\n config: null, // The ViewConfig loaded (from a state.views definition)\n configUpdated: configUpdatedCallback, // Called when the matching ViewConfig changes\n get creationContext() { // The context in which this ui-view \"tag\" was created\n let fromParentTagConfig = parse('$cfg.viewDecl.$context')(inherited);\n // Allow \n // See https://github.com/angular-ui/ui-router/issues/3355\n let fromParentTag = parse('$uiView.creationContext')(inherited);\n return fromParentTagConfig || fromParentTag;\n }\n };\n\n trace.traceUIViewEvent(\"Linking\", activeUIView);\n\n function configUpdatedCallback(config?: Ng1ViewConfig) {\n if (config && !(config instanceof Ng1ViewConfig)) return;\n if (configsEqual(viewConfig, config)) return;\n trace.traceUIViewConfigUpdated(activeUIView, config && config.viewDecl && config.viewDecl.$context);\n\n viewConfig = config;\n updateView(config);\n }\n\n $element.data('$uiView', { $uiView: activeUIView });\n\n updateView();\n\n unregister = $view.registerUIView(activeUIView);\n scope.$on(\"$destroy\", function() {\n trace.traceUIViewEvent(\"Destroying/Unregistering\", activeUIView);\n unregister();\n });\n\n function cleanupLastView() {\n if (previousEl) {\n trace.traceUIViewEvent(\"Removing (previous) el\", previousEl.data('$uiView'));\n previousEl.remove();\n previousEl = null;\n }\n\n if (currentScope) {\n trace.traceUIViewEvent(\"Destroying scope\", activeUIView);\n currentScope.$destroy();\n currentScope = null;\n }\n\n if (currentEl) {\n let _viewData = currentEl.data('$uiViewAnim');\n trace.traceUIViewEvent(\"Animate out\", _viewData);\n renderer.leave(currentEl, function() {\n _viewData.$$animLeave.resolve();\n previousEl = null;\n });\n\n previousEl = currentEl;\n currentEl = null;\n }\n }\n\n function updateView(config?: Ng1ViewConfig) {\n let newScope = scope.$new();\n let animEnter = $q.defer(), animLeave = $q.defer();\n\n let $uiViewData: UIViewData = {\n $cfg: config,\n $uiView: activeUIView,\n };\n\n let $uiViewAnim: UIViewAnimData = {\n $animEnter: animEnter.promise,\n $animLeave: animLeave.promise,\n $$animLeave: animLeave\n };\n\n /**\n * @ngdoc event\n * @name ui.router.state.directive:ui-view#$viewContentLoading\n * @eventOf ui.router.state.directive:ui-view\n * @eventType emits on ui-view directive scope\n * @description\n *\n * Fired once the view **begins loading**, *before* the DOM is rendered.\n *\n * @param {Object} event Event object.\n * @param {string} viewName Name of the view.\n */\n newScope.$emit('$viewContentLoading', name);\n\n let cloned = $transclude(newScope, function(clone) {\n clone.data('$uiViewAnim', $uiViewAnim);\n clone.data('$uiView', $uiViewData);\n renderer.enter(clone, $element, function onUIViewEnter() {\n animEnter.resolve();\n if (currentScope) currentScope.$emit('$viewContentAnimationEnded');\n\n if (isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {\n $uiViewScroll(clone);\n }\n });\n\n cleanupLastView();\n });\n\n currentEl = cloned;\n currentScope = newScope;\n /**\n * @ngdoc event\n * @name ui.router.state.directive:ui-view#$viewContentLoaded\n * @eventOf ui.router.state.directive:ui-view\n * @eventType emits on ui-view directive scope\n * @description *\n * Fired once the view is **loaded**, *after* the DOM is rendered.\n *\n * @param {Object} event Event object.\n */\n currentScope.$emit('$viewContentLoaded', config || viewConfig);\n currentScope.$eval(onloadExp);\n }\n };\n }\n };\n\n return directive;\n}];\n\n$ViewDirectiveFill.$inject = ['$compile', '$controller', '$transitions', '$view', '$q', '$timeout'];\n/** @hidden */\nfunction $ViewDirectiveFill($compile: angular.ICompileService,\n $controller: angular.IControllerService,\n $transitions: TransitionService,\n $view: ViewService,\n $q: angular.IQService,\n $timeout: ITimeoutService) {\n const getControllerAs = parse('viewDecl.controllerAs');\n const getResolveAs = parse('viewDecl.resolveAs');\n\n return {\n restrict: 'ECA',\n priority: -400,\n compile: function (tElement: JQuery) {\n let initial = tElement.html();\n tElement.empty();\n\n return function (scope: IScope, $element: JQuery) {\n let data: UIViewData = $element.data('$uiView');\n if (!data) {\n $element.html(initial);\n $compile($element.contents() as any)(scope);\n return;\n }\n\n let cfg: Ng1ViewConfig = data.$cfg || { viewDecl: {}, getTemplate: noop };\n let resolveCtx: ResolveContext = cfg.path && new ResolveContext(cfg.path);\n $element.html(cfg.getTemplate($element, resolveCtx) || initial);\n trace.traceUIViewFill(data.$uiView, $element.html());\n\n let link = $compile($element.contents() as any);\n let controller = cfg.controller;\n let controllerAs: string = getControllerAs(cfg);\n let resolveAs: string = getResolveAs(cfg);\n let locals = resolveCtx && getLocals(resolveCtx);\n\n scope[resolveAs] = locals;\n\n if (controller) {\n let controllerInstance = $controller(controller, extend({}, locals, { $scope: scope, $element: $element }));\n if (controllerAs) {\n scope[controllerAs] = controllerInstance;\n scope[controllerAs][resolveAs] = locals;\n }\n\n // TODO: Use $view service as a central point for registering component-level hooks\n // Then, when a component is created, tell the $view service, so it can invoke hooks\n // $view.componentLoaded(controllerInstance, { $scope: scope, $element: $element });\n // scope.$on('$destroy', () => $view.componentUnloaded(controllerInstance, { $scope: scope, $element: $element }));\n\n $element.data('$ngControllerController', controllerInstance);\n $element.children().data('$ngControllerController', controllerInstance);\n\n registerControllerCallbacks($q, $transitions, controllerInstance, scope, cfg);\n }\n\n // Wait for the component to appear in the DOM\n if (isString(cfg.viewDecl.component)) {\n let cmp = cfg.viewDecl.component;\n let kebobName = kebobString(cmp);\n let tagRegexp = new RegExp(`^(x-|data-)?${kebobName}$`, \"i\");\n\n let getComponentController = () => {\n let directiveEl = [].slice.call($element[0].children)\n .filter((el: Element) => el && el.tagName && tagRegexp.exec(el.tagName)) ;\n \n return directiveEl && angular.element(directiveEl).data(`$${cmp}Controller`);\n };\n\n let deregisterWatch = scope.$watch(getComponentController, function(ctrlInstance) {\n if (!ctrlInstance) return;\n registerControllerCallbacks($q, $transitions, ctrlInstance, scope, cfg);\n deregisterWatch();\n });\n }\n\n link(scope);\n };\n }\n };\n}\n\n/** @hidden */\nlet hasComponentImpl = typeof (angular as any).module('ui.router')['component'] === 'function';\n/** @hidden incrementing id */\nlet _uiCanExitId = 0;\n\n/** @hidden TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */\nfunction registerControllerCallbacks($q: angular.IQService,\n $transitions: TransitionService,\n controllerInstance: Ng1Controller,\n $scope: IScope,\n cfg: Ng1ViewConfig) {\n // Call $onInit() ASAP\n if (isFunction(controllerInstance.$onInit) && !(cfg.viewDecl.component && hasComponentImpl)) {\n controllerInstance.$onInit();\n }\n\n let viewState: Ng1StateDeclaration = tail(cfg.path).state.self;\n\n let hookOptions: HookRegOptions = { bind: controllerInstance };\n // Add component-level hook for onParamsChange\n if (isFunction(controllerInstance.uiOnParamsChanged)) {\n let resolveContext: ResolveContext = new ResolveContext(cfg.path);\n let viewCreationTrans = resolveContext.getResolvable('$transition$').data;\n\n // Fire callback on any successful transition\n const paramsUpdated = ($transition$: Transition) => {\n // Exit early if the $transition$ is the same as the view was created within.\n // Exit early if the $transition$ will exit the state the view is for.\n if ($transition$ === viewCreationTrans || $transition$.exiting().indexOf(viewState as StateDeclaration) !== -1) return;\n\n let toParams = $transition$.params(\"to\") as TypedMap;\n let fromParams = $transition$.params>(\"from\") as TypedMap;\n let toSchema: Param[] = $transition$.treeChanges().to.map((node: PathNode) => node.paramSchema).reduce(unnestR, []);\n let fromSchema: Param[] = $transition$.treeChanges().from.map((node: PathNode) => node.paramSchema).reduce(unnestR, []);\n\n // Find the to params that have different values than the from params\n let changedToParams = toSchema.filter((param: Param) => {\n let idx = fromSchema.indexOf(param);\n return idx === -1 || !fromSchema[idx].type.equals(toParams[param.id], fromParams[param.id]);\n });\n\n // Only trigger callback if a to param has changed or is new\n if (changedToParams.length) {\n let changedKeys: string[] = changedToParams.map(x => x.id);\n // Filter the params to only changed/new to params. `$transition$.params()` may be used to get all params.\n let newValues = filter(toParams, (val, key) => changedKeys.indexOf(key) !== -1);\n controllerInstance.uiOnParamsChanged(newValues, $transition$);\n }\n };\n $scope.$on('$destroy', $transitions.onSuccess({}, paramsUpdated, hookOptions));\n }\n\n // Add component-level hook for uiCanExit\n if (isFunction(controllerInstance.uiCanExit)) {\n let id = _uiCanExitId++;\n let cacheProp = '_uiCanExitIds';\n\n // Returns true if a redirect transition already answered truthy\n const prevTruthyAnswer = (trans: Transition) =>\n !!trans && (trans[cacheProp] && trans[cacheProp][id] === true || prevTruthyAnswer(trans.redirectedFrom()));\n\n // If a user answered yes, but the transition was later redirected, don't also ask for the new redirect transition\n const wrappedHook = (trans: Transition) => {\n let promise, ids = trans[cacheProp] = trans[cacheProp] || {};\n if (!prevTruthyAnswer(trans)) {\n promise = $q.when(controllerInstance.uiCanExit(trans));\n promise.then(val => ids[id] = (val !== false));\n }\n return promise;\n };\n\n let criteria = {exiting: viewState.name};\n $scope.$on('$destroy', $transitions.onBefore(criteria, wrappedHook, hookOptions));\n }\n}\n\nangular.module('ui.router.state').directive('uiView', uiView);\nangular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);\n", - "/** @module ng1 */ /** */\nimport { ng as angular } from \"./angular\";\nimport { IServiceProviderFactory } from \"angular\";\nimport IAnchorScrollService = angular.IAnchorScrollService;\nimport ITimeoutService = angular.ITimeoutService;\n\nexport interface UIViewScrollProvider {\n /**\n * Uses standard anchorScroll behavior\n *\n * Reverts [[$uiViewScroll]] back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)\n * service for scrolling based on the url anchor.\n */\n useAnchorScroll(): void;\n}\n\n\n/** @hidden */\nfunction $ViewScrollProvider() {\n\n var useAnchorScroll = false;\n\n this.useAnchorScroll = function () {\n useAnchorScroll = true;\n };\n\n this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll: IAnchorScrollService, $timeout: ITimeoutService): Function {\n if (useAnchorScroll) {\n return $anchorScroll;\n }\n\n return function ($element: JQuery) {\n return $timeout(function () {\n $element[0].scrollIntoView();\n }, 0, false);\n };\n }];\n}\n\nangular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);\n", - "/**\n * Main entry point for angular 1.x build\n * @module ng1\n */ /** */\n\nexport * from \"./interface\";\nexport * from \"./services\";\nexport * from \"./statebuilders/views\";\nexport * from \"./stateProvider\";\nexport * from \"./urlRouterProvider\";\n\nimport \"./injectables\";\nimport \"./directives/stateDirectives\";\nimport \"./stateFilters\";\nimport \"./directives/viewDirective\";\nimport \"./viewScroll\";\n\nexport default \"ui.router\";\n\nimport * as core from \"@uirouter/core\";\nexport { core };\nexport * from \"@uirouter/core\";\n\n" + "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { UIRouter } from '../router';\nimport { BaseLocationServices } from './baseLocationService';\nimport { LocationConfig, root, splitHash, splitQuery, stripLastPathElement } from '../common';\n\n/**\n * A `LocationServices` that gets/sets the current location using the browser's `location` and `history` apis\n *\n * Uses `history.pushState` and `history.replaceState`\n */\nexport class PushStateLocationService extends BaseLocationServices {\n _config: LocationConfig;\n\n constructor(router: UIRouter) {\n super(router, true);\n this._config = router.urlService.config;\n root.addEventListener('popstate', this._listener, false);\n }\n\n /**\n * Gets the base prefix without:\n * - trailing slash\n * - trailing filename\n * - protocol and hostname\n *\n * If , this returns '/base'.\n * If , this returns '/foo/base'.\n * If , this returns '/base'.\n * If , this returns '/base'.\n * If , this returns ''.\n * If , this returns ''.\n * If , this returns ''.\n *\n * See: https://html.spec.whatwg.org/dev/semantics.html#the-base-element\n */\n private _getBasePrefix() {\n return stripLastPathElement(this._config.baseHref());\n }\n\n protected _get() {\n let { pathname, hash, search } = this._location;\n search = splitQuery(search)[1]; // strip ? if found\n hash = splitHash(hash)[1]; // strip # if found\n\n const basePrefix = this._getBasePrefix();\n const exactBaseHrefMatch = pathname === this._config.baseHref();\n const startsWithBase = pathname.substr(0, basePrefix.length) === basePrefix;\n pathname = exactBaseHrefMatch ? '/' : startsWithBase ? pathname.substring(basePrefix.length) : pathname;\n\n return pathname + (search ? '?' + search : '') + (hash ? '#' + hash : '');\n }\n\n protected _set(state: any, title: string, url: string, replace: boolean) {\n const basePrefix = this._getBasePrefix();\n const slash = url && url[0] !== '/' ? '/' : '';\n const fullUrl = (url === '' || url === '/') ? this._config.baseHref() : basePrefix + slash + url;\n\n if (replace) {\n this._history.replaceState(state, title, fullUrl);\n } else {\n this._history.pushState(state, title, fullUrl);\n }\n }\n\n public dispose(router: UIRouter) {\n super.dispose(router);\n root.removeEventListener('popstate', this._listener);\n }\n}\n\n", + "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { LocationConfig } from '../common/coreservices';\nimport { isDefined } from '../common/predicates';\nimport { noop } from '../common/common';\n\n/** A `LocationConfig` mock that gets/sets all config from an in-memory object */\nexport class MemoryLocationConfig implements LocationConfig {\n dispose = noop;\n\n _baseHref = '';\n _port = 80;\n _protocol = 'http';\n _host = 'localhost';\n _hashPrefix = '';\n\n port = () => this._port;\n protocol = () => this._protocol;\n host = () => this._host;\n baseHref = () => this._baseHref;\n html5Mode = () => false;\n hashPrefix = (newval?) => isDefined(newval) ? this._hashPrefix = newval : this._hashPrefix;\n}\n", + "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { isDefined } from '../common/predicates';\nimport { LocationConfig } from '../common/coreservices';\n\n/** A `LocationConfig` that delegates to the browser's `location` object */\nexport class BrowserLocationConfig implements LocationConfig {\n private _baseHref = undefined;\n private _hashPrefix = '';\n\n constructor(router?, private _isHtml5 = false) { }\n\n port(): number {\n if (location.port) {\n return Number(location.port);\n }\n\n return this.protocol() === 'https' ? 443 : 80;\n }\n\n protocol(): string {\n return location.protocol.replace(/:/g, '');\n }\n\n host(): string {\n return location.hostname;\n }\n\n html5Mode(): boolean {\n return this._isHtml5;\n }\n\n hashPrefix(): string;\n hashPrefix(newprefix?: string): string {\n return isDefined(newprefix) ? this._hashPrefix = newprefix : this._hashPrefix;\n }\n\n baseHref(href?: string): string {\n return isDefined(href) ? this._baseHref = href :\n isDefined(this._baseHref) ? this._baseHref : this.applyDocumentBaseHref();\n }\n\n applyDocumentBaseHref() {\n const baseTag: HTMLBaseElement = document.getElementsByTagName('base')[0];\n return this._baseHref = baseTag ? baseTag.href.substr(location.origin.length) : location.pathname || '/';\n }\n\n dispose() {}\n}\n", + "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { BrowserLocationConfig } from './browserLocationConfig';\nimport { HashLocationService } from './hashLocationService';\nimport { locationPluginFactory } from './utils';\nimport { LocationPlugin, ServicesPlugin } from './interface';\nimport { UIRouter } from '../router';\nimport { PushStateLocationService } from './pushStateLocationService';\nimport { MemoryLocationService } from './memoryLocationService';\nimport { MemoryLocationConfig } from './memoryLocationConfig';\nimport { $injector } from './injector';\nimport { $q } from './q';\nimport { services } from '../common/coreservices';\n\nexport function servicesPlugin(router: UIRouter): ServicesPlugin {\n services.$injector = $injector;\n services.$q = $q;\n\n return { name: 'vanilla.services', $q, $injector, dispose: () => null };\n}\n\n/** A `UIRouterPlugin` uses the browser hash to get/set the current location */\nexport const hashLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory('vanilla.hashBangLocation', false, HashLocationService, BrowserLocationConfig);\n\n/** A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis */\nexport const pushStateLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory('vanilla.pushStateLocation', true, PushStateLocationService, BrowserLocationConfig);\n\n/** A `UIRouterPlugin` that gets/sets the current location from an in-memory object */\nexport const memoryLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory('vanilla.memoryLocation', false, MemoryLocationService, MemoryLocationConfig);\n", + "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nexport * from './vanilla/index';\n", + "/**\n * # Core classes and interfaces\n *\n * The classes and interfaces that are core to ui-router and do not belong\n * to a more specific subsystem (such as resolve).\n *\n * @coreapi\n * @preferred\n * @module core\n */ /** for typedoc */\n\n// Need to import or export at least one concrete something\nimport { noop } from './common/common';\nimport { UIRouter } from './router';\n\n/**\n * An interface for getting values from dependency injection.\n *\n * This is primarily used to get resolve values for a given token.\n * An instance of the `UIInjector` can be retrieved from the current transition using [[Transition.injector]].\n *\n * ---\n *\n * If no resolve is found for a token, then it will delegate to the native injector.\n * The native injector may be Angular 1 `$injector`, Angular 2 `Injector`, or a simple polyfill.\n *\n * In Angular 2, the native injector might be the root Injector,\n * or it might be a lazy loaded `NgModule` injector scoped to a lazy load state tree.\n */\nexport interface UIInjector {\n /**\n * Gets a value from the injector.\n *\n * For a given token, returns the value from the injector that matches the token.\n * If the token is for a resolve that has not yet been fetched, this throws an error.\n *\n * #### Example:\n * ```js\n * var myResolve = injector.get('myResolve');\n * ```\n *\n * #### ng1 Example:\n * ```js\n * // Fetch StateService\n * injector.get('$state').go('home');\n * ```\n *\n * #### ng2 Example:\n * ```js\n * import {StateService} from \"ui-router-ng2\";\n * // Fetch StateService\n * injector.get(StateService).go('home');\n * ```\n *\n * #### Typescript Example:\n * ```js\n * var stringArray = injector.get('myStringArray');\n * ```\n *\n * ### `NOWAIT` policy\n *\n * When using [[ResolvePolicy.async]] === `NOWAIT`, the value returned from `get()` is a promise for the result.\n * The promise is not automatically unwrapped.\n *\n * @param token the key for the value to get. May be a string, a class, or any arbitrary object.\n * @return the Dependency Injection value that matches the token\n */\n get(token: any): any;\n /** Gets a value as type `T` (generics parameter) */\n get(token: any): T;\n\n /**\n * Asynchronously gets a value from the injector\n *\n * For a given token, returns a promise for the value from the injector that matches the token.\n * If the token is for a resolve that has not yet been fetched, this triggers the resolve to load.\n *\n * #### Example:\n * ```js\n * return injector.getAsync('myResolve').then(value => {\n * if (value === 'declined') return false;\n * });\n * ```\n *\n * @param token the key for the value to get. May be a string or arbitrary object.\n * @return a Promise for the Dependency Injection value that matches the token\n */\n getAsync(token: any): Promise;\n /** Asynchronously gets a value as type `T` (generics parameter) */\n getAsync(token: any): Promise;\n\n /**\n * Gets a value from the native injector\n *\n * Returns a value from the native injector, bypassing anything in the [[ResolveContext]].\n *\n * Example:\n * ```js\n * let someThing = injector.getNative(SomeToken);\n * ```\n *\n * @param token the key for the value to get. May be a string or arbitrary object.\n * @return the Dependency Injection value that matches the token\n */\n getNative(token: any): any;\n getNative(token: any): T;\n}\n\n/** @internalapi */\nexport interface UIRouterPlugin extends Disposable {\n name: string;\n}\n\n/** @internalapi */\nexport abstract class UIRouterPluginBase implements UIRouterPlugin, Disposable {\n abstract name: string;\n dispose(router: UIRouter) { }\n}\n\n/** @internalapi */\nexport interface Disposable {\n /** Instructs the Disposable to clean up any resources */\n dispose(router?: UIRouter);\n}\n", + "/**\n * @coreapi\n * @module common\n */ /** */\n\nexport * from './common/index';\nexport * from './params/index';\nexport * from './path/index';\nexport * from './resolve/index';\nexport * from './state/index';\nexport * from './transition/index';\nexport * from './url/index';\nexport * from './view/index';\nexport * from './globals';\n\nexport * from './router';\nexport * from './vanilla';\nexport * from './interface';\n", + "/** @module ng1 */ /** */\nimport { ng as angular } from '../angular';\nimport {\n StateObject, pick, forEach, tail, extend,\n isArray, isInjectable, isDefined, isString, services, trace,\n ViewConfig, ViewService, ViewConfigFactory, PathNode, ResolveContext, Resolvable, IInjectable,\n} from '@uirouter/core';\nimport { Ng1ViewDeclaration } from '../interface';\nimport { TemplateFactory } from '../templateFactory';\nimport IInjectorService = angular.auto.IInjectorService;\n\nexport function getNg1ViewConfigFactory(): ViewConfigFactory {\n let templateFactory: TemplateFactory = null;\n return (path, view) => {\n templateFactory = templateFactory || services.$injector.get('$templateFactory');\n return [new Ng1ViewConfig(path, view, templateFactory)];\n };\n}\n\nconst hasAnyKey = (keys, obj) =>\n keys.reduce((acc, key) => acc || isDefined(obj[key]), false);\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `views`.\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * handles the `views` property with logic specific to @uirouter/angularjs (ng1).\n *\n * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object\n * and applies the state-level configuration to a view named `$default`.\n */\nexport function ng1ViewsBuilder(state: StateObject) {\n // Do not process root state\n if (!state.parent) return {};\n\n const tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'],\n ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'],\n compKeys = ['component', 'bindings', 'componentProvider'],\n nonCompKeys = tplKeys.concat(ctrlKeys),\n allViewKeys = compKeys.concat(nonCompKeys);\n\n // Do not allow a state to have both state-level props and also a `views: {}` property.\n // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state.\n // However, the `$default` approach should not be mixed with a separate `views: ` block.\n if (isDefined(state.views) && hasAnyKey(allViewKeys, state)) {\n throw new Error(`State '${state.name}' has a 'views' object. ` +\n `It cannot also have \"view properties\" at the state level. ` +\n `Move the following properties into a view (in the 'views' object): ` +\n ` ${allViewKeys.filter(key => isDefined(state[key])).join(', ')}`);\n }\n\n const views: { [key: string]: Ng1ViewDeclaration } = {},\n viewsObject = state.views || { '$default': pick(state, allViewKeys) };\n\n forEach(viewsObject, function (config: Ng1ViewDeclaration, name: string) {\n // Account for views: { \"\": { template... } }\n name = name || '$default';\n // Account for views: { header: \"headerComponent\" }\n if (isString(config)) config = { component: config };\n\n // Make a shallow copy of the config object\n config = extend({}, config);\n\n // Do not allow a view to mix props for component-style view with props for template/controller-style view\n if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {\n throw new Error(`Cannot combine: ${compKeys.join('|')} with: ${nonCompKeys.join('|')} in stateview: '${name}@${state.name}'`);\n }\n\n config.resolveAs = config.resolveAs || '$resolve';\n config.$type = 'ng1';\n config.$context = state;\n config.$name = name;\n\n const normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name);\n config.$uiViewName = normalized.uiViewName;\n config.$uiViewContextAnchor = normalized.uiViewContextAnchor;\n\n views[name] = config;\n });\n return views;\n}\n\nlet id = 0;\nexport class Ng1ViewConfig implements ViewConfig {\n $id = id++;\n loaded = false;\n controller: Function; // actually IInjectable|string\n template: string;\n component: string;\n locals: any; // TODO: delete me\n\n constructor(public path: PathNode[], public viewDecl: Ng1ViewDeclaration, public factory: TemplateFactory) { }\n\n load() {\n const $q = services.$q;\n const context = new ResolveContext(this.path);\n const params = this.path.reduce((acc, node) => extend(acc, node.paramValues), {});\n\n const promises: any = {\n template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)),\n controller: $q.when(this.getController(context)),\n };\n\n return $q.all(promises).then((results) => {\n trace.traceViewServiceEvent('Loaded', this);\n this.controller = results.controller;\n extend(this, results.template); // Either { template: \"tpl\" } or { component: \"cmpName\" }\n return this;\n });\n }\n\n getTemplate = (uiView, context: ResolveContext) =>\n this.component ? this.factory.makeComponentTemplate(uiView, context, this.component, this.viewDecl.bindings) : this.template;\n\n /**\n * Gets the controller for a view configuration.\n *\n * @returns {Function|Promise.} Returns a controller, or a promise that resolves to a controller.\n */\n getController(context: ResolveContext): (IInjectable|string|Promise) {\n const provider = this.viewDecl.controllerProvider;\n if (!isInjectable(provider)) return this.viewDecl.controller;\n const deps = services.$injector.annotate(provider);\n const providerFn = isArray(provider) ? tail( provider) : provider;\n const resolvable = new Resolvable('', providerFn, deps);\n return resolvable.get(context);\n }\n}\n", + "/** @module view */\n/** for typedoc */\nimport { ng as angular } from './angular';\nimport { IAugmentedJQuery } from 'angular';\nimport {\n isArray, isDefined, isFunction, isObject, services, Obj, IInjectable, tail, kebobString, unnestR, ResolveContext,\n Resolvable, RawParams,\n} from '@uirouter/core';\nimport { Ng1ViewDeclaration, TemplateFactoryProvider } from './interface';\n\n/**\n * Service which manages loading of templates from a ViewConfig.\n */\nexport class TemplateFactory implements TemplateFactoryProvider {\n /** @hidden */ private _useHttp = angular.version.minor < 3;\n /** @hidden */ private $templateRequest;\n /** @hidden */ private $templateCache;\n /** @hidden */ private $http;\n\n /** @hidden */ $get = ['$http', '$templateCache', '$injector', ($http, $templateCache, $injector) => {\n this.$templateRequest = $injector.has && $injector.has('$templateRequest') && $injector.get('$templateRequest');\n this.$http = $http;\n this.$templateCache = $templateCache;\n return this;\n }];\n\n /** @hidden */\n useHttpService(value: boolean) {\n this._useHttp = value;\n }\n\n /**\n * Creates a template from a configuration object.\n *\n * @param config Configuration object for which to load a template.\n * The following properties are search in the specified order, and the first one\n * that is defined is used to create the template:\n *\n * @param params Parameters to pass to the template function.\n * @param context The resolve context associated with the template's view\n *\n * @return {string|object} The template html as a string, or a promise for\n * that string,or `null` if no template is configured.\n */\n fromConfig(config: Ng1ViewDeclaration, params: any, context: ResolveContext): Promise<{ template?: string, component?: string }> {\n const defaultTemplate = '';\n\n const asTemplate = (result) => services.$q.when(result).then(str => ({ template: str }));\n const asComponent = (result) => services.$q.when(result).then(str => ({ component: str }));\n\n return (\n isDefined(config.template) ? asTemplate(this.fromString(config.template, params)) :\n isDefined(config.templateUrl) ? asTemplate(this.fromUrl(config.templateUrl, params)) :\n isDefined(config.templateProvider) ? asTemplate(this.fromProvider(config.templateProvider, params, context)) :\n isDefined(config.component) ? asComponent(config.component) :\n isDefined(config.componentProvider) ? asComponent(this.fromComponentProvider(config.componentProvider, params, context)) :\n asTemplate(defaultTemplate)\n );\n }\n\n /**\n * Creates a template from a string or a function returning a string.\n *\n * @param template html template as a string or function that returns an html template as a string.\n * @param params Parameters to pass to the template function.\n *\n * @return {string|object} The template html as a string, or a promise for that\n * string.\n */\n fromString(template: (string | Function), params?: RawParams) {\n return isFunction(template) ? ( template)(params) : template;\n }\n\n /**\n * Loads a template from the a URL via `$http` and `$templateCache`.\n *\n * @param {string|Function} url url of the template to load, or a function\n * that returns a url.\n * @param {Object} params Parameters to pass to the url function.\n * @return {string|Promise.} The template html as a string, or a promise\n * for that string.\n */\n fromUrl(url: (string | Function), params: any) {\n if (isFunction(url)) url = ( url)(params);\n if (url == null) return null;\n\n if (this._useHttp) {\n return this.$http.get(url, { cache: this.$templateCache, headers: { Accept: 'text/html' } })\n .then(function (response) {\n return response.data;\n });\n }\n\n return this.$templateRequest(url);\n }\n\n /**\n * Creates a template by invoking an injectable provider function.\n *\n * @param provider Function to invoke via `locals`\n * @param {Function} injectFn a function used to invoke the template provider\n * @return {string|Promise.} The template html as a string, or a promise\n * for that string.\n */\n fromProvider(provider: IInjectable, params: any, context: ResolveContext) {\n const deps = services.$injector.annotate(provider);\n const providerFn = isArray(provider) ? tail( provider) : provider;\n const resolvable = new Resolvable('', providerFn, deps);\n return resolvable.get(context);\n }\n\n /**\n * Creates a component's template by invoking an injectable provider function.\n *\n * @param provider Function to invoke via `locals`\n * @param {Function} injectFn a function used to invoke the template provider\n * @return {string} The template html as a string: \"\".\n */\n fromComponentProvider(provider: IInjectable, params: any, context: ResolveContext) {\n const deps = services.$injector.annotate(provider);\n const providerFn = isArray(provider) ? tail( provider) : provider;\n const resolvable = new Resolvable('', providerFn, deps);\n return resolvable.get(context);\n }\n\n /**\n * Creates a template from a component's name\n *\n * This implements route-to-component.\n * It works by retrieving the component (directive) metadata from the injector.\n * It analyses the component's bindings, then constructs a template that instantiates the component.\n * The template wires input and output bindings to resolves or from the parent component.\n *\n * @param uiView {object} The parent ui-view (for binding outputs to callbacks)\n * @param context The ResolveContext (for binding outputs to callbacks returned from resolves)\n * @param component {string} Component's name in camel case.\n * @param bindings An object defining the component's bindings: {foo: '<'}\n * @return {string} The template as a string: \"\".\n */\n makeComponentTemplate(uiView: IAugmentedJQuery, context: ResolveContext, component: string, bindings?: any) {\n bindings = bindings || {};\n\n // Bind once prefix\n const prefix = angular.version.minor >= 3 ? '::' : '';\n // Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-`\n const kebob = (camelCase: string) => {\n const kebobed = kebobString(camelCase);\n return /^(x|data)-/.exec(kebobed) ? `x-${kebobed}` : kebobed;\n };\n\n\n const attributeTpl = (input: BindingTuple) => {\n const { name, type } = input;\n const attrName = kebob(name);\n // If the ui-view has an attribute which matches a binding on the routed component\n // then pass that attribute through to the routed component template.\n // Prefer ui-view wired mappings to resolve data, unless the resolve was explicitly bound using `bindings:`\n if (uiView.attr(attrName) && !bindings[name])\n return `${attrName}='${uiView.attr(attrName)}'`;\n\n const resolveName = bindings[name] || name;\n // Pre-evaluate the expression for \"@\" bindings by enclosing in {{ }}\n // some-attr=\"{{ ::$resolve.someResolveName }}\"\n if (type === '@')\n return `${attrName}='{{${prefix}$resolve.${resolveName}}}'`;\n\n // Wire \"&\" callbacks to resolves that return a callback function\n // Get the result of the resolve (should be a function) and annotate it to get its arguments.\n // some-attr=\"$resolve.someResolveResultName(foo, bar)\"\n if (type === '&') {\n const res = context.getResolvable(resolveName);\n const fn = res && res.data;\n const args = fn && services.$injector.annotate(fn) || [];\n // account for array style injection, i.e., ['foo', function(foo) {}]\n const arrayIdxStr = isArray(fn) ? `[${fn.length - 1}]` : '';\n return `${attrName}='$resolve.${resolveName}${arrayIdxStr}(${args.join(',')})'`;\n }\n\n // some-attr=\"::$resolve.someResolveName\"\n return `${attrName}='${prefix}$resolve.${resolveName}'`;\n };\n\n const attrs = getComponentBindings(component).map(attributeTpl).join(' ');\n const kebobName = kebob(component);\n return `<${kebobName} ${attrs}>`;\n }\n}\n\n// Gets all the directive(s)' inputs ('@', '=', and '<') and outputs ('&')\nfunction getComponentBindings(name: string) {\n const cmpDefs = services.$injector.get(name + 'Directive'); // could be multiple\n if (!cmpDefs || !cmpDefs.length) throw new Error(`Unable to find component named '${name}'`);\n return cmpDefs.map(getBindings).reduce(unnestR, []);\n}\n\n// Given a directive definition, find its object input attributes\n// Use different properties, depending on the type of directive (component, bindToController, normal)\nconst getBindings = (def: any) => {\n if (isObject(def.bindToController)) return scopeBindings(def.bindToController);\n return scopeBindings(def.scope);\n};\n\ninterface BindingTuple {\n name: string;\n type: string;\n}\n\n// for ng 1.2 style, process the scope: { input: \"=foo\" }\n// for ng 1.3 through ng 1.5, process the component's bindToController: { input: \"=foo\" } object\nconst scopeBindings = (bindingsObj: Obj) => Object.keys(bindingsObj || {})\n // [ 'input', [ '=foo', '=', 'foo' ] ]\n .map(key => [key, /^([=<@&])[?]?(.*)/.exec(bindingsObj[key])])\n // skip malformed values\n .filter(tuple => isDefined(tuple) && isArray(tuple[1]))\n // { name: ('foo' || 'input'), type: '=' }\n .map(tuple => ({ name: tuple[1][2] || tuple[0], type: tuple[1][1] } as BindingTuple));\n\n", + "/** @module ng1 */ /** for typedoc */\nimport {\n val, isObject, createProxyFunctions, BuilderFunction, StateRegistry, StateService, OnInvalidCallback,\n} from '@uirouter/core';\nimport { Ng1StateDeclaration } from './interface';\n\n/**\n * The Angular 1 `StateProvider`\n *\n * The `$stateProvider` works similar to Angular's v1 router, but it focuses purely\n * on state.\n *\n * A state corresponds to a \"place\" in the application in terms of the overall UI and\n * navigation. A state describes (via the controller / template / view properties) what\n * the UI looks like and does at that place.\n *\n * States often have things in common, and the primary way of factoring out these\n * commonalities in this model is via the state hierarchy, i.e. parent/child states aka\n * nested states.\n *\n * The `$stateProvider` provides interfaces to declare these states for your app.\n */\nexport class StateProvider {\n constructor(private stateRegistry: StateRegistry, private stateService: StateService) {\n createProxyFunctions(val(StateProvider.prototype), this, val(this));\n }\n\n /**\n * Decorates states when they are registered\n *\n * Allows you to extend (carefully) or override (at your own peril) the\n * `stateBuilder` object used internally by [[StateRegistry]].\n * This can be used to add custom functionality to ui-router,\n * for example inferring templateUrl based on the state name.\n *\n * When passing only a name, it returns the current (original or decorated) builder\n * function that matches `name`.\n *\n * The builder functions that can be decorated are listed below. Though not all\n * necessarily have a good use case for decoration, that is up to you to decide.\n *\n * In addition, users can attach custom decorators, which will generate new\n * properties within the state's internal definition. There is currently no clear\n * use-case for this beyond accessing internal states (i.e. $state.$current),\n * however, expect this to become increasingly relevant as we introduce additional\n * meta-programming features.\n *\n * **Warning**: Decorators should not be interdependent because the order of\n * execution of the builder functions in non-deterministic. Builder functions\n * should only be dependent on the state definition object and super function.\n *\n *\n * Existing builder functions and current return values:\n *\n * - **parent** `{object}` - returns the parent state object.\n * - **data** `{object}` - returns state data, including any inherited data that is not\n * overridden by own values (if any).\n * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}\n * or `null`.\n * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is\n * navigable).\n * - **params** `{object}` - returns an array of state params that are ensured to\n * be a super-set of parent's params.\n * - **views** `{object}` - returns a views object where each key is an absolute view\n * name (i.e. \"viewName@stateName\") and each value is the config object\n * (template, controller) for the view. Even when you don't use the views object\n * explicitly on a state config, one is still created for you internally.\n * So by decorating this builder function you have access to decorating template\n * and controller properties.\n * - **ownParams** `{object}` - returns an array of params that belong to the state,\n * not including any params defined by ancestor states.\n * - **path** `{string}` - returns the full path from the root down to this state.\n * Needed for state activation.\n * - **includes** `{object}` - returns an object that includes every state that\n * would pass a `$state.includes()` test.\n *\n * #### Example:\n * Override the internal 'views' builder with a function that takes the state\n * definition, and a reference to the internal function being overridden:\n * ```js\n * $stateProvider.decorator('views', function (state, parent) {\n * let result = {},\n * views = parent(state);\n *\n * angular.forEach(views, function (config, name) {\n * let autoName = (state.name + '.' + name).replace('.', '/');\n * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';\n * result[name] = config;\n * });\n * return result;\n * });\n *\n * $stateProvider.state('home', {\n * views: {\n * 'contact.list': { controller: 'ListController' },\n * 'contact.item': { controller: 'ItemController' }\n * }\n * });\n * ```\n *\n *\n * ```js\n * // Auto-populates list and item views with /partials/home/contact/list.html,\n * // and /partials/home/contact/item.html, respectively.\n * $state.go('home');\n * ```\n *\n * @param {string} name The name of the builder function to decorate.\n * @param {object} func A function that is responsible for decorating the original\n * builder function. The function receives two parameters:\n *\n * - `{object}` - state - The state config object.\n * - `{object}` - super - The original builder function.\n *\n * @return {object} $stateProvider - $stateProvider instance\n */\n decorator(name: string, func: BuilderFunction) {\n return this.stateRegistry.decorator(name, func) || this;\n }\n\n /**\n * Registers a state\n *\n * ### This is a passthrough to [[StateRegistry.register]].\n *\n * Registers a state configuration under a given state name.\n * The stateConfig object has the following acceptable properties.\n *\n *
    \n *\n * - **`template`** - {string|function=} - html template as a string or a function that returns\n * an html template as a string which should be used by the uiView directives. This property\n * takes precedence over templateUrl.\n *\n * If `template` is a function, it will be called with the following parameters:\n *\n * - {array.<object>} - state parameters extracted from the current $location.path() by\n * applying the current state\n *\n * \n *\n * - **`templateUrl`** - {string|function=} - path or function that returns a path to an html\n * template that should be used by uiView.\n *\n * If `templateUrl` is a function, it will be called with the following parameters:\n *\n * - {array.<object>} - state parameters extracted from the current $location.path() by\n * applying the current state\n *\n * \n *\n * - **`templateProvider`** - {function=} - Provider function that returns HTML content\n * string.\n *\n * \n *\n * - **`controller`** - {string|function=} - Controller fn that should be associated with newly\n * related scope or the name of a registered controller if passed as a string.\n *\n * \n *\n * - **`controllerProvider`** - {function=} - Injectable provider function that returns\n * the actual controller or string.\n *\n * \n *\n * - **`controllerAs`** – {string=} – A controller alias name. If present the controller will be\n * published to scope under the controllerAs name.\n *\n * \n *\n * - **`resolve`** - {object.<string, function>=} - An optional map of dependencies which\n * should be injected into the controller. If any of these dependencies are promises,\n * the router will wait for them all to be resolved or one to be rejected before the\n * controller is instantiated. If all the promises are resolved successfully, the values\n * of the resolved promises are injected and $stateChangeSuccess event is fired. If any\n * of the promises are rejected the $stateChangeError event is fired. The map object is:\n *\n * - key - {string}: name of dependency to be injected into controller\n * - factory - {string|function}: If string then it is alias for service. Otherwise if function,\n * it is injected and return value it treated as dependency. If result is a promise, it is\n * resolved before its value is injected into controller.\n *\n * \n *\n * - **`url`** - {string=} - A url with optional parameters. When a state is navigated or\n * transitioned to, the `$stateParams` service will be populated with any\n * parameters that were passed.\n *\n * \n *\n * - **`params`** - {object=} - An array of parameter names or regular expressions. Only\n * use this within a state if you are not using url. Otherwise you can specify your\n * parameters within the url. When a state is navigated or transitioned to, the\n * $stateParams service will be populated with any parameters that were passed.\n *\n * \n *\n * - **`views`** - {object=} - Use the views property to set up multiple views or to target views\n * manually/explicitly.\n *\n * \n *\n * - **`abstract`** - {boolean=} - An abstract state will never be directly activated,\n * but can provide inherited properties to its common children states.\n *\n * \n *\n * - **`onEnter`** - {object=} - Callback function for when a state is entered. Good way\n * to trigger an action or dispatch an event, such as opening a dialog.\n * If minifying your scripts, make sure to use the `['injection1', 'injection2', function(injection1, injection2){}]` syntax.\n *\n * \n *\n * - **`onExit`** - {object=} - Callback function for when a state is exited. Good way to\n * trigger an action or dispatch an event, such as opening a dialog.\n * If minifying your scripts, make sure to use the `['injection1', 'injection2', function(injection1, injection2){}]` syntax.\n *\n * \n *\n * - **`reloadOnSearch = true`** - {boolean=} - If `false`, will not retrigger the same state\n * just because a search/query parameter has changed (via $location.search() or $location.hash()).\n * Useful for when you'd like to modify $location.search() without triggering a reload.\n *\n * \n *\n * - **`data`** - {object=} - Arbitrary data object, useful for custom configuration.\n *\n * #### Example:\n * Some state name examples\n * ```js\n * // stateName can be a single top-level name (must be unique).\n * $stateProvider.state(\"home\", {});\n *\n * // Or it can be a nested state name. This state is a child of the\n * // above \"home\" state.\n * $stateProvider.state(\"home.newest\", {});\n *\n * // Nest states as deeply as needed.\n * $stateProvider.state(\"home.newest.abc.xyz.inception\", {});\n *\n * // state() returns $stateProvider, so you can chain state declarations.\n * $stateProvider\n * .state(\"home\", {})\n * .state(\"about\", {})\n * .state(\"contacts\", {});\n * ```\n *\n * @param {string} name A unique state name, e.g. \"home\", \"about\", \"contacts\".\n * To create a parent/child state use a dot, e.g. \"about.sales\", \"home.newest\".\n * @param {object} definition State configuration object.\n */\n state(name: string, definition: Ng1StateDeclaration): StateProvider;\n state(definition: Ng1StateDeclaration): StateProvider;\n state(name: any, definition?: any) {\n if (isObject(name)) {\n definition = name;\n } else {\n definition.name = name;\n }\n this.stateRegistry.register(definition);\n return this;\n }\n\n /**\n * Registers an invalid state handler\n *\n * This is a passthrough to [[StateService.onInvalid]] for ng1.\n */\n\n onInvalid(callback: OnInvalidCallback): Function {\n return this.stateService.onInvalid(callback);\n }\n}\n", + "/** @module ng1 */ /** */\nimport {\n StateObject, TransitionStateHookFn, HookResult, Transition, services, ResolveContext, extend, BuilderFunction,\n} from '@uirouter/core';\nimport { getLocals } from '../services';\nimport { Ng1StateDeclaration } from '../interface';\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`,\n * `onRetain` callback hooks on a [[Ng1StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * ensures that those hooks are injectable for @uirouter/angularjs (ng1).\n */\nexport const getStateHookBuilder = (hookName: 'onEnter'|'onExit'|'onRetain') =>\nfunction stateHookBuilder(stateObject: StateObject, parentFn: BuilderFunction): TransitionStateHookFn {\n const hook = stateObject[hookName];\n const pathname = hookName === 'onExit' ? 'from' : 'to';\n\n function decoratedNg1Hook(trans: Transition, state: Ng1StateDeclaration): HookResult {\n const resolveContext = new ResolveContext(trans.treeChanges(pathname));\n const subContext = resolveContext.subContext(state.$$state());\n const locals = extend(getLocals(subContext), { $state$: state, $transition$: trans });\n return services.$injector.invoke(hook, this, locals);\n }\n\n return hook ? decoratedNg1Hook : undefined;\n};\n", + "/**\n * @internalapi\n * @module ng1\n */ /** */\nimport { LocationConfig, LocationServices, UIRouter, ParamType, isDefined } from '@uirouter/core';\nimport { val, createProxyFunctions, removeFrom, isObject } from '@uirouter/core';\nimport { ILocationService, ILocationProvider } from 'angular';\n\n/**\n * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service\n */\nexport class Ng1LocationServices implements LocationConfig, LocationServices {\n private $locationProvider: ILocationProvider;\n private $location: ILocationService;\n private $sniffer;\n\n path;\n search;\n hash;\n hashPrefix;\n port;\n protocol;\n host;\n baseHref;\n\n // .onChange() registry\n private _urlListeners: Function[] = [];\n\n /**\n * Applys ng1-specific path parameter encoding\n *\n * The Angular 1 `$location` service is a bit weird.\n * It doesn't allow slashes to be encoded/decoded bi-directionally.\n *\n * See the writeup at https://github.com/angular-ui/ui-router/issues/2598\n *\n * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F\n *\n * @param router\n */\n static monkeyPatchPathParameterType(router: UIRouter) {\n const pathType: ParamType = router.urlMatcherFactory.type('path');\n\n pathType.encode = (x: any) =>\n x != null ? x.toString().replace(/(~|\\/)/g, m => ({ '~': '~~', '/': '~2F' }[m])) : x;\n\n pathType.decode = (x: string) =>\n x != null ? x.toString().replace(/(~~|~2F)/g, m => ({ '~~': '~', '~2F': '/' }[m])) : x;\n\n }\n\n dispose() { }\n\n constructor($locationProvider: ILocationProvider) {\n this.$locationProvider = $locationProvider;\n const _lp = val($locationProvider);\n createProxyFunctions(_lp, this, _lp, ['hashPrefix']);\n }\n\n onChange(callback: Function) {\n this._urlListeners.push(callback);\n return () => removeFrom(this._urlListeners)(callback);\n }\n\n html5Mode() {\n let html5Mode: any = this.$locationProvider.html5Mode();\n html5Mode = isObject(html5Mode) ? html5Mode.enabled : html5Mode;\n return html5Mode && this.$sniffer.history;\n }\n\n url(newUrl?: string, replace = false, state?) {\n if (isDefined(newUrl)) this.$location.url(newUrl);\n if (replace) this.$location.replace();\n if (state) this.$location.state(state);\n return this.$location.url();\n }\n\n _runtimeServices($rootScope, $location: ILocationService, $sniffer, $browser) {\n this.$location = $location;\n this.$sniffer = $sniffer;\n\n // Bind $locationChangeSuccess to the listeners registered in LocationService.onChange\n $rootScope.$on('$locationChangeSuccess', evt => this._urlListeners.forEach(fn => fn(evt)));\n const _loc = val($location);\n const _browser = val($browser);\n\n // Bind these LocationService functions to $location\n createProxyFunctions(_loc, this, _loc, ['replace', 'path', 'search', 'hash']);\n // Bind these LocationConfig functions to $location\n createProxyFunctions(_loc, this, _loc, ['port', 'protocol', 'host']);\n // Bind these LocationConfig functions to $browser\n createProxyFunctions(_browser, this, _browser, ['baseHref']);\n }\n}\n", + "/** @module url */ /** */\nimport {\n UIRouter, UrlRouter, LocationServices, $InjectorLike, BaseUrlRule, UrlRuleHandlerFn, UrlMatcher,\n IInjectable,\n} from '@uirouter/core';\nimport { services, isString, isFunction, isArray, identity } from '@uirouter/core';\n\nexport interface RawNg1RuleFunction {\n ($injector: $InjectorLike, $location: LocationServices): string|void;\n}\n\n/**\n * Manages rules for client-side URL\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class manages the router rules for what to do when the URL changes.\n *\n * This provider remains for backwards compatibility.\n *\n * @deprecated\n */\nexport class UrlRouterProvider {\n /** @hidden */ _router: UIRouter;\n /** @hidden */ _urlRouter: UrlRouter;\n\n static injectableHandler(router: UIRouter, handler): UrlRuleHandlerFn {\n return match =>\n services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params });\n }\n\n /** @hidden */\n constructor(router: UIRouter) {\n this._router = router;\n this._urlRouter = router.urlRouter;\n }\n\n /** @hidden */\n $get() {\n const urlRouter = this._urlRouter;\n urlRouter.update(true);\n if (!urlRouter.interceptDeferred) urlRouter.listen();\n return urlRouter;\n }\n\n /**\n * Registers a url handler function.\n *\n * Registers a low level url handler (a `rule`).\n * A rule detects specific URL patterns and returns a redirect, or performs some action.\n *\n * If a rule returns a string, the URL is replaced with the string, and all rules are fired again.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // Here's an example of how you might allow case insensitive urls\n * $urlRouterProvider.rule(function ($injector, $location) {\n * var path = $location.path(),\n * normalized = path.toLowerCase();\n *\n * if (path !== normalized) {\n * return normalized;\n * }\n * });\n * });\n * ```\n *\n * @param ruleFn\n * Handler function that takes `$injector` and `$location` services as arguments.\n * You can use them to detect a url and return a different url as a string.\n *\n * @return [[UrlRouterProvider]] (`this`)\n */\n rule(ruleFn: RawNg1RuleFunction): UrlRouterProvider {\n if (!isFunction(ruleFn)) throw new Error(\"'rule' must be a function\");\n\n const match = () =>\n ruleFn(services.$injector, this._router.locationService);\n\n const rule = new BaseUrlRule(match, identity);\n this._urlRouter.rule(rule);\n return this;\n }\n\n /**\n * Defines the path or behavior to use when no url can be matched.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // if the path doesn't match any of the urls you configured\n * // otherwise will take care of routing the user to the\n * // specified url\n * $urlRouterProvider.otherwise('/index');\n *\n * // Example of using function rule as param\n * $urlRouterProvider.otherwise(function ($injector, $location) {\n * return '/a/valid/url';\n * });\n * });\n * ```\n *\n * @param rule\n * The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`.\n * The function version is passed two params: `$injector` and `$location` services, and should return a url string.\n *\n * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n */\n otherwise(rule: string | RawNg1RuleFunction): UrlRouterProvider {\n const urlRouter = this._urlRouter;\n\n if (isString(rule)) {\n urlRouter.otherwise(rule);\n } else if (isFunction(rule)) {\n urlRouter.otherwise(() => rule(services.$injector, this._router.locationService));\n } else {\n throw new Error(\"'rule' must be a string or function\");\n }\n\n return this;\n }\n\n /**\n * Registers a handler for a given url matching.\n *\n * If the handler is a string, it is\n * treated as a redirect, and is interpolated according to the syntax of match\n * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).\n *\n * If the handler is a function, it is injectable.\n * It gets invoked if `$location` matches.\n * You have the option of inject the match object as `$match`.\n *\n * The handler can return\n *\n * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n * will continue trying to find another one that matches.\n * - **string** which is treated as a redirect and passed to `$location.url()`\n * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n * if ($state.$current.navigable !== state ||\n * !equalForKeys($match, $stateParams) {\n * $state.transitionTo(state, $match, false);\n * }\n * });\n * });\n * ```\n *\n * @param what A pattern string to match, compiled as a [[UrlMatcher]].\n * @param handler The path (or function that returns a path) that you want to redirect your user to.\n * @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]]\n *\n * Note: the handler may also invoke arbitrary code, such as `$state.go()`\n */\n when(what: (RegExp|UrlMatcher|string), handler: string|IInjectable) {\n if (isArray(handler) || isFunction(handler)) {\n handler = UrlRouterProvider.injectableHandler(this._router, handler);\n }\n\n this._urlRouter.when(what, handler as any);\n return this;\n }\n\n /**\n * Disables monitoring of the URL.\n *\n * Call this method before UI-Router has bootstrapped.\n * It will stop UI-Router from performing the initial url sync.\n *\n * This can be useful to perform some asynchronous initialization before the router starts.\n * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // Prevent $urlRouter from automatically intercepting URL changes;\n * $urlRouterProvider.deferIntercept();\n * })\n *\n * app.run(function (MyService, $urlRouter, $http) {\n * $http.get(\"/stuff\").then(function(resp) {\n * MyService.doStuff(resp.data);\n * $urlRouter.listen();\n * $urlRouter.sync();\n * });\n * });\n * ```\n *\n * @param defer Indicates whether to defer location change interception.\n * Passing no parameter is equivalent to `true`.\n */\n deferIntercept(defer?: boolean) {\n this._urlRouter.deferIntercept(defer);\n }\n}\n", + "/**\n * # Angular 1 types\n *\n * UI-Router core provides various Typescript types which you can use for code completion and validating parameter values, etc.\n * The customizations to the core types for Angular UI-Router are documented here.\n *\n * The optional [[$resolve]] service is also documented here.\n *\n * @module ng1\n * @preferred\n */\n/** for typedoc */\nimport { ng as angular } from './angular';\nimport {\n IRootScopeService, IQService, ILocationService, ILocationProvider, IHttpService, ITemplateCacheService,\n} from 'angular';\nimport {\n services, applyPairs, isString, trace, extend, UIRouter, StateService, UrlRouter, UrlMatcherFactory, ResolveContext,\n unnestR, TypedMap,\n} from '@uirouter/core';\nimport { ng1ViewsBuilder, getNg1ViewConfigFactory } from './statebuilders/views';\nimport { TemplateFactory } from './templateFactory';\nimport { StateProvider } from './stateProvider';\nimport { getStateHookBuilder } from './statebuilders/onEnterExitRetain';\nimport { Ng1LocationServices } from './locationServices';\nimport { UrlRouterProvider } from './urlRouterProvider';\nimport IInjectorService = angular.auto.IInjectorService; // tslint:disable-line\n\nangular.module('ui.router.angular1', []);\nconst mod_init = angular.module('ui.router.init', []);\nconst mod_util = angular.module('ui.router.util', ['ng', 'ui.router.init']);\nconst mod_rtr = angular.module('ui.router.router', ['ui.router.util']);\nconst mod_state = angular.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']);\nconst mod_main = angular.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']);\nlet mod_cmpt = angular.module('ui.router.compat', ['ui.router']); // tslint:disable-line\n\ndeclare module '@uirouter/core/lib/router' {\n interface UIRouter { // tslint:disable-line:no-shadowed-variable\n /** @hidden */\n stateProvider: StateProvider;\n /** @hidden */\n urlRouterProvider: UrlRouterProvider;\n }\n}\n\nlet router: UIRouter = null;\n\n$uiRouterProvider.$inject = ['$locationProvider'];\n/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */\nfunction $uiRouterProvider($locationProvider: ILocationProvider) {\n\n // Create a new instance of the Router when the $uiRouterProvider is initialized\n router = this.router = new UIRouter();\n router.stateProvider = new StateProvider(router.stateRegistry, router.stateService);\n\n // Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties\n router.stateRegistry.decorator('views', ng1ViewsBuilder);\n router.stateRegistry.decorator('onExit', getStateHookBuilder('onExit'));\n router.stateRegistry.decorator('onRetain', getStateHookBuilder('onRetain'));\n router.stateRegistry.decorator('onEnter', getStateHookBuilder('onEnter'));\n\n router.viewService._pluginapi._viewConfigFactory('ng1', getNg1ViewConfigFactory());\n\n const ng1LocationService = router.locationService = router.locationConfig = new Ng1LocationServices($locationProvider);\n\n Ng1LocationServices.monkeyPatchPathParameterType(router);\n\n // backwards compat: also expose router instance as $uiRouterProvider.router\n router['router'] = router;\n router['$get'] = $get;\n $get.$inject = ['$location', '$browser', '$sniffer', '$rootScope', '$http', '$templateCache'];\n function $get($location: ILocationService, $browser: any, $sniffer: any, $rootScope: ng.IScope, $http: IHttpService, $templateCache: ITemplateCacheService) {\n ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser);\n delete router['router'];\n delete router['$get'];\n return router;\n }\n return router;\n}\n\nconst getProviderFor = (serviceName) => [ '$uiRouterProvider', ($urp) => {\n const service = $urp.router[serviceName];\n service['$get'] = () => service;\n return service;\n}];\n\n// This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime)\nrunBlock.$inject = ['$injector', '$q', '$uiRouter'];\nfunction runBlock($injector: IInjectorService, $q: IQService, $uiRouter: UIRouter) {\n services.$injector = $injector;\n services.$q = $q;\n\n // The $injector is now available.\n // Find any resolvables that had dependency annotation deferred\n $uiRouter.stateRegistry.get()\n .map(x => x.$$state().resolvables)\n .reduce(unnestR, [])\n .filter(x => x.deps === 'deferred')\n .forEach(resolvable => resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi));\n}\n\n// $urlRouter service and $urlRouterProvider\nconst getUrlRouterProvider = (uiRouter: UIRouter) =>\n uiRouter.urlRouterProvider = new UrlRouterProvider(uiRouter);\n\n// $state service and $stateProvider\n// $urlRouter service and $urlRouterProvider\nconst getStateProvider = () =>\n extend(router.stateProvider, { $get: () => router.stateService });\n\nwatchDigests.$inject = ['$rootScope'];\nexport function watchDigests($rootScope: IRootScopeService) {\n $rootScope.$watch(function() { trace.approximateDigests++; });\n}\n\nmod_init .provider('$uiRouter', $uiRouterProvider);\nmod_rtr .provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]);\nmod_util .provider('$urlService', getProviderFor('urlService'));\nmod_util .provider('$urlMatcherFactory', ['$uiRouterProvider', () => router.urlMatcherFactory]);\nmod_util .provider('$templateFactory', () => new TemplateFactory());\nmod_state.provider('$stateRegistry', getProviderFor('stateRegistry'));\nmod_state.provider('$uiRouterGlobals', getProviderFor('globals'));\nmod_state.provider('$transitions', getProviderFor('transitionService'));\nmod_state.provider('$state', ['$uiRouterProvider', getStateProvider]);\n\nmod_state.factory ('$stateParams', ['$uiRouter', ($uiRouter: UIRouter) => $uiRouter.globals.params]);\nmod_main .factory ('$view', () => router.viewService);\nmod_main .service ('$trace', () => trace);\n\nmod_main .run (watchDigests);\nmod_util .run (['$urlMatcherFactory', function ($urlMatcherFactory: UrlMatcherFactory) { }]);\nmod_state.run (['$state', function ($state: StateService) { }]);\nmod_rtr .run (['$urlRouter', function ($urlRouter: UrlRouter) { }]);\nmod_init .run (runBlock);\n\n/** @hidden TODO: find a place to move this */\nexport const getLocals = (ctx: ResolveContext): TypedMap => {\n const tokens = ctx.getTokens().filter(isString);\n\n const tuples = tokens .map(key => {\n const resolvable = ctx.getResolvable(key);\n const waitPolicy = ctx.getPolicy(resolvable).async;\n return [ key, waitPolicy === 'NOWAIT' ? resolvable.promise : resolvable.data ];\n });\n\n return tuples.reduce(applyPairs, {});\n};\n\n", + "/**\n * # Angular 1 injectable services\n *\n * This is a list of the objects which can be injected using angular's injector.\n *\n * There are three different kind of injectable objects:\n *\n * ## **Provider** objects\n * #### injectable into a `.config()` block during configtime\n *\n * - [[$uiRouterProvider]]: The UI-Router instance\n * - [[$stateProvider]]: State registration\n * - [[$transitionsProvider]]: Transition hooks\n * - [[$urlServiceProvider]]: All URL related public APIs\n *\n * - [[$uiViewScrollProvider]]: Disable ui-router view scrolling\n * - [[$urlRouterProvider]]: (deprecated) Url matching rules\n * - [[$urlMatcherFactoryProvider]]: (deprecated) Url parsing config\n *\n * ## **Service** objects\n * #### injectable globally during runtime\n *\n * - [[$uiRouter]]: The UI-Router instance\n * - [[$trace]]: Enable transition trace/debug\n * - [[$transitions]]: Transition hooks\n * - [[$state]]: Imperative state related APIs\n * - [[$stateRegistry]]: State registration\n * - [[$urlService]]: All URL related public APIs\n * - [[$uiRouterGlobals]]: Global variables\n * - [[$uiViewScroll]]: Scroll an element into view\n *\n * - [[$stateParams]]: (deprecated) Global state param values\n * - [[$urlRouter]]: (deprecated) URL synchronization\n * - [[$urlMatcherFactory]]: (deprecated) URL parsing config\n *\n * ## **Per-Transition** objects\n *\n * - These kind of objects are injectable into:\n * - Resolves ([[Ng1StateDeclaration.resolve]]),\n * - Transition Hooks ([[TransitionService.onStart]], etc),\n * - Routed Controllers ([[Ng1ViewDeclaration.controller]])\n *\n * #### Different instances are injected based on the [[Transition]]\n *\n * - [[$transition$]]: The current Transition object\n * - [[$stateParams]]: State param values for pending Transition (deprecated)\n * - Any resolve data defined using [[Ng1StateDeclaration.resolve]]\n *\n * @ng1api\n * @preferred\n * @module injectables\n */ /** */\n/* tslint:disable:prefer-const */\nimport { StateProvider } from './stateProvider';\nimport {\n StateService, TransitionService, Transition, UrlRouter, UrlMatcherFactory,\n StateParams, StateRegistry, UIRouterGlobals, UIRouter, Trace, UrlService,\n} from '@uirouter/core';\nimport { UIViewScrollProvider } from './viewScroll';\nimport { UrlRouterProvider } from './urlRouterProvider';\n\n/**\n * The current (or pending) State Parameters\n *\n * An injectable global **Service Object** which holds the state parameters for the latest **SUCCESSFUL** transition.\n *\n * The values are not updated until *after* a `Transition` successfully completes.\n *\n * **Also:** an injectable **Per-Transition Object** object which holds the pending state parameters for the pending `Transition` currently running.\n *\n * ### Deprecation warning:\n *\n * The value injected for `$stateParams` is different depending on where it is injected.\n *\n * - When injected into an angular service, the object injected is the global **Service Object** with the parameter values for the latest successful `Transition`.\n * - When injected into transition hooks, resolves, or view controllers, the object is the **Per-Transition Object** with the parameter values for the running `Transition`.\n *\n * Because of these confusing details, this service is deprecated.\n *\n * ### Instead of using the global `$stateParams` service object,\n * inject [[$uiRouterGlobals]] and use [[UIRouterGlobals.params]]\n *\n * ```js\n * MyService.$inject = ['$uiRouterGlobals'];\n * function MyService($uiRouterGlobals) {\n * return {\n * paramValues: function () {\n * return $uiRouterGlobals.params;\n * }\n * }\n * }\n * ```\n *\n * ### Instead of using the per-transition `$stateParams` object,\n * inject the current `Transition` (as [[$transition$]]) and use [[Transition.params]]\n *\n * ```js\n * MyController.$inject = ['$transition$'];\n * function MyController($transition$) {\n * var username = $transition$.params().username;\n * // .. do something with username\n * }\n * ```\n *\n * ---\n *\n * This object can be injected into other services.\n *\n * #### Deprecated Example:\n * ```js\n * SomeService.$inject = ['$http', '$stateParams'];\n * function SomeService($http, $stateParams) {\n * return {\n * getUser: function() {\n * return $http.get('/api/users/' + $stateParams.username);\n * }\n * }\n * };\n * angular.service('SomeService', SomeService);\n * ```\n * @deprecated\n */\nlet $stateParams: StateParams;\n\n/**\n * Global UI-Router variables\n *\n * The router global state as a **Service Object** (injectable during runtime).\n *\n * This object contains globals such as the current state and current parameter values.\n */\nlet $uiRouterGlobals: UIRouterGlobals;\n\n/**\n * The UI-Router instance\n *\n * The [[UIRouter]] singleton (the router instance) as a **Service Object** (injectable during runtime).\n *\n * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap.\n * It has references to the other UI-Router services\n *\n * #### Note: This object is also exposed as [[$uiRouterProvider]] for injection during angular config time.\n */\nlet $uiRouter: UIRouter ;\n\n/**\n * The UI-Router instance\n *\n * The [[UIRouter]] singleton (the router instance) as a **Provider Object** (injectable during config phase).\n *\n * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap.\n * It has references to the other UI-Router services\n *\n * #### Note: This object is also exposed as [[$uiRouter]] for injection during runtime.\n */\nlet $uiRouterProvider: UIRouter;\n\n/**\n * Transition debug/tracing\n *\n * The [[Trace]] singleton as a **Service Object** (injectable during runtime).\n *\n * Enables or disables Transition tracing which can help to debug issues.\n */\nlet $trace: Trace;\n\n/**\n * The Transition Service\n *\n * The [[TransitionService]] singleton as a **Service Object** (injectable during runtime).\n *\n * This angular service exposes the [[TransitionService]] singleton, which is primarily\n * used to register global transition hooks.\n *\n * #### Note: This object is also exposed as [[$transitionsProvider]] for injection during the config phase.\n */\nlet $transitions: TransitionService;\n\n/**\n * The Transition Service\n *\n * The [[TransitionService]] singleton as a **Provider Object** (injectable during config phase)\n *\n * This angular service exposes the [[TransitionService]] singleton, which is primarily\n * used to register global transition hooks.\n *\n * #### Note: This object is also exposed as [[$transitions]] for injection during runtime.\n */\nlet $transitionsProvider: TransitionService;\n\n/**\n * The current [[Transition]] object\n *\n * The current [[Transition]] object as a **Per-Transition Object** (injectable into Resolve, Hooks, Controllers)\n *\n * This object returns information about the current transition, including:\n *\n * - To/from states\n * - To/from parameters\n * - Transition options\n * - States being entered, exited, and retained\n * - Resolve data\n * - A Promise for the transition\n * - Any transition failure information\n * - An injector for both Service and Per-Transition Objects\n */\nlet $transition$: Transition;\n\n/**\n * The State Service\n *\n * The [[StateService]] singleton as a **Service Object** (injectable during runtime).\n *\n * This service used to manage and query information on registered states.\n * It exposes state related APIs including:\n *\n * - Start a [[Transition]]\n * - Imperatively lazy load states\n * - Check if a state is currently active\n * - Look up states by name\n * - Build URLs for a state+parameters\n * - Configure the global Transition error handler\n *\n * This angular service exposes the [[StateService]] singleton.\n */\nlet $state: StateService;\n\n/**\n * The State Registry\n *\n * The [[StateRegistry]] singleton as a **Service Object** (injectable during runtime).\n *\n * This service is used to register/deregister states.\n * It has state registration related APIs including:\n *\n * - Register/deregister states\n * - Listen for state registration/deregistration\n * - Get states by name\n * - Add state decorators (to customize the state creation process)\n *\n * #### Note: This object is also exposed as [[$stateRegistryProvider]] for injection during the config phase.\n */\nlet $stateRegistry: StateRegistry;\n\n/**\n * The State Registry\n *\n * The [[StateRegistry]] singleton as a **Provider Object** (injectable during config time).\n *\n * This service is used to register/deregister states.\n * It has state registration related APIs including:\n *\n * - Register/deregister states\n * - Listen for state registration/deregistration\n * - Get states by name\n * - Add state decorators (to customize the state creation process)\n *\n * #### Note: This object is also exposed as [[$stateRegistry]] for injection during runtime.\n */\nlet $stateRegistryProvider: StateRegistry;\n\n/**\n * The View Scroll provider\n *\n * The [[UIViewScrollProvider]] as a **Provider Object** (injectable during config time).\n *\n * This angular service exposes the [[UIViewScrollProvider]] singleton and is\n * used to disable UI-Router's scroll behavior.\n */\nlet $uiViewScrollProvider: UIViewScrollProvider;\n\n/**\n * The View Scroll function\n *\n * The View Scroll function as a **Service Object** (injectable during runtime).\n *\n * This is a function that scrolls an element into view.\n * The element is scrolled after a `$timeout` so the DOM has time to refresh.\n *\n * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor,\n * this can be enabled by calling [[UIViewScrollProvider.useAnchorScroll]].\n *\n * Note: this function is used by the [[directives.uiView]] when the `autoscroll` expression evaluates to true.\n */\nlet $uiViewScroll: ($element: JQuery) => void;\n\n/**\n * The StateProvider\n *\n * An angular1-only [[StateProvider]] as a **Provider Object** (injectable during config time).\n *\n * This angular service exposes the [[StateProvider]] singleton.\n *\n * The `StateProvider` is primarily used to register states or add custom state decorators.\n *\n * ##### Note: This provider is a ng1 vestige.\n * It is a passthrough to [[$stateRegistry]] and [[$state]].\n */\nlet $stateProvider: StateProvider;\n\n/**\n * The URL Service Provider\n *\n * The [[UrlService]] singleton as a **Provider Object** (injectable during the angular config phase).\n *\n * A service used to configure and interact with the URL.\n * It has URL related APIs including:\n *\n * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]])\n * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]])\n * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]])\n * - delay initial URL synchronization [[UrlService.deferIntercept]].\n * - get or set the current url: [[UrlService.url]]\n *\n * ##### Note: This service can also be injected during runtime as [[$urlService]].\n */\nlet $urlServiceProvider: UrlService;\n\n/**\n * The URL Service\n *\n * The [[UrlService]] singleton as a **Service Object** (injectable during runtime).\n *\n * Note: This service can also be injected during the config phase as [[$urlServiceProvider]].\n *\n * Used to configure the URL.\n * It has URL related APIs including:\n *\n * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]])\n * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]])\n * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]])\n * - delay initial URL synchronization [[UrlService.deferIntercept]].\n * - get or set the current url: [[UrlService.url]]\n *\n * ##### Note: This service can also be injected during the config phase as [[$urlServiceProvider]].\n */\nlet $urlService: UrlService;\n\n/**\n * The URL Router Provider\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlServiceProvider]] instead.\n *\n * The [[UrlRouter]] singleton as a **Provider Object** (injectable during config time).\n *\n * #### Note: This object is also exposed as [[$urlRouter]] for injection during runtime.\n *\n * @deprecated\n */\nlet $urlRouterProvider: UrlRouterProvider;\n\n/**\n * The Url Router\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.\n *\n * The [[UrlRouter]] singleton as a **Service Object** (injectable during runtime).\n *\n * #### Note: This object is also exposed as [[$urlRouterProvider]] for injection during angular config time.\n *\n * @deprecated\n */\nlet $urlRouter: UrlRouter;\n\n/**\n * The URL Matcher Factory\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.\n *\n * The [[UrlMatcherFactory]] singleton as a **Service Object** (injectable during runtime).\n *\n * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects.\n *\n * #### Note: This object is also exposed as [[$urlMatcherFactoryProvider]] for injection during angular config time.\n *\n * @deprecated\n */\nlet $urlMatcherFactory: UrlMatcherFactory;\n\n/**\n * The URL Matcher Factory\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.\n *\n * The [[UrlMatcherFactory]] singleton as a **Provider Object** (injectable during config time).\n *\n * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects.\n *\n * #### Note: This object is also exposed as [[$urlMatcherFactory]] for injection during runtime.\n *\n * @deprecated\n */\nlet $urlMatcherFactoryProvider: UrlMatcherFactory;\n\n\n\n", + "/**\n * # Angular 1 Directives\n *\n * These are the directives included in UI-Router for Angular 1.\n * These directives are used in templates to create viewports and link/navigate to states.\n *\n * @ng1api\n * @preferred\n * @module directives\n */ /** for typedoc */\nimport { ng as angular } from '../angular';\nimport { IAugmentedJQuery, ITimeoutService, IScope, IInterpolateService } from 'angular';\n\nimport {\n Obj, extend, forEach, tail, isString, isObject, isArray, parse, noop, unnestR, identity, uniqR, inArray, removeFrom,\n RawParams, PathNode, StateOrName, StateService, StateDeclaration, UIRouter,\n} from '@uirouter/core';\nimport { UIViewData } from './viewDirective';\nimport EventHandler = JQuery.EventHandler;\n\n/** @hidden Used for typedoc */\nexport interface ng1_directive {} // tslint:disable-line:class-name\n\n/** @hidden */\nfunction parseStateRef(ref: string) {\n let parsed;\n const paramsOnly = ref.match(/^\\s*({[^}]*})\\s*$/);\n if (paramsOnly) ref = '(' + paramsOnly[1] + ')';\n\n parsed = ref.replace(/\\n/g, ' ').match(/^\\s*([^(]*?)\\s*(\\((.*)\\))?\\s*$/);\n if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n return { state: parsed[1] || null, paramExpr: parsed[3] || null };\n}\n\n/** @hidden */\nfunction stateContext(el: IAugmentedJQuery) {\n const $uiView: UIViewData = (el.parent() as IAugmentedJQuery).inheritedData('$uiView');\n const path: PathNode[] = parse('$cfg.path')($uiView);\n return path ? tail(path).state.name : undefined;\n}\n\n/** @hidden */\nfunction processedDef($state: StateService, $element: IAugmentedJQuery, def: Def): Def {\n const uiState = def.uiState || $state.current.name;\n const uiStateOpts = extend(defaultOpts($element, $state), def.uiStateOpts || {});\n const href = $state.href(uiState, def.uiStateParams, uiStateOpts);\n return { uiState, uiStateParams: def.uiStateParams, uiStateOpts, href };\n}\n\n/** @hidden */\ninterface TypeInfo {\n attr: string;\n isAnchor: boolean;\n clickable: boolean;\n}\n\n/** @hidden */\nfunction getTypeInfo(el: IAugmentedJQuery): TypeInfo {\n // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.\n const isSvg = Object.prototype.toString.call(el.prop('href')) === '[object SVGAnimatedString]';\n const isForm = el[0].nodeName === 'FORM';\n\n return {\n attr: isForm ? 'action' : (isSvg ? 'xlink:href' : 'href'),\n isAnchor: el.prop('tagName').toUpperCase() === 'A',\n clickable: !isForm,\n };\n}\n\n/** @hidden */\nfunction clickHook(el: IAugmentedJQuery, $state: StateService, $timeout: ITimeoutService, type: TypeInfo, getDef: () => Def) {\n return function (e: JQueryMouseEventObject) {\n const button = e.which || e.button, target = getDef();\n\n if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || el.attr('target'))) {\n // HACK: This is to allow ng-clicks to be processed before the transition is initiated:\n const transition = $timeout(function () {\n $state.go(target.uiState, target.uiStateParams, target.uiStateOpts);\n });\n e.preventDefault();\n\n // if the state has no URL, ignore one preventDefault from the directive.\n let ignorePreventDefaultCount = type.isAnchor && !target.href ? 1 : 0;\n\n e.preventDefault = function () {\n if (ignorePreventDefaultCount-- <= 0) $timeout.cancel(transition);\n };\n }\n };\n}\n\n/** @hidden */\nfunction defaultOpts(el: IAugmentedJQuery, $state: StateService) {\n return {\n relative: stateContext(el) || $state.$current,\n inherit: true,\n source: 'sref',\n };\n}\n\n/** @hidden */\nfunction bindEvents(element: IAugmentedJQuery, scope: IScope, hookFn: EventHandler, uiStateOpts: any): void {\n let events;\n\n if (uiStateOpts) {\n events = uiStateOpts.events;\n }\n\n if (!isArray(events)) {\n events = ['click'];\n }\n\n const on = element.on ? 'on' : 'bind';\n for (const event of events) {\n element[on](event, hookFn);\n }\n\n scope.$on('$destroy', function() {\n const off = element.off ? 'off' : 'unbind';\n for (const event of events) {\n element[off](event, hookFn);\n }\n });\n}\n\n/**\n * `ui-sref`: A directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of the `ui-sref` is the name of the state to link to.\n *\n * #### Example:\n * This will activate the `home` state when the link is clicked.\n * ```html\n * Home\n * ```\n *\n * ### Relative Links\n * You can also use relative state paths within `ui-sref`, just like a relative path passed to `$state.go()` ([[StateService.go]]).\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create a relative `ui-sref` which always targets the same destination.\n *\n * #### Example:\n * Both these links are relative to the parent state, even when a child state is currently active.\n * ```html\n * child 1 state\n * child 2 state\n * ```\n *\n * This link activates the parent state.\n * ```html\n * Return\n * ```\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]] method).\n *\n * #### Example:\n * Assuming the `users` state has a url of `/users/`\n * ```html\n * Users\n * ```\n *\n * ### Parameter Values\n * In addition to the state name, a `ui-sref` can include parameter values which are applied when activating the state.\n * Param values can be provided in the `ui-sref` value after the state name, enclosed by parentheses.\n * The content inside the parentheses is an expression, evaluated to the parameter values.\n *\n * #### Example:\n * This example renders a list of links to users.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n *
  • \n * {{ user.displayName }}\n *
  • \n * ```\n *\n * Note:\n * The parameter values expression is `$watch`ed for updates.\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-sref-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n *\n * #### Example:\n * ```html\n * Home\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-sref-opts` attribute.\n *\n * #### Example:\n * ```html\n * \n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Examples\n * If you have the following template:\n *\n * ```html\n * Home\n * About\n * Next page\n *\n * \n * ```\n *\n * Then (assuming the current state is `contacts`) the rendered html including hrefs would be:\n *\n * ```html\n * Home\n * About\n * Next page\n *\n *
      \n *
    • \n * Joe\n *
    • \n *
    • \n * Alice\n *
    • \n *
    • \n * Bob\n *
    • \n *
    \n *\n * Home\n * ```\n *\n * ### Notes\n *\n * - You can use `ui-sref` to change **only the parameter values** by omitting the state name and parentheses.\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * English\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n *\n * - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons).\n * If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive.\n */\nlet uiSrefDirective: ng1_directive;\nuiSrefDirective = ['$uiRouter', '$timeout',\n function $StateRefDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n const $state = $uiRouter.stateService;\n\n return {\n restrict: 'A',\n require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n link: function (scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n const type = getTypeInfo(element);\n const active = uiSrefActive[1] || uiSrefActive[0];\n let unlinkInfoFn: Function = null;\n let hookFn;\n\n const rawDef = {} as Def;\n const getDef = () => processedDef($state, element, rawDef);\n\n const ref = parseStateRef(attrs.uiSref);\n rawDef.uiState = ref.state;\n rawDef.uiStateOpts = attrs.uiSrefOpts ? scope.$eval(attrs.uiSrefOpts) : {};\n\n function update() {\n const def = getDef();\n if (unlinkInfoFn) unlinkInfoFn();\n if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n if (def.href != null) attrs.$set(type.attr, def.href);\n }\n\n if (ref.paramExpr) {\n scope.$watch(ref.paramExpr, function (val) {\n rawDef.uiStateParams = extend({}, val);\n update();\n }, true);\n rawDef.uiStateParams = extend({}, scope.$eval(ref.paramExpr));\n }\n\n update();\n\n scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update));\n scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update));\n\n if (!type.clickable) return;\n hookFn = clickHook(element, $state, $timeout, type, getDef);\n bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n },\n };\n }];\n\n/**\n * `ui-state`: A fully dynamic directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * **This directive is very similar to [[uiSref]], but it `$observe`s and `$watch`es/evaluates all its inputs.**\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of `ui-state` is an expression which is `$watch`ed and evaluated as the state to link to.\n * **This is in contrast with `ui-sref`, which takes a state name as a string literal.**\n *\n * #### Example:\n * Create a list of links.\n * ```html\n *
  • \n * {{ link.displayName }}\n *
  • \n * ```\n *\n * ### Relative Links\n * If the expression evaluates to a relative path, it is processed like [[uiSref]].\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create relative `ui-state` which always targets the same destination.\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]] method).\n *\n * ### Parameter Values\n * In addition to the state name expression, a `ui-state` can include parameter values which are applied when activating the state.\n * Param values should be provided using the `ui-state-params` attribute.\n * The `ui-state-params` attribute value is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * This example renders a list of links with param values.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n *
  • \n * {{ link.displayName }}\n *
  • \n * ```\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-state-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n * The value of the `ui-state-opts` is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * ```html\n * Home\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-state-opts` attribute.\n *\n * #### Example:\n * ```html\n * \n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Notes\n *\n * - You can use `ui-params` to change **only the parameter values** by omitting the state name and supplying only `ui-state-params`.\n * However, it might be simpler to use [[uiSref]] parameter-only links.\n *\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * English\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n * ```\n */\nlet uiStateDirective: ng1_directive;\nuiStateDirective = ['$uiRouter', '$timeout',\n function $StateRefDynamicDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n const $state = $uiRouter.stateService;\n\n return {\n restrict: 'A',\n require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n link: function (scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n const type = getTypeInfo(element);\n const active = uiSrefActive[1] || uiSrefActive[0];\n let unlinkInfoFn: Function = null;\n let hookFn;\n\n const rawDef = {} as Def;\n const getDef = () => processedDef($state, element, rawDef);\n\n const inputAttrs = ['uiState', 'uiStateParams', 'uiStateOpts'];\n const watchDeregFns = inputAttrs.reduce((acc, attr) => (acc[attr] = noop, acc), {});\n\n function update() {\n const def = getDef();\n if (unlinkInfoFn) unlinkInfoFn();\n if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n if (def.href != null) attrs.$set(type.attr, def.href);\n }\n\n inputAttrs.forEach((field) => {\n rawDef[field] = attrs[field] ? scope.$eval(attrs[field]) : null;\n\n attrs.$observe(field, (expr) => {\n watchDeregFns[field]();\n watchDeregFns[field] = scope.$watch(expr, (newval) => {\n rawDef[field] = newval;\n update();\n }, true);\n });\n });\n\n update();\n\n scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update));\n scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update));\n\n if (!type.clickable) return;\n hookFn = clickHook(element, $state, $timeout, type, getDef);\n bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n },\n };\n }];\n\n\n/**\n * `ui-sref-active` and `ui-sref-active-eq`: A directive that adds a CSS class when a `ui-sref` is active\n *\n * A directive working alongside [[uiSref]] and [[uiState]] to add classes to an element when the\n * related directive's state is active (and remove them when it is inactive).\n *\n * The primary use-case is to highlight the active link in navigation menus,\n * distinguishing it from the inactive menu items.\n *\n * ### Linking to a `ui-sref` or `ui-state`\n * `ui-sref-active` can live on the same element as `ui-sref`/`ui-state`, or it can be on a parent element.\n * If a `ui-sref-active` is a parent to more than one `ui-sref`/`ui-state`, it will apply the CSS class when **any of the links are active**.\n *\n * ### Matching\n *\n * The `ui-sref-active` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state **or any child state is active**.\n * This is a \"fuzzy match\" which uses [[StateService.includes]].\n *\n * The `ui-sref-active-eq` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state is directly active (not when child states are active).\n * This is an \"exact match\" which uses [[StateService.is]].\n *\n * ### Parameter values\n * If the `ui-sref`/`ui-state` includes parameter values, the current parameter values must match the link's values for the link to be highlighted.\n * This allows a list of links to the same state with different parameters to be rendered, and the correct one highlighted.\n *\n * #### Example:\n * ```html\n *
  • \n * {{ user.lastName }}\n *
  • \n * ```\n *\n * ### Examples\n *\n * Given the following template:\n * #### Example:\n * ```html\n * \n * ```\n *\n * When the app state is `app.user` (or any child state),\n * and contains the state parameter \"user\" with value \"bilbobaggins\",\n * the resulting HTML will appear as (note the 'active' class):\n *\n * ```html\n * \n * ```\n *\n * ### Glob mode\n *\n * It is possible to pass `ui-sref-active` an expression that evaluates to an object.\n * The objects keys represent active class names and values represent the respective state names/globs.\n * `ui-sref-active` will match if the current active state **includes** any of\n * the specified state names/globs, even the abstract ones.\n *\n * #### Example:\n * Given the following template, with \"admin\" being an abstract state:\n * ```html\n *
    \n * Roles\n *
    \n * ```\n *\n * When the current state is \"admin.roles\" the \"active\" class will be applied to both the `
    ` and `` elements.\n * It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`.\n *\n * ### Notes:\n *\n * - The class name is interpolated **once** during the directives link time (any further changes to the\n * interpolated value are ignored).\n *\n * - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'`\n */\nlet uiSrefActiveDirective: ng1_directive;\nuiSrefActiveDirective = ['$state', '$stateParams', '$interpolate', '$uiRouter',\n function $StateRefActiveDirective($state: StateService, $stateParams: Obj, $interpolate: IInterpolateService, $uiRouter: UIRouter) {\n return {\n restrict: 'A',\n controller: ['$scope', '$element', '$attrs',\n function ($scope: IScope, $element: IAugmentedJQuery, $attrs: any) {\n const states: StateData[] = [];\n let activeEqClass: string;\n let uiSrefActive: any;\n\n // There probably isn't much point in $observing this\n // uiSrefActive and uiSrefActiveEq share the same directive object with some\n // slight difference in logic routing\n activeEqClass = $interpolate($attrs.uiSrefActiveEq || '', false)($scope);\n\n try {\n uiSrefActive = $scope.$eval($attrs.uiSrefActive);\n } catch (e) {\n // Do nothing. uiSrefActive is not a valid expression.\n // Fall back to using $interpolate below\n }\n uiSrefActive = uiSrefActive || $interpolate($attrs.uiSrefActive || '', false)($scope);\n if (isObject(uiSrefActive)) {\n forEach(uiSrefActive, function (stateOrName: StateOrName, activeClass: string) {\n if (isString(stateOrName)) {\n const ref = parseStateRef(stateOrName);\n addState(ref.state, $scope.$eval(ref.paramExpr), activeClass);\n }\n });\n }\n\n // Allow uiSref to communicate with uiSrefActive[Equals]\n this.$$addStateInfo = function (newState: string, newParams: Obj) {\n // we already got an explicit state provided by ui-sref-active, so we\n // shadow the one that comes from ui-sref\n if (isObject(uiSrefActive) && states.length > 0) {\n return;\n }\n const deregister = addState(newState, newParams, uiSrefActive);\n update();\n return deregister;\n };\n\n function updateAfterTransition(trans) {\n trans.promise.then(update, noop);\n }\n\n $scope.$on('$stateChangeSuccess', update);\n $scope.$on('$destroy', $uiRouter.transitionService.onStart({}, updateAfterTransition));\n if ($uiRouter.globals.transition) {\n updateAfterTransition($uiRouter.globals.transition);\n }\n\n function addState(stateName: string, stateParams: Obj, activeClass: string) {\n const state = $state.get(stateName, stateContext($element));\n\n const stateInfo = {\n state: state || { name: stateName },\n params: stateParams,\n activeClass: activeClass,\n };\n\n states.push(stateInfo);\n\n return function removeState() {\n removeFrom(states)(stateInfo);\n };\n }\n\n // Update route state\n function update() {\n const splitClasses = str =>\n str.split(/\\s/).filter(identity);\n const getClasses = (stateList: StateData[]) =>\n stateList.map(x => x.activeClass).map(splitClasses).reduce(unnestR, []);\n\n const allClasses = getClasses(states).concat(splitClasses(activeEqClass)).reduce(uniqR, []);\n const fuzzyClasses = getClasses(states.filter(x => $state.includes(x.state.name, x.params)));\n const exactlyMatchesAny = !!states.filter(x => $state.is(x.state.name, x.params)).length;\n const exactClasses = exactlyMatchesAny ? splitClasses(activeEqClass) : [];\n\n const addClasses = fuzzyClasses.concat(exactClasses).reduce(uniqR, []);\n const removeClasses = allClasses.filter(cls => !inArray(addClasses, cls));\n\n $scope.$evalAsync(() => {\n addClasses.forEach(className => $element.addClass(className));\n removeClasses.forEach(className => $element.removeClass(className));\n });\n }\n\n update();\n }],\n };\n }];\n\n/** @hidden */\ninterface Def { uiState: string; href: string; uiStateParams: Obj; uiStateOpts: any; }\n/** @hidden */\ninterface StateData { state: StateDeclaration; params: RawParams; activeClass: string; }\n\nangular.module('ui.router.state')\n .directive('uiSref', uiSrefDirective)\n .directive('uiSrefActive', uiSrefActiveDirective)\n .directive('uiSrefActiveEq', uiSrefActiveDirective)\n .directive('uiState', uiStateDirective);\n", + "/** @module ng1 */ /** for typedoc */\n\nimport { ng as angular } from './angular';\nimport { Obj, StateService, StateOrName } from '@uirouter/core';\n\n/**\n * `isState` Filter: truthy if the current state is the parameter\n *\n * Translates to [[StateService.is]] `$state.is(\"stateName\")`.\n *\n * #### Example:\n * ```html\n *
    show if state is 'stateName'
    \n * ```\n */\n$IsStateFilter.$inject = ['$state'];\nexport function $IsStateFilter($state: StateService) {\n const isFilter: any = function(state: StateOrName, params: Obj, options?: { relative?: StateOrName }) {\n return $state.is(state, params, options);\n };\n isFilter.$stateful = true;\n return isFilter;\n}\n\n/**\n * `includedByState` Filter: truthy if the current state includes the parameter\n *\n * Translates to [[StateService.includes]]` $state.is(\"fullOrPartialStateName\")`.\n *\n * #### Example:\n * ```html\n *
    show if state includes 'fullOrPartialStateName'
    \n * ```\n */\n$IncludedByStateFilter.$inject = ['$state'];\nexport function $IncludedByStateFilter($state: StateService) {\n const includesFilter: any = function(state: StateOrName, params: Obj, options: { relative?: StateOrName }) {\n return $state.includes(state, params, options);\n };\n includesFilter.$stateful = true;\n return includesFilter;\n}\n\nangular.module('ui.router.state')\n .filter('isState', $IsStateFilter)\n .filter('includedByState', $IncludedByStateFilter);\n", + "/**\n * @ng1api\n * @module directives\n */ /** for typedoc */\nimport { ng as angular } from '../angular';\nimport { IInterpolateService, IScope, ITranscludeFunction, IAugmentedJQuery, ITimeoutService } from 'angular';\n\nimport {\n extend, unnestR, filter, tail, isDefined, isFunction, isString, trace, parse,\n ActiveUIView, TransitionService, ResolveContext, Transition, PathNode, StateDeclaration,\n Param, kebobString, HookRegOptions, ViewService, $QLike, Obj, TypedMap, noop,\n} from '@uirouter/core';\nimport { Ng1ViewConfig } from '../statebuilders/views';\nimport { Ng1Controller, Ng1StateDeclaration } from '../interface';\nimport { getLocals } from '../services';\nimport { ng1_directive } from './stateDirectives';\n\n/** @hidden */\nexport type UIViewData = {\n $cfg: Ng1ViewConfig;\n $uiView: ActiveUIView;\n};\n\n/** @hidden */\nexport type UIViewAnimData = {\n $animEnter: Promise;\n $animLeave: Promise;\n $$animLeave: { resolve: () => any; } // \"deferred\"\n};\n\n/**\n * `ui-view`: A viewport directive which is filled in by a view from the active state.\n *\n * ### Attributes\n *\n * - `name`: (Optional) A view name.\n * The name should be unique amongst the other views in the same state.\n * You can have views of the same name that live in different states.\n * The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]).\n *\n * - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated.\n * Uses [[$uiViewScroll]] to do the scrolling.\n *\n * - `onload`: Expression to evaluate whenever the view updates.\n *\n * #### Example:\n * A view can be unnamed or named.\n * ```html\n * \n *
    \n *\n * \n *
    \n *\n * \n * \n * ```\n *\n * You can only have one unnamed view within any template (or root html). If you are only using a\n * single view and it is unnamed then you can populate it like so:\n *\n * ```html\n *
    \n * $stateProvider.state(\"home\", {\n * template: \"

    HELLO!

    \"\n * })\n * ```\n *\n * The above is a convenient shortcut equivalent to specifying your view explicitly with the\n * [[Ng1StateDeclaration.views]] config property, by name, in this case an empty name:\n *\n * ```js\n * $stateProvider.state(\"home\", {\n * views: {\n * \"\": {\n * template: \"

    HELLO!

    \"\n * }\n * }\n * })\n * ```\n *\n * But typically you'll only use the views property if you name your view or have more than one view\n * in the same template. There's not really a compelling reason to name a view if its the only one,\n * but you could if you wanted, like so:\n *\n * ```html\n *
    \n * ```\n *\n * ```js\n * $stateProvider.state(\"home\", {\n * views: {\n * \"main\": {\n * template: \"

    HELLO!

    \"\n * }\n * }\n * })\n * ```\n *\n * Really though, you'll use views to set up multiple views:\n *\n * ```html\n *
    \n *
    \n *
    \n * ```\n *\n * ```js\n * $stateProvider.state(\"home\", {\n * views: {\n * \"\": {\n * template: \"

    HELLO!

    \"\n * },\n * \"chart\": {\n * template: \"\"\n * },\n * \"data\": {\n * template: \"\"\n * }\n * }\n * })\n * ```\n *\n * #### Examples for `autoscroll`:\n * ```html\n * \n * \n *\n * \n * \n * \n * \n * ```\n *\n * Resolve data:\n *\n * The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this\n * can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template.\n *\n * Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the\n * controller is instantiated. The `$onInit()` hook can be used to perform initialization code which\n * depends on `$resolve` data.\n *\n * #### Example:\n * ```js\n * $stateProvider.state('home', {\n * template: '',\n * resolve: {\n * user: function(UserService) { return UserService.fetchUser(); }\n * }\n * });\n * ```\n */\nexport let uiView: ng1_directive;\nuiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q',\nfunction $ViewDirective($view: ViewService, $animate: any, $uiViewScroll: any, $interpolate: IInterpolateService, $q: $QLike) {\n\n function getRenderer(attrs: Obj, scope: IScope) {\n return {\n enter: function(element: JQuery, target: any, cb: Function) {\n if (angular.version.minor > 2) {\n $animate.enter(element, null, target).then(cb);\n } else {\n $animate.enter(element, null, target, cb);\n }\n },\n leave: function(element: JQuery, cb: Function) {\n if (angular.version.minor > 2) {\n $animate.leave(element).then(cb);\n } else {\n $animate.leave(element, cb);\n }\n },\n };\n }\n\n function configsEqual(config1: Ng1ViewConfig, config2: Ng1ViewConfig) {\n return config1 === config2;\n }\n\n const rootData = {\n $cfg: { viewDecl: { $context: $view._pluginapi._rootViewContext() } },\n $uiView: { },\n };\n\n const directive = {\n count: 0,\n restrict: 'ECA',\n terminal: true,\n priority: 400,\n transclude: 'element',\n compile: function (tElement: JQuery, tAttrs: Obj, $transclude: ITranscludeFunction) {\n\n return function (scope: IScope, $element: IAugmentedJQuery, attrs: Obj) {\n const onloadExp = attrs['onload'] || '',\n autoScrollExp = attrs['autoscroll'],\n renderer = getRenderer(attrs, scope),\n inherited = $element.inheritedData('$uiView') || rootData,\n name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default';\n\n let previousEl: JQuery,\n currentEl: JQuery,\n currentScope: IScope,\n viewConfig: Ng1ViewConfig,\n unregister: Function;\n\n const activeUIView: ActiveUIView = {\n $type: 'ng1',\n id: directive.count++, // Global sequential ID for ui-view tags added to DOM\n name: name, // ui-view name (
    \n fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + '.' + name : name, // fully qualified name, describes location in DOM\n config: null, // The ViewConfig loaded (from a state.views definition)\n configUpdated: configUpdatedCallback, // Called when the matching ViewConfig changes\n get creationContext() { // The context in which this ui-view \"tag\" was created\n const fromParentTagConfig = parse('$cfg.viewDecl.$context')(inherited);\n // Allow \n // See https://github.com/angular-ui/ui-router/issues/3355\n const fromParentTag = parse('$uiView.creationContext')(inherited);\n return fromParentTagConfig || fromParentTag;\n },\n };\n\n trace.traceUIViewEvent('Linking', activeUIView);\n\n function configUpdatedCallback(config?: Ng1ViewConfig) {\n if (config && !(config instanceof Ng1ViewConfig)) return;\n if (configsEqual(viewConfig, config)) return;\n trace.traceUIViewConfigUpdated(activeUIView, config && config.viewDecl && config.viewDecl.$context);\n\n viewConfig = config;\n updateView(config);\n }\n\n $element.data('$uiView', { $uiView: activeUIView });\n\n updateView();\n\n unregister = $view.registerUIView(activeUIView);\n scope.$on('$destroy', function() {\n trace.traceUIViewEvent('Destroying/Unregistering', activeUIView);\n unregister();\n });\n\n function cleanupLastView() {\n if (previousEl) {\n trace.traceUIViewEvent('Removing (previous) el', previousEl.data('$uiView'));\n previousEl.remove();\n previousEl = null;\n }\n\n if (currentScope) {\n trace.traceUIViewEvent('Destroying scope', activeUIView);\n currentScope.$destroy();\n currentScope = null;\n }\n\n if (currentEl) {\n const _viewData = currentEl.data('$uiViewAnim');\n trace.traceUIViewEvent('Animate out', _viewData);\n renderer.leave(currentEl, function() {\n _viewData.$$animLeave.resolve();\n previousEl = null;\n });\n\n previousEl = currentEl;\n currentEl = null;\n }\n }\n\n function updateView(config?: Ng1ViewConfig) {\n const newScope = scope.$new();\n const animEnter = $q.defer(), animLeave = $q.defer();\n\n const $uiViewData: UIViewData = {\n $cfg: config,\n $uiView: activeUIView,\n };\n\n const $uiViewAnim: UIViewAnimData = {\n $animEnter: animEnter.promise,\n $animLeave: animLeave.promise,\n $$animLeave: animLeave,\n };\n\n /**\n * @ngdoc event\n * @name ui.router.state.directive:ui-view#$viewContentLoading\n * @eventOf ui.router.state.directive:ui-view\n * @eventType emits on ui-view directive scope\n * @description\n *\n * Fired once the view **begins loading**, *before* the DOM is rendered.\n *\n * @param {Object} event Event object.\n * @param {string} viewName Name of the view.\n */\n newScope.$emit('$viewContentLoading', name);\n\n const cloned = $transclude(newScope, function(clone) {\n clone.data('$uiViewAnim', $uiViewAnim);\n clone.data('$uiView', $uiViewData);\n renderer.enter(clone, $element, function onUIViewEnter() {\n animEnter.resolve();\n if (currentScope) currentScope.$emit('$viewContentAnimationEnded');\n\n if (isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {\n $uiViewScroll(clone);\n }\n });\n\n cleanupLastView();\n });\n\n currentEl = cloned;\n currentScope = newScope;\n /**\n * @ngdoc event\n * @name ui.router.state.directive:ui-view#$viewContentLoaded\n * @eventOf ui.router.state.directive:ui-view\n * @eventType emits on ui-view directive scope\n * @description *\n * Fired once the view is **loaded**, *after* the DOM is rendered.\n *\n * @param {Object} event Event object.\n */\n currentScope.$emit('$viewContentLoaded', config || viewConfig);\n currentScope.$eval(onloadExp);\n }\n };\n },\n };\n\n return directive;\n}];\n\n$ViewDirectiveFill.$inject = ['$compile', '$controller', '$transitions', '$view', '$q', '$timeout'];\n/** @hidden */\nfunction $ViewDirectiveFill($compile: angular.ICompileService,\n $controller: angular.IControllerService,\n $transitions: TransitionService,\n $view: ViewService,\n $q: angular.IQService,\n $timeout: ITimeoutService) {\n const getControllerAs = parse('viewDecl.controllerAs');\n const getResolveAs = parse('viewDecl.resolveAs');\n\n return {\n restrict: 'ECA',\n priority: -400,\n compile: function (tElement: JQuery) {\n const initial = tElement.html();\n tElement.empty();\n\n return function (scope: IScope, $element: JQuery) {\n const data: UIViewData = $element.data('$uiView');\n if (!data) {\n $element.html(initial);\n $compile($element.contents() as any)(scope);\n return;\n }\n\n const cfg: Ng1ViewConfig = data.$cfg || { viewDecl: {}, getTemplate: noop };\n const resolveCtx: ResolveContext = cfg.path && new ResolveContext(cfg.path);\n $element.html(cfg.getTemplate($element, resolveCtx) || initial);\n trace.traceUIViewFill(data.$uiView, $element.html());\n\n const link = $compile($element.contents() as any);\n const controller = cfg.controller;\n const controllerAs: string = getControllerAs(cfg);\n const resolveAs: string = getResolveAs(cfg);\n const locals = resolveCtx && getLocals(resolveCtx);\n\n scope[resolveAs] = locals;\n\n if (controller) {\n const controllerInstance = $controller(controller, extend({}, locals, { $scope: scope, $element: $element }));\n if (controllerAs) {\n scope[controllerAs] = controllerInstance;\n scope[controllerAs][resolveAs] = locals;\n }\n\n // TODO: Use $view service as a central point for registering component-level hooks\n // Then, when a component is created, tell the $view service, so it can invoke hooks\n // $view.componentLoaded(controllerInstance, { $scope: scope, $element: $element });\n // scope.$on('$destroy', () => $view.componentUnloaded(controllerInstance, { $scope: scope, $element: $element }));\n\n $element.data('$ngControllerController', controllerInstance);\n $element.children().data('$ngControllerController', controllerInstance);\n\n registerControllerCallbacks($q, $transitions, controllerInstance, scope, cfg);\n }\n\n // Wait for the component to appear in the DOM\n if (isString(cfg.viewDecl.component)) {\n const cmp = cfg.viewDecl.component;\n const kebobName = kebobString(cmp);\n const tagRegexp = new RegExp(`^(x-|data-)?${kebobName}$`, 'i');\n\n const getComponentController = () => {\n const directiveEl = [].slice.call($element[0].children)\n .filter((el: Element) => el && el.tagName && tagRegexp.exec(el.tagName)) ;\n\n return directiveEl && angular.element(directiveEl).data(`$${cmp}Controller`);\n };\n\n const deregisterWatch = scope.$watch(getComponentController, function(ctrlInstance) {\n if (!ctrlInstance) return;\n registerControllerCallbacks($q, $transitions, ctrlInstance, scope, cfg);\n deregisterWatch();\n });\n }\n\n link(scope);\n };\n },\n };\n}\n\n/** @hidden */\nconst hasComponentImpl = typeof (angular as any).module('ui.router')['component'] === 'function';\n/** @hidden incrementing id */\nlet _uiCanExitId = 0;\n\n/** @hidden TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */\nfunction registerControllerCallbacks($q: angular.IQService,\n $transitions: TransitionService,\n controllerInstance: Ng1Controller,\n $scope: IScope,\n cfg: Ng1ViewConfig) {\n // Call $onInit() ASAP\n if (isFunction(controllerInstance.$onInit) && !(cfg.viewDecl.component && hasComponentImpl)) {\n controllerInstance.$onInit();\n }\n\n const viewState: Ng1StateDeclaration = tail(cfg.path).state.self;\n\n const hookOptions: HookRegOptions = { bind: controllerInstance };\n // Add component-level hook for onParamsChange\n if (isFunction(controllerInstance.uiOnParamsChanged)) {\n const resolveContext: ResolveContext = new ResolveContext(cfg.path);\n const viewCreationTrans = resolveContext.getResolvable('$transition$').data;\n\n // Fire callback on any successful transition\n const paramsUpdated = ($transition$: Transition) => {\n // Exit early if the $transition$ is the same as the view was created within.\n // Exit early if the $transition$ will exit the state the view is for.\n if ($transition$ === viewCreationTrans || $transition$.exiting().indexOf(viewState as StateDeclaration) !== -1) return;\n\n const toParams = $transition$.params('to') as TypedMap;\n const fromParams = $transition$.params>('from') as TypedMap;\n const toSchema: Param[] = $transition$.treeChanges().to.map((node: PathNode) => node.paramSchema).reduce(unnestR, []);\n const fromSchema: Param[] = $transition$.treeChanges().from.map((node: PathNode) => node.paramSchema).reduce(unnestR, []);\n\n // Find the to params that have different values than the from params\n const changedToParams = toSchema.filter((param: Param) => {\n const idx = fromSchema.indexOf(param);\n return idx === -1 || !fromSchema[idx].type.equals(toParams[param.id], fromParams[param.id]);\n });\n\n // Only trigger callback if a to param has changed or is new\n if (changedToParams.length) {\n const changedKeys: string[] = changedToParams.map(x => x.id);\n // Filter the params to only changed/new to params. `$transition$.params()` may be used to get all params.\n const newValues = filter(toParams, (val, key) => changedKeys.indexOf(key) !== -1);\n controllerInstance.uiOnParamsChanged(newValues, $transition$);\n }\n };\n $scope.$on('$destroy', $transitions.onSuccess({}, paramsUpdated, hookOptions));\n }\n\n // Add component-level hook for uiCanExit\n if (isFunction(controllerInstance.uiCanExit)) {\n const id = _uiCanExitId++;\n const cacheProp = '_uiCanExitIds';\n\n // Returns true if a redirect transition already answered truthy\n const prevTruthyAnswer = (trans: Transition) =>\n !!trans && (trans[cacheProp] && trans[cacheProp][id] === true || prevTruthyAnswer(trans.redirectedFrom()));\n\n // If a user answered yes, but the transition was later redirected, don't also ask for the new redirect transition\n const wrappedHook = (trans: Transition) => {\n let promise;\n const ids = trans[cacheProp] = trans[cacheProp] || {};\n\n if (!prevTruthyAnswer(trans)) {\n promise = $q.when(controllerInstance.uiCanExit(trans));\n promise.then(val => ids[id] = (val !== false));\n }\n return promise;\n };\n\n const criteria = { exiting: viewState.name };\n $scope.$on('$destroy', $transitions.onBefore(criteria, wrappedHook, hookOptions));\n }\n}\n\nangular.module('ui.router.state').directive('uiView', uiView);\nangular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);\n", + "/** @module ng1 */ /** */\nimport { ng as angular } from './angular';\nimport { IServiceProviderFactory } from 'angular';\nimport IAnchorScrollService = angular.IAnchorScrollService;\nimport ITimeoutService = angular.ITimeoutService;\n\nexport interface UIViewScrollProvider {\n /**\n * Uses standard anchorScroll behavior\n *\n * Reverts [[$uiViewScroll]] back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)\n * service for scrolling based on the url anchor.\n */\n useAnchorScroll(): void;\n}\n\n\n/** @hidden */\nfunction $ViewScrollProvider() {\n\n let useAnchorScroll = false;\n\n this.useAnchorScroll = function () {\n useAnchorScroll = true;\n };\n\n this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll: IAnchorScrollService, $timeout: ITimeoutService): Function {\n if (useAnchorScroll) {\n return $anchorScroll;\n }\n\n return function ($element: JQuery) {\n return $timeout(function () {\n $element[0].scrollIntoView();\n }, 0, false);\n };\n }];\n}\n\nangular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);\n", + "/**\n * Main entry point for angular 1.x build\n * @module ng1\n */ /** */\n\nexport * from './interface';\nexport * from './services';\nexport * from './statebuilders/views';\nexport * from './stateProvider';\nexport * from './urlRouterProvider';\n\nimport './injectables';\nimport './directives/stateDirectives';\nimport './stateFilters';\nimport './directives/viewDirective';\nimport './viewScroll';\n\nexport default 'ui.router';\n\nimport * as core from '@uirouter/core';\nexport { core };\nexport * from '@uirouter/core';\n\n" ], "names": [ "ng_from_import.module", @@ -181,12 +181,10 @@ "values", "root", "all", - "prop", "pattern", - "pairs", "parseUrl", "__extends", "id" ], - "mappings": ";;;;;;;;;;;;;;;;AAMA,IAAI,cAAc,GAAG,OAAO,CAAC;AAE7B,AAAO,IAAM,EAAE,GAAG,CAAC,cAAc,IAAIA,qBAAqB,IAAI,cAAc,GAAG,cAAc;;ACR7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,eAAsB,EAAY;IAChC,IAAI,YAAY,GAAG,EAAE,CAAC,KAAK,C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AC,iBAAiB,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAQ,kBAAkB,CAAC,CAAC;;ACnfhF;AACA,AAgBA;AACA;IAEE,IAAI,eAAe,GAAG,KAAK,CAAC;IAE5B,IAAI,CAAC,eAAe,GAAG;QACrB,eAAe,GAAG,IAAI,CAAC;KACxB,CAAC;IAEF,IAAI,CAAC,IAAI,GAAG,CAAC,eAAe,EAAE,UAAU,EAAE,UAAU,aAAmC,EAAE,QAAyB;YAChH,IAAI,eAAe,EAAE;gBACnB,OAAO,aAAa,CAAC;aACtB;YAED,OAAO,UAAU,QAAgB;gBAC/B,OAAO,QAAQ,CAAC;oBACd,QAAQ,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC;iBAC9B,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;aACd,CAAC;SACH,CAAC,CAAC;CACJ;AAEDA,EAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,eAAe,EAA4B,mBAAmB,CAAC,CAAC;;ACvC3G;;;;AAMA,AAWA,YAAe,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" } \ No newline at end of file diff --git a/UI/WebServerResources/js/vendor/angular-ui-router.min.js b/UI/WebServerResources/js/vendor/angular-ui-router.min.js index 65a814424..c5383fd3c 100644 --- a/UI/WebServerResources/js/vendor/angular-ui-router.min.js +++ b/UI/WebServerResources/js/vendor/angular-ui-router.min.js @@ -4,9 +4,9 @@ * This causes it to be incompatible with plugins that depend on @uirouter/core. * We recommend switching to the ui-router-core.js and ui-router-angularjs.js bundles instead. * For more information, see https://ui-router.github.io/blog/uirouter-for-angularjs-umd-bundles - * @version v1.0.12 + * @version v1.0.13 * @link https://ui-router.github.io * @license MIT License, http://www.opensource.org/licenses/MIT */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("angular")):"function"==typeof define&&define.amd?define(["exports","angular"],e):e(t["@uirouter/angularjs"]={},t.angular)}(this,function(t,e){"use strict";function r(t){function e(r){return r.length>=n?t.apply(null,r):function(){return e(r.concat([].slice.apply(arguments)))}}var r=[].slice.apply(arguments,[1]),n=t.length;return e(r)}function n(){var t=arguments,e=t.length-1;return function(){for(var r=e,n=t[e].apply(this,arguments);r--;)n=t[r].call(this,n);return n}}function i(){for(var t=[],e=0;e=0&&t.splice(r,1),t}function v(t,e){return t.push(e),e}function m(t){for(var e=[],r=1;r1||o.ctrlKey||o.metaKey||o.shiftKey||t.attr("target"))){var s=r(function(){e.go(u.uiState,u.uiStateParams,u.uiStateOpts)});o.preventDefault();var c=n.isAnchor&&!u.href?1:0;o.preventDefault=function(){c--<=0&&r.cancel(s)}}}}function Et(t,e){return{relative:$t(t)||e.$current,inherit:!0,source:"sref"}}function Ct(t,e,r,n){var i;n&&(i=n.events),te(i)||(i=["click"]);for(var o=t.on?"on":"bind",a=0,u=i;athis._limit&&e.shift(),t},t.prototype.dequeue=function(){if(this.size())return this._items.splice(0,1)[0]},t.prototype.clear=function(){var t=this._items;return this._items=[],t},t.prototype.size=function(){return this._items.length},t.prototype.remove=function(t){var e=this._items.indexOf(t);return e>-1&&this._items.splice(e,1)[0]},t.prototype.peekTail=function(){return this._items[this._items.length-1]},t.prototype.peekHead=function(){if(this.size())return this._items[0]},t}();!function(t){t[t.SUPERSEDED=2]="SUPERSEDED",t[t.ABORTED=3]="ABORTED",t[t.INVALID=4]="INVALID",t[t.IGNORED=5]="IGNORED",t[t.ERROR=6]="ERROR"}(t.RejectType||(t.RejectType={}));var Ae=0,He=function(){function e(t,e,r){this.$id=Ae++,this.type=t,this.message=e,this.detail=r}return e.prototype.toString=function(){var t=function(t){return t&&t.toString!==Object.prototype.toString?t.toString():J(t)}(this.detail),e=this;return"Transition Rejection($id: "+e.$id+" type: "+e.type+", message: "+e.message+", detail: "+t+")"},e.prototype.toPromise=function(){return he(Ve(this),{_transitionRejection:this})},e.isRejectionPromise=function(t){return t&&"function"==typeof t.then&&Ft(e)(t._transitionRejection)},e.superseded=function(r,n){var i=new e(t.RejectType.SUPERSEDED,"The transition has been superseded by a different transition",r);return n&&n.redirected&&(i.redirected=!0),i},e.redirected=function(t){return e.superseded(t,{redirected:!0})},e.invalid=function(r){return new e(t.RejectType.INVALID,"This transition is invalid",r)},e.ignored=function(r){return new e(t.RejectType.IGNORED,"The transition was ignored",r)},e.aborted=function(r){return new e(t.RejectType.ABORTED,"The transition has been aborted",r)},e.errored=function(r){return new e(t.RejectType.ERROR,"The transition errored",r)},e.normalize=function(t){return Ft(e)(t)?t:e.errored(t)},e}(),qe=function(t){var e=t.viewDecl,r=e.$context.name||"(root)";return"[View#"+t.$id+" from '"+r+"' state]: target ui-view: '"+e.$uiViewName+"@"+e.$uiViewContextAnchor+"'"},De=Function.prototype.bind.call(console.log,console),Fe=Kt(console.table)?console.table.bind(console):De.bind(console);!function(t){t[t.RESOLVE=0]="RESOLVE",t[t.TRANSITION=1]="TRANSITION",t[t.HOOK=2]="HOOK",t[t.UIVIEW=3]="UIVIEW",t[t.VIEWCONFIG=4]="VIEWCONFIG"}(t.Category||(t.Category={}));var Ne=At("$id"),Ue=At("router.$id"),Le=function(t){return"Transition #"+Ne(t)+"-"+Ue(t)},Me=function(){function e(){this._enabled={},this.approximateDigests=0}return e.prototype._set=function(e,r){var n=this;r.length||(r=Object.keys(t.Category).map(function(t){return parseInt(t,10)}).filter(function(t){return!isNaN(t)}).map(function(e){return t.Category[e]})),r.map(j).forEach(function(t){return n._enabled[t]=e})},e.prototype.enable=function(){for(var t=[],e=0;e "+J(e))},e.prototype.traceTransitionIgnored=function(e){this.enabled(t.Category.TRANSITION)&&console.log(Le(e)+": Ignored <> "+J(e))},e.prototype.traceHookInvocation=function(e,r,n){if(this.enabled(t.Category.HOOK)){var i=At("traceData.hookType")(n)||"internal",o=At("traceData.context.state.name")(n)||At("traceData.context")(n)||"unknown",a=W(e.registeredHook.callback);console.log(Le(r)+": Hook -> "+i+" context: "+o+", "+M(200,a))}},e.prototype.traceHookResult=function(e,r,n){this.enabled(t.Category.HOOK)&&console.log(Le(r)+": <- Hook returned: "+M(200,J(e)))},e.prototype.traceResolvePath=function(e,r,n){this.enabled(t.Category.RESOLVE)&&console.log(Le(n)+": Resolving "+e+" ("+r+")")},e.prototype.traceResolvableResolved=function(e,r){this.enabled(t.Category.RESOLVE)&&console.log(Le(r)+": <- Resolved "+e+" to: "+M(200,J(e.data)))},e.prototype.traceError=function(e,r){this.enabled(t.Category.TRANSITION)&&console.log(Le(r)+": <- Rejected "+J(r)+", reason: "+e)},e.prototype.traceSuccess=function(e,r){this.enabled(t.Category.TRANSITION)&&console.log(Le(r)+": <- Success "+J(r)+", final state: "+e.name)},e.prototype.traceUIViewEvent=function(e,r,n){void 0===n&&(n=""),this.enabled(t.Category.UIVIEW)&&console.log("ui-view: "+B(30,e)+" "+V(r)+n)},e.prototype.traceUIViewConfigUpdated=function(e,r){this.enabled(t.Category.UIVIEW)&&this.traceUIViewEvent("Updating",e," with ViewConfig from context='"+r+"'")},e.prototype.traceUIViewFill=function(e,r){this.enabled(t.Category.UIVIEW)&&this.traceUIViewEvent("Fill",e," with: "+M(200,r))},e.prototype.traceViewSync=function(e){if(this.enabled(t.Category.VIEWCONFIG)){var r=e.map(function(t){var e=t.uiView,r=t.viewConfig;return{"ui-view fqn":e&&e.fqn,"state: view name":r&&r.viewDecl.$context.name+": "+r.viewDecl.$name}}).sort(function(t,e){return t["ui-view fqn"].localeCompare(e["ui-view fqn"])});Fe(r)}},e.prototype.traceViewServiceEvent=function(e,r){this.enabled(t.Category.VIEWCONFIG)&&console.log("VIEWCONFIG: "+e+" "+qe(r))},e.prototype.traceViewServiceUIViewEvent=function(e,r){this.enabled(t.Category.VIEWCONFIG)&&console.log("VIEWCONFIG: "+e+" "+V(r))},e}(),Be=new Me;!function(t){t[t.CREATE=0]="CREATE",t[t.BEFORE=1]="BEFORE",t[t.RUN=2]="RUN",t[t.SUCCESS=3]="SUCCESS",t[t.ERROR=4]="ERROR"}(t.TransitionHookPhase||(t.TransitionHookPhase={})),function(t){t[t.TRANSITION=0]="TRANSITION",t[t.STATE=1]="STATE"}(t.TransitionHookScope||(t.TransitionHookScope={}));var Ge=function(){function t(t,e,r,n){this._stateRegistry=t,this._identifier=e,this._identifier=e,this._params=he({},r||{}),this._options=he({},n||{}),this._definition=t.matcher.find(e,this._options.relative)}return t.prototype.name=function(){return this._definition&&this._definition.name||this._identifier},t.prototype.identifier=function(){return this._identifier},t.prototype.params=function(){return this._params},t.prototype.$state=function(){return this._definition},t.prototype.state=function(){return this._definition&&this._definition.self},t.prototype.options=function(){return this._options},t.prototype.exists=function(){return!(!this._definition||!this._definition.self)},t.prototype.valid=function(){return!this.error()},t.prototype.error=function(){var t=this.options().relative;if(!this._definition&&t){var e=t.name?t.name:t;return"Could not resolve '"+this.name()+"' from state '"+e+"'"}return this._definition?this._definition.self?void 0:"State '"+this.name()+"' has an invalid definition":"No such state '"+this.name()+"'"},t.prototype.toString=function(){return"'"+this.name()+"'"+J(this.params())},t.prototype.withState=function(e){return new t(this._stateRegistry,e,this._params,this._options)},t.prototype.withParams=function(e,r){void 0===r&&(r=!1);var n=r?e:he({},this._params,e);return new t(this._stateRegistry,this._identifier,n,this._options)},t.prototype.withOptions=function(e,r){void 0===r&&(r=!1);var n=r?e:he({},this._options,e);return new t(this._stateRegistry,this._identifier,this._params,n)},t.isDef=function(t){return t&&t.state&&(Zt(t.state)||Zt(t.state.name))},t}(),We={current:l,transition:null,traceData:{},bind:null},ze=function(){function e(e,r,n,i){var o=this;this.transition=e,this.stateContext=r,this.registeredHook=n,this.options=i,this.isSuperseded=function(){return o.type.hookPhase===t.TransitionHookPhase.RUN&&!o.options.transition.isActive()},this.options=m(i,We),this.type=n.eventType}return e.prototype.logError=function(t){this.transition.router.stateService.defaultErrorHandler()(t)},e.prototype.invokeHook=function(){var t=this,e=this.registeredHook;if(!e._deregistered){var r=this.getNotCurrentRejection();if(r)return r;var n=this.options;Be.traceHookInvocation(this,this.transition,n);var i=function(r){return e.eventType.getErrorHandler(t)(r)},o=function(r){return e.eventType.getResultHandler(t)(r)};try{var a=e.callback.call(n.bind,t.transition,t.stateContext);return!this.type.synchronous&&ie(a)?a.catch(function(t){return He.normalize(t).toPromise()}).then(o,i):o(a)}catch(t){return i(He.normalize(t))}finally{e.invokeLimit&&++e.invokeCount>=e.invokeLimit&&e.deregister()}}},e.prototype.handleHookResult=function(t){var e=this,r=this.getNotCurrentRejection();return r||(ie(t)?t.then(function(t){return e.handleHookResult(t)}):(Be.traceHookResult(t,this.transition,this.options),!1===t?He.aborted("Hook aborted transition").toPromise():Ft(Ge)(t)?He.redirected(t).toPromise():void 0))},e.prototype.getNotCurrentRejection=function(){var t=this.transition.router;return t._disposed?He.aborted("UIRouter instance #"+t.$id+" has been stopped (disposed)").toPromise():this.transition._aborted?He.aborted().toPromise():this.isSuperseded()?He.superseded(this.options.current()).toPromise():void 0},e.prototype.toString=function(){var t=this,e=t.options,r=t.registeredHook;return(At("traceData.hookType")(e)||"internal")+" context: "+(At("traceData.context.state.name")(e)||At("traceData.context")(e)||"unknown")+", "+M(200,z(r.callback))},e.chain=function(t,e){return t.reduce(function(t,e){return t.then(function(){return e.invokeHook()})},e||ae.$q.when())},e.invokeHooks=function(t,r){for(var n=0;n20)throw new Error("Too many consecutive Transition redirects (20+)");var n={redirectedFrom:this,source:"redirect"};"url"===this.options().source&&!1!==t.options().location&&(n.location="replace");var i=he({},this.options(),t.options(),n);t=t.withOptions(i,!0);var o=this.router.transitionService.create(this._treeChanges.from,t),a=this._treeChanges.entering,u=o._treeChanges.entering;return er.matching(u,a,er.nonDynamicParams).filter(Ht(function(t){return function(e){return t&&e.state.includes[t.name]}}(t.options().reloadState))).forEach(function(t,e){t.resolvables=a[e].resolvables}),o},e.prototype._changedParams=function(){var t=this._treeChanges;if(!(this._options.reload||t.exiting.length||t.entering.length||t.to.length!==t.from.length||C(t.to,t.from).map(function(t){return t[0].state!==t[1].state}).reduce(be,!1))){var e=t.to.map(function(t){return t.paramSchema}),r=[t.to,t.from].map(function(t){return t.map(function(t){return t.paramValues})});return C(e,r[0],r[1]).map(function(t){var e=t[0],r=t[1],n=t[2];return Xe.changed(e,r,n)}).reduce(Re,[])}},e.prototype.dynamic=function(){var t=this._changedParams();return!!t&&t.map(function(t){return t.dynamic}).reduce(be,!1)},e.prototype.ignored=function(){return!!this._ignoredReason()},e.prototype._ignoredReason=function(){var t=this.router.globals.transition,e=this._options.reloadState,r=function(t,r){if(t.length!==r.length)return!1;var n=er.matching(t,r);return t.length===n.filter(function(t){return!e||!t.state.includes[e.name]}).length},n=this.treeChanges(),i=t&&t.treeChanges();return i&&r(i.to,n.to)&&r(i.exiting,n.exiting)?"SameAsPending":0===n.exiting.length&&0===n.entering.length&&r(n.from,n.to)?"SameAsCurrent":void 0},e.prototype.run=function(){var e=this,r=ze.runAllHooks,n=function(t){return e._hookBuilder.buildHooksForPhase(t)},i=n(t.TransitionHookPhase.BEFORE);return ze.invokeHooks(i,function(){var t=e.router.globals;return t.lastStartedTransitionId=e.$id,t.transition=e,t.transitionHistory.enqueue(e),Be.traceTransitionStart(e),ae.$q.when(void 0)}).then(function(){var e=n(t.TransitionHookPhase.RUN);return ze.invokeHooks(e,function(){return ae.$q.when(void 0)})}).then(function(){Be.traceSuccess(e.$to(),e),e.success=!0,e._deferred.resolve(e.to()),r(n(t.TransitionHookPhase.SUCCESS))},function(i){Be.traceError(i,e),e.success=!1,e._deferred.reject(i),e._error=i,r(n(t.TransitionHookPhase.ERROR))}),this.promise},e.prototype.valid=function(){return!this.error()||void 0!==this.success},e.prototype.abort=function(){Wt(this.success)&&(this._aborted=!0)},e.prototype.error=function(){var t=this.$to();if(t.self.abstract)return"Cannot transition to abstract state '"+t.name+"'";var e=t.parameters(),r=this.params(),n=e.filter(function(t){return!t.validates(r[t.id])});return n.length?"Param values not valid for state '"+t.name+"'. Invalid params: [ "+n.map(function(t){return t.id}).join(", ")+" ]":!1===this.success?this._error:void 0},e.prototype.toString=function(){var t=this.from(),e=this.to(),r=function(t){return null!==t["#"]&&void 0!==t["#"]?t:_(t,["#"])};return"Transition#"+this.$id+"( '"+(Xt(t)?t.name:t)+"'"+J(r(this._treeChanges.from.map(Vt("paramValues")).reduce(_e,{})))+" -> "+(this.valid()?"":"(X) ")+"'"+(Xt(e)?e.name:e)+"'"+J(r(this.params()))+" )"},e.diToken=e,e}(),pr=null,dr=function(t){var e=He.isRejectionPromise;return(pr=pr||s([[Ht(zt),Ut("undefined")],[Jt,Ut("null")],[ie,Ut("[Promise]")],[e,function(t){return t._transitionRejection.toString()}],[Ft(He),u("toString")],[Ft(hr),u("toString")],[Ft(nr),u("toString")],[c,W],[Ut(!0),f]]))(t)},vr=function(t){return function(e){if(!e)return["",""];var r=e.indexOf(t);return-1===r?[e,""]:[e.substr(0,r),e.substr(r+1)]}},mr=new RegExp("^(?:[a-z]+:)?//[^/]+/"),yr=function(t){return t.replace(/\/[^/]*$/,"")},gr=vr("#"),_r=vr("?"),wr=vr("="),$r=function(t){return t?t.replace(/^#/,""):""},Sr=function(){function t(){this.enqueue=!0,this.typeQueue=[],this.defaultTypes=g(t.prototype,["hash","string","query","path","int","bool","date","json","any"]);this.types=de(b(this.defaultTypes,function(t,e){return new Ke(he({name:e},t))}),{})}return t.prototype.dispose=function(){this.types={}},t.prototype.type=function(t,e,r){if(!zt(e))return this.types[t];if(this.types.hasOwnProperty(t))throw new Error("A type named '"+t+"' has already been defined.");return this.types[t]=new Ke(he({name:t},e)),r&&(this.typeQueue.push({name:t,def:r}),this.enqueue||this._flushTypeQueue()),this},t.prototype._flushTypeQueue=function(){for(;this.typeQueue.length;){var t=this.typeQueue.shift();if(t.pattern)throw new Error("You cannot override a type's .pattern at runtime.");he(this.types[t.name],ae.$injector.invoke(t.def))}},t}();!function(){var t=function(t){var e=function(t){return null!=t?t.toString():t},r={encode:e,decode:e,is:Ft(String),pattern:/.*/,equals:function(t,e){return t==e}};return he({},r,t)};he(Sr.prototype,{string:t({}),path:t({pattern:/[^/]*/}),query:t({}),hash:t({inherit:!1}),int:t({decode:function(t){return parseInt(t,10)},is:function(t){return!Qt(t)&&this.decode(t.toString())===t},pattern:/-?\d+/}),bool:t({encode:function(t){return t&&1||0},decode:function(t){return 0!==parseInt(t,10)},is:Ft(Boolean),pattern:/0|1/}),date:t({encode:function(t){return this.is(t)?[t.getFullYear(),("0"+(t.getMonth()+1)).slice(-2),("0"+t.getDate()).slice(-2)].join("-"):void 0},decode:function(t){if(this.is(t))return t;var e=this.capture.exec(t);return e?new Date(e[1],e[2]-1,e[3]):void 0},is:function(t){return t instanceof Date&&!isNaN(t.valueOf())},equals:function(t,e){return["getFullYear","getMonth","getDate"].reduce(function(r,n){return r&&t[n]()===e[n]()},!0)},pattern:/[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,capture:/([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/}),json:t({encode:fe,decode:ce,is:Ft(Object),equals:pe,pattern:/[^/]*/}),any:t({encode:f,decode:f,is:function(){return!0},equals:pe})})}();var br,Rr=function(){function t(t){void 0===t&&(t={}),he(this,t)}return t.prototype.$inherit=function(t,e,r){var n,i=y(e,r),o={},a=[];for(var u in i)if(i[u]&&i[u].params&&(n=Object.keys(i[u].params)).length)for(var s in n)a.indexOf(n[s])>=0||(a.push(n[s]),o[n[s]]=this[n[s]]);return he({},o,t)},t}(),Er=function(t){if(!Zt(t))return!1;var e="^"===t.charAt(0);return{val:e?t.substring(1):t,root:e}},Cr=function(t,e){return function(r){var n=r;n&&n.url&&n.name&&n.name.match(/\.\*\*$/)&&(n.url+="{remainder:any}");var i=Er(n.url),o=r.parent,a=i?t.compile(i.val,{params:r.params||{},paramMap:function(t,e){return!1===n.reloadOnSearch&&e&&(t=he(t||{},{dynamic:!0})),t}}):n.url;if(!a)return null;if(!t.isMatcher(a))throw new Error("Invalid url '"+a+"' in state '"+r+"'");return i&&i.root?a:(o&&o.navigable||e()).url.append(a)}},Tr=function(t){return function(e){return!t(e)&&e.url?e:e.parent?e.parent.navigable:null}},Pr=function(t){return function(e){var r=e.url&&e.url.parameters({inherit:!1})||[],n=$e(we(_(e.params||{},r.map(Vt("id"))),function(e,r){return t.fromConfig(r,null,e)}));return r.concat(n).map(function(t){return[t.id,t]}).reduce(T,{})}},kr=function(){function t(t,e){this.matcher=t;var r=this,n=function(){return t.find("")},i=function(t){return""===t.name};this.builders={name:[Y],self:[Z],parent:[function(e){return i(e)?null:t.find(r.parentName(e))||n()}],data:[X],url:[Cr(e,n)],navigable:[Tr(i)],params:[Pr(e.paramFactory)],views:[],path:[tt],includes:[et],resolvables:[rt]}}return t.prototype.builder=function(t,e){var r=this.builders,n=r[t]||[];return Zt(t)&&!zt(e)?n.length>1?n:n[0]:Zt(t)&&Kt(e)?(r[t]=n,r[t].push(e),function(){return r[t].splice(r[t].indexOf(e,1))&&null}):void 0},t.prototype.build=function(t){var e=this,r=e.matcher,n=e.builders,i=this.parentName(t);if(i&&!r.find(i,void 0,!1))return null;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o].reduce(function(t,e){return function(r){return e(r,t)}},l);t[o]=a(t)}return t},t.prototype.parentName=function(t){var e=t.name||"",r=e.split(".");if("**"===r.pop()&&r.pop(),r.length){if(t.parent)throw new Error("States that specify the 'parent:' property should not have a '.' in their name ("+e+")");return r.join(".")}return t.parent?Zt(t.parent)?t.parent:t.parent.name:""},t.prototype.name=function(t){var e=t.name;if(-1!==e.indexOf(".")||!t.parent)return e;var r=Zt(t.parent)?t.parent:t.parent.name;return r?r+"."+e:e},t}(),Or=function(){function t(t){this._states=t}return t.prototype.isRelative=function(t){return 0===(t=t||"").indexOf(".")||0===t.indexOf("^")},t.prototype.find=function(t,e,r){if(void 0===r&&(r=!0),t||""===t){var n=Zt(t),i=n?t:t.name;this.isRelative(i)&&(i=this.resolvePath(i,e));var o=this._states[i];if(o&&(n||!(n||o!==t&&o.self!==t)))return o;if(n&&r){var a=$e(this._states).filter(function(t){return t.__stateObjectCache.nameGlob&&t.__stateObjectCache.nameGlob.matches(i)});return a.length>1&&console.log("stateMatcher.find: Found multiple matches for "+i+" using glob: ",a.map(function(t){return t.name})),a[0]}}},t.prototype.resolvePath=function(t,e){if(!e)throw new Error("No reference point given for path '"+t+"'");for(var r=this.find(e),n=t.split("."),i=0,o=n.length,a=r;i0;){var c=r.shift(),f=c.name,l=i.build(c),h=a.indexOf(c);if(l){var p=s(f);if(p&&p.name===f)throw new Error("State '"+f+"' is already defined");var d=s(f+".**");d&&this.$registry.deregister(d),n[f]=c,this.attachRoute(c),h>=0&&a.splice(h,1),o.push(c)}else{var v=u[f];if(u[f]=r.length,h>=0&&v===r.length)return r.push(c),n;h<0&&a.push(c),r.push(c)}}return o.length&&this.listeners.forEach(function(t){return t("registered",o.map(function(t){return t.self}))}),n},t.prototype.attachRoute=function(t){!t.abstract&&t.url&&this.$urlRouter.rule(this.$urlRouter.urlRuleFactory.create(t))},t}(),Ir=function(){function t(t){this._router=t,this.states={},this.listeners=[],this.matcher=new Or(this.states),this.builder=new kr(this.matcher,t.urlMatcherFactory),this.stateQueue=new xr(this,t.urlRouter,this.states,this.builder,this.listeners),this._registerRoot()}return t.prototype._registerRoot=function(){var t={name:"",url:"^",views:null,params:{"#":{value:null,type:"hash",dynamic:!0}},abstract:!0};(this._root=this.stateQueue.register(t)).navigable=null},t.prototype.dispose=function(){var t=this;this.stateQueue.dispose(),this.listeners=[],this.get().forEach(function(e){return t.get(e)&&t.deregister(e)})},t.prototype.onStatesChanged=function(t){return this.listeners.push(t),function(){me(this.listeners)(t)}.bind(this)},t.prototype.root=function(){return this._root},t.prototype.register=function(t){return this.stateQueue.register(t)},t.prototype._deregisterTree=function(t){var e=this,r=this.get().map(function(t){return t.$$state()}),n=function(t){var e=r.filter(function(e){return-1!==t.indexOf(e.parent)});return 0===e.length?e:e.concat(n(e))},i=n([t]),o=[t].concat(i).reverse();return o.forEach(function(t){var r=e._router.urlRouter;r.rules().filter(jt("state",t)).forEach(r.removeRule.bind(r)),delete e.states[t.name]}),o},t.prototype.deregister=function(t){var e=this.get(t);if(!e)throw new Error("Can't deregister state; not found: "+t);var r=this._deregisterTree(e.$$state());return this.listeners.forEach(function(t){return t("deregistered",r.map(function(t){return t.self}))}),r},t.prototype.get=function(t,e){var r=this;if(0===arguments.length)return Object.keys(this.states).map(function(t){return r.states[t].self});var n=this.matcher.find(t,e);return n&&n.self||null},t.prototype.decorator=function(t,e){return this.builder.builder(t,e)},t}(),Vr=function(t,e,r){return t[e]=t[e]||r()},jr=Q("/"),Ar=function(){function e(t,r,n,i){var o=this;this.config=i,this._cache={path:[this]},this._children=[],this._params=[],this._segments=[],this._compiled=[],this.pattern=t,this.config=m(this.config,{params:{},strict:!0,caseInsensitive:!1,paramMap:f});for(var a,u,s,c=/([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,l=/([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,h=0,p=[],d=function(r){if(!e.nameValidator.test(r))throw new Error("Invalid parameter name '"+r+"' in pattern '"+t+"'");if(S(o._params,jt("id",r)))throw new Error("Duplicate parameter name '"+r+"' in pattern '"+t+"'")},v=function(e,n){var i=e[2]||e[3],a=n?e[4]:e[4]||("*"===e[1]?"[\\s\\S]*":null);return{id:i,regexp:a,cfg:o.config.params[i],segment:t.substring(h,e.index),type:a?r.type(a)||function(t){return de(r.type(n?"query":"path"),{pattern:new RegExp(t,o.config.caseInsensitive?"i":void 0)})}(a):null}};(a=c.exec(t))&&!((u=v(a,!1)).segment.indexOf("?")>=0);)d(u.id),this._params.push(n.fromPath(u.id,u.type,this.config.paramMap(u.cfg,!1))),this._segments.push(u.segment),p.push([u.segment,P(this._params)]),h=c.lastIndex;var y=(s=t.substring(h)).indexOf("?");if(y>=0){var g=s.substring(y);if(s=s.substring(0,y),g.length>0)for(h=0;a=l.exec(g);)d((u=v(a,!0)).id),this._params.push(n.fromSearch(u.id,u.type,this.config.paramMap(u.cfg,!0))),h=c.lastIndex}this._segments.push(s),this._compiled=p.map(function(t){return nt.apply(null,t)}).concat(nt(s))}return e.prototype.append=function(t){return this._children.push(t),t._cache={path:this._cache.path.concat(t),parent:this,pattern:null},t},e.prototype.isRoot=function(){return this._cache.path[0]===this},e.prototype.toString=function(){return this.pattern},e.prototype.exec=function(t,e,r,n){var i=this;void 0===e&&(e={}),void 0===n&&(n={});var o=Vr(this._cache,"pattern",function(){return new RegExp(["^",Te(i._cache.path.map(Vt("_compiled"))).join(""),!1===i.config.strict?"/?":"","$"].join(""),i.config.caseInsensitive?"i":void 0)}).exec(t);if(!o)return null;var a=this.parameters(),u=a.filter(function(t){return!t.isSearch()}),s=a.filter(function(t){return t.isSearch()}),c=this._cache.path.map(function(t){return t._segments.length-1}).reduce(function(t,e){return t+e}),f={};if(c!==o.length-1)throw new Error("Unbalanced capture group in route '"+this.pattern+"'");for(var l=0;ln.weight?o:n}return n},t.prototype.sync=function(t){if(!t||!t.defaultPrevented){var e=this._router,r=e.urlService,n=e.stateService,i={path:r.path(),search:r.search(),hash:r.hash()},o=this.match(i);s([[Zt,function(t){return r.url(t,!0)}],[Ge.isDef,function(t){return n.go(t.state,t.params,t.options)}],[Ft(Ge),function(t){return n.go(t.state(),t.params(),t.options())}]])(o&&o.rule.handler(o.match,i,e))}},t.prototype.listen=function(t){var e=this;if(!1!==t)return this._stopFn=this._stopFn||this._router.urlService.onChange(function(t){return e.sync(t)});this._stopFn&&this._stopFn(),delete this._stopFn},t.prototype.update=function(t){var e=this._router.locationService;t?this.location=e.url():e.url()!==this.location&&e.url(this.location,!0)},t.prototype.push=function(t,e,r){var n=r&&!!r.replace;this._router.urlService.url(t.format(e||{}),n)},t.prototype.href=function(t,e,r){var n=t.format(e);if(null==n)return null;r=r||{absolute:!1};var i=this._router.urlService.config,o=i.html5Mode();if(o||null===n||(n="#"+i.hashPrefix()+n),n=it(n,o,r.absolute,i.baseHref()),!r.absolute||!n)return n;var a=!o&&n?"/":"",u=i.port();return u=80===u||443===u?"":":"+u,[i.protocol(),"://",i.host(),u,a,n].join("")},t.prototype.rule=function(t){var e=this;if(!qr.isUrlRule(t))throw new Error("invalid rule");return t.$id=this._id++,t.priority=t.priority||0,this._rules.push(t),this._sorted=!1,function(){return e.removeRule(t)}},t.prototype.removeRule=function(t){me(this._rules,t)},t.prototype.rules=function(){return this.ensureSorted(),this._rules.slice()},t.prototype.otherwise=function(t){var e=ot(t);this._otherwiseFn=this.urlRuleFactory.create(Ut(!0),e),this._sorted=!1},t.prototype.initial=function(t){var e=ot(t);this.rule(this.urlRuleFactory.create(function(t,e){return 0===e.globals.transitionHistory.size()&&!!/^\/?$/.exec(t.path)},e))},t.prototype.when=function(t,e,r){var n=this.urlRuleFactory.create(t,e);return zt(r&&r.priority)&&(n.priority=r.priority),this.rule(n),n},t.prototype.deferIntercept=function(t){void 0===t&&(t=!0),this.interceptDeferred=t},t}(),Br=function(){function t(){var t=this;this._uiViews=[],this._viewConfigs=[],this._viewConfigFactories={},this._listeners=[],this._pluginapi={_rootViewContext:this._rootViewContext.bind(this),_viewConfigFactory:this._viewConfigFactory.bind(this),_registeredUIViews:function(){return t._uiViews},_activeViewConfigs:function(){return t._viewConfigs},_onSync:function(e){return t._listeners.push(e),function(){return me(t._listeners,e)}}}}return t.prototype._rootViewContext=function(t){return this._rootContext=t||this._rootContext},t.prototype._viewConfigFactory=function(t,e){this._viewConfigFactories[t]=e},t.prototype.createViewConfig=function(t,e){var r=this._viewConfigFactories[e.$type];if(!r)throw new Error("ViewService: No view config factory registered for type "+e.$type);var n=r(t,e);return te(n)?n:[n]},t.prototype.deactivateViewConfig=function(t){Be.traceViewServiceEvent("<- Removing",t),me(this._viewConfigs,t)},t.prototype.activateViewConfig=function(t){Be.traceViewServiceEvent("-> Registering",t),this._viewConfigs.push(t)},t.prototype.sync=function(){function e(t){for(var e=t.viewDecl.$context,r=0;++r&&e.parent;)e=e.parent;return r}var n=this,i=this._uiViews.map(function(t){return[t.fqn,t]}).reduce(T,{}),o=r(function(t,e,r,n){return e*(t(r)-t(n))}),a=this._uiViews.sort(o(function(t){var e=function(t){return t&&t.parent?e(t.parent)+1:1};return 1e4*t.fqn.split(".").length+e(t.creationContext)},1)).map(function(r){var a=n._viewConfigs.filter(t.matches(i,r));return a.length>1&&a.sort(o(e,-1)),{uiView:r,viewConfig:a[0]}}),u=a.map(function(t){return t.viewConfig}),s=this._viewConfigs.filter(function(t){return ve(u,t)}).map(function(t){return{uiView:void 0,viewConfig:t}}),c=a.concat(s);a.forEach(function(t){-1!==n._uiViews.indexOf(t.uiView)&&t.uiView.configUpdated(t.viewConfig)}),this._listeners.forEach(function(t){return t(c)}),Be.traceViewSync(c)},t.prototype.registerUIView=function(t){Be.traceViewServiceUIViewEvent("-> Registering",t);var e=this._uiViews;return e.filter(function(e){return e.fqn===t.fqn&&e.$type===t.$type}).length&&Be.traceViewServiceUIViewEvent("!!!! duplicate uiView named:",t),e.push(t),this.sync(),function(){-1!==e.indexOf(t)?(Be.traceViewServiceUIViewEvent("<- Deregistering",t),me(e)(t)):Be.traceViewServiceUIViewEvent("Tried removing non-registered uiView",t)}},t.prototype.available=function(){return this._uiViews.map(Vt("fqn"))},t.prototype.active=function(){return this._uiViews.filter(Vt("$config")).map(Vt("name"))},t.normalizeUIViewTarget=function(t,e){void 0===e&&(e="");var r=e.split("@"),n=r[0]||"$default",i=Zt(r[1])?r[1]:"^",o=/^(\^(?:\.\^)*)\.(.*$)/.exec(n);return o&&(i=o[1],n=o[2]),"!"===n.charAt(0)&&(n=n.substr(1),i=""),/^(\^(?:\.\^)*)$/.exec(i)?i=i.split(".").reduce(function(t,e){return t.parent},t).name:"."===i&&(i=t.name),{uiViewName:n,uiViewContextAnchor:i}},t.matches=function(t,e){return function(r){if(e.$type!==r.viewDecl.$type)return!1;var n=r.viewDecl,i=n.$uiViewName.split("."),o=e.fqn.split(".");if(!pe(i,o.slice(0-i.length)))return!1;var a=1-i.length||void 0,u=o.slice(0,a).join("."),s=t[u].creationContext;return n.$uiViewContextAnchor===(s&&s.name)}},t}(),Gr=function(){function t(){this.params=new Rr,this.lastStartedTransitionId=-1,this.transitionHistory=new je([],1),this.successfulTransitions=new je([],1)}return t.prototype.dispose=function(){this.transitionHistory.clear(),this.successfulTransitions.clear(),this.transition=null},t}(),Wr=function(t){return t.reduce(function(t,e){return t[e]=oe(e),t},{dispose:l})},zr=["url","path","search","hash","onChange"],Jr=["port","protocol","host","baseHref","html5Mode","hashPrefix"],Qr=["type","caseInsensitive","strictMode","defaultSquashPolicy"],Kr=["sort","when","initial","otherwise","rules","rule","removeRule"],Yr=["deferIntercept","listen","sync","match"],Zr=function(){function t(t,e){void 0===e&&(e=!0),this.router=t,this.rules={},this.config={};var r=function(){return t.locationService};h(r,this,r,zr,e);var n=function(){return t.locationConfig};h(n,this.config,n,Jr,e);var i=function(){return t.urlMatcherFactory};h(i,this.config,i,Qr);var o=function(){return t.urlRouter};h(o,this.rules,o,Kr),h(o,this,o,Yr)}return t.prototype.url=function(t,e,r){},t.prototype.path=function(){},t.prototype.search=function(){},t.prototype.hash=function(){},t.prototype.onChange=function(t){},t.prototype.parts=function(){return{path:this.path(),search:this.search(),hash:this.hash()}},t.prototype.dispose=function(){},t.prototype.sync=function(t){},t.prototype.listen=function(t){},t.prototype.deferIntercept=function(t){},t.prototype.match=function(t){},t.locationServiceStub=Wr(zr),t.locationConfigStub=Wr(Jr),t}(),Xr=0,tn=function(){function t(t,e){void 0===t&&(t=Zr.locationServiceStub),void 0===e&&(e=Zr.locationConfigStub),this.locationService=t,this.locationConfig=e,this.$id=Xr++,this._disposed=!1,this._disposables=[],this.trace=Be,this.viewService=new Br,this.transitionService=new xn(this),this.globals=new Gr,this.urlMatcherFactory=new Hr,this.urlRouter=new Mr(this),this.stateRegistry=new Ir(this),this.stateService=new In(this),this.urlService=new Zr(this),this._plugins={},this.viewService._pluginapi._rootViewContext(this.stateRegistry.root()),this.globals.$current=this.stateRegistry.root(),this.globals.current=this.globals.$current.self,this.disposable(this.globals),this.disposable(this.stateService),this.disposable(this.stateRegistry),this.disposable(this.transitionService),this.disposable(this.urlRouter),this.disposable(t),this.disposable(e)}return t.prototype.disposable=function(t){this._disposables.push(t)},t.prototype.dispose=function(t){var e=this;t&&Kt(t.dispose)?t.dispose(this):(this._disposed=!0,this._disposables.slice().forEach(function(t){try{"function"==typeof t.dispose&&t.dispose(e),me(e._disposables,t)}catch(t){}}))},t.prototype.plugin=function(t,e){void 0===e&&(e={});var r=new t(this,e);if(!r.name)throw new Error("Required property `name` missing on plugin: "+r);return this._disposables.push(r),this._plugins[r.name]=r},t.prototype.getPlugin=function(t){return t?this._plugins[t]:$e(this._plugins)},t}(),en=function(t){return t.onCreate({},at)},rn=function(t){function e(e){if(e)return e instanceof Ge?e:Zt(e)?n.target(e,t.params(),t.options()):e.state||e.params?n.target(e.state||t.to(),e.params||t.params(),t.options()):void 0}var r=t.to().redirectTo;if(r){var n=t.router.stateService;return Kt(r)?ae.$q.when(r(t)).then(e):e(r)}},nn=function(t){return t.onStart({to:function(t){return!!t.redirectTo}},rn)},on=ut("onExit"),an=function(t){return t.onExit({exiting:function(t){return!!t.onExit}},on)},un=ut("onRetain"),sn=function(t){return t.onRetain({retained:function(t){return!!t.onRetain}},un)},cn=ut("onEnter"),fn=function(t){return t.onEnter({entering:function(t){return!!t.onEnter}},cn)},ln=function(t){return new cr(t.treeChanges().to).resolvePath("EAGER",t).then(l)},hn=function(t){return t.onStart({},ln,{priority:1e3})},pn=function(t,e){return new cr(t.treeChanges().to).subContext(e.$$state()).resolvePath("LAZY",t).then(l)},dn=function(t){return t.onEnter({entering:Ut(!0)},pn,{priority:1e3})},vn=function(t){return new cr(t.treeChanges().to).resolvePath("LAZY",t).then(l)},mn=function(t){return t.onFinish({},vn,{priority:1e3})},yn=function(t){var e=ae.$q,r=t.views("entering");if(r.length)return e.all(r.map(function(t){return e.when(t.load())})).then(l)},gn=function(t){return t.onFinish({},yn)},_n=function(t){var e=t.views("entering"),r=t.views("exiting");if(e.length||r.length){var n=t.router.viewService;r.forEach(function(t){return n.deactivateViewConfig(t)}),e.forEach(function(t){return n.activateViewConfig(t)}),n.sync()}},wn=function(t){return t.onSuccess({},_n)},$n=function(t){var e=t.router.globals,r=function(){e.transition===t&&(e.transition=null)};t.onSuccess({},function(){e.successfulTransitions.enqueue(t),e.$current=t.$to(),e.current=e.$current.self,k(t.params(),e.params)},{priority:1e4}),t.promise.then(r,r)},Sn=function(t){return t.onCreate({},$n)},bn=function(t){var e=t.options(),r=t.router.stateService,n=t.router.urlRouter;if("url"!==e.source&&e.location&&r.$current.navigable){var i={replace:"replace"===e.location};n.push(r.$current.navigable.url,r.params,i)}n.update(!0)},Rn=function(t){return t.onSuccess({},bn,{priority:9999})},En=function(t){var e=t.router,r=t.entering().filter(function(t){return!!t.$$state().lazyLoad}).map(function(e){return st(t,e)});return ae.$q.all(r).then(function(){if("url"!==t.originalTransition().options().source){var r=t.targetState();return e.stateService.target(r.identifier(),r.params(),r.options())}var n=e.urlService,i=n.match(n.parts()),o=i&&i.rule;if(o&&"STATE"===o.type){var a=o.state,u=i.match;return e.stateService.target(a,u,t.options())}e.urlService.sync()})},Cn=function(t){return t.onBefore({entering:function(t){return!!t.lazyLoad}},En)},Tn=function(){return function(t,e,r,n,i,o,a,u){void 0===i&&(i=!1),void 0===o&&(o=ze.HANDLE_RESULT),void 0===a&&(a=ze.REJECT_ERROR),void 0===u&&(u=!1),this.name=t,this.hookPhase=e,this.hookOrder=r,this.criteriaMatchPath=n,this.reverseSort=i,this.getResultHandler=o,this.getErrorHandler=a,this.synchronous=u}}(),Pn=function(t){return t.onBefore({},ct,{priority:-9999})},kn=function(t){return t.onBefore({},ft,{priority:-1e4})},On={location:!0,relative:null,inherit:!1,notify:!0,reload:!1,custom:{},current:function(){return null},source:"unknown"},xn=function(){function e(t){this._transitionCount=0,this._eventTypes=[],this._registeredHooks={},this._criteriaPaths={},this._router=t,this.$view=t.viewService,this._deregisterHookFns={},this._pluginapi=h(Ut(this),{},Ut(this),["_definePathType","_defineEvent","_getPathTypes","_getEvents","getHooks"]),this._defineCorePaths(),this._defineCoreEvents(),this._registerCoreTransitionHooks()}return e.prototype.onCreate=function(t,e,r){},e.prototype.onBefore=function(t,e,r){},e.prototype.onStart=function(t,e,r){},e.prototype.onExit=function(t,e,r){},e.prototype.onRetain=function(t,e,r){},e.prototype.onEnter=function(t,e,r){},e.prototype.onFinish=function(t,e,r){},e.prototype.onSuccess=function(t,e,r){},e.prototype.onError=function(t,e,r){},e.prototype.dispose=function(t){$e(this._registeredHooks).forEach(function(t){return t.forEach(function(e){e._deregistered=!0,me(t,e)})})},e.prototype.create=function(t,e){return new hr(t,e,this._router)},e.prototype._defineCoreEvents=function(){var e=t.TransitionHookPhase,r=ze,n=this._criteriaPaths;this._defineEvent("onCreate",e.CREATE,0,n.to,!1,r.LOG_REJECTED_RESULT,r.THROW_ERROR,!0),this._defineEvent("onBefore",e.BEFORE,0,n.to),this._defineEvent("onStart",e.RUN,0,n.to),this._defineEvent("onExit",e.RUN,100,n.exiting,!0),this._defineEvent("onRetain",e.RUN,200,n.retained),this._defineEvent("onEnter",e.RUN,300,n.entering),this._defineEvent("onFinish",e.RUN,400,n.to),this._defineEvent("onSuccess",e.SUCCESS,0,n.to,!1,r.LOG_REJECTED_RESULT,r.LOG_ERROR,!0),this._defineEvent("onError",e.ERROR,0,n.to,!1,r.LOG_REJECTED_RESULT,r.LOG_ERROR,!0)},e.prototype._defineCorePaths=function(){var e=t.TransitionHookScope.STATE,r=t.TransitionHookScope.TRANSITION;this._definePathType("to",r),this._definePathType("from",r),this._definePathType("exiting",e),this._definePathType("retained",e),this._definePathType("entering",e)},e.prototype._defineEvent=function(t,e,r,n,i,o,a,u){void 0===i&&(i=!1),void 0===o&&(o=ze.HANDLE_RESULT),void 0===a&&(a=ze.REJECT_ERROR),void 0===u&&(u=!1);var s=new Tn(t,e,r,n,i,o,a,u);this._eventTypes.push(s),H(this,this,s)},e.prototype._getEvents=function(t){return(zt(t)?this._eventTypes.filter(function(e){return e.hookPhase===t}):this._eventTypes.slice()).sort(function(t,e){var r=t.hookPhase-e.hookPhase;return 0===r?t.hookOrder-e.hookOrder:r})},e.prototype._definePathType=function(t,e){this._criteriaPaths[t]={name:t,scope:e}},e.prototype._getPathTypes=function(){return this._criteriaPaths},e.prototype.getHooks=function(t){return this._registeredHooks[t]},e.prototype._registerCoreTransitionHooks=function(){var t=this._deregisterHookFns;t.addCoreResolves=en(this),t.ignored=Pn(this),t.invalid=kn(this),t.redirectTo=nn(this),t.onExit=an(this),t.onRetain=sn(this),t.onEnter=fn(this),t.eagerResolve=hn(this),t.lazyResolve=dn(this),t.resolveAll=mn(this),t.loadViews=gn(this),t.activateViews=wn(this),t.updateGlobals=Sn(this),t.updateUrl=Rn(this),t.lazyLoad=Cn(this)},e}(),In=function(){function e(t){this.router=t,this.invalidCallbacks=[],this._defaultErrorHandler=function(t){t instanceof Error&&t.stack?(console.error(t),console.error(t.stack)):t instanceof He?(console.error(t.toString()),t.detail&&t.detail.stack&&console.error(t.detail.stack)):console.error(t)};var r=["current","$current","params","transition"],n=Object.keys(e.prototype).filter(Ht(ve(r)));h(Ut(e.prototype),this,Ut(this),n)}return Object.defineProperty(e.prototype,"transition",{get:function(){return this.router.globals.transition},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"params",{get:function(){return this.router.globals.params},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"current",{get:function(){return this.router.globals.current},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"$current",{get:function(){return this.router.globals.$current},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.defaultErrorHandler(l),this.invalidCallbacks=[]},e.prototype._handleInvalidTargetState=function(t,e){function r(){var t=s.dequeue();return void 0===t?He.invalid(e.error()).toPromise():ae.$q.when(t(e,i,c)).then(f).then(function(t){return t||r()})}var n=this,i=er.makeTargetState(this.router.stateRegistry,t),o=this.router.globals,a=function(){return o.transitionHistory.peekTail()},u=a(),s=new je(this.invalidCallbacks.slice()),c=new cr(t).injector(),f=function(t){if(t instanceof Ge){var e=t;return(e=n.target(e.identifier(),e.params(),e.options())).valid()?a()!==u?He.superseded().toPromise():n.transitionTo(e.identifier(),e.params(),e.options()):He.invalid(e.error()).toPromise()}};return r()},e.prototype.onInvalid=function(t){return this.invalidCallbacks.push(t),function(){me(this.invalidCallbacks)(t)}.bind(this)},e.prototype.reload=function(t){return this.transitionTo(this.current,this.params,{reload:!zt(t)||t,inherit:!1,notify:!1})},e.prototype.go=function(t,e,r){var n=m(r,{relative:this.$current,inherit:!0},On);return this.transitionTo(t,e,n)},e.prototype.target=function(t,e,r){if(void 0===r&&(r={}),Xt(r.reload)&&!r.reload.name)throw new Error("Invalid reload state object");var n=this.router.stateRegistry;if(r.reloadState=!0===r.reload?n.root():n.matcher.find(r.reload,r.relative),r.reload&&!r.reloadState)throw new Error("No such reload state '"+(Zt(r.reload)?r.reload:r.reload.name)+"'");return new Ge(this.router.stateRegistry,t,e,r)},e.prototype.getCurrentPath=function(){var t=this,e=this.router.globals.successfulTransitions.peekTail();return e?e.treeChanges().to:[new tr(t.router.stateRegistry.root())]},e.prototype.transitionTo=function(e,r,n){var i=this;void 0===r&&(r={}),void 0===n&&(n={});var o=this.router,a=o.globals;n=m(n,On);n=he(n,{current:function(){return a.transition}});var u=this.target(e,r,n),s=this.getCurrentPath();if(!u.exists())return this._handleInvalidTargetState(s,u);if(!u.valid())return Ve(u.error());var c=function(e){return function(r){if(r instanceof He){var n=o.globals.lastStartedTransitionId===e.$id;if(r.type===t.RejectType.IGNORED)return n&&o.urlRouter.update(),ae.$q.when(a.current);var u=r.detail;if(r.type===t.RejectType.SUPERSEDED&&r.redirected&&u instanceof Ge){var s=e.redirect(u);return s.run().catch(c(s))}if(r.type===t.RejectType.ABORTED)return n&&o.urlRouter.update(),ae.$q.reject(r)}return i.defaultErrorHandler()(r),ae.$q.reject(r)}},f=this.router.transitionService.create(s,u),l=f.run().catch(c(f));return Ie(l),he(l,{transition:f})},e.prototype.is=function(t,e,r){r=m(r,{relative:this.$current});var n=this.router.stateRegistry.matcher.find(t,r.relative);if(zt(n)){if(this.$current!==n)return!1;if(!e)return!0;var i=n.parameters({inherit:!0,matchingKeys:e});return Xe.equals(i,Xe.values(i,e),this.params)}},e.prototype.includes=function(t,e,r){r=m(r,{relative:this.$current});var n=Zt(t)&&Lt.fromString(t);if(n){if(!n.matches(this.$current.name))return!1;t=this.$current.name}var i=this.router.stateRegistry.matcher.find(t,r.relative),o=this.$current.includes;if(zt(i)){if(!zt(o[i.name]))return!1;if(!e)return!0;var a=i.parameters({inherit:!0,matchingKeys:e});return Xe.equals(a,Xe.values(a,e),this.params)}},e.prototype.href=function(t,e,r){r=m(r,{lossy:!0,inherit:!0,absolute:!1,relative:this.$current}),e=e||{};var n=this.router.stateRegistry.matcher.find(t,r.relative);if(!zt(n))return null;r.inherit&&(e=this.params.$inherit(e,this.$current,n));var i=n&&r.lossy?n.navigable:n;return i&&void 0!==i.url&&null!==i.url?this.router.urlRouter.href(i.url,e,{absolute:r.absolute}):null},e.prototype.defaultErrorHandler=function(t){return this._defaultErrorHandler=t||this._defaultErrorHandler},e.prototype.get=function(t,e){var r=this.router.stateRegistry;return 0===arguments.length?r.get():r.get(t,e||this.$current)},e.prototype.lazyLoad=function(t,e){var r=this.get(t);if(!r||!r.lazyLoad)throw new Error("Can not lazy load "+t);var n=this.getCurrentPath(),i=er.makeTargetState(this.router.stateRegistry,n);return e=e||this.router.transitionService.create(n,i),st(e,r)},e}(),Vn={when:function(t){return new Promise(function(e,r){return e(t)})},reject:function(t){return new Promise(function(e,r){r(t)})},defer:function(){var t={};return t.promise=new Promise(function(e,r){t.resolve=e,t.reject=r}),t},all:function(t){if(te(t))return Promise.all(t);if(Xt(t)){var e=Object.keys(t).map(function(e){return t[e].then(function(t){return{key:e,val:t}})});return Vn.all(e).then(function(t){return t.reduce(function(t,e){return t[e.key]=e.val,t},{})})}}},jn={},An=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,Hn=/([^\s,]+)/g,qn={get:function(t){return jn[t]},has:function(t){return null!=qn.get(t)},invoke:function(t,e,r){var n=he({},jn,r||{}),i=qn.annotate(t),o=ke(function(t){return n.hasOwnProperty(t)},function(t){return"DI can't find injectable: '"+t+"'"}),a=i.filter(o).map(function(t){return n[t]});return Kt(t)?t.apply(e,a):t.slice(-1)[0].apply(e,a)},annotate:function(t){if(!c(t))throw new Error("Not an injectable function: "+t);if(t&&t.$inject)return t.$inject;if(te(t))return t.slice(0,-1);var e=t.toString().replace(An,"");return e.slice(e.indexOf("(")+1,e.indexOf(")")).match(Hn)||[]}},Dn=function(t,e){var r=e[0],n=e[1];return t.hasOwnProperty(r)?te(t[r])?t[r].push(n):t[r]=[t[r],n]:t[r]=n,t},Fn=function(t){return t.split("&").filter(f).map(wr).reduce(Dn,{})},Nn=function(t){var e=t.path(),r=t.search(),n=t.hash(),i=Object.keys(r).map(function(t){var e=r[t];return(te(e)?e:[e]).map(function(e){return t+"="+e})}).reduce(Re,[]).join("&");return e+(i?"?"+i:"")+(n?"#"+n:"")},Un=function(){function t(t,e){var r=this;this.fireAfterUpdate=e,this._listener=function(t){return r._listeners.forEach(function(e){return e(t)})},this._listeners=[],this.hash=function(){return lt(r._get()).hash},this.path=function(){return lt(r._get()).path},this.search=function(){return Fn(lt(r._get()).search)},this._location=ue.location,this._history=ue.history}return t.prototype.url=function(t,e){return void 0===e&&(e=!0),zt(t)&&t!==this._get()&&(this._set(null,null,t,e),this.fireAfterUpdate&&this._listeners.forEach(function(e){return e({url:t})})),Nn(this)},t.prototype.onChange=function(t){var e=this;return this._listeners.push(t),function(){return me(e._listeners,t)}},t.prototype.dispose=function(t){ge(this._listeners)},t}(),Ln=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Mn=function(t){function e(e){var r=t.call(this,e,!1)||this;return ue.addEventListener("hashchange",r._listener,!1),r}return Ln(e,t),e.prototype._get=function(){return $r(this._location.hash)},e.prototype._set=function(t,e,r,n){this._location.hash=r},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),ue.removeEventListener("hashchange",this._listener)},e}(Un),Bn=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Gn=function(t){function e(e){return t.call(this,e,!0)||this}return Bn(e,t),e.prototype._get=function(){return this._url},e.prototype._set=function(t,e,r,n){this._url=r},e}(Un),Wn=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zn=function(t){function e(e){var r=t.call(this,e,!0)||this;return r._config=e.urlService.config,ue.addEventListener("popstate",r._listener,!1),r}return Wn(e,t),e.prototype._getBasePrefix=function(){return yr(this._config.baseHref())},e.prototype._get=function(){var t=this._location,e=t.pathname,r=t.hash,n=t.search;n=_r(n)[1],r=gr(r)[1];var i=this._getBasePrefix(),o=e===this._config.baseHref(),a=e.substr(0,i.length)===i;return(e=o?"/":a?e.substring(i.length):e)+(n?"?"+n:"")+(r?"#"+r:"")},e.prototype._set=function(t,e,r,n){var i=this._getBasePrefix(),o=r&&"/"!==r[0]?"/":"",a=""===r||"/"===r?this._config.baseHref():i+o+r;n?this._history.replaceState(t,e,a):this._history.pushState(t,e,a)},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),ue.removeEventListener("popstate",this._listener)},e}(Un),Jn=function(){return function(){var t=this;this._baseHref="",this._port=80,this._protocol="http",this._host="localhost",this._hashPrefix="",this.port=function(){return t._port},this.protocol=function(){return t._protocol},this.host=function(){return t._host},this.baseHref=function(){return t._baseHref},this.html5Mode=function(){return!1},this.hashPrefix=function(e){return zt(e)?t._hashPrefix=e:t._hashPrefix},this.dispose=l}}(),Qn=function(){function t(t,e){void 0===e&&(e=!1),this._isHtml5=e,this._baseHref=void 0,this._hashPrefix=""}return t.prototype.port=function(){return location.port?Number(location.port):"https"===this.protocol()?443:80},t.prototype.protocol=function(){return location.protocol.replace(/:/g,"")},t.prototype.host=function(){return location.hostname},t.prototype.html5Mode=function(){return this._isHtml5},t.prototype.hashPrefix=function(t){return zt(t)?this._hashPrefix=t:this._hashPrefix},t.prototype.baseHref=function(t){return zt(t)?this._baseHref=t:zt(this._baseHref)?this._baseHref:this.applyDocumentBaseHref()},t.prototype.applyDocumentBaseHref=function(){var t=document.getElementsByTagName("base")[0];return this._baseHref=t?t.href.substr(location.origin.length):location.pathname||"/"},t.prototype.dispose=function(){},t}(),Kn=ht("vanilla.hashBangLocation",!1,Mn,Qn),Yn=ht("vanilla.pushStateLocation",!0,zn,Qn),Zn=ht("vanilla.memoryLocation",!1,Gn,Jn),Xn=function(){function t(){}return t.prototype.dispose=function(t){},t}(),ti=Object.freeze({root:ue,fromJson:ce,toJson:fe,forEach:le,extend:he,equals:pe,identity:f,noop:l,createProxyFunctions:h,inherit:de,inArray:ve,_inArray:p,removeFrom:me,_removeFrom:d,pushTo:ye,_pushTo:v,deregAll:ge,defaults:m,mergeR:_e,ancestors:y,pick:g,omit:_,pluck:w,filter:$,find:S,mapObj:we,map:b,values:$e,allTrueR:Se,anyTrueR:be,unnestR:Re,flattenR:Ee,pushR:R,uniqR:Ce,unnest:Te,flatten:Pe,assertPredicate:ke,assertMap:Oe,assertFn:E,pairs:xe,arrayTuples:C,applyPairs:T,tail:P,copy:k,_extend:O,silenceUncaughtInPromise:Ie,silentRejection:Ve,notImplemented:oe,services:ae,Glob:Lt,curry:r,compose:n,pipe:i,prop:Vt,propEq:jt,parse:At,not:Ht,and:o,or:a,all:qt,any:Dt,is:Ft,eq:Nt,val:Ut,invoke:u,pattern:s,isUndefined:Wt,isDefined:zt,isNull:Jt,isNullOrUndefined:Qt,isFunction:Kt,isNumber:Yt,isString:Zt,isObject:Xt,isArray:te,isDate:ee,isRegExp:re,isState:ne,isInjectable:c,isPromise:ie,Queue:je,maxLength:M,padString:B,kebobString:G,functionToString:W,fnToString:z,stringify:J,beforeAfterSubstr:vr,hostRegex:mr,stripLastPathElement:yr,splitHash:gr,splitQuery:_r,splitEqual:wr,trimHashVal:$r,splitOnDelim:Q,joinNeighborsR:K,get Category(){return t.Category},Trace:Me,trace:Be,get DefType(){return t.DefType},Param:Xe,ParamTypes:Sr,StateParams:Rr,ParamType:Ke,PathNode:tr,PathUtils:er,resolvePolicies:ir,defaultResolvePolicy:rr,Resolvable:nr,NATIVE_INJECTOR_TOKEN:sr,ResolveContext:cr,resolvablesBuilder:rt,StateBuilder:kr,StateObject:Mt,StateMatcher:Or,StateQueueManager:xr,StateRegistry:Ir,StateService:In,TargetState:Ge,get TransitionHookPhase(){return t.TransitionHookPhase},get TransitionHookScope(){return t.TransitionHookScope},HookBuilder:Qe,matchState:A,RegisteredHook:Je,makeEvent:H,get RejectType(){return t.RejectType},Rejection:He,Transition:hr,TransitionHook:ze,TransitionEventType:Tn,defaultTransOpts:On,TransitionService:xn,UrlMatcher:Ar,UrlMatcherFactory:Hr,UrlRouter:Mr,UrlRuleFactory:qr,BaseUrlRule:Dr,UrlService:Zr,ViewService:Br,UIRouterGlobals:Gr,UIRouter:tn,$q:Vn,$injector:qn,BaseLocationServices:Un,HashLocationService:Mn,MemoryLocationService:Gn,PushStateLocationService:zn,MemoryLocationConfig:Jn,BrowserLocationConfig:Qn,keyValsToObjectR:Dn,getParams:Fn,parseUrl:lt,buildUrl:Nn,locationPluginFactory:ht,servicesPlugin:pt,hashLocationPlugin:Kn,pushStateLocationPlugin:Yn,memoryLocationPlugin:Zn,UIRouterPluginBase:Xn}),ei=function(t,e){return t.reduce(function(t,r){return t||zt(e[r])},!1)},ri=0,ni=function(){function t(t,e,r){var n=this;this.path=t,this.viewDecl=e,this.factory=r,this.$id=ri++,this.loaded=!1,this.getTemplate=function(t,e){return n.component?n.factory.makeComponentTemplate(t,e,n.component,n.viewDecl.bindings):n.template}}return t.prototype.load=function(){var t=this,e=ae.$q,r=new cr(this.path),n=this.path.reduce(function(t,e){return he(t,e.paramValues)},{}),i={template:e.when(this.factory.fromConfig(this.viewDecl,n,r)),controller:e.when(this.getController(r))};return e.all(i).then(function(e){return Be.traceViewServiceEvent("Loaded",t),t.controller=e.controller,he(t,e.template),t})},t.prototype.getController=function(t){var e=this.viewDecl.controllerProvider;if(!c(e))return this.viewDecl.controller;var r=ae.$injector.annotate(e),n=te(e)?P(e):e;return new nr("",n,r).get(t)},t}(),ii=function(){function t(){var t=this;this._useHttp=It.version.minor<3,this.$get=["$http","$templateCache","$injector",function(e,r,n){return t.$templateRequest=n.has&&n.has("$templateRequest")&&n.get("$templateRequest"),t.$http=e,t.$templateCache=r,t}]}return t.prototype.useHttpService=function(t){this._useHttp=t},t.prototype.fromConfig=function(t,e,r){var n=function(t){return ae.$q.when(t).then(function(t){return{template:t}})},i=function(t){return ae.$q.when(t).then(function(t){return{component:t}})};return zt(t.template)?n(this.fromString(t.template,e)):zt(t.templateUrl)?n(this.fromUrl(t.templateUrl,e)):zt(t.templateProvider)?n(this.fromProvider(t.templateProvider,e,r)):zt(t.component)?i(t.component):zt(t.componentProvider)?i(this.fromComponentProvider(t.componentProvider,e,r)):n("")},t.prototype.fromString=function(t,e){return Kt(t)?t(e):t},t.prototype.fromUrl=function(t,e){return Kt(t)&&(t=t(e)),null==t?null:this._useHttp?this.$http.get(t,{cache:this.$templateCache,headers:{Accept:"text/html"}}).then(function(t){return t.data}):this.$templateRequest(t)},t.prototype.fromProvider=function(t,e,r){var n=ae.$injector.annotate(t),i=te(t)?P(t):t;return new nr("",i,n).get(r)},t.prototype.fromComponentProvider=function(t,e,r){var n=ae.$injector.annotate(t),i=te(t)?P(t):t;return new nr("",i,n).get(r)},t.prototype.makeComponentTemplate=function(t,e,r,n){n=n||{};var i=It.version.minor>=3?"::":"",o=function(t){var e=G(t);return/^(x|data)-/.exec(e)?"x-"+e:e},a=mt(r).map(function(r){var a=r.name,u=r.type,s=o(a);if(t.attr(s)&&!n[a])return s+"='"+t.attr(s)+"'";var c=n[a]||a;if("@"===u)return s+"='{{"+i+"$resolve."+c+"}}'";if("&"===u){var f=e.getResolvable(c),l=f&&f.data,h=l&&ae.$injector.annotate(l)||[];return s+"='$resolve."+c+(te(l)?"["+(l.length-1)+"]":"")+"("+h.join(",")+")'"}return s+"='"+i+"$resolve."+c+"'"}).join(" "),u=o(r);return"<"+u+" "+a+">"},t}(),oi=function(t){return ai(Xt(t.bindToController)?t.bindToController:t.scope)},ai=function(t){return Object.keys(t||{}).map(function(e){return[e,/^([=<@&])[?]?(.*)/.exec(t[e])]}).filter(function(t){return zt(t)&&te(t[1])}).map(function(t){return{name:t[1][2]||t[0],type:t[1][1]}})},ui=function(){function t(e,r){this.stateRegistry=e,this.stateService=r,h(Ut(t.prototype),this,Ut(this))}return t.prototype.decorator=function(t,e){return this.stateRegistry.decorator(t,e)||this},t.prototype.state=function(t,e){return Xt(t)?e=t:e.name=t,this.stateRegistry.register(e),this},t.prototype.onInvalid=function(t){return this.stateService.onInvalid(t)},t}(),si=function(t){return function(e,r){var n=e[t],i="onExit"===t?"from":"to";return n?function(t,e){var r=new cr(t.treeChanges(i)).subContext(e.$$state()),o=he(_i(r),{$state$:e,$transition$:t});return ae.$injector.invoke(n,this,o)}:void 0}},ci=function(){function t(t){this._urlListeners=[],this.$locationProvider=t;var e=Ut(t);h(e,this,e,["hashPrefix"])}return t.prototype.dispose=function(){},t.prototype.onChange=function(t){var e=this;return this._urlListeners.push(t),function(){return me(e._urlListeners)(t)}},t.prototype.html5Mode=function(){var t=this.$locationProvider.html5Mode();return(t=Xt(t)?t.enabled:t)&&this.$sniffer.history},t.prototype.url=function(t,e,r){return void 0===e&&(e=!1),zt(t)&&this.$location.url(t),e&&this.$location.replace(),r&&this.$location.state(r),this.$location.url()},t.prototype._runtimeServices=function(t,e,r,n){var i=this;this.$location=e,this.$sniffer=r,t.$on("$locationChangeSuccess",function(t){return i._urlListeners.forEach(function(e){return e(t)})});var o=Ut(e),a=Ut(n);h(o,this,o,["replace","path","search","hash"]),h(o,this,o,["port","protocol","host"]),h(a,this,a,["baseHref"])},t.monkeyPatchPathParameterType=function(t){var e=t.urlMatcherFactory.type("path");e.encode=function(t){return null!=t?t.toString().replace(/(~|\/)/g,function(t){return{"~":"~~","/":"~2F"}[t]}):t},e.decode=function(t){return null!=t?t.toString().replace(/(~~|~2F)/g,function(t){return{"~~":"~","~2F":"/"}[t]}):t}},t}(),fi=function(){function t(t){this._router=t,this._urlRouter=t.urlRouter}return t.prototype.$get=function(){var t=this._urlRouter;return t.update(!0),t.interceptDeferred||t.listen(),t},t.prototype.rule=function(t){var e=this;if(!Kt(t))throw new Error("'rule' must be a function");var r=new Dr(function(){return t(ae.$injector,e._router.locationService)},f);return this._urlRouter.rule(r),this},t.prototype.otherwise=function(t){var e=this,r=this._urlRouter;if(Zt(t))r.otherwise(t);else{if(!Kt(t))throw new Error("'rule' must be a string or function");r.otherwise(function(){return t(ae.$injector,e._router.locationService)})}return this},t.prototype.when=function(e,r){return(te(r)||Kt(r))&&(r=t.injectableHandler(this._router,r)),this._urlRouter.when(e,r),this},t.injectableHandler=function(t,e){return function(r){return ae.$injector.invoke(e,null,{$match:r,$stateParams:t.globals.params})}},t.prototype.deferIntercept=function(t){this._urlRouter.deferIntercept(t)},t}();It.module("ui.router.angular1",[]);var li=It.module("ui.router.init",[]),hi=It.module("ui.router.util",["ng","ui.router.init"]),pi=It.module("ui.router.router",["ui.router.util"]),di=It.module("ui.router.state",["ui.router.router","ui.router.util","ui.router.angular1"]),vi=It.module("ui.router",["ui.router.init","ui.router.state","ui.router.angular1"]),mi=(It.module("ui.router.compat",["ui.router"]),null);yt.$inject=["$locationProvider"];var yi=function(t){return["$uiRouterProvider",function(e){var r=e.router[t];return r.$get=function(){return r},r}]};gt.$inject=["$injector","$q","$uiRouter"];_t.$inject=["$rootScope"],li.provider("$uiRouter",yt),pi.provider("$urlRouter",["$uiRouterProvider",function(t){return t.urlRouterProvider=new fi(t)}]),hi.provider("$urlService",yi("urlService")),hi.provider("$urlMatcherFactory",["$uiRouterProvider",function(){return mi.urlMatcherFactory}]),hi.provider("$templateFactory",function(){return new ii}),di.provider("$stateRegistry",yi("stateRegistry")),di.provider("$uiRouterGlobals",yi("globals")),di.provider("$transitions",yi("transitionService")),di.provider("$state",["$uiRouterProvider",function(){return he(mi.stateProvider,{$get:function(){return mi.stateService}})}]),di.factory("$stateParams",["$uiRouter",function(t){return t.globals.params}]),vi.factory("$view",function(){return mi.viewService}),vi.service("$trace",function(){return Be}),vi.run(_t),hi.run(["$urlMatcherFactory",function(t){}]),di.run(["$state",function(t){}]),pi.run(["$urlRouter",function(t){}]),li.run(gt);var gi,_i=function(t){return t.getTokens().filter(Zt).map(function(e){var r=t.getResolvable(e);return[e,"NOWAIT"===t.getPolicy(r).async?r.promise:r.data]}).reduce(T,{})};gi=["$uiRouter","$timeout",function(t,e){var r=t.stateService;return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(n,i,o,a){function u(){var t=p();l&&l(),f&&(l=f.$$addStateInfo(t.uiState,t.uiStateParams)),null!=t.href&&o.$set(c.attr,t.href)}var s,c=bt(i),f=a[1]||a[0],l=null,h={},p=function(){return St(r,i,h)},d=wt(o.uiSref);h.uiState=d.state,h.uiStateOpts=o.uiSrefOpts?n.$eval(o.uiSrefOpts):{},d.paramExpr&&(n.$watch(d.paramExpr,function(t){h.uiStateParams=he({},t),u()},!0),h.uiStateParams=he({},n.$eval(d.paramExpr))),u(),n.$on("$destroy",t.stateRegistry.onStatesChanged(u)),n.$on("$destroy",t.transitionService.onSuccess({},u)),c.clickable&&(s=Rt(i,r,e,c,p),Ct(i,n,s,h.uiStateOpts))}}}];var wi;wi=["$uiRouter","$timeout",function(t,e){var r=t.stateService;return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(n,i,o,a){function u(){var t=d();h&&h(),f&&(h=f.$$addStateInfo(t.uiState,t.uiStateParams)),null!=t.href&&o.$set(c.attr,t.href)}var s,c=bt(i),f=a[1]||a[0],h=null,p={},d=function(){return St(r,i,p)},v=["uiState","uiStateParams","uiStateOpts"],m=v.reduce(function(t,e){return t[e]=l,t},{});v.forEach(function(t){p[t]=o[t]?n.$eval(o[t]):null,o.$observe(t,function(e){m[t](),m[t]=n.$watch(e,function(e){p[t]=e,u()},!0)})}),u(),n.$on("$destroy",t.stateRegistry.onStatesChanged(u)),n.$on("$destroy",t.transitionService.onSuccess({},u)),c.clickable&&(s=Rt(i,r,e,c,d),Ct(i,n,s,p.uiStateOpts))}}}];var $i;$i=["$state","$stateParams","$interpolate","$uiRouter",function(t,e,r,n){return{restrict:"A",controller:["$scope","$element","$attrs",function(e,i,o){function a(t){t.promise.then(s,l)}function u(e,r,n){var o={state:t.get(e,$t(i))||{name:e},params:r,activeClass:n};return p.push(o),function(){me(p)(o)}}function s(){var r=function(t){return t.split(/\s/).filter(f)},n=function(t){return t.map(function(t){return t.activeClass}).map(r).reduce(Re,[])},o=n(p).concat(r(c)).reduce(Ce,[]),a=n(p.filter(function(e){return t.includes(e.state.name,e.params)})),u=!!p.filter(function(e){return t.is(e.state.name,e.params)}).length?r(c):[],s=a.concat(u).reduce(Ce,[]),l=o.filter(function(t){return!ve(s,t)});e.$evalAsync(function(){s.forEach(function(t){return i.addClass(t)}),l.forEach(function(t){return i.removeClass(t)})})}var c,h,p=[];c=r(o.uiSrefActiveEq||"",!1)(e);try{h=e.$eval(o.uiSrefActive)}catch(t){}h=h||r(o.uiSrefActive||"",!1)(e),Xt(h)&&le(h,function(t,r){if(Zt(t)){var n=wt(t);u(n.state,e.$eval(n.paramExpr),r)}}),this.$$addStateInfo=function(t,e){if(!(Xt(h)&&p.length>0)){var r=u(t,e,h);return s(),r}},e.$on("$stateChangeSuccess",s),e.$on("$destroy",n.transitionService.onStart({},a)),n.globals.transition&&a(n.globals.transition),s()}]}}],It.module("ui.router.state").directive("uiSref",gi).directive("uiSrefActive",$i).directive("uiSrefActiveEq",$i).directive("uiState",wi),Tt.$inject=["$state"],Pt.$inject=["$state"],It.module("ui.router.state").filter("isState",Tt).filter("includedByState",Pt);var Si;Si=["$view","$animate","$uiViewScroll","$interpolate","$q",function(t,e,r,n,i){function o(t,r){return{enter:function(t,r,n){It.version.minor>2?e.enter(t,null,r).then(n):e.enter(t,null,r,n)},leave:function(t,r){It.version.minor>2?e.leave(t).then(r):e.leave(t,r)}}}function a(t,e){return t===e}var u={$cfg:{viewDecl:{$context:t._pluginapi._rootViewContext()}},$uiView:{}},s={count:0,restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(e,c,f){return function(e,c,l){function h(){if(d&&(Be.traceUIViewEvent("Removing (previous) el",d.data("$uiView")),d.remove(),d=null),m&&(Be.traceUIViewEvent("Destroying scope",R),m.$destroy(),m=null),v){var t=v.data("$uiViewAnim");Be.traceUIViewEvent("Animate out",t),w.leave(v,function(){t.$$animLeave.resolve(),d=null}),d=v,v=null}}function p(t){var n=e.$new(),o=i.defer(),a=i.defer(),u={$cfg:t,$uiView:R},s={$animEnter:o.promise,$animLeave:a.promise,$$animLeave:a};n.$emit("$viewContentLoading",b);var l=f(n,function(t){t.data("$uiViewAnim",s),t.data("$uiView",u),w.enter(t,c,function(){o.resolve(),m&&m.$emit("$viewContentAnimationEnded"),(zt(_)&&!_||e.$eval(_))&&r(t)}),h()});v=l,(m=n).$emit("$viewContentLoaded",t||$),m.$eval(g)}var d,v,m,y,g=l.onload||"",_=l.autoscroll,w=o(),$=void 0,S=c.inheritedData("$uiView")||u,b=n(l.uiView||l.name||"")(e)||"$default",R={$type:"ng1",id:s.count++,name:b,fqn:S.$uiView.fqn?S.$uiView.fqn+"."+b:b,config:null,configUpdated:function(t){(!t||t instanceof ni)&&(a($,t)||(Be.traceUIViewConfigUpdated(R,t&&t.viewDecl&&t.viewDecl.$context),$=t,p(t)))},get creationContext(){var t=At("$cfg.viewDecl.$context")(S),e=At("$uiView.creationContext")(S);return t||e}};Be.traceUIViewEvent("Linking",R),c.data("$uiView",{$uiView:R}),p(),y=t.registerUIView(R),e.$on("$destroy",function(){Be.traceUIViewEvent("Destroying/Unregistering",R),y()})}}};return s}],kt.$inject=["$compile","$controller","$transitions","$view","$q","$timeout"];var bi="function"==typeof It.module("ui.router").component,Ri=0;It.module("ui.router.state").directive("uiView",Si),It.module("ui.router.state").directive("uiView",kt),It.module("ui.router.state").provider("$uiViewScroll",function(){var t=!1;this.useAnchorScroll=function(){t=!0},this.$get=["$anchorScroll","$timeout",function(e,r){return t?e:function(t){return r(function(){t[0].scrollIntoView()},0,!1)}}]});t.default="ui.router",t.core=ti,t.watchDigests=_t,t.getLocals=_i,t.getNg1ViewConfigFactory=dt,t.ng1ViewsBuilder=vt,t.Ng1ViewConfig=ni,t.StateProvider=ui,t.UrlRouterProvider=fi,t.root=ue,t.fromJson=ce,t.toJson=fe,t.forEach=le,t.extend=he,t.equals=pe,t.identity=f,t.noop=l,t.createProxyFunctions=h,t.inherit=de,t.inArray=ve,t._inArray=p,t.removeFrom=me,t._removeFrom=d,t.pushTo=ye,t._pushTo=v,t.deregAll=ge,t.defaults=m,t.mergeR=_e,t.ancestors=y,t.pick=g,t.omit=_,t.pluck=w,t.filter=$,t.find=S,t.mapObj=we,t.map=b,t.values=$e,t.allTrueR=Se,t.anyTrueR=be,t.unnestR=Re,t.flattenR=Ee,t.pushR=R,t.uniqR=Ce,t.unnest=Te,t.flatten=Pe,t.assertPredicate=ke,t.assertMap=Oe,t.assertFn=E,t.pairs=xe,t.arrayTuples=C,t.applyPairs=T,t.tail=P,t.copy=k,t._extend=O,t.silenceUncaughtInPromise=Ie,t.silentRejection=Ve,t.notImplemented=oe,t.services=ae,t.Glob=Lt,t.curry=r,t.compose=n,t.pipe=i,t.prop=Vt,t.propEq=jt,t.parse=At,t.not=Ht,t.and=o,t.or=a,t.all=qt,t.any=Dt,t.is=Ft,t.eq=Nt,t.val=Ut,t.invoke=u,t.pattern=s,t.isUndefined=Wt,t.isDefined=zt,t.isNull=Jt,t.isNullOrUndefined=Qt,t.isFunction=Kt,t.isNumber=Yt,t.isString=Zt,t.isObject=Xt,t.isArray=te,t.isDate=ee,t.isRegExp=re,t.isState=ne,t.isInjectable=c,t.isPromise=ie,t.Queue=je,t.maxLength=M,t.padString=B,t.kebobString=G,t.functionToString=W,t.fnToString=z,t.stringify=J,t.beforeAfterSubstr=vr,t.hostRegex=mr,t.stripLastPathElement=yr,t.splitHash=gr,t.splitQuery=_r,t.splitEqual=wr,t.trimHashVal=$r,t.splitOnDelim=Q,t.joinNeighborsR=K,t.Trace=Me,t.trace=Be,t.Param=Xe,t.ParamTypes=Sr,t.StateParams=Rr,t.ParamType=Ke,t.PathNode=tr,t.PathUtils=er,t.resolvePolicies=ir,t.defaultResolvePolicy=rr,t.Resolvable=nr,t.NATIVE_INJECTOR_TOKEN=sr,t.ResolveContext=cr,t.resolvablesBuilder=rt,t.StateBuilder=kr,t.StateObject=Mt,t.StateMatcher=Or,t.StateQueueManager=xr,t.StateRegistry=Ir,t.StateService=In,t.TargetState=Ge,t.HookBuilder=Qe,t.matchState=A,t.RegisteredHook=Je,t.makeEvent=H,t.Rejection=He,t.Transition=hr,t.TransitionHook=ze,t.TransitionEventType=Tn,t.defaultTransOpts=On,t.TransitionService=xn,t.UrlMatcher=Ar,t.UrlMatcherFactory=Hr,t.UrlRouter=Mr,t.UrlRuleFactory=qr,t.BaseUrlRule=Dr,t.UrlService=Zr,t.ViewService=Br,t.UIRouterGlobals=Gr,t.UIRouter=tn,t.$q=Vn,t.$injector=qn,t.BaseLocationServices=Un,t.HashLocationService=Mn,t.MemoryLocationService=Gn,t.PushStateLocationService=zn,t.MemoryLocationConfig=Jn,t.BrowserLocationConfig=Qn,t.keyValsToObjectR=Dn,t.getParams=Fn,t.parseUrl=lt,t.buildUrl=Nn,t.locationPluginFactory=ht,t.servicesPlugin=pt,t.hashLocationPlugin=Kn,t.pushStateLocationPlugin=Yn,t.memoryLocationPlugin=Zn,t.UIRouterPluginBase=Xn,Object.defineProperty(t,"__esModule",{value:!0})}); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("angular")):"function"==typeof define&&define.amd?define(["exports","angular"],e):e(t["@uirouter/angularjs"]={},t.angular)}(this,function(t,e){"use strict";function r(t){function e(r){return r.length>=n?t.apply(null,r):function(){return e(r.concat([].slice.apply(arguments)))}}var r=[].slice.apply(arguments,[1]),n=t.length;return e(r)}function n(){var t=arguments,e=t.length-1;return function(){for(var r=e,n=t[e].apply(this,arguments);r--;)n=t[r].call(this,n);return n}}function i(){for(var t=[],e=0;e=0&&t.splice(r,1),t}function v(t,e){return t.push(e),e}function m(t){for(var e=[],r=1;r1||o.ctrlKey||o.metaKey||o.shiftKey||t.attr("target"))){var s=r(function(){e.go(u.uiState,u.uiStateParams,u.uiStateOpts)});o.preventDefault();var c=n.isAnchor&&!u.href?1:0;o.preventDefault=function(){c--<=0&&r.cancel(s)}}}}function Et(t,e){return{relative:$t(t)||e.$current,inherit:!0,source:"sref"}}function Ct(t,e,r,n){var i;n&&(i=n.events),te(i)||(i=["click"]);for(var o=t.on?"on":"bind",a=0,u=i;athis._limit&&e.shift(),t},t.prototype.dequeue=function(){if(this.size())return this._items.splice(0,1)[0]},t.prototype.clear=function(){var t=this._items;return this._items=[],t},t.prototype.size=function(){return this._items.length},t.prototype.remove=function(t){var e=this._items.indexOf(t);return e>-1&&this._items.splice(e,1)[0]},t.prototype.peekTail=function(){return this._items[this._items.length-1]},t.prototype.peekHead=function(){if(this.size())return this._items[0]},t}();!function(t){t[t.SUPERSEDED=2]="SUPERSEDED",t[t.ABORTED=3]="ABORTED",t[t.INVALID=4]="INVALID",t[t.IGNORED=5]="IGNORED",t[t.ERROR=6]="ERROR"}(t.RejectType||(t.RejectType={}));var Ae=0,He=function(){function e(t,e,r){this.$id=Ae++,this.type=t,this.message=e,this.detail=r}return e.isRejectionPromise=function(t){return t&&"function"==typeof t.then&&Ft(e)(t._transitionRejection)},e.superseded=function(r,n){var i=new e(t.RejectType.SUPERSEDED,"The transition has been superseded by a different transition",r);return n&&n.redirected&&(i.redirected=!0),i},e.redirected=function(t){return e.superseded(t,{redirected:!0})},e.invalid=function(r){return new e(t.RejectType.INVALID,"This transition is invalid",r)},e.ignored=function(r){return new e(t.RejectType.IGNORED,"The transition was ignored",r)},e.aborted=function(r){return new e(t.RejectType.ABORTED,"The transition has been aborted",r)},e.errored=function(r){return new e(t.RejectType.ERROR,"The transition errored",r)},e.normalize=function(t){return Ft(e)(t)?t:e.errored(t)},e.prototype.toString=function(){var t=function(t){return t&&t.toString!==Object.prototype.toString?t.toString():J(t)}(this.detail),e=this;return"Transition Rejection($id: "+e.$id+" type: "+e.type+", message: "+e.message+", detail: "+t+")"},e.prototype.toPromise=function(){return he(Ve(this),{_transitionRejection:this})},e}(),qe=function(t){var e=t.viewDecl,r=e.$context.name||"(root)";return"[View#"+t.$id+" from '"+r+"' state]: target ui-view: '"+e.$uiViewName+"@"+e.$uiViewContextAnchor+"'"},De=Function.prototype.bind.call(console.log,console),Fe=Kt(console.table)?console.table.bind(console):De.bind(console);!function(t){t[t.RESOLVE=0]="RESOLVE",t[t.TRANSITION=1]="TRANSITION",t[t.HOOK=2]="HOOK",t[t.UIVIEW=3]="UIVIEW",t[t.VIEWCONFIG=4]="VIEWCONFIG"}(t.Category||(t.Category={}));var Ne=At("$id"),Ue=At("router.$id"),Le=function(t){return"Transition #"+Ne(t)+"-"+Ue(t)},Me=function(){function e(){this._enabled={},this.approximateDigests=0}return e.prototype._set=function(e,r){var n=this;r.length||(r=Object.keys(t.Category).map(function(t){return parseInt(t,10)}).filter(function(t){return!isNaN(t)}).map(function(e){return t.Category[e]})),r.map(j).forEach(function(t){return n._enabled[t]=e})},e.prototype.enable=function(){for(var t=[],e=0;e "+J(e))},e.prototype.traceTransitionIgnored=function(e){this.enabled(t.Category.TRANSITION)&&console.log(Le(e)+": Ignored <> "+J(e))},e.prototype.traceHookInvocation=function(e,r,n){if(this.enabled(t.Category.HOOK)){var i=At("traceData.hookType")(n)||"internal",o=At("traceData.context.state.name")(n)||At("traceData.context")(n)||"unknown",a=W(e.registeredHook.callback);console.log(Le(r)+": Hook -> "+i+" context: "+o+", "+M(200,a))}},e.prototype.traceHookResult=function(e,r,n){this.enabled(t.Category.HOOK)&&console.log(Le(r)+": <- Hook returned: "+M(200,J(e)))},e.prototype.traceResolvePath=function(e,r,n){this.enabled(t.Category.RESOLVE)&&console.log(Le(n)+": Resolving "+e+" ("+r+")")},e.prototype.traceResolvableResolved=function(e,r){this.enabled(t.Category.RESOLVE)&&console.log(Le(r)+": <- Resolved "+e+" to: "+M(200,J(e.data)))},e.prototype.traceError=function(e,r){this.enabled(t.Category.TRANSITION)&&console.log(Le(r)+": <- Rejected "+J(r)+", reason: "+e)},e.prototype.traceSuccess=function(e,r){this.enabled(t.Category.TRANSITION)&&console.log(Le(r)+": <- Success "+J(r)+", final state: "+e.name)},e.prototype.traceUIViewEvent=function(e,r,n){void 0===n&&(n=""),this.enabled(t.Category.UIVIEW)&&console.log("ui-view: "+B(30,e)+" "+V(r)+n)},e.prototype.traceUIViewConfigUpdated=function(e,r){this.enabled(t.Category.UIVIEW)&&this.traceUIViewEvent("Updating",e," with ViewConfig from context='"+r+"'")},e.prototype.traceUIViewFill=function(e,r){this.enabled(t.Category.UIVIEW)&&this.traceUIViewEvent("Fill",e," with: "+M(200,r))},e.prototype.traceViewSync=function(e){if(this.enabled(t.Category.VIEWCONFIG)){var r="uiview component fqn",n=e.map(function(t){var e=t.uiView,n=t.viewConfig,i=e&&e.fqn,o=n&&n.viewDecl.$context.name+": ("+n.viewDecl.$name+")";return a={},a[r]=i,a["view config state (view name)"]=o,a;var a}).sort(function(t,e){return(t[r]||"").localeCompare(e[r]||"")});Fe(n)}},e.prototype.traceViewServiceEvent=function(e,r){this.enabled(t.Category.VIEWCONFIG)&&console.log("VIEWCONFIG: "+e+" "+qe(r))},e.prototype.traceViewServiceUIViewEvent=function(e,r){this.enabled(t.Category.VIEWCONFIG)&&console.log("VIEWCONFIG: "+e+" "+V(r))},e}(),Be=new Me;!function(t){t[t.CREATE=0]="CREATE",t[t.BEFORE=1]="BEFORE",t[t.RUN=2]="RUN",t[t.SUCCESS=3]="SUCCESS",t[t.ERROR=4]="ERROR"}(t.TransitionHookPhase||(t.TransitionHookPhase={})),function(t){t[t.TRANSITION=0]="TRANSITION",t[t.STATE=1]="STATE"}(t.TransitionHookScope||(t.TransitionHookScope={}));var Ge=function(){function t(t,e,r,n){this._stateRegistry=t,this._identifier=e,this._identifier=e,this._params=he({},r||{}),this._options=he({},n||{}),this._definition=t.matcher.find(e,this._options.relative)}return t.prototype.name=function(){return this._definition&&this._definition.name||this._identifier},t.prototype.identifier=function(){return this._identifier},t.prototype.params=function(){return this._params},t.prototype.$state=function(){return this._definition},t.prototype.state=function(){return this._definition&&this._definition.self},t.prototype.options=function(){return this._options},t.prototype.exists=function(){return!(!this._definition||!this._definition.self)},t.prototype.valid=function(){return!this.error()},t.prototype.error=function(){var t=this.options().relative;if(!this._definition&&t){var e=t.name?t.name:t;return"Could not resolve '"+this.name()+"' from state '"+e+"'"}return this._definition?this._definition.self?void 0:"State '"+this.name()+"' has an invalid definition":"No such state '"+this.name()+"'"},t.prototype.toString=function(){return"'"+this.name()+"'"+J(this.params())},t.prototype.withState=function(e){return new t(this._stateRegistry,e,this._params,this._options)},t.prototype.withParams=function(e,r){void 0===r&&(r=!1);var n=r?e:he({},this._params,e);return new t(this._stateRegistry,this._identifier,n,this._options)},t.prototype.withOptions=function(e,r){void 0===r&&(r=!1);var n=r?e:he({},this._options,e);return new t(this._stateRegistry,this._identifier,this._params,n)},t.isDef=function(t){return t&&t.state&&(Zt(t.state)||Zt(t.state.name))},t}(),We={current:l,transition:null,traceData:{},bind:null},ze=function(){function e(e,r,n,i){var o=this;this.transition=e,this.stateContext=r,this.registeredHook=n,this.options=i,this.isSuperseded=function(){return o.type.hookPhase===t.TransitionHookPhase.RUN&&!o.options.transition.isActive()},this.options=m(i,We),this.type=n.eventType}return e.chain=function(t,e){return t.reduce(function(t,e){return t.then(function(){return e.invokeHook()})},e||ae.$q.when())},e.invokeHooks=function(t,r){for(var n=0;n=e.invokeLimit&&e.deregister()}}},e.prototype.handleHookResult=function(t){var e=this,r=this.getNotCurrentRejection();return r||(ie(t)?t.then(function(t){return e.handleHookResult(t)}):(Be.traceHookResult(t,this.transition,this.options),!1===t?He.aborted("Hook aborted transition").toPromise():Ft(Ge)(t)?He.redirected(t).toPromise():void 0))},e.prototype.getNotCurrentRejection=function(){var t=this.transition.router;return t._disposed?He.aborted("UIRouter instance #"+t.$id+" has been stopped (disposed)").toPromise():this.transition._aborted?He.aborted().toPromise():this.isSuperseded()?He.superseded(this.options.current()).toPromise():void 0},e.prototype.toString=function(){var t=this,e=t.options,r=t.registeredHook;return(At("traceData.hookType")(e)||"internal")+" context: "+(At("traceData.context.state.name")(e)||At("traceData.context")(e)||"unknown")+", "+M(200,z(r.callback))},e.HANDLE_RESULT=function(t){return function(e){return t.handleHookResult(e)}},e.LOG_REJECTED_RESULT=function(t){return function(e){ie(e)&&e.catch(function(e){return t.logError(He.normalize(e))})}},e.LOG_ERROR=function(t){return function(e){return t.logError(e)}},e.REJECT_ERROR=function(t){return function(t){return Ve(t)}},e.THROW_ERROR=function(t){return function(t){throw t}},e}(),Je=function(){function e(t,e,r,n,i,o){void 0===o&&(o={}),this.tranSvc=t,this.eventType=e,this.callback=r,this.matchCriteria=n,this.removeHookFromRegistry=i,this.invokeCount=0,this._deregistered=!1,this.priority=o.priority||0,this.bind=o.bind||null,this.invokeLimit=o.invokeLimit}return e.prototype._matchingNodes=function(t,e){if(!0===e)return t;var r=t.filter(function(t){return A(t.state,e)});return r.length?r:null},e.prototype._getDefaultMatchCriteria=function(){return b(this.tranSvc._pluginapi._getPathTypes(),function(){return!0})},e.prototype._getMatchingNodes=function(e){var r=this,n=he(this._getDefaultMatchCriteria(),this.matchCriteria);return $e(this.tranSvc._pluginapi._getPathTypes()).reduce(function(i,o){var a=o.scope===t.TransitionHookScope.STATE,u=e[o.name]||[],s=a?u:[P(u)];return i[o.name]=r._matchingNodes(s,n[o.name]),i},{})},e.prototype.matches=function(t){var e=this._getMatchingNodes(t);return $e(e).every(f)?e:null},e.prototype.deregister=function(){this.removeHookFromRegistry(this),this._deregistered=!0},e}(),Qe=function(){function e(t){this.transition=t}return e.prototype.buildHooksForPhase=function(t){var e=this;return this.transition.router.transitionService._pluginapi._getEvents(t).map(function(t){return e.buildHooks(t)}).reduce(Re,[]).filter(f)},e.prototype.buildHooks=function(e){var r=this.transition,n=r.treeChanges(),i=this.getMatchingHooks(e,n);if(!i)return[];var o={transition:r,current:r.options().current};return i.map(function(i){return i.matches(n)[e.criteriaMatchPath.name].map(function(n){var a=he({bind:i.bind,traceData:{hookType:e.name,context:n}},o),u=e.criteriaMatchPath.scope===t.TransitionHookScope.STATE?n.state.self:null,s=new ze(r,u,i,a);return{hook:i,node:n,transitionHook:s}})}).reduce(Re,[]).sort(q(e.reverseSort)).map(function(t){return t.transitionHook})},e.prototype.getMatchingHooks=function(e,r){var n=e.hookPhase===t.TransitionHookPhase.CREATE,i=this.transition.router.transitionService;return(n?[i]:[this.transition,i]).map(function(t){return t.getHooks(e.name)}).filter(ke(te,"broken event named: "+e.name)).reduce(Re,[]).filter(function(t){return t.matches(r)})},e}(),Ke=function(){function t(t){this.pattern=/.*/,this.inherit=!0,he(this,t)}return t.prototype.is=function(t,e){return!0},t.prototype.encode=function(t,e){return t},t.prototype.decode=function(t,e){return t},t.prototype.equals=function(t,e){return t==e},t.prototype.$subPattern=function(){var t=this.pattern.toString();return t.substr(1,t.length-2)},t.prototype.toString=function(){return"{ParamType:"+this.name+"}"},t.prototype.$normalize=function(t){return this.is(t)?t:this.decode(t)},t.prototype.$asArray=function(t,e){if(!t)return this;if("auto"===t&&!e)throw new Error("'auto' array mode is for query parameters only");return new D(this,t)},t}(),Ye=Object.prototype.hasOwnProperty,Ze=function(t){return 0===["value","type","squash","array","dynamic"].filter(Ye.bind(t||{})).length};!function(t){t[t.PATH=0]="PATH",t[t.SEARCH=1]="SEARCH",t[t.CONFIG=2]="CONFIG"}(t.DefType||(t.DefType={}));var Xe=function(){function e(e,r,n,i,o){r=N(n=F(n),r,i,e,o.paramTypes);var a=function(){var r={array:i===t.DefType.SEARCH&&"auto"},o=e.match(/\[\]$/)?{array:!0}:{};return he(r,o,n).array}();r=a?r.$asArray(a,i===t.DefType.SEARCH):r;var u=void 0!==n.value||i===t.DefType.SEARCH,s=zt(n.dynamic)?!!n.dynamic:!!r.dynamic,c=zt(n.raw)?!!n.raw:!!r.raw,f=U(n,u,o.defaultSquashPolicy()),l=L(n,a,u,f),h=zt(n.inherit)?!!n.inherit:!!r.inherit;he(this,{id:e,type:r,location:i,isOptional:u,dynamic:s,raw:c,squash:f,replace:l,inherit:h,array:a,config:n})}return e.values=function(t,e){void 0===e&&(e={});for(var r={},n=0,i=t;n20)throw new Error("Too many consecutive Transition redirects (20+)");var n={redirectedFrom:this,source:"redirect"};"url"===this.options().source&&!1!==t.options().location&&(n.location="replace");var i=he({},this.options(),t.options(),n);t=t.withOptions(i,!0);var o=this.router.transitionService.create(this._treeChanges.from,t),a=this._treeChanges.entering,u=o._treeChanges.entering;return er.matching(u,a,er.nonDynamicParams).filter(Ht(function(t){return function(e){return t&&e.state.includes[t.name]}}(t.options().reloadState))).forEach(function(t,e){t.resolvables=a[e].resolvables}),o},e.prototype._changedParams=function(){var t=this._treeChanges;if(!(this._options.reload||t.exiting.length||t.entering.length||t.to.length!==t.from.length||C(t.to,t.from).map(function(t){return t[0].state!==t[1].state}).reduce(be,!1))){var e=t.to.map(function(t){return t.paramSchema}),r=[t.to,t.from].map(function(t){return t.map(function(t){return t.paramValues})});return C(e,r[0],r[1]).map(function(t){var e=t[0],r=t[1],n=t[2];return Xe.changed(e,r,n)}).reduce(Re,[])}},e.prototype.dynamic=function(){var t=this._changedParams();return!!t&&t.map(function(t){return t.dynamic}).reduce(be,!1)},e.prototype.ignored=function(){return!!this._ignoredReason()},e.prototype._ignoredReason=function(){var t=this.router.globals.transition,e=this._options.reloadState,r=function(t,r){if(t.length!==r.length)return!1;var n=er.matching(t,r);return t.length===n.filter(function(t){return!e||!t.state.includes[e.name]}).length},n=this.treeChanges(),i=t&&t.treeChanges();return i&&r(i.to,n.to)&&r(i.exiting,n.exiting)?"SameAsPending":0===n.exiting.length&&0===n.entering.length&&r(n.from,n.to)?"SameAsCurrent":void 0},e.prototype.run=function(){var e=this,r=ze.runAllHooks,n=function(t){return e._hookBuilder.buildHooksForPhase(t)},i=n(t.TransitionHookPhase.BEFORE);return ze.invokeHooks(i,function(){var t=e.router.globals;return t.lastStartedTransitionId=e.$id,t.transition=e,t.transitionHistory.enqueue(e),Be.traceTransitionStart(e),ae.$q.when(void 0)}).then(function(){var e=n(t.TransitionHookPhase.RUN);return ze.invokeHooks(e,function(){return ae.$q.when(void 0)})}).then(function(){Be.traceSuccess(e.$to(),e),e.success=!0,e._deferred.resolve(e.to()),r(n(t.TransitionHookPhase.SUCCESS))},function(i){Be.traceError(i,e),e.success=!1,e._deferred.reject(i),e._error=i,r(n(t.TransitionHookPhase.ERROR))}),this.promise},e.prototype.valid=function(){return!this.error()||void 0!==this.success},e.prototype.abort=function(){Wt(this.success)&&(this._aborted=!0)},e.prototype.error=function(){var t=this.$to();if(t.self.abstract)return"Cannot transition to abstract state '"+t.name+"'";var e=t.parameters(),r=this.params(),n=e.filter(function(t){return!t.validates(r[t.id])});return n.length?"Param values not valid for state '"+t.name+"'. Invalid params: [ "+n.map(function(t){return t.id}).join(", ")+" ]":!1===this.success?this._error:void 0},e.prototype.toString=function(){var t=this.from(),e=this.to(),r=function(t){return null!==t["#"]&&void 0!==t["#"]?t:_(t,["#"])};return"Transition#"+this.$id+"( '"+(Xt(t)?t.name:t)+"'"+J(r(this._treeChanges.from.map(Vt("paramValues")).reduce(_e,{})))+" -> "+(this.valid()?"":"(X) ")+"'"+(Xt(e)?e.name:e)+"'"+J(r(this.params()))+" )"},e.diToken=e,e}(),pr=null,dr=function(t){var e=He.isRejectionPromise;return(pr=pr||s([[Ht(zt),Ut("undefined")],[Jt,Ut("null")],[ie,Ut("[Promise]")],[e,function(t){return t._transitionRejection.toString()}],[Ft(He),u("toString")],[Ft(hr),u("toString")],[Ft(nr),u("toString")],[c,W],[Ut(!0),f]]))(t)},vr=function(t){return function(e){if(!e)return["",""];var r=e.indexOf(t);return-1===r?[e,""]:[e.substr(0,r),e.substr(r+1)]}},mr=new RegExp("^(?:[a-z]+:)?//[^/]+/"),yr=function(t){return t.replace(/\/[^/]*$/,"")},gr=vr("#"),_r=vr("?"),wr=vr("="),$r=function(t){return t?t.replace(/^#/,""):""},Sr=function(){function t(){this.enqueue=!0,this.typeQueue=[],this.defaultTypes=g(t.prototype,["hash","string","query","path","int","bool","date","json","any"]);this.types=de(b(this.defaultTypes,function(t,e){return new Ke(he({name:e},t))}),{})}return t.prototype.dispose=function(){this.types={}},t.prototype.type=function(t,e,r){if(!zt(e))return this.types[t];if(this.types.hasOwnProperty(t))throw new Error("A type named '"+t+"' has already been defined.");return this.types[t]=new Ke(he({name:t},e)),r&&(this.typeQueue.push({name:t,def:r}),this.enqueue||this._flushTypeQueue()),this},t.prototype._flushTypeQueue=function(){for(;this.typeQueue.length;){var t=this.typeQueue.shift();if(t.pattern)throw new Error("You cannot override a type's .pattern at runtime.");he(this.types[t.name],ae.$injector.invoke(t.def))}},t}();!function(){var t=function(t){var e=function(t){return null!=t?t.toString():t},r={encode:e,decode:e,is:Ft(String),pattern:/.*/,equals:function(t,e){return t==e}};return he({},r,t)};he(Sr.prototype,{string:t({}),path:t({pattern:/[^/]*/}),query:t({}),hash:t({inherit:!1}),int:t({decode:function(t){return parseInt(t,10)},is:function(t){return!Qt(t)&&this.decode(t.toString())===t},pattern:/-?\d+/}),bool:t({encode:function(t){return t&&1||0},decode:function(t){return 0!==parseInt(t,10)},is:Ft(Boolean),pattern:/0|1/}),date:t({encode:function(t){return this.is(t)?[t.getFullYear(),("0"+(t.getMonth()+1)).slice(-2),("0"+t.getDate()).slice(-2)].join("-"):void 0},decode:function(t){if(this.is(t))return t;var e=this.capture.exec(t);return e?new Date(e[1],e[2]-1,e[3]):void 0},is:function(t){return t instanceof Date&&!isNaN(t.valueOf())},equals:function(t,e){return["getFullYear","getMonth","getDate"].reduce(function(r,n){return r&&t[n]()===e[n]()},!0)},pattern:/[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,capture:/([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/}),json:t({encode:fe,decode:ce,is:Ft(Object),equals:pe,pattern:/[^/]*/}),any:t({encode:f,decode:f,is:function(){return!0},equals:pe})})}();var br,Rr=function(){function t(t){void 0===t&&(t={}),he(this,t)}return t.prototype.$inherit=function(t,e,r){var n,i=y(e,r),o={},a=[];for(var u in i)if(i[u]&&i[u].params&&(n=Object.keys(i[u].params)).length)for(var s in n)a.indexOf(n[s])>=0||(a.push(n[s]),o[n[s]]=this[n[s]]);return he({},o,t)},t}(),Er=function(t){if(!Zt(t))return!1;var e="^"===t.charAt(0);return{val:e?t.substring(1):t,root:e}},Cr=function(t,e){return function(r){var n=r;n&&n.url&&n.name&&n.name.match(/\.\*\*$/)&&(n.url+="{remainder:any}");var i=Er(n.url),o=r.parent,a=i?t.compile(i.val,{params:r.params||{},paramMap:function(t,e){return!1===n.reloadOnSearch&&e&&(t=he(t||{},{dynamic:!0})),t}}):n.url;if(!a)return null;if(!t.isMatcher(a))throw new Error("Invalid url '"+a+"' in state '"+r+"'");return i&&i.root?a:(o&&o.navigable||e()).url.append(a)}},Tr=function(t){return function(e){return!t(e)&&e.url?e:e.parent?e.parent.navigable:null}},Pr=function(t){return function(e){var r=e.url&&e.url.parameters({inherit:!1})||[],n=$e(we(_(e.params||{},r.map(Vt("id"))),function(e,r){return t.fromConfig(r,null,e)}));return r.concat(n).map(function(t){return[t.id,t]}).reduce(T,{})}},kr=function(){function t(t,e){this.matcher=t;var r=this,n=function(){return t.find("")},i=function(t){return""===t.name};this.builders={name:[Y],self:[Z],parent:[function(e){return i(e)?null:t.find(r.parentName(e))||n()}],data:[X],url:[Cr(e,n)],navigable:[Tr(i)],params:[Pr(e.paramFactory)],views:[],path:[tt],includes:[et],resolvables:[rt]}}return t.prototype.builder=function(t,e){var r=this.builders,n=r[t]||[];return Zt(t)&&!zt(e)?n.length>1?n:n[0]:Zt(t)&&Kt(e)?(r[t]=n,r[t].push(e),function(){return r[t].splice(r[t].indexOf(e,1))&&null}):void 0},t.prototype.build=function(t){var e=this,r=e.matcher,n=e.builders,i=this.parentName(t);if(i&&!r.find(i,void 0,!1))return null;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o].reduce(function(t,e){return function(r){return e(r,t)}},l);t[o]=a(t)}return t},t.prototype.parentName=function(t){var e=t.name||"",r=e.split(".");if("**"===r.pop()&&r.pop(),r.length){if(t.parent)throw new Error("States that specify the 'parent:' property should not have a '.' in their name ("+e+")");return r.join(".")}return t.parent?Zt(t.parent)?t.parent:t.parent.name:""},t.prototype.name=function(t){var e=t.name;if(-1!==e.indexOf(".")||!t.parent)return e;var r=Zt(t.parent)?t.parent:t.parent.name;return r?r+"."+e:e},t}(),Or=function(){function t(t){this._states=t}return t.prototype.isRelative=function(t){return 0===(t=t||"").indexOf(".")||0===t.indexOf("^")},t.prototype.find=function(t,e,r){if(void 0===r&&(r=!0),t||""===t){var n=Zt(t),i=n?t:t.name;this.isRelative(i)&&(i=this.resolvePath(i,e));var o=this._states[i];if(o&&(n||!(n||o!==t&&o.self!==t)))return o;if(n&&r){var a=$e(this._states).filter(function(t){return t.__stateObjectCache.nameGlob&&t.__stateObjectCache.nameGlob.matches(i)});return a.length>1&&console.log("stateMatcher.find: Found multiple matches for "+i+" using glob: ",a.map(function(t){return t.name})),a[0]}}},t.prototype.resolvePath=function(t,e){if(!e)throw new Error("No reference point given for path '"+t+"'");for(var r=this.find(e),n=t.split("."),i=n.length,o=0,a=r;o0;){var c=r.shift(),f=c.name,l=i.build(c),h=a.indexOf(c);if(l){var p=s(f);if(p&&p.name===f)throw new Error("State '"+f+"' is already defined");var d=s(f+".**");d&&this.$registry.deregister(d),n[f]=c,this.attachRoute(c),h>=0&&a.splice(h,1),o.push(c)}else{var v=u[f];if(u[f]=r.length,h>=0&&v===r.length)return r.push(c),n;h<0&&a.push(c),r.push(c)}}return o.length&&this.listeners.forEach(function(t){return t("registered",o.map(function(t){return t.self}))}),n},t.prototype.attachRoute=function(t){!t.abstract&&t.url&&this.$urlRouter.rule(this.$urlRouter.urlRuleFactory.create(t))},t}(),Ir=function(){function t(t){this._router=t,this.states={},this.listeners=[],this.matcher=new Or(this.states),this.builder=new kr(this.matcher,t.urlMatcherFactory),this.stateQueue=new xr(this,t.urlRouter,this.states,this.builder,this.listeners),this._registerRoot()}return t.prototype._registerRoot=function(){var t={name:"",url:"^",views:null,params:{"#":{value:null,type:"hash",dynamic:!0}},abstract:!0};(this._root=this.stateQueue.register(t)).navigable=null},t.prototype.dispose=function(){var t=this;this.stateQueue.dispose(),this.listeners=[],this.get().forEach(function(e){return t.get(e)&&t.deregister(e)})},t.prototype.onStatesChanged=function(t){return this.listeners.push(t),function(){me(this.listeners)(t)}.bind(this)},t.prototype.root=function(){return this._root},t.prototype.register=function(t){return this.stateQueue.register(t)},t.prototype._deregisterTree=function(t){var e=this,r=this.get().map(function(t){return t.$$state()}),n=function(t){var e=r.filter(function(e){return-1!==t.indexOf(e.parent)});return 0===e.length?e:e.concat(n(e))},i=n([t]),o=[t].concat(i).reverse();return o.forEach(function(t){var r=e._router.urlRouter;r.rules().filter(jt("state",t)).forEach(r.removeRule.bind(r)),delete e.states[t.name]}),o},t.prototype.deregister=function(t){var e=this.get(t);if(!e)throw new Error("Can't deregister state; not found: "+t);var r=this._deregisterTree(e.$$state());return this.listeners.forEach(function(t){return t("deregistered",r.map(function(t){return t.self}))}),r},t.prototype.get=function(t,e){var r=this;if(0===arguments.length)return Object.keys(this.states).map(function(t){return r.states[t].self});var n=this.matcher.find(t,e);return n&&n.self||null},t.prototype.decorator=function(t,e){return this.builder.builder(t,e)},t}(),Vr=function(t,e,r){return t[e]=t[e]||r()},jr=Q("/"),Ar=function(){function e(t,r,n,i){var o=this;this.config=i,this._cache={path:[this]},this._children=[],this._params=[],this._segments=[],this._compiled=[],this.pattern=t,this.config=m(this.config,{params:{},strict:!0,caseInsensitive:!1,paramMap:f});for(var a,u,s,c=/([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,l=/([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,h=[],p=0,d=function(r){if(!e.nameValidator.test(r))throw new Error("Invalid parameter name '"+r+"' in pattern '"+t+"'");if(S(o._params,jt("id",r)))throw new Error("Duplicate parameter name '"+r+"' in pattern '"+t+"'")},v=function(e,n){var i=e[2]||e[3],a=n?e[4]:e[4]||("*"===e[1]?"[\\s\\S]*":null);return{id:i,regexp:a,cfg:o.config.params[i],segment:t.substring(p,e.index),type:a?r.type(a)||function(t){return de(r.type(n?"query":"path"),{pattern:new RegExp(t,o.config.caseInsensitive?"i":void 0)})}(a):null}};(a=c.exec(t))&&!((u=v(a,!1)).segment.indexOf("?")>=0);)d(u.id),this._params.push(n.fromPath(u.id,u.type,this.config.paramMap(u.cfg,!1))),this._segments.push(u.segment),h.push([u.segment,P(this._params)]),p=c.lastIndex;var y=(s=t.substring(p)).indexOf("?");if(y>=0){var g=s.substring(y);if(s=s.substring(0,y),g.length>0)for(p=0;a=l.exec(g);)d((u=v(a,!0)).id),this._params.push(n.fromSearch(u.id,u.type,this.config.paramMap(u.cfg,!0))),p=c.lastIndex}this._segments.push(s),this._compiled=h.map(function(t){return nt.apply(null,t)}).concat(nt(s))}return e.encodeDashes=function(t){return encodeURIComponent(t).replace(/-/g,function(t){return"%5C%"+t.charCodeAt(0).toString(16).toUpperCase()})},e.pathSegmentsAndParams=function(e){return C(e._segments,e._params.filter(function(e){return e.location===t.DefType.PATH}).concat(void 0)).reduce(Re,[]).filter(function(t){return""!==t&&zt(t)})},e.queryParams=function(e){return e._params.filter(function(e){return e.location===t.DefType.SEARCH})},e.compare=function(t,r){var n=function(t){return t._cache.segments=t._cache.segments||t._cache.path.map(e.pathSegmentsAndParams).reduce(Re,[]).reduce(K,[]).map(function(t){return Zt(t)?jr(t):t}).reduce(Re,[])},i=function(t){return t._cache.weights=t._cache.weights||n(t).map(function(t){return"/"===t?1:Zt(t)?2:t instanceof Xe?3:void 0})},o=i(t),a=i(r);!function(t,e,r){for(var n=Math.max(t.length,e.length);t.lengthn.weight?o:n}return n},t.prototype.sync=function(t){if(!t||!t.defaultPrevented){var e=this._router,r=e.urlService,n=e.stateService,i={path:r.path(),search:r.search(),hash:r.hash()},o=this.match(i);s([[Zt,function(t){return r.url(t,!0)}],[Ge.isDef,function(t){return n.go(t.state,t.params,t.options)}],[Ft(Ge),function(t){return n.go(t.state(),t.params(),t.options())}]])(o&&o.rule.handler(o.match,i,e))}},t.prototype.listen=function(t){var e=this;if(!1!==t)return this._stopFn=this._stopFn||this._router.urlService.onChange(function(t){return e.sync(t)});this._stopFn&&this._stopFn(),delete this._stopFn},t.prototype.update=function(t){var e=this._router.locationService;t?this.location=e.url():e.url()!==this.location&&e.url(this.location,!0)},t.prototype.push=function(t,e,r){var n=r&&!!r.replace;this._router.urlService.url(t.format(e||{}),n)},t.prototype.href=function(t,e,r){var n=t.format(e);if(null==n)return null;r=r||{absolute:!1};var i=this._router.urlService.config,o=i.html5Mode();if(o||null===n||(n="#"+i.hashPrefix()+n),n=it(n,o,r.absolute,i.baseHref()),!r.absolute||!n)return n;var a=!o&&n?"/":"",u=i.port(),s=80===u||443===u?"":":"+u;return[i.protocol(),"://",i.host(),s,a,n].join("")},t.prototype.rule=function(t){var e=this;if(!qr.isUrlRule(t))throw new Error("invalid rule");return t.$id=this._id++,t.priority=t.priority||0,this._rules.push(t),this._sorted=!1,function(){return e.removeRule(t)}},t.prototype.removeRule=function(t){me(this._rules,t)},t.prototype.rules=function(){return this.ensureSorted(),this._rules.slice()},t.prototype.otherwise=function(t){var e=ot(t);this._otherwiseFn=this.urlRuleFactory.create(Ut(!0),e),this._sorted=!1},t.prototype.initial=function(t){var e=ot(t);this.rule(this.urlRuleFactory.create(function(t,e){return 0===e.globals.transitionHistory.size()&&!!/^\/?$/.exec(t.path)},e))},t.prototype.when=function(t,e,r){var n=this.urlRuleFactory.create(t,e);return zt(r&&r.priority)&&(n.priority=r.priority),this.rule(n),n},t.prototype.deferIntercept=function(t){void 0===t&&(t=!0),this.interceptDeferred=t},t}(),Br=function(){function t(){var t=this;this._uiViews=[],this._viewConfigs=[],this._viewConfigFactories={},this._listeners=[],this._pluginapi={_rootViewContext:this._rootViewContext.bind(this),_viewConfigFactory:this._viewConfigFactory.bind(this),_registeredUIViews:function(){return t._uiViews},_activeViewConfigs:function(){return t._viewConfigs},_onSync:function(e){return t._listeners.push(e),function(){return me(t._listeners,e)}}}}return t.normalizeUIViewTarget=function(t,e){void 0===e&&(e="");var r=e.split("@"),n=r[0]||"$default",i=Zt(r[1])?r[1]:"^",o=/^(\^(?:\.\^)*)\.(.*$)/.exec(n);return o&&(i=o[1],n=o[2]),"!"===n.charAt(0)&&(n=n.substr(1),i=""),/^(\^(?:\.\^)*)$/.exec(i)?i=i.split(".").reduce(function(t,e){return t.parent},t).name:"."===i&&(i=t.name),{uiViewName:n,uiViewContextAnchor:i}},t.prototype._rootViewContext=function(t){return this._rootContext=t||this._rootContext},t.prototype._viewConfigFactory=function(t,e){this._viewConfigFactories[t]=e},t.prototype.createViewConfig=function(t,e){var r=this._viewConfigFactories[e.$type];if(!r)throw new Error("ViewService: No view config factory registered for type "+e.$type);var n=r(t,e);return te(n)?n:[n]},t.prototype.deactivateViewConfig=function(t){Be.traceViewServiceEvent("<- Removing",t),me(this._viewConfigs,t)},t.prototype.activateViewConfig=function(t){Be.traceViewServiceEvent("-> Registering",t),this._viewConfigs.push(t)},t.prototype.sync=function(){function e(t){for(var e=t.viewDecl.$context,r=0;++r&&e.parent;)e=e.parent;return r}var n=this,i=this._uiViews.map(function(t){return[t.fqn,t]}).reduce(T,{}),o=r(function(t,e,r,n){return e*(t(r)-t(n))}),a=this._uiViews.sort(o(function(t){var e=function(t){return t&&t.parent?e(t.parent)+1:1};return 1e4*t.fqn.split(".").length+e(t.creationContext)},1)).map(function(r){var a=n._viewConfigs.filter(t.matches(i,r));return a.length>1&&a.sort(o(e,-1)),{uiView:r,viewConfig:a[0]}}),u=a.map(function(t){return t.viewConfig}),s=this._viewConfigs.filter(function(t){return!ve(u,t)}).map(function(t){return{uiView:void 0,viewConfig:t}});a.forEach(function(t){-1!==n._uiViews.indexOf(t.uiView)&&t.uiView.configUpdated(t.viewConfig)});var c=a.concat(s);this._listeners.forEach(function(t){return t(c)}),Be.traceViewSync(c)},t.prototype.registerUIView=function(t){Be.traceViewServiceUIViewEvent("-> Registering",t);var e=this._uiViews;return e.filter(function(e){return e.fqn===t.fqn&&e.$type===t.$type}).length&&Be.traceViewServiceUIViewEvent("!!!! duplicate uiView named:",t),e.push(t),this.sync(),function(){-1!==e.indexOf(t)?(Be.traceViewServiceUIViewEvent("<- Deregistering",t),me(e)(t)):Be.traceViewServiceUIViewEvent("Tried removing non-registered uiView",t)}},t.prototype.available=function(){return this._uiViews.map(Vt("fqn"))},t.prototype.active=function(){return this._uiViews.filter(Vt("$config")).map(Vt("name"))},t.matches=function(t,e){return function(r){if(e.$type!==r.viewDecl.$type)return!1;var n=r.viewDecl,i=n.$uiViewName.split("."),o=e.fqn.split(".");if(!pe(i,o.slice(0-i.length)))return!1;var a=1-i.length||void 0,u=o.slice(0,a).join("."),s=t[u].creationContext;return n.$uiViewContextAnchor===(s&&s.name)}},t}(),Gr=function(){function t(){this.params=new Rr,this.lastStartedTransitionId=-1,this.transitionHistory=new je([],1),this.successfulTransitions=new je([],1)}return t.prototype.dispose=function(){this.transitionHistory.clear(),this.successfulTransitions.clear(),this.transition=null},t}(),Wr=function(t){return t.reduce(function(t,e){return t[e]=oe(e),t},{dispose:l})},zr=["url","path","search","hash","onChange"],Jr=["port","protocol","host","baseHref","html5Mode","hashPrefix"],Qr=["type","caseInsensitive","strictMode","defaultSquashPolicy"],Kr=["sort","when","initial","otherwise","rules","rule","removeRule"],Yr=["deferIntercept","listen","sync","match"],Zr=function(){function t(t,e){void 0===e&&(e=!0),this.router=t,this.rules={},this.config={};var r=function(){return t.locationService};h(r,this,r,zr,e);var n=function(){return t.locationConfig};h(n,this.config,n,Jr,e);var i=function(){return t.urlMatcherFactory};h(i,this.config,i,Qr);var o=function(){return t.urlRouter};h(o,this.rules,o,Kr),h(o,this,o,Yr)}return t.prototype.url=function(t,e,r){},t.prototype.path=function(){},t.prototype.search=function(){},t.prototype.hash=function(){},t.prototype.onChange=function(t){},t.prototype.parts=function(){return{path:this.path(),search:this.search(),hash:this.hash()}},t.prototype.dispose=function(){},t.prototype.sync=function(t){},t.prototype.listen=function(t){},t.prototype.deferIntercept=function(t){},t.prototype.match=function(t){},t.locationServiceStub=Wr(zr),t.locationConfigStub=Wr(Jr),t}(),Xr=0,tn=function(){function t(t,e){void 0===t&&(t=Zr.locationServiceStub),void 0===e&&(e=Zr.locationConfigStub),this.locationService=t,this.locationConfig=e,this.$id=Xr++,this._disposed=!1,this._disposables=[],this.trace=Be,this.viewService=new Br,this.transitionService=new xn(this),this.globals=new Gr,this.urlMatcherFactory=new Hr,this.urlRouter=new Mr(this),this.stateRegistry=new Ir(this),this.stateService=new In(this),this.urlService=new Zr(this),this._plugins={},this.viewService._pluginapi._rootViewContext(this.stateRegistry.root()),this.globals.$current=this.stateRegistry.root(),this.globals.current=this.globals.$current.self,this.disposable(this.globals),this.disposable(this.stateService),this.disposable(this.stateRegistry),this.disposable(this.transitionService),this.disposable(this.urlRouter),this.disposable(t),this.disposable(e)}return t.prototype.disposable=function(t){this._disposables.push(t)},t.prototype.dispose=function(t){var e=this;t&&Kt(t.dispose)?t.dispose(this):(this._disposed=!0,this._disposables.slice().forEach(function(t){try{"function"==typeof t.dispose&&t.dispose(e),me(e._disposables,t)}catch(t){}}))},t.prototype.plugin=function(t,e){void 0===e&&(e={});var r=new t(this,e);if(!r.name)throw new Error("Required property `name` missing on plugin: "+r);return this._disposables.push(r),this._plugins[r.name]=r},t.prototype.getPlugin=function(t){return t?this._plugins[t]:$e(this._plugins)},t}(),en=function(t){return t.onCreate({},at)},rn=function(t){function e(e){if(e)return e instanceof Ge?e:Zt(e)?n.target(e,t.params(),t.options()):e.state||e.params?n.target(e.state||t.to(),e.params||t.params(),t.options()):void 0}var r=t.to().redirectTo;if(r){var n=t.router.stateService;return Kt(r)?ae.$q.when(r(t)).then(e):e(r)}},nn=function(t){return t.onStart({to:function(t){return!!t.redirectTo}},rn)},on=ut("onExit"),an=function(t){return t.onExit({exiting:function(t){return!!t.onExit}},on)},un=ut("onRetain"),sn=function(t){return t.onRetain({retained:function(t){return!!t.onRetain}},un)},cn=ut("onEnter"),fn=function(t){return t.onEnter({entering:function(t){return!!t.onEnter}},cn)},ln=function(t){return new cr(t.treeChanges().to).resolvePath("EAGER",t).then(l)},hn=function(t){return t.onStart({},ln,{priority:1e3})},pn=function(t,e){return new cr(t.treeChanges().to).subContext(e.$$state()).resolvePath("LAZY",t).then(l)},dn=function(t){return t.onEnter({entering:Ut(!0)},pn,{priority:1e3})},vn=function(t){return new cr(t.treeChanges().to).resolvePath("LAZY",t).then(l)},mn=function(t){return t.onFinish({},vn,{priority:1e3})},yn=function(t){var e=ae.$q,r=t.views("entering");if(r.length)return e.all(r.map(function(t){return e.when(t.load())})).then(l)},gn=function(t){return t.onFinish({},yn)},_n=function(t){var e=t.views("entering"),r=t.views("exiting");if(e.length||r.length){var n=t.router.viewService;r.forEach(function(t){return n.deactivateViewConfig(t)}),e.forEach(function(t){return n.activateViewConfig(t)}),n.sync()}},wn=function(t){return t.onSuccess({},_n)},$n=function(t){var e=t.router.globals,r=function(){e.transition===t&&(e.transition=null)};t.onSuccess({},function(){e.successfulTransitions.enqueue(t),e.$current=t.$to(),e.current=e.$current.self,k(t.params(),e.params)},{priority:1e4}),t.promise.then(r,r)},Sn=function(t){return t.onCreate({},$n)},bn=function(t){var e=t.options(),r=t.router.stateService,n=t.router.urlRouter;if("url"!==e.source&&e.location&&r.$current.navigable){var i={replace:"replace"===e.location};n.push(r.$current.navigable.url,r.params,i)}n.update(!0)},Rn=function(t){return t.onSuccess({},bn,{priority:9999})},En=function(t){var e=t.router,r=t.entering().filter(function(t){return!!t.$$state().lazyLoad}).map(function(e){return st(t,e)});return ae.$q.all(r).then(function(){if("url"!==t.originalTransition().options().source){var r=t.targetState();return e.stateService.target(r.identifier(),r.params(),r.options())}var n=e.urlService,i=n.match(n.parts()),o=i&&i.rule;if(o&&"STATE"===o.type){var a=o.state,u=i.match;return e.stateService.target(a,u,t.options())}e.urlService.sync()})},Cn=function(t){return t.onBefore({entering:function(t){return!!t.lazyLoad}},En)},Tn=function(){return function(t,e,r,n,i,o,a,u){void 0===i&&(i=!1),void 0===o&&(o=ze.HANDLE_RESULT),void 0===a&&(a=ze.REJECT_ERROR),void 0===u&&(u=!1),this.name=t,this.hookPhase=e,this.hookOrder=r,this.criteriaMatchPath=n,this.reverseSort=i,this.getResultHandler=o,this.getErrorHandler=a,this.synchronous=u}}(),Pn=function(t){return t.onBefore({},ct,{priority:-9999})},kn=function(t){return t.onBefore({},ft,{priority:-1e4})},On={location:!0,relative:null,inherit:!1,notify:!0,reload:!1,custom:{},current:function(){return null},source:"unknown"},xn=function(){function e(t){this._transitionCount=0,this._eventTypes=[],this._registeredHooks={},this._criteriaPaths={},this._router=t,this.$view=t.viewService,this._deregisterHookFns={},this._pluginapi=h(Ut(this),{},Ut(this),["_definePathType","_defineEvent","_getPathTypes","_getEvents","getHooks"]),this._defineCorePaths(),this._defineCoreEvents(),this._registerCoreTransitionHooks()}return e.prototype.onCreate=function(t,e,r){},e.prototype.onBefore=function(t,e,r){},e.prototype.onStart=function(t,e,r){},e.prototype.onExit=function(t,e,r){},e.prototype.onRetain=function(t,e,r){},e.prototype.onEnter=function(t,e,r){},e.prototype.onFinish=function(t,e,r){},e.prototype.onSuccess=function(t,e,r){},e.prototype.onError=function(t,e,r){},e.prototype.dispose=function(t){$e(this._registeredHooks).forEach(function(t){return t.forEach(function(e){e._deregistered=!0,me(t,e)})})},e.prototype.create=function(t,e){return new hr(t,e,this._router)},e.prototype._defineCoreEvents=function(){var e=t.TransitionHookPhase,r=ze,n=this._criteriaPaths;this._defineEvent("onCreate",e.CREATE,0,n.to,!1,r.LOG_REJECTED_RESULT,r.THROW_ERROR,!0),this._defineEvent("onBefore",e.BEFORE,0,n.to),this._defineEvent("onStart",e.RUN,0,n.to),this._defineEvent("onExit",e.RUN,100,n.exiting,!0),this._defineEvent("onRetain",e.RUN,200,n.retained),this._defineEvent("onEnter",e.RUN,300,n.entering),this._defineEvent("onFinish",e.RUN,400,n.to),this._defineEvent("onSuccess",e.SUCCESS,0,n.to,!1,r.LOG_REJECTED_RESULT,r.LOG_ERROR,!0),this._defineEvent("onError",e.ERROR,0,n.to,!1,r.LOG_REJECTED_RESULT,r.LOG_ERROR,!0)},e.prototype._defineCorePaths=function(){var e=t.TransitionHookScope.STATE,r=t.TransitionHookScope.TRANSITION;this._definePathType("to",r),this._definePathType("from",r),this._definePathType("exiting",e),this._definePathType("retained",e),this._definePathType("entering",e)},e.prototype._defineEvent=function(t,e,r,n,i,o,a,u){void 0===i&&(i=!1),void 0===o&&(o=ze.HANDLE_RESULT),void 0===a&&(a=ze.REJECT_ERROR),void 0===u&&(u=!1);var s=new Tn(t,e,r,n,i,o,a,u);this._eventTypes.push(s),H(this,this,s)},e.prototype._getEvents=function(t){return(zt(t)?this._eventTypes.filter(function(e){return e.hookPhase===t}):this._eventTypes.slice()).sort(function(t,e){var r=t.hookPhase-e.hookPhase;return 0===r?t.hookOrder-e.hookOrder:r})},e.prototype._definePathType=function(t,e){this._criteriaPaths[t]={name:t,scope:e}},e.prototype._getPathTypes=function(){return this._criteriaPaths},e.prototype.getHooks=function(t){return this._registeredHooks[t]},e.prototype._registerCoreTransitionHooks=function(){var t=this._deregisterHookFns;t.addCoreResolves=en(this),t.ignored=Pn(this),t.invalid=kn(this),t.redirectTo=nn(this),t.onExit=an(this),t.onRetain=sn(this),t.onEnter=fn(this),t.eagerResolve=hn(this),t.lazyResolve=dn(this),t.resolveAll=mn(this),t.loadViews=gn(this),t.activateViews=wn(this),t.updateGlobals=Sn(this),t.updateUrl=Rn(this),t.lazyLoad=Cn(this)},e}(),In=function(){function e(t){this.router=t,this.invalidCallbacks=[],this._defaultErrorHandler=function(t){t instanceof Error&&t.stack?(console.error(t),console.error(t.stack)):t instanceof He?(console.error(t.toString()),t.detail&&t.detail.stack&&console.error(t.detail.stack)):console.error(t)};var r=["current","$current","params","transition"],n=Object.keys(e.prototype).filter(Ht(ve(r)));h(Ut(e.prototype),this,Ut(this),n)}return Object.defineProperty(e.prototype,"transition",{get:function(){return this.router.globals.transition},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"params",{get:function(){return this.router.globals.params},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"current",{get:function(){return this.router.globals.current},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"$current",{get:function(){return this.router.globals.$current},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.defaultErrorHandler(l),this.invalidCallbacks=[]},e.prototype._handleInvalidTargetState=function(t,e){function r(){var t=s.dequeue();return void 0===t?He.invalid(e.error()).toPromise():ae.$q.when(t(e,i,c)).then(f).then(function(t){return t||r()})}var n=this,i=er.makeTargetState(this.router.stateRegistry,t),o=this.router.globals,a=function(){return o.transitionHistory.peekTail()},u=a(),s=new je(this.invalidCallbacks.slice()),c=new cr(t).injector(),f=function(t){if(t instanceof Ge){var e=t;return(e=n.target(e.identifier(),e.params(),e.options())).valid()?a()!==u?He.superseded().toPromise():n.transitionTo(e.identifier(),e.params(),e.options()):He.invalid(e.error()).toPromise()}};return r()},e.prototype.onInvalid=function(t){return this.invalidCallbacks.push(t),function(){me(this.invalidCallbacks)(t)}.bind(this)},e.prototype.reload=function(t){return this.transitionTo(this.current,this.params,{reload:!zt(t)||t,inherit:!1,notify:!1})},e.prototype.go=function(t,e,r){var n=m(r,{relative:this.$current,inherit:!0},On);return this.transitionTo(t,e,n)},e.prototype.target=function(t,e,r){if(void 0===r&&(r={}),Xt(r.reload)&&!r.reload.name)throw new Error("Invalid reload state object");var n=this.router.stateRegistry;if(r.reloadState=!0===r.reload?n.root():n.matcher.find(r.reload,r.relative),r.reload&&!r.reloadState)throw new Error("No such reload state '"+(Zt(r.reload)?r.reload:r.reload.name)+"'");return new Ge(this.router.stateRegistry,t,e,r)},e.prototype.getCurrentPath=function(){var t=this,e=this.router.globals.successfulTransitions.peekTail();return e?e.treeChanges().to:[new tr(t.router.stateRegistry.root())]},e.prototype.transitionTo=function(e,r,n){var i=this;void 0===r&&(r={}),void 0===n&&(n={});var o=this.router,a=o.globals;n=m(n,On);n=he(n,{current:function(){return a.transition}});var u=this.target(e,r,n),s=this.getCurrentPath();if(!u.exists())return this._handleInvalidTargetState(s,u);if(!u.valid())return Ve(u.error());var c=function(e){return function(r){if(r instanceof He){var n=o.globals.lastStartedTransitionId===e.$id;if(r.type===t.RejectType.IGNORED)return n&&o.urlRouter.update(),ae.$q.when(a.current);var u=r.detail;if(r.type===t.RejectType.SUPERSEDED&&r.redirected&&u instanceof Ge){var s=e.redirect(u);return s.run().catch(c(s))}if(r.type===t.RejectType.ABORTED)return n&&o.urlRouter.update(),ae.$q.reject(r)}return i.defaultErrorHandler()(r),ae.$q.reject(r)}},f=this.router.transitionService.create(s,u),l=f.run().catch(c(f));return Ie(l),he(l,{transition:f})},e.prototype.is=function(t,e,r){r=m(r,{relative:this.$current});var n=this.router.stateRegistry.matcher.find(t,r.relative);if(zt(n)){if(this.$current!==n)return!1;if(!e)return!0;var i=n.parameters({inherit:!0,matchingKeys:e});return Xe.equals(i,Xe.values(i,e),this.params)}},e.prototype.includes=function(t,e,r){r=m(r,{relative:this.$current});var n=Zt(t)&&Lt.fromString(t);if(n){if(!n.matches(this.$current.name))return!1;t=this.$current.name}var i=this.router.stateRegistry.matcher.find(t,r.relative),o=this.$current.includes;if(zt(i)){if(!zt(o[i.name]))return!1;if(!e)return!0;var a=i.parameters({inherit:!0,matchingKeys:e});return Xe.equals(a,Xe.values(a,e),this.params)}},e.prototype.href=function(t,e,r){r=m(r,{lossy:!0,inherit:!0,absolute:!1,relative:this.$current}),e=e||{};var n=this.router.stateRegistry.matcher.find(t,r.relative);if(!zt(n))return null;r.inherit&&(e=this.params.$inherit(e,this.$current,n));var i=n&&r.lossy?n.navigable:n;return i&&void 0!==i.url&&null!==i.url?this.router.urlRouter.href(i.url,e,{absolute:r.absolute}):null},e.prototype.defaultErrorHandler=function(t){return this._defaultErrorHandler=t||this._defaultErrorHandler},e.prototype.get=function(t,e){var r=this.router.stateRegistry;return 0===arguments.length?r.get():r.get(t,e||this.$current)},e.prototype.lazyLoad=function(t,e){var r=this.get(t);if(!r||!r.lazyLoad)throw new Error("Can not lazy load "+t);var n=this.getCurrentPath(),i=er.makeTargetState(this.router.stateRegistry,n);return e=e||this.router.transitionService.create(n,i),st(e,r)},e}(),Vn={when:function(t){return new Promise(function(e,r){return e(t)})},reject:function(t){return new Promise(function(e,r){r(t)})},defer:function(){var t={};return t.promise=new Promise(function(e,r){t.resolve=e,t.reject=r}),t},all:function(t){if(te(t))return Promise.all(t);if(Xt(t)){var e=Object.keys(t).map(function(e){return t[e].then(function(t){return{key:e,val:t}})});return Vn.all(e).then(function(t){return t.reduce(function(t,e){return t[e.key]=e.val,t},{})})}}},jn={},An=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,Hn=/([^\s,]+)/g,qn={get:function(t){return jn[t]},has:function(t){return null!=qn.get(t)},invoke:function(t,e,r){var n=he({},jn,r||{}),i=qn.annotate(t),o=ke(function(t){return n.hasOwnProperty(t)},function(t){return"DI can't find injectable: '"+t+"'"}),a=i.filter(o).map(function(t){return n[t]});return Kt(t)?t.apply(e,a):t.slice(-1)[0].apply(e,a)},annotate:function(t){if(!c(t))throw new Error("Not an injectable function: "+t);if(t&&t.$inject)return t.$inject;if(te(t))return t.slice(0,-1);var e=t.toString().replace(An,"");return e.slice(e.indexOf("(")+1,e.indexOf(")")).match(Hn)||[]}},Dn=function(t,e){var r=e[0],n=e[1];return t.hasOwnProperty(r)?te(t[r])?t[r].push(n):t[r]=[t[r],n]:t[r]=n,t},Fn=function(t){return t.split("&").filter(f).map(wr).reduce(Dn,{})},Nn=function(t){var e=t.path(),r=t.search(),n=t.hash(),i=Object.keys(r).map(function(t){var e=r[t];return(te(e)?e:[e]).map(function(e){return t+"="+e})}).reduce(Re,[]).join("&");return e+(i?"?"+i:"")+(n?"#"+n:"")},Un=function(){function t(t,e){var r=this;this.fireAfterUpdate=e,this._listeners=[],this._listener=function(t){return r._listeners.forEach(function(e){return e(t)})},this.hash=function(){return lt(r._get()).hash},this.path=function(){return lt(r._get()).path},this.search=function(){return Fn(lt(r._get()).search)},this._location=ue.location,this._history=ue.history}return t.prototype.url=function(t,e){return void 0===e&&(e=!0),zt(t)&&t!==this._get()&&(this._set(null,null,t,e),this.fireAfterUpdate&&this._listeners.forEach(function(e){return e({url:t})})),Nn(this)},t.prototype.onChange=function(t){var e=this;return this._listeners.push(t),function(){return me(e._listeners,t)}},t.prototype.dispose=function(t){ge(this._listeners)},t}(),Ln=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Mn=function(t){function e(e){var r=t.call(this,e,!1)||this;return ue.addEventListener("hashchange",r._listener,!1),r}return Ln(e,t),e.prototype._get=function(){return $r(this._location.hash)},e.prototype._set=function(t,e,r,n){this._location.hash=r},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),ue.removeEventListener("hashchange",this._listener)},e}(Un),Bn=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Gn=function(t){function e(e){return t.call(this,e,!0)||this}return Bn(e,t),e.prototype._get=function(){return this._url},e.prototype._set=function(t,e,r,n){this._url=r},e}(Un),Wn=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zn=function(t){function e(e){var r=t.call(this,e,!0)||this;return r._config=e.urlService.config,ue.addEventListener("popstate",r._listener,!1),r}return Wn(e,t),e.prototype._getBasePrefix=function(){return yr(this._config.baseHref())},e.prototype._get=function(){var t=this._location,e=t.pathname,r=t.hash,n=t.search;n=_r(n)[1],r=gr(r)[1];var i=this._getBasePrefix(),o=e===this._config.baseHref(),a=e.substr(0,i.length)===i;return(e=o?"/":a?e.substring(i.length):e)+(n?"?"+n:"")+(r?"#"+r:"")},e.prototype._set=function(t,e,r,n){var i=this._getBasePrefix(),o=r&&"/"!==r[0]?"/":"",a=""===r||"/"===r?this._config.baseHref():i+o+r;n?this._history.replaceState(t,e,a):this._history.pushState(t,e,a)},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),ue.removeEventListener("popstate",this._listener)},e}(Un),Jn=function(){return function(){var t=this;this.dispose=l,this._baseHref="",this._port=80,this._protocol="http",this._host="localhost",this._hashPrefix="",this.port=function(){return t._port},this.protocol=function(){return t._protocol},this.host=function(){return t._host},this.baseHref=function(){return t._baseHref},this.html5Mode=function(){return!1},this.hashPrefix=function(e){return zt(e)?t._hashPrefix=e:t._hashPrefix}}}(),Qn=function(){function t(t,e){void 0===e&&(e=!1),this._isHtml5=e,this._baseHref=void 0,this._hashPrefix=""}return t.prototype.port=function(){return location.port?Number(location.port):"https"===this.protocol()?443:80},t.prototype.protocol=function(){return location.protocol.replace(/:/g,"")},t.prototype.host=function(){return location.hostname},t.prototype.html5Mode=function(){return this._isHtml5},t.prototype.hashPrefix=function(t){return zt(t)?this._hashPrefix=t:this._hashPrefix},t.prototype.baseHref=function(t){return zt(t)?this._baseHref=t:zt(this._baseHref)?this._baseHref:this.applyDocumentBaseHref()},t.prototype.applyDocumentBaseHref=function(){var t=document.getElementsByTagName("base")[0];return this._baseHref=t?t.href.substr(location.origin.length):location.pathname||"/"},t.prototype.dispose=function(){},t}(),Kn=ht("vanilla.hashBangLocation",!1,Mn,Qn),Yn=ht("vanilla.pushStateLocation",!0,zn,Qn),Zn=ht("vanilla.memoryLocation",!1,Gn,Jn),Xn=function(){function t(){}return t.prototype.dispose=function(t){},t}(),ti=Object.freeze({root:ue,fromJson:ce,toJson:fe,forEach:le,extend:he,equals:pe,identity:f,noop:l,createProxyFunctions:h,inherit:de,inArray:ve,_inArray:p,removeFrom:me,_removeFrom:d,pushTo:ye,_pushTo:v,deregAll:ge,defaults:m,mergeR:_e,ancestors:y,pick:g,omit:_,pluck:w,filter:$,find:S,mapObj:we,map:b,values:$e,allTrueR:Se,anyTrueR:be,unnestR:Re,flattenR:Ee,pushR:R,uniqR:Ce,unnest:Te,flatten:Pe,assertPredicate:ke,assertMap:Oe,assertFn:E,pairs:xe,arrayTuples:C,applyPairs:T,tail:P,copy:k,_extend:O,silenceUncaughtInPromise:Ie,silentRejection:Ve,notImplemented:oe,services:ae,Glob:Lt,curry:r,compose:n,pipe:i,prop:Vt,propEq:jt,parse:At,not:Ht,and:o,or:a,all:qt,any:Dt,is:Ft,eq:Nt,val:Ut,invoke:u,pattern:s,isUndefined:Wt,isDefined:zt,isNull:Jt,isNullOrUndefined:Qt,isFunction:Kt,isNumber:Yt,isString:Zt,isObject:Xt,isArray:te,isDate:ee,isRegExp:re,isState:ne,isInjectable:c,isPromise:ie,Queue:je,maxLength:M,padString:B,kebobString:G,functionToString:W,fnToString:z,stringify:J,beforeAfterSubstr:vr,hostRegex:mr,stripLastPathElement:yr,splitHash:gr,splitQuery:_r,splitEqual:wr,trimHashVal:$r,splitOnDelim:Q,joinNeighborsR:K,get Category(){return t.Category},Trace:Me,trace:Be,get DefType(){return t.DefType},Param:Xe,ParamTypes:Sr,StateParams:Rr,ParamType:Ke,PathNode:tr,PathUtils:er,resolvePolicies:ir,defaultResolvePolicy:rr,Resolvable:nr,NATIVE_INJECTOR_TOKEN:sr,ResolveContext:cr,resolvablesBuilder:rt,StateBuilder:kr,StateObject:Mt,StateMatcher:Or,StateQueueManager:xr,StateRegistry:Ir,StateService:In,TargetState:Ge,get TransitionHookPhase(){return t.TransitionHookPhase},get TransitionHookScope(){return t.TransitionHookScope},HookBuilder:Qe,matchState:A,RegisteredHook:Je,makeEvent:H,get RejectType(){return t.RejectType},Rejection:He,Transition:hr,TransitionHook:ze,TransitionEventType:Tn,defaultTransOpts:On,TransitionService:xn,UrlMatcher:Ar,UrlMatcherFactory:Hr,UrlRouter:Mr,UrlRuleFactory:qr,BaseUrlRule:Dr,UrlService:Zr,ViewService:Br,UIRouterGlobals:Gr,UIRouter:tn,$q:Vn,$injector:qn,BaseLocationServices:Un,HashLocationService:Mn,MemoryLocationService:Gn,PushStateLocationService:zn,MemoryLocationConfig:Jn,BrowserLocationConfig:Qn,keyValsToObjectR:Dn,getParams:Fn,parseUrl:lt,buildUrl:Nn,locationPluginFactory:ht,servicesPlugin:pt,hashLocationPlugin:Kn,pushStateLocationPlugin:Yn,memoryLocationPlugin:Zn,UIRouterPluginBase:Xn}),ei=function(t,e){return t.reduce(function(t,r){return t||zt(e[r])},!1)},ri=0,ni=function(){function t(t,e,r){var n=this;this.path=t,this.viewDecl=e,this.factory=r,this.$id=ri++,this.loaded=!1,this.getTemplate=function(t,e){return n.component?n.factory.makeComponentTemplate(t,e,n.component,n.viewDecl.bindings):n.template}}return t.prototype.load=function(){var t=this,e=ae.$q,r=new cr(this.path),n=this.path.reduce(function(t,e){return he(t,e.paramValues)},{}),i={template:e.when(this.factory.fromConfig(this.viewDecl,n,r)),controller:e.when(this.getController(r))};return e.all(i).then(function(e){return Be.traceViewServiceEvent("Loaded",t),t.controller=e.controller,he(t,e.template),t})},t.prototype.getController=function(t){var e=this.viewDecl.controllerProvider;if(!c(e))return this.viewDecl.controller;var r=ae.$injector.annotate(e),n=te(e)?P(e):e;return new nr("",n,r).get(t)},t}(),ii=function(){function t(){var t=this;this._useHttp=It.version.minor<3,this.$get=["$http","$templateCache","$injector",function(e,r,n){return t.$templateRequest=n.has&&n.has("$templateRequest")&&n.get("$templateRequest"),t.$http=e,t.$templateCache=r,t}]}return t.prototype.useHttpService=function(t){this._useHttp=t},t.prototype.fromConfig=function(t,e,r){var n=function(t){return ae.$q.when(t).then(function(t){return{template:t}})},i=function(t){return ae.$q.when(t).then(function(t){return{component:t}})};return zt(t.template)?n(this.fromString(t.template,e)):zt(t.templateUrl)?n(this.fromUrl(t.templateUrl,e)):zt(t.templateProvider)?n(this.fromProvider(t.templateProvider,e,r)):zt(t.component)?i(t.component):zt(t.componentProvider)?i(this.fromComponentProvider(t.componentProvider,e,r)):n("")},t.prototype.fromString=function(t,e){return Kt(t)?t(e):t},t.prototype.fromUrl=function(t,e){return Kt(t)&&(t=t(e)),null==t?null:this._useHttp?this.$http.get(t,{cache:this.$templateCache,headers:{Accept:"text/html"}}).then(function(t){return t.data}):this.$templateRequest(t)},t.prototype.fromProvider=function(t,e,r){var n=ae.$injector.annotate(t),i=te(t)?P(t):t;return new nr("",i,n).get(r)},t.prototype.fromComponentProvider=function(t,e,r){var n=ae.$injector.annotate(t),i=te(t)?P(t):t;return new nr("",i,n).get(r)},t.prototype.makeComponentTemplate=function(t,e,r,n){n=n||{};var i=It.version.minor>=3?"::":"",o=function(t){var e=G(t);return/^(x|data)-/.exec(e)?"x-"+e:e},a=mt(r).map(function(r){var a=r.name,u=r.type,s=o(a);if(t.attr(s)&&!n[a])return s+"='"+t.attr(s)+"'";var c=n[a]||a;if("@"===u)return s+"='{{"+i+"$resolve."+c+"}}'";if("&"===u){var f=e.getResolvable(c),l=f&&f.data,h=l&&ae.$injector.annotate(l)||[];return s+"='$resolve."+c+(te(l)?"["+(l.length-1)+"]":"")+"("+h.join(",")+")'"}return s+"='"+i+"$resolve."+c+"'"}).join(" "),u=o(r);return"<"+u+" "+a+">"},t}(),oi=function(t){return ai(Xt(t.bindToController)?t.bindToController:t.scope)},ai=function(t){return Object.keys(t||{}).map(function(e){return[e,/^([=<@&])[?]?(.*)/.exec(t[e])]}).filter(function(t){return zt(t)&&te(t[1])}).map(function(t){return{name:t[1][2]||t[0],type:t[1][1]}})},ui=function(){function t(e,r){this.stateRegistry=e,this.stateService=r,h(Ut(t.prototype),this,Ut(this))}return t.prototype.decorator=function(t,e){return this.stateRegistry.decorator(t,e)||this},t.prototype.state=function(t,e){return Xt(t)?e=t:e.name=t,this.stateRegistry.register(e),this},t.prototype.onInvalid=function(t){return this.stateService.onInvalid(t)},t}(),si=function(t){return function(e,r){var n=e[t],i="onExit"===t?"from":"to";return n?function(t,e){var r=new cr(t.treeChanges(i)).subContext(e.$$state()),o=he(_i(r),{$state$:e,$transition$:t});return ae.$injector.invoke(n,this,o)}:void 0}},ci=function(){function t(t){this._urlListeners=[],this.$locationProvider=t;var e=Ut(t);h(e,this,e,["hashPrefix"])}return t.monkeyPatchPathParameterType=function(t){var e=t.urlMatcherFactory.type("path");e.encode=function(t){return null!=t?t.toString().replace(/(~|\/)/g,function(t){return{"~":"~~","/":"~2F"}[t]}):t},e.decode=function(t){return null!=t?t.toString().replace(/(~~|~2F)/g,function(t){return{"~~":"~","~2F":"/"}[t]}):t}},t.prototype.dispose=function(){},t.prototype.onChange=function(t){var e=this;return this._urlListeners.push(t),function(){return me(e._urlListeners)(t)}},t.prototype.html5Mode=function(){var t=this.$locationProvider.html5Mode();return(t=Xt(t)?t.enabled:t)&&this.$sniffer.history},t.prototype.url=function(t,e,r){return void 0===e&&(e=!1),zt(t)&&this.$location.url(t),e&&this.$location.replace(),r&&this.$location.state(r),this.$location.url()},t.prototype._runtimeServices=function(t,e,r,n){var i=this;this.$location=e,this.$sniffer=r,t.$on("$locationChangeSuccess",function(t){return i._urlListeners.forEach(function(e){return e(t)})});var o=Ut(e),a=Ut(n);h(o,this,o,["replace","path","search","hash"]),h(o,this,o,["port","protocol","host"]),h(a,this,a,["baseHref"])},t}(),fi=function(){function t(t){this._router=t,this._urlRouter=t.urlRouter}return t.injectableHandler=function(t,e){return function(r){return ae.$injector.invoke(e,null,{$match:r,$stateParams:t.globals.params})}},t.prototype.$get=function(){var t=this._urlRouter;return t.update(!0),t.interceptDeferred||t.listen(),t},t.prototype.rule=function(t){var e=this;if(!Kt(t))throw new Error("'rule' must be a function");var r=new Dr(function(){return t(ae.$injector,e._router.locationService)},f);return this._urlRouter.rule(r),this},t.prototype.otherwise=function(t){var e=this,r=this._urlRouter;if(Zt(t))r.otherwise(t);else{if(!Kt(t))throw new Error("'rule' must be a string or function");r.otherwise(function(){return t(ae.$injector,e._router.locationService)})}return this},t.prototype.when=function(e,r){return(te(r)||Kt(r))&&(r=t.injectableHandler(this._router,r)),this._urlRouter.when(e,r),this},t.prototype.deferIntercept=function(t){this._urlRouter.deferIntercept(t)},t}();It.module("ui.router.angular1",[]);var li=It.module("ui.router.init",[]),hi=It.module("ui.router.util",["ng","ui.router.init"]),pi=It.module("ui.router.router",["ui.router.util"]),di=It.module("ui.router.state",["ui.router.router","ui.router.util","ui.router.angular1"]),vi=It.module("ui.router",["ui.router.init","ui.router.state","ui.router.angular1"]),mi=(It.module("ui.router.compat",["ui.router"]),null);yt.$inject=["$locationProvider"];var yi=function(t){return["$uiRouterProvider",function(e){var r=e.router[t];return r.$get=function(){return r},r}]};gt.$inject=["$injector","$q","$uiRouter"];_t.$inject=["$rootScope"],li.provider("$uiRouter",yt),pi.provider("$urlRouter",["$uiRouterProvider",function(t){return t.urlRouterProvider=new fi(t)}]),hi.provider("$urlService",yi("urlService")),hi.provider("$urlMatcherFactory",["$uiRouterProvider",function(){return mi.urlMatcherFactory}]),hi.provider("$templateFactory",function(){return new ii}),di.provider("$stateRegistry",yi("stateRegistry")),di.provider("$uiRouterGlobals",yi("globals")),di.provider("$transitions",yi("transitionService")),di.provider("$state",["$uiRouterProvider",function(){return he(mi.stateProvider,{$get:function(){return mi.stateService}})}]),di.factory("$stateParams",["$uiRouter",function(t){return t.globals.params}]),vi.factory("$view",function(){return mi.viewService}),vi.service("$trace",function(){return Be}),vi.run(_t),hi.run(["$urlMatcherFactory",function(t){}]),di.run(["$state",function(t){}]),pi.run(["$urlRouter",function(t){}]),li.run(gt);var gi,_i=function(t){return t.getTokens().filter(Zt).map(function(e){var r=t.getResolvable(e);return[e,"NOWAIT"===t.getPolicy(r).async?r.promise:r.data]}).reduce(T,{})};gi=["$uiRouter","$timeout",function(t,e){var r=t.stateService;return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(n,i,o,a){function u(){var t=p();l&&l(),f&&(l=f.$$addStateInfo(t.uiState,t.uiStateParams)),null!=t.href&&o.$set(c.attr,t.href)}var s,c=bt(i),f=a[1]||a[0],l=null,h={},p=function(){return St(r,i,h)},d=wt(o.uiSref);h.uiState=d.state,h.uiStateOpts=o.uiSrefOpts?n.$eval(o.uiSrefOpts):{},d.paramExpr&&(n.$watch(d.paramExpr,function(t){h.uiStateParams=he({},t),u()},!0),h.uiStateParams=he({},n.$eval(d.paramExpr))),u(),n.$on("$destroy",t.stateRegistry.onStatesChanged(u)),n.$on("$destroy",t.transitionService.onSuccess({},u)),c.clickable&&(s=Rt(i,r,e,c,p),Ct(i,n,s,h.uiStateOpts))}}}];var wi;wi=["$uiRouter","$timeout",function(t,e){var r=t.stateService;return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(n,i,o,a){function u(){var t=d();h&&h(),f&&(h=f.$$addStateInfo(t.uiState,t.uiStateParams)),null!=t.href&&o.$set(c.attr,t.href)}var s,c=bt(i),f=a[1]||a[0],h=null,p={},d=function(){return St(r,i,p)},v=["uiState","uiStateParams","uiStateOpts"],m=v.reduce(function(t,e){return t[e]=l,t},{});v.forEach(function(t){p[t]=o[t]?n.$eval(o[t]):null,o.$observe(t,function(e){m[t](),m[t]=n.$watch(e,function(e){p[t]=e,u()},!0)})}),u(),n.$on("$destroy",t.stateRegistry.onStatesChanged(u)),n.$on("$destroy",t.transitionService.onSuccess({},u)),c.clickable&&(s=Rt(i,r,e,c,d),Ct(i,n,s,p.uiStateOpts))}}}];var $i;$i=["$state","$stateParams","$interpolate","$uiRouter",function(t,e,r,n){return{restrict:"A",controller:["$scope","$element","$attrs",function(e,i,o){function a(t){t.promise.then(s,l)}function u(e,r,n){var o={state:t.get(e,$t(i))||{name:e},params:r,activeClass:n};return p.push(o),function(){me(p)(o)}}function s(){var r=function(t){return t.split(/\s/).filter(f)},n=function(t){return t.map(function(t){return t.activeClass}).map(r).reduce(Re,[])},o=n(p).concat(r(c)).reduce(Ce,[]),a=n(p.filter(function(e){return t.includes(e.state.name,e.params)})),u=!!p.filter(function(e){return t.is(e.state.name,e.params)}).length?r(c):[],s=a.concat(u).reduce(Ce,[]),l=o.filter(function(t){return!ve(s,t)});e.$evalAsync(function(){s.forEach(function(t){return i.addClass(t)}),l.forEach(function(t){return i.removeClass(t)})})}var c,h,p=[];c=r(o.uiSrefActiveEq||"",!1)(e);try{h=e.$eval(o.uiSrefActive)}catch(t){}h=h||r(o.uiSrefActive||"",!1)(e),Xt(h)&&le(h,function(t,r){if(Zt(t)){var n=wt(t);u(n.state,e.$eval(n.paramExpr),r)}}),this.$$addStateInfo=function(t,e){if(!(Xt(h)&&p.length>0)){var r=u(t,e,h);return s(),r}},e.$on("$stateChangeSuccess",s),e.$on("$destroy",n.transitionService.onStart({},a)),n.globals.transition&&a(n.globals.transition),s()}]}}],It.module("ui.router.state").directive("uiSref",gi).directive("uiSrefActive",$i).directive("uiSrefActiveEq",$i).directive("uiState",wi),Tt.$inject=["$state"],Pt.$inject=["$state"],It.module("ui.router.state").filter("isState",Tt).filter("includedByState",Pt);var Si;Si=["$view","$animate","$uiViewScroll","$interpolate","$q",function(t,e,r,n,i){function o(t,r){return{enter:function(t,r,n){It.version.minor>2?e.enter(t,null,r).then(n):e.enter(t,null,r,n)},leave:function(t,r){It.version.minor>2?e.leave(t).then(r):e.leave(t,r)}}}function a(t,e){return t===e}var u={$cfg:{viewDecl:{$context:t._pluginapi._rootViewContext()}},$uiView:{}},s={count:0,restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(e,c,f){return function(e,c,l){function h(){if(d&&(Be.traceUIViewEvent("Removing (previous) el",d.data("$uiView")),d.remove(),d=null),m&&(Be.traceUIViewEvent("Destroying scope",R),m.$destroy(),m=null),v){var t=v.data("$uiViewAnim");Be.traceUIViewEvent("Animate out",t),$.leave(v,function(){t.$$animLeave.resolve(),d=null}),d=v,v=null}}function p(t){var n=e.$new(),o=i.defer(),a=i.defer(),u={$cfg:t,$uiView:R},s={$animEnter:o.promise,$animLeave:a.promise,$$animLeave:a};n.$emit("$viewContentLoading",b);var l=f(n,function(t){t.data("$uiViewAnim",s),t.data("$uiView",u),$.enter(t,c,function(){o.resolve(),m&&m.$emit("$viewContentAnimationEnded"),(zt(w)&&!w||e.$eval(w))&&r(t)}),h()});v=l,(m=n).$emit("$viewContentLoaded",t||y),m.$eval(_)}var d,v,m,y,g,_=l.onload||"",w=l.autoscroll,$=o(),S=c.inheritedData("$uiView")||u,b=n(l.uiView||l.name||"")(e)||"$default",R={$type:"ng1",id:s.count++,name:b,fqn:S.$uiView.fqn?S.$uiView.fqn+"."+b:b,config:null,configUpdated:function(t){(!t||t instanceof ni)&&(a(y,t)||(Be.traceUIViewConfigUpdated(R,t&&t.viewDecl&&t.viewDecl.$context),y=t,p(t)))},get creationContext(){var t=At("$cfg.viewDecl.$context")(S),e=At("$uiView.creationContext")(S);return t||e}};Be.traceUIViewEvent("Linking",R),c.data("$uiView",{$uiView:R}),p(),g=t.registerUIView(R),e.$on("$destroy",function(){Be.traceUIViewEvent("Destroying/Unregistering",R),g()})}}};return s}],kt.$inject=["$compile","$controller","$transitions","$view","$q","$timeout"];var bi="function"==typeof It.module("ui.router").component,Ri=0;It.module("ui.router.state").directive("uiView",Si),It.module("ui.router.state").directive("uiView",kt),It.module("ui.router.state").provider("$uiViewScroll",function(){var t=!1;this.useAnchorScroll=function(){t=!0},this.$get=["$anchorScroll","$timeout",function(e,r){return t?e:function(t){return r(function(){t[0].scrollIntoView()},0,!1)}}]});t.default="ui.router",t.core=ti,t.watchDigests=_t,t.getLocals=_i,t.getNg1ViewConfigFactory=dt,t.ng1ViewsBuilder=vt,t.Ng1ViewConfig=ni,t.StateProvider=ui,t.UrlRouterProvider=fi,t.root=ue,t.fromJson=ce,t.toJson=fe,t.forEach=le,t.extend=he,t.equals=pe,t.identity=f,t.noop=l,t.createProxyFunctions=h,t.inherit=de,t.inArray=ve,t._inArray=p,t.removeFrom=me,t._removeFrom=d,t.pushTo=ye,t._pushTo=v,t.deregAll=ge,t.defaults=m,t.mergeR=_e,t.ancestors=y,t.pick=g,t.omit=_,t.pluck=w,t.filter=$,t.find=S,t.mapObj=we,t.map=b,t.values=$e,t.allTrueR=Se,t.anyTrueR=be,t.unnestR=Re,t.flattenR=Ee,t.pushR=R,t.uniqR=Ce,t.unnest=Te,t.flatten=Pe,t.assertPredicate=ke,t.assertMap=Oe,t.assertFn=E,t.pairs=xe,t.arrayTuples=C,t.applyPairs=T,t.tail=P,t.copy=k,t._extend=O,t.silenceUncaughtInPromise=Ie,t.silentRejection=Ve,t.notImplemented=oe,t.services=ae,t.Glob=Lt,t.curry=r,t.compose=n,t.pipe=i,t.prop=Vt,t.propEq=jt,t.parse=At,t.not=Ht,t.and=o,t.or=a,t.all=qt,t.any=Dt,t.is=Ft,t.eq=Nt,t.val=Ut,t.invoke=u,t.pattern=s,t.isUndefined=Wt,t.isDefined=zt,t.isNull=Jt,t.isNullOrUndefined=Qt,t.isFunction=Kt,t.isNumber=Yt,t.isString=Zt,t.isObject=Xt,t.isArray=te,t.isDate=ee,t.isRegExp=re,t.isState=ne,t.isInjectable=c,t.isPromise=ie,t.Queue=je,t.maxLength=M,t.padString=B,t.kebobString=G,t.functionToString=W,t.fnToString=z,t.stringify=J,t.beforeAfterSubstr=vr,t.hostRegex=mr,t.stripLastPathElement=yr,t.splitHash=gr,t.splitQuery=_r,t.splitEqual=wr,t.trimHashVal=$r,t.splitOnDelim=Q,t.joinNeighborsR=K,t.Trace=Me,t.trace=Be,t.Param=Xe,t.ParamTypes=Sr,t.StateParams=Rr,t.ParamType=Ke,t.PathNode=tr,t.PathUtils=er,t.resolvePolicies=ir,t.defaultResolvePolicy=rr,t.Resolvable=nr,t.NATIVE_INJECTOR_TOKEN=sr,t.ResolveContext=cr,t.resolvablesBuilder=rt,t.StateBuilder=kr,t.StateObject=Mt,t.StateMatcher=Or,t.StateQueueManager=xr,t.StateRegistry=Ir,t.StateService=In,t.TargetState=Ge,t.HookBuilder=Qe,t.matchState=A,t.RegisteredHook=Je,t.makeEvent=H,t.Rejection=He,t.Transition=hr,t.TransitionHook=ze,t.TransitionEventType=Tn,t.defaultTransOpts=On,t.TransitionService=xn,t.UrlMatcher=Ar,t.UrlMatcherFactory=Hr,t.UrlRouter=Mr,t.UrlRuleFactory=qr,t.BaseUrlRule=Dr,t.UrlService=Zr,t.ViewService=Br,t.UIRouterGlobals=Gr,t.UIRouter=tn,t.$q=Vn,t.$injector=qn,t.BaseLocationServices=Un,t.HashLocationService=Mn,t.MemoryLocationService=Gn,t.PushStateLocationService=zn,t.MemoryLocationConfig=Jn,t.BrowserLocationConfig=Qn,t.keyValsToObjectR=Dn,t.getParams=Fn,t.parseUrl=lt,t.buildUrl=Nn,t.locationPluginFactory=ht,t.servicesPlugin=pt,t.hashLocationPlugin=Kn,t.pushStateLocationPlugin=Yn,t.memoryLocationPlugin=Zn,t.UIRouterPluginBase=Xn,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=angular-ui-router.min.js.map diff --git a/UI/WebServerResources/js/vendor/angular-ui-router.min.js.map b/UI/WebServerResources/js/vendor/angular-ui-router.min.js.map index ba0d91931..f2af414ef 100644 --- a/UI/WebServerResources/js/vendor/angular-ui-router.min.js.map +++ b/UI/WebServerResources/js/vendor/angular-ui-router.min.js.map @@ -37,7 +37,7 @@ "@uirouter/angularjs/node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/targetState.ts", "@uirouter/angularjs/node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/transitionHook.ts", "@uirouter/angularjs/node_modules/@uirouter/core/lib-esm/path/@uirouter/core/path/pathNode.ts", - "@uirouter/angularjs/node_modules/@uirouter/core/lib-esm/path/@uirouter/core/path/pathFactory.ts", + "@uirouter/angularjs/node_modules/@uirouter/core/lib-esm/path/@uirouter/core/path/pathUtils.ts", "@uirouter/angularjs/node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/resolvable.ts", "@uirouter/angularjs/node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/interface.ts", "@uirouter/angularjs/node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/resolveContext.ts", @@ -78,80 +78,80 @@ "@uirouter/angularjs/src/index.ts" ], "sourcesContent": [ - "/**\n * Higher order functions\n *\n * These utility functions are exported, but are subject to change without notice.\n *\n * @module common_hof\n */ /** */\n\nimport {Predicate} from \"./common\";\n/**\n * Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function.\n *\n * Given a function with N parameters, returns a new function that supports partial application.\n * The new function accepts anywhere from 1 to N parameters. When that function is called with M parameters,\n * where M is less than N, it returns a new function that accepts the remaining parameters. It continues to\n * accept more parameters until all N parameters have been supplied.\n *\n *\n * This contrived example uses a partially applied function as an predicate, which returns true\n * if an object is found in both arrays.\n * @example\n * ```\n * // returns true if an object is in both of the two arrays\n * function inBoth(array1, array2, object) {\n * return array1.indexOf(object) !== -1 &&\n * array2.indexOf(object) !== 1;\n * }\n * let obj1, obj2, obj3, obj4, obj5, obj6, obj7\n * let foos = [obj1, obj3]\n * let bars = [obj3, obj4, obj5]\n *\n * // A curried \"copy\" of inBoth\n * let curriedInBoth = curry(inBoth);\n * // Partially apply both the array1 and array2\n * let inFoosAndBars = curriedInBoth(foos, bars);\n *\n * // Supply the final argument; since all arguments are\n * // supplied, the original inBoth function is then called.\n * let obj1InBoth = inFoosAndBars(obj1); // false\n *\n * // Use the inFoosAndBars as a predicate.\n * // Filter, on each iteration, supplies the final argument\n * let allObjs = [ obj1, obj2, obj3, obj4, obj5, obj6, obj7 ];\n * let foundInBoth = allObjs.filter(inFoosAndBars); // [ obj3 ]\n *\n * ```\n *\n * Stolen from: http://stackoverflow.com/questions/4394747/javascript-curry-function\n *\n * @param fn\n * @returns {*|function(): (*|any)}\n */\nexport function curry(fn: Function): Function {\n let initial_args = [].slice.apply(arguments, [1]);\n let func_args_length = fn.length;\n\n function curried(args: any[]) {\n if (args.length >= func_args_length)\n return fn.apply(null, args);\n return function () {\n return curried(args.concat([].slice.apply(arguments)));\n };\n }\n return curried(initial_args);\n}\n\n\n\n/**\n * Given a varargs list of functions, returns a function that composes the argument functions, right-to-left\n * given: f(x), g(x), h(x)\n * let composed = compose(f,g,h)\n * then, composed is: f(g(h(x)))\n */\nexport function compose() {\n let args = arguments;\n let start = args.length - 1;\n return function() {\n let i = start, result = args[start].apply(this, arguments);\n while (i--) result = args[i].call(this, result);\n return result;\n };\n}\n\n/**\n * Given a varargs list of functions, returns a function that is composes the argument functions, left-to-right\n * given: f(x), g(x), h(x)\n * let piped = pipe(f,g,h);\n * then, piped is: h(g(f(x)))\n */\nexport function pipe(...funcs: Function[]): (obj: any) => any {\n return compose.apply(null, [].slice.call(arguments).reverse());\n}\n\n/**\n * Given a property name, returns a function that returns that property from an object\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = prop(\"name\");\n * getName(obj) === \"blarg\"\n */\nexport const prop = (name: string) =>\n (obj: any) => obj && obj[name];\n\n/**\n * Given a property name and a value, returns a function that returns a boolean based on whether\n * the passed object has a property that matches the value\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = propEq(\"name\", \"blarg\");\n * getName(obj) === true\n */\nexport const propEq = curry((name: string, val: any, obj: any) => obj && obj[name] === val);\n\n/**\n * Given a dotted property name, returns a function that returns a nested property from an object, or undefined\n * let obj = { id: 1, nestedObj: { foo: 1, name: \"blarg\" }, };\n * let getName = prop(\"nestedObj.name\");\n * getName(obj) === \"blarg\"\n * let propNotFound = prop(\"this.property.doesnt.exist\");\n * propNotFound(obj) === undefined\n */\nexport const parse = (name: string) =>\n pipe.apply(null, name.split(\".\").map(prop));\n\n/**\n * Given a function that returns a truthy or falsey value, returns a\n * function that returns the opposite (falsey or truthy) value given the same inputs\n */\nexport const not: (fn: Predicate) => Predicate = (fn: Predicate) =>\n (...args: any[]) => !fn.apply(null, args);\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if both functions return truthy for the given arguments\n */\nexport function and(fn1: Predicate, fn2: Predicate): Predicate {\n return (...args: any[]) => fn1.apply(null, args) && fn2.apply(null, args);\n}\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if at least one of the functions returns truthy for the given arguments\n */\nexport function or(fn1: Predicate, fn2: Predicate): Predicate {\n return (...args: any[]) => fn1.apply(null, args) || fn2.apply(null, args);\n}\n\n/**\n * Check if all the elements of an array match a predicate function\n *\n * @param fn1 a predicate function `fn1`\n * @returns a function which takes an array and returns true if `fn1` is true for all elements of the array\n */\nexport const all = (fn1: Predicate) =>\n (arr: any[]) => arr.reduce((b, x) => b && !!fn1(x), true) as boolean;\nexport const any = (fn1: Predicate) =>\n (arr: any[]) => arr.reduce((b, x) => b || !!fn1(x), false) as boolean;\n\n/** Given a class, returns a Predicate function that returns true if the object is of that class */\nexport const is = (ctor: { new(...args): T }) =>\n (obj: any): obj is T =>\n (obj != null && obj.constructor === ctor || obj instanceof ctor);\n\n/** Given a value, returns a Predicate function that returns true if another value is === equal to the original value */\nexport const eq: (comp: any) => Predicate = (val: any) => (other: any) =>\n val === other;\n\n/** Given a value, returns a function which returns the value */\nexport const val = (v: T) => () => v;\n\n\n\nexport function invoke(fnName: string): Function;\nexport function invoke(fnName: string, args: any[]): Function;\nexport function invoke(fnName: string, args?: any[]): Function {\n return (obj: any) =>\n obj[fnName].apply(obj, args);\n}\n\n/**\n * Sorta like Pattern Matching (a functional programming conditional construct)\n *\n * See http://c2.com/cgi/wiki?PatternMatching\n *\n * This is a conditional construct which allows a series of predicates and output functions\n * to be checked and then applied. Each predicate receives the input. If the predicate\n * returns truthy, then its matching output function (mapping function) is provided with\n * the input and, then the result is returned.\n *\n * Each combination (2-tuple) of predicate + output function should be placed in an array\n * of size 2: [ predicate, mapFn ]\n *\n * These 2-tuples should be put in an outer array.\n *\n * @example\n * ```\n *\n * // Here's a 2-tuple where the first element is the isString predicate\n * // and the second element is a function that returns a description of the input\n * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];\n *\n * // Second tuple: predicate \"isNumber\", mapfn returns a description\n * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];\n *\n * let third = [ (input) => input === null, (input) => `Oh, null...` ];\n *\n * let fourth = [ (input) => input === undefined, (input) => `notdefined` ];\n *\n * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);\n *\n * console.log(descriptionOf(undefined)); // 'notdefined'\n * console.log(descriptionOf(55)); // '(55) That's a number!'\n * console.log(descriptionOf(\"foo\")); // 'Here's your string foo'\n * ```\n *\n * @param struct A 2D array. Each element of the array should be an array, a 2-tuple,\n * with a Predicate and a mapping/output function\n * @returns {function(any): *}\n */\nexport function pattern(struct: Function[][]): Function {\n return function(x: any) {\n for (var i = 0; i < struct.length; i++) {\n if (struct[i][0](x)) return struct[i][1](x);\n }\n };\n}\n\n", - "/** Predicates\n *\n * These predicates return true/false based on the input.\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_predicates\n */\n/** */\nimport { and, not, pipe, prop, or } from \"./hof\";\nimport { Predicate } from \"./common\"; // has or is using\nimport { StateObject } from \"../state/stateObject\";\n\nconst toStr = Object.prototype.toString;\nconst tis = (t: string) => (x: any) => typeof(x) === t;\nexport const isUndefined = tis('undefined');\nexport const isDefined = not(isUndefined);\nexport const isNull = (o: any) => o === null;\nexport const isNullOrUndefined = or(isNull, isUndefined);\nexport const isFunction: (x: any) => x is Function = tis('function');\nexport const isNumber: (x: any) => x is number = tis('number');\nexport const isString = <(x: any) => x is string> tis('string');\nexport const isObject = (x: any) => x !== null && typeof x === 'object';\nexport const isArray = Array.isArray;\nexport const isDate: (x: any) => x is Date = ((x: any) => toStr.call(x) === '[object Date]');\nexport const isRegExp: (x: any) => x is RegExp = ((x: any) => toStr.call(x) === '[object RegExp]');\nexport const isState: (x: any) => x is StateObject = StateObject.isState;\n\n/**\n * Predicate which checks if a value is injectable\n *\n * A value is \"injectable\" if it is a function, or if it is an ng1 array-notation-style array\n * where all the elements in the array are Strings, except the last one, which is a Function\n */\nexport function isInjectable(val: any) {\n if (isArray(val) && val.length) {\n let head = val.slice(0, -1), tail = val.slice(-1);\n return !(head.filter(not(isString)).length || tail.filter(not(isFunction)).length);\n }\n return isFunction(val);\n}\n\n/**\n * Predicate which checks if a value looks like a Promise\n *\n * It is probably a Promise if it's an object, and it has a `then` property which is a Function\n */\nexport const isPromise = <(x: any) => x is Promise> and(isObject, pipe(prop('then'), isFunction));\n\n", - "/**\n * Random utility functions used in the UI-Router code\n *\n * These functions are exported, but are subject to change without notice.\n *\n * @preferred\n * @module common\n */\n/** for typedoc */\nimport { isFunction, isString, isArray, isRegExp, isDate } from \"./predicates\";\nimport { all, any, prop, curry, not } from \"./hof\";\nimport { services } from \"./coreservices\";\nimport { StateObject } from \"../state/stateObject\";\n\ndeclare const global;\nexport const root: any = (typeof self === 'object' && self.self === self && self) ||\n (typeof global === 'object' && global.global === global && global) || this;\nconst angular = root.angular || {};\n\nexport const fromJson = angular.fromJson || JSON.parse.bind(JSON);\nexport const toJson = angular.toJson || JSON.stringify.bind(JSON);\nexport const forEach = angular.forEach || _forEach;\nexport const extend = Object.assign || _extend;\nexport const equals = angular.equals || _equals;\nexport function identity(x: any) { return x; }\nexport function noop(): any {}\n\nexport type Mapper = (x: X, key?: (string|number)) => T;\nexport interface TypedMap { [key: string]: T; }\nexport type Predicate = (x?: X) => boolean;\n/**\n * An ng1-style injectable\n *\n * This could be a (non-minified) function such as:\n * ```js\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an explicitly annotated function (minify safe)\n * ```js\n * injectableFunction.$inject = [ 'SomeDependency' ];\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an array style annotated function (minify safe)\n * ```js\n * ['SomeDependency', function injectableFunction(SomeDependency) {\n *\n * }];\n * ```\n *\n * @publicapi\n */\nexport type IInjectable = (Function|any[]);\n\nexport interface Obj extends Object {\n [key: string]: any;\n}\n\n/**\n * Builds proxy functions on the `to` object which pass through to the `from` object.\n *\n * For each key in `fnNames`, creates a proxy function on the `to` object.\n * The proxy function calls the real function on the `from` object.\n *\n *\n * #### Example:\n * This example creates an new class instance whose functions are prebound to the new'd object.\n * ```js\n * class Foo {\n * constructor(data) {\n * // Binds all functions from Foo.prototype to 'this',\n * // then copies them to 'this'\n * bindFunctions(Foo.prototype, this, this);\n * this.data = data;\n * }\n *\n * log() {\n * console.log(this.data);\n * }\n * }\n *\n * let myFoo = new Foo([1,2,3]);\n * var logit = myFoo.log;\n * logit(); // logs [1, 2, 3] from the myFoo 'this' instance\n * ```\n *\n * #### Example:\n * This example creates a bound version of a service function, and copies it to another object\n * ```\n *\n * var SomeService = {\n * this.data = [3, 4, 5];\n * this.log = function() {\n * console.log(this.data);\n * }\n * }\n *\n * // Constructor fn\n * function OtherThing() {\n * // Binds all functions from SomeService to SomeService,\n * // then copies them to 'this'\n * bindFunctions(SomeService, this, SomeService);\n * }\n *\n * let myOtherThing = new OtherThing();\n * myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this'\n * ```\n *\n * @param source A function that returns the source object which contains the original functions to be bound\n * @param target A function that returns the target object which will receive the bound functions\n * @param bind A function that returns the object which the functions will be bound to\n * @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object)\n * @param latebind If true, the binding of the function is delayed until the first time it's invoked\n */\nexport function createProxyFunctions(source: Function, target: Obj, bind: Function, fnNames?: string[], latebind = false): Obj {\n const bindFunction = (fnName) =>\n source()[fnName].bind(bind());\n\n const makeLateRebindFn = fnName => function lateRebindFunction() {\n target[fnName] = bindFunction(fnName);\n return target[fnName].apply(null, arguments);\n };\n\n fnNames = fnNames || Object.keys(source());\n\n return fnNames.reduce((acc, name) => {\n acc[name] = latebind ? makeLateRebindFn(name) : bindFunction(name);\n return acc;\n }, target);\n}\n\n\n/**\n * prototypal inheritance helper.\n * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it\n */\nexport const inherit = (parent: Obj, extra?: Obj) =>\n extend(Object.create(parent), extra);\n\n/** Given an array, returns true if the object is found in the array, (using indexOf) */\nexport const inArray: typeof _inArray = curry(_inArray) as any;\nexport function _inArray(array: any[], obj: any): boolean;\nexport function _inArray(array: any[]): (obj: any) => boolean;\nexport function _inArray(array, obj?): any {\n return array.indexOf(obj) !== -1;\n}\n\n/**\n * Given an array, and an item, if the item is found in the array, it removes it (in-place).\n * The same array is returned\n */\nexport const removeFrom: typeof _removeFrom = curry(_removeFrom) as any;\nexport function _removeFrom(array: T[], obj: T): T[];\nexport function _removeFrom(array: T[]): (obj: T) => T[];\nexport function _removeFrom(array, obj?) {\n let idx = array.indexOf(obj);\n if (idx >= 0) array.splice(idx, 1);\n return array;\n}\n\n/** pushes a values to an array and returns the value */\nexport const pushTo: typeof _pushTo = curry(_pushTo) as any;\nexport function _pushTo(arr: T[], val: T): T ;\nexport function _pushTo(arr: T[]): (val: T) => T ;\nexport function _pushTo(arr, val?): any {\n return (arr.push(val), val);\n}\n\n/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */\nexport const deregAll = (functions: Function[]) =>\n functions.slice().forEach(fn => {\n typeof fn === 'function' && fn();\n removeFrom(functions, fn);\n });\n/**\n * Applies a set of defaults to an options object. The options object is filtered\n * to only those properties of the objects in the defaultsList.\n * Earlier objects in the defaultsList take precedence when applying defaults.\n */\nexport function defaults(opts, ...defaultsList: Obj[]) {\n let _defaultsList = defaultsList.concat({}).reverse();\n let defaultVals = extend.apply(null, _defaultsList);\n return extend({}, defaultVals, pick(opts || {}, Object.keys(defaultVals)));\n}\n\n/** Reduce function that merges each element of the list into a single object, using extend */\nexport const mergeR = (memo: Obj, item: Obj) => extend(memo, item);\n\n/**\n * Finds the common ancestor path between two states.\n *\n * @param {Object} first The first state.\n * @param {Object} second The second state.\n * @return {Array} Returns an array of state names in descending order, not including the root.\n */\nexport function ancestors(first: StateObject, second: StateObject) {\n let path: StateObject[] = [];\n\n for (let n in first.path) {\n if (first.path[n] !== second.path[n]) break;\n path.push(first.path[n]);\n }\n return path;\n}\n\n/**\n * Return a copy of the object only containing the whitelisted properties.\n *\n * #### Example:\n * ```\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the whitelisted property names\n */\nexport function pick(obj: Obj, propNames: string[]): Obj {\n let objCopy = {};\n for (let prop in obj) {\n if (propNames.indexOf(prop) !== -1) {\n objCopy[prop] = obj[prop];\n }\n }\n return objCopy;\n}\n\n/**\n * Return a copy of the object omitting the blacklisted properties.\n *\n * @example\n * ```\n *\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = omit(foo, ['a', 'b']); // { c: 3 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the blacklisted property names\n */\nexport function omit(obj: Obj, propNames: string[]): Obj {\n return Object.keys(obj)\n .filter(not(inArray(propNames)))\n .reduce((acc, key) => (acc[key] = obj[key], acc), {});\n}\n\n\n/** Given an array of objects, maps each element to a named property of the element. */\nexport function pluck(collection: Obj[], propName: string): T[];\n/** Given an object, maps each property of the object to a named property of the property. */\nexport function pluck(collection: { [key: string]: any }, propName: string): { [key: string]: any };\n/**\n * Maps an array, or object to a property (by name)\n */\nexport function pluck(collection: any, propName: string): any {\n return map(collection, > prop(propName));\n}\n\n\n/** Given an array of objects, returns a new array containing only the elements which passed the callback predicate */\nexport function filter(collection: T[], callback: (t: T, key?: number) => boolean): T[];\n/** Given an object, returns a new object with only those properties that passed the callback predicate */\nexport function filter(collection: TypedMap, callback: (t: T, key?: string) => boolean): TypedMap;\n/** Filters an Array or an Object's properties based on a predicate */\nexport function filter(collection: any, callback: Function): T {\n let arr = isArray(collection), result: any = arr ? [] : {};\n let accept = arr ? x => result.push(x) : (x, key) => result[key] = x;\n forEach(collection, function(item, i) {\n if (callback(item, i)) accept(item, i);\n });\n return result;\n}\n\n\n/** Given an object, return the first property of that object which passed the callback predicate */\nexport function find(collection: TypedMap, callback: Predicate): T;\n/** Given an array of objects, returns the first object which passed the callback predicate */\nexport function find(collection: T[], callback: Predicate): T;\n/** Finds an object from an array, or a property of an object, that matches a predicate */\nexport function find(collection: any, callback: any) {\n let result;\n\n forEach(collection, function(item, i) {\n if (result) return;\n if (callback(item, i)) result = item;\n });\n\n return result;\n}\n\n/** Given an object, returns a new object, where each property is transformed by the callback function */\nexport let mapObj: (collection: { [key: string]: T }, callback: Mapper) => { [key: string]: U } = map;\n/** Given an array, returns a new array, where each element is transformed by the callback function */\nexport function map(collection: T[], callback: Mapper): U[];\nexport function map(collection: { [key: string]: T }, callback: Mapper): { [key: string]: U };\n/** Maps an array or object properties using a callback function */\nexport function map(collection: any, callback: any): any {\n let result = isArray(collection) ? [] : {};\n forEach(collection, (item, i) => result[i] = callback(item, i));\n return result;\n}\n\n/**\n * Given an object, return its enumerable property values\n *\n * @example\n * ```\n *\n * let foo = { a: 1, b: 2, c: 3 }\n * let vals = values(foo); // [ 1, 2, 3 ]\n * ```\n */\nexport const values: ( (obj: TypedMap) => T[]) = (obj: Obj) =>\n Object.keys(obj).map(key => obj[key]);\n\n/**\n * Reduce function that returns true if all of the values are truthy.\n *\n * @example\n * ```\n *\n * let vals = [ 1, true, {}, \"hello world\"];\n * vals.reduce(allTrueR, true); // true\n *\n * vals.push(0);\n * vals.reduce(allTrueR, true); // false\n * ```\n */\nexport const allTrueR = (memo: boolean, elem: any) => memo && elem;\n\n/**\n * Reduce function that returns true if any of the values are truthy.\n *\n * * @example\n * ```\n *\n * let vals = [ 0, null, undefined ];\n * vals.reduce(anyTrueR, true); // false\n *\n * vals.push(\"hello world\");\n * vals.reduce(anyTrueR, true); // true\n * ```\n */\nexport const anyTrueR = (memo: boolean, elem: any) => memo || elem;\n\n/**\n * Reduce function which un-nests a single level of arrays\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnestR = (memo: any[], elem: any[]) => memo.concat(elem);\n\n/**\n * Reduce function which recursively un-nests all arrays\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flattenR = (memo: any[], elem: any) =>\n isArray(elem) ? memo.concat(elem.reduce(flattenR, [])) : pushR(memo, elem);\n\n/**\n * Reduce function that pushes an object to an array, then returns the array.\n * Mostly just for [[flattenR]] and [[uniqR]]\n */\nexport function pushR(arr: any[], obj: any) {\n arr.push(obj);\n return arr;\n}\n\n/** Reduce function that filters out duplicates */\nexport const uniqR = (acc: T[], token: T): T[] =>\n inArray(acc, token) ? acc : pushR(acc, token);\n\n/**\n * Return a new array with a single level of arrays unnested.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * unnest(input) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnest = (arr: any[]) => arr.reduce(unnestR, []);\n/**\n * Return a completely flattened version of an array.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * flatten(input) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flatten = (arr: any[]) => arr.reduce(flattenR, []);\n\n/**\n * Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass.\n * @example\n * ```\n *\n * let isNumber = (obj) => typeof(obj) === 'number';\n * let allNumbers = [ 1, 2, 3, 4, 5 ];\n * allNumbers.filter(assertPredicate(isNumber)); //OK\n *\n * let oneString = [ 1, 2, 3, 4, \"5\" ];\n * oneString.filter(assertPredicate(isNumber, \"Not all numbers\")); // throws Error(\"\"Not all numbers\"\");\n * ```\n */\nexport const assertPredicate: (predicate: Predicate, errMsg: (string|Function)) => Predicate = assertFn;\n/**\n * Given a .map function, builds a .map function which throws an error if any mapped elements do not pass a truthyness test.\n * @example\n * ```\n *\n * var data = { foo: 1, bar: 2 };\n *\n * let keys = [ 'foo', 'bar' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // values is [1, 2]\n *\n * let keys = [ 'foo', 'bar', 'baz' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // throws Error(\"Key not found\")\n * ```\n */\nexport const assertMap: (mapFn: (t: T) => U, errMsg: (string|Function)) => (t: T) => U = assertFn;\nexport function assertFn(predicateOrMap: Function, errMsg: (string|Function) = \"assert failure\"): any {\n return (obj) => {\n let result = predicateOrMap(obj);\n if (!result) {\n throw new Error(isFunction(errMsg) ? ( errMsg)(obj) : errMsg);\n }\n return result;\n };\n}\n\n/**\n * Like _.pairs: Given an object, returns an array of key/value pairs\n *\n * @example\n * ```\n *\n * pairs({ foo: \"FOO\", bar: \"BAR }) // [ [ \"foo\", \"FOO\" ], [ \"bar\": \"BAR\" ] ]\n * ```\n */\nexport const pairs = (obj: Obj) =>\n Object.keys(obj).map(key => [ key, obj[key]] );\n\n/**\n * Given two or more parallel arrays, returns an array of tuples where\n * each tuple is composed of [ a[i], b[i], ... z[i] ]\n *\n * @example\n * ```\n *\n * let foo = [ 0, 2, 4, 6 ];\n * let bar = [ 1, 3, 5, 7 ];\n * let baz = [ 10, 30, 50, 70 ];\n * arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ]\n * arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ]\n * ```\n */\nexport function arrayTuples(...args: any[]): any[] {\n if (args.length === 0) return [];\n let maxArrayLen = args.reduce((min, arr) => Math.min(arr.length, min), 9007199254740991); // aka 2^53 − 1 aka Number.MAX_SAFE_INTEGER\n\n let i, result = [];\n\n for (i = 0; i < maxArrayLen; i++) {\n // This is a hot function\n // Unroll when there are 1-4 arguments\n switch (args.length) {\n case 1: result.push([args[0][i]]); break;\n case 2: result.push([args[0][i], args[1][i]]); break;\n case 3: result.push([args[0][i], args[1][i], args[2][i]]); break;\n case 4: result.push([args[0][i], args[1][i], args[2][i], args[3][i]]); break;\n default:\n result.push(args.map(array => array[i])); break;\n }\n }\n\n return result;\n}\n\n/**\n * Reduce function which builds an object from an array of [key, value] pairs.\n *\n * Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration.\n *\n * Each keyValueTuple should be an array with values [ key: string, value: any ]\n *\n * @example\n * ```\n *\n * var pairs = [ [\"fookey\", \"fooval\"], [\"barkey\", \"barval\"] ]\n *\n * var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n *\n * // Or, more simply:\n * var pairsToObj = pairs.reduce(applyPairs, {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n * ```\n */\nexport function applyPairs(memo: TypedMap, keyValTuple: any[]) {\n let key: string, value: any;\n if (isArray(keyValTuple)) [key, value] = keyValTuple;\n if (!isString(key)) throw new Error(\"invalid parameters to applyPairs\");\n memo[key] = value;\n return memo;\n}\n\n/** Get the last element of an array */\nexport function tail(arr: T[]): T {\n return arr.length && arr[arr.length - 1] || undefined;\n}\n\n/**\n * shallow copy from src to dest\n */\nexport function copy(src: Obj, dest?: Obj) {\n if (dest) Object.keys(dest).forEach(key => delete dest[key]);\n if (!dest) dest = {};\n return extend(dest, src);\n}\n\n/** Naive forEach implementation works with Objects or Arrays */\nfunction _forEach(obj: (any[]|any), cb: (el, idx?) => void, _this: Obj) {\n if (isArray(obj)) return obj.forEach(cb, _this);\n Object.keys(obj).forEach(key => cb(obj[key], key));\n}\n\n/** Like Object.assign() */\nexport function _extend(toObj: Obj, ...fromObjs: Obj[]): any;\nexport function _extend(toObj: Obj): any {\n for (let i = 1; i < arguments.length; i++) {\n let obj = arguments[i];\n if (!obj) continue;\n let keys = Object.keys(obj);\n\n for (let j = 0; j < keys.length; j++) {\n toObj[keys[j]] = obj[keys[j]];\n }\n }\n\n return toObj;\n}\n\nfunction _equals(o1: any, o2: any): boolean {\n if (o1 === o2) return true;\n if (o1 === null || o2 === null) return false;\n if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN\n let t1 = typeof o1, t2 = typeof o2;\n if (t1 !== t2 || t1 !== 'object') return false;\n\n const tup = [o1, o2];\n if (all(isArray)(tup)) return _arraysEq(o1, o2);\n if (all(isDate)(tup)) return o1.getTime() === o2.getTime();\n if (all(isRegExp)(tup)) return o1.toString() === o2.toString();\n if (all(isFunction)(tup)) return true; // meh\n\n let predicates = [isFunction, isArray, isDate, isRegExp];\n if (predicates.map(any).reduce((b, fn) => b || !!fn(tup), false)) return false;\n\n let key: string, keys: { [i: string]: boolean } = {};\n for (key in o1) {\n if (!_equals(o1[key], o2[key])) return false;\n keys[key] = true;\n }\n for (key in o2) {\n if (!keys[key]) return false;\n }\n\n return true;\n}\n\nfunction _arraysEq(a1: any[], a2: any[]) {\n if (a1.length !== a2.length) return false;\n return arrayTuples(a1, a2).reduce((b, t) => b && _equals(t[0], t[1]), true);\n}\n\n// issue #2676\nexport const silenceUncaughtInPromise = (promise: Promise) =>\n promise.catch(e => 0) && promise;\nexport const silentRejection = (error: any) =>\n silenceUncaughtInPromise(services.$q.reject(error));\n", - "/**\n * # Transition tracing (debug)\n *\n * Enable transition tracing to print transition information to the console,\n * in order to help debug your application.\n * Tracing logs detailed information about each Transition to your console.\n *\n * To enable tracing, import the [[Trace]] singleton and enable one or more categories.\n *\n * ### ES6\n * ```js\n * import {trace} from \"ui-router-ng2\"; // or \"angular-ui-router\"\n * trace.enable(1, 5); // TRANSITION and VIEWCONFIG\n * ```\n *\n * ### CJS\n * ```js\n * let trace = require(\"angular-ui-router\").trace; // or \"ui-router-ng2\"\n * trace.enable(\"TRANSITION\", \"VIEWCONFIG\");\n * ```\n *\n * ### Globals\n * ```js\n * let trace = window[\"angular-ui-router\"].trace; // or \"ui-router-ng2\"\n * trace.enable(); // Trace everything (very verbose)\n * ```\n *\n * ### Angular 1:\n * ```js\n * app.run($trace => $trace.enable());\n * ```\n *\n * @coreapi\n * @module trace\n */ /** for typedoc */\nimport { parse } from \"../common/hof\";\nimport { isFunction, isNumber } from \"../common/predicates\";\nimport { Transition } from \"../transition/transition\";\nimport { ViewTuple } from '../view';\nimport { ActiveUIView, ViewConfig, ViewContext } from \"../view/interface\";\nimport { stringify, functionToString, maxLength, padString } from \"./strings\";\nimport { Resolvable } from \"../resolve/resolvable\";\nimport { PathNode } from \"../path/pathNode\";\nimport { PolicyWhen } from \"../resolve/interface\";\nimport { TransitionHook } from \"../transition/transitionHook\";\nimport { HookResult } from \"../transition/interface\";\nimport { StateObject } from \"../state/stateObject\";\n\n/** @hidden */\nfunction uiViewString (uiview: ActiveUIView) {\n if (!uiview) return 'ui-view (defunct)';\n const state = uiview.creationContext ? uiview.creationContext.name || '(root)' : '(none)';\n return `[ui-view#${uiview.id} ${uiview.$type}:${uiview.fqn} (${uiview.name}@${state})]`;\n}\n\n/** @hidden */\nconst viewConfigString = (viewConfig: ViewConfig) => {\n let view = viewConfig.viewDecl;\n const state = view.$context.name || '(root)';\n return `[View#${viewConfig.$id} from '${state}' state]: target ui-view: '${view.$uiViewName}@${view.$uiViewContextAnchor}'`;\n};\n\n/** @hidden */\nfunction normalizedCat(input: Category|string): string {\n return isNumber(input) ? Category[input] : Category[Category[input]];\n}\n\n/** @hidden */\nconst consoleLog = Function.prototype.bind.call(console.log, console);\n\n/** @hidden */\nconst consoletable = isFunction(console.table) ? console.table.bind(console) : consoleLog.bind(console);\n\n\n/**\n * Trace categories Enum\n *\n * Enable or disable a category using [[Trace.enable]] or [[Trace.disable]]\n *\n * `trace.enable(Category.TRANSITION)`\n *\n * These can also be provided using a matching string, or position ordinal\n *\n * `trace.enable(\"TRANSITION\")`\n *\n * `trace.enable(1)`\n */\nexport enum Category {\n RESOLVE, TRANSITION, HOOK, UIVIEW, VIEWCONFIG,\n}\n\n/** @hidden */ const _tid = parse(\"$id\");\n/** @hidden */ const _rid = parse(\"router.$id\");\n/** @hidden */ const transLbl = (trans) => `Transition #${_tid(trans)}-${_rid(trans)}`;\n\n/**\n * Prints UI-Router Transition trace information to the console.\n */\nexport class Trace {\n /** @hidden */\n approximateDigests: number;\n\n /** @hidden */\n constructor() {\n this.approximateDigests = 0;\n }\n\n /** @hidden */\n private _enabled: { [key: string]: boolean } = {};\n\n /** @hidden */\n private _set(enabled: boolean, categories: Category[]) {\n if (!categories.length) {\n categories = Object.keys(Category)\n .map(k => parseInt(k, 10))\n .filter(k => !isNaN(k))\n .map(key => Category[key]);\n }\n categories.map(normalizedCat).forEach(category => this._enabled[category] = enabled);\n }\n\n /**\n * Enables a trace [[Category]]\n *\n * ```js\n * trace.enable(\"TRANSITION\");\n * ```\n *\n * @param categories categories to enable. If `categories` is omitted, all categories are enabled.\n * Also takes strings (category name) or ordinal (category position)\n */\n enable(...categories: (Category|string|number)[]);\n enable(...categories: any[]) { this._set(true, categories); }\n /**\n * Disables a trace [[Category]]\n *\n * ```js\n * trace.disable(\"VIEWCONFIG\");\n * ```\n *\n * @param categories categories to disable. If `categories` is omitted, all categories are disabled.\n * Also takes strings (category name) or ordinal (category position)\n */\n disable(...categories: (Category|string|number)[]);\n disable(...categories: any[]) { this._set(false, categories); }\n\n /**\n * Retrieves the enabled stateus of a [[Category]]\n *\n * ```js\n * trace.enabled(\"VIEWCONFIG\"); // true or false\n * ```\n *\n * @returns boolean true if the category is enabled\n */\n enabled(category: (Category|string|number)): boolean {\n return !!this._enabled[normalizedCat(category)];\n }\n\n /** @internalapi called by ui-router code */\n traceTransitionStart(trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: Started -> ${stringify(trans)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceTransitionIgnored(trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: Ignored <> ${stringify(trans)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceHookInvocation(step: TransitionHook, trans: Transition, options: any) {\n if (!this.enabled(Category.HOOK)) return;\n let event = parse(\"traceData.hookType\")(options) || \"internal\",\n context = parse(\"traceData.context.state.name\")(options) || parse(\"traceData.context\")(options) || \"unknown\",\n name = functionToString((step as any).registeredHook.callback);\n console.log(`${transLbl(trans)}: Hook -> ${event} context: ${context}, ${maxLength(200, name)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceHookResult(hookResult: HookResult, trans: Transition, transitionOptions: any) {\n if (!this.enabled(Category.HOOK)) return;\n console.log(`${transLbl(trans)}: <- Hook returned: ${maxLength(200, stringify(hookResult))}`);\n }\n\n /** @internalapi called by ui-router code */\n traceResolvePath(path: PathNode[], when: PolicyWhen, trans?: Transition) {\n if (!this.enabled(Category.RESOLVE)) return;\n console.log(`${transLbl(trans)}: Resolving ${path} (${when})`);\n }\n\n /** @internalapi called by ui-router code */\n traceResolvableResolved(resolvable: Resolvable, trans?: Transition) {\n if (!this.enabled(Category.RESOLVE)) return;\n console.log(`${transLbl(trans)}: <- Resolved ${resolvable} to: ${maxLength(200, stringify(resolvable.data))}`);\n }\n\n /** @internalapi called by ui-router code */\n traceError(reason: any, trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: <- Rejected ${stringify(trans)}, reason: ${reason}`);\n }\n\n /** @internalapi called by ui-router code */\n traceSuccess(finalState: StateObject, trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: <- Success ${stringify(trans)}, final state: ${finalState.name}`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewEvent(event: string, viewData: ActiveUIView, extra = \"\") {\n if (!this.enabled(Category.UIVIEW)) return;\n console.log(`ui-view: ${padString(30, event)} ${uiViewString(viewData)}${extra}`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewConfigUpdated(viewData: ActiveUIView, context: ViewContext) {\n if (!this.enabled(Category.UIVIEW)) return;\n this.traceUIViewEvent(\"Updating\", viewData, ` with ViewConfig from context='${context}'`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewFill(viewData: ActiveUIView, html: string) {\n if (!this.enabled(Category.UIVIEW)) return;\n this.traceUIViewEvent(\"Fill\", viewData, ` with: ${maxLength(200, html)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceViewSync(pairs: ViewTuple[]) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n const mapping = pairs.map(({ uiView, viewConfig }) => {\n const uiv = uiView && uiView.fqn;\n const cfg = viewConfig && `${viewConfig.viewDecl.$context.name}: ${viewConfig.viewDecl.$name}`;\n\n return { 'ui-view fqn': uiv, 'state: view name': cfg };\n }).sort((a, b) => a['ui-view fqn'].localeCompare(b['ui-view fqn']));\n\n consoletable(mapping);\n }\n\n /** @internalapi called by ui-router code */\n traceViewServiceEvent(event: string, viewConfig: ViewConfig) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n console.log(`VIEWCONFIG: ${event} ${viewConfigString(viewConfig)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceViewServiceUIViewEvent(event: string, viewData: ActiveUIView) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n console.log(`VIEWCONFIG: ${event} ${uiViewString(viewData)}`);\n }\n}\n\n/**\n * The [[Trace]] singleton\n *\n * #### Example:\n * ```js\n * import {trace} from \"angular-ui-router\";\n * trace.enable(1, 5);\n * ```\n */\nlet trace = new Trace();\nexport {trace};\n", - "/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\nimport { extend, removeFrom, tail, values, identity, map } from \"../common/common\";\nimport {isString, isFunction} from \"../common/predicates\";\nimport {PathNode} from \"../path/pathNode\";\nimport {\n TransitionStateHookFn, TransitionHookFn, TransitionHookPhase, TransitionHookScope, IHookRegistry, PathType,\n} from \"./interface\"; // has or is using\n\nimport {\n HookRegOptions, HookMatchCriteria, TreeChanges,\n HookMatchCriterion, IMatchingNodes, HookFn,\n} from \"./interface\";\nimport {Glob} from \"../common/glob\";\nimport {StateObject} from \"../state/stateObject\";\nimport {TransitionEventType} from \"./transitionEventType\";\nimport { TransitionService } from \"./transitionService\";\n\n/**\n * Determines if the given state matches the matchCriteria\n *\n * @hidden\n *\n * @param state a State Object to test against\n * @param criterion\n * - If a string, matchState uses the string as a glob-matcher against the state name\n * - If an array (of strings), matchState uses each string in the array as a glob-matchers against the state name\n * and returns a positive match if any of the globs match.\n * - If a function, matchState calls the function with the state and returns true if the function's result is truthy.\n * @returns {boolean}\n */\nexport function matchState(state: StateObject, criterion: HookMatchCriterion) {\n let toMatch = isString(criterion) ? [criterion] : criterion;\n\n function matchGlobs(_state: StateObject) {\n let globStrings = toMatch;\n for (let i = 0; i < globStrings.length; i++) {\n let glob = new Glob(globStrings[i]);\n\n if ((glob && glob.matches(_state.name)) || (!glob && globStrings[i] === _state.name)) {\n return true;\n }\n }\n return false;\n }\n\n let matchFn = (isFunction(toMatch) ? toMatch : matchGlobs);\n return !!matchFn(state);\n}\n\n/**\n * @internalapi\n * The registration data for a registered transition hook\n */\nexport class RegisteredHook {\n priority: number;\n bind: any;\n invokeCount = 0;\n invokeLimit: number;\n _deregistered = false;\n\n constructor(public tranSvc: TransitionService,\n public eventType: TransitionEventType,\n public callback: HookFn,\n public matchCriteria: HookMatchCriteria,\n public removeHookFromRegistry: (hook: RegisteredHook) => void,\n options: HookRegOptions = {} as any) {\n this.priority = options.priority || 0;\n this.bind = options.bind || null;\n this.invokeLimit = options.invokeLimit;\n }\n\n /**\n * Gets the matching [[PathNode]]s\n *\n * Given an array of [[PathNode]]s, and a [[HookMatchCriterion]], returns an array containing\n * the [[PathNode]]s that the criteria matches, or `null` if there were no matching nodes.\n *\n * Returning `null` is significant to distinguish between the default\n * \"match-all criterion value\" of `true` compared to a `() => true` function,\n * when the nodes is an empty array.\n *\n * This is useful to allow a transition match criteria of `entering: true`\n * to still match a transition, even when `entering === []`. Contrast that\n * with `entering: (state) => true` which only matches when a state is actually\n * being entered.\n */\n private _matchingNodes(nodes: PathNode[], criterion: HookMatchCriterion): PathNode[] {\n if (criterion === true) return nodes;\n let matching = nodes.filter(node => matchState(node.state, criterion));\n return matching.length ? matching : null;\n }\n\n /**\n * Gets the default match criteria (all `true`)\n *\n * Returns an object which has all the criteria match paths as keys and `true` as values, i.e.:\n *\n * ```js\n * {\n * to: true,\n * from: true,\n * entering: true,\n * exiting: true,\n * retained: true,\n * }\n */\n private _getDefaultMatchCriteria(): HookMatchCriteria {\n return map(this.tranSvc._pluginapi._getPathTypes(), () => true);\n }\n\n /**\n * Gets matching nodes as [[IMatchingNodes]]\n *\n * Create a IMatchingNodes object from the TransitionHookTypes that is roughly equivalent to:\n *\n * ```js\n * let matches: IMatchingNodes = {\n * to: _matchingNodes([tail(treeChanges.to)], mc.to),\n * from: _matchingNodes([tail(treeChanges.from)], mc.from),\n * exiting: _matchingNodes(treeChanges.exiting, mc.exiting),\n * retained: _matchingNodes(treeChanges.retained, mc.retained),\n * entering: _matchingNodes(treeChanges.entering, mc.entering),\n * };\n * ```\n */\n private _getMatchingNodes(treeChanges: TreeChanges): IMatchingNodes {\n let criteria = extend(this._getDefaultMatchCriteria(), this.matchCriteria);\n let paths: PathType[] = values(this.tranSvc._pluginapi._getPathTypes());\n\n return paths.reduce((mn: IMatchingNodes, pathtype: PathType) => {\n // STATE scope criteria matches against every node in the path.\n // TRANSITION scope criteria matches against only the last node in the path\n let isStateHook = pathtype.scope === TransitionHookScope.STATE;\n let path = treeChanges[pathtype.name] || [];\n let nodes: PathNode[] = isStateHook ? path : [tail(path)];\n\n mn[pathtype.name] = this._matchingNodes(nodes, criteria[pathtype.name]);\n return mn;\n }, {} as IMatchingNodes);\n }\n\n /**\n * Determines if this hook's [[matchCriteria]] match the given [[TreeChanges]]\n *\n * @returns an IMatchingNodes object, or null. If an IMatchingNodes object is returned, its values\n * are the matching [[PathNode]]s for each [[HookMatchCriterion]] (to, from, exiting, retained, entering)\n */\n matches(treeChanges: TreeChanges): IMatchingNodes {\n let matches = this._getMatchingNodes(treeChanges);\n\n // Check if all the criteria matched the TreeChanges object\n let allMatched = values(matches).every(identity);\n return allMatched ? matches : null;\n }\n\n deregister() {\n this.removeHookFromRegistry(this);\n this._deregistered = true;\n }\n}\n\n/** @hidden Return a registration function of the requested type. */\nexport function makeEvent(registry: IHookRegistry, transitionService: TransitionService, eventType: TransitionEventType) {\n // Create the object which holds the registered transition hooks.\n const _registeredHooks = registry._registeredHooks = (registry._registeredHooks || {});\n const hooks = _registeredHooks[eventType.name] = [];\n const removeHookFn: (hook: RegisteredHook) => void = removeFrom(hooks);\n\n // Create hook registration function on the IHookRegistry for the event\n registry[eventType.name] = hookRegistrationFn;\n\n function hookRegistrationFn(matchObject, callback, options = {}) {\n const registeredHook = new RegisteredHook(transitionService, eventType, callback, matchObject, removeHookFn, options);\n hooks.push(registeredHook);\n return registeredHook.deregister.bind(registeredHook);\n }\n\n return hookRegistrationFn;\n}\n", - "/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\n\nimport {extend, tail, assertPredicate, unnestR, identity} from \"../common/common\";\nimport {isArray} from \"../common/predicates\";\n\nimport {\n TransitionOptions, TransitionHookOptions, IHookRegistry, TreeChanges, IMatchingNodes,\n TransitionHookPhase, TransitionHookScope\n} from \"./interface\";\n\nimport {Transition} from \"./transition\";\nimport {TransitionHook} from \"./transitionHook\";\nimport {StateObject} from \"../state/stateObject\";\nimport {PathNode} from \"../path/pathNode\";\nimport {TransitionService} from \"./transitionService\";\nimport {TransitionEventType} from \"./transitionEventType\";\nimport {RegisteredHook} from \"./hookRegistry\";\n\n/**\n * This class returns applicable TransitionHooks for a specific Transition instance.\n *\n * Hooks ([[RegisteredHook]]) may be registered globally, e.g., $transitions.onEnter(...), or locally, e.g.\n * myTransition.onEnter(...). The HookBuilder finds matching RegisteredHooks (where the match criteria is\n * determined by the type of hook)\n *\n * The HookBuilder also converts RegisteredHooks objects to TransitionHook objects, which are used to run a Transition.\n *\n * The HookBuilder constructor is given the $transitions service and a Transition instance. Thus, a HookBuilder\n * instance may only be used for one specific Transition object. (side note: the _treeChanges accessor is private\n * in the Transition class, so we must also provide the Transition's _treeChanges)\n *\n */\nexport class HookBuilder {\n constructor(private transition: Transition) { }\n\n buildHooksForPhase(phase: TransitionHookPhase): TransitionHook[] {\n let $transitions = this.transition.router.transitionService;\n return $transitions._pluginapi._getEvents(phase)\n .map(type => this.buildHooks(type))\n .reduce(unnestR, [])\n .filter(identity);\n }\n\n /**\n * Returns an array of newly built TransitionHook objects.\n *\n * - Finds all RegisteredHooks registered for the given `hookType` which matched the transition's [[TreeChanges]].\n * - Finds [[PathNode]] (or `PathNode[]`) to use as the TransitionHook context(s)\n * - For each of the [[PathNode]]s, creates a TransitionHook\n *\n * @param hookType the type of the hook registration function, e.g., 'onEnter', 'onFinish'.\n */\n buildHooks(hookType: TransitionEventType): TransitionHook[] {\n let transition = this.transition;\n let treeChanges = transition.treeChanges();\n\n // Find all the matching registered hooks for a given hook type\n let matchingHooks = this.getMatchingHooks(hookType, treeChanges);\n if (!matchingHooks) return [];\n\n let baseHookOptions = {\n transition: transition,\n current: transition.options().current\n };\n\n const makeTransitionHooks = (hook: RegisteredHook) => {\n // Fetch the Nodes that caused this hook to match.\n let matches: IMatchingNodes = hook.matches(treeChanges);\n // Select the PathNode[] that will be used as TransitionHook context objects\n let matchingNodes: PathNode[] = matches[hookType.criteriaMatchPath.name];\n\n // Return an array of HookTuples\n return matchingNodes.map(node => {\n let _options = extend({\n bind: hook.bind,\n traceData: { hookType: hookType.name, context: node }\n }, baseHookOptions);\n\n let state = hookType.criteriaMatchPath.scope === TransitionHookScope.STATE ? node.state.self : null;\n let transitionHook = new TransitionHook(transition, state, hook, _options);\n return { hook, node, transitionHook };\n });\n };\n\n return matchingHooks.map(makeTransitionHooks)\n .reduce(unnestR, [])\n .sort(tupleSort(hookType.reverseSort))\n .map(tuple => tuple.transitionHook);\n }\n\n /**\n * Finds all RegisteredHooks from:\n * - The Transition object instance hook registry\n * - The TransitionService ($transitions) global hook registry\n *\n * which matched:\n * - the eventType\n * - the matchCriteria (to, from, exiting, retained, entering)\n *\n * @returns an array of matched [[RegisteredHook]]s\n */\n public getMatchingHooks(hookType: TransitionEventType, treeChanges: TreeChanges): RegisteredHook[] {\n let isCreate = hookType.hookPhase === TransitionHookPhase.CREATE;\n\n // Instance and Global hook registries\n let $transitions = this.transition.router.transitionService;\n let registries = isCreate ? [ $transitions ] : [ this.transition, $transitions ];\n\n return registries.map((reg: IHookRegistry) => reg.getHooks(hookType.name)) // Get named hooks from registries\n .filter(assertPredicate(isArray, `broken event named: ${hookType.name}`)) // Sanity check\n .reduce(unnestR, []) // Un-nest RegisteredHook[][] to RegisteredHook[] array\n .filter(hook => hook.matches(treeChanges)); // Only those satisfying matchCriteria\n }\n}\n\ninterface HookTuple { hook: RegisteredHook, node: PathNode, transitionHook: TransitionHook }\n\n/**\n * A factory for a sort function for HookTuples.\n *\n * The sort function first compares the PathNode depth (how deep in the state tree a node is), then compares\n * the EventHook priority.\n *\n * @param reverseDepthSort a boolean, when true, reverses the sort order for the node depth\n * @returns a tuple sort function\n */\nfunction tupleSort(reverseDepthSort = false) {\n return function nodeDepthThenPriority(l: HookTuple, r: HookTuple): number {\n let factor = reverseDepthSort ? -1 : 1;\n let depthDelta = (l.node.state.path.length - r.node.state.path.length) * factor;\n return depthDelta !== 0 ? depthDelta : r.hook.priority - l.hook.priority;\n }\n}", - "/**\n * @coreapi\n * @module params\n */\n/** */\nimport {extend, filter, map} from \"../common/common\";\nimport {isArray, isDefined} from \"../common/predicates\";\nimport {ParamTypeDefinition} from \"./interface\";\n\n/**\n * An internal class which implements [[ParamTypeDefinition]].\n *\n * A [[ParamTypeDefinition]] is a plain javascript object used to register custom parameter types.\n * When a param type definition is registered, an instance of this class is created internally.\n *\n * This class has naive implementations for all the [[ParamTypeDefinition]] methods.\n *\n * Used by [[UrlMatcher]] when matching or formatting URLs, or comparing and validating parameter values.\n *\n * #### Example:\n * ```js\n * var paramTypeDef = {\n * decode: function(val) { return parseInt(val, 10); },\n * encode: function(val) { return val && val.toString(); },\n * equals: function(a, b) { return this.is(a) && a === b; },\n * is: function(val) { return angular.isNumber(val) && isFinite(val) && val % 1 === 0; },\n * pattern: /\\d+/\n * }\n *\n * var paramType = new ParamType(paramTypeDef);\n * ```\n * @internalapi\n */\nexport class ParamType implements ParamTypeDefinition {\n /** @inheritdoc */\n pattern: RegExp = /.*/;\n /** The name/id of the parameter type */\n name: string;\n /** @inheritdoc */\n raw: boolean;\n /** @inheritdoc */\n dynamic: boolean;\n /** @inheritdoc */\n inherit = true;\n\n /**\n * @param def A configuration object which contains the custom type definition. The object's\n * properties will override the default methods and/or pattern in `ParamType`'s public interface.\n * @returns a new ParamType object\n */\n constructor(def: ParamTypeDefinition) {\n extend(this, def);\n }\n\n\n // consider these four methods to be \"abstract methods\" that should be overridden\n /** @inheritdoc */\n is(val: any, key?: string): boolean { return true; }\n /** @inheritdoc */\n encode(val: any, key?: string): (string|string[]) { return val; }\n /** @inheritdoc */\n decode(val: string, key?: string): any { return val; }\n /** @inheritdoc */\n equals(a: any, b: any): boolean { return a == b; }\n\n\n $subPattern() {\n let sub = this.pattern.toString();\n return sub.substr(1, sub.length - 2);\n }\n\n toString() {\n return `{ParamType:${this.name}}`;\n }\n\n /** Given an encoded string, or a decoded object, returns a decoded object */\n $normalize(val: any) {\n return this.is(val) ? val : this.decode(val);\n }\n\n /**\n * Wraps an existing custom ParamType as an array of ParamType, depending on 'mode'.\n * e.g.:\n * - urlmatcher pattern \"/path?{queryParam[]:int}\"\n * - url: \"/path?queryParam=1&queryParam=2\n * - $stateParams.queryParam will be [1, 2]\n * if `mode` is \"auto\", then\n * - url: \"/path?queryParam=1 will create $stateParams.queryParam: 1\n * - url: \"/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2]\n */\n $asArray(mode: (boolean|\"auto\"), isSearch: boolean) {\n if (!mode) return this;\n if (mode === \"auto\" && !isSearch) throw new Error(\"'auto' array mode is for query parameters only\");\n return new ( ArrayType)(this, mode);\n }\n}\n\n/**\n * Wraps up a `ParamType` object to handle array values.\n * @internalapi\n */\nfunction ArrayType(type: ParamType, mode: (boolean|\"auto\")) {\n // Wrap non-array value as array\n function arrayWrap(val: any): any[] {\n return isArray(val) ? val : (isDefined(val) ? [ val ] : []);\n }\n\n // Unwrap array value for \"auto\" mode. Return undefined for empty array.\n function arrayUnwrap(val: any) {\n switch (val.length) {\n case 0: return undefined;\n case 1: return mode === \"auto\" ? val[0] : val;\n default: return val;\n }\n }\n\n // Wraps type (.is/.encode/.decode) functions to operate on each value of an array\n function arrayHandler(callback: (x: any) => any, allTruthyMode?: boolean) {\n return function handleArray(val: any) {\n if (isArray(val) && val.length === 0) return val;\n let arr = arrayWrap(val);\n let result = map(arr, callback);\n return (allTruthyMode === true) ? filter(result, x => !x).length === 0 : arrayUnwrap(result);\n };\n }\n\n // Wraps type (.equals) functions to operate on each value of an array\n function arrayEqualsHandler(callback: (l: any, r: any) => boolean) {\n return function handleArray(val1: any, val2: any) {\n let left = arrayWrap(val1), right = arrayWrap(val2);\n if (left.length !== right.length) return false;\n for (let i = 0; i < left.length; i++) {\n if (!callback(left[i], right[i])) return false;\n }\n return true;\n };\n }\n\n ['encode', 'decode', 'equals', '$normalize'].forEach(name => {\n var paramTypeFn = type[name].bind(type);\n var wrapperFn: Function = name === 'equals' ? arrayEqualsHandler : arrayHandler;\n this[name] = wrapperFn(paramTypeFn);\n });\n\n extend(this, {\n dynamic: type.dynamic,\n name: type.name,\n pattern: type.pattern,\n inherit: type.inherit,\n is: arrayHandler(type.is.bind(type), true),\n $arrayMode: mode\n });\n}\n", - "/**\n * @coreapi\n * @module params\n */ /** for typedoc */\nimport { extend, filter, map, allTrueR } from \"../common/common\";\nimport { prop } from \"../common/hof\";\nimport { isInjectable, isDefined, isString, isArray, isUndefined } from \"../common/predicates\";\nimport { RawParams, ParamDeclaration } from \"../params/interface\";\nimport { services } from \"../common/coreservices\";\nimport { ParamType } from \"./paramType\";\nimport { ParamTypes } from \"./paramTypes\";\nimport { UrlMatcherFactory } from \"../url/urlMatcherFactory\";\n\n/** @hidden */ let hasOwn = Object.prototype.hasOwnProperty;\n/** @hidden */ let isShorthand = (cfg: ParamDeclaration) =>\n [\"value\", \"type\", \"squash\", \"array\", \"dynamic\"].filter(hasOwn.bind(cfg || {})).length === 0;\n\n/** @internalapi */\nexport enum DefType {\n PATH,\n SEARCH,\n CONFIG,\n}\n\n/** @hidden */\nfunction unwrapShorthand(cfg: ParamDeclaration): ParamDeclaration {\n cfg = isShorthand(cfg) && { value: cfg } as any || cfg;\n\n getStaticDefaultValue['__cacheable'] = true;\n function getStaticDefaultValue() {\n return cfg.value;\n }\n\n return extend(cfg, {\n $$fn: isInjectable(cfg.value) ? cfg.value : getStaticDefaultValue,\n });\n}\n\n/** @hidden */\nfunction getType(cfg: ParamDeclaration, urlType: ParamType, location: DefType, id: string, paramTypes: ParamTypes) {\n if (cfg.type && urlType && urlType.name !== 'string') throw new Error(`Param '${id}' has two type configurations.`);\n if (cfg.type && urlType && urlType.name === 'string' && paramTypes.type(cfg.type as string)) return paramTypes.type(cfg.type as string);\n if (urlType) return urlType;\n if (!cfg.type) {\n let type = location === DefType.CONFIG ? \"any\" :\n location === DefType.PATH ? \"path\" :\n location === DefType.SEARCH ? \"query\" : \"string\";\n return paramTypes.type(type);\n }\n return cfg.type instanceof ParamType ? cfg.type : paramTypes.type(cfg.type as string);\n}\n\n/**\n * @internalapi\n * returns false, true, or the squash value to indicate the \"default parameter url squash policy\".\n */\nfunction getSquashPolicy(config: ParamDeclaration, isOptional: boolean, defaultPolicy: (boolean|string)) {\n let squash = config.squash;\n if (!isOptional || squash === false) return false;\n if (!isDefined(squash) || squash == null) return defaultPolicy;\n if (squash === true || isString(squash)) return squash;\n throw new Error(`Invalid squash policy: '${squash}'. Valid policies: false, true, or arbitrary string`);\n}\n\n/** @internalapi */\nfunction getReplace(config: ParamDeclaration, arrayMode: boolean, isOptional: boolean, squash: (string|boolean)) {\n let replace: any, configuredKeys: string[], defaultPolicy = [\n {from: \"\", to: (isOptional || arrayMode ? undefined : \"\")},\n {from: null, to: (isOptional || arrayMode ? undefined : \"\")},\n ];\n replace = isArray(config.replace) ? config.replace : [];\n if (isString(squash)) replace.push({ from: squash, to: undefined });\n configuredKeys = map(replace, prop(\"from\"));\n return filter(defaultPolicy, item => configuredKeys.indexOf(item.from) === -1).concat(replace);\n}\n\n\n/** @internalapi */\nexport class Param {\n id: string;\n type: ParamType;\n location: DefType;\n isOptional: boolean;\n dynamic: boolean;\n raw: boolean;\n squash: (boolean|string);\n replace: [{ to: any, from: any }];\n inherit: boolean;\n array: boolean;\n config: any;\n /** Cache the default value if it is a static value */\n _defaultValueCache: {\n defaultValue: any,\n };\n\n constructor(id: string, type: ParamType, config: ParamDeclaration, location: DefType, urlMatcherFactory: UrlMatcherFactory) {\n config = unwrapShorthand(config);\n type = getType(config, type, location, id, urlMatcherFactory.paramTypes);\n let arrayMode = getArrayMode();\n type = arrayMode ? type.$asArray(arrayMode, location === DefType.SEARCH) : type;\n let isOptional = config.value !== undefined || location === DefType.SEARCH;\n let dynamic = isDefined(config.dynamic) ? !!config.dynamic : !!type.dynamic;\n let raw = isDefined(config.raw) ? !!config.raw : !!type.raw;\n let squash = getSquashPolicy(config, isOptional, urlMatcherFactory.defaultSquashPolicy());\n let replace = getReplace(config, arrayMode, isOptional, squash);\n let inherit = isDefined(config.inherit) ? !!config.inherit : !!type.inherit;\n\n // array config: param name (param[]) overrides default settings. explicit config overrides param name.\n function getArrayMode() {\n let arrayDefaults = { array: (location === DefType.SEARCH ? \"auto\" : false) };\n let arrayParamNomenclature = id.match(/\\[\\]$/) ? { array: true } : {};\n return extend(arrayDefaults, arrayParamNomenclature, config).array;\n }\n\n extend(this, {id, type, location, isOptional, dynamic, raw, squash, replace, inherit, array: arrayMode, config });\n }\n\n isDefaultValue(value: any): boolean {\n return this.isOptional && this.type.equals(this.value(), value);\n }\n\n /**\n * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the\n * default value, which may be the result of an injectable function.\n */\n value(value?: any): any {\n /**\n * [Internal] Get the default value of a parameter, which may be an injectable function.\n */\n const getDefaultValue = () => {\n if (this._defaultValueCache) return this._defaultValueCache.defaultValue;\n\n if (!services.$injector) throw new Error(\"Injectable functions cannot be called at configuration time\");\n\n let defaultValue = services.$injector.invoke(this.config.$$fn);\n\n if (defaultValue !== null && defaultValue !== undefined && !this.type.is(defaultValue))\n throw new Error(`Default value (${defaultValue}) for parameter '${this.id}' is not an instance of ParamType (${this.type.name})`);\n\n if (this.config.$$fn['__cacheable']) {\n this._defaultValueCache = { defaultValue };\n }\n\n return defaultValue;\n };\n\n const replaceSpecialValues = (val: any) => {\n for (let tuple of this.replace) {\n if (tuple.from === val) return tuple.to;\n }\n return val;\n };\n\n value = replaceSpecialValues(value);\n\n return isUndefined(value) ? getDefaultValue() : this.type.$normalize(value);\n }\n\n isSearch(): boolean {\n return this.location === DefType.SEARCH;\n }\n\n validates(value: any): boolean {\n // There was no parameter value, but the param is optional\n if ((isUndefined(value) || value === null) && this.isOptional) return true;\n\n // The value was not of the correct ParamType, and could not be decoded to the correct ParamType\n const normalized = this.type.$normalize(value);\n if (!this.type.is(normalized)) return false;\n\n // The value was of the correct type, but when encoded, did not match the ParamType's regexp\n const encoded = this.type.encode(normalized);\n return !(isString(encoded) && !this.type.pattern.exec( encoded));\n }\n\n toString() {\n return `{Param:${this.id} ${this.type} squash: '${this.squash}' optional: ${this.isOptional}}`;\n }\n\n static values(params: Param[], values: RawParams = {}): RawParams {\n const paramValues = {} as RawParams;\n for (let param of params) {\n paramValues[param.id] = param.value(values[param.id]);\n }\n return paramValues;\n }\n\n /**\n * Finds [[Param]] objects which have different param values\n *\n * Filters a list of [[Param]] objects to only those whose parameter values differ in two param value objects\n *\n * @param params: The list of Param objects to filter\n * @param values1: The first set of parameter values\n * @param values2: the second set of parameter values\n *\n * @returns any Param objects whose values were different between values1 and values2\n */\n static changed(params: Param[], values1: RawParams = {}, values2: RawParams = {}): Param[] {\n return params.filter(param => !param.type.equals(values1[param.id], values2[param.id]));\n }\n\n /**\n * Checks if two param value objects are equal (for a set of [[Param]] objects)\n *\n * @param params The list of [[Param]] objects to check\n * @param values1 The first set of param values\n * @param values2 The second set of param values\n *\n * @returns true if the param values in values1 and values2 are equal\n */\n static equals(params: Param[], values1 = {}, values2 = {}): boolean {\n return Param.changed(params, values1, values2).length === 0;\n }\n\n /** Returns true if a the parameter values are valid, according to the Param definitions */\n static validates(params: Param[], values: RawParams = {}): boolean {\n return params.map(param => param.validates(values[param.id])).reduce(allTrueR, true);\n }\n}", - "/**\n * Functions that manipulate strings\n *\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_strings\n */ /** */\n\nimport { isString, isArray, isDefined, isNull, isPromise, isInjectable, isObject } from \"./predicates\";\nimport { Rejection } from \"../transition/rejectFactory\";\nimport { IInjectable, identity, Obj, tail, pushR } from \"./common\";\nimport { pattern, is, not, val, invoke } from \"./hof\";\nimport { Transition } from \"../transition/transition\";\nimport { Resolvable } from \"../resolve/resolvable\";\n\n/**\n * Returns a string shortened to a maximum length\n *\n * If the string is already less than the `max` length, return the string.\n * Else return the string, shortened to `max - 3` and append three dots (\"...\").\n *\n * @param max the maximum length of the string to return\n * @param str the input string\n */\nexport function maxLength(max: number, str: string) {\n if (str.length <= max) return str;\n return str.substr(0, max - 3) + \"...\";\n}\n\n/**\n * Returns a string, with spaces added to the end, up to a desired str length\n *\n * If the string is already longer than the desired length, return the string.\n * Else returns the string, with extra spaces on the end, such that it reaches `length` characters.\n *\n * @param length the desired length of the string to return\n * @param str the input string\n */\nexport function padString(length: number, str: string) {\n while (str.length < length) str += \" \";\n return str;\n}\n\nexport function kebobString(camelCase: string) {\n return camelCase\n .replace(/^([A-Z])/, $1 => $1.toLowerCase()) // replace first char\n .replace(/([A-Z])/g, $1 => \"-\" + $1.toLowerCase()); // replace rest\n}\n\nfunction _toJson(obj: Obj) {\n return JSON.stringify(obj);\n}\n\nfunction _fromJson(json: string) {\n return isString(json) ? JSON.parse(json) : json;\n}\n\n\nfunction promiseToString(p: Promise) {\n return `Promise(${JSON.stringify(p)})`;\n}\n\nexport function functionToString(fn: Function) {\n let fnStr = fnToString(fn);\n let namedFunctionMatch = fnStr.match(/^(function [^ ]+\\([^)]*\\))/);\n let toStr = namedFunctionMatch ? namedFunctionMatch[1] : fnStr;\n\n let fnName = fn['name'] || \"\";\n if (fnName && toStr.match(/function \\(/)) {\n return 'function ' + fnName + toStr.substr(9);\n }\n return toStr;\n}\n\nexport function fnToString(fn: IInjectable) {\n let _fn = isArray(fn) ? fn.slice(-1)[0] : fn;\n return _fn && _fn.toString() || \"undefined\";\n}\n\nlet stringifyPatternFn: (val: any) => string = null;\nlet stringifyPattern = function(value: any) {\n let isRejection = Rejection.isRejectionPromise;\n\n stringifyPatternFn = stringifyPatternFn || pattern([\n [not(isDefined), val(\"undefined\")],\n [isNull, val(\"null\")],\n [isPromise, val(\"[Promise]\")],\n [isRejection, (x: any) => x._transitionRejection.toString()],\n [is(Rejection), invoke(\"toString\")],\n [is(Transition), invoke(\"toString\")],\n [is(Resolvable), invoke(\"toString\")],\n [isInjectable, functionToString],\n [val(true), identity]\n ]);\n\n return stringifyPatternFn(value);\n};\n\nexport function stringify(o: any) {\n var seen: any[] = [];\n\n function format(val: any) {\n if (isObject(val)) {\n if (seen.indexOf(val) !== -1) return '[circular ref]';\n seen.push(val);\n }\n return stringifyPattern(val);\n }\n\n return JSON.stringify(o, (key, val) => format(val)).replace(/\\\\\"/g, '\"');\n}\n\n/** Returns a function that splits a string on a character or substring */\nexport const beforeAfterSubstr = (char: string) => (str: string): string[] => {\n if (!str) return [\"\", \"\"];\n let idx = str.indexOf(char);\n if (idx === -1) return [str, \"\"];\n return [str.substr(0, idx), str.substr(idx + 1)];\n};\n\nexport const hostRegex = new RegExp('^(?:[a-z]+:)?//[^/]+/');\nexport const stripLastPathElement = (str: string) => str.replace(/\\/[^/]*$/, '');\nexport const splitHash = beforeAfterSubstr(\"#\");\nexport const splitQuery = beforeAfterSubstr(\"?\");\nexport const splitEqual = beforeAfterSubstr(\"=\");\nexport const trimHashVal = (str: string) => str ? str.replace(/^#/, \"\") : \"\";\n\n/**\n * Splits on a delimiter, but returns the delimiters in the array\n *\n * #### Example:\n * ```js\n * var splitOnSlashes = splitOnDelim('/');\n * splitOnSlashes(\"/foo\"); // [\"/\", \"foo\"]\n * splitOnSlashes(\"/foo/\"); // [\"/\", \"foo\", \"/\"]\n * ```\n */\nexport function splitOnDelim(delim: string) {\n let re = new RegExp(\"(\" + delim + \")\", \"g\");\n return (str: string) =>\n str.split(re).filter(identity);\n};\n\n\n/**\n * Reduce fn that joins neighboring strings\n *\n * Given an array of strings, returns a new array\n * where all neighboring strings have been joined.\n *\n * #### Example:\n * ```js\n * let arr = [\"foo\", \"bar\", 1, \"baz\", \"\", \"qux\" ];\n * arr.reduce(joinNeighborsR, []) // [\"foobar\", 1, \"bazqux\" ]\n * ```\n */\nexport function joinNeighborsR(acc: any[], x: any) {\n if (isString(tail(acc)) && isString(x))\n return acc.slice(0, -1).concat(tail(acc)+ x);\n return pushR(acc, x);\n};\n\n", - "/** @module state */ /** for typedoc */\nimport {Obj, omit, noop, extend, inherit, values, applyPairs, tail, mapObj, identity} from \"../common/common\";\nimport {isDefined, isFunction, isString, isArray} from \"../common/predicates\";\nimport {stringify} from \"../common/strings\";\nimport {prop, pattern, is, pipe, val} from \"../common/hof\";\nimport {StateDeclaration} from \"./interface\";\n\nimport {StateObject} from \"./stateObject\";\nimport {StateMatcher} from \"./stateMatcher\";\nimport {Param} from \"../params/param\";\nimport {UrlMatcherFactory} from \"../url/urlMatcherFactory\";\nimport {UrlMatcher} from \"../url/urlMatcher\";\nimport {Resolvable} from \"../resolve/resolvable\";\nimport {services} from \"../common/coreservices\";\nimport {ResolvePolicy} from \"../resolve/interface\";\nimport { ParamFactory } from \"../url/interface\";\n\nconst parseUrl = (url: string): any => {\n if (!isString(url)) return false;\n let root = url.charAt(0) === '^';\n return { val: root ? url.substring(1) : url, root };\n};\n\nexport type BuilderFunction = (state: StateObject, parent?: BuilderFunction) => any;\n\ninterface Builders {\n [key: string]: BuilderFunction[];\n\n name: BuilderFunction[];\n parent: BuilderFunction[];\n data: BuilderFunction[];\n url: BuilderFunction[];\n navigable: BuilderFunction[];\n params: BuilderFunction[];\n views: BuilderFunction[];\n path: BuilderFunction[];\n includes: BuilderFunction[];\n resolvables: BuilderFunction[];\n}\n\n\nfunction nameBuilder(state: StateObject) {\n return state.name;\n}\n\nfunction selfBuilder(state: StateObject) {\n state.self.$$state = () => state;\n return state.self;\n}\n\nfunction dataBuilder(state: StateObject) {\n if (state.parent && state.parent.data) {\n state.data = state.self.data = inherit(state.parent.data, state.data);\n }\n return state.data;\n}\n\nconst getUrlBuilder = ($urlMatcherFactoryProvider: UrlMatcherFactory, root: () => StateObject) =>\nfunction urlBuilder(state: StateObject) {\n let stateDec: StateDeclaration = state;\n\n // For future states, i.e., states whose name ends with `.**`,\n // match anything that starts with the url prefix\n if (stateDec && stateDec.url && stateDec.name && stateDec.name.match(/\\.\\*\\*$/)) {\n stateDec.url += \"{remainder:any}\"; // match any path (.*)\n }\n\n const parsed = parseUrl(stateDec.url), parent = state.parent;\n const url = !parsed ? stateDec.url : $urlMatcherFactoryProvider.compile(parsed.val, {\n params: state.params || {},\n paramMap: function (paramConfig: any, isSearch: boolean) {\n if (stateDec.reloadOnSearch === false && isSearch) paramConfig = extend(paramConfig || {}, {dynamic: true});\n return paramConfig;\n }\n });\n\n if (!url) return null;\n if (!$urlMatcherFactoryProvider.isMatcher(url)) throw new Error(`Invalid url '${url}' in state '${state}'`);\n return (parsed && parsed.root) ? url : ((parent && parent.navigable) || root()).url.append( url);\n};\n\nconst getNavigableBuilder = (isRoot: (state: StateObject) => boolean) =>\nfunction navigableBuilder(state: StateObject) {\n return !isRoot(state) && state.url ? state : (state.parent ? state.parent.navigable : null);\n};\n\nconst getParamsBuilder = (paramFactory: ParamFactory) =>\nfunction paramsBuilder(state: StateObject): { [key: string]: Param } {\n const makeConfigParam = (config: any, id: string) => paramFactory.fromConfig(id, null, config);\n let urlParams: Param[] = (state.url && state.url.parameters({inherit: false})) || [];\n let nonUrlParams: Param[] = values(mapObj(omit(state.params || {}, urlParams.map(prop('id'))), makeConfigParam));\n return urlParams.concat(nonUrlParams).map(p => [p.id, p]).reduce(applyPairs, {});\n};\n\nfunction pathBuilder(state: StateObject) {\n return state.parent ? state.parent.path.concat(state) : /*root*/ [state];\n}\n\nfunction includesBuilder(state: StateObject) {\n let includes = state.parent ? extend({}, state.parent.includes) : {};\n includes[state.name] = true;\n return includes;\n}\n\n/**\n * This is a [[StateBuilder.builder]] function for the `resolve:` block on a [[StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * validates the `resolve` property and converts it to a [[Resolvable]] array.\n *\n * resolve: input value can be:\n *\n * {\n * // analyzed but not injected\n * myFooResolve: function() { return \"myFooData\"; },\n *\n * // function.toString() parsed, \"DependencyName\" dep as string (not min-safe)\n * myBarResolve: function(DependencyName) { return DependencyName.fetchSomethingAsPromise() },\n *\n * // Array split; \"DependencyName\" dep as string\n * myBazResolve: [ \"DependencyName\", function(dep) { return dep.fetchSomethingAsPromise() },\n *\n * // Array split; DependencyType dep as token (compared using ===)\n * myQuxResolve: [ DependencyType, function(dep) { return dep.fetchSometingAsPromise() },\n *\n * // val.$inject used as deps\n * // where:\n * // corgeResolve.$inject = [\"DependencyName\"];\n * // function corgeResolve(dep) { dep.fetchSometingAsPromise() }\n * // then \"DependencyName\" dep as string\n * myCorgeResolve: corgeResolve,\n *\n * // inject service by name\n * // When a string is found, desugar creating a resolve that injects the named service\n * myGraultResolve: \"SomeService\"\n * }\n *\n * or:\n *\n * [\n * new Resolvable(\"myFooResolve\", function() { return \"myFooData\" }),\n * new Resolvable(\"myBarResolve\", function(dep) { return dep.fetchSomethingAsPromise() }, [ \"DependencyName\" ]),\n * { provide: \"myBazResolve\", useFactory: function(dep) { dep.fetchSomethingAsPromise() }, deps: [ \"DependencyName\" ] }\n * ]\n */\nexport function resolvablesBuilder(state: StateObject): Resolvable[] {\n interface Tuple { token: any, val: any, deps: any[], policy: ResolvePolicy }\n \n /** convert resolve: {} and resolvePolicy: {} objects to an array of tuples */\n const objects2Tuples = (resolveObj: Obj, resolvePolicies: { [key: string]: ResolvePolicy }) =>\n Object.keys(resolveObj || {}).map(token => ({token, val: resolveObj[token], deps: undefined, policy: resolvePolicies[token]}));\n\n /** fetch DI annotations from a function or ng1-style array */\n const annotate = (fn: Function) => {\n let $injector = services.$injector;\n // ng1 doesn't have an $injector until runtime.\n // If the $injector doesn't exist, use \"deferred\" literal as a\n // marker indicating they should be annotated when runtime starts\n return fn['$inject'] || ($injector && $injector.annotate(fn, $injector.strictDi)) || \"deferred\";\n };\n\n /** true if the object has both `token` and `resolveFn`, and is probably a [[ResolveLiteral]] */\n const isResolveLiteral = (obj: any) => !!(obj.token && obj.resolveFn);\n\n /** true if the object looks like a provide literal, or a ng2 Provider */\n const isLikeNg2Provider = (obj: any) => !!((obj.provide || obj.token) && (obj.useValue || obj.useFactory || obj.useExisting || obj.useClass));\n\n /** true if the object looks like a tuple from obj2Tuples */\n const isTupleFromObj = (obj: any) => !!(obj && obj.val && (isString(obj.val) || isArray(obj.val) || isFunction(obj.val)));\n\n /** extracts the token from a Provider or provide literal */\n const token = (p: any) => p.provide || p.token;\n\n /** Given a literal resolve or provider object, returns a Resolvable */\n const literal2Resolvable = pattern([\n [prop('resolveFn'), p => new Resolvable(token(p), p.resolveFn, p.deps, p.policy)],\n [prop('useFactory'), p => new Resolvable(token(p), p.useFactory, (p.deps || p.dependencies), p.policy)],\n [prop('useClass'), p => new Resolvable(token(p), () => new (p.useClass)(), [], p.policy)],\n [prop('useValue'), p => new Resolvable(token(p), () => p.useValue, [], p.policy, p.useValue)],\n [prop('useExisting'), p => new Resolvable(token(p), identity, [p.useExisting], p.policy)],\n ]);\n\n const tuple2Resolvable = pattern([\n [pipe(prop(\"val\"), isString), (tuple: Tuple) => new Resolvable(tuple.token, identity, [ tuple.val ], tuple.policy)],\n [pipe(prop(\"val\"), isArray), (tuple: Tuple) => new Resolvable(tuple.token, tail( tuple.val), tuple.val.slice(0, -1), tuple.policy)],\n [pipe(prop(\"val\"), isFunction), (tuple: Tuple) => new Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy)],\n ]);\n\n const item2Resolvable = <(obj: any) => Resolvable> pattern([\n [is(Resolvable), (r: Resolvable) => r],\n [isResolveLiteral, literal2Resolvable],\n [isLikeNg2Provider, literal2Resolvable],\n [isTupleFromObj, tuple2Resolvable],\n [val(true), (obj: any) => { throw new Error(\"Invalid resolve value: \" + stringify(obj)) }]\n ]);\n\n // If resolveBlock is already an array, use it as-is.\n // Otherwise, assume it's an object and convert to an Array of tuples\n let decl = state.resolve;\n let items: any[] = isArray(decl) ? decl : objects2Tuples(decl, state.resolvePolicy || {});\n return items.map(item2Resolvable);\n}\n\n/**\n * @internalapi A internal global service\n *\n * StateBuilder is a factory for the internal [[StateObject]] objects.\n *\n * When you register a state with the [[StateRegistry]], you register a plain old javascript object which\n * conforms to the [[StateDeclaration]] interface. This factory takes that object and builds the corresponding\n * [[StateObject]] object, which has an API and is used internally.\n *\n * Custom properties or API may be added to the internal [[StateObject]] object by registering a decorator function\n * using the [[builder]] method.\n */\nexport class StateBuilder {\n /** An object that contains all the BuilderFunctions registered, key'd by the name of the State property they build */\n private builders: Builders;\n\n constructor(private matcher: StateMatcher, urlMatcherFactory: UrlMatcherFactory) {\n let self = this;\n\n const root = () => matcher.find(\"\");\n const isRoot = (state: StateObject) => state.name === \"\";\n\n function parentBuilder(state: StateObject) {\n if (isRoot(state)) return null;\n return matcher.find(self.parentName(state)) || root();\n }\n\n this.builders = {\n name: [ nameBuilder ],\n self: [ selfBuilder ],\n parent: [ parentBuilder ],\n data: [ dataBuilder ],\n // Build a URLMatcher if necessary, either via a relative or absolute URL\n url: [ getUrlBuilder(urlMatcherFactory, root) ],\n // Keep track of the closest ancestor state that has a URL (i.e. is navigable)\n navigable: [ getNavigableBuilder(isRoot) ],\n params: [ getParamsBuilder(urlMatcherFactory.paramFactory) ],\n // Each framework-specific ui-router implementation should define its own `views` builder\n // e.g., src/ng1/statebuilders/views.ts\n views: [],\n // Keep a full path from the root down to this state as this is needed for state activation.\n path: [ pathBuilder ],\n // Speed up $state.includes() as it's used a lot\n includes: [ includesBuilder ],\n resolvables: [ resolvablesBuilder ]\n };\n }\n\n /**\n * Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`).\n * More than one BuilderFunction can be registered for a given property.\n *\n * The BuilderFunction(s) will be used to define the property on any subsequently built [[StateObject]] objects.\n *\n * @param name The name of the State property being registered for.\n * @param fn The BuilderFunction which will be used to build the State property\n * @returns a function which deregisters the BuilderFunction\n */\n builder(name: string, fn: BuilderFunction): (BuilderFunction|BuilderFunction[]|Function) {\n let builders = this.builders;\n let array = builders[name] || [];\n // Backwards compat: if only one builder exists, return it, else return whole arary.\n if (isString(name) && !isDefined(fn)) return array.length > 1 ? array : array[0];\n if (!isString(name) || !isFunction(fn)) return;\n\n builders[name] = array;\n builders[name].push(fn);\n return () => builders[name].splice(builders[name].indexOf(fn, 1)) && null;\n }\n\n /**\n * Builds all of the properties on an essentially blank State object, returning a State object which has all its\n * properties and API built.\n *\n * @param state an uninitialized State object\n * @returns the built State object\n */\n build(state: StateObject): StateObject {\n let {matcher, builders} = this;\n let parent = this.parentName(state);\n\n if (parent && !matcher.find(parent, undefined, false)) {\n return null;\n }\n\n for (let key in builders) {\n if (!builders.hasOwnProperty(key)) continue;\n let chain = builders[key].reduce((parentFn: BuilderFunction, step: BuilderFunction) => (_state) => step(_state, parentFn), noop);\n state[key] = chain(state);\n }\n return state;\n }\n\n parentName(state: StateObject) {\n // name = 'foo.bar.baz.**'\n let name = state.name || \"\";\n // segments = ['foo', 'bar', 'baz', '.**']\n let segments = name.split('.');\n // segments = ['foo', 'bar', 'baz']\n let lastSegment = segments.pop();\n // segments = ['foo', 'bar'] (ignore .** segment for future states)\n if (lastSegment === '**') segments.pop();\n\n if (segments.length) {\n if (state.parent) {\n throw new Error(`States that specify the 'parent:' property should not have a '.' in their name (${name})`);\n }\n\n // 'foo.bar'\n return segments.join(\".\");\n }\n\n if (!state.parent) return \"\";\n return isString(state.parent) ? state.parent : state.parent.name;\n }\n\n name(state: StateObject) {\n let name = state.name;\n if (name.indexOf('.') !== -1 || !state.parent) return name;\n\n let parentName = isString(state.parent) ? state.parent : state.parent.name;\n return parentName ? parentName + \".\" + name : name;\n }\n}\n", - "/**\n * @coreapi\n * @module url\n */\n/** for typedoc */\nimport {\n map, defaults, inherit, identity, unnest, tail, find, Obj, pairs, allTrueR, unnestR, arrayTuples\n} from \"../common/common\";\nimport { prop, propEq } from \"../common/hof\";\nimport { isArray, isString, isDefined } from \"../common/predicates\";\nimport { Param, DefType } from \"../params/param\";\nimport { ParamTypes } from \"../params/paramTypes\";\nimport { RawParams } from \"../params/interface\";\nimport { ParamFactory } from \"./interface\";\nimport { joinNeighborsR, splitOnDelim } from \"../common/strings\";\n\n/** @hidden */\nfunction quoteRegExp(string: any, param?: any) {\n let surroundPattern = ['', ''], result = string.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, \"\\\\$&\");\n if (!param) return result;\n\n switch (param.squash) {\n case false:\n surroundPattern = ['(', ')' + (param.isOptional ? '?' : '')]; break;\n case true:\n result = result.replace(/\\/$/, '');\n surroundPattern = ['(?:\\/(', ')|\\/)?'];\n break;\n default:\n surroundPattern = [`(${param.squash}|`, ')?']; break;\n }\n return result + surroundPattern[0] + param.type.pattern.source + surroundPattern[1];\n}\n\n/** @hidden */\nconst memoizeTo = (obj: Obj, prop: string, fn: Function) =>\n obj[prop] = obj[prop] || fn();\n\n/** @hidden */\nconst splitOnSlash = splitOnDelim('/');\n\n/** @hidden */\ninterface UrlMatcherCache {\n segments?: any[];\n weights?: number[];\n path?: UrlMatcher[];\n parent?: UrlMatcher;\n pattern?: RegExp;\n}\n\n/**\n * Matches URLs against patterns.\n *\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL.\n *\n * A URL pattern consists of a path pattern, optionally followed by '?' and a list of search (query)\n * parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by [[UrlMatcher.exec]].\n *\n * - *Path parameters* are defined using curly brace placeholders (`/somepath/{param}`)\n * or colon placeholders (`/somePath/:param`).\n *\n * - *A parameter RegExp* may be defined for a param after a colon\n * (`/somePath/{param:[a-zA-Z0-9]+}`) in a curly brace placeholder.\n * The regexp must match for the url to be matched.\n * Should the regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Note: a RegExp parameter will encode its value using either [[ParamTypes.path]] or [[ParamTypes.query]].\n *\n * - *Custom parameter types* may also be specified after a colon (`/somePath/{param:int}`) in curly brace parameters.\n * See [[UrlMatcherFactory.type]] for more information.\n *\n * - *Catch-all parameters* are defined using an asterisk placeholder (`/somepath/*catchallparam`).\n * A catch-all * parameter value will contain the remainder of the URL.\n *\n * ---\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters).\n * A path parameter matches any number of characters other than '/'. For catch-all\n * placeholders the path parameter matches any number of characters.\n *\n * Examples:\n *\n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n * trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n * '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n * parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n * path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n * * `'/calendar/{start:date}'` - Matches \"/calendar/2014-11-12\" (because the pattern defined\n * in the built-in `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start\n *\n */\nexport class UrlMatcher {\n /** @hidden */\n static nameValidator: RegExp = /^\\w+([-.]+\\w+)*(?:\\[\\])?$/;\n\n /** @hidden */\n private _cache: UrlMatcherCache = { path: [this] };\n /** @hidden */\n private _children: UrlMatcher[] = [];\n /** @hidden */\n private _params: Param[] = [];\n /** @hidden */\n private _segments: string[] = [];\n /** @hidden */\n private _compiled: string[] = [];\n\n /** The pattern that was passed into the constructor */\n public pattern: string;\n\n /**\n * @param pattern The pattern to compile into a matcher.\n * @param paramTypes The [[ParamTypes]] registry\n * @param config A configuration object\n * - `caseInsensitive` - `true` if URL matching should be case insensitive, otherwise `false`, the default value (for backward compatibility) is `false`.\n * - `strict` - `false` if matching against a URL with a trailing slash should be treated as equivalent to a URL without a trailing slash, the default value is `true`.\n */\n constructor(pattern: string, paramTypes: ParamTypes, paramFactory: ParamFactory, public config?: any) {\n this.pattern = pattern;\n this.config = defaults(this.config, {\n params: {},\n strict: true,\n caseInsensitive: false,\n paramMap: identity\n });\n\n // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n // '*' name\n // ':' name\n // '{' name '}'\n // '{' name ':' regexp '}'\n // The regular expression is somewhat complicated due to the need to allow curly braces\n // inside the regular expression. The placeholder regexp breaks down as follows:\n // ([:*])([\\w\\[\\]]+) - classic placeholder ($1 / $2) (search version has - for snake-case)\n // \\{([\\w\\[\\]]+)(?:\\:\\s*( ... ))?\\} - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case\n // (?: ... | ... | ... )+ - the regexp consists of any number of atoms, an atom being either\n // [^{}\\\\]+ - anything other than curly braces or backslash\n // \\\\. - a backslash escape\n // \\{(?:[^{}\\\\]+|\\\\.)*\\} - a matched set of curly braces containing other atoms\n let placeholder = /([:*])([\\w\\[\\]]+)|\\{([\\w\\[\\]]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n searchPlaceholder = /([:]?)([\\w\\[\\].-]+)|\\{([\\w\\[\\].-]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n last = 0, m: RegExpExecArray, patterns: any[][] = [];\n\n const checkParamErrors = (id: string) => {\n if (!UrlMatcher.nameValidator.test(id)) throw new Error(`Invalid parameter name '${id}' in pattern '${pattern}'`);\n if (find(this._params, propEq('id', id))) throw new Error(`Duplicate parameter name '${id}' in pattern '${pattern}'`);\n };\n\n // Split into static segments separated by path parameter placeholders.\n // The number of segments is always 1 more than the number of parameters.\n const matchDetails = (m: RegExpExecArray, isSearch: boolean) => {\n // IE[78] returns '' for unmatched groups instead of null\n let id = m[2] || m[3];\n let regexp = isSearch ? m[4] : m[4] || (m[1] === '*' ? '[\\\\s\\\\S]*' : null);\n\n const makeRegexpType = (regexp) => inherit(paramTypes.type(isSearch ? \"query\" : \"path\"), {\n pattern: new RegExp(regexp, this.config.caseInsensitive ? 'i' : undefined)\n });\n\n return {\n id,\n regexp,\n cfg: this.config.params[id],\n segment: pattern.substring(last, m.index),\n type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp)\n };\n };\n\n let p: any, segment: string;\n\n while ((m = placeholder.exec(pattern))) {\n p = matchDetails(m, false);\n if (p.segment.indexOf('?') >= 0) break; // we're into the search part\n\n checkParamErrors(p.id);\n this._params.push(paramFactory.fromPath(p.id, p.type, this.config.paramMap(p.cfg, false)));\n this._segments.push(p.segment);\n patterns.push([p.segment, tail(this._params)]);\n last = placeholder.lastIndex;\n }\n segment = pattern.substring(last);\n\n // Find any search parameter names and remove them from the last segment\n let i = segment.indexOf('?');\n\n if (i >= 0) {\n let search = segment.substring(i);\n segment = segment.substring(0, i);\n\n if (search.length > 0) {\n last = 0;\n\n while ((m = searchPlaceholder.exec(search))) {\n p = matchDetails(m, true);\n checkParamErrors(p.id);\n this._params.push(paramFactory.fromSearch(p.id, p.type, this.config.paramMap(p.cfg, true)));\n last = placeholder.lastIndex;\n // check if ?&\n }\n }\n }\n\n this._segments.push(segment);\n this._compiled = patterns.map(pattern => quoteRegExp.apply(null, pattern)).concat(quoteRegExp(segment));\n }\n\n /**\n * Creates a new concatenated UrlMatcher\n *\n * Builds a new UrlMatcher by appending another UrlMatcher to this one.\n *\n * @param url A `UrlMatcher` instance to append as a child of the current `UrlMatcher`.\n */\n append(url: UrlMatcher): UrlMatcher {\n this._children.push(url);\n url._cache = {\n path: this._cache.path.concat(url),\n parent: this,\n pattern: null,\n };\n return url;\n }\n\n /** @hidden */\n isRoot(): boolean {\n return this._cache.path[0] === this;\n }\n\n /** Returns the input pattern string */\n toString(): string {\n return this.pattern;\n }\n\n /**\n * Tests the specified url/path against this matcher.\n *\n * Tests if the given url matches this matcher's pattern, and returns an object containing the captured\n * parameter values. Returns null if the path does not match.\n *\n * The returned object contains the values\n * of any search parameters that are mentioned in the pattern, but their value may be null if\n * they are not present in `search`. This means that search parameters are always treated\n * as optional.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', {\n * x: '1', q: 'hello'\n * });\n * // returns { id: 'bob', q: 'hello', r: null }\n * ```\n *\n * @param path The URL path to match, e.g. `$location.path()`.\n * @param search URL search parameters, e.g. `$location.search()`.\n * @param hash URL hash e.g. `$location.hash()`.\n * @param options\n *\n * @returns The captured parameter values.\n */\n exec(path: string, search: any = {}, hash?: string, options: any = {}): RawParams {\n let match = memoizeTo(this._cache, 'pattern', () => {\n return new RegExp([\n '^',\n unnest(this._cache.path.map(prop('_compiled'))).join(''),\n this.config.strict === false ? '\\/?' : '',\n '$'\n ].join(''), this.config.caseInsensitive ? 'i' : undefined);\n }).exec(path);\n\n if (!match) return null;\n\n //options = defaults(options, { isolate: false });\n\n let allParams: Param[] = this.parameters(),\n pathParams: Param[] = allParams.filter(param => !param.isSearch()),\n searchParams: Param[] = allParams.filter(param => param.isSearch()),\n nPathSegments = this._cache.path.map(urlm => urlm._segments.length - 1).reduce((a, x) => a + x),\n values: RawParams = {};\n\n if (nPathSegments !== match.length - 1)\n throw new Error(`Unbalanced capture group in route '${this.pattern}'`);\n\n function decodePathArray(string: string) {\n const reverseString = (str: string) => str.split(\"\").reverse().join(\"\");\n const unquoteDashes = (str: string) => str.replace(/\\\\-/g, \"-\");\n\n let split = reverseString(string).split(/-(?!\\\\)/);\n let allReversed = map(split, reverseString);\n return map(allReversed, unquoteDashes).reverse();\n }\n\n for (let i = 0; i < nPathSegments; i++) {\n let param: Param = pathParams[i];\n let value: (any|any[]) = match[i + 1];\n\n // if the param value matches a pre-replace pair, replace the value before decoding.\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n if (value && param.array === true) value = decodePathArray(value);\n if (isDefined(value)) value = param.type.decode(value);\n values[param.id] = param.value(value);\n }\n searchParams.forEach(param => {\n let value = search[param.id];\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n if (isDefined(value)) value = param.type.decode(value);\n values[param.id] = param.value(value);\n });\n\n if (hash) values[\"#\"] = hash;\n\n return values;\n }\n\n /**\n * @hidden\n * Returns all the [[Param]] objects of all path and search parameters of this pattern in order of appearance.\n *\n * @returns {Array.} An array of [[Param]] objects. Must be treated as read-only. If the\n * pattern has no parameters, an empty array is returned.\n */\n parameters(opts: any = {}): Param[] {\n if (opts.inherit === false) return this._params;\n return unnest(this._cache.path.map(matcher => matcher._params));\n }\n\n /**\n * @hidden\n * Returns a single parameter from this UrlMatcher by id\n *\n * @param id\n * @param opts\n * @returns {T|Param|any|boolean|UrlMatcher|null}\n */\n parameter(id: string, opts: any = {}): Param {\n const findParam = () => {\n for (let param of this._params) {\n if (param.id === id) return param;\n }\n };\n\n let parent = this._cache.parent;\n return findParam() || (opts.inherit !== false && parent && parent.parameter(id, opts)) || null;\n }\n\n /**\n * Validates the input parameter values against this UrlMatcher\n *\n * Checks an object hash of parameters to validate their correctness according to the parameter\n * types of this `UrlMatcher`.\n *\n * @param params The object hash of parameters to validate.\n * @returns Returns `true` if `params` validates, otherwise `false`.\n */\n validates(params: RawParams): boolean {\n const validParamVal = (param: Param, val: any) =>\n !param || param.validates(val);\n\n params = params || {};\n\n // I'm not sure why this checks only the param keys passed in, and not all the params known to the matcher\n let paramSchema = this.parameters().filter(paramDef => params.hasOwnProperty(paramDef.id));\n return paramSchema.map(paramDef => validParamVal(paramDef, params[paramDef.id])).reduce(allTrueR, true);\n }\n\n /**\n * Given a set of parameter values, creates a URL from this UrlMatcher.\n *\n * Creates a URL that matches this pattern by substituting the specified values\n * for the path and search parameters.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n * // returns '/user/bob?q=yes'\n * ```\n *\n * @param values the values to substitute for the parameters in this pattern.\n * @returns the formatted URL (path and optionally search part).\n */\n format(values: RawParams = {}) {\n // Build the full path of UrlMatchers (including all parent UrlMatchers)\n let urlMatchers = this._cache.path;\n\n // Extract all the static segments and Params (processed as ParamDetails)\n // into an ordered array\n let pathSegmentsAndParams: Array = urlMatchers.map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .map(x => isString(x) ? x : getDetails(x));\n\n // Extract the query params into a separate array\n let queryParams: Array = urlMatchers.map(UrlMatcher.queryParams)\n .reduce(unnestR, [])\n .map(getDetails);\n\n const isInvalid = (param: ParamDetails) => param.isValid === false;\n if (pathSegmentsAndParams.concat(queryParams).filter(isInvalid).length) {\n return null;\n }\n\n /**\n * Given a Param, applies the parameter value, then returns detailed information about it\n */\n function getDetails(param: Param): ParamDetails {\n // Normalize to typed value\n let value = param.value(values[param.id]);\n let isValid = param.validates(value);\n let isDefaultValue = param.isDefaultValue(value);\n // Check if we're in squash mode for the parameter\n let squash = isDefaultValue ? param.squash : false;\n // Allow the Parameter's Type to encode the value\n let encoded = param.type.encode(value);\n\n return { param, value, isValid, isDefaultValue, squash, encoded };\n }\n\n // Build up the path-portion from the list of static segments and parameters\n let pathString = pathSegmentsAndParams.reduce((acc: string, x: string|ParamDetails) => {\n // The element is a static segment (a raw string); just append it\n if (isString(x)) return acc + x;\n\n // Otherwise, it's a ParamDetails.\n let { squash, encoded, param } = x;\n\n // If squash is === true, try to remove a slash from the path\n if (squash === true) return (acc.match(/\\/$/)) ? acc.slice(0, -1) : acc;\n // If squash is a string, use the string for the param value\n if (isString(squash)) return acc + squash;\n if (squash !== false) return acc; // ?\n if (encoded == null) return acc;\n // If this parameter value is an array, encode the value using encodeDashes\n if (isArray(encoded)) return acc + map( encoded, UrlMatcher.encodeDashes).join(\"-\");\n // If the parameter type is \"raw\", then do not encodeURIComponent\n if (param.raw) return acc + encoded;\n // Encode the value\n return acc + encodeURIComponent( encoded);\n }, \"\");\n\n // Build the query string by applying parameter values (array or regular)\n // then mapping to key=value, then flattening and joining using \"&\"\n let queryString = queryParams.map((paramDetails: ParamDetails) => {\n let { param, squash, encoded, isDefaultValue } = paramDetails;\n if (encoded == null || (isDefaultValue && squash !== false)) return;\n if (!isArray(encoded)) encoded = [ encoded];\n if (encoded.length === 0) return;\n if (!param.raw) encoded = map( encoded, encodeURIComponent);\n\n return ( encoded).map(val => `${param.id}=${val}`);\n }).filter(identity).reduce(unnestR, []).join(\"&\");\n\n // Concat the pathstring with the queryString (if exists) and the hashString (if exists)\n return pathString + (queryString ? `?${queryString}` : \"\") + (values[\"#\"] ? \"#\" + values[\"#\"] : \"\");\n }\n\n /** @hidden */\n static encodeDashes(str: string) { // Replace dashes with encoded \"\\-\"\n return encodeURIComponent(str).replace(/-/g, c => `%5C%${c.charCodeAt(0).toString(16).toUpperCase()}`);\n }\n\n /** @hidden Given a matcher, return an array with the matcher's path segments and path params, in order */\n static pathSegmentsAndParams(matcher: UrlMatcher) {\n let staticSegments = matcher._segments;\n let pathParams = matcher._params.filter(p => p.location === DefType.PATH);\n return arrayTuples(staticSegments, pathParams.concat(undefined))\n .reduce(unnestR, [])\n .filter(x => x !== \"\" && isDefined(x));\n }\n\n /** @hidden Given a matcher, return an array with the matcher's query params */\n static queryParams(matcher: UrlMatcher): Param[] {\n return matcher._params.filter(p => p.location === DefType.SEARCH);\n }\n\n /**\n * Compare two UrlMatchers\n *\n * This comparison function converts a UrlMatcher into static and dynamic path segments.\n * Each static path segment is a static string between a path separator (slash character).\n * Each dynamic segment is a path parameter.\n *\n * The comparison function sorts static segments before dynamic ones.\n */\n static compare(a: UrlMatcher, b: UrlMatcher): number {\n /**\n * Turn a UrlMatcher and all its parent matchers into an array\n * of slash literals '/', string literals, and Param objects\n *\n * This example matcher matches strings like \"/foo/:param/tail\":\n * var matcher = $umf.compile(\"/foo\").append($umf.compile(\"/:param\")).append($umf.compile(\"/\")).append($umf.compile(\"tail\"));\n * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ]\n *\n * Caches the result as `matcher._cache.segments`\n */\n const segments = (matcher: UrlMatcher) =>\n matcher._cache.segments = matcher._cache.segments ||\n matcher._cache.path.map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .reduce(joinNeighborsR, [])\n .map(x => isString(x) ? splitOnSlash(x) : x)\n .reduce(unnestR, []);\n\n /**\n * Gets the sort weight for each segment of a UrlMatcher\n *\n * Caches the result as `matcher._cache.weights`\n */\n const weights = (matcher: UrlMatcher) =>\n matcher._cache.weights = matcher._cache.weights ||\n segments(matcher).map(segment => {\n // Sort slashes first, then static strings, the Params\n if (segment === '/') return 1;\n if (isString(segment)) return 2;\n if (segment instanceof Param) return 3;\n });\n\n /**\n * Pads shorter array in-place (mutates)\n */\n const padArrays = (l: any[], r: any[], padVal: any) => {\n const len = Math.max(l.length, r.length);\n while (l.length < len) l.push(padVal);\n while (r.length < len) r.push(padVal);\n };\n\n const weightsA = weights(a), weightsB = weights(b);\n padArrays(weightsA, weightsB, 0);\n let cmp, i, pairs = arrayTuples(weightsA, weightsB);\n\n for (i = 0; i < pairs.length; i++) {\n cmp = pairs[i][0] - pairs[i][1];\n if (cmp !== 0) return cmp;\n }\n\n return 0;\n }\n}\n\n/** @hidden */\ninterface ParamDetails {\n param: Param;\n value: any;\n isValid: boolean;\n isDefaultValue: boolean;\n squash: (boolean|string);\n encoded: (string|string[]);\n}\n", - "/**\n * @internalapi\n * @module url\n */\n/** for typedoc */\nimport { createProxyFunctions, extend, removeFrom } from '../common/common';\nimport { isDefined, isFunction, isString } from '../common/predicates';\nimport { UrlMatcher } from './urlMatcher';\nimport { RawParams } from '../params/interface';\nimport { Disposable } from '../interface';\nimport { UIRouter } from '../router';\nimport { is, pattern, val } from '../common/hof';\nimport { UrlRuleFactory } from './urlRule';\nimport { TargetState } from '../state/targetState';\nimport { MatcherUrlRule, MatchResult, UrlParts, UrlRule, UrlRuleHandlerFn, UrlRuleMatchFn, UrlRulesApi, UrlSyncApi, } from './interface';\nimport { TargetStateDef } from '../state/interface';\nimport { stripLastPathElement } from '../common';\n\n/** @hidden */\nfunction appendBasePath(url: string, isHtml5: boolean, absolute: boolean, baseHref: string): string {\n if (baseHref === '/') return url;\n if (isHtml5) return stripLastPathElement(baseHref) + url;\n if (absolute) return baseHref.slice(1) + url;\n return url;\n}\n\n/** @hidden */\nconst prioritySort = (a: UrlRule, b: UrlRule) =>\n (b.priority || 0) - (a.priority || 0);\n\n/** @hidden */\nconst typeSort = (a: UrlRule, b: UrlRule) => {\n const weights = { \"STATE\": 4, \"URLMATCHER\": 4, \"REGEXP\": 3, \"RAW\": 2, \"OTHER\": 1 };\n return (weights[a.type] || 0) - (weights[b.type] || 0);\n};\n\n/** @hidden */\nconst urlMatcherSort = (a: MatcherUrlRule, b: MatcherUrlRule) =>\n !a.urlMatcher || !b.urlMatcher ? 0 : UrlMatcher.compare(a.urlMatcher, b.urlMatcher);\n\n/** @hidden */\nconst idSort = (a: UrlRule, b: UrlRule) => {\n // Identically sorted STATE and URLMATCHER best rule will be chosen by `matchPriority` after each rule matches the URL\n const useMatchPriority = { STATE: true, URLMATCHER: true };\n const equal = useMatchPriority[a.type] && useMatchPriority[b.type];\n return equal ? 0 : (a.$id || 0) - (b.$id || 0);\n};\n\n/**\n * Default rule priority sorting function.\n *\n * Sorts rules by:\n *\n * - Explicit priority (set rule priority using [[UrlRulesApi.when]])\n * - Rule type (STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1)\n * - `UrlMatcher` specificity ([[UrlMatcher.compare]]): works for STATE and URLMATCHER types to pick the most specific rule.\n * - Rule registration order (for rule types other than STATE and URLMATCHER)\n * - Equally sorted State and UrlMatcher rules will each match the URL.\n * Then, the *best* match is chosen based on how many parameter values were matched.\n *\n * @coreapi\n */\nlet defaultRuleSortFn: (a: UrlRule, b: UrlRule) => number;\ndefaultRuleSortFn = (a, b) => {\n let cmp = prioritySort(a, b);\n if (cmp !== 0) return cmp;\n\n cmp = typeSort(a, b);\n if (cmp !== 0) return cmp;\n\n cmp = urlMatcherSort(a as MatcherUrlRule, b as MatcherUrlRule);\n if (cmp !== 0) return cmp;\n\n return idSort(a, b);\n};\n\n/**\n * Updates URL and responds to URL changes\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class updates the URL when the state changes.\n * It also responds to changes in the URL.\n */\nexport class UrlRouter implements UrlRulesApi, UrlSyncApi, Disposable {\n /** used to create [[UrlRule]] objects for common cases */\n public urlRuleFactory: UrlRuleFactory;\n\n /** @hidden */ private _router: UIRouter;\n /** @hidden */ private location: string;\n /** @hidden */ private _sortFn = defaultRuleSortFn;\n /** @hidden */ private _stopFn: Function;\n /** @hidden */ _rules: UrlRule[] = [];\n /** @hidden */ private _otherwiseFn: UrlRule;\n /** @hidden */ interceptDeferred = false;\n /** @hidden */ private _id = 0;\n /** @hidden */ private _sorted = false;\n\n /** @hidden */\n constructor(router: UIRouter) {\n this._router = router;\n this.urlRuleFactory = new UrlRuleFactory(router);\n createProxyFunctions(val(UrlRouter.prototype), this, val(this));\n }\n\n /** @internalapi */\n dispose() {\n this.listen(false);\n this._rules = [];\n delete this._otherwiseFn;\n }\n\n /** @inheritdoc */\n sort(compareFn?: (a: UrlRule, b: UrlRule) => number) {\n this._rules = this.stableSort(this._rules, this._sortFn = compareFn || this._sortFn);\n this._sorted = true;\n }\n\n private ensureSorted() {\n this._sorted || this.sort();\n }\n\n private stableSort(arr, compareFn) {\n const arrOfWrapper = arr.map((elem, idx) => ({ elem, idx }));\n\n arrOfWrapper.sort((wrapperA, wrapperB) => {\n const cmpDiff = compareFn(wrapperA.elem, wrapperB.elem);\n return cmpDiff === 0\n ? wrapperA.idx - wrapperB.idx\n : cmpDiff;\n });\n\n return arrOfWrapper.map(wrapper => wrapper.elem);\n }\n\n /**\n * Given a URL, check all rules and return the best [[MatchResult]]\n * @param url\n * @returns {MatchResult}\n */\n match(url: UrlParts): MatchResult {\n this.ensureSorted();\n\n url = extend({path: '', search: {}, hash: '' }, url);\n let rules = this.rules();\n if (this._otherwiseFn) rules.push(this._otherwiseFn);\n\n // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined\n\n let checkRule = (rule: UrlRule): MatchResult => {\n let match = rule.match(url, this._router);\n return match && { match, rule, weight: rule.matchPriority(match) };\n };\n\n // The rules are pre-sorted.\n // - Find the first matching rule.\n // - Find any other matching rule that sorted *exactly the same*, according to `.sort()`.\n // - Choose the rule with the highest match weight.\n let best: MatchResult;\n for (let i = 0; i < rules.length; i++) {\n // Stop when there is a 'best' rule and the next rule sorts differently than it.\n if (best && this._sortFn(rules[i], best.rule) !== 0) break;\n\n let current = checkRule(rules[i]);\n // Pick the best MatchResult\n best = (!best || current && current.weight > best.weight) ? current : best;\n }\n\n return best;\n }\n\n /** @inheritdoc */\n sync(evt?) {\n if (evt && evt.defaultPrevented) return;\n\n let router = this._router,\n $url = router.urlService,\n $state = router.stateService;\n\n let url: UrlParts = {\n path: $url.path(), search: $url.search(), hash: $url.hash(),\n };\n\n let best = this.match(url);\n\n let applyResult = pattern([\n [isString, (newurl: string) => $url.url(newurl, true)],\n [TargetState.isDef, (def: TargetStateDef) => $state.go(def.state, def.params, def.options)],\n [is(TargetState), (target: TargetState) => $state.go(target.state(), target.params(), target.options())],\n ]);\n\n applyResult(best && best.rule.handler(best.match, url, router));\n }\n\n /** @inheritdoc */\n listen(enabled?: boolean): Function {\n if (enabled === false) {\n this._stopFn && this._stopFn();\n delete this._stopFn;\n } else {\n return this._stopFn = this._stopFn || this._router.urlService.onChange(evt => this.sync(evt));\n }\n }\n\n /**\n * Internal API.\n * @internalapi\n */\n update(read?: boolean) {\n let $url = this._router.locationService;\n if (read) {\n this.location = $url.url();\n return;\n }\n if ($url.url() === this.location) return;\n\n $url.url(this.location, true);\n }\n\n /**\n * Internal API.\n *\n * Pushes a new location to the browser history.\n *\n * @internalapi\n * @param urlMatcher\n * @param params\n * @param options\n */\n push(urlMatcher: UrlMatcher, params?: RawParams, options?: { replace?: (string|boolean) }) {\n let replace = options && !!options.replace;\n this._router.urlService.url(urlMatcher.format(params || {}), replace);\n }\n\n /**\n * Builds and returns a URL with interpolated parameters\n *\n * #### Example:\n * ```js\n * matcher = $umf.compile(\"/about/:person\");\n * params = { person: \"bob\" };\n * $bob = $urlRouter.href(matcher, params);\n * // $bob == \"/about/bob\";\n * ```\n *\n * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate.\n * @param params An object of parameter values to fill the matcher's required parameters.\n * @param options Options object. The options are:\n *\n * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n *\n * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`\n */\n href(urlMatcher: UrlMatcher, params?: any, options?: { absolute: boolean }): string {\n let url = urlMatcher.format(params);\n if (url == null) return null;\n\n options = options || { absolute: false };\n\n let cfg = this._router.urlService.config;\n let isHtml5 = cfg.html5Mode();\n if (!isHtml5 && url !== null) {\n url = \"#\" + cfg.hashPrefix() + url;\n }\n url = appendBasePath(url, isHtml5, options.absolute, cfg.baseHref());\n\n if (!options.absolute || !url) {\n return url;\n }\n\n let slash = (!isHtml5 && url ? '/' : ''), port = cfg.port();\n port = (port === 80 || port === 443 ? '' : ':' + port);\n\n return [cfg.protocol(), '://', cfg.host(), port, slash, url].join('');\n }\n\n\n /**\n * Manually adds a URL Rule.\n *\n * Usually, a url rule is added using [[StateDeclaration.url]] or [[when]].\n * This api can be used directly for more control (to register a [[BaseUrlRule]], for example).\n * Rules can be created using [[UrlRouter.urlRuleFactory]], or create manually as simple objects.\n *\n * A rule should have a `match` function which returns truthy if the rule matched.\n * It should also have a `handler` function which is invoked if the rule is the best match.\n *\n * @return a function that deregisters the rule\n */\n rule(rule: UrlRule): Function {\n if (!UrlRuleFactory.isUrlRule(rule)) throw new Error(\"invalid rule\");\n rule.$id = this._id++;\n rule.priority = rule.priority || 0;\n\n this._rules.push(rule);\n this._sorted = false;\n\n return () => this.removeRule(rule);\n }\n\n /** @inheritdoc */\n removeRule(rule): void {\n removeFrom(this._rules, rule);\n }\n\n /** @inheritdoc */\n rules(): UrlRule[] {\n this.ensureSorted();\n return this._rules.slice();\n }\n\n /** @inheritdoc */\n otherwise(handler: string|UrlRuleHandlerFn|TargetState|TargetStateDef) {\n let handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n this._otherwiseFn = this.urlRuleFactory.create(val(true), handlerFn);\n this._sorted = false;\n };\n\n /** @inheritdoc */\n initial(handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef) {\n let handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n let matchFn: UrlRuleMatchFn = (urlParts, router) =>\n router.globals.transitionHistory.size() === 0 && !!/^\\/?$/.exec(urlParts.path);\n\n this.rule(this.urlRuleFactory.create(matchFn, handlerFn));\n };\n\n /** @inheritdoc */\n when(matcher: (RegExp|UrlMatcher|string), handler: string|UrlRuleHandlerFn, options?: { priority: number }): UrlRule {\n let rule = this.urlRuleFactory.create(matcher, handler);\n if (isDefined(options && options.priority)) rule.priority = options.priority;\n this.rule(rule);\n return rule;\n };\n\n /** @inheritdoc */\n deferIntercept(defer?: boolean) {\n if (defer === undefined) defer = true;\n this.interceptDeferred = defer;\n };\n}\n\nfunction getHandlerFn(handler: string|UrlRuleHandlerFn|TargetState|TargetStateDef): UrlRuleHandlerFn {\n if (!isFunction(handler) && !isString(handler) && !is(TargetState)(handler) && !TargetState.isDef(handler)) {\n throw new Error(\"'handler' must be a string, function, TargetState, or have a state: 'newtarget' property\");\n }\n return isFunction(handler) ? handler as UrlRuleHandlerFn : val(handler);\n}\n", - "/** @module hooks */ /** */\nimport { Transition } from \"../transition/transition\";\nimport { UIRouter } from \"../router\";\nimport { TransitionService } from \"../transition/transitionService\";\n\nfunction addCoreResolvables(trans: Transition) {\n trans.addResolvable({ token: UIRouter, deps: [], resolveFn: () => trans.router, data: trans.router }, \"\");\n trans.addResolvable({ token: Transition, deps: [], resolveFn: () => trans, data: trans }, \"\");\n trans.addResolvable({ token: '$transition$', deps: [], resolveFn: () => trans, data: trans }, \"\");\n trans.addResolvable({ token: '$stateParams', deps: [], resolveFn: () => trans.params(), data: trans.params() }, \"\");\n\n trans.entering().forEach(state => {\n trans.addResolvable({ token: '$state$', deps: [], resolveFn: () => state, data: state }, state);\n });\n}\n\nexport const registerAddCoreResolvables = (transitionService: TransitionService) =>\n transitionService.onCreate({}, addCoreResolvables);\n", - "/** @module hooks */\n/** for typedoc */\nimport { TransitionStateHookFn } from '../transition/interface';\nimport { Transition } from '../transition/transition';\nimport { TransitionService } from '../transition/transitionService';\nimport { StateDeclaration } from '../state/interface';\nimport { StateObject } from '../state/stateObject';\n\n/**\n * A factory which creates an onEnter, onExit or onRetain transition hook function\n *\n * The returned function invokes the (for instance) state.onEnter hook when the\n * state is being entered.\n *\n * @hidden\n */\nfunction makeEnterExitRetainHook(hookName: string): TransitionStateHookFn {\n return (transition: Transition, state: StateDeclaration) => {\n let _state: StateObject = state.$$state();\n let hookFn: TransitionStateHookFn = _state[hookName];\n return hookFn(transition, state);\n }\n}\n\n/**\n * The [[TransitionStateHookFn]] for onExit\n *\n * When the state is being exited, the state's .onExit function is invoked.\n *\n * Registered using `transitionService.onExit({ exiting: (state) => !!state.onExit }, onExitHook);`\n *\n * See: [[IHookRegistry.onExit]]\n */\nconst onExitHook: TransitionStateHookFn = makeEnterExitRetainHook('onExit');\nexport const registerOnExitHook = (transitionService: TransitionService) =>\n transitionService.onExit({exiting: state => !!state.onExit}, onExitHook);\n\n/**\n * The [[TransitionStateHookFn]] for onRetain\n *\n * When the state was already entered, and is not being exited or re-entered, the state's .onRetain function is invoked.\n *\n * Registered using `transitionService.onRetain({ retained: (state) => !!state.onRetain }, onRetainHook);`\n *\n * See: [[IHookRegistry.onRetain]]\n */\nconst onRetainHook: TransitionStateHookFn = makeEnterExitRetainHook('onRetain');\nexport const registerOnRetainHook = (transitionService: TransitionService) =>\n transitionService.onRetain({retained: state => !!state.onRetain}, onRetainHook);\n\n/**\n * The [[TransitionStateHookFn]] for onEnter\n *\n * When the state is being entered, the state's .onEnter function is invoked.\n *\n * Registered using `transitionService.onEnter({ entering: (state) => !!state.onEnter }, onEnterHook);`\n *\n * See: [[IHookRegistry.onEnter]]\n */\nconst onEnterHook: TransitionStateHookFn = makeEnterExitRetainHook('onEnter');\nexport const registerOnEnterHook = (transitionService: TransitionService) =>\n transitionService.onEnter({entering: state => !!state.onEnter}, onEnterHook);\n\n", - "/** @module hooks */ /** */\nimport {Transition} from \"../transition/transition\";\nimport {TransitionService} from \"../transition/transitionService\";\nimport {TransitionHookFn} from \"../transition/interface\";\nimport {StateDeclaration, LazyLoadResult} from \"../state/interface\";\nimport {services} from \"../common/coreservices\";\nimport { StateRule } from \"../url/interface\";\n\n/**\n * A [[TransitionHookFn]] that performs lazy loading\n *\n * When entering a state \"abc\" which has a `lazyLoad` function defined:\n * - Invoke the `lazyLoad` function (unless it is already in process)\n * - Flag the hook function as \"in process\"\n * - The function should return a promise (that resolves when lazy loading is complete)\n * - Wait for the promise to settle\n * - If the promise resolves to a [[LazyLoadResult]], then register those states\n * - Flag the hook function as \"not in process\"\n * - If the hook was successful\n * - Remove the `lazyLoad` function from the state declaration\n * - If all the hooks were successful\n * - Retry the transition (by returning a TargetState)\n *\n * ```\n * .state('abc', {\n * component: 'fooComponent',\n * lazyLoad: () => System.import('./fooComponent')\n * });\n * ```\n *\n * See [[StateDeclaration.lazyLoad]]\n */\nconst lazyLoadHook: TransitionHookFn = (transition: Transition) => {\n let router = transition.router;\n\n function retryTransition() {\n if (transition.originalTransition().options().source !== 'url') {\n // The original transition was not triggered via url sync\n // The lazy state should be loaded now, so re-try the original transition\n let orig = transition.targetState();\n return router.stateService.target(orig.identifier(), orig.params(), orig.options());\n }\n\n // The original transition was triggered via url sync\n // Run the URL rules and find the best match\n let $url = router.urlService;\n let result = $url.match($url.parts());\n let rule = result && result.rule;\n\n // If the best match is a state, redirect the transition (instead\n // of calling sync() which supersedes the current transition)\n if (rule && rule.type === \"STATE\") {\n let state = (rule as StateRule).state;\n let params = result.match;\n return router.stateService.target(state, params, transition.options());\n }\n\n // No matching state found, so let .sync() choose the best non-state match/otherwise\n router.urlService.sync();\n }\n\n let promises = transition.entering()\n .filter(state => !!state.$$state().lazyLoad)\n .map(state => lazyLoadState(transition, state));\n\n return services.$q.all(promises).then(retryTransition);\n};\n\nexport const registerLazyLoadHook = (transitionService: TransitionService) =>\n transitionService.onBefore({ entering: (state) => !!state.lazyLoad }, lazyLoadHook);\n\n\n/**\n * Invokes a state's lazy load function\n *\n * @param transition a Transition context\n * @param state the state to lazy load\n * @returns A promise for the lazy load result\n */\nexport function lazyLoadState(transition: Transition, state: StateDeclaration): Promise {\n let lazyLoadFn = state.$$state().lazyLoad;\n\n // Store/get the lazy load promise on/from the hookfn so it doesn't get re-invoked\n let promise = lazyLoadFn['_promise'];\n if (!promise) {\n const success = (result) => {\n delete state.lazyLoad;\n delete state.$$state().lazyLoad;\n delete lazyLoadFn['_promise'];\n return result;\n };\n\n const error = (err) => {\n delete lazyLoadFn['_promise'];\n return services.$q.reject(err);\n };\n\n promise = lazyLoadFn['_promise'] =\n services.$q.when(lazyLoadFn(transition, state))\n .then(updateStateRegistry)\n .then(success, error);\n }\n\n /** Register any lazy loaded state definitions */\n function updateStateRegistry(result: LazyLoadResult) {\n if (result && Array.isArray(result.states)) {\n result.states.forEach(state => transition.router.stateRegistry.register(state));\n }\n return result;\n }\n\n return promise;\n}\n", + "/**\n * Higher order functions\n *\n * These utility functions are exported, but are subject to change without notice.\n *\n * @module common_hof\n */ /** */\n\nimport { Predicate } from './common';\n/**\n * Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function.\n *\n * Given a function with N parameters, returns a new function that supports partial application.\n * The new function accepts anywhere from 1 to N parameters. When that function is called with M parameters,\n * where M is less than N, it returns a new function that accepts the remaining parameters. It continues to\n * accept more parameters until all N parameters have been supplied.\n *\n *\n * This contrived example uses a partially applied function as an predicate, which returns true\n * if an object is found in both arrays.\n * @example\n * ```\n * // returns true if an object is in both of the two arrays\n * function inBoth(array1, array2, object) {\n * return array1.indexOf(object) !== -1 &&\n * array2.indexOf(object) !== 1;\n * }\n * let obj1, obj2, obj3, obj4, obj5, obj6, obj7\n * let foos = [obj1, obj3]\n * let bars = [obj3, obj4, obj5]\n *\n * // A curried \"copy\" of inBoth\n * let curriedInBoth = curry(inBoth);\n * // Partially apply both the array1 and array2\n * let inFoosAndBars = curriedInBoth(foos, bars);\n *\n * // Supply the final argument; since all arguments are\n * // supplied, the original inBoth function is then called.\n * let obj1InBoth = inFoosAndBars(obj1); // false\n *\n * // Use the inFoosAndBars as a predicate.\n * // Filter, on each iteration, supplies the final argument\n * let allObjs = [ obj1, obj2, obj3, obj4, obj5, obj6, obj7 ];\n * let foundInBoth = allObjs.filter(inFoosAndBars); // [ obj3 ]\n *\n * ```\n *\n * Stolen from: http://stackoverflow.com/questions/4394747/javascript-curry-function\n *\n * @param fn\n * @returns {*|function(): (*|any)}\n */\nexport function curry(fn: Function): Function {\n const initial_args = [].slice.apply(arguments, [1]);\n const func_args_length = fn.length;\n\n function curried(args: any[]) {\n if (args.length >= func_args_length)\n return fn.apply(null, args);\n return function () {\n return curried(args.concat([].slice.apply(arguments)));\n };\n }\n return curried(initial_args);\n}\n\n\n\n/**\n * Given a varargs list of functions, returns a function that composes the argument functions, right-to-left\n * given: f(x), g(x), h(x)\n * let composed = compose(f,g,h)\n * then, composed is: f(g(h(x)))\n */\nexport function compose() {\n const args = arguments;\n const start = args.length - 1;\n return function() {\n let i = start, result = args[start].apply(this, arguments);\n while (i--) result = args[i].call(this, result);\n return result;\n };\n}\n\n/**\n * Given a varargs list of functions, returns a function that is composes the argument functions, left-to-right\n * given: f(x), g(x), h(x)\n * let piped = pipe(f,g,h);\n * then, piped is: h(g(f(x)))\n */\nexport function pipe(...funcs: Function[]): (obj: any) => any {\n return compose.apply(null, [].slice.call(arguments).reverse());\n}\n\n/**\n * Given a property name, returns a function that returns that property from an object\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = prop(\"name\");\n * getName(obj) === \"blarg\"\n */\nexport const prop = (name: string) =>\n (obj: any) => obj && obj[name];\n\n/**\n * Given a property name and a value, returns a function that returns a boolean based on whether\n * the passed object has a property that matches the value\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = propEq(\"name\", \"blarg\");\n * getName(obj) === true\n */\nexport const propEq = curry((name: string, _val: any, obj: any) => obj && obj[name] === _val);\n\n/**\n * Given a dotted property name, returns a function that returns a nested property from an object, or undefined\n * let obj = { id: 1, nestedObj: { foo: 1, name: \"blarg\" }, };\n * let getName = prop(\"nestedObj.name\");\n * getName(obj) === \"blarg\"\n * let propNotFound = prop(\"this.property.doesnt.exist\");\n * propNotFound(obj) === undefined\n */\nexport const parse = (name: string) =>\n pipe.apply(null, name.split('.').map(prop));\n\n/**\n * Given a function that returns a truthy or falsey value, returns a\n * function that returns the opposite (falsey or truthy) value given the same inputs\n */\nexport const not: (fn: Predicate) => Predicate = (fn: Predicate) =>\n (...args: any[]) => !fn.apply(null, args);\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if both functions return truthy for the given arguments\n */\nexport function and(fn1: Predicate, fn2: Predicate): Predicate {\n return (...args: any[]) => fn1.apply(null, args) && fn2.apply(null, args);\n}\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if at least one of the functions returns truthy for the given arguments\n */\nexport function or(fn1: Predicate, fn2: Predicate): Predicate {\n return (...args: any[]) => fn1.apply(null, args) || fn2.apply(null, args);\n}\n\n/**\n * Check if all the elements of an array match a predicate function\n *\n * @param fn1 a predicate function `fn1`\n * @returns a function which takes an array and returns true if `fn1` is true for all elements of the array\n */\nexport const all = (fn1: Predicate) =>\n (arr: any[]) => arr.reduce((b, x) => b && !!fn1(x), true) as boolean;\n\n// tslint:disable-next-line:variable-name\nexport const any = (fn1: Predicate) =>\n (arr: any[]) => arr.reduce((b, x) => b || !!fn1(x), false) as boolean;\n\n/** Given a class, returns a Predicate function that returns true if the object is of that class */\nexport const is = (ctor: { new(...args): T }) =>\n (obj: any): obj is T =>\n (obj != null && obj.constructor === ctor || obj instanceof ctor);\n\n/** Given a value, returns a Predicate function that returns true if another value is === equal to the original value */\nexport const eq: (comp: any) => Predicate = (value: any) => (other: any) =>\n value === other;\n\n/** Given a value, returns a function which returns the value */\nexport const val = (v: T) => () => v;\n\n\n\nexport function invoke(fnName: string): Function;\nexport function invoke(fnName: string, args: any[]): Function;\nexport function invoke(fnName: string, args?: any[]): Function {\n return (obj: any) =>\n obj[fnName].apply(obj, args);\n}\n\n/**\n * Sorta like Pattern Matching (a functional programming conditional construct)\n *\n * See http://c2.com/cgi/wiki?PatternMatching\n *\n * This is a conditional construct which allows a series of predicates and output functions\n * to be checked and then applied. Each predicate receives the input. If the predicate\n * returns truthy, then its matching output function (mapping function) is provided with\n * the input and, then the result is returned.\n *\n * Each combination (2-tuple) of predicate + output function should be placed in an array\n * of size 2: [ predicate, mapFn ]\n *\n * These 2-tuples should be put in an outer array.\n *\n * @example\n * ```\n *\n * // Here's a 2-tuple where the first element is the isString predicate\n * // and the second element is a function that returns a description of the input\n * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];\n *\n * // Second tuple: predicate \"isNumber\", mapfn returns a description\n * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];\n *\n * let third = [ (input) => input === null, (input) => `Oh, null...` ];\n *\n * let fourth = [ (input) => input === undefined, (input) => `notdefined` ];\n *\n * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);\n *\n * console.log(descriptionOf(undefined)); // 'notdefined'\n * console.log(descriptionOf(55)); // '(55) That's a number!'\n * console.log(descriptionOf(\"foo\")); // 'Here's your string foo'\n * ```\n *\n * @param struct A 2D array. Each element of the array should be an array, a 2-tuple,\n * with a Predicate and a mapping/output function\n * @returns {function(any): *}\n */\nexport function pattern(struct: Function[][]): Function {\n return function(x: any) {\n for (let i = 0; i < struct.length; i++) {\n if (struct[i][0](x)) return struct[i][1](x);\n }\n };\n}\n\n", + "/** Predicates\n *\n * These predicates return true/false based on the input.\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_predicates\n */\n/** */\nimport { and, not, pipe, prop, or } from './hof';\nimport { Predicate } from './common'; // has or is using\nimport { StateObject } from '../state/stateObject';\n\nconst toStr = Object.prototype.toString;\nconst tis = (t: string) => (x: any) => typeof(x) === t;\nexport const isUndefined = tis('undefined');\nexport const isDefined = not(isUndefined);\nexport const isNull = (o: any) => o === null;\nexport const isNullOrUndefined = or(isNull, isUndefined);\nexport const isFunction: (x: any) => x is Function = tis('function');\nexport const isNumber: (x: any) => x is number = tis('number');\nexport const isString = <(x: any) => x is string> tis('string');\nexport const isObject = (x: any) => x !== null && typeof x === 'object';\nexport const isArray = Array.isArray;\nexport const isDate: (x: any) => x is Date = ((x: any) => toStr.call(x) === '[object Date]');\nexport const isRegExp: (x: any) => x is RegExp = ((x: any) => toStr.call(x) === '[object RegExp]');\nexport const isState: (x: any) => x is StateObject = StateObject.isState;\n\n/**\n * Predicate which checks if a value is injectable\n *\n * A value is \"injectable\" if it is a function, or if it is an ng1 array-notation-style array\n * where all the elements in the array are Strings, except the last one, which is a Function\n */\nexport function isInjectable(val: any) {\n if (isArray(val) && val.length) {\n const head = val.slice(0, -1), tail = val.slice(-1);\n return !(head.filter(not(isString)).length || tail.filter(not(isFunction)).length);\n }\n return isFunction(val);\n}\n\n/**\n * Predicate which checks if a value looks like a Promise\n *\n * It is probably a Promise if it's an object, and it has a `then` property which is a Function\n */\nexport const isPromise = <(x: any) => x is Promise> and(isObject, pipe(prop('then'), isFunction));\n\n", + "/**\n * Random utility functions used in the UI-Router code\n *\n * These functions are exported, but are subject to change without notice.\n *\n * @preferred\n * @module common\n */\n/** for typedoc */\nimport { isFunction, isString, isArray, isRegExp, isDate } from './predicates';\nimport { all, any, prop, curry, not } from './hof';\nimport { services } from './coreservices';\nimport { StateObject } from '../state/stateObject';\n\ndeclare const global;\nexport const root: any = (typeof self === 'object' && self.self === self && self) ||\n (typeof global === 'object' && global.global === global && global) || this;\nconst angular = root.angular || {};\n\nexport const fromJson = angular.fromJson || JSON.parse.bind(JSON);\nexport const toJson = angular.toJson || JSON.stringify.bind(JSON);\nexport const forEach = angular.forEach || _forEach;\nexport const extend = Object.assign || _extend;\nexport const equals = angular.equals || _equals;\nexport function identity(x: any) { return x; }\nexport function noop(): any {}\n\nexport type Mapper = (x: X, key?: (string|number)) => T;\nexport interface TypedMap { [key: string]: T; }\nexport type Predicate = (x?: X) => boolean;\n/**\n * An ng1-style injectable\n *\n * This could be a (non-minified) function such as:\n * ```js\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an explicitly annotated function (minify safe)\n * ```js\n * injectableFunction.$inject = [ 'SomeDependency' ];\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an array style annotated function (minify safe)\n * ```js\n * ['SomeDependency', function injectableFunction(SomeDependency) {\n *\n * }];\n * ```\n *\n * @publicapi\n */\nexport type IInjectable = (Function|any[]);\n\nexport interface Obj extends Object {\n [key: string]: any;\n}\n\n/**\n * Builds proxy functions on the `to` object which pass through to the `from` object.\n *\n * For each key in `fnNames`, creates a proxy function on the `to` object.\n * The proxy function calls the real function on the `from` object.\n *\n *\n * #### Example:\n * This example creates an new class instance whose functions are prebound to the new'd object.\n * ```js\n * class Foo {\n * constructor(data) {\n * // Binds all functions from Foo.prototype to 'this',\n * // then copies them to 'this'\n * bindFunctions(Foo.prototype, this, this);\n * this.data = data;\n * }\n *\n * log() {\n * console.log(this.data);\n * }\n * }\n *\n * let myFoo = new Foo([1,2,3]);\n * var logit = myFoo.log;\n * logit(); // logs [1, 2, 3] from the myFoo 'this' instance\n * ```\n *\n * #### Example:\n * This example creates a bound version of a service function, and copies it to another object\n * ```\n *\n * var SomeService = {\n * this.data = [3, 4, 5];\n * this.log = function() {\n * console.log(this.data);\n * }\n * }\n *\n * // Constructor fn\n * function OtherThing() {\n * // Binds all functions from SomeService to SomeService,\n * // then copies them to 'this'\n * bindFunctions(SomeService, this, SomeService);\n * }\n *\n * let myOtherThing = new OtherThing();\n * myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this'\n * ```\n *\n * @param source A function that returns the source object which contains the original functions to be bound\n * @param target A function that returns the target object which will receive the bound functions\n * @param bind A function that returns the object which the functions will be bound to\n * @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object)\n * @param latebind If true, the binding of the function is delayed until the first time it's invoked\n */\nexport function createProxyFunctions(source: Function, target: Obj, bind: Function, fnNames?: string[], latebind = false): Obj {\n const bindFunction = (fnName) =>\n source()[fnName].bind(bind());\n\n const makeLateRebindFn = fnName => function lateRebindFunction() {\n target[fnName] = bindFunction(fnName);\n return target[fnName].apply(null, arguments);\n };\n\n fnNames = fnNames || Object.keys(source());\n\n return fnNames.reduce((acc, name) => {\n acc[name] = latebind ? makeLateRebindFn(name) : bindFunction(name);\n return acc;\n }, target);\n}\n\n\n/**\n * prototypal inheritance helper.\n * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it\n */\nexport const inherit = (parent: Obj, extra?: Obj) =>\n extend(Object.create(parent), extra);\n\n/** Given an array, returns true if the object is found in the array, (using indexOf) */\nexport const inArray: typeof _inArray = curry(_inArray) as any;\nexport function _inArray(array: any[], obj: any): boolean;\nexport function _inArray(array: any[]): (obj: any) => boolean;\nexport function _inArray(array, obj?): any {\n return array.indexOf(obj) !== -1;\n}\n\n/**\n * Given an array, and an item, if the item is found in the array, it removes it (in-place).\n * The same array is returned\n */\nexport const removeFrom: typeof _removeFrom = curry(_removeFrom) as any;\nexport function _removeFrom(array: T[], obj: T): T[];\nexport function _removeFrom(array: T[]): (obj: T) => T[];\nexport function _removeFrom(array, obj?) {\n const idx = array.indexOf(obj);\n if (idx >= 0) array.splice(idx, 1);\n return array;\n}\n\n/** pushes a values to an array and returns the value */\nexport const pushTo: typeof _pushTo = curry(_pushTo) as any;\nexport function _pushTo(arr: T[], val: T): T ;\nexport function _pushTo(arr: T[]): (val: T) => T ;\nexport function _pushTo(arr, val?): any {\n return (arr.push(val), val);\n}\n\n/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */\nexport const deregAll = (functions: Function[]) =>\n functions.slice().forEach(fn => {\n typeof fn === 'function' && fn();\n removeFrom(functions, fn);\n });\n/**\n * Applies a set of defaults to an options object. The options object is filtered\n * to only those properties of the objects in the defaultsList.\n * Earlier objects in the defaultsList take precedence when applying defaults.\n */\nexport function defaults(opts, ...defaultsList: Obj[]) {\n const _defaultsList = defaultsList.concat({}).reverse();\n const defaultVals = extend.apply(null, _defaultsList);\n return extend({}, defaultVals, pick(opts || {}, Object.keys(defaultVals)));\n}\n\n/** Reduce function that merges each element of the list into a single object, using extend */\nexport const mergeR = (memo: Obj, item: Obj) => extend(memo, item);\n\n/**\n * Finds the common ancestor path between two states.\n *\n * @param {Object} first The first state.\n * @param {Object} second The second state.\n * @return {Array} Returns an array of state names in descending order, not including the root.\n */\nexport function ancestors(first: StateObject, second: StateObject) {\n const path: StateObject[] = [];\n\n for (const n in first.path) { // tslint:disable-line:forin\n if (first.path[n] !== second.path[n]) break;\n path.push(first.path[n]);\n }\n return path;\n}\n\n/**\n * Return a copy of the object only containing the whitelisted properties.\n *\n * #### Example:\n * ```\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the whitelisted property names\n */\nexport function pick(obj: Obj, propNames: string[]): Obj {\n const objCopy = {};\n for (const _prop in obj) {\n if (propNames.indexOf(_prop) !== -1) {\n objCopy[_prop] = obj[_prop];\n }\n }\n return objCopy;\n}\n\n/**\n * Return a copy of the object omitting the blacklisted properties.\n *\n * @example\n * ```\n *\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = omit(foo, ['a', 'b']); // { c: 3 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the blacklisted property names\n */\nexport function omit(obj: Obj, propNames: string[]): Obj {\n return Object.keys(obj)\n .filter(not(inArray(propNames)))\n .reduce((acc, key) => (acc[key] = obj[key], acc), {});\n}\n\n\n/** Given an array of objects, maps each element to a named property of the element. */\nexport function pluck(collection: Obj[], propName: string): T[];\n/** Given an object, maps each property of the object to a named property of the property. */\nexport function pluck(collection: { [key: string]: any }, propName: string): { [key: string]: any };\n/**\n * Maps an array, or object to a property (by name)\n */\nexport function pluck(collection: any, propName: string): any {\n return map(collection, > prop(propName));\n}\n\n\n/** Given an array of objects, returns a new array containing only the elements which passed the callback predicate */\nexport function filter(collection: T[], callback: (t: T, key?: number) => boolean): T[];\n/** Given an object, returns a new object with only those properties that passed the callback predicate */\nexport function filter(collection: TypedMap, callback: (t: T, key?: string) => boolean): TypedMap;\n/** Filters an Array or an Object's properties based on a predicate */\nexport function filter(collection: any, callback: Function): T {\n const arr = isArray(collection), result: any = arr ? [] : {};\n const accept = arr ? x => result.push(x) : (x, key) => result[key] = x;\n forEach(collection, function(item, i) {\n if (callback(item, i)) accept(item, i);\n });\n return result;\n}\n\n\n/** Given an object, return the first property of that object which passed the callback predicate */\nexport function find(collection: TypedMap, callback: Predicate): T;\n/** Given an array of objects, returns the first object which passed the callback predicate */\nexport function find(collection: T[], callback: Predicate): T;\n/** Finds an object from an array, or a property of an object, that matches a predicate */\nexport function find(collection: any, callback: any) {\n let result;\n\n forEach(collection, function(item, i) {\n if (result) return;\n if (callback(item, i)) result = item;\n });\n\n return result;\n}\n\n/** Given an object, returns a new object, where each property is transformed by the callback function */\nexport let mapObj: (collection: { [key: string]: T }, callback: Mapper) => { [key: string]: U } = map;\n/** Given an array, returns a new array, where each element is transformed by the callback function */\nexport function map(collection: T[], callback: Mapper): U[];\nexport function map(collection: { [key: string]: T }, callback: Mapper): { [key: string]: U };\n/** Maps an array or object properties using a callback function */\nexport function map(collection: any, callback: any): any {\n const result = isArray(collection) ? [] : {};\n forEach(collection, (item, i) => result[i] = callback(item, i));\n return result;\n}\n\n/**\n * Given an object, return its enumerable property values\n *\n * @example\n * ```\n *\n * let foo = { a: 1, b: 2, c: 3 }\n * let vals = values(foo); // [ 1, 2, 3 ]\n * ```\n */\nexport const values: ( (obj: TypedMap) => T[]) = (obj: Obj) =>\n Object.keys(obj).map(key => obj[key]);\n\n/**\n * Reduce function that returns true if all of the values are truthy.\n *\n * @example\n * ```\n *\n * let vals = [ 1, true, {}, \"hello world\"];\n * vals.reduce(allTrueR, true); // true\n *\n * vals.push(0);\n * vals.reduce(allTrueR, true); // false\n * ```\n */\nexport const allTrueR = (memo: boolean, elem: any) => memo && elem;\n\n/**\n * Reduce function that returns true if any of the values are truthy.\n *\n * * @example\n * ```\n *\n * let vals = [ 0, null, undefined ];\n * vals.reduce(anyTrueR, true); // false\n *\n * vals.push(\"hello world\");\n * vals.reduce(anyTrueR, true); // true\n * ```\n */\nexport const anyTrueR = (memo: boolean, elem: any) => memo || elem;\n\n/**\n * Reduce function which un-nests a single level of arrays\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnestR = (memo: any[], elem: any[]) => memo.concat(elem);\n\n/**\n * Reduce function which recursively un-nests all arrays\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flattenR = (memo: any[], elem: any) =>\n isArray(elem) ? memo.concat(elem.reduce(flattenR, [])) : pushR(memo, elem);\n\n/**\n * Reduce function that pushes an object to an array, then returns the array.\n * Mostly just for [[flattenR]] and [[uniqR]]\n */\nexport function pushR(arr: any[], obj: any) {\n arr.push(obj);\n return arr;\n}\n\n/** Reduce function that filters out duplicates */\nexport const uniqR = (acc: T[], token: T): T[] =>\n inArray(acc, token) ? acc : pushR(acc, token);\n\n/**\n * Return a new array with a single level of arrays unnested.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * unnest(input) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnest = (arr: any[]) => arr.reduce(unnestR, []);\n/**\n * Return a completely flattened version of an array.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * flatten(input) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flatten = (arr: any[]) => arr.reduce(flattenR, []);\n\n/**\n * Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass.\n * @example\n * ```\n *\n * let isNumber = (obj) => typeof(obj) === 'number';\n * let allNumbers = [ 1, 2, 3, 4, 5 ];\n * allNumbers.filter(assertPredicate(isNumber)); //OK\n *\n * let oneString = [ 1, 2, 3, 4, \"5\" ];\n * oneString.filter(assertPredicate(isNumber, \"Not all numbers\")); // throws Error(\"\"Not all numbers\"\");\n * ```\n */\nexport const assertPredicate: (predicate: Predicate, errMsg: (string|Function)) => Predicate = assertFn;\n/**\n * Given a .map function, builds a .map function which throws an error if any mapped elements do not pass a truthyness test.\n * @example\n * ```\n *\n * var data = { foo: 1, bar: 2 };\n *\n * let keys = [ 'foo', 'bar' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // values is [1, 2]\n *\n * let keys = [ 'foo', 'bar', 'baz' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // throws Error(\"Key not found\")\n * ```\n */\nexport const assertMap: (mapFn: (t: T) => U, errMsg: (string|Function)) => (t: T) => U = assertFn;\nexport function assertFn(predicateOrMap: Function, errMsg: (string|Function) = 'assert failure'): any {\n return (obj) => {\n const result = predicateOrMap(obj);\n if (!result) {\n throw new Error(isFunction(errMsg) ? ( errMsg)(obj) : errMsg);\n }\n return result;\n };\n}\n\n/**\n * Like _.pairs: Given an object, returns an array of key/value pairs\n *\n * @example\n * ```\n *\n * pairs({ foo: \"FOO\", bar: \"BAR }) // [ [ \"foo\", \"FOO\" ], [ \"bar\": \"BAR\" ] ]\n * ```\n */\nexport const pairs = (obj: Obj) =>\n Object.keys(obj).map(key => [ key, obj[key]] );\n\n/**\n * Given two or more parallel arrays, returns an array of tuples where\n * each tuple is composed of [ a[i], b[i], ... z[i] ]\n *\n * @example\n * ```\n *\n * let foo = [ 0, 2, 4, 6 ];\n * let bar = [ 1, 3, 5, 7 ];\n * let baz = [ 10, 30, 50, 70 ];\n * arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ]\n * arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ]\n * ```\n */\nexport function arrayTuples(...args: any[]): any[] {\n if (args.length === 0) return [];\n const maxArrayLen = args.reduce((min, arr) => Math.min(arr.length, min), 9007199254740991); // aka 2^53 − 1 aka Number.MAX_SAFE_INTEGER\n const result = [];\n\n for (let i = 0; i < maxArrayLen; i++) {\n // This is a hot function\n // Unroll when there are 1-4 arguments\n switch (args.length) {\n case 1: result.push([args[0][i]]); break;\n case 2: result.push([args[0][i], args[1][i]]); break;\n case 3: result.push([args[0][i], args[1][i], args[2][i]]); break;\n case 4: result.push([args[0][i], args[1][i], args[2][i], args[3][i]]); break;\n default:\n result.push(args.map(array => array[i])); break;\n }\n }\n\n return result;\n}\n\n/**\n * Reduce function which builds an object from an array of [key, value] pairs.\n *\n * Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration.\n *\n * Each keyValueTuple should be an array with values [ key: string, value: any ]\n *\n * @example\n * ```\n *\n * var pairs = [ [\"fookey\", \"fooval\"], [\"barkey\", \"barval\"] ]\n *\n * var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n *\n * // Or, more simply:\n * var pairsToObj = pairs.reduce(applyPairs, {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n * ```\n */\nexport function applyPairs(memo: TypedMap, keyValTuple: any[]) {\n let key: string, value: any;\n if (isArray(keyValTuple)) [key, value] = keyValTuple;\n if (!isString(key)) throw new Error('invalid parameters to applyPairs');\n memo[key] = value;\n return memo;\n}\n\n/** Get the last element of an array */\nexport function tail(arr: T[]): T {\n return arr.length && arr[arr.length - 1] || undefined;\n}\n\n/**\n * shallow copy from src to dest\n */\nexport function copy(src: Obj, dest?: Obj) {\n if (dest) Object.keys(dest).forEach(key => delete dest[key]);\n if (!dest) dest = {};\n return extend(dest, src);\n}\n\n/** Naive forEach implementation works with Objects or Arrays */\nfunction _forEach(obj: (any[]|any), cb: (el, idx?) => void, _this: Obj) {\n if (isArray(obj)) return obj.forEach(cb, _this);\n Object.keys(obj).forEach(key => cb(obj[key], key));\n}\n\n/** Like Object.assign() */\nexport function _extend(toObj: Obj, ...fromObjs: Obj[]): any;\nexport function _extend(toObj: Obj): any {\n for (let i = 1; i < arguments.length; i++) {\n const obj = arguments[i];\n if (!obj) continue;\n const keys = Object.keys(obj);\n\n for (let j = 0; j < keys.length; j++) {\n toObj[keys[j]] = obj[keys[j]];\n }\n }\n\n return toObj;\n}\n\nfunction _equals(o1: any, o2: any): boolean {\n if (o1 === o2) return true;\n if (o1 === null || o2 === null) return false;\n if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN\n const t1 = typeof o1, t2 = typeof o2;\n if (t1 !== t2 || t1 !== 'object') return false;\n\n const tup = [o1, o2];\n if (all(isArray)(tup)) return _arraysEq(o1, o2);\n if (all(isDate)(tup)) return o1.getTime() === o2.getTime();\n if (all(isRegExp)(tup)) return o1.toString() === o2.toString();\n if (all(isFunction)(tup)) return true; // meh\n\n const predicates = [isFunction, isArray, isDate, isRegExp];\n if (predicates.map(any).reduce((b, fn) => b || !!fn(tup), false)) return false;\n\n const keys: { [i: string]: boolean } = {};\n for (const key in o1) { // tslint:disable-line:forin\n if (!_equals(o1[key], o2[key])) return false;\n keys[key] = true;\n }\n for (const key in o2) {\n if (!keys[key]) return false;\n }\n\n return true;\n}\n\nfunction _arraysEq(a1: any[], a2: any[]) {\n if (a1.length !== a2.length) return false;\n return arrayTuples(a1, a2).reduce((b, t) => b && _equals(t[0], t[1]), true);\n}\n\n// issue #2676\nexport const silenceUncaughtInPromise = (promise: Promise) =>\n promise.catch(e => 0) && promise;\nexport const silentRejection = (error: any) =>\n silenceUncaughtInPromise(services.$q.reject(error));\n", + "/**\n * # Transition tracing (debug)\n *\n * Enable transition tracing to print transition information to the console,\n * in order to help debug your application.\n * Tracing logs detailed information about each Transition to your console.\n *\n * To enable tracing, import the [[Trace]] singleton and enable one or more categories.\n *\n * ### ES6\n * ```js\n * import {trace} from \"ui-router-ng2\"; // or \"angular-ui-router\"\n * trace.enable(1, 5); // TRANSITION and VIEWCONFIG\n * ```\n *\n * ### CJS\n * ```js\n * let trace = require(\"angular-ui-router\").trace; // or \"ui-router-ng2\"\n * trace.enable(\"TRANSITION\", \"VIEWCONFIG\");\n * ```\n *\n * ### Globals\n * ```js\n * let trace = window[\"angular-ui-router\"].trace; // or \"ui-router-ng2\"\n * trace.enable(); // Trace everything (very verbose)\n * ```\n *\n * ### Angular 1:\n * ```js\n * app.run($trace => $trace.enable());\n * ```\n *\n * @coreapi\n * @module trace\n */\n/* tslint:disable:no-console */\nimport { parse } from '../common/hof';\nimport { isFunction, isNumber } from '../common/predicates';\nimport { Transition } from '../transition/transition';\nimport { ViewTuple } from '../view';\nimport { ActiveUIView, ViewConfig, ViewContext } from '../view/interface';\nimport { stringify, functionToString, maxLength, padString } from './strings';\nimport { Resolvable } from '../resolve/resolvable';\nimport { PathNode } from '../path/pathNode';\nimport { PolicyWhen } from '../resolve/interface';\nimport { TransitionHook } from '../transition/transitionHook';\nimport { HookResult } from '../transition/interface';\nimport { StateObject } from '../state/stateObject';\n\n/** @hidden */\nfunction uiViewString (uiview: ActiveUIView) {\n if (!uiview) return 'ui-view (defunct)';\n const state = uiview.creationContext ? uiview.creationContext.name || '(root)' : '(none)';\n return `[ui-view#${uiview.id} ${uiview.$type}:${uiview.fqn} (${uiview.name}@${state})]`;\n}\n\n/** @hidden */\nconst viewConfigString = (viewConfig: ViewConfig) => {\n const view = viewConfig.viewDecl;\n const state = view.$context.name || '(root)';\n return `[View#${viewConfig.$id} from '${state}' state]: target ui-view: '${view.$uiViewName}@${view.$uiViewContextAnchor}'`;\n};\n\n/** @hidden */\nfunction normalizedCat(input: Category|string): string {\n return isNumber(input) ? Category[input] : Category[Category[input]];\n}\n\n/** @hidden */\nconst consoleLog = Function.prototype.bind.call(console.log, console);\n\n/** @hidden */\nconst consoletable = isFunction(console.table) ? console.table.bind(console) : consoleLog.bind(console);\n\n\n/**\n * Trace categories Enum\n *\n * Enable or disable a category using [[Trace.enable]] or [[Trace.disable]]\n *\n * `trace.enable(Category.TRANSITION)`\n *\n * These can also be provided using a matching string, or position ordinal\n *\n * `trace.enable(\"TRANSITION\")`\n *\n * `trace.enable(1)`\n */\nexport enum Category {\n RESOLVE, TRANSITION, HOOK, UIVIEW, VIEWCONFIG,\n}\n\n/** @hidden */\nconst _tid = parse('$id');\n\n/** @hidden */\nconst _rid = parse('router.$id');\n\n/** @hidden */\nconst transLbl = (trans) => `Transition #${_tid(trans)}-${_rid(trans)}`;\n\n/**\n * Prints UI-Router Transition trace information to the console.\n */\nexport class Trace {\n /** @hidden */\n approximateDigests: number;\n\n /** @hidden */\n private _enabled: { [key: string]: boolean } = {};\n\n /** @hidden */\n constructor() {\n this.approximateDigests = 0;\n }\n\n /** @hidden */\n private _set(enabled: boolean, categories: Category[]) {\n if (!categories.length) {\n categories = Object.keys(Category)\n .map(k => parseInt(k, 10))\n .filter(k => !isNaN(k))\n .map(key => Category[key]);\n }\n categories.map(normalizedCat).forEach(category => this._enabled[category] = enabled);\n }\n\n /**\n * Enables a trace [[Category]]\n *\n * ```js\n * trace.enable(\"TRANSITION\");\n * ```\n *\n * @param categories categories to enable. If `categories` is omitted, all categories are enabled.\n * Also takes strings (category name) or ordinal (category position)\n */\n enable(...categories: (Category|string|number)[]);\n enable(...categories: any[]) { this._set(true, categories); }\n /**\n * Disables a trace [[Category]]\n *\n * ```js\n * trace.disable(\"VIEWCONFIG\");\n * ```\n *\n * @param categories categories to disable. If `categories` is omitted, all categories are disabled.\n * Also takes strings (category name) or ordinal (category position)\n */\n disable(...categories: (Category|string|number)[]);\n disable(...categories: any[]) { this._set(false, categories); }\n\n /**\n * Retrieves the enabled stateus of a [[Category]]\n *\n * ```js\n * trace.enabled(\"VIEWCONFIG\"); // true or false\n * ```\n *\n * @returns boolean true if the category is enabled\n */\n enabled(category: (Category|string|number)): boolean {\n return !!this._enabled[normalizedCat(category)];\n }\n\n /** @internalapi called by ui-router code */\n traceTransitionStart(trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: Started -> ${stringify(trans)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceTransitionIgnored(trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: Ignored <> ${stringify(trans)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceHookInvocation(step: TransitionHook, trans: Transition, options: any) {\n if (!this.enabled(Category.HOOK)) return;\n const event = parse('traceData.hookType')(options) || 'internal',\n context = parse('traceData.context.state.name')(options) || parse('traceData.context')(options) || 'unknown',\n name = functionToString((step as any).registeredHook.callback);\n console.log(`${transLbl(trans)}: Hook -> ${event} context: ${context}, ${maxLength(200, name)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceHookResult(hookResult: HookResult, trans: Transition, transitionOptions: any) {\n if (!this.enabled(Category.HOOK)) return;\n console.log(`${transLbl(trans)}: <- Hook returned: ${maxLength(200, stringify(hookResult))}`);\n }\n\n /** @internalapi called by ui-router code */\n traceResolvePath(path: PathNode[], when: PolicyWhen, trans?: Transition) {\n if (!this.enabled(Category.RESOLVE)) return;\n console.log(`${transLbl(trans)}: Resolving ${path} (${when})`);\n }\n\n /** @internalapi called by ui-router code */\n traceResolvableResolved(resolvable: Resolvable, trans?: Transition) {\n if (!this.enabled(Category.RESOLVE)) return;\n console.log(`${transLbl(trans)}: <- Resolved ${resolvable} to: ${maxLength(200, stringify(resolvable.data))}`);\n }\n\n /** @internalapi called by ui-router code */\n traceError(reason: any, trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: <- Rejected ${stringify(trans)}, reason: ${reason}`);\n }\n\n /** @internalapi called by ui-router code */\n traceSuccess(finalState: StateObject, trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: <- Success ${stringify(trans)}, final state: ${finalState.name}`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewEvent(event: string, viewData: ActiveUIView, extra = '') {\n if (!this.enabled(Category.UIVIEW)) return;\n console.log(`ui-view: ${padString(30, event)} ${uiViewString(viewData)}${extra}`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewConfigUpdated(viewData: ActiveUIView, context: ViewContext) {\n if (!this.enabled(Category.UIVIEW)) return;\n this.traceUIViewEvent('Updating', viewData, ` with ViewConfig from context='${context}'`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewFill(viewData: ActiveUIView, html: string) {\n if (!this.enabled(Category.UIVIEW)) return;\n this.traceUIViewEvent('Fill', viewData, ` with: ${maxLength(200, html)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceViewSync(pairs: ViewTuple[]) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n const uivheader = 'uiview component fqn';\n const cfgheader = 'view config state (view name)';\n const mapping = pairs.map(({ uiView, viewConfig }) => {\n const uiv = uiView && uiView.fqn;\n const cfg = viewConfig && `${viewConfig.viewDecl.$context.name}: (${viewConfig.viewDecl.$name})`;\n return { [uivheader]: uiv, [cfgheader]: cfg };\n }).sort((a, b) => (a[uivheader] || '').localeCompare(b[uivheader] || ''));\n\n consoletable(mapping);\n }\n\n /** @internalapi called by ui-router code */\n traceViewServiceEvent(event: string, viewConfig: ViewConfig) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n console.log(`VIEWCONFIG: ${event} ${viewConfigString(viewConfig)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceViewServiceUIViewEvent(event: string, viewData: ActiveUIView) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n console.log(`VIEWCONFIG: ${event} ${uiViewString(viewData)}`);\n }\n}\n\n/**\n * The [[Trace]] singleton\n *\n * #### Example:\n * ```js\n * import {trace} from \"angular-ui-router\";\n * trace.enable(1, 5);\n * ```\n */\nconst trace = new Trace();\nexport { trace };\n", + "/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\nimport { extend, removeFrom, tail, values, identity, map } from '../common/common';\nimport { isString, isFunction } from '../common/predicates';\nimport { PathNode } from '../path/pathNode';\nimport {\n TransitionStateHookFn, TransitionHookFn, TransitionHookPhase, TransitionHookScope, IHookRegistry, PathType,\n} from './interface'; // has or is using\n\nimport {\n HookRegOptions, HookMatchCriteria, TreeChanges,\n HookMatchCriterion, IMatchingNodes, HookFn,\n} from './interface';\nimport { Glob } from '../common/glob';\nimport { StateObject } from '../state/stateObject';\nimport { TransitionEventType } from './transitionEventType';\nimport { TransitionService } from './transitionService';\n\n/**\n * Determines if the given state matches the matchCriteria\n *\n * @hidden\n *\n * @param state a State Object to test against\n * @param criterion\n * - If a string, matchState uses the string as a glob-matcher against the state name\n * - If an array (of strings), matchState uses each string in the array as a glob-matchers against the state name\n * and returns a positive match if any of the globs match.\n * - If a function, matchState calls the function with the state and returns true if the function's result is truthy.\n * @returns {boolean}\n */\nexport function matchState(state: StateObject, criterion: HookMatchCriterion) {\n const toMatch = isString(criterion) ? [criterion] : criterion;\n\n function matchGlobs(_state: StateObject) {\n const globStrings = toMatch;\n for (let i = 0; i < globStrings.length; i++) {\n const glob = new Glob(globStrings[i]);\n\n if ((glob && glob.matches(_state.name)) || (!glob && globStrings[i] === _state.name)) {\n return true;\n }\n }\n return false;\n }\n\n const matchFn = (isFunction(toMatch) ? toMatch : matchGlobs);\n return !!matchFn(state);\n}\n\n/**\n * @internalapi\n * The registration data for a registered transition hook\n */\nexport class RegisteredHook {\n priority: number;\n bind: any;\n invokeCount = 0;\n invokeLimit: number;\n _deregistered = false;\n\n constructor(public tranSvc: TransitionService,\n public eventType: TransitionEventType,\n public callback: HookFn,\n public matchCriteria: HookMatchCriteria,\n public removeHookFromRegistry: (hook: RegisteredHook) => void,\n options: HookRegOptions = {} as any) {\n this.priority = options.priority || 0;\n this.bind = options.bind || null;\n this.invokeLimit = options.invokeLimit;\n }\n\n /**\n * Gets the matching [[PathNode]]s\n *\n * Given an array of [[PathNode]]s, and a [[HookMatchCriterion]], returns an array containing\n * the [[PathNode]]s that the criteria matches, or `null` if there were no matching nodes.\n *\n * Returning `null` is significant to distinguish between the default\n * \"match-all criterion value\" of `true` compared to a `() => true` function,\n * when the nodes is an empty array.\n *\n * This is useful to allow a transition match criteria of `entering: true`\n * to still match a transition, even when `entering === []`. Contrast that\n * with `entering: (state) => true` which only matches when a state is actually\n * being entered.\n */\n private _matchingNodes(nodes: PathNode[], criterion: HookMatchCriterion): PathNode[] {\n if (criterion === true) return nodes;\n const matching = nodes.filter(node => matchState(node.state, criterion));\n return matching.length ? matching : null;\n }\n\n /**\n * Gets the default match criteria (all `true`)\n *\n * Returns an object which has all the criteria match paths as keys and `true` as values, i.e.:\n *\n * ```js\n * {\n * to: true,\n * from: true,\n * entering: true,\n * exiting: true,\n * retained: true,\n * }\n */\n private _getDefaultMatchCriteria(): HookMatchCriteria {\n return map(this.tranSvc._pluginapi._getPathTypes(), () => true);\n }\n\n /**\n * Gets matching nodes as [[IMatchingNodes]]\n *\n * Create a IMatchingNodes object from the TransitionHookTypes that is roughly equivalent to:\n *\n * ```js\n * let matches: IMatchingNodes = {\n * to: _matchingNodes([tail(treeChanges.to)], mc.to),\n * from: _matchingNodes([tail(treeChanges.from)], mc.from),\n * exiting: _matchingNodes(treeChanges.exiting, mc.exiting),\n * retained: _matchingNodes(treeChanges.retained, mc.retained),\n * entering: _matchingNodes(treeChanges.entering, mc.entering),\n * };\n * ```\n */\n private _getMatchingNodes(treeChanges: TreeChanges): IMatchingNodes {\n const criteria = extend(this._getDefaultMatchCriteria(), this.matchCriteria);\n const paths: PathType[] = values(this.tranSvc._pluginapi._getPathTypes());\n\n return paths.reduce((mn: IMatchingNodes, pathtype: PathType) => {\n // STATE scope criteria matches against every node in the path.\n // TRANSITION scope criteria matches against only the last node in the path\n const isStateHook = pathtype.scope === TransitionHookScope.STATE;\n const path = treeChanges[pathtype.name] || [];\n const nodes: PathNode[] = isStateHook ? path : [tail(path)];\n\n mn[pathtype.name] = this._matchingNodes(nodes, criteria[pathtype.name]);\n return mn;\n }, {} as IMatchingNodes);\n }\n\n /**\n * Determines if this hook's [[matchCriteria]] match the given [[TreeChanges]]\n *\n * @returns an IMatchingNodes object, or null. If an IMatchingNodes object is returned, its values\n * are the matching [[PathNode]]s for each [[HookMatchCriterion]] (to, from, exiting, retained, entering)\n */\n matches(treeChanges: TreeChanges): IMatchingNodes {\n const matches = this._getMatchingNodes(treeChanges);\n\n // Check if all the criteria matched the TreeChanges object\n const allMatched = values(matches).every(identity);\n return allMatched ? matches : null;\n }\n\n deregister() {\n this.removeHookFromRegistry(this);\n this._deregistered = true;\n }\n}\n\n/** @hidden Return a registration function of the requested type. */\nexport function makeEvent(registry: IHookRegistry, transitionService: TransitionService, eventType: TransitionEventType) {\n // Create the object which holds the registered transition hooks.\n const _registeredHooks = registry._registeredHooks = (registry._registeredHooks || {});\n const hooks = _registeredHooks[eventType.name] = [];\n const removeHookFn: (hook: RegisteredHook) => void = removeFrom(hooks);\n\n // Create hook registration function on the IHookRegistry for the event\n registry[eventType.name] = hookRegistrationFn;\n\n function hookRegistrationFn(matchObject, callback, options = {}) {\n const registeredHook = new RegisteredHook(transitionService, eventType, callback, matchObject, removeHookFn, options);\n hooks.push(registeredHook);\n return registeredHook.deregister.bind(registeredHook);\n }\n\n return hookRegistrationFn;\n}\n", + "/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\n\nimport { extend, tail, assertPredicate, unnestR, identity } from '../common/common';\nimport { isArray } from '../common/predicates';\n\nimport {\n TransitionOptions, TransitionHookOptions, IHookRegistry, TreeChanges, IMatchingNodes,\n TransitionHookPhase, TransitionHookScope,\n} from './interface';\n\nimport { Transition } from './transition';\nimport { TransitionHook } from './transitionHook';\nimport { StateObject } from '../state/stateObject';\nimport { PathNode } from '../path/pathNode';\nimport { TransitionService } from './transitionService';\nimport { TransitionEventType } from './transitionEventType';\nimport { RegisteredHook } from './hookRegistry';\n\n/**\n * This class returns applicable TransitionHooks for a specific Transition instance.\n *\n * Hooks ([[RegisteredHook]]) may be registered globally, e.g., $transitions.onEnter(...), or locally, e.g.\n * myTransition.onEnter(...). The HookBuilder finds matching RegisteredHooks (where the match criteria is\n * determined by the type of hook)\n *\n * The HookBuilder also converts RegisteredHooks objects to TransitionHook objects, which are used to run a Transition.\n *\n * The HookBuilder constructor is given the $transitions service and a Transition instance. Thus, a HookBuilder\n * instance may only be used for one specific Transition object. (side note: the _treeChanges accessor is private\n * in the Transition class, so we must also provide the Transition's _treeChanges)\n *\n */\nexport class HookBuilder {\n constructor(private transition: Transition) { }\n\n buildHooksForPhase(phase: TransitionHookPhase): TransitionHook[] {\n const $transitions = this.transition.router.transitionService;\n return $transitions._pluginapi._getEvents(phase)\n .map(type => this.buildHooks(type))\n .reduce(unnestR, [])\n .filter(identity);\n }\n\n /**\n * Returns an array of newly built TransitionHook objects.\n *\n * - Finds all RegisteredHooks registered for the given `hookType` which matched the transition's [[TreeChanges]].\n * - Finds [[PathNode]] (or `PathNode[]`) to use as the TransitionHook context(s)\n * - For each of the [[PathNode]]s, creates a TransitionHook\n *\n * @param hookType the type of the hook registration function, e.g., 'onEnter', 'onFinish'.\n */\n buildHooks(hookType: TransitionEventType): TransitionHook[] {\n const transition = this.transition;\n const treeChanges = transition.treeChanges();\n\n // Find all the matching registered hooks for a given hook type\n const matchingHooks = this.getMatchingHooks(hookType, treeChanges);\n if (!matchingHooks) return [];\n\n const baseHookOptions = {\n transition: transition,\n current: transition.options().current,\n };\n\n const makeTransitionHooks = (hook: RegisteredHook) => {\n // Fetch the Nodes that caused this hook to match.\n const matches: IMatchingNodes = hook.matches(treeChanges);\n // Select the PathNode[] that will be used as TransitionHook context objects\n const matchingNodes: PathNode[] = matches[hookType.criteriaMatchPath.name];\n\n // Return an array of HookTuples\n return matchingNodes.map(node => {\n const _options = extend({\n bind: hook.bind,\n traceData: { hookType: hookType.name, context: node },\n }, baseHookOptions);\n\n const state = hookType.criteriaMatchPath.scope === TransitionHookScope.STATE ? node.state.self : null;\n const transitionHook = new TransitionHook(transition, state, hook, _options);\n return { hook, node, transitionHook };\n });\n };\n\n return matchingHooks.map(makeTransitionHooks)\n .reduce(unnestR, [])\n .sort(tupleSort(hookType.reverseSort))\n .map(tuple => tuple.transitionHook);\n }\n\n /**\n * Finds all RegisteredHooks from:\n * - The Transition object instance hook registry\n * - The TransitionService ($transitions) global hook registry\n *\n * which matched:\n * - the eventType\n * - the matchCriteria (to, from, exiting, retained, entering)\n *\n * @returns an array of matched [[RegisteredHook]]s\n */\n public getMatchingHooks(hookType: TransitionEventType, treeChanges: TreeChanges): RegisteredHook[] {\n const isCreate = hookType.hookPhase === TransitionHookPhase.CREATE;\n\n // Instance and Global hook registries\n const $transitions = this.transition.router.transitionService;\n const registries = isCreate ? [ $transitions ] : [ this.transition, $transitions ];\n\n return registries.map((reg: IHookRegistry) => reg.getHooks(hookType.name)) // Get named hooks from registries\n .filter(assertPredicate(isArray, `broken event named: ${hookType.name}`)) // Sanity check\n .reduce(unnestR, []) // Un-nest RegisteredHook[][] to RegisteredHook[] array\n .filter(hook => hook.matches(treeChanges)); // Only those satisfying matchCriteria\n }\n}\n\ninterface HookTuple { hook: RegisteredHook, node: PathNode, transitionHook: TransitionHook }\n\n/**\n * A factory for a sort function for HookTuples.\n *\n * The sort function first compares the PathNode depth (how deep in the state tree a node is), then compares\n * the EventHook priority.\n *\n * @param reverseDepthSort a boolean, when true, reverses the sort order for the node depth\n * @returns a tuple sort function\n */\nfunction tupleSort(reverseDepthSort = false) {\n return function nodeDepthThenPriority(l: HookTuple, r: HookTuple): number {\n const factor = reverseDepthSort ? -1 : 1;\n const depthDelta = (l.node.state.path.length - r.node.state.path.length) * factor;\n return depthDelta !== 0 ? depthDelta : r.hook.priority - l.hook.priority;\n };\n}\n", + "/**\n * @coreapi\n * @module params\n */\n/** */\nimport { extend, filter, map } from '../common/common';\nimport { isArray, isDefined } from '../common/predicates';\nimport { ParamTypeDefinition } from './interface';\n\n/**\n * An internal class which implements [[ParamTypeDefinition]].\n *\n * A [[ParamTypeDefinition]] is a plain javascript object used to register custom parameter types.\n * When a param type definition is registered, an instance of this class is created internally.\n *\n * This class has naive implementations for all the [[ParamTypeDefinition]] methods.\n *\n * Used by [[UrlMatcher]] when matching or formatting URLs, or comparing and validating parameter values.\n *\n * #### Example:\n * ```js\n * var paramTypeDef = {\n * decode: function(val) { return parseInt(val, 10); },\n * encode: function(val) { return val && val.toString(); },\n * equals: function(a, b) { return this.is(a) && a === b; },\n * is: function(val) { return angular.isNumber(val) && isFinite(val) && val % 1 === 0; },\n * pattern: /\\d+/\n * }\n *\n * var paramType = new ParamType(paramTypeDef);\n * ```\n * @internalapi\n */\nexport class ParamType implements ParamTypeDefinition {\n /** @inheritdoc */\n pattern: RegExp = /.*/;\n /** The name/id of the parameter type */\n name: string;\n /** @inheritdoc */\n raw: boolean;\n /** @inheritdoc */\n dynamic: boolean;\n /** @inheritdoc */\n inherit = true;\n\n /**\n * @param def A configuration object which contains the custom type definition. The object's\n * properties will override the default methods and/or pattern in `ParamType`'s public interface.\n * @returns a new ParamType object\n */\n constructor(def: ParamTypeDefinition) {\n extend(this, def);\n }\n\n\n // consider these four methods to be \"abstract methods\" that should be overridden\n /** @inheritdoc */\n is(val: any, key?: string): boolean { return true; }\n /** @inheritdoc */\n encode(val: any, key?: string): (string|string[]) { return val; }\n /** @inheritdoc */\n decode(val: string, key?: string): any { return val; }\n /** @inheritdoc */\n equals(a: any, b: any): boolean { return a == b; } // tslint:disable-line:triple-equals\n\n\n $subPattern() {\n const sub = this.pattern.toString();\n return sub.substr(1, sub.length - 2);\n }\n\n toString() {\n return `{ParamType:${this.name}}`;\n }\n\n /** Given an encoded string, or a decoded object, returns a decoded object */\n $normalize(val: any) {\n return this.is(val) ? val : this.decode(val);\n }\n\n /**\n * Wraps an existing custom ParamType as an array of ParamType, depending on 'mode'.\n * e.g.:\n * - urlmatcher pattern \"/path?{queryParam[]:int}\"\n * - url: \"/path?queryParam=1&queryParam=2\n * - $stateParams.queryParam will be [1, 2]\n * if `mode` is \"auto\", then\n * - url: \"/path?queryParam=1 will create $stateParams.queryParam: 1\n * - url: \"/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2]\n */\n $asArray(mode: (boolean|'auto'), isSearch: boolean) {\n if (!mode) return this;\n if (mode === 'auto' && !isSearch) throw new Error(\"'auto' array mode is for query parameters only\");\n return new ( ArrayType)(this, mode);\n }\n}\n\n/**\n * Wraps up a `ParamType` object to handle array values.\n * @internalapi\n */\nfunction ArrayType(type: ParamType, mode: (boolean|'auto')) {\n // Wrap non-array value as array\n function arrayWrap(val: any): any[] {\n return isArray(val) ? val : (isDefined(val) ? [ val ] : []);\n }\n\n // Unwrap array value for \"auto\" mode. Return undefined for empty array.\n function arrayUnwrap(val: any) {\n switch (val.length) {\n case 0: return undefined;\n case 1: return mode === 'auto' ? val[0] : val;\n default: return val;\n }\n }\n\n // Wraps type (.is/.encode/.decode) functions to operate on each value of an array\n function arrayHandler(callback: (x: any) => any, allTruthyMode?: boolean) {\n return function handleArray(val: any) {\n if (isArray(val) && val.length === 0) return val;\n const arr = arrayWrap(val);\n const result = map(arr, callback);\n return (allTruthyMode === true) ? filter(result, x => !x).length === 0 : arrayUnwrap(result);\n };\n }\n\n // Wraps type (.equals) functions to operate on each value of an array\n function arrayEqualsHandler(callback: (l: any, r: any) => boolean) {\n return function handleArray(val1: any, val2: any) {\n const left = arrayWrap(val1), right = arrayWrap(val2);\n if (left.length !== right.length) return false;\n for (let i = 0; i < left.length; i++) {\n if (!callback(left[i], right[i])) return false;\n }\n return true;\n };\n }\n\n ['encode', 'decode', 'equals', '$normalize'].forEach(name => {\n const paramTypeFn = type[name].bind(type);\n const wrapperFn: Function = name === 'equals' ? arrayEqualsHandler : arrayHandler;\n this[name] = wrapperFn(paramTypeFn);\n });\n\n extend(this, {\n dynamic: type.dynamic,\n name: type.name,\n pattern: type.pattern,\n inherit: type.inherit,\n is: arrayHandler(type.is.bind(type), true),\n $arrayMode: mode,\n });\n}\n", + "/**\n * @coreapi\n * @module params\n */ /** for typedoc */\nimport { extend, filter, map, allTrueR } from '../common/common';\nimport { prop } from '../common/hof';\nimport { isInjectable, isDefined, isString, isArray, isUndefined } from '../common/predicates';\nimport { RawParams, ParamDeclaration } from '../params/interface';\nimport { services } from '../common/coreservices';\nimport { ParamType } from './paramType';\nimport { ParamTypes } from './paramTypes';\nimport { UrlMatcherFactory } from '../url/urlMatcherFactory';\n\n/** @hidden */\nconst hasOwn = Object.prototype.hasOwnProperty;\n\n/** @hidden */\nconst isShorthand = (cfg: ParamDeclaration) =>\n ['value', 'type', 'squash', 'array', 'dynamic'].filter(hasOwn.bind(cfg || {})).length === 0;\n\n/** @internalapi */\nexport enum DefType {\n PATH,\n SEARCH,\n CONFIG,\n}\n\n/** @hidden */\nfunction unwrapShorthand(cfg: ParamDeclaration): ParamDeclaration {\n cfg = isShorthand(cfg) && { value: cfg } as any || cfg;\n\n getStaticDefaultValue['__cacheable'] = true;\n function getStaticDefaultValue() {\n return cfg.value;\n }\n\n return extend(cfg, {\n $$fn: isInjectable(cfg.value) ? cfg.value : getStaticDefaultValue,\n });\n}\n\n/** @hidden */\nfunction getType(cfg: ParamDeclaration, urlType: ParamType, location: DefType, id: string, paramTypes: ParamTypes) {\n if (cfg.type && urlType && urlType.name !== 'string') throw new Error(`Param '${id}' has two type configurations.`);\n if (cfg.type && urlType && urlType.name === 'string' && paramTypes.type(cfg.type as string)) return paramTypes.type(cfg.type as string);\n if (urlType) return urlType;\n if (!cfg.type) {\n const type = location === DefType.CONFIG ? 'any' :\n location === DefType.PATH ? 'path' :\n location === DefType.SEARCH ? 'query' : 'string';\n return paramTypes.type(type);\n }\n return cfg.type instanceof ParamType ? cfg.type : paramTypes.type(cfg.type as string);\n}\n\n/**\n * @internalapi\n * returns false, true, or the squash value to indicate the \"default parameter url squash policy\".\n */\nfunction getSquashPolicy(config: ParamDeclaration, isOptional: boolean, defaultPolicy: (boolean|string)) {\n const squash = config.squash;\n if (!isOptional || squash === false) return false;\n if (!isDefined(squash) || squash == null) return defaultPolicy;\n if (squash === true || isString(squash)) return squash;\n throw new Error(`Invalid squash policy: '${squash}'. Valid policies: false, true, or arbitrary string`);\n}\n\n/** @internalapi */\nfunction getReplace(config: ParamDeclaration, arrayMode: boolean, isOptional: boolean, squash: (string|boolean)) {\n const defaultPolicy = [\n { from: '', to: (isOptional || arrayMode ? undefined : '') },\n { from: null, to: (isOptional || arrayMode ? undefined : '') },\n ];\n\n const replace = isArray(config.replace) ? config.replace : [];\n if (isString(squash)) replace.push({ from: squash, to: undefined });\n\n const configuredKeys = map(replace, prop('from'));\n return filter(defaultPolicy, item => configuredKeys.indexOf(item.from) === -1).concat(replace);\n}\n\n\n/** @internalapi */\nexport class Param {\n id: string;\n type: ParamType;\n location: DefType;\n isOptional: boolean;\n dynamic: boolean;\n raw: boolean;\n squash: (boolean|string);\n replace: [{ to: any, from: any }];\n inherit: boolean;\n array: boolean;\n config: any;\n /** Cache the default value if it is a static value */\n _defaultValueCache: {\n defaultValue: any,\n };\n\n static values(params: Param[], values: RawParams = {}): RawParams {\n const paramValues = {} as RawParams;\n for (const param of params) {\n paramValues[param.id] = param.value(values[param.id]);\n }\n return paramValues;\n }\n\n /**\n * Finds [[Param]] objects which have different param values\n *\n * Filters a list of [[Param]] objects to only those whose parameter values differ in two param value objects\n *\n * @param params: The list of Param objects to filter\n * @param values1: The first set of parameter values\n * @param values2: the second set of parameter values\n *\n * @returns any Param objects whose values were different between values1 and values2\n */\n static changed(params: Param[], values1: RawParams = {}, values2: RawParams = {}): Param[] {\n return params.filter(param => !param.type.equals(values1[param.id], values2[param.id]));\n }\n\n /**\n * Checks if two param value objects are equal (for a set of [[Param]] objects)\n *\n * @param params The list of [[Param]] objects to check\n * @param values1 The first set of param values\n * @param values2 The second set of param values\n *\n * @returns true if the param values in values1 and values2 are equal\n */\n static equals(params: Param[], values1 = {}, values2 = {}): boolean {\n return Param.changed(params, values1, values2).length === 0;\n }\n\n /** Returns true if a the parameter values are valid, according to the Param definitions */\n static validates(params: Param[], values: RawParams = {}): boolean {\n return params.map(param => param.validates(values[param.id])).reduce(allTrueR, true);\n }\n\n constructor(id: string, type: ParamType, config: ParamDeclaration, location: DefType, urlMatcherFactory: UrlMatcherFactory) {\n config = unwrapShorthand(config);\n type = getType(config, type, location, id, urlMatcherFactory.paramTypes);\n const arrayMode = getArrayMode();\n type = arrayMode ? type.$asArray(arrayMode, location === DefType.SEARCH) : type;\n const isOptional = config.value !== undefined || location === DefType.SEARCH;\n const dynamic = isDefined(config.dynamic) ? !!config.dynamic : !!type.dynamic;\n const raw = isDefined(config.raw) ? !!config.raw : !!type.raw;\n const squash = getSquashPolicy(config, isOptional, urlMatcherFactory.defaultSquashPolicy());\n const replace = getReplace(config, arrayMode, isOptional, squash);\n const inherit = isDefined(config.inherit) ? !!config.inherit : !!type.inherit;\n\n // array config: param name (param[]) overrides default settings. explicit config overrides param name.\n function getArrayMode() {\n const arrayDefaults = { array: (location === DefType.SEARCH ? 'auto' : false) };\n const arrayParamNomenclature = id.match(/\\[\\]$/) ? { array: true } : {};\n return extend(arrayDefaults, arrayParamNomenclature, config).array;\n }\n\n extend(this, { id, type, location, isOptional, dynamic, raw, squash, replace, inherit, array: arrayMode, config });\n }\n\n isDefaultValue(value: any): boolean {\n return this.isOptional && this.type.equals(this.value(), value);\n }\n\n /**\n * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the\n * default value, which may be the result of an injectable function.\n */\n value(value?: any): any {\n /**\n * [Internal] Get the default value of a parameter, which may be an injectable function.\n */\n const getDefaultValue = () => {\n if (this._defaultValueCache) return this._defaultValueCache.defaultValue;\n\n if (!services.$injector) throw new Error('Injectable functions cannot be called at configuration time');\n\n const defaultValue = services.$injector.invoke(this.config.$$fn);\n\n if (defaultValue !== null && defaultValue !== undefined && !this.type.is(defaultValue))\n throw new Error(`Default value (${defaultValue}) for parameter '${this.id}' is not an instance of ParamType (${this.type.name})`);\n\n if (this.config.$$fn['__cacheable']) {\n this._defaultValueCache = { defaultValue };\n }\n\n return defaultValue;\n };\n\n const replaceSpecialValues = (val: any) => {\n for (const tuple of this.replace) {\n if (tuple.from === val) return tuple.to;\n }\n return val;\n };\n\n value = replaceSpecialValues(value);\n\n return isUndefined(value) ? getDefaultValue() : this.type.$normalize(value);\n }\n\n isSearch(): boolean {\n return this.location === DefType.SEARCH;\n }\n\n validates(value: any): boolean {\n // There was no parameter value, but the param is optional\n if ((isUndefined(value) || value === null) && this.isOptional) return true;\n\n // The value was not of the correct ParamType, and could not be decoded to the correct ParamType\n const normalized = this.type.$normalize(value);\n if (!this.type.is(normalized)) return false;\n\n // The value was of the correct type, but when encoded, did not match the ParamType's regexp\n const encoded = this.type.encode(normalized);\n return !(isString(encoded) && !this.type.pattern.exec( encoded));\n }\n\n toString() {\n return `{Param:${this.id} ${this.type} squash: '${this.squash}' optional: ${this.isOptional}}`;\n }\n}\n", + "/**\n * Functions that manipulate strings\n *\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_strings\n */ /** */\n\nimport { isString, isArray, isDefined, isNull, isPromise, isInjectable, isObject } from './predicates';\nimport { Rejection } from '../transition/rejectFactory';\nimport { IInjectable, identity, Obj, tail, pushR } from './common';\nimport { pattern, is, not, val, invoke } from './hof';\nimport { Transition } from '../transition/transition';\nimport { Resolvable } from '../resolve/resolvable';\n\n/**\n * Returns a string shortened to a maximum length\n *\n * If the string is already less than the `max` length, return the string.\n * Else return the string, shortened to `max - 3` and append three dots (\"...\").\n *\n * @param max the maximum length of the string to return\n * @param str the input string\n */\nexport function maxLength(max: number, str: string) {\n if (str.length <= max) return str;\n return str.substr(0, max - 3) + '...';\n}\n\n/**\n * Returns a string, with spaces added to the end, up to a desired str length\n *\n * If the string is already longer than the desired length, return the string.\n * Else returns the string, with extra spaces on the end, such that it reaches `length` characters.\n *\n * @param length the desired length of the string to return\n * @param str the input string\n */\nexport function padString(length: number, str: string) {\n while (str.length < length) str += ' ';\n return str;\n}\n\nexport function kebobString(camelCase: string) {\n return camelCase\n .replace(/^([A-Z])/, $1 => $1.toLowerCase()) // replace first char\n .replace(/([A-Z])/g, $1 => '-' + $1.toLowerCase()); // replace rest\n}\n\nfunction _toJson(obj: Obj) {\n return JSON.stringify(obj);\n}\n\nfunction _fromJson(json: string) {\n return isString(json) ? JSON.parse(json) : json;\n}\n\n\nfunction promiseToString(p: Promise) {\n return `Promise(${JSON.stringify(p)})`;\n}\n\nexport function functionToString(fn: Function) {\n const fnStr = fnToString(fn);\n const namedFunctionMatch = fnStr.match(/^(function [^ ]+\\([^)]*\\))/);\n const toStr = namedFunctionMatch ? namedFunctionMatch[1] : fnStr;\n\n const fnName = fn['name'] || '';\n if (fnName && toStr.match(/function \\(/)) {\n return 'function ' + fnName + toStr.substr(9);\n }\n return toStr;\n}\n\nexport function fnToString(fn: IInjectable) {\n const _fn = isArray(fn) ? fn.slice(-1)[0] : fn;\n return _fn && _fn.toString() || 'undefined';\n}\n\nlet stringifyPatternFn: (val: any) => string = null;\nconst stringifyPattern = function(value: any) {\n const isRejection = Rejection.isRejectionPromise;\n\n stringifyPatternFn = stringifyPatternFn || pattern([\n [not(isDefined), val('undefined')],\n [isNull, val('null')],\n [isPromise, val('[Promise]')],\n [isRejection, (x: any) => x._transitionRejection.toString()],\n [is(Rejection), invoke('toString')],\n [is(Transition), invoke('toString')],\n [is(Resolvable), invoke('toString')],\n [isInjectable, functionToString],\n [val(true), identity],\n ]);\n\n return stringifyPatternFn(value);\n};\n\nexport function stringify(o: any) {\n const seen: any[] = [];\n\n function format(value: any) {\n if (isObject(value)) {\n if (seen.indexOf(value) !== -1) return '[circular ref]';\n seen.push(value);\n }\n return stringifyPattern(value);\n }\n\n return JSON.stringify(o, (key, value) => format(value)).replace(/\\\\\"/g, '\"');\n}\n\n/** Returns a function that splits a string on a character or substring */\nexport const beforeAfterSubstr = (char: string) => (str: string): string[] => {\n if (!str) return ['', ''];\n const idx = str.indexOf(char);\n if (idx === -1) return [str, ''];\n return [str.substr(0, idx), str.substr(idx + 1)];\n};\n\nexport const hostRegex = new RegExp('^(?:[a-z]+:)?//[^/]+/');\nexport const stripLastPathElement = (str: string) => str.replace(/\\/[^/]*$/, '');\nexport const splitHash = beforeAfterSubstr('#');\nexport const splitQuery = beforeAfterSubstr('?');\nexport const splitEqual = beforeAfterSubstr('=');\nexport const trimHashVal = (str: string) => str ? str.replace(/^#/, '') : '';\n\n/**\n * Splits on a delimiter, but returns the delimiters in the array\n *\n * #### Example:\n * ```js\n * var splitOnSlashes = splitOnDelim('/');\n * splitOnSlashes(\"/foo\"); // [\"/\", \"foo\"]\n * splitOnSlashes(\"/foo/\"); // [\"/\", \"foo\", \"/\"]\n * ```\n */\nexport function splitOnDelim(delim: string) {\n const re = new RegExp('(' + delim + ')', 'g');\n return (str: string) =>\n str.split(re).filter(identity);\n}\n\n\n/**\n * Reduce fn that joins neighboring strings\n *\n * Given an array of strings, returns a new array\n * where all neighboring strings have been joined.\n *\n * #### Example:\n * ```js\n * let arr = [\"foo\", \"bar\", 1, \"baz\", \"\", \"qux\" ];\n * arr.reduce(joinNeighborsR, []) // [\"foobar\", 1, \"bazqux\" ]\n * ```\n */\nexport function joinNeighborsR(acc: any[], x: any) {\n if (isString(tail(acc)) && isString(x))\n return acc.slice(0, -1).concat(tail(acc) + x);\n return pushR(acc, x);\n}\n\n", + "/** @module state */ /** for typedoc */\nimport { Obj, omit, noop, extend, inherit, values, applyPairs, tail, mapObj, identity } from '../common/common';\nimport { isDefined, isFunction, isString, isArray } from '../common/predicates';\nimport { stringify } from '../common/strings';\nimport { prop, pattern, is, pipe, val } from '../common/hof';\nimport { StateDeclaration } from './interface';\n\nimport { StateObject } from './stateObject';\nimport { StateMatcher } from './stateMatcher';\nimport { Param } from '../params/param';\nimport { UrlMatcherFactory } from '../url/urlMatcherFactory';\nimport { UrlMatcher } from '../url/urlMatcher';\nimport { Resolvable } from '../resolve/resolvable';\nimport { services } from '../common/coreservices';\nimport { ResolvePolicy } from '../resolve/interface';\nimport { ParamFactory } from '../url/interface';\n\nconst parseUrl = (url: string): any => {\n if (!isString(url)) return false;\n const root = url.charAt(0) === '^';\n return { val: root ? url.substring(1) : url, root };\n};\n\nexport type BuilderFunction = (state: StateObject, parent?: BuilderFunction) => any;\n\ninterface Builders {\n [key: string]: BuilderFunction[];\n\n name: BuilderFunction[];\n parent: BuilderFunction[];\n data: BuilderFunction[];\n url: BuilderFunction[];\n navigable: BuilderFunction[];\n params: BuilderFunction[];\n views: BuilderFunction[];\n path: BuilderFunction[];\n includes: BuilderFunction[];\n resolvables: BuilderFunction[];\n}\n\n\nfunction nameBuilder(state: StateObject) {\n return state.name;\n}\n\nfunction selfBuilder(state: StateObject) {\n state.self.$$state = () => state;\n return state.self;\n}\n\nfunction dataBuilder(state: StateObject) {\n if (state.parent && state.parent.data) {\n state.data = state.self.data = inherit(state.parent.data, state.data);\n }\n return state.data;\n}\n\nconst getUrlBuilder = ($urlMatcherFactoryProvider: UrlMatcherFactory, root: () => StateObject) =>\nfunction urlBuilder(state: StateObject) {\n const stateDec: StateDeclaration = state;\n\n // For future states, i.e., states whose name ends with `.**`,\n // match anything that starts with the url prefix\n if (stateDec && stateDec.url && stateDec.name && stateDec.name.match(/\\.\\*\\*$/)) {\n stateDec.url += '{remainder:any}'; // match any path (.*)\n }\n\n const parsed = parseUrl(stateDec.url), parent = state.parent;\n const url = !parsed ? stateDec.url : $urlMatcherFactoryProvider.compile(parsed.val, {\n params: state.params || {},\n paramMap: function (paramConfig: any, isSearch: boolean) {\n if (stateDec.reloadOnSearch === false && isSearch) paramConfig = extend(paramConfig || {}, { dynamic: true });\n return paramConfig;\n },\n });\n\n if (!url) return null;\n if (!$urlMatcherFactoryProvider.isMatcher(url)) throw new Error(`Invalid url '${url}' in state '${state}'`);\n return (parsed && parsed.root) ? url : ((parent && parent.navigable) || root()).url.append( url);\n};\n\nconst getNavigableBuilder = (isRoot: (state: StateObject) => boolean) =>\nfunction navigableBuilder(state: StateObject) {\n return !isRoot(state) && state.url ? state : (state.parent ? state.parent.navigable : null);\n};\n\nconst getParamsBuilder = (paramFactory: ParamFactory) =>\nfunction paramsBuilder(state: StateObject): { [key: string]: Param } {\n const makeConfigParam = (config: any, id: string) => paramFactory.fromConfig(id, null, config);\n const urlParams: Param[] = (state.url && state.url.parameters({ inherit: false })) || [];\n const nonUrlParams: Param[] = values(mapObj(omit(state.params || {}, urlParams.map(prop('id'))), makeConfigParam));\n return urlParams.concat(nonUrlParams).map(p => [p.id, p]).reduce(applyPairs, {});\n};\n\nfunction pathBuilder(state: StateObject) {\n return state.parent ? state.parent.path.concat(state) : /*root*/ [state];\n}\n\nfunction includesBuilder(state: StateObject) {\n const includes = state.parent ? extend({}, state.parent.includes) : {};\n includes[state.name] = true;\n return includes;\n}\n\n/**\n * This is a [[StateBuilder.builder]] function for the `resolve:` block on a [[StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * validates the `resolve` property and converts it to a [[Resolvable]] array.\n *\n * resolve: input value can be:\n *\n * {\n * // analyzed but not injected\n * myFooResolve: function() { return \"myFooData\"; },\n *\n * // function.toString() parsed, \"DependencyName\" dep as string (not min-safe)\n * myBarResolve: function(DependencyName) { return DependencyName.fetchSomethingAsPromise() },\n *\n * // Array split; \"DependencyName\" dep as string\n * myBazResolve: [ \"DependencyName\", function(dep) { return dep.fetchSomethingAsPromise() },\n *\n * // Array split; DependencyType dep as token (compared using ===)\n * myQuxResolve: [ DependencyType, function(dep) { return dep.fetchSometingAsPromise() },\n *\n * // val.$inject used as deps\n * // where:\n * // corgeResolve.$inject = [\"DependencyName\"];\n * // function corgeResolve(dep) { dep.fetchSometingAsPromise() }\n * // then \"DependencyName\" dep as string\n * myCorgeResolve: corgeResolve,\n *\n * // inject service by name\n * // When a string is found, desugar creating a resolve that injects the named service\n * myGraultResolve: \"SomeService\"\n * }\n *\n * or:\n *\n * [\n * new Resolvable(\"myFooResolve\", function() { return \"myFooData\" }),\n * new Resolvable(\"myBarResolve\", function(dep) { return dep.fetchSomethingAsPromise() }, [ \"DependencyName\" ]),\n * { provide: \"myBazResolve\", useFactory: function(dep) { dep.fetchSomethingAsPromise() }, deps: [ \"DependencyName\" ] }\n * ]\n */\nexport function resolvablesBuilder(state: StateObject): Resolvable[] {\n interface Tuple { token: any, val: any, deps: any[], policy: ResolvePolicy }\n\n /** convert resolve: {} and resolvePolicy: {} objects to an array of tuples */\n const objects2Tuples = (resolveObj: Obj, resolvePolicies: { [key: string]: ResolvePolicy }) =>\n Object.keys(resolveObj || {}).map(token => ({ token, val: resolveObj[token], deps: undefined, policy: resolvePolicies[token] }));\n\n /** fetch DI annotations from a function or ng1-style array */\n const annotate = (fn: Function) => {\n const $injector = services.$injector;\n // ng1 doesn't have an $injector until runtime.\n // If the $injector doesn't exist, use \"deferred\" literal as a\n // marker indicating they should be annotated when runtime starts\n return fn['$inject'] || ($injector && $injector.annotate(fn, $injector.strictDi)) || 'deferred';\n };\n\n /** true if the object has both `token` and `resolveFn`, and is probably a [[ResolveLiteral]] */\n const isResolveLiteral = (obj: any) => !!(obj.token && obj.resolveFn);\n\n /** true if the object looks like a provide literal, or a ng2 Provider */\n const isLikeNg2Provider = (obj: any) => !!((obj.provide || obj.token) && (obj.useValue || obj.useFactory || obj.useExisting || obj.useClass));\n\n /** true if the object looks like a tuple from obj2Tuples */\n const isTupleFromObj = (obj: any) => !!(obj && obj.val && (isString(obj.val) || isArray(obj.val) || isFunction(obj.val)));\n\n /** extracts the token from a Provider or provide literal */\n const getToken = (p: any) => p.provide || p.token;\n\n /** Given a literal resolve or provider object, returns a Resolvable */\n const literal2Resolvable = pattern([\n [prop('resolveFn'), p => new Resolvable(getToken(p), p.resolveFn, p.deps, p.policy)],\n [prop('useFactory'), p => new Resolvable(getToken(p), p.useFactory, (p.deps || p.dependencies), p.policy)],\n [prop('useClass'), p => new Resolvable(getToken(p), () => new (p.useClass)(), [], p.policy)],\n [prop('useValue'), p => new Resolvable(getToken(p), () => p.useValue, [], p.policy, p.useValue)],\n [prop('useExisting'), p => new Resolvable(getToken(p), identity, [p.useExisting], p.policy)],\n ]);\n\n const tuple2Resolvable = pattern([\n [pipe(prop('val'), isString), (tuple: Tuple) => new Resolvable(tuple.token, identity, [ tuple.val ], tuple.policy)],\n [pipe(prop('val'), isArray), (tuple: Tuple) => new Resolvable(tuple.token, tail( tuple.val), tuple.val.slice(0, -1), tuple.policy)],\n [pipe(prop('val'), isFunction), (tuple: Tuple) => new Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy)],\n ]);\n\n const item2Resolvable = <(obj: any) => Resolvable> pattern([\n [is(Resolvable), (r: Resolvable) => r],\n [isResolveLiteral, literal2Resolvable],\n [isLikeNg2Provider, literal2Resolvable],\n [isTupleFromObj, tuple2Resolvable],\n [val(true), (obj: any) => { throw new Error('Invalid resolve value: ' + stringify(obj)); }],\n ]);\n\n // If resolveBlock is already an array, use it as-is.\n // Otherwise, assume it's an object and convert to an Array of tuples\n const decl = state.resolve;\n const items: any[] = isArray(decl) ? decl : objects2Tuples(decl, state.resolvePolicy || {});\n return items.map(item2Resolvable);\n}\n\n/**\n * @internalapi A internal global service\n *\n * StateBuilder is a factory for the internal [[StateObject]] objects.\n *\n * When you register a state with the [[StateRegistry]], you register a plain old javascript object which\n * conforms to the [[StateDeclaration]] interface. This factory takes that object and builds the corresponding\n * [[StateObject]] object, which has an API and is used internally.\n *\n * Custom properties or API may be added to the internal [[StateObject]] object by registering a decorator function\n * using the [[builder]] method.\n */\nexport class StateBuilder {\n /** An object that contains all the BuilderFunctions registered, key'd by the name of the State property they build */\n private builders: Builders;\n\n constructor(private matcher: StateMatcher, urlMatcherFactory: UrlMatcherFactory) {\n const self = this;\n\n const root = () => matcher.find('');\n const isRoot = (state: StateObject) => state.name === '';\n\n function parentBuilder(state: StateObject) {\n if (isRoot(state)) return null;\n return matcher.find(self.parentName(state)) || root();\n }\n\n this.builders = {\n name: [ nameBuilder ],\n self: [ selfBuilder ],\n parent: [ parentBuilder ],\n data: [ dataBuilder ],\n // Build a URLMatcher if necessary, either via a relative or absolute URL\n url: [ getUrlBuilder(urlMatcherFactory, root) ],\n // Keep track of the closest ancestor state that has a URL (i.e. is navigable)\n navigable: [ getNavigableBuilder(isRoot) ],\n params: [ getParamsBuilder(urlMatcherFactory.paramFactory) ],\n // Each framework-specific ui-router implementation should define its own `views` builder\n // e.g., src/ng1/statebuilders/views.ts\n views: [],\n // Keep a full path from the root down to this state as this is needed for state activation.\n path: [ pathBuilder ],\n // Speed up $state.includes() as it's used a lot\n includes: [ includesBuilder ],\n resolvables: [ resolvablesBuilder ],\n };\n }\n\n /**\n * Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`).\n * More than one BuilderFunction can be registered for a given property.\n *\n * The BuilderFunction(s) will be used to define the property on any subsequently built [[StateObject]] objects.\n *\n * @param name The name of the State property being registered for.\n * @param fn The BuilderFunction which will be used to build the State property\n * @returns a function which deregisters the BuilderFunction\n */\n builder(name: string, fn: BuilderFunction): (BuilderFunction|BuilderFunction[]|Function) {\n const builders = this.builders;\n const array = builders[name] || [];\n // Backwards compat: if only one builder exists, return it, else return whole arary.\n if (isString(name) && !isDefined(fn)) return array.length > 1 ? array : array[0];\n if (!isString(name) || !isFunction(fn)) return;\n\n builders[name] = array;\n builders[name].push(fn);\n return () => builders[name].splice(builders[name].indexOf(fn, 1)) && null;\n }\n\n /**\n * Builds all of the properties on an essentially blank State object, returning a State object which has all its\n * properties and API built.\n *\n * @param state an uninitialized State object\n * @returns the built State object\n */\n build(state: StateObject): StateObject {\n const { matcher, builders } = this;\n const parent = this.parentName(state);\n\n if (parent && !matcher.find(parent, undefined, false)) {\n return null;\n }\n\n for (const key in builders) {\n if (!builders.hasOwnProperty(key)) continue;\n const chain = builders[key].reduce((parentFn: BuilderFunction, step: BuilderFunction) => (_state) => step(_state, parentFn), noop);\n state[key] = chain(state);\n }\n return state;\n }\n\n parentName(state: StateObject) {\n // name = 'foo.bar.baz.**'\n const name = state.name || '';\n // segments = ['foo', 'bar', 'baz', '.**']\n const segments = name.split('.');\n // segments = ['foo', 'bar', 'baz']\n const lastSegment = segments.pop();\n // segments = ['foo', 'bar'] (ignore .** segment for future states)\n if (lastSegment === '**') segments.pop();\n\n if (segments.length) {\n if (state.parent) {\n throw new Error(`States that specify the 'parent:' property should not have a '.' in their name (${name})`);\n }\n\n // 'foo.bar'\n return segments.join('.');\n }\n\n if (!state.parent) return '';\n return isString(state.parent) ? state.parent : state.parent.name;\n }\n\n name(state: StateObject) {\n const name = state.name;\n if (name.indexOf('.') !== -1 || !state.parent) return name;\n\n const parentName = isString(state.parent) ? state.parent : state.parent.name;\n return parentName ? parentName + '.' + name : name;\n }\n}\n", + "/**\n * @coreapi\n * @module url\n */\n/** for typedoc */\nimport {\n map, defaults, inherit, identity, unnest, tail, find, Obj, pairs, allTrueR, unnestR, arrayTuples,\n} from '../common/common';\nimport { prop, propEq } from '../common/hof';\nimport { isArray, isString, isDefined } from '../common/predicates';\nimport { Param, DefType } from '../params/param';\nimport { ParamTypes } from '../params/paramTypes';\nimport { RawParams } from '../params/interface';\nimport { ParamFactory } from './interface';\nimport { joinNeighborsR, splitOnDelim } from '../common/strings';\n\n/** @hidden */\nfunction quoteRegExp(str: any, param?: any) {\n let surroundPattern = ['', ''], result = str.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, '\\\\$&');\n if (!param) return result;\n\n switch (param.squash) {\n case false:\n surroundPattern = ['(', ')' + (param.isOptional ? '?' : '')]; break;\n case true:\n result = result.replace(/\\/$/, '');\n surroundPattern = ['(?:\\/(', ')|\\/)?'];\n break;\n default:\n surroundPattern = [`(${param.squash}|`, ')?']; break;\n }\n return result + surroundPattern[0] + param.type.pattern.source + surroundPattern[1];\n}\n\n/** @hidden */\nconst memoizeTo = (obj: Obj, _prop: string, fn: Function) =>\n obj[_prop] = obj[_prop] || fn();\n\n/** @hidden */\nconst splitOnSlash = splitOnDelim('/');\n\n/** @hidden */\ninterface UrlMatcherCache {\n segments?: any[];\n weights?: number[];\n path?: UrlMatcher[];\n parent?: UrlMatcher;\n pattern?: RegExp;\n}\n\n/**\n * Matches URLs against patterns.\n *\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL.\n *\n * A URL pattern consists of a path pattern, optionally followed by '?' and a list of search (query)\n * parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by [[UrlMatcher.exec]].\n *\n * - *Path parameters* are defined using curly brace placeholders (`/somepath/{param}`)\n * or colon placeholders (`/somePath/:param`).\n *\n * - *A parameter RegExp* may be defined for a param after a colon\n * (`/somePath/{param:[a-zA-Z0-9]+}`) in a curly brace placeholder.\n * The regexp must match for the url to be matched.\n * Should the regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Note: a RegExp parameter will encode its value using either [[ParamTypes.path]] or [[ParamTypes.query]].\n *\n * - *Custom parameter types* may also be specified after a colon (`/somePath/{param:int}`) in curly brace parameters.\n * See [[UrlMatcherFactory.type]] for more information.\n *\n * - *Catch-all parameters* are defined using an asterisk placeholder (`/somepath/*catchallparam`).\n * A catch-all * parameter value will contain the remainder of the URL.\n *\n * ---\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters).\n * A path parameter matches any number of characters other than '/'. For catch-all\n * placeholders the path parameter matches any number of characters.\n *\n * Examples:\n *\n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n * trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n * '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n * parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n * path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n * * `'/calendar/{start:date}'` - Matches \"/calendar/2014-11-12\" (because the pattern defined\n * in the built-in `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start\n *\n */\nexport class UrlMatcher {\n /** @hidden */\n static nameValidator: RegExp = /^\\w+([-.]+\\w+)*(?:\\[\\])?$/;\n\n /** @hidden */\n private _cache: UrlMatcherCache = { path: [this] };\n /** @hidden */\n private _children: UrlMatcher[] = [];\n /** @hidden */\n private _params: Param[] = [];\n /** @hidden */\n private _segments: string[] = [];\n /** @hidden */\n private _compiled: string[] = [];\n\n /** The pattern that was passed into the constructor */\n public pattern: string;\n\n /** @hidden */\n static encodeDashes(str: string) { // Replace dashes with encoded \"\\-\"\n return encodeURIComponent(str).replace(/-/g, c => `%5C%${c.charCodeAt(0).toString(16).toUpperCase()}`);\n }\n\n /** @hidden Given a matcher, return an array with the matcher's path segments and path params, in order */\n static pathSegmentsAndParams(matcher: UrlMatcher) {\n const staticSegments = matcher._segments;\n const pathParams = matcher._params.filter(p => p.location === DefType.PATH);\n return arrayTuples(staticSegments, pathParams.concat(undefined))\n .reduce(unnestR, [])\n .filter(x => x !== '' && isDefined(x));\n }\n\n /** @hidden Given a matcher, return an array with the matcher's query params */\n static queryParams(matcher: UrlMatcher): Param[] {\n return matcher._params.filter(p => p.location === DefType.SEARCH);\n }\n\n /**\n * Compare two UrlMatchers\n *\n * This comparison function converts a UrlMatcher into static and dynamic path segments.\n * Each static path segment is a static string between a path separator (slash character).\n * Each dynamic segment is a path parameter.\n *\n * The comparison function sorts static segments before dynamic ones.\n */\n static compare(a: UrlMatcher, b: UrlMatcher): number {\n /**\n * Turn a UrlMatcher and all its parent matchers into an array\n * of slash literals '/', string literals, and Param objects\n *\n * This example matcher matches strings like \"/foo/:param/tail\":\n * var matcher = $umf.compile(\"/foo\").append($umf.compile(\"/:param\")).append($umf.compile(\"/\")).append($umf.compile(\"tail\"));\n * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ]\n *\n * Caches the result as `matcher._cache.segments`\n */\n const segments = (matcher: UrlMatcher) =>\n matcher._cache.segments = matcher._cache.segments ||\n matcher._cache.path.map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .reduce(joinNeighborsR, [])\n .map(x => isString(x) ? splitOnSlash(x) : x)\n .reduce(unnestR, []);\n\n /**\n * Gets the sort weight for each segment of a UrlMatcher\n *\n * Caches the result as `matcher._cache.weights`\n */\n const weights = (matcher: UrlMatcher) =>\n matcher._cache.weights = matcher._cache.weights ||\n segments(matcher).map(segment => {\n // Sort slashes first, then static strings, the Params\n if (segment === '/') return 1;\n if (isString(segment)) return 2;\n if (segment instanceof Param) return 3;\n });\n\n /**\n * Pads shorter array in-place (mutates)\n */\n const padArrays = (l: any[], r: any[], padVal: any) => {\n const len = Math.max(l.length, r.length);\n while (l.length < len) l.push(padVal);\n while (r.length < len) r.push(padVal);\n };\n\n const weightsA = weights(a), weightsB = weights(b);\n padArrays(weightsA, weightsB, 0);\n\n const _pairs = arrayTuples(weightsA, weightsB);\n let cmp, i;\n\n for (i = 0; i < _pairs.length; i++) {\n cmp = _pairs[i][0] - _pairs[i][1];\n if (cmp !== 0) return cmp;\n }\n\n return 0;\n }\n\n /**\n * @param pattern The pattern to compile into a matcher.\n * @param paramTypes The [[ParamTypes]] registry\n * @param config A configuration object\n * - `caseInsensitive` - `true` if URL matching should be case insensitive, otherwise `false`, the default value (for backward compatibility) is `false`.\n * - `strict` - `false` if matching against a URL with a trailing slash should be treated as equivalent to a URL without a trailing slash, the default value is `true`.\n */\n constructor(pattern: string, paramTypes: ParamTypes, paramFactory: ParamFactory, public config?: any) {\n this.pattern = pattern;\n this.config = defaults(this.config, {\n params: {},\n strict: true,\n caseInsensitive: false,\n paramMap: identity,\n });\n\n // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n // '*' name\n // ':' name\n // '{' name '}'\n // '{' name ':' regexp '}'\n // The regular expression is somewhat complicated due to the need to allow curly braces\n // inside the regular expression. The placeholder regexp breaks down as follows:\n // ([:*])([\\w\\[\\]]+) - classic placeholder ($1 / $2) (search version has - for snake-case)\n // \\{([\\w\\[\\]]+)(?:\\:\\s*( ... ))?\\} - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case\n // (?: ... | ... | ... )+ - the regexp consists of any number of atoms, an atom being either\n // [^{}\\\\]+ - anything other than curly braces or backslash\n // \\\\. - a backslash escape\n // \\{(?:[^{}\\\\]+|\\\\.)*\\} - a matched set of curly braces containing other atoms\n const placeholder = /([:*])([\\w\\[\\]]+)|\\{([\\w\\[\\]]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g;\n const searchPlaceholder = /([:]?)([\\w\\[\\].-]+)|\\{([\\w\\[\\].-]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g;\n const patterns: any[][] = [];\n let last = 0, matchArray: RegExpExecArray;\n\n const checkParamErrors = (id: string) => {\n if (!UrlMatcher.nameValidator.test(id)) throw new Error(`Invalid parameter name '${id}' in pattern '${pattern}'`);\n if (find(this._params, propEq('id', id))) throw new Error(`Duplicate parameter name '${id}' in pattern '${pattern}'`);\n };\n\n // Split into static segments separated by path parameter placeholders.\n // The number of segments is always 1 more than the number of parameters.\n const matchDetails = (m: RegExpExecArray, isSearch: boolean) => {\n // IE[78] returns '' for unmatched groups instead of null\n const id: string = m[2] || m[3];\n const regexp: string = isSearch ? m[4] : m[4] || (m[1] === '*' ? '[\\\\s\\\\S]*' : null);\n\n const makeRegexpType = (str) => inherit(paramTypes.type(isSearch ? 'query' : 'path'), {\n pattern: new RegExp(str, this.config.caseInsensitive ? 'i' : undefined),\n });\n\n return {\n id,\n regexp,\n cfg: this.config.params[id],\n segment: pattern.substring(last, m.index),\n type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp),\n };\n };\n\n let p: any, segment: string;\n\n // tslint:disable-next-line:no-conditional-assignment\n while ((matchArray = placeholder.exec(pattern))) {\n p = matchDetails(matchArray, false);\n if (p.segment.indexOf('?') >= 0) break; // we're into the search part\n\n checkParamErrors(p.id);\n this._params.push(paramFactory.fromPath(p.id, p.type, this.config.paramMap(p.cfg, false)));\n this._segments.push(p.segment);\n patterns.push([p.segment, tail(this._params)]);\n last = placeholder.lastIndex;\n }\n segment = pattern.substring(last);\n\n // Find any search parameter names and remove them from the last segment\n const i = segment.indexOf('?');\n\n if (i >= 0) {\n const search = segment.substring(i);\n segment = segment.substring(0, i);\n\n if (search.length > 0) {\n last = 0;\n\n // tslint:disable-next-line:no-conditional-assignment\n while ((matchArray = searchPlaceholder.exec(search))) {\n p = matchDetails(matchArray, true);\n checkParamErrors(p.id);\n this._params.push(paramFactory.fromSearch(p.id, p.type, this.config.paramMap(p.cfg, true)));\n last = placeholder.lastIndex;\n // check if ?&\n }\n }\n }\n\n this._segments.push(segment);\n this._compiled = patterns.map(_pattern => quoteRegExp.apply(null, _pattern)).concat(quoteRegExp(segment));\n }\n\n /**\n * Creates a new concatenated UrlMatcher\n *\n * Builds a new UrlMatcher by appending another UrlMatcher to this one.\n *\n * @param url A `UrlMatcher` instance to append as a child of the current `UrlMatcher`.\n */\n append(url: UrlMatcher): UrlMatcher {\n this._children.push(url);\n url._cache = {\n path: this._cache.path.concat(url),\n parent: this,\n pattern: null,\n };\n return url;\n }\n\n /** @hidden */\n isRoot(): boolean {\n return this._cache.path[0] === this;\n }\n\n /** Returns the input pattern string */\n toString(): string {\n return this.pattern;\n }\n\n /**\n * Tests the specified url/path against this matcher.\n *\n * Tests if the given url matches this matcher's pattern, and returns an object containing the captured\n * parameter values. Returns null if the path does not match.\n *\n * The returned object contains the values\n * of any search parameters that are mentioned in the pattern, but their value may be null if\n * they are not present in `search`. This means that search parameters are always treated\n * as optional.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', {\n * x: '1', q: 'hello'\n * });\n * // returns { id: 'bob', q: 'hello', r: null }\n * ```\n *\n * @param path The URL path to match, e.g. `$location.path()`.\n * @param search URL search parameters, e.g. `$location.search()`.\n * @param hash URL hash e.g. `$location.hash()`.\n * @param options\n *\n * @returns The captured parameter values.\n */\n exec(path: string, search: any = {}, hash?: string, options: any = {}): RawParams {\n const match = memoizeTo(this._cache, 'pattern', () => {\n return new RegExp([\n '^',\n unnest(this._cache.path.map(prop('_compiled'))).join(''),\n this.config.strict === false ? '\\/?' : '',\n '$',\n ].join(''), this.config.caseInsensitive ? 'i' : undefined);\n }).exec(path);\n\n if (!match) return null;\n\n // options = defaults(options, { isolate: false });\n\n const allParams: Param[] = this.parameters(),\n pathParams: Param[] = allParams.filter(param => !param.isSearch()),\n searchParams: Param[] = allParams.filter(param => param.isSearch()),\n nPathSegments = this._cache.path.map(urlm => urlm._segments.length - 1).reduce((a, x) => a + x),\n values: RawParams = {};\n\n if (nPathSegments !== match.length - 1)\n throw new Error(`Unbalanced capture group in route '${this.pattern}'`);\n\n function decodePathArray(paramVal: string) {\n const reverseString = (str: string) => str.split('').reverse().join('');\n const unquoteDashes = (str: string) => str.replace(/\\\\-/g, '-');\n\n const split = reverseString(paramVal).split(/-(?!\\\\)/);\n const allReversed = map(split, reverseString);\n return map(allReversed, unquoteDashes).reverse();\n }\n\n for (let i = 0; i < nPathSegments; i++) {\n const param: Param = pathParams[i];\n let value: (any|any[]) = match[i + 1];\n\n // if the param value matches a pre-replace pair, replace the value before decoding.\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n if (value && param.array === true) value = decodePathArray(value);\n if (isDefined(value)) value = param.type.decode(value);\n values[param.id] = param.value(value);\n }\n searchParams.forEach(param => {\n let value = search[param.id];\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n if (isDefined(value)) value = param.type.decode(value);\n values[param.id] = param.value(value);\n });\n\n if (hash) values['#'] = hash;\n\n return values;\n }\n\n /**\n * @hidden\n * Returns all the [[Param]] objects of all path and search parameters of this pattern in order of appearance.\n *\n * @returns {Array.} An array of [[Param]] objects. Must be treated as read-only. If the\n * pattern has no parameters, an empty array is returned.\n */\n parameters(opts: any = {}): Param[] {\n if (opts.inherit === false) return this._params;\n return unnest(this._cache.path.map(matcher => matcher._params));\n }\n\n /**\n * @hidden\n * Returns a single parameter from this UrlMatcher by id\n *\n * @param id\n * @param opts\n * @returns {T|Param|any|boolean|UrlMatcher|null}\n */\n parameter(id: string, opts: any = {}): Param {\n const findParam = () => {\n for (const param of this._params) {\n if (param.id === id) return param;\n }\n };\n\n const parent = this._cache.parent;\n return findParam() || (opts.inherit !== false && parent && parent.parameter(id, opts)) || null;\n }\n\n /**\n * Validates the input parameter values against this UrlMatcher\n *\n * Checks an object hash of parameters to validate their correctness according to the parameter\n * types of this `UrlMatcher`.\n *\n * @param params The object hash of parameters to validate.\n * @returns Returns `true` if `params` validates, otherwise `false`.\n */\n validates(params: RawParams): boolean {\n const validParamVal = (param: Param, val: any) =>\n !param || param.validates(val);\n\n params = params || {};\n\n // I'm not sure why this checks only the param keys passed in, and not all the params known to the matcher\n const paramSchema = this.parameters().filter(paramDef => params.hasOwnProperty(paramDef.id));\n return paramSchema.map(paramDef => validParamVal(paramDef, params[paramDef.id])).reduce(allTrueR, true);\n }\n\n /**\n * Given a set of parameter values, creates a URL from this UrlMatcher.\n *\n * Creates a URL that matches this pattern by substituting the specified values\n * for the path and search parameters.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n * // returns '/user/bob?q=yes'\n * ```\n *\n * @param values the values to substitute for the parameters in this pattern.\n * @returns the formatted URL (path and optionally search part).\n */\n format(values: RawParams = {}) {\n // Build the full path of UrlMatchers (including all parent UrlMatchers)\n const urlMatchers = this._cache.path;\n\n // Extract all the static segments and Params (processed as ParamDetails)\n // into an ordered array\n const pathSegmentsAndParams: Array = urlMatchers.map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .map(x => isString(x) ? x : getDetails(x));\n\n // Extract the query params into a separate array\n const queryParams: Array = urlMatchers.map(UrlMatcher.queryParams)\n .reduce(unnestR, [])\n .map(getDetails);\n\n const isInvalid = (param: ParamDetails) => param.isValid === false;\n if (pathSegmentsAndParams.concat(queryParams).filter(isInvalid).length) {\n return null;\n }\n\n /**\n * Given a Param, applies the parameter value, then returns detailed information about it\n */\n function getDetails(param: Param): ParamDetails {\n // Normalize to typed value\n const value = param.value(values[param.id]);\n const isValid = param.validates(value);\n const isDefaultValue = param.isDefaultValue(value);\n // Check if we're in squash mode for the parameter\n const squash = isDefaultValue ? param.squash : false;\n // Allow the Parameter's Type to encode the value\n const encoded = param.type.encode(value);\n\n return { param, value, isValid, isDefaultValue, squash, encoded };\n }\n\n // Build up the path-portion from the list of static segments and parameters\n const pathString = pathSegmentsAndParams.reduce((acc: string, x: string|ParamDetails) => {\n // The element is a static segment (a raw string); just append it\n if (isString(x)) return acc + x;\n\n // Otherwise, it's a ParamDetails.\n const { squash, encoded, param } = x;\n\n // If squash is === true, try to remove a slash from the path\n if (squash === true) return (acc.match(/\\/$/)) ? acc.slice(0, -1) : acc;\n // If squash is a string, use the string for the param value\n if (isString(squash)) return acc + squash;\n if (squash !== false) return acc; // ?\n if (encoded == null) return acc;\n // If this parameter value is an array, encode the value using encodeDashes\n if (isArray(encoded)) return acc + map( encoded, UrlMatcher.encodeDashes).join('-');\n // If the parameter type is \"raw\", then do not encodeURIComponent\n if (param.raw) return acc + encoded;\n // Encode the value\n return acc + encodeURIComponent( encoded);\n }, '');\n\n // Build the query string by applying parameter values (array or regular)\n // then mapping to key=value, then flattening and joining using \"&\"\n const queryString = queryParams.map((paramDetails: ParamDetails) => {\n let { param, squash, encoded, isDefaultValue } = paramDetails;\n if (encoded == null || (isDefaultValue && squash !== false)) return;\n if (!isArray(encoded)) encoded = [ encoded];\n if (encoded.length === 0) return;\n if (!param.raw) encoded = map( encoded, encodeURIComponent);\n\n return ( encoded).map(val => `${param.id}=${val}`);\n }).filter(identity).reduce(unnestR, []).join('&');\n\n // Concat the pathstring with the queryString (if exists) and the hashString (if exists)\n return pathString + (queryString ? `?${queryString}` : '') + (values['#'] ? '#' + values['#'] : '');\n }\n}\n\n/** @hidden */\ninterface ParamDetails {\n param: Param;\n value: any;\n isValid: boolean;\n isDefaultValue: boolean;\n squash: (boolean|string);\n encoded: (string|string[]);\n}\n", + "/**\n * @internalapi\n * @module url\n */\n/** for typedoc */\nimport { createProxyFunctions, extend, removeFrom } from '../common/common';\nimport { isDefined, isFunction, isString } from '../common/predicates';\nimport { UrlMatcher } from './urlMatcher';\nimport { RawParams } from '../params/interface';\nimport { Disposable } from '../interface';\nimport { UIRouter } from '../router';\nimport { is, pattern, val } from '../common/hof';\nimport { UrlRuleFactory } from './urlRule';\nimport { TargetState } from '../state/targetState';\nimport { MatcherUrlRule, MatchResult, UrlParts, UrlRule, UrlRuleHandlerFn, UrlRuleMatchFn, UrlRulesApi, UrlSyncApi } from './interface';\nimport { TargetStateDef } from '../state/interface';\nimport { stripLastPathElement } from '../common';\n\n/** @hidden */\nfunction appendBasePath(url: string, isHtml5: boolean, absolute: boolean, baseHref: string): string {\n if (baseHref === '/') return url;\n if (isHtml5) return stripLastPathElement(baseHref) + url;\n if (absolute) return baseHref.slice(1) + url;\n return url;\n}\n\n/** @hidden */\nconst prioritySort = (a: UrlRule, b: UrlRule) =>\n (b.priority || 0) - (a.priority || 0);\n\n/** @hidden */\nconst typeSort = (a: UrlRule, b: UrlRule) => {\n const weights = { 'STATE': 4, 'URLMATCHER': 4, 'REGEXP': 3, 'RAW': 2, 'OTHER': 1 };\n return (weights[a.type] || 0) - (weights[b.type] || 0);\n};\n\n/** @hidden */\nconst urlMatcherSort = (a: MatcherUrlRule, b: MatcherUrlRule) =>\n !a.urlMatcher || !b.urlMatcher ? 0 : UrlMatcher.compare(a.urlMatcher, b.urlMatcher);\n\n/** @hidden */\nconst idSort = (a: UrlRule, b: UrlRule) => {\n // Identically sorted STATE and URLMATCHER best rule will be chosen by `matchPriority` after each rule matches the URL\n const useMatchPriority = { STATE: true, URLMATCHER: true };\n const equal = useMatchPriority[a.type] && useMatchPriority[b.type];\n return equal ? 0 : (a.$id || 0) - (b.$id || 0);\n};\n\n/**\n * Default rule priority sorting function.\n *\n * Sorts rules by:\n *\n * - Explicit priority (set rule priority using [[UrlRulesApi.when]])\n * - Rule type (STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1)\n * - `UrlMatcher` specificity ([[UrlMatcher.compare]]): works for STATE and URLMATCHER types to pick the most specific rule.\n * - Rule registration order (for rule types other than STATE and URLMATCHER)\n * - Equally sorted State and UrlMatcher rules will each match the URL.\n * Then, the *best* match is chosen based on how many parameter values were matched.\n *\n * @coreapi\n */\nlet defaultRuleSortFn: (a: UrlRule, b: UrlRule) => number;\ndefaultRuleSortFn = (a, b) => {\n let cmp = prioritySort(a, b);\n if (cmp !== 0) return cmp;\n\n cmp = typeSort(a, b);\n if (cmp !== 0) return cmp;\n\n cmp = urlMatcherSort(a as MatcherUrlRule, b as MatcherUrlRule);\n if (cmp !== 0) return cmp;\n\n return idSort(a, b);\n};\n\n/**\n * Updates URL and responds to URL changes\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class updates the URL when the state changes.\n * It also responds to changes in the URL.\n */\nexport class UrlRouter implements UrlRulesApi, UrlSyncApi, Disposable {\n /** used to create [[UrlRule]] objects for common cases */\n public urlRuleFactory: UrlRuleFactory;\n\n /** @hidden */ private _router: UIRouter;\n /** @hidden */ private location: string;\n /** @hidden */ private _sortFn = defaultRuleSortFn;\n /** @hidden */ private _stopFn: Function;\n /** @hidden */ _rules: UrlRule[] = [];\n /** @hidden */ private _otherwiseFn: UrlRule;\n /** @hidden */ interceptDeferred = false;\n /** @hidden */ private _id = 0;\n /** @hidden */ private _sorted = false;\n\n /** @hidden */\n constructor(router: UIRouter) {\n this._router = router;\n this.urlRuleFactory = new UrlRuleFactory(router);\n createProxyFunctions(val(UrlRouter.prototype), this, val(this));\n }\n\n /** @internalapi */\n dispose() {\n this.listen(false);\n this._rules = [];\n delete this._otherwiseFn;\n }\n\n /** @inheritdoc */\n sort(compareFn?: (a: UrlRule, b: UrlRule) => number) {\n this._rules = this.stableSort(this._rules, this._sortFn = compareFn || this._sortFn);\n this._sorted = true;\n }\n\n private ensureSorted() {\n this._sorted || this.sort();\n }\n\n private stableSort(arr, compareFn) {\n const arrOfWrapper = arr.map((elem, idx) => ({ elem, idx }));\n\n arrOfWrapper.sort((wrapperA, wrapperB) => {\n const cmpDiff = compareFn(wrapperA.elem, wrapperB.elem);\n return cmpDiff === 0\n ? wrapperA.idx - wrapperB.idx\n : cmpDiff;\n });\n\n return arrOfWrapper.map(wrapper => wrapper.elem);\n }\n\n /**\n * Given a URL, check all rules and return the best [[MatchResult]]\n * @param url\n * @returns {MatchResult}\n */\n match(url: UrlParts): MatchResult {\n this.ensureSorted();\n\n url = extend({ path: '', search: {}, hash: '' }, url);\n const rules = this.rules();\n if (this._otherwiseFn) rules.push(this._otherwiseFn);\n\n // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined\n\n const checkRule = (rule: UrlRule): MatchResult => {\n const match = rule.match(url, this._router);\n return match && { match, rule, weight: rule.matchPriority(match) };\n };\n\n // The rules are pre-sorted.\n // - Find the first matching rule.\n // - Find any other matching rule that sorted *exactly the same*, according to `.sort()`.\n // - Choose the rule with the highest match weight.\n let best: MatchResult;\n for (let i = 0; i < rules.length; i++) {\n // Stop when there is a 'best' rule and the next rule sorts differently than it.\n if (best && this._sortFn(rules[i], best.rule) !== 0) break;\n\n const current = checkRule(rules[i]);\n // Pick the best MatchResult\n best = (!best || current && current.weight > best.weight) ? current : best;\n }\n\n return best;\n }\n\n /** @inheritdoc */\n sync(evt?) {\n if (evt && evt.defaultPrevented) return;\n\n const router = this._router,\n $url = router.urlService,\n $state = router.stateService;\n\n const url: UrlParts = {\n path: $url.path(), search: $url.search(), hash: $url.hash(),\n };\n\n const best = this.match(url);\n\n const applyResult = pattern([\n [isString, (newurl: string) => $url.url(newurl, true)],\n [TargetState.isDef, (def: TargetStateDef) => $state.go(def.state, def.params, def.options)],\n [is(TargetState), (target: TargetState) => $state.go(target.state(), target.params(), target.options())],\n ]);\n\n applyResult(best && best.rule.handler(best.match, url, router));\n }\n\n /** @inheritdoc */\n listen(enabled?: boolean): Function {\n if (enabled === false) {\n this._stopFn && this._stopFn();\n delete this._stopFn;\n } else {\n return this._stopFn = this._stopFn || this._router.urlService.onChange(evt => this.sync(evt));\n }\n }\n\n /**\n * Internal API.\n * @internalapi\n */\n update(read?: boolean) {\n const $url = this._router.locationService;\n if (read) {\n this.location = $url.url();\n return;\n }\n if ($url.url() === this.location) return;\n\n $url.url(this.location, true);\n }\n\n /**\n * Internal API.\n *\n * Pushes a new location to the browser history.\n *\n * @internalapi\n * @param urlMatcher\n * @param params\n * @param options\n */\n push(urlMatcher: UrlMatcher, params?: RawParams, options?: { replace?: (string|boolean) }) {\n const replace = options && !!options.replace;\n this._router.urlService.url(urlMatcher.format(params || {}), replace);\n }\n\n /**\n * Builds and returns a URL with interpolated parameters\n *\n * #### Example:\n * ```js\n * matcher = $umf.compile(\"/about/:person\");\n * params = { person: \"bob\" };\n * $bob = $urlRouter.href(matcher, params);\n * // $bob == \"/about/bob\";\n * ```\n *\n * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate.\n * @param params An object of parameter values to fill the matcher's required parameters.\n * @param options Options object. The options are:\n *\n * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n *\n * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`\n */\n href(urlMatcher: UrlMatcher, params?: any, options?: { absolute: boolean }): string {\n let url = urlMatcher.format(params);\n if (url == null) return null;\n\n options = options || { absolute: false };\n\n const cfg = this._router.urlService.config;\n const isHtml5 = cfg.html5Mode();\n if (!isHtml5 && url !== null) {\n url = '#' + cfg.hashPrefix() + url;\n }\n url = appendBasePath(url, isHtml5, options.absolute, cfg.baseHref());\n\n if (!options.absolute || !url) {\n return url;\n }\n\n const slash = (!isHtml5 && url ? '/' : '');\n const cfgPort = cfg.port();\n const port = (cfgPort === 80 || cfgPort === 443 ? '' : ':' + cfgPort);\n\n return [cfg.protocol(), '://', cfg.host(), port, slash, url].join('');\n }\n\n\n /**\n * Manually adds a URL Rule.\n *\n * Usually, a url rule is added using [[StateDeclaration.url]] or [[when]].\n * This api can be used directly for more control (to register a [[BaseUrlRule]], for example).\n * Rules can be created using [[UrlRouter.urlRuleFactory]], or create manually as simple objects.\n *\n * A rule should have a `match` function which returns truthy if the rule matched.\n * It should also have a `handler` function which is invoked if the rule is the best match.\n *\n * @return a function that deregisters the rule\n */\n rule(rule: UrlRule): Function {\n if (!UrlRuleFactory.isUrlRule(rule)) throw new Error('invalid rule');\n rule.$id = this._id++;\n rule.priority = rule.priority || 0;\n\n this._rules.push(rule);\n this._sorted = false;\n\n return () => this.removeRule(rule);\n }\n\n /** @inheritdoc */\n removeRule(rule): void {\n removeFrom(this._rules, rule);\n }\n\n /** @inheritdoc */\n rules(): UrlRule[] {\n this.ensureSorted();\n return this._rules.slice();\n }\n\n /** @inheritdoc */\n otherwise(handler: string|UrlRuleHandlerFn|TargetState|TargetStateDef) {\n const handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n this._otherwiseFn = this.urlRuleFactory.create(val(true), handlerFn);\n this._sorted = false;\n }\n\n /** @inheritdoc */\n initial(handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef) {\n const handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n const matchFn: UrlRuleMatchFn = (urlParts, router) =>\n router.globals.transitionHistory.size() === 0 && !!/^\\/?$/.exec(urlParts.path);\n\n this.rule(this.urlRuleFactory.create(matchFn, handlerFn));\n }\n\n /** @inheritdoc */\n when(matcher: (RegExp|UrlMatcher|string), handler: string|UrlRuleHandlerFn, options?: { priority: number }): UrlRule {\n const rule = this.urlRuleFactory.create(matcher, handler);\n if (isDefined(options && options.priority)) rule.priority = options.priority;\n this.rule(rule);\n return rule;\n }\n\n /** @inheritdoc */\n deferIntercept(defer?: boolean) {\n if (defer === undefined) defer = true;\n this.interceptDeferred = defer;\n }\n}\n\nfunction getHandlerFn(handler: string|UrlRuleHandlerFn|TargetState|TargetStateDef): UrlRuleHandlerFn {\n if (!isFunction(handler) && !isString(handler) && !is(TargetState)(handler) && !TargetState.isDef(handler)) {\n throw new Error(\"'handler' must be a string, function, TargetState, or have a state: 'newtarget' property\");\n }\n return isFunction(handler) ? handler as UrlRuleHandlerFn : val(handler);\n}\n", + "/** @module hooks */ /** */\nimport { Transition } from '../transition/transition';\nimport { UIRouter } from '../router';\nimport { TransitionService } from '../transition/transitionService';\n\nfunction addCoreResolvables(trans: Transition) {\n trans.addResolvable({ token: UIRouter, deps: [], resolveFn: () => trans.router, data: trans.router }, '');\n trans.addResolvable({ token: Transition, deps: [], resolveFn: () => trans, data: trans }, '');\n trans.addResolvable({ token: '$transition$', deps: [], resolveFn: () => trans, data: trans }, '');\n trans.addResolvable({ token: '$stateParams', deps: [], resolveFn: () => trans.params(), data: trans.params() }, '');\n\n trans.entering().forEach(state => {\n trans.addResolvable({ token: '$state$', deps: [], resolveFn: () => state, data: state }, state);\n });\n}\n\nexport const registerAddCoreResolvables = (transitionService: TransitionService) =>\n transitionService.onCreate({}, addCoreResolvables);\n", + "/** @module hooks */\n/** for typedoc */\nimport { TransitionStateHookFn } from '../transition/interface';\nimport { Transition } from '../transition/transition';\nimport { TransitionService } from '../transition/transitionService';\nimport { StateDeclaration } from '../state/interface';\nimport { StateObject } from '../state/stateObject';\n\n/**\n * A factory which creates an onEnter, onExit or onRetain transition hook function\n *\n * The returned function invokes the (for instance) state.onEnter hook when the\n * state is being entered.\n *\n * @hidden\n */\nfunction makeEnterExitRetainHook(hookName: string): TransitionStateHookFn {\n return (transition: Transition, state: StateDeclaration) => {\n const _state: StateObject = state.$$state();\n const hookFn: TransitionStateHookFn = _state[hookName];\n return hookFn(transition, state);\n };\n}\n\n/**\n * The [[TransitionStateHookFn]] for onExit\n *\n * When the state is being exited, the state's .onExit function is invoked.\n *\n * Registered using `transitionService.onExit({ exiting: (state) => !!state.onExit }, onExitHook);`\n *\n * See: [[IHookRegistry.onExit]]\n */\nconst onExitHook: TransitionStateHookFn = makeEnterExitRetainHook('onExit');\nexport const registerOnExitHook = (transitionService: TransitionService) =>\n transitionService.onExit({ exiting: state => !!state.onExit }, onExitHook);\n\n/**\n * The [[TransitionStateHookFn]] for onRetain\n *\n * When the state was already entered, and is not being exited or re-entered, the state's .onRetain function is invoked.\n *\n * Registered using `transitionService.onRetain({ retained: (state) => !!state.onRetain }, onRetainHook);`\n *\n * See: [[IHookRegistry.onRetain]]\n */\nconst onRetainHook: TransitionStateHookFn = makeEnterExitRetainHook('onRetain');\nexport const registerOnRetainHook = (transitionService: TransitionService) =>\n transitionService.onRetain({ retained: state => !!state.onRetain }, onRetainHook);\n\n/**\n * The [[TransitionStateHookFn]] for onEnter\n *\n * When the state is being entered, the state's .onEnter function is invoked.\n *\n * Registered using `transitionService.onEnter({ entering: (state) => !!state.onEnter }, onEnterHook);`\n *\n * See: [[IHookRegistry.onEnter]]\n */\nconst onEnterHook: TransitionStateHookFn = makeEnterExitRetainHook('onEnter');\nexport const registerOnEnterHook = (transitionService: TransitionService) =>\n transitionService.onEnter({ entering: state => !!state.onEnter }, onEnterHook);\n\n", + "/** @module hooks */ /** */\nimport { Transition } from '../transition/transition';\nimport { TransitionService } from '../transition/transitionService';\nimport { TransitionHookFn } from '../transition/interface';\nimport { StateDeclaration, LazyLoadResult } from '../state/interface';\nimport { services } from '../common/coreservices';\nimport { StateRule } from '../url/interface';\n\n/**\n * A [[TransitionHookFn]] that performs lazy loading\n *\n * When entering a state \"abc\" which has a `lazyLoad` function defined:\n * - Invoke the `lazyLoad` function (unless it is already in process)\n * - Flag the hook function as \"in process\"\n * - The function should return a promise (that resolves when lazy loading is complete)\n * - Wait for the promise to settle\n * - If the promise resolves to a [[LazyLoadResult]], then register those states\n * - Flag the hook function as \"not in process\"\n * - If the hook was successful\n * - Remove the `lazyLoad` function from the state declaration\n * - If all the hooks were successful\n * - Retry the transition (by returning a TargetState)\n *\n * ```\n * .state('abc', {\n * component: 'fooComponent',\n * lazyLoad: () => System.import('./fooComponent')\n * });\n * ```\n *\n * See [[StateDeclaration.lazyLoad]]\n */\nconst lazyLoadHook: TransitionHookFn = (transition: Transition) => {\n const router = transition.router;\n\n function retryTransition() {\n if (transition.originalTransition().options().source !== 'url') {\n // The original transition was not triggered via url sync\n // The lazy state should be loaded now, so re-try the original transition\n const orig = transition.targetState();\n return router.stateService.target(orig.identifier(), orig.params(), orig.options());\n }\n\n // The original transition was triggered via url sync\n // Run the URL rules and find the best match\n const $url = router.urlService;\n const result = $url.match($url.parts());\n const rule = result && result.rule;\n\n // If the best match is a state, redirect the transition (instead\n // of calling sync() which supersedes the current transition)\n if (rule && rule.type === 'STATE') {\n const state = (rule as StateRule).state;\n const params = result.match;\n return router.stateService.target(state, params, transition.options());\n }\n\n // No matching state found, so let .sync() choose the best non-state match/otherwise\n router.urlService.sync();\n }\n\n const promises = transition.entering()\n .filter(state => !!state.$$state().lazyLoad)\n .map(state => lazyLoadState(transition, state));\n\n return services.$q.all(promises).then(retryTransition);\n};\n\nexport const registerLazyLoadHook = (transitionService: TransitionService) =>\n transitionService.onBefore({ entering: (state) => !!state.lazyLoad }, lazyLoadHook);\n\n\n/**\n * Invokes a state's lazy load function\n *\n * @param transition a Transition context\n * @param state the state to lazy load\n * @returns A promise for the lazy load result\n */\nexport function lazyLoadState(transition: Transition, state: StateDeclaration): Promise {\n const lazyLoadFn = state.$$state().lazyLoad;\n\n // Store/get the lazy load promise on/from the hookfn so it doesn't get re-invoked\n let promise = lazyLoadFn['_promise'];\n if (!promise) {\n const success = (result) => {\n delete state.lazyLoad;\n delete state.$$state().lazyLoad;\n delete lazyLoadFn['_promise'];\n return result;\n };\n\n const error = (err) => {\n delete lazyLoadFn['_promise'];\n return services.$q.reject(err);\n };\n\n promise = lazyLoadFn['_promise'] =\n services.$q.when(lazyLoadFn(transition, state))\n .then(updateStateRegistry)\n .then(success, error);\n }\n\n /** Register any lazy loaded state definitions */\n function updateStateRegistry(result: LazyLoadResult) {\n if (result && Array.isArray(result.states)) {\n result.states.forEach(_state => transition.router.stateRegistry.register(_state));\n }\n return result;\n }\n\n return promise;\n}\n", "/** @module hooks */ /** */\n\nimport { trace } from '../common/trace';\nimport { Rejection } from '../transition/rejectFactory';\nimport { TransitionService } from '../transition/transitionService';\nimport { Transition } from '../transition/transition';\n\n/**\n * A [[TransitionHookFn]] that skips a transition if it should be ignored\n *\n * This hook is invoked at the end of the onBefore phase.\n *\n * If the transition should be ignored (because no parameter or states changed)\n * then the transition is ignored and not processed.\n */\nfunction ignoredHook(trans: Transition) {\n const ignoredReason = trans._ignoredReason();\n if (!ignoredReason) return;\n\n trace.traceTransitionIgnored(trans);\n\n const pending = trans.router.globals.transition;\n\n // The user clicked a link going back to the *current state* ('A')\n // However, there is also a pending transition in flight (to 'B')\n // Abort the transition to 'B' because the user now wants to be back at 'A'.\n if (ignoredReason === 'SameAsCurrent' && pending) {\n pending.abort();\n }\n\n return Rejection.ignored().toPromise();\n}\n\nexport const registerIgnoredTransitionHook = (transitionService: TransitionService) =>\n transitionService.onBefore({}, ignoredHook, { priority: -9999 });\n", "/** @module hooks */ /** */\n\nimport { TransitionService } from '../transition/transitionService';\nimport { Transition } from '../transition/transition';\n\n/**\n * A [[TransitionHookFn]] that rejects the Transition if it is invalid\n *\n * This hook is invoked at the end of the onBefore phase.\n * If the transition is invalid (for example, param values do not validate)\n * then the transition is rejected.\n */\nfunction invalidTransitionHook(trans: Transition) {\n if (!trans.valid()) {\n throw new Error(trans.error());\n }\n}\n\nexport const registerInvalidTransitionHook = (transitionService: TransitionService) =>\n transitionService.onBefore({}, invalidTransitionHook, { priority: -10000 });\n", - "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport {\n LocationConfig, LocationServices, identity, unnestR, isArray, splitEqual, splitHash, splitQuery\n} from \"../common\";\nimport { UIRouter } from \"../router\";\n\nexport const keyValsToObjectR = (accum, [key, val]) => {\n if (!accum.hasOwnProperty(key)) {\n accum[key] = val;\n } else if (isArray(accum[key])) {\n accum[key].push(val);\n } else {\n accum[key] = [accum[key], val]\n }\n return accum;\n};\n\nexport const getParams = (queryString: string): any =>\n queryString.split(\"&\").filter(identity).map(splitEqual).reduce(keyValsToObjectR, {});\n\nexport function parseUrl(url: string) {\n const orEmptyString = x => x || \"\";\n let [beforehash, hash] = splitHash(url).map(orEmptyString);\n let [path, search] = splitQuery(beforehash).map(orEmptyString);\n\n return { path, search, hash, url };\n}\n\nexport const buildUrl = (loc: LocationServices) => {\n let path = loc.path();\n let searchObject = loc.search();\n let hash = loc.hash();\n\n let search = Object.keys(searchObject).map(key => {\n let param = searchObject[key];\n let vals = isArray(param) ? param : [param];\n return vals.map(val => key + \"=\" + val);\n }).reduce(unnestR, []).join(\"&\");\n\n return path + (search ? \"?\" + search : \"\") + (hash ? \"#\" + hash : \"\");\n};\n\nexport function locationPluginFactory(\n name: string,\n isHtml5: boolean,\n serviceClass: { new(router?: UIRouter): LocationServices },\n configurationClass: { new(router?: UIRouter, isHtml5?: boolean): LocationConfig }\n) {\n return function(router: UIRouter) {\n let service = router.locationService = new serviceClass(router);\n let configuration = router.locationConfig = new configurationClass(router, isHtml5);\n\n function dispose(router: UIRouter) {\n router.dispose(service);\n router.dispose(configuration);\n }\n\n return { name, service, configuration, dispose };\n };\n}\n", - "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { BrowserLocationConfig } from \"./browserLocationConfig\";\nimport { HashLocationService } from \"./hashLocationService\";\nimport { locationPluginFactory } from \"./utils\";\nimport { LocationPlugin, ServicesPlugin } from \"./interface\";\nimport { UIRouter } from \"../router\";\nimport { PushStateLocationService } from \"./pushStateLocationService\";\nimport { MemoryLocationService } from \"./memoryLocationService\";\nimport { MemoryLocationConfig } from \"./memoryLocationConfig\";\nimport { $injector } from \"./injector\";\nimport { $q } from \"./q\";\nimport { services } from \"../common/coreservices\";\n\nexport function servicesPlugin(router: UIRouter): ServicesPlugin {\n services.$injector = $injector;\n services.$q = $q;\n\n return { name: \"vanilla.services\", $q, $injector, dispose: () => null };\n}\n\n/** A `UIRouterPlugin` uses the browser hash to get/set the current location */\nexport const hashLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory('vanilla.hashBangLocation', false, HashLocationService, BrowserLocationConfig);\n\n/** A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis */\nexport const pushStateLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory(\"vanilla.pushStateLocation\", true, PushStateLocationService, BrowserLocationConfig);\n\n/** A `UIRouterPlugin` that gets/sets the current location from an in-memory object */\nexport const memoryLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory(\"vanilla.memoryLocation\", false, MemoryLocationService, MemoryLocationConfig);\n", - "/** @module ng1 */ /** */\nimport { ng as angular } from \"../angular\";\nimport {\n StateObject, pick, forEach, tail, extend,\n isArray, isInjectable, isDefined, isString, services, trace,\n ViewConfig, ViewService, ViewConfigFactory, PathNode, ResolveContext, Resolvable, IInjectable\n} from \"@uirouter/core\";\nimport { Ng1ViewDeclaration } from \"../interface\";\nimport { TemplateFactory } from \"../templateFactory\";\nimport IInjectorService = angular.auto.IInjectorService;\n\nexport function getNg1ViewConfigFactory(): ViewConfigFactory {\n let templateFactory: TemplateFactory = null;\n return (path, view) => {\n templateFactory = templateFactory || services.$injector.get(\"$templateFactory\");\n return [new Ng1ViewConfig(path, view, templateFactory)];\n };\n}\n\nconst hasAnyKey = (keys, obj) =>\n keys.reduce((acc, key) => acc || isDefined(obj[key]), false);\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `views`.\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * handles the `views` property with logic specific to @uirouter/angularjs (ng1).\n *\n * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object\n * and applies the state-level configuration to a view named `$default`.\n */\nexport function ng1ViewsBuilder(state: StateObject) {\n // Do not process root state\n if (!state.parent) return {};\n\n let tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'],\n ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'],\n compKeys = ['component', 'bindings', 'componentProvider'],\n nonCompKeys = tplKeys.concat(ctrlKeys),\n allViewKeys = compKeys.concat(nonCompKeys);\n\n // Do not allow a state to have both state-level props and also a `views: {}` property.\n // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state.\n // However, the `$default` approach should not be mixed with a separate `views: ` block.\n if (isDefined(state.views) && hasAnyKey(allViewKeys, state)) {\n throw new Error(`State '${state.name}' has a 'views' object. ` +\n `It cannot also have \"view properties\" at the state level. ` +\n `Move the following properties into a view (in the 'views' object): ` +\n ` ${allViewKeys.filter(key => isDefined(state[key])).join(\", \")}`);\n }\n\n let views: { [key: string]: Ng1ViewDeclaration } = {},\n viewsObject = state.views || { \"$default\": pick(state, allViewKeys) };\n\n forEach(viewsObject, function (config: Ng1ViewDeclaration, name: string) {\n // Account for views: { \"\": { template... } }\n name = name || \"$default\";\n // Account for views: { header: \"headerComponent\" }\n if (isString(config)) config = { component: config };\n\n // Make a shallow copy of the config object\n config = extend({}, config);\n\n // Do not allow a view to mix props for component-style view with props for template/controller-style view\n if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {\n throw new Error(`Cannot combine: ${compKeys.join(\"|\")} with: ${nonCompKeys.join(\"|\")} in stateview: '${name}@${state.name}'`);\n }\n\n config.resolveAs = config.resolveAs || '$resolve';\n config.$type = \"ng1\";\n config.$context = state;\n config.$name = name;\n\n let normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name);\n config.$uiViewName = normalized.uiViewName;\n config.$uiViewContextAnchor = normalized.uiViewContextAnchor;\n\n views[name] = config;\n });\n return views;\n}\n\nlet id = 0;\nexport class Ng1ViewConfig implements ViewConfig {\n $id = id++;\n loaded: boolean = false;\n controller: Function; // actually IInjectable|string\n template: string;\n component: string;\n locals: any; // TODO: delete me\n\n constructor(public path: PathNode[], public viewDecl: Ng1ViewDeclaration, public factory: TemplateFactory) { }\n\n load() {\n let $q = services.$q;\n let context = new ResolveContext(this.path);\n let params = this.path.reduce((acc, node) => extend(acc, node.paramValues), {});\n\n let promises: any = {\n template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)),\n controller: $q.when(this.getController(context))\n };\n\n return $q.all(promises).then((results) => {\n trace.traceViewServiceEvent(\"Loaded\", this);\n this.controller = results.controller;\n extend(this, results.template); // Either { template: \"tpl\" } or { component: \"cmpName\" }\n return this;\n });\n }\n\n getTemplate = (uiView, context: ResolveContext) =>\n this.component ? this.factory.makeComponentTemplate(uiView, context, this.component, this.viewDecl.bindings) : this.template;\n\n /**\n * Gets the controller for a view configuration.\n *\n * @returns {Function|Promise.} Returns a controller, or a promise that resolves to a controller.\n */\n getController(context: ResolveContext): (IInjectable|string|Promise) {\n let provider = this.viewDecl.controllerProvider;\n if (!isInjectable(provider)) return this.viewDecl.controller;\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n }\n}\n", - "/** @module view */\n/** for typedoc */\nimport { ng as angular } from \"./angular\";\nimport { IAugmentedJQuery } from \"angular\";\nimport {\n isArray, isDefined, isFunction, isObject, services, Obj, IInjectable, tail, kebobString, unnestR, ResolveContext,\n Resolvable, RawParams\n} from \"@uirouter/core\";\nimport { Ng1ViewDeclaration, TemplateFactoryProvider } from \"./interface\";\n\n/**\n * Service which manages loading of templates from a ViewConfig.\n */\nexport class TemplateFactory implements TemplateFactoryProvider {\n /** @hidden */ private _useHttp = angular.version.minor < 3;\n /** @hidden */ private $templateRequest;\n /** @hidden */ private $templateCache;\n /** @hidden */ private $http;\n\n /** @hidden */ $get = ['$http', '$templateCache', '$injector', ($http, $templateCache, $injector) => {\n this.$templateRequest = $injector.has && $injector.has('$templateRequest') && $injector.get('$templateRequest');\n this.$http = $http;\n this.$templateCache = $templateCache;\n return this;\n }];\n\n /** @hidden */\n useHttpService(value: boolean) {\n this._useHttp = value;\n };\n\n /**\n * Creates a template from a configuration object.\n *\n * @param config Configuration object for which to load a template.\n * The following properties are search in the specified order, and the first one\n * that is defined is used to create the template:\n *\n * @param params Parameters to pass to the template function.\n * @param context The resolve context associated with the template's view\n *\n * @return {string|object} The template html as a string, or a promise for\n * that string,or `null` if no template is configured.\n */\n fromConfig(config: Ng1ViewDeclaration, params: any, context: ResolveContext): Promise<{ template?: string, component?: string }> {\n const defaultTemplate = \"\";\n\n const asTemplate = (result) => services.$q.when(result).then(str => ({ template: str }));\n const asComponent = (result) => services.$q.when(result).then(str => ({ component: str }));\n\n return (\n isDefined(config.template) ? asTemplate(this.fromString(config.template, params)) :\n isDefined(config.templateUrl) ? asTemplate(this.fromUrl(config.templateUrl, params)) :\n isDefined(config.templateProvider) ? asTemplate(this.fromProvider(config.templateProvider, params, context)) :\n isDefined(config.component) ? asComponent(config.component) :\n isDefined(config.componentProvider) ? asComponent(this.fromComponentProvider(config.componentProvider, params, context)) :\n asTemplate(defaultTemplate)\n );\n };\n\n /**\n * Creates a template from a string or a function returning a string.\n *\n * @param template html template as a string or function that returns an html template as a string.\n * @param params Parameters to pass to the template function.\n *\n * @return {string|object} The template html as a string, or a promise for that\n * string.\n */\n fromString(template: (string | Function), params?: RawParams) {\n return isFunction(template) ? ( template)(params) : template;\n };\n\n /**\n * Loads a template from the a URL via `$http` and `$templateCache`.\n *\n * @param {string|Function} url url of the template to load, or a function\n * that returns a url.\n * @param {Object} params Parameters to pass to the url function.\n * @return {string|Promise.} The template html as a string, or a promise\n * for that string.\n */\n fromUrl(url: (string | Function), params: any) {\n if (isFunction(url)) url = ( url)(params);\n if (url == null) return null;\n\n if (this._useHttp) {\n return this.$http.get(url, { cache: this.$templateCache, headers: { Accept: 'text/html' } })\n .then(function (response) {\n return response.data;\n });\n }\n\n return this.$templateRequest(url);\n };\n\n /**\n * Creates a template by invoking an injectable provider function.\n *\n * @param provider Function to invoke via `locals`\n * @param {Function} injectFn a function used to invoke the template provider\n * @return {string|Promise.} The template html as a string, or a promise\n * for that string.\n */\n fromProvider(provider: IInjectable, params: any, context: ResolveContext) {\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n };\n\n /**\n * Creates a component's template by invoking an injectable provider function.\n *\n * @param provider Function to invoke via `locals`\n * @param {Function} injectFn a function used to invoke the template provider\n * @return {string} The template html as a string: \"\".\n */\n fromComponentProvider(provider: IInjectable, params: any, context: ResolveContext) {\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n };\n\n /**\n * Creates a template from a component's name\n *\n * This implements route-to-component.\n * It works by retrieving the component (directive) metadata from the injector.\n * It analyses the component's bindings, then constructs a template that instantiates the component.\n * The template wires input and output bindings to resolves or from the parent component.\n *\n * @param uiView {object} The parent ui-view (for binding outputs to callbacks)\n * @param context The ResolveContext (for binding outputs to callbacks returned from resolves)\n * @param component {string} Component's name in camel case.\n * @param bindings An object defining the component's bindings: {foo: '<'}\n * @return {string} The template as a string: \"\".\n */\n makeComponentTemplate(uiView: IAugmentedJQuery, context: ResolveContext, component: string, bindings?: any) {\n bindings = bindings || {};\n\n // Bind once prefix\n const prefix = angular.version.minor >= 3 ? \"::\" : \"\";\n // Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-`\n const kebob = (camelCase: string) => {\n const kebobed = kebobString(camelCase);\n return /^(x|data)-/.exec(kebobed) ? `x-${kebobed}` : kebobed;\n };\n\n\n const attributeTpl = (input: BindingTuple) => {\n let { name, type } = input;\n let attrName = kebob(name);\n // If the ui-view has an attribute which matches a binding on the routed component\n // then pass that attribute through to the routed component template.\n // Prefer ui-view wired mappings to resolve data, unless the resolve was explicitly bound using `bindings:`\n if (uiView.attr(attrName) && !bindings[name])\n return `${attrName}='${uiView.attr(attrName)}'`;\n\n let resolveName = bindings[name] || name;\n // Pre-evaluate the expression for \"@\" bindings by enclosing in {{ }}\n // some-attr=\"{{ ::$resolve.someResolveName }}\"\n if (type === '@')\n return `${attrName}='{{${prefix}$resolve.${resolveName}}}'`;\n\n // Wire \"&\" callbacks to resolves that return a callback function\n // Get the result of the resolve (should be a function) and annotate it to get its arguments.\n // some-attr=\"$resolve.someResolveResultName(foo, bar)\"\n if (type === '&') {\n let res = context.getResolvable(resolveName);\n let fn = res && res.data;\n let args = fn && services.$injector.annotate(fn) || [];\n // account for array style injection, i.e., ['foo', function(foo) {}]\n let arrayIdxStr = isArray(fn) ? `[${fn.length - 1}]` : '';\n return `${attrName}='$resolve.${resolveName}${arrayIdxStr}(${args.join(\",\")})'`;\n }\n\n // some-attr=\"::$resolve.someResolveName\"\n return `${attrName}='${prefix}$resolve.${resolveName}'`;\n };\n\n let attrs = getComponentBindings(component).map(attributeTpl).join(\" \");\n let kebobName = kebob(component);\n return `<${kebobName} ${attrs}>`;\n };\n}\n\n// Gets all the directive(s)' inputs ('@', '=', and '<') and outputs ('&')\nfunction getComponentBindings(name: string) {\n let cmpDefs = services.$injector.get(name + \"Directive\"); // could be multiple\n if (!cmpDefs || !cmpDefs.length) throw new Error(`Unable to find component named '${name}'`);\n return cmpDefs.map(getBindings).reduce(unnestR, []);\n}\n\n// Given a directive definition, find its object input attributes\n// Use different properties, depending on the type of directive (component, bindToController, normal)\nconst getBindings = (def: any) => {\n if (isObject(def.bindToController)) return scopeBindings(def.bindToController);\n return scopeBindings(def.scope);\n};\n\ninterface BindingTuple {\n name: string;\n type: string;\n}\n\n// for ng 1.2 style, process the scope: { input: \"=foo\" }\n// for ng 1.3 through ng 1.5, process the component's bindToController: { input: \"=foo\" } object\nconst scopeBindings = (bindingsObj: Obj) => Object.keys(bindingsObj || {})\n // [ 'input', [ '=foo', '=', 'foo' ] ]\n .map(key => [key, /^([=<@&])[?]?(.*)/.exec(bindingsObj[key])])\n // skip malformed values\n .filter(tuple => isDefined(tuple) && isArray(tuple[1]))\n // { name: ('foo' || 'input'), type: '=' }\n .map(tuple => ({ name: tuple[1][2] || tuple[0], type: tuple[1][1] } as BindingTuple));\n\n", - "/**\n * # Angular 1 types\n *\n * UI-Router core provides various Typescript types which you can use for code completion and validating parameter values, etc.\n * The customizations to the core types for Angular UI-Router are documented here.\n *\n * The optional [[$resolve]] service is also documented here.\n *\n * @module ng1\n * @preferred\n */\n/** for typedoc */\nimport { ng as angular } from \"./angular\";\nimport {\n IRootScopeService, IQService, ILocationService, ILocationProvider, IHttpService, ITemplateCacheService\n} from \"angular\";\nimport {\n services, applyPairs, isString, trace, extend, UIRouter, StateService, UrlRouter, UrlMatcherFactory, ResolveContext,\n unnestR, TypedMap\n} from \"@uirouter/core\";\nimport { ng1ViewsBuilder, getNg1ViewConfigFactory } from \"./statebuilders/views\";\nimport { TemplateFactory } from \"./templateFactory\";\nimport { StateProvider } from \"./stateProvider\";\nimport { getStateHookBuilder } from \"./statebuilders/onEnterExitRetain\";\nimport { Ng1LocationServices } from \"./locationServices\";\nimport { UrlRouterProvider } from \"./urlRouterProvider\";\nimport IInjectorService = angular.auto.IInjectorService; // tslint:disable-line\n\nangular.module(\"ui.router.angular1\", []);\nlet mod_init = angular.module('ui.router.init', []);\nlet mod_util = angular.module('ui.router.util', ['ng', 'ui.router.init']);\nlet mod_rtr = angular.module('ui.router.router', ['ui.router.util']);\nlet mod_state = angular.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']);\nlet mod_main = angular.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']);\nlet mod_cmpt = angular.module('ui.router.compat', ['ui.router']); // tslint:disable-line\n\ndeclare module '@uirouter/core/lib/router' {\n interface UIRouter {\n /** @hidden */\n stateProvider: StateProvider;\n /** @hidden */\n urlRouterProvider: UrlRouterProvider;\n }\n}\n\nlet router: UIRouter = null;\n\n$uiRouter.$inject = ['$locationProvider'];\n/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */\nfunction $uiRouter($locationProvider: ILocationProvider) {\n\n // Create a new instance of the Router when the $uiRouterProvider is initialized\n router = this.router = new UIRouter();\n router.stateProvider = new StateProvider(router.stateRegistry, router.stateService);\n\n // Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties\n router.stateRegistry.decorator(\"views\", ng1ViewsBuilder);\n router.stateRegistry.decorator(\"onExit\", getStateHookBuilder(\"onExit\"));\n router.stateRegistry.decorator(\"onRetain\", getStateHookBuilder(\"onRetain\"));\n router.stateRegistry.decorator(\"onEnter\", getStateHookBuilder(\"onEnter\"));\n\n router.viewService._pluginapi._viewConfigFactory('ng1', getNg1ViewConfigFactory());\n\n let ng1LocationService = router.locationService = router.locationConfig = new Ng1LocationServices($locationProvider);\n\n Ng1LocationServices.monkeyPatchPathParameterType(router);\n\n // backwards compat: also expose router instance as $uiRouterProvider.router\n router['router'] = router;\n router['$get'] = $get;\n $get.$inject = ['$location', '$browser', '$sniffer', '$rootScope', '$http', '$templateCache'];\n function $get($location: ILocationService, $browser: any, $sniffer: any, $rootScope: ng.IScope, $http: IHttpService, $templateCache: ITemplateCacheService) {\n ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser);\n delete router['router'];\n delete router['$get'];\n return router;\n }\n return router;\n}\n\nconst getProviderFor = (serviceName) => [ '$uiRouterProvider', ($urp) => {\n let service = $urp.router[serviceName];\n service[\"$get\"] = () => service;\n return service;\n}];\n\n// This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime)\nrunBlock.$inject = ['$injector', '$q', '$uiRouter'];\nfunction runBlock($injector: IInjectorService, $q: IQService, $uiRouter: UIRouter) {\n services.$injector = $injector;\n services.$q = $q;\n\n // The $injector is now available.\n // Find any resolvables that had dependency annotation deferred\n $uiRouter.stateRegistry.get()\n .map(x => x.$$state().resolvables)\n .reduce(unnestR, [])\n .filter(x => x.deps === \"deferred\")\n .forEach(resolvable => resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi));\n}\n\n// $urlRouter service and $urlRouterProvider\nconst getUrlRouterProvider = (uiRouter: UIRouter) =>\n uiRouter.urlRouterProvider = new UrlRouterProvider(uiRouter);\n\n// $state service and $stateProvider\n// $urlRouter service and $urlRouterProvider\nconst getStateProvider = () =>\n extend(router.stateProvider, { $get: () => router.stateService });\n\nwatchDigests.$inject = ['$rootScope'];\nexport function watchDigests($rootScope: IRootScopeService) {\n $rootScope.$watch(function() { trace.approximateDigests++; });\n}\n\nmod_init .provider(\"$uiRouter\", $uiRouter);\nmod_rtr .provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]);\nmod_util .provider('$urlService', getProviderFor('urlService'));\nmod_util .provider('$urlMatcherFactory', ['$uiRouterProvider', () => router.urlMatcherFactory]);\nmod_util .provider('$templateFactory', () => new TemplateFactory());\nmod_state.provider('$stateRegistry', getProviderFor('stateRegistry'));\nmod_state.provider('$uiRouterGlobals', getProviderFor('globals'));\nmod_state.provider('$transitions', getProviderFor('transitionService'));\nmod_state.provider('$state', ['$uiRouterProvider', getStateProvider]);\n\nmod_state.factory ('$stateParams', ['$uiRouter', ($uiRouter: UIRouter) => $uiRouter.globals.params]);\nmod_main .factory ('$view', () => router.viewService);\nmod_main .service (\"$trace\", () => trace);\n\nmod_main .run (watchDigests);\nmod_util .run (['$urlMatcherFactory', function ($urlMatcherFactory: UrlMatcherFactory) { }]);\nmod_state.run (['$state', function ($state: StateService) { }]);\nmod_rtr .run (['$urlRouter', function ($urlRouter: UrlRouter) { }]);\nmod_init .run (runBlock);\n\n/** @hidden TODO: find a place to move this */\nexport const getLocals = (ctx: ResolveContext): TypedMap => {\n let tokens = ctx.getTokens().filter(isString);\n\n let tuples = tokens .map(key => {\n let resolvable = ctx.getResolvable(key);\n let waitPolicy = ctx.getPolicy(resolvable).async;\n return [ key, waitPolicy === 'NOWAIT' ? resolvable.promise : resolvable.data ];\n });\n\n return tuples.reduce(applyPairs, {});\n};\n\n", - "/**\n * # Angular 1 Directives\n *\n * These are the directives included in UI-Router for Angular 1.\n * These directives are used in templates to create viewports and link/navigate to states.\n *\n * @ng1api\n * @preferred\n * @module directives\n */ /** for typedoc */\nimport { ng as angular } from \"../angular\";\nimport { IAugmentedJQuery, ITimeoutService, IScope, IInterpolateService } from \"angular\";\n\nimport {\n Obj, extend, forEach, tail, isString, isObject, isArray, parse, noop, unnestR, identity, uniqR, inArray, removeFrom,\n RawParams, PathNode, StateOrName, StateService, StateDeclaration, UIRouter\n} from \"@uirouter/core\";\nimport { UIViewData } from \"./viewDirective\";\n\n/** @hidden Used for typedoc */\nexport interface ng1_directive {}\n\n/** @hidden */\nfunction parseStateRef(ref: string) {\n let paramsOnly = ref.match(/^\\s*({[^}]*})\\s*$/), parsed;\n if (paramsOnly) ref = '(' + paramsOnly[1] + ')';\n\n parsed = ref.replace(/\\n/g, \" \").match(/^\\s*([^(]*?)\\s*(\\((.*)\\))?\\s*$/);\n if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n return { state: parsed[1] || null, paramExpr: parsed[3] || null };\n}\n\n/** @hidden */\nfunction stateContext(el: IAugmentedJQuery) {\n let $uiView: UIViewData = (el.parent() as IAugmentedJQuery).inheritedData('$uiView');\n let path: PathNode[] = parse('$cfg.path')($uiView);\n return path ? tail(path).state.name : undefined;\n}\n\n/** @hidden */\nfunction processedDef($state: StateService, $element: IAugmentedJQuery, def: Def): Def {\n let uiState = def.uiState || $state.current.name;\n let uiStateOpts = extend(defaultOpts($element, $state), def.uiStateOpts || {});\n let href = $state.href(uiState, def.uiStateParams, uiStateOpts);\n return { uiState, uiStateParams: def.uiStateParams, uiStateOpts, href };\n}\n\n/** @hidden */\ninterface TypeInfo {\n attr: string;\n isAnchor: boolean;\n clickable: boolean;\n}\n\n/** @hidden */\nfunction getTypeInfo(el: IAugmentedJQuery): TypeInfo {\n // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.\n var isSvg = Object.prototype.toString.call(el.prop('href')) === '[object SVGAnimatedString]';\n var isForm = el[0].nodeName === \"FORM\";\n\n return {\n attr: isForm ? \"action\" : (isSvg ? 'xlink:href' : 'href'),\n isAnchor: el.prop(\"tagName\").toUpperCase() === \"A\",\n clickable: !isForm\n };\n}\n\n/** @hidden */\nfunction clickHook(el: IAugmentedJQuery, $state: StateService, $timeout: ITimeoutService, type: TypeInfo, getDef: () => Def) {\n return function (e: JQueryMouseEventObject) {\n var button = e.which || e.button, target = getDef();\n\n if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || el.attr('target'))) {\n // HACK: This is to allow ng-clicks to be processed before the transition is initiated:\n var transition = $timeout(function () {\n $state.go(target.uiState, target.uiStateParams, target.uiStateOpts);\n });\n e.preventDefault();\n\n // if the state has no URL, ignore one preventDefault from the
    directive.\n var ignorePreventDefaultCount = type.isAnchor && !target.href ? 1 : 0;\n\n e.preventDefault = function () {\n if (ignorePreventDefaultCount-- <= 0) $timeout.cancel(transition);\n };\n }\n };\n}\n\n/** @hidden */\nfunction defaultOpts(el: IAugmentedJQuery, $state: StateService) {\n return {\n relative: stateContext(el) || $state.$current,\n inherit: true,\n source: \"sref\"\n };\n}\n\n/** @hidden */\nfunction bindEvents(element: IAugmentedJQuery, scope: IScope, hookFn: (e: JQueryMouseEventObject) => void, uiStateOpts: any): void {\n let events;\n\n if (uiStateOpts) {\n events = uiStateOpts.events;\n }\n\n if (!isArray(events)) {\n events = ['click'];\n }\n\n let on = element.on ? 'on' : 'bind';\n for (let event of events) {\n element[on](event, hookFn);\n }\n\n scope.$on('$destroy', function() {\n let off = element.off ? 'off' : 'unbind';\n for (let event of events) {\n element[off](event, hookFn);\n }\n });\n}\n\n/**\n * `ui-sref`: A directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of the `ui-sref` is the name of the state to link to.\n *\n * #### Example:\n * This will activate the `home` state when the link is clicked.\n * ```html\n * Home\n * ```\n *\n * ### Relative Links\n * You can also use relative state paths within `ui-sref`, just like a relative path passed to `$state.go()` ([[StateService.go]]).\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create a relative `ui-sref` which always targets the same destination.\n *\n * #### Example:\n * Both these links are relative to the parent state, even when a child state is currently active.\n * ```html\n * child 1 state\n * child 2 state\n * ```\n *\n * This link activates the parent state.\n * ```html\n * Return\n * ```\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]] method).\n *\n * #### Example:\n * Assuming the `users` state has a url of `/users/`\n * ```html\n * Users\n * ```\n *\n * ### Parameter Values\n * In addition to the state name, a `ui-sref` can include parameter values which are applied when activating the state.\n * Param values can be provided in the `ui-sref` value after the state name, enclosed by parentheses.\n * The content inside the parentheses is an expression, evaluated to the parameter values.\n *\n * #### Example:\n * This example renders a list of links to users.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n *
  • \n * {{ user.displayName }}\n *
  • \n * ```\n *\n * Note:\n * The parameter values expression is `$watch`ed for updates.\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-sref-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n *\n * #### Example:\n * ```html\n * Home\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-sref-opts` attribute.\n *\n * #### Example:\n * ```html\n * \n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Examples\n * If you have the following template:\n *\n * ```html\n * Home\n * About\n * Next page\n *\n * \n * ```\n *\n * Then (assuming the current state is `contacts`) the rendered html including hrefs would be:\n *\n * ```html\n * Home\n * About\n * Next page\n *\n *
      \n *
    • \n * Joe\n *
    • \n *
    • \n * Alice\n *
    • \n *
    • \n * Bob\n *
    • \n *
    \n *\n * Home\n * ```\n *\n * ### Notes\n *\n * - You can use `ui-sref` to change **only the parameter values** by omitting the state name and parentheses.\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * English\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n *\n * - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons).\n * If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive.\n */\nlet uiSref: ng1_directive;\nuiSref = ['$uiRouter', '$timeout',\n function $StateRefDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n let $state = $uiRouter.stateService;\n\n return {\n restrict: 'A',\n require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n link: function (scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n let type = getTypeInfo(element);\n let active = uiSrefActive[1] || uiSrefActive[0];\n let unlinkInfoFn: Function = null;\n let hookFn;\n\n let rawDef = {} as Def;\n let getDef = () => processedDef($state, element, rawDef);\n\n let ref = parseStateRef(attrs.uiSref);\n rawDef.uiState = ref.state;\n rawDef.uiStateOpts = attrs.uiSrefOpts ? scope.$eval(attrs.uiSrefOpts) : {};\n\n function update() {\n let def = getDef();\n if (unlinkInfoFn) unlinkInfoFn();\n if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n if (def.href != null) attrs.$set(type.attr, def.href);\n }\n\n if (ref.paramExpr) {\n scope.$watch(ref.paramExpr, function (val) {\n rawDef.uiStateParams = extend({}, val);\n update();\n }, true);\n rawDef.uiStateParams = extend({}, scope.$eval(ref.paramExpr));\n }\n\n update();\n\n scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update));\n scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update));\n\n if (!type.clickable) return;\n hookFn = clickHook(element, $state, $timeout, type, getDef);\n bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n }\n };\n }];\n\n/**\n * `ui-state`: A fully dynamic directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * **This directive is very similar to [[uiSref]], but it `$observe`s and `$watch`es/evaluates all its inputs.**\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of `ui-state` is an expression which is `$watch`ed and evaluated as the state to link to.\n * **This is in contrast with `ui-sref`, which takes a state name as a string literal.**\n *\n * #### Example:\n * Create a list of links.\n * ```html\n *
  • \n * {{ link.displayName }}\n *
  • \n * ```\n *\n * ### Relative Links\n * If the expression evaluates to a relative path, it is processed like [[uiSref]].\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create relative `ui-state` which always targets the same destination.\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]] method).\n *\n * ### Parameter Values\n * In addition to the state name expression, a `ui-state` can include parameter values which are applied when activating the state.\n * Param values should be provided using the `ui-state-params` attribute.\n * The `ui-state-params` attribute value is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * This example renders a list of links with param values.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n *
  • \n * {{ link.displayName }}\n *
  • \n * ```\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-state-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n * The value of the `ui-state-opts` is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * ```html\n * Home\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-state-opts` attribute.\n *\n * #### Example:\n * ```html\n * \n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Notes\n *\n * - You can use `ui-params` to change **only the parameter values** by omitting the state name and supplying only `ui-state-params`.\n * However, it might be simpler to use [[uiSref]] parameter-only links.\n *\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * English\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n * ```\n */\nlet uiState: ng1_directive;\nuiState = ['$uiRouter', '$timeout',\n function $StateRefDynamicDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n let $state = $uiRouter.stateService;\n\n return {\n restrict: 'A',\n require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n link: function (scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n let type = getTypeInfo(element);\n let active = uiSrefActive[1] || uiSrefActive[0];\n let unlinkInfoFn: Function = null;\n let hookFn;\n\n let rawDef = {} as Def;\n let getDef = () => processedDef($state, element, rawDef);\n\n let inputAttrs = ['uiState', 'uiStateParams', 'uiStateOpts'];\n let watchDeregFns = inputAttrs.reduce((acc, attr) => (acc[attr] = noop, acc), {});\n\n function update() {\n let def = getDef();\n if (unlinkInfoFn) unlinkInfoFn();\n if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n if (def.href != null) attrs.$set(type.attr, def.href);\n }\n\n inputAttrs.forEach((field) => {\n rawDef[field] = attrs[field] ? scope.$eval(attrs[field]) : null;\n\n attrs.$observe(field, (expr) => {\n watchDeregFns[field]();\n watchDeregFns[field] = scope.$watch(expr, (newval) => {\n rawDef[field] = newval;\n update();\n }, true);\n })\n });\n\n update();\n\n scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update));\n scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update));\n\n if (!type.clickable) return;\n hookFn = clickHook(element, $state, $timeout, type, getDef);\n bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n }\n };\n }];\n\n\n/**\n * `ui-sref-active` and `ui-sref-active-eq`: A directive that adds a CSS class when a `ui-sref` is active\n *\n * A directive working alongside [[uiSref]] and [[uiState]] to add classes to an element when the\n * related directive's state is active (and remove them when it is inactive).\n *\n * The primary use-case is to highlight the active link in navigation menus,\n * distinguishing it from the inactive menu items.\n *\n * ### Linking to a `ui-sref` or `ui-state`\n * `ui-sref-active` can live on the same element as `ui-sref`/`ui-state`, or it can be on a parent element.\n * If a `ui-sref-active` is a parent to more than one `ui-sref`/`ui-state`, it will apply the CSS class when **any of the links are active**.\n *\n * ### Matching\n *\n * The `ui-sref-active` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state **or any child state is active**.\n * This is a \"fuzzy match\" which uses [[StateService.includes]].\n *\n * The `ui-sref-active-eq` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state is directly active (not when child states are active).\n * This is an \"exact match\" which uses [[StateService.is]].\n *\n * ### Parameter values\n * If the `ui-sref`/`ui-state` includes parameter values, the current parameter values must match the link's values for the link to be highlighted.\n * This allows a list of links to the same state with different parameters to be rendered, and the correct one highlighted.\n *\n * #### Example:\n * ```html\n *
  • \n * {{ user.lastName }}\n *
  • \n * ```\n *\n * ### Examples\n *\n * Given the following template:\n * #### Example:\n * ```html\n * \n * ```\n *\n * When the app state is `app.user` (or any child state),\n * and contains the state parameter \"user\" with value \"bilbobaggins\",\n * the resulting HTML will appear as (note the 'active' class):\n *\n * ```html\n * \n * ```\n *\n * ### Glob mode\n *\n * It is possible to pass `ui-sref-active` an expression that evaluates to an object.\n * The objects keys represent active class names and values represent the respective state names/globs.\n * `ui-sref-active` will match if the current active state **includes** any of\n * the specified state names/globs, even the abstract ones.\n *\n * #### Example:\n * Given the following template, with \"admin\" being an abstract state:\n * ```html\n *
    \n * Roles\n *
    \n * ```\n *\n * When the current state is \"admin.roles\" the \"active\" class will be applied to both the `
    ` and `` elements.\n * It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`.\n *\n * ### Notes:\n *\n * - The class name is interpolated **once** during the directives link time (any further changes to the\n * interpolated value are ignored).\n *\n * - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'`\n */\nlet uiSrefActive: ng1_directive;\nuiSrefActive = ['$state', '$stateParams', '$interpolate', '$uiRouter',\n function $StateRefActiveDirective($state: StateService, $stateParams: Obj, $interpolate: IInterpolateService, $uiRouter: UIRouter) {\n return {\n restrict: \"A\",\n controller: ['$scope', '$element', '$attrs',\n function ($scope: IScope, $element: IAugmentedJQuery, $attrs: any) {\n let states: StateData[] = [],\n activeEqClass: string,\n uiSrefActive: any;\n\n // There probably isn't much point in $observing this\n // uiSrefActive and uiSrefActiveEq share the same directive object with some\n // slight difference in logic routing\n activeEqClass = $interpolate($attrs.uiSrefActiveEq || '', false)($scope);\n\n try {\n uiSrefActive = $scope.$eval($attrs.uiSrefActive);\n } catch (e) {\n // Do nothing. uiSrefActive is not a valid expression.\n // Fall back to using $interpolate below\n }\n uiSrefActive = uiSrefActive || $interpolate($attrs.uiSrefActive || '', false)($scope);\n if (isObject(uiSrefActive)) {\n forEach(uiSrefActive, function (stateOrName: StateOrName, activeClass: string) {\n if (isString(stateOrName)) {\n let ref = parseStateRef(stateOrName);\n addState(ref.state, $scope.$eval(ref.paramExpr), activeClass);\n }\n });\n }\n\n // Allow uiSref to communicate with uiSrefActive[Equals]\n this.$$addStateInfo = function (newState: string, newParams: Obj) {\n // we already got an explicit state provided by ui-sref-active, so we\n // shadow the one that comes from ui-sref\n if (isObject(uiSrefActive) && states.length > 0) {\n return;\n }\n let deregister = addState(newState, newParams, uiSrefActive);\n update();\n return deregister;\n };\n\n function updateAfterTransition(trans) {\n trans.promise.then(update, noop);\n }\n\n $scope.$on('$stateChangeSuccess', update);\n $scope.$on('$destroy', $uiRouter.transitionService.onStart({}, updateAfterTransition));\n if ($uiRouter.globals.transition) {\n updateAfterTransition($uiRouter.globals.transition);\n }\n\n function addState(stateName: string, stateParams: Obj, activeClass: string) {\n var state = $state.get(stateName, stateContext($element));\n\n var stateInfo = {\n state: state || { name: stateName },\n params: stateParams,\n activeClass: activeClass\n };\n\n states.push(stateInfo);\n\n return function removeState() {\n removeFrom(states)(stateInfo);\n }\n }\n\n // Update route state\n function update() {\n const splitClasses = str =>\n str.split(/\\s/).filter(identity);\n const getClasses = (stateList: StateData[]) =>\n stateList.map(x => x.activeClass).map(splitClasses).reduce(unnestR, []);\n\n let allClasses = getClasses(states).concat(splitClasses(activeEqClass)).reduce(uniqR, []);\n let fuzzyClasses = getClasses(states.filter(x => $state.includes(x.state.name, x.params)));\n let exactlyMatchesAny = !!states.filter(x => $state.is(x.state.name, x.params)).length;\n let exactClasses = exactlyMatchesAny ? splitClasses(activeEqClass) : [];\n\n let addClasses = fuzzyClasses.concat(exactClasses).reduce(uniqR, []);\n let removeClasses = allClasses.filter(cls => !inArray(addClasses, cls));\n\n $scope.$evalAsync(() => {\n addClasses.forEach(className => $element.addClass(className));\n removeClasses.forEach(className => $element.removeClass(className));\n });\n }\n\n update();\n }]\n };\n }];\n\n/** @hidden */\ninterface Def { uiState: string; href: string; uiStateParams: Obj; uiStateOpts: any; }\n/** @hidden */\ninterface StateData { state: StateDeclaration; params: RawParams; activeClass: string; }\n\nangular.module('ui.router.state')\n .directive('uiSref', uiSref)\n .directive('uiSrefActive', uiSrefActive)\n .directive('uiSrefActiveEq', uiSrefActive)\n .directive('uiState', uiState);\n", - "/** @module ng1 */ /** for typedoc */\n\nimport { ng as angular } from \"./angular\";\nimport { Obj, StateService, StateOrName } from \"@uirouter/core\";\n\n/**\n * `isState` Filter: truthy if the current state is the parameter\n *\n * Translates to [[StateService.is]] `$state.is(\"stateName\")`.\n *\n * #### Example:\n * ```html\n *
    show if state is 'stateName'
    \n * ```\n */\n$IsStateFilter.$inject = ['$state'];\nexport function $IsStateFilter($state: StateService) {\n var isFilter: any = function(state: StateOrName, params: Obj, options?: { relative?: StateOrName }) {\n return $state.is(state, params, options);\n };\n isFilter.$stateful = true;\n return isFilter;\n}\n\n/**\n * `includedByState` Filter: truthy if the current state includes the parameter\n *\n * Translates to [[StateService.includes]]` $state.is(\"fullOrPartialStateName\")`.\n *\n * #### Example:\n * ```html\n *
    show if state includes 'fullOrPartialStateName'
    \n * ```\n */\n$IncludedByStateFilter.$inject = ['$state'];\nexport function $IncludedByStateFilter($state: StateService) {\n var includesFilter: any = function(state: StateOrName, params: Obj, options: { relative?: StateOrName }) {\n return $state.includes(state, params, options);\n };\n includesFilter.$stateful = true;\n return includesFilter;\n}\n\nangular.module('ui.router.state')\n .filter('isState', $IsStateFilter)\n .filter('includedByState', $IncludedByStateFilter);\n", - "/** \n * @ng1api \n * @module directives \n */ /** for typedoc */\nimport { ng as angular } from \"../angular\";\nimport { IInterpolateService, IScope, ITranscludeFunction, IAugmentedJQuery, ITimeoutService } from \"angular\";\n\nimport {\n extend, unnestR, filter, tail, isDefined, isFunction, isString, trace, parse,\n ActiveUIView, TransitionService, ResolveContext, Transition, PathNode, StateDeclaration,\n Param, kebobString, HookRegOptions, ViewService, $QLike, Obj, TypedMap, noop,\n} from \"@uirouter/core\";\nimport {Ng1ViewConfig} from \"../statebuilders/views\";\nimport {Ng1Controller, Ng1StateDeclaration} from \"../interface\";\nimport {getLocals} from \"../services\";\nimport { ng1_directive } from \"./stateDirectives\";\n\n/** @hidden */\nexport type UIViewData = {\n $cfg: Ng1ViewConfig;\n $uiView: ActiveUIView;\n}\n\n/** @hidden */\nexport type UIViewAnimData = {\n $animEnter: Promise;\n $animLeave: Promise;\n $$animLeave: { resolve: () => any; } // \"deferred\"\n}\n\n/**\n * `ui-view`: A viewport directive which is filled in by a view from the active state.\n *\n * ### Attributes\n *\n * - `name`: (Optional) A view name.\n * The name should be unique amongst the other views in the same state.\n * You can have views of the same name that live in different states.\n * The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]).\n *\n * - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated.\n * Uses [[$uiViewScroll]] to do the scrolling.\n *\n * - `onload`: Expression to evaluate whenever the view updates.\n *\n * #### Example:\n * A view can be unnamed or named.\n * ```html\n * \n *
    \n *\n * \n *
    \n *\n * \n * \n * ```\n *\n * You can only have one unnamed view within any template (or root html). If you are only using a\n * single view and it is unnamed then you can populate it like so:\n *\n * ```html\n *
    \n * $stateProvider.state(\"home\", {\n * template: \"

    HELLO!

    \"\n * })\n * ```\n *\n * The above is a convenient shortcut equivalent to specifying your view explicitly with the\n * [[Ng1StateDeclaration.views]] config property, by name, in this case an empty name:\n *\n * ```js\n * $stateProvider.state(\"home\", {\n * views: {\n * \"\": {\n * template: \"

    HELLO!

    \"\n * }\n * }\n * })\n * ```\n *\n * But typically you'll only use the views property if you name your view or have more than one view\n * in the same template. There's not really a compelling reason to name a view if its the only one,\n * but you could if you wanted, like so:\n *\n * ```html\n *
    \n * ```\n *\n * ```js\n * $stateProvider.state(\"home\", {\n * views: {\n * \"main\": {\n * template: \"

    HELLO!

    \"\n * }\n * }\n * })\n * ```\n *\n * Really though, you'll use views to set up multiple views:\n *\n * ```html\n *
    \n *
    \n *
    \n * ```\n *\n * ```js\n * $stateProvider.state(\"home\", {\n * views: {\n * \"\": {\n * template: \"

    HELLO!

    \"\n * },\n * \"chart\": {\n * template: \"\"\n * },\n * \"data\": {\n * template: \"\"\n * }\n * }\n * })\n * ```\n *\n * #### Examples for `autoscroll`:\n * ```html\n * \n * \n *\n * \n * \n * \n * \n * ```\n *\n * Resolve data:\n *\n * The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this\n * can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template.\n *\n * Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the\n * controller is instantiated. The `$onInit()` hook can be used to perform initialization code which\n * depends on `$resolve` data.\n *\n * #### Example:\n * ```js\n * $stateProvider.state('home', {\n * template: '',\n * resolve: {\n * user: function(UserService) { return UserService.fetchUser(); }\n * }\n * });\n * ```\n */\nexport let uiView: ng1_directive;\nuiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q',\nfunction $ViewDirective($view: ViewService, $animate: any, $uiViewScroll: any, $interpolate: IInterpolateService, $q: $QLike) {\n\n function getRenderer(attrs: Obj, scope: IScope) {\n return {\n enter: function(element: JQuery, target: any, cb: Function) {\n if (angular.version.minor > 2) {\n $animate.enter(element, null, target).then(cb);\n } else {\n $animate.enter(element, null, target, cb);\n }\n },\n leave: function(element: JQuery, cb: Function) {\n if (angular.version.minor > 2) {\n $animate.leave(element).then(cb);\n } else {\n $animate.leave(element, cb);\n }\n }\n };\n }\n\n function configsEqual(config1: Ng1ViewConfig, config2: Ng1ViewConfig) {\n return config1 === config2;\n }\n\n let rootData = {\n $cfg: { viewDecl: { $context: $view._pluginapi._rootViewContext() } },\n $uiView: { }\n };\n\n let directive = {\n count: 0,\n restrict: 'ECA',\n terminal: true,\n priority: 400,\n transclude: 'element',\n compile: function (tElement: JQuery, tAttrs: Obj, $transclude: ITranscludeFunction) {\n\n return function (scope: IScope, $element: IAugmentedJQuery, attrs: Obj) {\n let previousEl: JQuery, currentEl: JQuery,\n currentScope: IScope, unregister: Function,\n onloadExp = attrs['onload'] || '',\n autoScrollExp = attrs['autoscroll'],\n renderer = getRenderer(attrs, scope),\n viewConfig = undefined as Ng1ViewConfig,\n inherited = $element.inheritedData('$uiView') || rootData,\n name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default';\n\n let activeUIView: ActiveUIView = {\n $type: 'ng1',\n id: directive.count++, // Global sequential ID for ui-view tags added to DOM\n name: name, // ui-view name (
    \n fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + \".\" + name : name, // fully qualified name, describes location in DOM\n config: null, // The ViewConfig loaded (from a state.views definition)\n configUpdated: configUpdatedCallback, // Called when the matching ViewConfig changes\n get creationContext() { // The context in which this ui-view \"tag\" was created\n let fromParentTagConfig = parse('$cfg.viewDecl.$context')(inherited);\n // Allow \n // See https://github.com/angular-ui/ui-router/issues/3355\n let fromParentTag = parse('$uiView.creationContext')(inherited);\n return fromParentTagConfig || fromParentTag;\n }\n };\n\n trace.traceUIViewEvent(\"Linking\", activeUIView);\n\n function configUpdatedCallback(config?: Ng1ViewConfig) {\n if (config && !(config instanceof Ng1ViewConfig)) return;\n if (configsEqual(viewConfig, config)) return;\n trace.traceUIViewConfigUpdated(activeUIView, config && config.viewDecl && config.viewDecl.$context);\n\n viewConfig = config;\n updateView(config);\n }\n\n $element.data('$uiView', { $uiView: activeUIView });\n\n updateView();\n\n unregister = $view.registerUIView(activeUIView);\n scope.$on(\"$destroy\", function() {\n trace.traceUIViewEvent(\"Destroying/Unregistering\", activeUIView);\n unregister();\n });\n\n function cleanupLastView() {\n if (previousEl) {\n trace.traceUIViewEvent(\"Removing (previous) el\", previousEl.data('$uiView'));\n previousEl.remove();\n previousEl = null;\n }\n\n if (currentScope) {\n trace.traceUIViewEvent(\"Destroying scope\", activeUIView);\n currentScope.$destroy();\n currentScope = null;\n }\n\n if (currentEl) {\n let _viewData = currentEl.data('$uiViewAnim');\n trace.traceUIViewEvent(\"Animate out\", _viewData);\n renderer.leave(currentEl, function() {\n _viewData.$$animLeave.resolve();\n previousEl = null;\n });\n\n previousEl = currentEl;\n currentEl = null;\n }\n }\n\n function updateView(config?: Ng1ViewConfig) {\n let newScope = scope.$new();\n let animEnter = $q.defer(), animLeave = $q.defer();\n\n let $uiViewData: UIViewData = {\n $cfg: config,\n $uiView: activeUIView,\n };\n\n let $uiViewAnim: UIViewAnimData = {\n $animEnter: animEnter.promise,\n $animLeave: animLeave.promise,\n $$animLeave: animLeave\n };\n\n /**\n * @ngdoc event\n * @name ui.router.state.directive:ui-view#$viewContentLoading\n * @eventOf ui.router.state.directive:ui-view\n * @eventType emits on ui-view directive scope\n * @description\n *\n * Fired once the view **begins loading**, *before* the DOM is rendered.\n *\n * @param {Object} event Event object.\n * @param {string} viewName Name of the view.\n */\n newScope.$emit('$viewContentLoading', name);\n\n let cloned = $transclude(newScope, function(clone) {\n clone.data('$uiViewAnim', $uiViewAnim);\n clone.data('$uiView', $uiViewData);\n renderer.enter(clone, $element, function onUIViewEnter() {\n animEnter.resolve();\n if (currentScope) currentScope.$emit('$viewContentAnimationEnded');\n\n if (isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {\n $uiViewScroll(clone);\n }\n });\n\n cleanupLastView();\n });\n\n currentEl = cloned;\n currentScope = newScope;\n /**\n * @ngdoc event\n * @name ui.router.state.directive:ui-view#$viewContentLoaded\n * @eventOf ui.router.state.directive:ui-view\n * @eventType emits on ui-view directive scope\n * @description *\n * Fired once the view is **loaded**, *after* the DOM is rendered.\n *\n * @param {Object} event Event object.\n */\n currentScope.$emit('$viewContentLoaded', config || viewConfig);\n currentScope.$eval(onloadExp);\n }\n };\n }\n };\n\n return directive;\n}];\n\n$ViewDirectiveFill.$inject = ['$compile', '$controller', '$transitions', '$view', '$q', '$timeout'];\n/** @hidden */\nfunction $ViewDirectiveFill($compile: angular.ICompileService,\n $controller: angular.IControllerService,\n $transitions: TransitionService,\n $view: ViewService,\n $q: angular.IQService,\n $timeout: ITimeoutService) {\n const getControllerAs = parse('viewDecl.controllerAs');\n const getResolveAs = parse('viewDecl.resolveAs');\n\n return {\n restrict: 'ECA',\n priority: -400,\n compile: function (tElement: JQuery) {\n let initial = tElement.html();\n tElement.empty();\n\n return function (scope: IScope, $element: JQuery) {\n let data: UIViewData = $element.data('$uiView');\n if (!data) {\n $element.html(initial);\n $compile($element.contents() as any)(scope);\n return;\n }\n\n let cfg: Ng1ViewConfig = data.$cfg || { viewDecl: {}, getTemplate: noop };\n let resolveCtx: ResolveContext = cfg.path && new ResolveContext(cfg.path);\n $element.html(cfg.getTemplate($element, resolveCtx) || initial);\n trace.traceUIViewFill(data.$uiView, $element.html());\n\n let link = $compile($element.contents() as any);\n let controller = cfg.controller;\n let controllerAs: string = getControllerAs(cfg);\n let resolveAs: string = getResolveAs(cfg);\n let locals = resolveCtx && getLocals(resolveCtx);\n\n scope[resolveAs] = locals;\n\n if (controller) {\n let controllerInstance = $controller(controller, extend({}, locals, { $scope: scope, $element: $element }));\n if (controllerAs) {\n scope[controllerAs] = controllerInstance;\n scope[controllerAs][resolveAs] = locals;\n }\n\n // TODO: Use $view service as a central point for registering component-level hooks\n // Then, when a component is created, tell the $view service, so it can invoke hooks\n // $view.componentLoaded(controllerInstance, { $scope: scope, $element: $element });\n // scope.$on('$destroy', () => $view.componentUnloaded(controllerInstance, { $scope: scope, $element: $element }));\n\n $element.data('$ngControllerController', controllerInstance);\n $element.children().data('$ngControllerController', controllerInstance);\n\n registerControllerCallbacks($q, $transitions, controllerInstance, scope, cfg);\n }\n\n // Wait for the component to appear in the DOM\n if (isString(cfg.viewDecl.component)) {\n let cmp = cfg.viewDecl.component;\n let kebobName = kebobString(cmp);\n let tagRegexp = new RegExp(`^(x-|data-)?${kebobName}$`, \"i\");\n\n let getComponentController = () => {\n let directiveEl = [].slice.call($element[0].children)\n .filter((el: Element) => el && el.tagName && tagRegexp.exec(el.tagName)) ;\n \n return directiveEl && angular.element(directiveEl).data(`$${cmp}Controller`);\n };\n\n let deregisterWatch = scope.$watch(getComponentController, function(ctrlInstance) {\n if (!ctrlInstance) return;\n registerControllerCallbacks($q, $transitions, ctrlInstance, scope, cfg);\n deregisterWatch();\n });\n }\n\n link(scope);\n };\n }\n };\n}\n\n/** @hidden */\nlet hasComponentImpl = typeof (angular as any).module('ui.router')['component'] === 'function';\n/** @hidden incrementing id */\nlet _uiCanExitId = 0;\n\n/** @hidden TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */\nfunction registerControllerCallbacks($q: angular.IQService,\n $transitions: TransitionService,\n controllerInstance: Ng1Controller,\n $scope: IScope,\n cfg: Ng1ViewConfig) {\n // Call $onInit() ASAP\n if (isFunction(controllerInstance.$onInit) && !(cfg.viewDecl.component && hasComponentImpl)) {\n controllerInstance.$onInit();\n }\n\n let viewState: Ng1StateDeclaration = tail(cfg.path).state.self;\n\n let hookOptions: HookRegOptions = { bind: controllerInstance };\n // Add component-level hook for onParamsChange\n if (isFunction(controllerInstance.uiOnParamsChanged)) {\n let resolveContext: ResolveContext = new ResolveContext(cfg.path);\n let viewCreationTrans = resolveContext.getResolvable('$transition$').data;\n\n // Fire callback on any successful transition\n const paramsUpdated = ($transition$: Transition) => {\n // Exit early if the $transition$ is the same as the view was created within.\n // Exit early if the $transition$ will exit the state the view is for.\n if ($transition$ === viewCreationTrans || $transition$.exiting().indexOf(viewState as StateDeclaration) !== -1) return;\n\n let toParams = $transition$.params(\"to\") as TypedMap;\n let fromParams = $transition$.params>(\"from\") as TypedMap;\n let toSchema: Param[] = $transition$.treeChanges().to.map((node: PathNode) => node.paramSchema).reduce(unnestR, []);\n let fromSchema: Param[] = $transition$.treeChanges().from.map((node: PathNode) => node.paramSchema).reduce(unnestR, []);\n\n // Find the to params that have different values than the from params\n let changedToParams = toSchema.filter((param: Param) => {\n let idx = fromSchema.indexOf(param);\n return idx === -1 || !fromSchema[idx].type.equals(toParams[param.id], fromParams[param.id]);\n });\n\n // Only trigger callback if a to param has changed or is new\n if (changedToParams.length) {\n let changedKeys: string[] = changedToParams.map(x => x.id);\n // Filter the params to only changed/new to params. `$transition$.params()` may be used to get all params.\n let newValues = filter(toParams, (val, key) => changedKeys.indexOf(key) !== -1);\n controllerInstance.uiOnParamsChanged(newValues, $transition$);\n }\n };\n $scope.$on('$destroy', $transitions.onSuccess({}, paramsUpdated, hookOptions));\n }\n\n // Add component-level hook for uiCanExit\n if (isFunction(controllerInstance.uiCanExit)) {\n let id = _uiCanExitId++;\n let cacheProp = '_uiCanExitIds';\n\n // Returns true if a redirect transition already answered truthy\n const prevTruthyAnswer = (trans: Transition) =>\n !!trans && (trans[cacheProp] && trans[cacheProp][id] === true || prevTruthyAnswer(trans.redirectedFrom()));\n\n // If a user answered yes, but the transition was later redirected, don't also ask for the new redirect transition\n const wrappedHook = (trans: Transition) => {\n let promise, ids = trans[cacheProp] = trans[cacheProp] || {};\n if (!prevTruthyAnswer(trans)) {\n promise = $q.when(controllerInstance.uiCanExit(trans));\n promise.then(val => ids[id] = (val !== false));\n }\n return promise;\n };\n\n let criteria = {exiting: viewState.name};\n $scope.$on('$destroy', $transitions.onBefore(criteria, wrappedHook, hookOptions));\n }\n}\n\nangular.module('ui.router.state').directive('uiView', uiView);\nangular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);\n", - "/**\n * @hidden\n * @module ng1\n */ /** */\ndeclare var angular;\nimport * as ng_from_import from \"angular\";\nlet ng_from_global = angular;\n\nexport const ng = (ng_from_import && ng_from_import.module) ? ng_from_import : ng_from_global;\n", - "/**\n * @coreapi\n * @module core\n */\n/** \n * Matches state names using glob-like pattern strings.\n *\n * Globs can be used in specific APIs including:\n *\n * - [[StateService.is]]\n * - [[StateService.includes]]\n * - The first argument to Hook Registration functions like [[TransitionService.onStart]]\n * - [[HookMatchCriteria]] and [[HookMatchCriterion]]\n *\n * A `Glob` string is a pattern which matches state names.\n * Nested state names are split into segments (separated by a dot) when processing.\n * The state named `foo.bar.baz` is split into three segments ['foo', 'bar', 'baz']\n *\n * Globs work according to the following rules:\n *\n * ### Exact match:\n *\n * The glob `'A.B'` matches the state named exactly `'A.B'`.\n *\n * | Glob |Matches states named|Does not match state named|\n * |:------------|:--------------------|:---------------------|\n * | `'A'` | `'A'` | `'B'` , `'A.C'` |\n * | `'A.B'` | `'A.B'` | `'A'` , `'A.B.C'` |\n * | `'foo'` | `'foo'` | `'FOO'` , `'foo.bar'`|\n *\n * ### Single star (`*`)\n *\n * A single star (`*`) is a wildcard that matches exactly one segment.\n *\n * | Glob |Matches states named |Does not match state named |\n * |:------------|:---------------------|:--------------------------|\n * | `'*'` | `'A'` , `'Z'` | `'A.B'` , `'Z.Y.X'` |\n * | `'A.*'` | `'A.B'` , `'A.C'` | `'A'` , `'A.B.C'` |\n * | `'A.*.*'` | `'A.B.C'` , `'A.X.Y'`| `'A'`, `'A.B'` , `'Z.Y.X'`|\n *\n * ### Double star (`**`)\n *\n * A double star (`'**'`) is a wildcard that matches *zero or more segments*\n *\n * | Glob |Matches states named |Does not match state named |\n * |:------------|:----------------------------------------------|:----------------------------------|\n * | `'**'` | `'A'` , `'A.B'`, `'Z.Y.X'` | (matches all states) |\n * | `'A.**'` | `'A'` , `'A.B'` , `'A.C.X'` | `'Z.Y.X'` |\n * | `'**.X'` | `'X'` , `'A.X'` , `'Z.Y.X'` | `'A'` , `'A.login.Z'` |\n * | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` |\n *\n */\nexport class Glob {\n text: string;\n glob: Array;\n regexp: RegExp;\n\n constructor(text: string) {\n this.text = text;\n this.glob = text.split('.');\n\n let regexpString = this.text.split('.')\n .map(seg => {\n if (seg === '**') return '(?:|(?:\\\\.[^.]*)*)';\n if (seg === '*') return '\\\\.[^.]*';\n return '\\\\.' + seg;\n }).join('');\n\n this.regexp = new RegExp(\"^\" + regexpString + \"$\");\n }\n\n matches(name: string) {\n return this.regexp.test('.' + name);\n }\n\n /** Returns true if the string has glob-like characters in it */\n static is(text: string) {\n return !!/[!,*]+/.exec(text);\n }\n\n /** Returns a glob from the string, or null if the string isn't Glob-like */\n static fromString(text: string) {\n return Glob.is(text) ? new Glob(text) : null;\n }\n}\n", - "/**\n * @coreapi\n * @module state\n */\n/** for typedoc */\nimport { StateDeclaration, _ViewDeclaration, _StateDeclaration, LazyLoadResult } from \"./interface\";\nimport { defaults, values, find, inherit } from \"../common/common\";\nimport { propEq } from \"../common/hof\";\nimport { Param } from \"../params/param\";\nimport { UrlMatcher } from \"../url/urlMatcher\";\nimport { Resolvable } from \"../resolve/resolvable\";\nimport { TransitionStateHookFn } from \"../transition/interface\";\nimport { TargetState } from \"./targetState\";\nimport { Transition } from \"../transition/transition\";\nimport { Glob } from \"../common/glob\";\nimport { isObject, isFunction } from \"../common/predicates\";\n\n/**\n * Internal representation of a UI-Router state.\n *\n * Instances of this class are created when a [[StateDeclaration]] is registered with the [[StateRegistry]].\n *\n * A registered [[StateDeclaration]] is augmented with a getter ([[StateDeclaration.$$state]]) which returns the corresponding [[StateObject]] object.\n *\n * This class prototypally inherits from the corresponding [[StateDeclaration]].\n * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]].\n */\nexport class StateObject {\n /** The parent [[StateObject]] */\n public parent: StateObject;\n\n /** The name used to register the state */\n public name: string;\n\n /** Prototypally inherits from [[StateDeclaration.abstract]] */\n public abstract: boolean;\n\n /** Prototypally inherits from [[StateDeclaration.resolve]] */\n public resolve: ({ [key: string]: (string|any[]|Function) }|any[]);\n\n /** A list of [[Resolvable]] objects. The internal representation of [[resolve]]. */\n public resolvables: Resolvable[];\n\n /** Prototypally inherits from [[StateDeclaration.resolvePolicy]] */\n public resolvePolicy: any;\n\n /** A compiled URLMatcher which detects when the state's URL is matched */\n public url: UrlMatcher;\n\n /** The parameters for the state, built from the URL and [[StateDeclaration.params]] */\n public params: { [key: string]: Param };\n\n /**\n * The views for the state.\n * Note: `@uirouter/core` does not register a builder for views.\n * The framework specific code should register a `views` builder.\n */\n public views: { [key: string]: _ViewDeclaration; };\n\n /**\n * The original [[StateDeclaration]] used to build this [[StateObject]].\n * Note: `this` object also prototypally inherits from the `self` declaration object.\n */\n public self: StateDeclaration;\n\n /** The nearest parent [[StateObject]] which has a URL */\n public navigable: StateObject;\n\n /** The parent [[StateObject]] objects from this state up to the root */\n public path: StateObject[];\n\n /**\n * Prototypally inherits from [[StateDeclaration.data]]\n * Note: This is the only field on the [[StateDeclaration]] which is mutated.\n * The definition object's `data` field is replaced with a new object\n * which prototypally inherits from the parent state definition's `data` field.\n */\n public data: any;\n\n /** \n * An object containing the parent States' names as keys and \n * true as their values.\n */\n public includes: { [name: string]: boolean };\n\n /** Prototypally inherits from [[StateDeclaration.onExit]] */\n public onExit: TransitionStateHookFn;\n /** Prototypally inherits from [[StateDeclaration.onRetain]] */\n public onRetain: TransitionStateHookFn;\n /** Prototypally inherits from [[StateDeclaration.onEnter]] */\n public onEnter: TransitionStateHookFn;\n\n /** Prototypally inherits from [[StateDeclaration.lazyLoad]] */\n public lazyLoad: (transition: Transition, state: StateDeclaration) => Promise;\n\n /** Prototypally inherits from [[StateDeclaration.redirectTo]] */\n redirectTo: (\n string |\n (($transition$: Transition) => TargetState) |\n { state: (string|StateDeclaration), params: { [key: string]: any }}\n );\n\n /** @hidden */\n __stateObjectCache: {\n /** Might be null */\n nameGlob?: Glob\n };\n\n\n /** @deprecated use State.create() */\n constructor(config?: StateDeclaration) {\n return StateObject.create(config || {});\n }\n\n /**\n * Create a state object to put the private/internal implementation details onto.\n * The object's prototype chain looks like:\n * (Internal State Object) -> (Copy of State.prototype) -> (State Declaration object) -> (State Declaration's prototype...)\n *\n * @param stateDecl the user-supplied State Declaration\n * @returns {StateObject} an internal State object\n */\n static create(stateDecl: _StateDeclaration): StateObject {\n stateDecl = StateObject.isStateClass(stateDecl) ? new stateDecl() : stateDecl;\n\n let state = inherit(inherit(stateDecl, StateObject.prototype)) as StateObject;\n stateDecl.$$state = () => state;\n state.self = stateDecl;\n state.__stateObjectCache = {\n nameGlob: Glob.fromString(state.name) // might return null\n };\n return state;\n }\n\n /** Predicate which returns true if the object is an class with @State() decorator */\n static isStateClass = (stateDecl: _StateDeclaration): stateDecl is ({ new (): StateDeclaration }) =>\n isFunction(stateDecl) && stateDecl['__uiRouterState'] === true;\n\n /** Predicate which returns true if the object is an internal [[StateObject]] object */\n static isState = (obj: any): obj is StateObject =>\n isObject(obj['__stateObjectCache']);\n\n /**\n * Returns true if the provided parameter is the same state.\n *\n * Compares the identity of the state against the passed value, which is either an object\n * reference to the actual `State` instance, the original definition object passed to\n * `$stateProvider.state()`, or the fully-qualified name.\n *\n * @param ref Can be one of (a) a `State` instance, (b) an object that was passed\n * into `$stateProvider.state()`, (c) the fully-qualified name of a state as a string.\n * @returns Returns `true` if `ref` matches the current `State` instance.\n */\n is(ref: StateObject|StateDeclaration|string): boolean {\n return this === ref || this.self === ref || this.fqn() === ref;\n }\n\n /**\n * @deprecated this does not properly handle dot notation\n * @returns Returns a dot-separated name of the state.\n */\n fqn(): string {\n if (!this.parent || !(this.parent instanceof this.constructor)) return this.name;\n let name = this.parent.fqn();\n return name ? name + \".\" + this.name : this.name;\n }\n\n /**\n * Returns the root node of this state's tree.\n *\n * @returns The root of this state's tree.\n */\n root(): StateObject {\n return this.parent && this.parent.root() || this;\n }\n\n /**\n * Gets the state's `Param` objects\n *\n * Gets the list of [[Param]] objects owned by the state.\n * If `opts.inherit` is true, it also includes the ancestor states' [[Param]] objects.\n * If `opts.matchingKeys` exists, returns only `Param`s whose `id` is a key on the `matchingKeys` object\n *\n * @param opts options\n */\n parameters(opts?: { inherit?: boolean, matchingKeys?: any }): Param[] {\n opts = defaults(opts, { inherit: true, matchingKeys: null });\n let inherited = opts.inherit && this.parent && this.parent.parameters() || [];\n return inherited.concat(values(this.params))\n .filter(param => !opts.matchingKeys || opts.matchingKeys.hasOwnProperty(param.id));\n }\n\n /**\n * Returns a single [[Param]] that is owned by the state\n *\n * If `opts.inherit` is true, it also searches the ancestor states` [[Param]]s.\n * @param id the name of the [[Param]] to return\n * @param opts options\n */\n parameter(id: string, opts: { inherit?: boolean } = {}): Param {\n return (\n this.url && this.url.parameter(id, opts) ||\n find(values(this.params), propEq('id', id)) ||\n opts.inherit && this.parent && this.parent.parameter(id)\n );\n }\n\n toString() {\n return this.fqn();\n }\n}\n", - "/**\n * This module is a stub for core services such as Dependency Injection or Browser Location.\n * Core services may be implemented by a specific framework, such as ng1 or ng2, or be pure javascript.\n *\n * @module common\n */\n/** for typedoc */\nimport {IInjectable, Obj} from \"./common\";\nimport { Disposable } from \"../interface\";\nimport { UrlParts } from \"../url/interface\";\n\nexport let notImplemented = (fnname: string) => () => {\n throw new Error(`${fnname}(): No coreservices implementation for UI-Router is loaded.`);\n};\n\nlet services: CoreServices = {\n $q: undefined,\n $injector: undefined,\n};\n\nexport interface $QLikeDeferred {\n resolve: (val?: any) => void;\n reject: (reason?: any) => void;\n promise: Promise;\n}\n\nexport interface $QLike {\n when(value?: T | PromiseLike): Promise;\n reject(reason: any): Promise;\n defer(): $QLikeDeferred;\n all(promises: { [key: string]: Promise }): Promise;\n all(promises: Promise[]): Promise;\n}\n\nexport interface $InjectorLike {\n get(token: any): any;\n get(token: any): T;\n has(token: any): boolean;\n invoke(fn: IInjectable, context?: any, locals?: Obj): any;\n annotate(fn: IInjectable, strictDi?: boolean): any[];\n strictDi?: boolean;\n}\n\nexport interface CoreServices {\n $q: $QLike;\n $injector: $InjectorLike;\n}\n\nexport interface LocationServices extends Disposable {\n /**\n * Gets the current url string\n *\n * The URL is normalized using the internal [[path]]/[[search]]/[[hash]] values.\n *\n * For example, the URL may be stored in the hash ([[HashLocationServices]]) or\n * have a base HREF prepended ([[PushStateLocationServices]]).\n *\n * The raw URL in the browser might be:\n *\n * ```\n * http://mysite.com/somepath/index.html#/internal/path/123?param1=foo#anchor\n * ```\n *\n * or\n *\n * ```\n * http://mysite.com/basepath/internal/path/123?param1=foo#anchor\n * ```\n *\n * then this method returns:\n *\n * ```\n * /internal/path/123?param1=foo#anchor\n * ```\n *\n *\n * #### Example:\n * ```js\n * locationServices.url(); // \"/some/path?query=value#anchor\"\n * ```\n *\n * @returns the current value of the url, as a string.\n */\n url(): string;\n\n /**\n * Updates the url, or gets the current url\n *\n * Updates the url, changing it to the value in `newurl`\n *\n * #### Example:\n * ```js\n * locationServices.url(\"/some/path?query=value#anchor\", true);\n * ```\n *\n * @param newurl The new value for the URL.\n * This url should reflect only the new internal [[path]], [[search]], and [[hash]] values.\n * It should not include the protocol, site, port, or base path of an absolute HREF.\n * @param replace When true, replaces the current history entry (instead of appending it) with this new url\n * @param state The history's state object, i.e., pushState (if the LocationServices implementation supports it)\n * @return the url (after potentially being processed)\n */\n url(newurl: string, replace?: boolean, state?: any): string;\n\n /**\n * Gets the path part of the current url\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`\n *\n * @return the path portion of the url\n */\n path(): string;\n\n /**\n * Gets the search part of the current url as an object\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`\n *\n * @return the search (querystring) portion of the url, as an object\n */\n search(): { [key: string]: any };\n\n /**\n * Gets the hash part of the current url\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `anchor`\n *\n * @return the hash (anchor) portion of the url\n */\n hash(): string;\n\n /**\n * Registers a url change handler\n *\n * #### Example:\n * ```js\n * let deregisterFn = locationServices.onChange((evt) => console.log(\"url change\", evt));\n * ```\n *\n * @param callback a function that will be called when the url is changing\n * @return a function that de-registers the callback\n */\n onChange(callback: Function): Function;\n}\n\n/**\n * This service returns the location configuration\n *\n * This service returns information about the location configuration.\n * This service is primarily used when building URLs (e.g., for `hrefs`)\n */\nexport interface LocationConfig extends Disposable {\n /**\n * Gets the port, e.g., `80`\n *\n * @return the port number\n */\n port(): number;\n /**\n * Gets the protocol, e.g., `http`\n *\n * @return the protocol\n */\n protocol(): string;\n /**\n * Gets the host, e.g., `localhost`\n *\n * @return the protocol\n */\n host(): string;\n /**\n * Gets the base Href, e.g., `http://localhost/approot/`\n *\n * @return the application's base href\n */\n baseHref(): string;\n /**\n * Returns true when running in pushstate mode\n *\n * @return true when running in pushstate mode\n */\n html5Mode(): boolean;\n /**\n * Gets the hashPrefix (when not running in pushstate mode)\n *\n * If the current url is `http://localhost/app#!/uirouter/path/#anchor`, it returns `!` which is the prefix for the \"hashbang\" portion.\n *\n * @return the hash prefix\n */\n hashPrefix(): string;\n /**\n * Sets the hashPrefix (when not running in pushstate mode)\n *\n * @return the new hash prefix\n */\n hashPrefix(newprefix: string): string;\n}\n\nexport {services};\n", - "/**\n * @module common\n */ /** for typedoc */\n\nexport class Queue {\n constructor(private _items: T[] = [], private _limit: number = null) { }\n\n enqueue(item: T) {\n let items = this._items;\n items.push(item);\n if (this._limit && items.length > this._limit) items.shift();\n return item;\n }\n\n dequeue(): T {\n if (this.size())\n return this._items.splice(0, 1)[0];\n }\n\n clear(): Array {\n let current = this._items;\n this._items = [];\n return current;\n }\n\n size(): number {\n return this._items.length;\n }\n\n remove(item: T) {\n let idx = this._items.indexOf(item);\n return idx > -1 && this._items.splice(idx, 1)[0];\n }\n\n peekTail(): T {\n return this._items[this._items.length - 1];\n }\n\n peekHead(): T {\n if (this.size())\n return this._items[0];\n }\n}\n", - "/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\n\"use strict\";\nimport {extend, silentRejection} from \"../common/common\";\nimport {stringify} from \"../common/strings\";\nimport { is } from '../common/hof';\n\nexport enum RejectType {\n SUPERSEDED = 2, ABORTED = 3, INVALID = 4, IGNORED = 5, ERROR = 6\n}\n\n/** @hidden */ let id = 0;\n\nexport class Rejection {\n $id = id++;\n type: number;\n message: string;\n detail: any;\n redirected: boolean;\n\n constructor(type: number, message?: string, detail?: any) {\n this.type = type;\n this.message = message;\n this.detail = detail;\n }\n\n toString() {\n const detailString = (d: any) => \n d && d.toString !== Object.prototype.toString ? d.toString() : stringify(d);\n let detail = detailString(this.detail);\n let { $id, type, message } = this;\n return `Transition Rejection($id: ${$id} type: ${type}, message: ${message}, detail: ${detail})`;\n }\n\n toPromise(): Promise {\n return extend(silentRejection(this), { _transitionRejection: this });\n }\n\n /** Returns true if the obj is a rejected promise created from the `asPromise` factory */\n static isRejectionPromise(obj: any): boolean {\n return obj && (typeof obj.then === 'function') && is(Rejection)(obj._transitionRejection);\n }\n\n /** Returns a Rejection due to transition superseded */\n static superseded(detail?: any, options?: any): Rejection {\n let message = \"The transition has been superseded by a different transition\";\n let rejection = new Rejection(RejectType.SUPERSEDED, message, detail);\n if (options && options.redirected) {\n rejection.redirected = true;\n }\n return rejection;\n }\n\n /** Returns a Rejection due to redirected transition */\n static redirected(detail?: any): Rejection {\n return Rejection.superseded(detail, { redirected: true });\n }\n\n /** Returns a Rejection due to invalid transition */\n static invalid(detail?: any): Rejection {\n let message = \"This transition is invalid\";\n return new Rejection(RejectType.INVALID, message, detail);\n }\n\n /** Returns a Rejection due to ignored transition */\n static ignored(detail?: any): Rejection {\n let message = \"The transition was ignored\";\n return new Rejection(RejectType.IGNORED, message, detail);\n }\n\n /** Returns a Rejection due to aborted transition */\n static aborted(detail?: any): Rejection {\n let message = \"The transition has been aborted\";\n return new Rejection(RejectType.ABORTED, message, detail);\n }\n\n /** Returns a Rejection due to aborted transition */\n static errored(detail?: any): Rejection {\n let message = \"The transition errored\";\n return new Rejection(RejectType.ERROR, message, detail);\n }\n \n /**\n * Returns a Rejection\n *\n * Normalizes a value as a Rejection.\n * If the value is already a Rejection, returns it.\n * Otherwise, wraps and returns the value as a Rejection (Rejection type: ERROR).\n *\n * @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection.\n */\n static normalize(detail?: Rejection | Error | any): Rejection {\n return is(Rejection)(detail) ? detail : Rejection.errored(detail);\n }\n}\n", - "/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\nimport {StateDeclaration} from \"../state/interface\";\nimport {Predicate} from \"../common/common\";\n\nimport {Transition} from \"./transition\";\nimport {StateObject} from \"../state/stateObject\";\nimport {PathNode} from \"../path/pathNode\";\nimport {TargetState} from \"../state/targetState\";\nimport {RegisteredHook} from \"./hookRegistry\";\n\n/**\n * The TransitionOptions object can be used to change the behavior of a transition.\n *\n * It is passed as the third argument to [[StateService.go]], [[StateService.transitionTo]].\n * It can also be used with a `uiSref`.\n */\nexport interface TransitionOptions {\n /**\n * This option changes how the Transition interacts with the browser's location bar (URL).\n *\n * - If `true`, it will update the url in the location bar.\n * - If `false`, it will not update the url in the location bar.\n * - If it is the string `\"replace\"`, it will update the url and also replace the last history record.\n *\n * @default `true`\n */\n location ?: (boolean|string);\n\n /**\n * When transitioning to relative path (e.g '`^`'), this option defines which state to be relative from.\n * @default `$state.current`\n */\n relative ?: (string|StateDeclaration|StateObject);\n\n /**\n * This option sets whether or not the transition's parameter values should be inherited from\n * the current parameter values.\n *\n * - If `true`, it will inherit parameter values from the current parameter values.\n * - If `false`, only the parameters which are provided to `transitionTo` will be used.\n *\n * @default `false`\n */\n inherit ?: boolean;\n\n /**\n * @deprecated\n */\n notify ?: boolean;\n\n /**\n * This option may be used to force states which are currently active to reload.\n *\n * During a normal transition, a state is \"retained\" if:\n * - It was previously active\n * - The state's parameter values have not changed\n * - All the parent states' parameter values have not changed\n *\n * Forcing a reload of a state will cause it to be exited and entered, which will:\n * - Refetch that state's resolve data\n * - Exit the state (onExit hook)\n * - Re-enter the state (onEnter hook)\n * - Re-render the views (controllers and templates)\n *\n * - When `true`, the destination state (and all parent states) will be reloaded.\n * - When it is a string and is the name of a state, or when it is a State object,\n * that state and any children states will be reloaded.\n *\n * @default `false`\n */\n reload ?: (boolean|string|StateDeclaration|StateObject);\n /**\n * You can define your own Transition Options inside this property and use them, e.g., from a Transition Hook\n */\n custom ?: any;\n /** @internalapi */\n reloadState ?: (StateObject);\n /** @internalapi\n * If this transition is a redirect, this property should be the original Transition (which was redirected to this one)\n */\n redirectedFrom?: Transition;\n /** @internalapi */\n current ?: () => Transition;\n /** @internalapi */\n source ?: \"sref\" | \"url\" | \"redirect\" | \"otherwise\" | \"unknown\";\n}\n\n/** @internalapi */\nexport interface TransitionHookOptions {\n current ?: () => Transition; //path?\n transition ?: Transition;\n hookType ?: string;\n target ?: any;\n traceData ?: any;\n bind ?: any;\n stateHook ?: boolean;\n}\n\n/**\n * TreeChanges encapsulates the various Paths that are involved in a Transition.\n *\n * Get a TreeChanges object using [[Transition.treeChanges]]\n *\n * A UI-Router Transition is from one Path in a State Tree to another Path. For a given Transition,\n * this object stores the \"to\" and \"from\" paths, as well as subsets of those: the \"retained\",\n * \"exiting\" and \"entering\" paths.\n *\n * Each path in TreeChanges is an array of [[PathNode]] objects. Each PathNode in the array corresponds to a portion\n * of a nested state.\n *\n * For example, if you had a nested state named `foo.bar.baz`, it would have three\n * portions, `foo, bar, baz`. If you transitioned **to** `foo.bar.baz` and inspected the [[TreeChanges.to]]\n * Path, you would find a node in the array for each portion: `foo`, `bar`, and `baz`.\n *\n * ---\n *\n * @todo show visual state tree\n */\nexport interface TreeChanges {\n /** @nodoc */\n [key: string]: PathNode[];\n\n /** The path of nodes in the state tree that the transition is coming *from* */\n from: PathNode[];\n\n /** The path of nodes in the state tree that the transition is going *to* */\n to: PathNode[];\n\n /**\n * The path of active nodes that the transition is retaining.\n *\n * These nodes are neither exited, nor entered.\n * Before and after the transition is successful, these nodes are active.\n */\n retained: PathNode[];\n\n /**\n * The path of previously active nodes that the transition is exiting.\n *\n * After the Transition is successful, these nodes are no longer active.\n *\n * Note that a state that is being reloaded (due to parameter values changing, or `reload: true`) may be in both the\n * `exiting` and `entering` paths.\n */\n exiting: PathNode[];\n\n /**\n * The path of nodes that the transition is entering.\n *\n * After the Transition is successful, these nodes will be active.\n * Because they are entering, they have their resolves fetched, `onEnter` hooks run, and their views\n * (component(s) or controller(s)+template(s)) refreshed.\n *\n * Note that a state that is reloaded (due to parameter values changing, or `reload: true`) may be in both the\n * `exiting` and `entering` paths.\n */\n entering: PathNode[];\n}\n\nexport type IHookRegistration = (matchCriteria: HookMatchCriteria, callback: HookFn, options?: HookRegOptions) => Function;\n\n/**\n * The signature for Transition Hooks.\n *\n * Transition hooks are callback functions that hook into the lifecycle of transitions.\n * As a transition runs, it reaches certain lifecycle events.\n * As each event occurs, the hooks which are registered for the event are called (in priority order).\n *\n * A transition hook may alter a Transition by returning a [[HookResult]].\n *\n * #### See:\n *\n * - [[IHookRegistry.onBefore]]\n * - [[IHookRegistry.onStart]]\n * - [[IHookRegistry.onFinish]]\n * - [[IHookRegistry.onSuccess]]\n * - [[IHookRegistry.onError]]\n *\n * @param transition the current [[Transition]]\n * @param injector (for ng1 or ng2 only) the injector service\n *\n * @returns a [[HookResult]] which may alter the transition\n *\n */\nexport interface TransitionHookFn {\n (transition: Transition) : HookResult;\n}\n\n/**\n * The signature for Transition State Hooks.\n *\n * A function which hooks into a lifecycle event for a specific state.\n *\n * Transition State Hooks are callback functions that hook into the lifecycle events of specific states during a transition.\n * As a transition runs, it may exit some states, retain (keep) states, and enter states.\n * As each lifecycle event occurs, the hooks which are registered for the event and that state are called (in priority order).\n *\n * #### See:\n *\n * - [[IHookRegistry.onExit]]\n * - [[IHookRegistry.onRetain]]\n * - [[IHookRegistry.onEnter]]\n *\n * @param transition the current [[Transition]]\n * @param state the [[StateObject]] that the hook is bound to\n * @param injector (for ng1 or ng2 only) the injector service\n *\n * @returns a [[HookResult]] which may alter the transition\n */\nexport interface TransitionStateHookFn {\n (transition: Transition, state: StateDeclaration) : HookResult;\n}\n\n/**\n * The signature for Transition onCreate Hooks.\n *\n * Transition onCreate Hooks are callbacks that allow customization or preprocessing of\n * a Transition before it is returned from [[TransitionService.create]]\n *\n * @param transition the [[Transition]] that was just created\n * @return a [[Transition]] which will then be returned from [[TransitionService.create]]\n */\nexport interface TransitionCreateHookFn {\n (transition: Transition): void;\n}\n\nexport type HookFn = (TransitionHookFn|TransitionStateHookFn|TransitionCreateHookFn);\n\n/**\n * The return value of a [[TransitionHookFn]] or [[TransitionStateHookFn]]\n *\n * When returned from a [[TransitionHookFn]] or [[TransitionStateHookFn]], these values alter the running [[Transition]]:\n *\n * - `false`: the transition will be cancelled.\n * - [[TargetState]]: the transition will be redirected to the new target state (see: [[StateService.target]])\n * - `Promise`: the transition will wait for the promise to resolve or reject\n * - If the promise is rejected (or resolves to `false`), the transition will be cancelled\n * - If the promise resolves to a [[TargetState]], the transition will be redirected\n * - If the promise resolves to anything else, the transition will resume\n * - Anything else: the transition will resume\n */\nexport type HookResult = (boolean | TargetState | void | Promise);\n\n/**\n * These options may be provided when registering a Transition Hook (such as `onStart`)\n */\nexport interface HookRegOptions {\n /**\n * Sets the priority of the registered hook\n *\n * Hooks of the same type (onBefore, onStart, etc) are invoked in priority order. A hook with a higher priority\n * is invoked before a hook with a lower priority.\n *\n * The default hook priority is 0\n */\n priority?: number;\n\n /**\n * Specifies what `this` is bound to during hook invocation.\n */\n bind?: any;\n\n /**\n * Limits the number of times that the hook will be invoked.\n * Once the hook has been invoked this many times, it is automatically deregistered.\n */\n invokeLimit?: number;\n}\n\n/**\n * This interface specifies the api for registering Transition Hooks. Both the\n * [[TransitionService]] and also the [[Transition]] object itself implement this interface.\n * Note: the Transition object only allows hooks to be registered before the Transition is started.\n */\nexport interface IHookRegistry {\n /**\n * Registers a [[TransitionHookFn]], called *before a transition starts*.\n *\n * Registers a transition lifecycle hook, which is invoked before a transition even begins.\n * This hook can be useful to implement logic which prevents a transition from even starting, such\n * as authentication, redirection\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onBefore` hooks are invoked *before a Transition starts*.\n * No resolves have been fetched yet.\n * Each `onBefore` hook is invoked synchronously, in the same call stack as [[StateService.transitionTo]].\n * The registered `onBefore` hooks are invoked in priority order.\n *\n * Note: during the `onBefore` phase, additional hooks can be added to the specific [[Transition]] instance.\n * These \"on-the-fly\" hooks only affect the currently running transition..\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * If any hook modifies the transition *synchronously* (by throwing, returning `false`, or returning\n * a [[TargetState]]), the remainder of the hooks are skipped.\n * If a hook returns a promise, the remainder of the `onBefore` hooks are still invoked synchronously.\n * All promises are resolved, and processed asynchronously before the `onStart` phase of the Transition.\n *\n * ### Examples\n *\n * #### Default Substate\n *\n * This example redirects any transition from 'home' to 'home.dashboard'. This is commonly referred to as a\n * \"default substate\".\n *\n * @example\n * ```js\n * // ng2\n * transitionService.onBefore({ to: 'home' }, (trans: Transition) =>\n * trans.router.stateService.target(\"home.dashboard\"));\n * ```\n *\n * #### Data Driven Default Substate\n *\n * This example provides data-driven default substate functionality. It matches on a transition to any state\n * which has `defaultSubstate: \"some.sub.state\"` defined. See: [[Transition.to]] which returns the \"to state\"\n * definition.\n *\n * @example\n * ```js\n * // ng1\n * // state declaration\n * {\n * name: 'home',\n * template: '
    ',\n * defaultSubstate: 'home.dashboard'\n * }\n *\n * var criteria = {\n * to: function(state) {\n * return state.defaultSubstate != null;\n * }\n * }\n *\n * $transitions.onBefore(criteria, function(trans: Transition) {\n * var substate = trans.to().defaultSubstate;\n * return trans.router.stateService.target(substate);\n * });\n * ```\n *\n *\n * #### Require authentication\n *\n * This example cancels a transition to a state which requires authentication, if the user is not currently authenticated.\n *\n * This example assumes a state tree where all states which require authentication are children of a parent `'requireauth'` state.\n * This example assumes `MyAuthService` synchronously returns a boolean from `isAuthenticated()`.\n *\n * #### Example:\n * ```js\n * // ng1\n * $transitions.onBefore( { to: 'requireauth.**' }, function(trans) {\n * var myAuthService = trans.injector().get('MyAuthService');\n * // If isAuthenticated returns false, the transition is cancelled.\n * return myAuthService.isAuthenticated();\n * });\n * ```\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be invoked.\n * @returns a function which deregisters the hook.\n */\n onBefore(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called when a transition starts.\n *\n * Registers a transition lifecycle hook, which is invoked as a transition starts running.\n * This hook can be useful to perform some asynchronous action before completing a transition.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onStart` hooks are invoked asynchronously when the Transition starts running.\n * This happens after the `onBefore` phase is complete.\n * At this point, the Transition has not yet exited nor entered any states.\n * The registered `onStart` hooks are invoked in priority order.\n *\n * Note: A built-in `onStart` hook with high priority is used to fetch any eager resolve data.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Example\n *\n * #### Login during transition\n *\n * This example intercepts any transition to a state which requires authentication, when the user is\n * not currently authenticated. It allows the user to authenticate asynchronously, then resumes the\n * transition. If the user did not authenticate successfully, it redirects to the \"guest\" state, which\n * does not require authentication.\n *\n * This example assumes:\n * - a state tree where all states which require authentication are children of a parent `'auth'` state.\n * - `MyAuthService.isAuthenticated()` synchronously returns a boolean.\n * - `MyAuthService.authenticate()` presents a login dialog, and returns a promise which is resolved\n * or rejected, whether or not the login attempt was successful.\n *\n * #### Example:\n * ```js\n * // ng1\n * $transitions.onStart( { to: 'auth.**' }, function(trans) {\n * var $state = trans.router.stateService;\n * var MyAuthService = trans.injector().get('MyAuthService');\n *\n * // If the user is not authenticated\n * if (!MyAuthService.isAuthenticated()) {\n *\n * // Then return a promise for a successful login.\n * // The transition will wait for this promise to settle\n *\n * return MyAuthService.authenticate().catch(function() {\n *\n * // If the authenticate() method failed for whatever reason,\n * // redirect to a 'guest' state which doesn't require auth.\n * return $state.target(\"guest\");\n * });\n * }\n * });\n * ```\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onStart(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is entered.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being entered.\n *\n * Since this hook is run only when the specific state is being *entered*, it can be useful for\n * performing tasks when entering a submodule/feature area such as initializing a stateful service,\n * or for guarding access to a submodule/feature area.\n *\n * See [[TransitionStateHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onEnter` hooks generally specify `{ entering: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onEnter` hooks are invoked when the Transition is entering a state.\n * States are entered after the `onRetain` phase is complete.\n * If more than one state is being entered, the parent state is entered first.\n * The registered `onEnter` hooks for a state are invoked in priority order.\n *\n * Note: A built-in `onEnter` hook with high priority is used to fetch lazy resolve data for states being entered.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onEnter` hooks using the [[TransitionService]], you may define an `onEnter` hook\n * directly on a state declaration (see: [[StateDeclaration.onEnter]]).\n *\n *\n * ### Examples\n *\n * #### Audit Log\n *\n * This example uses a service to log that a user has entered the admin section of an app.\n * This assumes that there are substates of the \"admin\" state, such as \"admin.users\", \"admin.pages\", etc.\n * @example\n * ```\n *\n * $transitions.onEnter({ entering: 'admin' }, function(transition, state) {\n * var AuditService = trans.injector().get('AuditService');\n * AuditService.log(\"Entered \" + state.name + \" module while transitioning to \" + transition.to().name);\n * }\n * ```\n *\n * #### Audit Log (inside a state declaration)\n *\n * The `onEnter` inside this state declaration is syntactic sugar for the previous Audit Log example.\n * ```\n * {\n * name: 'admin',\n * component: 'admin',\n * onEnter: function($transition$, $state$) {\n * var AuditService = $transition$.injector().get('AuditService');\n * AuditService.log(\"Entered \" + state.name + \" module while transitioning to \" + transition.to().name);\n * }\n * }\n * ```\n *\n * Note: A state declaration's `onEnter` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onEnter(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is retained/kept.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) for\n * a specific state that was previously active will remain active (is not being entered nor exited).\n *\n * This hook is invoked when a state is \"retained\" or \"kept\".\n * It means the transition is coming *from* a substate of the retained state *to* a substate of the retained state.\n * This hook can be used to perform actions when the user moves from one substate to another, such as between steps in a wizard.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onRetain` hooks generally specify `{ retained: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onRetain` hooks are invoked after any `onExit` hooks have been fired.\n * If more than one state is retained, the child states' `onRetain` hooks are invoked first.\n * The registered `onRetain` hooks for a state are invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onRetain` hooks using the [[TransitionService]], you may define an `onRetain` hook\n * directly on a state declaration (see: [[StateDeclaration.onRetain]]).\n *\n * Note: A state declaration's `onRetain` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onRetain(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is exited.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being exited.\n *\n * Since this hook is run only when the specific state is being *exited*, it can be useful for\n * performing tasks when leaving a submodule/feature area such as cleaning up a stateful service,\n * or for preventing the user from leaving a state or submodule until some criteria is satisfied.\n *\n * See [[TransitionStateHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onExit` hooks generally specify `{ exiting: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onExit` hooks are invoked when the Transition is exiting a state.\n * States are exited after any `onStart` phase is complete.\n * If more than one state is being exited, the child states are exited first.\n * The registered `onExit` hooks for a state are invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onExit` hooks using the [[TransitionService]], you may define an `onExit` hook\n * directly on a state declaration (see: [[StateDeclaration.onExit]]).\n *\n * Note: A state declaration's `onExit` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onExit(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called *just before a transition finishes*.\n *\n * Registers a transition lifecycle hook, which is invoked just before a transition finishes.\n * This hook is a last chance to cancel or redirect a transition.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onFinish` hooks are invoked after the `onEnter` phase is complete.\n * These hooks are invoked just before the transition is \"committed\".\n * Each hook is invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onFinish(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called after a successful transition completed.\n *\n * Registers a transition lifecycle hook, which is invoked after a transition successfully completes.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onSuccess` hooks are chained off the Transition's promise (see [[Transition.promise]]).\n * If the Transition is successful and its promise is resolved, then the `onSuccess` hooks are invoked.\n * Since these hooks are run after the transition is over, their return value is ignored.\n * The `onSuccess` hooks are invoked in priority order.\n *\n * ### Return value\n *\n * Since the Transition is already completed, the hook's return value is ignored\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onSuccess(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called after a transition has errored.\n *\n * Registers a transition lifecycle hook, which is invoked after a transition has been rejected for any reason.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * The `onError` hooks are chained off the Transition's promise (see [[Transition.promise]]).\n * If a Transition fails, its promise is rejected and the `onError` hooks are invoked.\n * The `onError` hooks are invoked in priority order.\n *\n * Since these hooks are run after the transition is over, their return value is ignored.\n *\n * A transition \"errors\" if it was started, but failed to complete (for any reason).\n * A *non-exhaustive list* of reasons a transition can error:\n *\n * - A transition was cancelled because a new transition started while it was still running (`Transition superseded`)\n * - A transition was cancelled by a Transition Hook returning false\n * - A transition was redirected by a Transition Hook returning a [[TargetState]]\n * - A Transition Hook or resolve function threw an error\n * - A Transition Hook returned a rejected promise\n * - A resolve function returned a rejected promise\n *\n * To check the failure reason, inspect the return value of [[Transition.error]].\n *\n * Note: `onError` should be used for targeted error handling, or error recovery.\n * For simple catch-all error reporting, use [[StateService.defaultErrorHandler]].\n *\n * ### Return value\n *\n * Since the Transition is already completed, the hook's return value is ignored\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onError(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Returns all the registered hooks of a given `hookName` type\n *\n * #### Example:\n * ```\n * $transitions.getHooks(\"onEnter\")\n * ```\n */\n getHooks(hookName: string): RegisteredHook[];\n\n /** @hidden place to store the hooks */\n _registeredHooks: { [key: string]: RegisteredHook[] };\n}\n\n/** A predicate type which tests if a [[StateObject]] passes some test. Returns a boolean. */\nexport type IStateMatch = Predicate;\n\n/**\n * This object is used to configure whether or not a Transition Hook is invoked for a particular transition,\n * based on the Transition's \"to state\" and \"from state\".\n *\n * Each property (`to`, `from`, `exiting`, `retained`, and `entering`) can be a state [[Glob]] string,\n * a boolean, or a function that takes a state and returns a boolean (see [[HookMatchCriterion]])\n *\n * All properties are optional. If any property is omitted, it is replaced with the value `true`, and always matches.\n * To match any transition, use an empty criteria object `{}`.\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from the `parent` state and going to the `parent.child` state.\n * var match = {\n * to: 'parent',\n * from: 'parent.child'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any substate of `parent` and going directly to the `parent` state.\n * var match = {\n * to: 'parent',\n * from: 'parent.**'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any state and going to any substate of `mymodule`\n * var match = {\n * to: 'mymodule.**'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any state and going to any state that has `data.authRequired`\n * // set to a truthy value.\n * var match = {\n * to: function(state) {\n * return state.data != null && state.data.authRequired === true;\n * }\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition that is exiting `parent.child`\n * var match = {\n * exiting: 'parent.child'\n * }\n * ```\n */\nexport interface HookMatchCriteria {\n [key: string]: HookMatchCriterion | undefined;\n\n /** A [[HookMatchCriterion]] to match the destination state */\n to?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match the original (from) state */\n from?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be exiting */\n exiting?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be retained */\n retained?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be entering */\n entering?: HookMatchCriterion;\n}\n\nexport interface IMatchingNodes {\n [key: string]: PathNode[];\n\n to: PathNode[];\n from: PathNode[];\n exiting: PathNode[];\n retained: PathNode[];\n entering: PathNode[];\n}\n\n/** @hidden */\nexport interface RegisteredHooks {\n [key: string]: RegisteredHook[];\n}\n\n/** @hidden */\nexport interface PathTypes {\n [key: string]: PathType;\n\n to: PathType;\n from: PathType;\n exiting: PathType;\n retained: PathType;\n entering: PathType;\n}\n\n/** @hidden */\nexport interface PathType {\n name: string;\n scope: TransitionHookScope;\n}\n\n/**\n * Hook Criterion used to match a transition.\n *\n * A [[Glob]] string that matches the name of a state.\n *\n * Or, a function with the signature `function(state) { return matches; }`\n * which should return a boolean to indicate if a state matches.\n *\n * Or, `true` to always match\n */\nexport type HookMatchCriterion = (string|IStateMatch|boolean)\n\nexport enum TransitionHookPhase { CREATE, BEFORE, RUN, SUCCESS, ERROR }\nexport enum TransitionHookScope { TRANSITION, STATE }\n", - "/**\n * @coreapi\n * @module state\n */ /** for typedoc */\n\nimport { StateDeclaration, StateOrName, TargetStateDef } from \"./interface\";\nimport { TransitionOptions } from \"../transition/interface\";\nimport { StateObject } from \"./stateObject\";\nimport { isString } from \"../common/predicates\";\nimport { stringify } from '../common/strings';\nimport { extend } from '../common';\nimport { StateRegistry } from './stateRegistry';\nimport { RawParams } from '../params';\n\n/**\n * Encapsulate the target (destination) state/params/options of a [[Transition]].\n *\n * This class is frequently used to redirect a transition to a new destination.\n *\n * See:\n *\n * - [[HookResult]]\n * - [[TransitionHookFn]]\n * - [[TransitionService.onStart]]\n *\n * To create a `TargetState`, use [[StateService.target]].\n *\n * ---\n *\n * This class wraps:\n *\n * 1) an identifier for a state\n * 2) a set of parameters\n * 3) and transition options\n * 4) the registered state object (the [[StateDeclaration]])\n *\n * Many UI-Router APIs such as [[StateService.go]] take a [[StateOrName]] argument which can\n * either be a *state object* (a [[StateDeclaration]] or [[StateObject]]) or a *state name* (a string).\n * The `TargetState` class normalizes those options.\n *\n * A `TargetState` may be valid (the state being targeted exists in the registry)\n * or invalid (the state being targeted is not registered).\n */\nexport class TargetState {\n private _definition: StateObject;\n private _params: RawParams;\n private _options: TransitionOptions;\n\n /**\n * The TargetState constructor\n *\n * Note: Do not construct a `TargetState` manually.\n * To create a `TargetState`, use the [[StateService.target]] factory method.\n *\n * @param _stateRegistry The StateRegistry to use to look up the _definition\n * @param _identifier An identifier for a state.\n * Either a fully-qualified state name, or the object used to define the state.\n * @param _params Parameters for the target state\n * @param _options Transition options.\n *\n * @internalapi\n */\n constructor(\n private _stateRegistry: StateRegistry,\n private _identifier: StateOrName,\n _params?: RawParams,\n _options?: TransitionOptions,\n ) {\n this._identifier = _identifier;\n this._params = extend({}, _params || {});\n this._options = extend({}, _options || {});\n this._definition = _stateRegistry.matcher.find(_identifier, this._options.relative);\n }\n\n /** The name of the state this object targets */\n name(): string {\n return this._definition && this._definition.name || this._identifier;\n }\n\n /** The identifier used when creating this TargetState */\n identifier(): StateOrName {\n return this._identifier;\n }\n\n /** The target parameter values */\n params(): RawParams {\n return this._params;\n }\n\n /** The internal state object (if it was found) */\n $state(): StateObject {\n return this._definition;\n }\n\n /** The internal state declaration (if it was found) */\n state(): StateDeclaration {\n return this._definition && this._definition.self;\n }\n\n /** The target options */\n options() {\n return this._options;\n }\n\n /** True if the target state was found */\n exists(): boolean {\n return !!(this._definition && this._definition.self);\n }\n\n /** True if the object is valid */\n valid(): boolean {\n return !this.error();\n }\n\n /** If the object is invalid, returns the reason why */\n error(): string {\n let base = this.options().relative;\n if (!this._definition && !!base) {\n let stateName = base.name ? base.name : base;\n return `Could not resolve '${this.name()}' from state '${stateName}'`;\n }\n if (!this._definition)\n return `No such state '${this.name()}'`;\n if (!this._definition.self)\n return `State '${this.name()}' has an invalid definition`;\n }\n\n toString() {\n return `'${this.name()}'${stringify(this.params())}`;\n }\n\n /** Returns true if the object has a state property that might be a state or state name */\n static isDef = (obj): obj is TargetStateDef =>\n obj && obj.state && (isString(obj.state) || isString(obj.state.name));\n\n /**\n * Returns a copy of this TargetState which targets a different state.\n * The new TargetState has the same parameter values and transition options.\n *\n * @param state The new state that should be targeted\n */\n withState(state: StateOrName): TargetState {\n return new TargetState(this._stateRegistry, state, this._params, this._options);\n }\n\n /**\n * Returns a copy of this TargetState, using the specified parameter values.\n *\n * @param params the new parameter values to use\n * @param replace When false (default) the new parameter values will be merged with the current values.\n * When true the parameter values will be used instead of the current values.\n */\n withParams(params: RawParams, replace = false): TargetState {\n const newParams: RawParams = replace ? params : extend({}, this._params, params);\n return new TargetState(this._stateRegistry, this._identifier, newParams, this._options);\n }\n\n /**\n * Returns a copy of this TargetState, using the specified Transition Options.\n *\n * @param options the new options to use\n * @param replace When false (default) the new options will be merged with the current options.\n * When true the options will be used instead of the current options.\n */\n withOptions(options: TransitionOptions, replace = false): TargetState {\n const newOpts = replace ? options : extend({}, this._options, options);\n return new TargetState(this._stateRegistry, this._identifier, this._params, newOpts);\n }\n}\n", - "/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport { TransitionHookOptions, HookResult, TransitionHookPhase } from './interface';\nimport { defaults, noop, silentRejection } from '../common/common';\nimport { fnToString, maxLength } from '../common/strings';\nimport { isPromise } from '../common/predicates';\nimport { is, parse } from '../common/hof';\nimport { trace } from '../common/trace';\nimport { services } from '../common/coreservices';\nimport { Rejection } from './rejectFactory';\nimport { TargetState } from '../state/targetState';\nimport { Transition } from './transition';\nimport { TransitionEventType } from './transitionEventType';\nimport { RegisteredHook } from './hookRegistry';\nimport { StateDeclaration } from '../state/interface';\n\nlet defaultOptions: TransitionHookOptions = {\n current: noop,\n transition: null,\n traceData: {},\n bind: null,\n};\n\nexport type GetResultHandler = (hook: TransitionHook) => ResultHandler;\nexport type GetErrorHandler = (hook: TransitionHook) => ErrorHandler;\n\nexport type ResultHandler = (result: HookResult) => Promise;\nexport type ErrorHandler = (error: any) => Promise;\n\n/** @hidden */\nexport class TransitionHook {\n type: TransitionEventType;\n constructor(private transition: Transition,\n private stateContext: StateDeclaration,\n private registeredHook: RegisteredHook,\n private options: TransitionHookOptions) {\n this.options = defaults(options, defaultOptions);\n this.type = registeredHook.eventType;\n }\n\n /**\n * These GetResultHandler(s) are used by [[invokeHook]] below\n * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]])\n */\n static HANDLE_RESULT: GetResultHandler = (hook: TransitionHook) => (result: HookResult) =>\n hook.handleHookResult(result);\n\n /**\n * If the result is a promise rejection, log it.\n * Otherwise, ignore the result.\n */\n static LOG_REJECTED_RESULT: GetResultHandler = (hook: TransitionHook) => (result: HookResult) => {\n isPromise(result) && result.catch(err =>\n hook.logError(Rejection.normalize(err)));\n return undefined;\n }\n\n /**\n * These GetErrorHandler(s) are used by [[invokeHook]] below\n * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]])\n */\n static LOG_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) =>\n hook.logError(error);\n\n static REJECT_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) =>\n silentRejection(error);\n\n static THROW_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) => {\n throw error;\n }\n\n private isSuperseded = () =>\n this.type.hookPhase === TransitionHookPhase.RUN && !this.options.transition.isActive();\n\n logError(err): any {\n this.transition.router.stateService.defaultErrorHandler()(err);\n }\n\n invokeHook(): Promise | void {\n let hook = this.registeredHook;\n if (hook._deregistered) return;\n\n let notCurrent = this.getNotCurrentRejection();\n if (notCurrent) return notCurrent;\n\n let options = this.options;\n trace.traceHookInvocation(this, this.transition, options);\n\n const invokeCallback = () =>\n hook.callback.call(options.bind, this.transition, this.stateContext);\n\n const normalizeErr = err =>\n Rejection.normalize(err).toPromise();\n\n const handleError = err =>\n hook.eventType.getErrorHandler(this)(err);\n\n const handleResult = result =>\n hook.eventType.getResultHandler(this)(result);\n\n try {\n let result = invokeCallback();\n\n if (!this.type.synchronous && isPromise(result)) {\n return result.catch(normalizeErr)\n .then(handleResult, handleError);\n } else {\n return handleResult(result);\n }\n } catch (err) {\n // If callback throws (synchronously)\n return handleError(Rejection.normalize(err));\n } finally {\n if (hook.invokeLimit && ++hook.invokeCount >= hook.invokeLimit) {\n hook.deregister();\n }\n }\n }\n\n /**\n * This method handles the return value of a Transition Hook.\n *\n * A hook can return false (cancel), a TargetState (redirect),\n * or a promise (which may later resolve to false or a redirect)\n *\n * This also handles \"transition superseded\" -- when a new transition\n * was started while the hook was still running\n */\n handleHookResult(result: HookResult): Promise {\n let notCurrent = this.getNotCurrentRejection();\n if (notCurrent) return notCurrent;\n\n // Hook returned a promise\n if (isPromise(result)) {\n // Wait for the promise, then reprocess with the resulting value\n return result.then(val => this.handleHookResult(val));\n }\n\n trace.traceHookResult(result, this.transition, this.options);\n\n // Hook returned false\n if (result === false) {\n // Abort this Transition\n return Rejection.aborted(\"Hook aborted transition\").toPromise();\n }\n\n const isTargetState = is(TargetState);\n // hook returned a TargetState\n if (isTargetState(result)) {\n // Halt the current Transition and redirect (a new Transition) to the TargetState.\n return Rejection.redirected(result).toPromise();\n }\n }\n\n\n /**\n * Return a Rejection promise if the transition is no longer current due\n * to a stopped router (disposed), or a new transition has started and superseded this one.\n */\n private getNotCurrentRejection() {\n let router = this.transition.router;\n\n // The router is stopped\n if (router._disposed) {\n return Rejection.aborted(`UIRouter instance #${router.$id} has been stopped (disposed)`).toPromise();\n }\n\n if (this.transition._aborted) {\n return Rejection.aborted().toPromise();\n }\n\n // This transition is no longer current.\n // Another transition started while this hook was still running.\n if (this.isSuperseded()) {\n // Abort this transition\n return Rejection.superseded(this.options.current()).toPromise();\n }\n }\n\n toString() {\n let { options, registeredHook } = this;\n let event = parse(\"traceData.hookType\")(options) || \"internal\",\n context = parse(\"traceData.context.state.name\")(options) || parse(\"traceData.context\")(options) || \"unknown\",\n name = fnToString(registeredHook.callback);\n return `${event} context: ${context}, ${maxLength(200, name)}`;\n }\n\n /**\n * Chains together an array of TransitionHooks.\n *\n * Given a list of [[TransitionHook]] objects, chains them together.\n * Each hook is invoked after the previous one completes.\n *\n * #### Example:\n * ```js\n * var hooks: TransitionHook[] = getHooks();\n * let promise: Promise = TransitionHook.chain(hooks);\n *\n * promise.then(handleSuccess, handleError);\n * ```\n *\n * @param hooks the list of hooks to chain together\n * @param waitFor if provided, the chain is `.then()`'ed off this promise\n * @returns a `Promise` for sequentially invoking the hooks (in order)\n */\n static chain(hooks: TransitionHook[], waitFor?: Promise): Promise {\n // Chain the next hook off the previous\n const createHookChainR = (prev: Promise, nextHook: TransitionHook) =>\n prev.then(() => nextHook.invokeHook());\n return hooks.reduce(createHookChainR, waitFor || services.$q.when());\n }\n\n\n /**\n * Invokes all the provided TransitionHooks, in order.\n * Each hook's return value is checked.\n * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned.\n * If no hook returns a promise, then all hooks are processed synchronously.\n *\n * @param hooks the list of TransitionHooks to invoke\n * @param doneCallback a callback that is invoked after all the hooks have successfully completed\n *\n * @returns a promise for the async result, or the result of the callback\n */\n static invokeHooks(hooks: TransitionHook[], doneCallback: (result?: HookResult) => T): Promise | T {\n for (let idx = 0; idx < hooks.length; idx++) {\n let hookResult = hooks[idx].invokeHook();\n\n if (isPromise(hookResult)) {\n let remainingHooks = hooks.slice(idx + 1);\n\n return TransitionHook.chain(remainingHooks, hookResult)\n .then(doneCallback);\n }\n }\n\n return doneCallback();\n }\n\n /**\n * Run all TransitionHooks, ignoring their return value.\n */\n static runAllHooks(hooks: TransitionHook[]): void {\n hooks.forEach(hook => hook.invokeHook());\n }\n\n}\n", - "/** @module path */ /** for typedoc */\nimport {extend, applyPairs, find, allTrueR, pairs, arrayTuples} from \"../common/common\";\nimport {propEq} from \"../common/hof\";\nimport {StateObject} from \"../state/stateObject\";\nimport {RawParams} from \"../params/interface\";\nimport {Param} from \"../params/param\";\nimport {Resolvable} from \"../resolve/resolvable\";\nimport {ViewConfig} from \"../view/interface\";\n\n/**\n * @internalapi\n *\n * A node in a [[TreeChanges]] path\n *\n * For a [[TreeChanges]] path, this class holds the stateful information for a single node in the path.\n * Each PathNode corresponds to a state being entered, exited, or retained.\n * The stateful information includes parameter values and resolve data.\n */\nexport class PathNode {\n /** The state being entered, exited, or retained */\n public state: StateObject;\n /** The parameters declared on the state */\n public paramSchema: Param[];\n /** The parameter values that belong to the state */\n public paramValues: { [key: string]: any };\n /** The individual (stateful) resolvable objects that belong to the state */\n public resolvables: Resolvable[];\n /** The state's declared view configuration objects */\n public views: ViewConfig[];\n\n /** Creates a copy of a PathNode */\n constructor(node: PathNode);\n /** Creates a new (empty) PathNode for a State */\n constructor(state: StateObject);\n constructor(stateOrNode: any) {\n if (stateOrNode instanceof PathNode) {\n let node: PathNode = stateOrNode;\n this.state = node.state;\n this.paramSchema = node.paramSchema.slice();\n this.paramValues = extend({}, node.paramValues);\n this.resolvables = node.resolvables.slice();\n this.views = node.views && node.views.slice();\n } else {\n let state: StateObject = stateOrNode;\n this.state = state;\n this.paramSchema = state.parameters({ inherit: false });\n this.paramValues = {};\n this.resolvables = state.resolvables.map(res => res.clone());\n }\n }\n\n /** Sets [[paramValues]] for the node, from the values of an object hash */\n applyRawParams(params: RawParams): PathNode {\n const getParamVal = (paramDef: Param) => [ paramDef.id, paramDef.value(params[paramDef.id]) ];\n this.paramValues = this.paramSchema.reduce((memo, pDef) => applyPairs(memo, getParamVal(pDef)), {});\n return this;\n }\n\n /** Gets a specific [[Param]] metadata that belongs to the node */\n parameter(name: string): Param {\n return find(this.paramSchema, propEq(\"id\", name));\n }\n\n /**\n * @returns true if the state and parameter values for another PathNode are\n * equal to the state and param values for this PathNode\n */\n equals(node: PathNode, paramsFn?: GetParamsFn): boolean {\n const diff = this.diff(node, paramsFn);\n return diff && diff.length === 0;\n }\n\n /**\n * Finds Params with different parameter values on another PathNode.\n *\n * Given another node (of the same state), finds the parameter values which differ.\n * Returns the [[Param]] (schema objects) whose parameter values differ.\n *\n * Given another node for a different state, returns `false`\n *\n * @param node The node to compare to\n * @param paramsFn A function that returns which parameters should be compared.\n * @returns The [[Param]]s which differ, or null if the two nodes are for different states\n */\n diff(node: PathNode, paramsFn?: GetParamsFn): Param[] | false {\n if (this.state !== node.state) return false;\n\n const params: Param[] = paramsFn ? paramsFn(this) : this.paramSchema;\n return Param.changed(params, this.paramValues, node.paramValues);\n }\n\n /** Returns a clone of the PathNode */\n static clone(node: PathNode) {\n return new PathNode(node);\n }\n}\n\n/** @hidden */\nexport type GetParamsFn = (pathNode: PathNode) => Param[];", - "/** @module path */ /** for typedoc */\n\nimport {\n extend, find, pick, omit, tail, mergeR, values, unnestR, Predicate, inArray, arrayTuples,\n} from \"../common/common\";\nimport {prop, propEq, not} from \"../common/hof\";\n\nimport {RawParams} from \"../params/interface\";\nimport {TreeChanges} from \"../transition/interface\";\nimport {ViewConfig} from \"../view/interface\";\nimport {_ViewDeclaration} from \"../state/interface\";\n\nimport {StateObject} from \"../state/stateObject\";\nimport {TargetState} from \"../state/targetState\";\nimport {GetParamsFn, PathNode} from \"./pathNode\";\nimport {ViewService} from \"../view/view\";\nimport { Param } from '../params/param';\nimport { StateRegistry } from '../state';\n\n/**\n * This class contains functions which convert TargetStates, Nodes and paths from one type to another.\n */\nexport class PathUtils {\n\n constructor() { }\n\n /** Given a PathNode[], create an TargetState */\n static makeTargetState(registry: StateRegistry, path: PathNode[]): TargetState {\n let state = tail(path).state;\n return new TargetState(registry, state, path.map(prop(\"paramValues\")).reduce(mergeR, {}), {});\n }\n\n static buildPath(targetState: TargetState) {\n let toParams = targetState.params();\n return targetState.$state().path.map(state => new PathNode(state).applyRawParams(toParams));\n }\n\n /** Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[] */\n static buildToPath(fromPath: PathNode[], targetState: TargetState): PathNode[] {\n let toPath: PathNode[] = PathUtils.buildPath(targetState);\n if (targetState.options().inherit) {\n return PathUtils.inheritParams(fromPath, toPath, Object.keys(targetState.params()));\n }\n return toPath;\n }\n\n /**\n * Creates ViewConfig objects and adds to nodes.\n *\n * On each [[PathNode]], creates ViewConfig objects from the views: property of the node's state\n */\n static applyViewConfigs($view: ViewService, path: PathNode[], states: StateObject[]) {\n // Only apply the viewConfigs to the nodes for the given states\n path.filter(node => inArray(states, node.state)).forEach(node => {\n let viewDecls: _ViewDeclaration[] = values(node.state.views || {});\n let subPath = PathUtils.subPath(path, n => n === node);\n let viewConfigs: ViewConfig[][] = viewDecls.map(view => $view.createViewConfig(subPath, view));\n node.views = viewConfigs.reduce(unnestR, []);\n });\n }\n\n /**\n * Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath\n *\n * For a parameter in a node to be inherited from the from path:\n * - The toPath's node must have a matching node in the fromPath (by state).\n * - The parameter name must not be found in the toKeys parameter array.\n *\n * Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some\n * caller, for instance, $state.transitionTo(..., toParams). If a key was found in toParams,\n * it is not inherited from the fromPath.\n */\n static inheritParams(fromPath: PathNode[], toPath: PathNode[], toKeys: string[] = []): PathNode[] {\n function nodeParamVals(path: PathNode[], state: StateObject): RawParams {\n let node: PathNode = find(path, propEq('state', state));\n return extend({}, node && node.paramValues);\n }\n\n let noInherit = fromPath.map(node => node.paramSchema)\n .reduce(unnestR, [])\n .filter(param => !param.inherit)\n .map(prop('id'));\n\n /**\n * Given an [[PathNode]] \"toNode\", return a new [[PathNode]] with param values inherited from the\n * matching node in fromPath. Only inherit keys that aren't found in \"toKeys\" from the node in \"fromPath\"\"\n */\n function makeInheritedParamsNode(toNode: PathNode): PathNode {\n // All param values for the node (may include default key/vals, when key was not found in toParams)\n let toParamVals = extend({}, toNode && toNode.paramValues);\n // limited to only those keys found in toParams\n let incomingParamVals = pick(toParamVals, toKeys);\n toParamVals = omit(toParamVals, toKeys);\n let fromParamVals = omit(nodeParamVals(fromPath, toNode.state) || {}, noInherit);\n // extend toParamVals with any fromParamVals, then override any of those those with incomingParamVals\n let ownParamVals: RawParams = extend(toParamVals, fromParamVals, incomingParamVals);\n return new PathNode(toNode.state).applyRawParams(ownParamVals);\n }\n\n // The param keys specified by the incoming toParams\n return toPath.map(makeInheritedParamsNode);\n }\n\n static nonDynamicParams = (node: PathNode): Param[] =>\n node.state.parameters({ inherit: false })\n .filter(param => !param.dynamic);\n\n /**\n * Computes the tree changes (entering, exiting) between a fromPath and toPath.\n */\n static treeChanges(fromPath: PathNode[], toPath: PathNode[], reloadState: StateObject): TreeChanges {\n let keep = 0, max = Math.min(fromPath.length, toPath.length);\n\n const nodesMatch = (node1: PathNode, node2: PathNode) =>\n node1.equals(node2, PathUtils.nonDynamicParams);\n\n while (keep < max && fromPath[keep].state !== reloadState && nodesMatch(fromPath[keep], toPath[keep])) {\n keep++;\n }\n\n /** Given a retained node, return a new node which uses the to node's param values */\n function applyToParams(retainedNode: PathNode, idx: number): PathNode {\n let cloned = PathNode.clone(retainedNode);\n cloned.paramValues = toPath[idx].paramValues;\n return cloned;\n }\n\n let from: PathNode[], retained: PathNode[], exiting: PathNode[], entering: PathNode[], to: PathNode[];\n\n from = fromPath;\n retained = from.slice(0, keep);\n exiting = from.slice(keep);\n\n // Create a new retained path (with shallow copies of nodes) which have the params of the toPath mapped\n let retainedWithToParams = retained.map(applyToParams);\n entering = toPath.slice(keep);\n to = (retainedWithToParams).concat(entering);\n\n return { from, to, retained, exiting, entering };\n }\n\n /**\n * Returns a new path which is: the subpath of the first path which matches the second path.\n *\n * The new path starts from root and contains any nodes that match the nodes in the second path.\n * It stops before the first non-matching node.\n *\n * Nodes are compared using their state property and their parameter values.\n * If a `paramsFn` is provided, only the [[Param]] returned by the function will be considered when comparing nodes.\n *\n * @param pathA the first path\n * @param pathB the second path\n * @param paramsFn a function which returns the parameters to consider when comparing\n *\n * @returns an array of PathNodes from the first path which match the nodes in the second path\n */\n static matching(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): PathNode[] {\n let done = false;\n let tuples: PathNode[][] = arrayTuples(pathA, pathB);\n return tuples.reduce((matching, [nodeA, nodeB]) => {\n done = done || !nodeA.equals(nodeB, paramsFn);\n return done ? matching : matching.concat(nodeA);\n }, []);\n }\n\n /**\n * Returns true if two paths are identical.\n *\n * @param pathA\n * @param pathB\n * @param paramsFn a function which returns the parameters to consider when comparing\n * @returns true if the the states and parameter values for both paths are identical\n */\n static equals(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): boolean {\n return pathA.length === pathB.length &&\n PathUtils.matching(pathA, pathB, paramsFn).length === pathA.length;\n }\n\n /**\n * Return a subpath of a path, which stops at the first matching node\n *\n * Given an array of nodes, returns a subset of the array starting from the first node,\n * stopping when the first node matches the predicate.\n *\n * @param path a path of [[PathNode]]s\n * @param predicate a [[Predicate]] fn that matches [[PathNode]]s\n * @returns a subpath up to the matching node, or undefined if no match is found\n */\n static subPath(path: PathNode[], predicate: Predicate): PathNode[] {\n let node = find(path, predicate);\n let elementIdx = path.indexOf(node);\n return elementIdx === -1 ? undefined : path.slice(0, elementIdx + 1);\n }\n\n /** Gets the raw parameter values from a path */\n static paramValues = (path: PathNode[]) =>\n path.reduce((acc, node) => extend(acc, node.paramValues), {});\n}\n", - "/**\n * @coreapi\n * @module resolve\n */ /** for typedoc */\nimport {extend, equals, inArray, identity} from \"../common/common\";\nimport {services} from \"../common/coreservices\";\nimport {trace} from \"../common/trace\";\nimport {ResolvePolicy, ResolvableLiteral, resolvePolicies} from \"./interface\";\n\nimport {ResolveContext} from \"./resolveContext\";\nimport {stringify} from \"../common/strings\";\nimport {isFunction, isObject} from \"../common/predicates\";\nimport {Transition} from \"../transition/transition\";\nimport {StateObject} from \"../state/stateObject\";\nimport {PathNode} from \"../path/pathNode\";\nimport { isNullOrUndefined } from '../common';\n\n\n// TODO: explicitly make this user configurable\nexport let defaultResolvePolicy: ResolvePolicy = {\n when: \"LAZY\",\n async: \"WAIT\"\n};\n\n/**\n * The basic building block for the resolve system.\n *\n * Resolvables encapsulate a state's resolve's resolveFn, the resolveFn's declared dependencies, the wrapped (.promise),\n * and the unwrapped-when-complete (.data) result of the resolveFn.\n *\n * Resolvable.get() either retrieves the Resolvable's existing promise, or else invokes resolve() (which invokes the\n * resolveFn) and returns the resulting promise.\n *\n * Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first\n * parameter to those fns.\n */\nexport class Resolvable implements ResolvableLiteral {\n token: any;\n policy: ResolvePolicy;\n resolveFn: Function;\n deps: any[];\n\n data: any;\n resolved: boolean = false;\n promise: Promise = undefined;\n\n /** This constructor creates a Resolvable copy */\n constructor(resolvable: Resolvable)\n\n /** This constructor creates a new Resolvable from the plain old [[ResolvableLiteral]] javascript object */\n constructor(resolvable: ResolvableLiteral)\n\n /**\n * This constructor creates a new `Resolvable`\n *\n * #### Example:\n * ```js\n * var resolvable1 = new Resolvable('mytoken', http => http.get('foo.json').toPromise(), [Http]);\n *\n * var resolvable2 = new Resolvable(UserService, dep => new UserService(dep.data), [SomeDependency]);\n *\n * var resolvable1Clone = new Resolvable(resolvable1);\n * ```\n *\n * @param token The new resolvable's injection token, such as `\"userList\"` (a string) or `UserService` (a class).\n * When this token is used during injection, the resolved value will be injected.\n * @param resolveFn The function that returns the resolved value, or a promise for the resolved value\n * @param deps An array of dependencies, which will be injected into the `resolveFn`\n * @param policy the [[ResolvePolicy]] defines when and how the Resolvable is processed\n * @param data Pre-resolved data. If the resolve value is already known, it may be provided here.\n */\n constructor(token: any, resolveFn: Function, deps?: any[], policy?: ResolvePolicy, data?: any)\n constructor(arg1: any, resolveFn?: Function, deps?: any[], policy?: ResolvePolicy, data?: any) {\n if (arg1 instanceof Resolvable) {\n extend(this, arg1);\n } else if (isFunction(resolveFn)) {\n if (isNullOrUndefined(arg1)) throw new Error(\"new Resolvable(): token argument is required\");\n if (!isFunction(resolveFn)) throw new Error(\"new Resolvable(): resolveFn argument must be a function\");\n\n this.token = arg1;\n this.policy = policy;\n this.resolveFn = resolveFn;\n this.deps = deps || [];\n\n this.data = data;\n this.resolved = data !== undefined;\n this.promise = this.resolved ? services.$q.when(this.data) : undefined;\n } else if (isObject(arg1) && arg1.token && isFunction(arg1.resolveFn)) {\n let literal = arg1;\n return new Resolvable(literal.token, literal.resolveFn, literal.deps, literal.policy, literal.data);\n }\n }\n\n getPolicy(state: StateObject): ResolvePolicy {\n let thisPolicy = this.policy || {};\n let statePolicy = state && state.resolvePolicy || {};\n return {\n when: thisPolicy.when || statePolicy.when || defaultResolvePolicy.when,\n async: thisPolicy.async || statePolicy.async || defaultResolvePolicy.async,\n };\n }\n\n /**\n * Asynchronously resolve this Resolvable's data\n *\n * Given a ResolveContext that this Resolvable is found in:\n * Wait for this Resolvable's dependencies, then invoke this Resolvable's function\n * and update the Resolvable's state\n */\n resolve(resolveContext: ResolveContext, trans?: Transition) {\n let $q = services.$q;\n\n // Gets all dependencies from ResolveContext and wait for them to be resolved\n const getResolvableDependencies = () =>\n $q.all(resolveContext.getDependencies(this).map(resolvable =>\n resolvable.get(resolveContext, trans))) as Promise;\n\n // Invokes the resolve function passing the resolved dependencies as arguments\n const invokeResolveFn = (resolvedDeps: any[]) =>\n this.resolveFn.apply(null, resolvedDeps);\n\n /**\n * For RXWAIT policy:\n *\n * Given an observable returned from a resolve function:\n * - enables .cache() mode (this allows multicast subscribers)\n * - then calls toPromise() (this triggers subscribe() and thus fetches)\n * - Waits for the promise, then return the cached observable (not the first emitted value).\n */\n const waitForRx = (observable$: any) => {\n let cached = observable$.cache(1);\n return cached.take(1).toPromise().then(() => cached);\n };\n\n // If the resolve policy is RXWAIT, wait for the observable to emit something. otherwise pass through.\n let node: PathNode = resolveContext.findNode(this);\n let state: StateObject = node && node.state;\n let maybeWaitForRx = this.getPolicy(state).async === \"RXWAIT\" ? waitForRx : identity;\n\n // After the final value has been resolved, update the state of the Resolvable\n const applyResolvedValue = (resolvedValue: any) => {\n this.data = resolvedValue;\n this.resolved = true;\n trace.traceResolvableResolved(this, trans);\n return this.data;\n };\n\n // Sets the promise property first, then getsResolvableDependencies in the context of the promise chain. Always waits one tick.\n return this.promise = $q.when()\n .then(getResolvableDependencies)\n .then(invokeResolveFn)\n .then(maybeWaitForRx)\n .then(applyResolvedValue);\n }\n\n /**\n * Gets a promise for this Resolvable's data.\n *\n * Fetches the data and returns a promise.\n * Returns the existing promise if it has already been fetched once.\n */\n get(resolveContext: ResolveContext, trans?: Transition): Promise {\n return this.promise || this.resolve(resolveContext, trans);\n }\n\n toString() {\n return `Resolvable(token: ${stringify(this.token)}, requires: [${this.deps.map(stringify)}])`;\n }\n\n clone(): Resolvable {\n return new Resolvable(this);\n }\n \n static fromData = (token: any, data: any) => \n new Resolvable(token, () => data, null, null, data);\n}\n", - "/**\n * # The Resolve subsystem\n *\n * This subsystem is an asynchronous, hierarchical Dependency Injection system.\n *\n * Typically, resolve is configured on a state using a [[StateDeclaration.resolve]] declaration.\n *\n * @coreapi\n * @module resolve\n */ /** for typedoc */\nimport {Resolvable} from \"./resolvable\";\n\n/**\n * An interface which is similar to an Angular 2 `Provider`\n */\nexport interface ProviderLike {\n provide: any,\n useClass?: any,\n useFactory?: Function,\n useValue?: any,\n useExisting?: any,\n deps?: any[]\n}\n\n/**\n * A plain object used to describe a [[Resolvable]]\n *\n * These objects may be used in the [[StateDeclaration.resolve]] array to declare\n * async data that the state or substates require.\n *\n * #### Example:\n * ```js\n *\n * var state = {\n * name: 'main',\n * resolve: [\n * { token: 'myData', deps: [MyDataApi], resolveFn: (myDataApi) => myDataApi.getData() },\n * ],\n * }\n * ```\n */\nexport interface ResolvableLiteral {\n /**\n * A Dependency Injection token\n *\n * This Resolvable's DI token.\n * The Resolvable will be injectable elsewhere using the token.\n */\n token: any;\n\n /**\n * A function which fetches the Resolvable's data\n *\n * A function which returns one of:\n *\n * - The resolved value (synchronously)\n * - A promise for the resolved value\n * - An Observable of the resolved value(s)\n *\n * This function will be provided the dependencies listed in [[deps]] as its arguments.\n * The resolve system will asynchronously fetch the dependencies before invoking this function.\n */\n resolveFn: Function;\n\n /**\n * Defines the Resolve Policy\n *\n * A policy that defines when to invoke the resolve,\n * and whether to wait for async and unwrap the data\n */\n policy?: ResolvePolicy;\n\n /**\n * The Dependency Injection tokens\n *\n * This is an array of Dependency Injection tokens for the dependencies of the [[resolveFn]].\n *\n * The DI tokens are references to other `Resolvables`, or to other\n * services from the native DI system.\n */\n deps?: any[];\n\n /** Pre-resolved data. */\n data?: any\n}\n\n/**\n * Defines how a resolve is processed during a transition\n *\n * This object is the [[StateDeclaration.resolvePolicy]] property.\n *\n * #### Example:\n * ```js\n * // Fetched when the resolve's state is being entered.\n * // Wait for the promise to resolve.\n * var policy1 = { when: \"LAZY\", async: \"WAIT\" }\n *\n * // Fetched when the Transition is starting.\n * // Do not wait for the returned promise to resolve.\n * // Inject the raw promise/value\n * var policy2 = { when: \"EAGER\", async: \"NOWAIT\" }\n * ```\n *\n * The policy for a given Resolvable is merged from three sources (highest priority first):\n *\n * - 1) Individual resolve definition\n * - 2) State definition\n * - 3) Global default\n *\n * #### Example:\n * ```js\n * // Wait for an Observable to emit one item.\n * // Since `wait` is not specified, it uses the `wait`\n * // policy defined on the state, or the global default\n * // if no `wait` policy is defined on the state\n * var myResolvablePolicy = { async: \"RXWAIT\" }\n * ```\n */\nexport interface ResolvePolicy {\n /**\n * Defines when a Resolvable is resolved (fetched) during a transition\n *\n * - `LAZY` (default)\n * - Resolved as the resolve's state is being entered\n * - `EAGER`\n * - Resolved as the transition is starting\n *\n * #### Example:\n * Resolves for `main` and `main.home` are fetched when each state is entered.\n * All of `main` resolves are processed before fetching `main.home` resolves.\n * ```js\n * var state = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { when: 'LAZY' }, // default\n * }\n *\n * var state = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { when: 'LAZY' }, // default\n * }\n * ```\n *\n * #### Example:\n * Resolves for `main` and `main.home` are fetched at the same time when the transition starts.\n * This happens earlier in the lifecycle than when states are entered.\n * All of the `main` and `main.home` resolves are fetched as soon as possible.\n * ```js\n * var mainState = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { when: 'EAGER' },\n * }\n *\n * var homeState = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { when: 'EAGER' },\n * }\n * ```\n */\n when?: PolicyWhen;\n\n /**\n * Determines the unwrapping behavior of asynchronous resolve values.\n *\n * - `WAIT` (default)\n * - If a promise is returned from the resolveFn, wait for the promise before proceeding\n * - The unwrapped value from the promise\n * - `NOWAIT`\n * - If a promise is returned from the resolve, do not wait for the promise.\n * - Any other value returned is wrapped in a promise.\n * - The promise will not be unwrapped.\n * - The promise itself will be provided when the resolve is injected or bound elsewhere.\n * - `RXWAIT`\n * - When an Observable is returned from the resolveFn, wait until the Observable emits at least one item.\n * - The Observable item will not be unwrapped.\n * - The Observable stream itself will be provided when the resolve is injected or bound elsewhere.\n *\n * #### Example:\n * The `Transition` will not wait for the resolve promise(s) from `main` to settle before continuing.\n * Resolves for `main` will be provided to components wrapped in a `Promise`.\n *\n * The `Transition` will wait for the `main.home` resolve promises.\n * Resolved values will be unwrapped before being provided to components.\n * ```js\n * var mainState = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { async: 'NOWAIT' },\n * }\n * var homeState = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { async: 'WAIT' }, // default\n * }\n * ```\n */\n async?: PolicyAsync;\n}\n\nexport type PolicyWhen = \"LAZY\" | \"EAGER\" ;\nexport type PolicyAsync = \"WAIT\" | \"NOWAIT\" | \"RXWAIT\" ;\n\n/** @internalapi */\nexport let resolvePolicies = {\n when: {\n LAZY: \"LAZY\",\n EAGER: \"EAGER\"\n },\n async: {\n WAIT: \"WAIT\",\n NOWAIT: \"NOWAIT\",\n RXWAIT: \"RXWAIT\"\n }\n};\n", - "/** @module resolve */\n/** for typedoc */\nimport { find, tail, uniqR, unnestR, inArray } from \"../common/common\";\nimport { propEq, not } from \"../common/hof\";\nimport { trace } from \"../common/trace\";\nimport { services, $InjectorLike } from \"../common/coreservices\";\nimport { resolvePolicies, PolicyWhen, ResolvePolicy } from \"./interface\";\nimport { PathNode } from \"../path/pathNode\";\nimport { Resolvable } from \"./resolvable\";\nimport { StateObject } from \"../state/stateObject\";\nimport { PathUtils } from \"../path/pathFactory\";\nimport { stringify } from \"../common/strings\";\nimport { Transition } from \"../transition/transition\";\nimport { UIInjector } from \"../interface\";\nimport { isUndefined } from '../common';\n\nconst whens = resolvePolicies.when;\nconst ALL_WHENS = [whens.EAGER, whens.LAZY];\nconst EAGER_WHENS = [whens.EAGER];\n\nexport const NATIVE_INJECTOR_TOKEN: string = \"Native Injector\";\n\n/**\n * Encapsulates Dependency Injection for a path of nodes\n *\n * UI-Router states are organized as a tree.\n * A nested state has a path of ancestors to the root of the tree.\n * When a state is being activated, each element in the path is wrapped as a [[PathNode]].\n * A `PathNode` is a stateful object that holds things like parameters and resolvables for the state being activated.\n *\n * The ResolveContext closes over the [[PathNode]]s, and provides DI for the last node in the path.\n */\nexport class ResolveContext {\n _injector: UIInjector;\n\n constructor(private _path: PathNode[]) { }\n\n /** Gets all the tokens found in the resolve context, de-duplicated */\n getTokens(): any[] {\n return this._path.reduce((acc, node) => acc.concat(node.resolvables.map(r => r.token)), []).reduce(uniqR, []);\n }\n\n /**\n * Gets the Resolvable that matches the token\n *\n * Gets the last Resolvable that matches the token in this context, or undefined.\n * Throws an error if it doesn't exist in the ResolveContext\n */\n getResolvable(token: any): Resolvable {\n let matching = this._path.map(node => node.resolvables)\n .reduce(unnestR, [])\n .filter((r: Resolvable) => r.token === token);\n return tail(matching);\n }\n\n /** Returns the [[ResolvePolicy]] for the given [[Resolvable]] */\n getPolicy(resolvable: Resolvable): ResolvePolicy {\n let node = this.findNode(resolvable);\n return resolvable.getPolicy(node.state);\n }\n\n /**\n * Returns a ResolveContext that includes a portion of this one\n *\n * Given a state, this method creates a new ResolveContext from this one.\n * The new context starts at the first node (root) and stops at the node for the `state` parameter.\n *\n * #### Why\n *\n * When a transition is created, the nodes in the \"To Path\" are injected from a ResolveContext.\n * A ResolveContext closes over a path of [[PathNode]]s and processes the resolvables.\n * The \"To State\" can inject values from its own resolvables, as well as those from all its ancestor state's (node's).\n * This method is used to create a narrower context when injecting ancestor nodes.\n *\n * @example\n * `let ABCD = new ResolveContext([A, B, C, D]);`\n *\n * Given a path `[A, B, C, D]`, where `A`, `B`, `C` and `D` are nodes for states `a`, `b`, `c`, `d`:\n * When injecting `D`, `D` should have access to all resolvables from `A`, `B`, `C`, `D`.\n * However, `B` should only be able to access resolvables from `A`, `B`.\n *\n * When resolving for the `B` node, first take the full \"To Path\" Context `[A,B,C,D]` and limit to the subpath `[A,B]`.\n * `let AB = ABCD.subcontext(a)`\n */\n subContext(state: StateObject): ResolveContext {\n return new ResolveContext(PathUtils.subPath(this._path, node => node.state === state));\n }\n\n /**\n * Adds Resolvables to the node that matches the state\n *\n * This adds a [[Resolvable]] (generally one created on the fly; not declared on a [[StateDeclaration.resolve]] block).\n * The resolvable is added to the node matching the `state` parameter.\n *\n * These new resolvables are not automatically fetched.\n * The calling code should either fetch them, fetch something that depends on them,\n * or rely on [[resolvePath]] being called when some state is being entered.\n *\n * Note: each resolvable's [[ResolvePolicy]] is merged with the state's policy, and the global default.\n *\n * @param newResolvables the new Resolvables\n * @param state Used to find the node to put the resolvable on\n */\n addResolvables(newResolvables: Resolvable[], state: StateObject) {\n let node = find(this._path, propEq('state', state));\n let keys = newResolvables.map(r => r.token);\n node.resolvables = node.resolvables.filter(r => keys.indexOf(r.token) === -1).concat(newResolvables);\n }\n\n /**\n * Returns a promise for an array of resolved path Element promises\n *\n * @param when\n * @param trans\n * @returns {Promise|any}\n */\n resolvePath(when: PolicyWhen = \"LAZY\", trans?: Transition): Promise<{ token: any, value: any }[]> {\n // This option determines which 'when' policy Resolvables we are about to fetch.\n let whenOption: string = inArray(ALL_WHENS, when) ? when : \"LAZY\";\n // If the caller specified EAGER, only the EAGER Resolvables are fetched.\n // if the caller specified LAZY, both EAGER and LAZY Resolvables are fetched.`\n let matchedWhens = whenOption === resolvePolicies.when.EAGER ? EAGER_WHENS : ALL_WHENS;\n\n // get the subpath to the state argument, if provided\n trace.traceResolvePath(this._path, when, trans);\n\n const matchesPolicy = (acceptedVals: string[], whenOrAsync: \"when\"|\"async\") =>\n (resolvable: Resolvable) =>\n inArray(acceptedVals, this.getPolicy(resolvable)[whenOrAsync]);\n\n // Trigger all the (matching) Resolvables in the path\n // Reduce all the \"WAIT\" Resolvables into an array\n let promises: Promise[] = this._path.reduce((acc, node) => {\n let nodeResolvables = node.resolvables.filter(matchesPolicy(matchedWhens, 'when'));\n let nowait = nodeResolvables.filter(matchesPolicy(['NOWAIT'], 'async'));\n let wait = nodeResolvables.filter(not(matchesPolicy(['NOWAIT'], 'async')));\n\n // For the matching Resolvables, start their async fetch process.\n let subContext = this.subContext(node.state);\n let getResult = (r: Resolvable) => r.get(subContext, trans)\n // Return a tuple that includes the Resolvable's token\n .then(value => ({ token: r.token, value: value }));\n nowait.forEach(getResult);\n return acc.concat(wait.map(getResult));\n }, []);\n\n // Wait for all the \"WAIT\" resolvables\n return services.$q.all(promises);\n }\n\n injector(): UIInjector {\n return this._injector || (this._injector = new UIInjectorImpl(this));\n }\n\n findNode(resolvable: Resolvable): PathNode {\n return find(this._path, (node: PathNode) => inArray(node.resolvables, resolvable));\n }\n\n /**\n * Gets the async dependencies of a Resolvable\n *\n * Given a Resolvable, returns its dependencies as a Resolvable[]\n */\n getDependencies(resolvable: Resolvable): Resolvable[] {\n let node = this.findNode(resolvable);\n // Find which other resolvables are \"visible\" to the `resolvable` argument\n // subpath stopping at resolvable's node, or the whole path (if the resolvable isn't in the path)\n let subPath: PathNode[] = PathUtils.subPath(this._path, x => x === node) || this._path;\n let availableResolvables: Resolvable[] = subPath\n .reduce((acc, _node) => acc.concat(_node.resolvables), []) //all of subpath's resolvables\n .filter(res => res !== resolvable); // filter out the `resolvable` argument\n\n const getDependency = (token: any) => {\n let matching = availableResolvables.filter(r => r.token === token);\n if (matching.length) return tail(matching);\n\n let fromInjector = this.injector().getNative(token);\n if (isUndefined(fromInjector)) {\n throw new Error(\"Could not find Dependency Injection token: \" + stringify(token));\n }\n\n return new Resolvable(token, () => fromInjector, [], fromInjector);\n };\n\n return resolvable.deps.map(getDependency);\n }\n}\n\nclass UIInjectorImpl implements UIInjector {\n native: $InjectorLike;\n\n constructor(public context: ResolveContext) {\n this.native = this.get(NATIVE_INJECTOR_TOKEN) || services.$injector;\n }\n\n get(token: any) {\n let resolvable = this.context.getResolvable(token);\n if (resolvable) {\n if (this.context.getPolicy(resolvable).async === 'NOWAIT') {\n return resolvable.get(this.context);\n }\n\n if (!resolvable.resolved) {\n throw new Error(\"Resolvable async .get() not complete:\" + stringify(resolvable.token))\n }\n return resolvable.data;\n }\n\n return this.getNative(token);\n }\n\n getAsync(token: any) {\n let resolvable = this.context.getResolvable(token);\n if (resolvable) return resolvable.get(this.context);\n return services.$q.when(this.native.get(token));\n }\n\n getNative(token: any) {\n return this.native && this.native.get(token);\n }\n}\n", - "/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport { trace } from '../common/trace';\nimport { services } from '../common/coreservices';\nimport { stringify } from '../common/strings';\nimport { map, find, extend, mergeR, tail, omit, arrayTuples, unnestR, identity, anyTrueR } from '../common/common';\nimport {isObject, isUndefined} from '../common/predicates';\nimport { prop, propEq, val, not, is } from '../common/hof';\nimport { StateDeclaration, StateOrName } from '../state/interface';\nimport {\n TransitionOptions, TreeChanges, IHookRegistry, TransitionHookPhase, RegisteredHooks, HookRegOptions,\n HookMatchCriteria, TransitionStateHookFn, TransitionHookFn,\n} from './interface'; // has or is using\nimport { TransitionHook } from './transitionHook';\nimport { matchState, makeEvent, RegisteredHook } from './hookRegistry';\nimport { HookBuilder } from './hookBuilder';\nimport { PathNode } from '../path/pathNode';\nimport { PathUtils } from '../path/pathFactory';\nimport { StateObject } from '../state/stateObject';\nimport { TargetState } from '../state/targetState';\nimport { Param } from '../params/param';\nimport { Resolvable } from '../resolve/resolvable';\nimport { ViewConfig } from '../view/interface';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { UIRouter } from '../router';\nimport { UIInjector } from '../interface';\nimport { RawParams } from '../params/interface';\nimport { ResolvableLiteral } from '../resolve/interface';\n\n/** @hidden */\nconst stateSelf: (_state: StateObject) => StateDeclaration = prop(\"self\");\n\n/**\n * Represents a transition between two states.\n *\n * When navigating to a state, we are transitioning **from** the current state **to** the new state.\n *\n * This object contains all contextual information about the to/from states, parameters, resolves.\n * It has information about all states being entered and exited as a result of the transition.\n */\nexport class Transition implements IHookRegistry {\n\n /** @hidden */\n static diToken = Transition;\n\n /**\n * A unique identifier for the transition.\n *\n * This is an auto incrementing integer, starting from `0`.\n */\n $id: number;\n\n /**\n * A reference to the [[UIRouter]] instance\n *\n * This reference can be used to access the router services, such as the [[StateService]]\n */\n router: UIRouter;\n\n /** @hidden */\n private _deferred = services.$q.defer();\n /**\n * This promise is resolved or rejected based on the outcome of the Transition.\n *\n * When the transition is successful, the promise is resolved\n * When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error\n */\n promise: Promise = this._deferred.promise;\n /**\n * A boolean which indicates if the transition was successful\n *\n * After a successful transition, this value is set to true.\n * After an unsuccessful transition, this value is set to false.\n *\n * The value will be undefined if the transition is not complete\n */\n success: boolean;\n /** @hidden */\n _aborted: boolean;\n /** @hidden */\n private _error: any;\n\n /** @hidden Holds the hook registration functions such as those passed to Transition.onStart() */\n _registeredHooks: RegisteredHooks = { };\n\n /** @hidden */\n private _options: TransitionOptions;\n /** @hidden */\n private _treeChanges: TreeChanges;\n /** @hidden */\n private _targetState: TargetState;\n /** @hidden */\n private _hookBuilder = new HookBuilder(this);\n\n\n /** @hidden */\n onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n\n /** @hidden\n * Creates the transition-level hook registration functions\n * (which can then be used to register hooks)\n */\n private createTransitionHookRegFns() {\n this.router.transitionService._pluginapi._getEvents()\n .filter(type => type.hookPhase !== TransitionHookPhase.CREATE)\n .forEach(type => makeEvent(this, this.router.transitionService, type));\n }\n\n /** @internalapi */\n getHooks(hookName: string): RegisteredHook[] {\n return this._registeredHooks[hookName];\n }\n\n /**\n * Creates a new Transition object.\n *\n * If the target state is not valid, an error is thrown.\n *\n * @internalapi\n *\n * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`\n * encapsulates the \"from state\".\n * @param targetState The target state and parameters being transitioned to (also, the transition options)\n * @param router The [[UIRouter]] instance\n */\n constructor(fromPath: PathNode[], targetState: TargetState, router: UIRouter) {\n this.router = router;\n this._targetState = targetState;\n\n if (!targetState.valid()) {\n throw new Error(targetState.error());\n }\n\n // current() is assumed to come from targetState.options, but provide a naive implementation otherwise.\n this._options = extend({ current: val(this) }, targetState.options());\n this.$id = router.transitionService._transitionCount++;\n let toPath = PathUtils.buildToPath(fromPath, targetState);\n this._treeChanges = PathUtils.treeChanges(fromPath, toPath, this._options.reloadState);\n this.createTransitionHookRegFns();\n\n let onCreateHooks = this._hookBuilder.buildHooksForPhase(TransitionHookPhase.CREATE);\n TransitionHook.invokeHooks(onCreateHooks, () => null);\n\n this.applyViewConfigs(router);\n }\n\n private applyViewConfigs(router: UIRouter) {\n let enteringStates = this._treeChanges.entering.map(node => node.state);\n PathUtils.applyViewConfigs(router.transitionService.$view, this._treeChanges.to, enteringStates);\n }\n\n /**\n * @internalapi\n *\n * @returns the internal from [State] object\n */\n $from() {\n return tail(this._treeChanges.from).state;\n }\n\n /**\n * @internalapi\n *\n * @returns the internal to [State] object\n */\n $to() {\n return tail(this._treeChanges.to).state;\n }\n\n /**\n * Returns the \"from state\"\n *\n * Returns the state that the transition is coming *from*.\n *\n * @returns The state declaration object for the Transition's (\"from state\").\n */\n from(): StateDeclaration {\n return this.$from().self;\n }\n\n /**\n * Returns the \"to state\"\n *\n * Returns the state that the transition is going *to*.\n *\n * @returns The state declaration object for the Transition's target state (\"to state\").\n */\n to(): StateDeclaration {\n return this.$to().self;\n }\n\n /**\n * Gets the Target State\n *\n * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object.\n *\n * @returns the [[TargetState]] of this Transition\n */\n targetState() {\n return this._targetState;\n }\n\n /**\n * Determines whether two transitions are equivalent.\n * @deprecated\n */\n is(compare: (Transition|{to?: any, from?: any})): boolean {\n if (compare instanceof Transition) {\n // TODO: Also compare parameters\n return this.is({ to: compare.$to().name, from: compare.$from().name });\n }\n return !(\n (compare.to && !matchState(this.$to(), compare.to)) ||\n (compare.from && !matchState(this.$from(), compare.from))\n );\n }\n\n /**\n * Gets transition parameter values\n *\n * Returns the parameter values for a transition as key/value pairs.\n * This object is immutable.\n *\n * By default, returns the new parameter values (for the \"to state\").\n *\n * #### Example:\n * ```js\n * var toParams = transition.params();\n * ```\n *\n * To return the previous parameter values, supply `'from'` as the `pathname` argument.\n *\n * #### Example:\n * ```js\n * var fromParams = transition.params('from');\n * ```\n *\n * @param pathname the name of the treeChanges path to get parameter values for:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n *\n * @returns transition parameter values for the desired path.\n */\n params(pathname?: string): any;\n params(pathname?: string): T;\n params(pathname: string = \"to\") {\n return Object.freeze(this._treeChanges[pathname].map(prop(\"paramValues\")).reduce(mergeR, {}));\n }\n\n\n /**\n * Creates a [[UIInjector]] Dependency Injector\n *\n * Returns a Dependency Injector for the Transition's target state (to state).\n * The injector provides resolve values which the target state has access to.\n *\n * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2).\n *\n * #### Example:\n * ```js\n * .onEnter({ entering: 'myState' }, trans => {\n * var myResolveValue = trans.injector().get('myResolve');\n * // Inject a global service from the global/native injector (if it exists)\n * var MyService = trans.injector().get('MyService');\n * })\n * ```\n *\n * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched.\n * You can use [[UIInjector.getAsync]] to get a promise for the data.\n * #### Example:\n * ```js\n * .onBefore({}, trans => {\n * return trans.injector().getAsync('myResolve').then(myResolveValue =>\n * return myResolveValue !== 'ABORT';\n * });\n * });\n * ```\n *\n * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to.\n * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`.\n * #### Example:\n * ```js\n * .onEnter({ to: 'foo.bar' }, trans => {\n * // returns result of `foo` state's `myResolve` resolve\n * // even though `foo.bar` also has a `myResolve` resolve\n * var fooData = trans.injector('foo').get('myResolve');\n * });\n * ```\n *\n * If you need resolve data from the exiting states, pass `'from'` as `pathName`.\n * The resolve data from the `from` path will be returned.\n * #### Example:\n * ```js\n * .onExit({ exiting: 'foo.bar' }, trans => {\n * // Gets the resolve value of `myResolve` from the state being exited\n * var fooData = trans.injector(null, 'from').get('myResolve');\n * });\n * ```\n *\n *\n * @param state Limits the resolves provided to only the resolves the provided state has access to.\n * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states.\n *\n * @returns a [[UIInjector]]\n */\n injector(state?: StateOrName, pathName = \"to\"): UIInjector {\n let path: PathNode[] = this._treeChanges[pathName];\n if (state) path = PathUtils.subPath(path, node => node.state === state || node.state.name === state);\n return new ResolveContext(path).injector();\n }\n\n /**\n * Gets all available resolve tokens (keys)\n *\n * This method can be used in conjunction with [[injector]] to inspect the resolve values\n * available to the Transition.\n *\n * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states\n * in the Transition's [[TreeChanges.to]] path.\n *\n * #### Example:\n * This example logs all resolve values\n * ```js\n * let tokens = trans.getResolveTokens();\n * tokens.forEach(token => console.log(token + \" = \" + trans.injector().get(token)));\n * ```\n *\n * #### Example:\n * This example creates promises for each resolve value.\n * This triggers fetches of resolves (if any have not yet been fetched).\n * When all promises have all settled, it logs the resolve values.\n * ```js\n * let tokens = trans.getResolveTokens();\n * let promise = tokens.map(token => trans.injector().getAsync(token));\n * Promise.all(promises).then(values => console.log(\"Resolved values: \" + values));\n * ```\n *\n * Note: Angular 1 users whould use `$q.all()`\n *\n * @param pathname resolve context's path name (e.g., `to` or `from`)\n *\n * @returns an array of resolve tokens (keys)\n */\n getResolveTokens(pathname: string = \"to\"): any[] {\n return new ResolveContext(this._treeChanges[pathname]).getTokens();\n }\n\n /**\n * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition.\n *\n * Allows a transition hook to dynamically add a Resolvable to this Transition.\n *\n * Use the [[Transition.injector]] to retrieve the resolved data in subsequent hooks ([[UIInjector.get]]).\n *\n * If a `state` argument is provided, the Resolvable is processed when that state is being entered.\n * If no `state` is provided then the root state is used.\n * If the given `state` has already been entered, the Resolvable is processed when any child state is entered.\n * If no child states will be entered, the Resolvable is processed during the `onFinish` phase of the Transition.\n *\n * The `state` argument also scopes the resolved data.\n * The resolved data is available from the injector for that `state` and any children states.\n *\n * #### Example:\n * ```js\n * transitionService.onBefore({}, transition => {\n * transition.addResolvable({\n * token: 'myResolve',\n * deps: ['MyService'],\n * resolveFn: myService => myService.getData()\n * });\n * });\n * ```\n *\n * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]])\n * @param state the state in the \"to path\" which should receive the new resolve (otherwise, the root state)\n */\n addResolvable(resolvable: Resolvable|ResolvableLiteral, state: StateOrName = \"\"): void {\n resolvable = is(Resolvable)(resolvable) ? resolvable : new Resolvable(resolvable);\n\n let stateName: string = (typeof state === \"string\") ? state : state.name;\n let topath = this._treeChanges.to;\n let targetNode = find(topath, node => node.state.name === stateName);\n let resolveContext: ResolveContext = new ResolveContext(topath);\n resolveContext.addResolvables([resolvable as Resolvable], targetNode.state);\n }\n\n /**\n * Gets the transition from which this transition was redirected.\n *\n * If the current transition is a redirect, this method returns the transition that was redirected.\n *\n * #### Example:\n * ```js\n * let transitionA = $state.go('A').transition\n * transitionA.onStart({}, () => $state.target('B'));\n * $transitions.onSuccess({ to: 'B' }, (trans) => {\n * trans.to().name === 'B'; // true\n * trans.redirectedFrom() === transitionA; // true\n * });\n * ```\n *\n * @returns The previous Transition, or null if this Transition is not the result of a redirection\n */\n redirectedFrom(): Transition {\n return this._options.redirectedFrom || null;\n }\n\n /**\n * Gets the original transition in a redirect chain\n *\n * A transition might belong to a long chain of multiple redirects.\n * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain.\n *\n * #### Example:\n * ```js\n * // states\n * registry.register({ name: 'A', redirectTo: 'B' });\n * registry.register({ name: 'B', redirectTo: 'C' });\n * registry.register({ name: 'C', redirectTo: 'D' });\n * registry.register({ name: 'D' });\n *\n * let transitionA = $state.go('A').transition\n *\n * $transitions.onSuccess({ to: 'D' }, (trans) => {\n * trans.to().name === 'D'; // true\n * trans.redirectedFrom().to().name === 'C'; // true\n * trans.originalTransition() === transitionA; // true\n * trans.originalTransition().to().name === 'A'; // true\n * });\n * ```\n *\n * @returns The original Transition that started a redirect chain\n */\n originalTransition(): Transition {\n let rf = this.redirectedFrom();\n return (rf && rf.originalTransition()) || this;\n }\n\n /**\n * Get the transition options\n *\n * @returns the options for this Transition.\n */\n options(): TransitionOptions {\n return this._options;\n }\n\n /**\n * Gets the states being entered.\n *\n * @returns an array of states that will be entered during this transition.\n */\n entering(): StateDeclaration[] {\n return map(this._treeChanges.entering, prop('state')).map(stateSelf);\n }\n\n /**\n * Gets the states being exited.\n *\n * @returns an array of states that will be exited during this transition.\n */\n exiting(): StateDeclaration[] {\n return map(this._treeChanges.exiting, prop('state')).map(stateSelf).reverse();\n }\n\n /**\n * Gets the states being retained.\n *\n * @returns an array of states that are already entered from a previous Transition, that will not be\n * exited during this Transition\n */\n retained(): StateDeclaration[] {\n return map(this._treeChanges.retained, prop('state')).map(stateSelf);\n }\n\n /**\n * Get the [[ViewConfig]]s associated with this Transition\n *\n * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects.\n * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., \"to\" or \"entering\").\n *\n * @param pathname the name of the path to fetch views for:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n * @param state If provided, only returns the `ViewConfig`s for a single state in the path\n *\n * @returns a list of ViewConfig objects for the given path.\n */\n views(pathname: string = \"entering\", state?: StateObject): ViewConfig[] {\n let path = this._treeChanges[pathname];\n path = !state ? path : path.filter(propEq('state', state));\n return path.map(prop(\"views\")).filter(identity).reduce(unnestR, []);\n }\n\n /**\n * Return the transition's tree changes\n *\n * A transition goes from one state/parameters to another state/parameters.\n * During a transition, states are entered and/or exited.\n *\n * This function returns various branches (paths) which represent the changes to the\n * active state tree that are caused by the transition.\n *\n * @param pathname The name of the tree changes path to get:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n */\n treeChanges(pathname: string): PathNode[];\n treeChanges(): TreeChanges;\n treeChanges(pathname?: string) {\n return pathname ? this._treeChanges[pathname] : this._treeChanges;\n }\n\n /**\n * Creates a new transition that is a redirection of the current one.\n *\n * This transition can be returned from a [[TransitionService]] hook to\n * redirect a transition to a new state and/or set of parameters.\n *\n * @internalapi\n *\n * @returns Returns a new [[Transition]] instance.\n */\n redirect(targetState: TargetState): Transition {\n let redirects = 1, trans: Transition = this;\n while ((trans = trans.redirectedFrom()) != null) {\n if (++redirects > 20) throw new Error(`Too many consecutive Transition redirects (20+)`);\n }\n\n let redirectOpts: TransitionOptions = { redirectedFrom: this, source: \"redirect\" };\n // If the original transition was caused by URL sync, then use { location: 'replace' }\n // on the new transition (unless the target state explicitly specifies location: false).\n // This causes the original url to be replaced with the url for the redirect target\n // so the original url disappears from the browser history.\n if (this.options().source === 'url' && targetState.options().location !== false) {\n redirectOpts.location = 'replace';\n }\n\n let newOptions = extend({}, this.options(), targetState.options(), redirectOpts);\n targetState = targetState.withOptions(newOptions, true);\n\n let newTransition = this.router.transitionService.create(this._treeChanges.from, targetState);\n let originalEnteringNodes = this._treeChanges.entering;\n let redirectEnteringNodes = newTransition._treeChanges.entering;\n\n // --- Re-use resolve data from original transition ---\n // When redirecting from a parent state to a child state where the parent parameter values haven't changed\n // (because of the redirect), the resolves fetched by the original transition are still valid in the\n // redirected transition.\n //\n // This allows you to define a redirect on a parent state which depends on an async resolve value.\n // You can wait for the resolve, then redirect to a child state based on the result.\n // The redirected transition does not have to re-fetch the resolve.\n // ---------------------------------------------------------\n\n const nodeIsReloading = (reloadState: StateObject) => (node: PathNode) => {\n return reloadState && node.state.includes[reloadState.name];\n };\n\n // Find any \"entering\" nodes in the redirect path that match the original path and aren't being reloaded\n let matchingEnteringNodes: PathNode[] = PathUtils.matching(redirectEnteringNodes, originalEnteringNodes, PathUtils.nonDynamicParams)\n .filter(not(nodeIsReloading(targetState.options().reloadState)));\n\n // Use the existing (possibly pre-resolved) resolvables for the matching entering nodes.\n matchingEnteringNodes.forEach((node, idx) => {\n node.resolvables = originalEnteringNodes[idx].resolvables;\n });\n\n return newTransition;\n }\n\n /** @hidden If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */\n private _changedParams(): Param[] {\n let tc = this._treeChanges;\n\n /** Return undefined if it's not a \"dynamic\" transition, for the following reasons */\n // If user explicitly wants a reload\n if (this._options.reload) return undefined;\n // If any states are exiting or entering\n if (tc.exiting.length || tc.entering.length) return undefined;\n // If to/from path lengths differ\n if (tc.to.length !== tc.from.length) return undefined;\n // If the to/from paths are different\n let pathsDiffer: boolean = arrayTuples(tc.to, tc.from)\n .map(tuple => tuple[0].state !== tuple[1].state)\n .reduce(anyTrueR, false);\n if (pathsDiffer) return undefined;\n\n // Find any parameter values that differ\n let nodeSchemas: Param[][] = tc.to.map((node: PathNode) => node.paramSchema);\n let [toValues, fromValues] = [tc.to, tc.from].map(path => path.map(x => x.paramValues));\n let tuples = arrayTuples(nodeSchemas, toValues, fromValues);\n\n return tuples.map(([schema, toVals, fromVals]) => Param.changed(schema, toVals, fromVals)).reduce(unnestR, []);\n }\n\n /**\n * Returns true if the transition is dynamic.\n *\n * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed.\n *\n * @returns true if the Transition is dynamic\n */\n dynamic(): boolean {\n let changes = this._changedParams();\n return !changes ? false : changes.map(x => x.dynamic).reduce(anyTrueR, false);\n }\n\n /**\n * Returns true if the transition is ignored.\n *\n * A transition is ignored if no states are entered nor exited, and no parameter values have changed.\n *\n * @returns true if the Transition is ignored.\n */\n ignored(): boolean {\n return !!this._ignoredReason();\n }\n\n /** @hidden */\n _ignoredReason(): \"SameAsCurrent\"|\"SameAsPending\"|undefined {\n const pending = this.router.globals.transition;\n const reloadState = this._options.reloadState;\n\n const same = (pathA, pathB) => {\n if (pathA.length !== pathB.length) return false;\n const matching = PathUtils.matching(pathA, pathB);\n return pathA.length === matching.filter(node => !reloadState || !node.state.includes[reloadState.name]).length;\n };\n\n let newTC = this.treeChanges();\n let pendTC = pending && pending.treeChanges();\n\n if (pendTC && same(pendTC.to, newTC.to) && same(pendTC.exiting, newTC.exiting)) return \"SameAsPending\";\n if (newTC.exiting.length === 0 && newTC.entering.length === 0 && same(newTC.from, newTC.to)) return \"SameAsCurrent\";\n }\n\n /**\n * Runs the transition\n *\n * This method is generally called from the [[StateService.transitionTo]]\n *\n * @internalapi\n *\n * @returns a promise for a successful transition.\n */\n run(): Promise {\n let runAllHooks = TransitionHook.runAllHooks;\n\n // Gets transition hooks array for the given phase\n const getHooksFor = (phase: TransitionHookPhase) =>\n this._hookBuilder.buildHooksForPhase(phase);\n\n // When the chain is complete, then resolve or reject the deferred\n const transitionSuccess = () => {\n trace.traceSuccess(this.$to(), this);\n this.success = true;\n this._deferred.resolve(this.to());\n runAllHooks(getHooksFor(TransitionHookPhase.SUCCESS));\n };\n\n const transitionError = (reason: any) => {\n trace.traceError(reason, this);\n this.success = false;\n this._deferred.reject(reason);\n this._error = reason;\n runAllHooks(getHooksFor(TransitionHookPhase.ERROR));\n };\n\n const runTransition = () => {\n // Wait to build the RUN hook chain until the BEFORE hooks are done\n // This allows a BEFORE hook to dynamically add additional RUN hooks via the Transition object.\n let allRunHooks = getHooksFor(TransitionHookPhase.RUN);\n let done = () => services.$q.when(undefined);\n return TransitionHook.invokeHooks(allRunHooks, done);\n };\n\n const startTransition = () => {\n let globals = this.router.globals;\n\n globals.lastStartedTransitionId = this.$id;\n globals.transition = this;\n globals.transitionHistory.enqueue(this);\n\n trace.traceTransitionStart(this);\n\n return services.$q.when(undefined);\n };\n\n let allBeforeHooks = getHooksFor(TransitionHookPhase.BEFORE);\n TransitionHook.invokeHooks(allBeforeHooks, startTransition)\n .then(runTransition)\n .then(transitionSuccess, transitionError);\n\n return this.promise;\n }\n\n /** Checks if this transition is currently active/running. */\n isActive = () =>\n this.router.globals.transition === this;\n\n /**\n * Checks if the Transition is valid\n *\n * @returns true if the Transition is valid\n */\n valid() {\n return !this.error() || this.success !== undefined;\n }\n\n /**\n * Aborts this transition\n *\n * Imperative API to abort a Transition.\n * This only applies to Transitions that are not yet complete.\n */\n abort() {\n // Do not set flag if the transition is already complete\n if (isUndefined(this.success)) {\n this._aborted = true;\n }\n }\n\n /**\n * The Transition error reason.\n *\n * If the transition is invalid (and could not be run), returns the reason the transition is invalid.\n * If the transition was valid and ran, but was not successful, returns the reason the transition failed.\n *\n * @returns an error message explaining why the transition is invalid, or the reason the transition failed.\n */\n error() {\n let state: StateObject = this.$to();\n\n if (state.self.abstract)\n return `Cannot transition to abstract state '${state.name}'`;\n\n const paramDefs = state.parameters(), values = this.params();\n const invalidParams = paramDefs.filter(param => !param.validates(values[param.id]));\n if (invalidParams.length) {\n return `Param values not valid for state '${state.name}'. Invalid params: [ ${invalidParams.map(param => param.id).join(', ')} ]`;\n }\n\n if (this.success === false)\n return this._error;\n }\n\n /**\n * A string representation of the Transition\n *\n * @returns A string representation of the Transition\n */\n toString () {\n let fromStateOrName = this.from();\n let toStateOrName = this.to();\n\n const avoidEmptyHash = (params: RawParams) =>\n (params[\"#\"] !== null && params[\"#\"] !== undefined) ? params : omit(params, [\"#\"]);\n\n // (X) means the to state is invalid.\n let id = this.$id,\n from = isObject(fromStateOrName) ? fromStateOrName.name : fromStateOrName,\n fromParams = stringify(avoidEmptyHash(this._treeChanges.from.map(prop('paramValues')).reduce(mergeR, {}))),\n toValid = this.valid() ? \"\" : \"(X) \",\n to = isObject(toStateOrName) ? toStateOrName.name : toStateOrName,\n toParams = stringify(avoidEmptyHash(this.params()));\n\n return `Transition#${id}( '${from}'${fromParams} -> ${toValid}'${to}'${toParams} )`;\n }\n}\n", - "/**\n * @coreapi\n * @module params\n */\n/** */\nimport { fromJson, toJson, identity, equals, inherit, map, extend, pick } from \"../common/common\";\nimport { isDefined, isNullOrUndefined } from \"../common/predicates\";\nimport { is } from \"../common/hof\";\nimport { services } from \"../common/coreservices\";\nimport { ParamType } from \"./paramType\";\nimport { ParamTypeDefinition } from \"./interface\";\n\n/**\n * A registry for parameter types.\n *\n * This registry manages the built-in (and custom) parameter types.\n *\n * The built-in parameter types are:\n *\n * - [[string]]\n * - [[path]]\n * - [[query]]\n * - [[hash]]\n * - [[int]]\n * - [[bool]]\n * - [[date]]\n * - [[json]]\n * - [[any]]\n */\nexport class ParamTypes {\n /** @hidden */\n types: any;\n /** @hidden */\n enqueue: boolean = true;\n /** @hidden */\n typeQueue: any[] = [];\n\n /**\n * Built-in parameter type: `string`\n *\n * This parameter type coerces values to strings.\n * It matches anything (`new RegExp(\".*\")`) in the URL\n */\n static string: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `path`\n *\n * This parameter type is the default type for path parameters.\n * A path parameter is any parameter declared in the path portion of a url\n *\n * - `/foo/:param1/:param2`: two path parameters\n *\n * This parameter type behaves exactly like the [[string]] type with one exception.\n * When matching parameter values in the URL, the `path` type does not match forward slashes `/`.\n *\n * #### Angular 1 note:\n * In ng1, this type is overridden with one that pre-encodes slashes as `~2F` instead of `%2F`.\n * For more details about this angular 1 behavior, see: https://github.com/angular-ui/ui-router/issues/2598\n */\n static path: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `query`\n *\n * This parameter type is the default type for query/search parameters.\n * It behaves the same as the [[string]] parameter type.\n *\n * A query parameter is any parameter declared in the query/search portion of a url\n *\n * - `/bar?param2`: a query parameter\n */\n static query: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `hash`\n *\n * This parameter type is used for the `#` parameter (the hash)\n * It behaves the same as the [[string]] parameter type.\n * @coreapi\n */\n static hash: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `int`\n *\n * This parameter type serializes javascript integers (`number`s which represent an integer) to the URL.\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'user',\n * url: '/user/{id:int}'\n * });\n * ```\n * ```js\n * $state.go('user', { id: 1298547 });\n * ```\n *\n * The URL will serialize to: `/user/1298547`.\n *\n * When the parameter value is read, it will be the `number` `1298547`, not the string `\"1298547\"`.\n */\n static int: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `bool`\n *\n * This parameter type serializes `true`/`false` as `1`/`0`\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'inbox',\n * url: '/inbox?{unread:bool}'\n * });\n * ```\n * ```js\n * $state.go('inbox', { unread: true });\n * ```\n *\n * The URL will serialize to: `/inbox?unread=1`.\n *\n * Conversely, if the url is `/inbox?unread=0`, the value of the `unread` parameter will be a `false`.\n */\n static bool: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `date`\n *\n * This parameter type can be used to serialize Javascript dates as parameter values.\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'search',\n * url: '/search?{start:date}'\n * });\n * ```\n * ```js\n * $state.go('search', { start: new Date(2000, 0, 1) });\n * ```\n *\n * The URL will serialize to: `/search?start=2000-01-01`.\n *\n * Conversely, if the url is `/search?start=2016-12-25`, the value of the `start` parameter will be a `Date` object where:\n *\n * - `date.getFullYear() === 2016`\n * - `date.getMonth() === 11` (month is 0-based)\n * - `date.getDate() === 25`\n */\n static date: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `json`\n *\n * This parameter type can be used to serialize javascript objects into the URL using JSON serialization.\n *\n * #### Example:\n * This example serializes an plain javascript object to the URL\n * ```js\n * .state({\n * name: 'map',\n * url: '/map/{coords:json}'\n * });\n * ```\n * ```js\n * $state.go('map', { coords: { x: 10399.2, y: 49071 });\n * ```\n *\n * The URL will serialize to: `/map/%7B%22x%22%3A10399.2%2C%22y%22%3A49071%7D`\n */\n static json: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `any`\n *\n * This parameter type is used by default for url-less parameters (parameters that do not appear in the URL).\n * This type does not encode or decode.\n * It is compared using a deep `equals` comparison.\n *\n * #### Example:\n * This example defines a non-url parameter on a [[StateDeclaration]].\n * ```js\n * .state({\n * name: 'new',\n * url: '/new',\n * params: {\n * inrepyto: null\n * }\n * });\n * ```\n * ```js\n * $state.go('new', { inreplyto: currentMessage });\n * ```\n */\n static any: ParamTypeDefinition;\n\n\n /** @internalapi */\n private defaultTypes: any = pick(ParamTypes.prototype, [\"hash\", \"string\", \"query\", \"path\", \"int\", \"bool\", \"date\", \"json\", \"any\"]);\n\n /** @internalapi */\n constructor() {\n // Register default types. Store them in the prototype of this.types.\n const makeType = (definition: ParamTypeDefinition, name: string) =>\n new ParamType(extend({ name }, definition));\n this.types = inherit(map(this.defaultTypes, makeType), {});\n }\n\n /** @internalapi */\n dispose() {\n this.types = {};\n }\n\n /**\n * Registers a parameter type\n *\n * End users should call [[UrlMatcherFactory.type]], which delegates to this method.\n */\n type(name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {\n if (!isDefined(definition)) return this.types[name];\n if (this.types.hasOwnProperty(name)) throw new Error(`A type named '${name}' has already been defined.`);\n\n this.types[name] = new ParamType(extend({ name }, definition));\n\n if (definitionFn) {\n this.typeQueue.push({ name, def: definitionFn });\n if (!this.enqueue) this._flushTypeQueue();\n }\n\n return this;\n }\n\n /** @internalapi */\n _flushTypeQueue() {\n while (this.typeQueue.length) {\n let type = this.typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n extend(this.types[type.name], services.$injector.invoke(type.def));\n }\n }\n}\n\n/** @hidden */\nfunction initDefaultTypes() {\n\n const makeDefaultType = (def) => {\n const valToString = (val: any) =>\n val != null ? val.toString() : val;\n\n const defaultTypeBase = {\n encode: valToString,\n decode: valToString,\n is: is(String),\n pattern: /.*/,\n equals: (a: any, b: any) => a == b, // allow coersion for null/undefined/\"\"\n };\n\n return extend({}, defaultTypeBase, def) as ParamTypeDefinition;\n };\n\n // Default Parameter Type Definitions\n extend(ParamTypes.prototype, {\n string: makeDefaultType({}),\n\n path: makeDefaultType({\n pattern: /[^/]*/,\n }),\n\n query: makeDefaultType({}),\n\n hash: makeDefaultType({\n inherit: false,\n }),\n\n int: makeDefaultType({\n decode: (val: string) => parseInt(val, 10),\n is: function(val: any) {\n return !isNullOrUndefined(val) && this.decode(val.toString()) === val;\n },\n pattern: /-?\\d+/,\n }),\n\n bool: makeDefaultType({\n encode: (val: any) => val && 1 || 0,\n decode: (val: string) => parseInt(val, 10) !== 0,\n is: is(Boolean),\n pattern: /0|1/,\n }),\n\n date: makeDefaultType({\n encode: function(val: any) {\n return !this.is(val) ? undefined : [\n val.getFullYear(),\n ('0' + (val.getMonth() + 1)).slice(-2),\n ('0' + val.getDate()).slice(-2),\n ].join(\"-\");\n },\n decode: function(val: string) {\n if (this.is(val)) return val as Date;\n let match = this.capture.exec(val);\n return match ? new Date(match[1], match[2] - 1, match[3]) : undefined;\n },\n is: (val: any) => val instanceof Date && !isNaN(val.valueOf()),\n equals(l: any, r: any) {\n return ['getFullYear', 'getMonth', 'getDate']\n .reduce((acc, fn) => acc && l[fn]() === r[fn](), true);\n },\n pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,\n capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/,\n }),\n\n json: makeDefaultType({\n encode: toJson,\n decode: fromJson,\n is: is(Object),\n equals: equals,\n pattern: /[^/]*/,\n }),\n\n // does not encode/decode\n any: makeDefaultType({\n encode: identity,\n decode: identity,\n is: () => true,\n equals: equals,\n }),\n });\n}\n\ninitDefaultTypes();\n\n", - "/**\n * @coreapi\n * @module params\n */\n/** */\nimport {extend, ancestors, Obj} from \"../common/common\";\nimport {StateObject} from \"../state/stateObject\";\n\n/** @internalapi */\nexport class StateParams {\n [key: string]: any;\n\n constructor(params: Obj = {}) {\n extend(this, params);\n }\n\n /**\n * Merges a set of parameters with all parameters inherited between the common parents of the\n * current state and a given destination state.\n *\n * @param {Object} newParams The set of parameters which will be composited with inherited params.\n * @param {Object} $current Internal definition of object representing the current state.\n * @param {Object} $to Internal definition of object representing state to transition to.\n */\n $inherit(newParams: Obj, $current: StateObject, $to: StateObject) {\n let parents = ancestors($current, $to),\n parentParams: string[],\n inherited: Obj = {},\n inheritList: string[] = [];\n\n for (let i in parents) {\n if (!parents[i] || !parents[i].params) continue;\n parentParams = Object.keys(parents[i].params);\n if (!parentParams.length) continue;\n\n for (let j in parentParams) {\n if (inheritList.indexOf(parentParams[j]) >= 0) continue;\n inheritList.push(parentParams[j]);\n inherited[parentParams[j]] = this[parentParams[j]];\n }\n }\n return extend({}, inherited, newParams);\n };\n}\n\n", - "/** @module state */ /** for typedoc */\nimport {isString} from \"../common/predicates\";\nimport {StateOrName} from \"./interface\";\nimport {StateObject} from \"./stateObject\";\nimport {values} from \"../common/common\";\n\nexport class StateMatcher {\n constructor (private _states: { [key: string]: StateObject }) { }\n \n isRelative(stateName: string) {\n stateName = stateName || \"\";\n return stateName.indexOf(\".\") === 0 || stateName.indexOf(\"^\") === 0;\n }\n\n\n find(stateOrName: StateOrName, base?: StateOrName, matchGlob = true): StateObject {\n if (!stateOrName && stateOrName !== \"\") return undefined;\n let isStr = isString(stateOrName);\n let name: string = isStr ? stateOrName : (stateOrName).name;\n\n if (this.isRelative(name)) name = this.resolvePath(name, base);\n let state = this._states[name];\n\n if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {\n return state;\n } else if (isStr && matchGlob) {\n let _states = values(this._states);\n let matches = _states.filter(state =>\n state.__stateObjectCache.nameGlob &&\n state.__stateObjectCache.nameGlob.matches(name)\n );\n\n if (matches.length > 1) {\n console.log(`stateMatcher.find: Found multiple matches for ${name} using glob: `, matches.map(match => match.name));\n }\n return matches[0];\n }\n return undefined;\n }\n\n resolvePath(name: string, base: StateOrName) {\n if (!base) throw new Error(`No reference point given for path '${name}'`);\n \n let baseState: StateObject = this.find(base);\n\n let splitName = name.split(\".\"), i = 0, pathLength = splitName.length, current = baseState;\n\n for (; i < pathLength; i++) {\n if (splitName[i] === \"\" && i === 0) {\n current = baseState;\n continue;\n }\n if (splitName[i] === \"^\") {\n if (!current.parent) throw new Error(`Path '${name}' not valid for state '${baseState.name}'`);\n current = current.parent;\n continue;\n }\n break;\n }\n let relName = splitName.slice(i).join(\".\");\n return current.name + (current.name && relName ? \".\" : \"\") + relName;\n }\n}\n", - "/** @module state */ /** for typedoc */\nimport { inArray } from \"../common/common\";\nimport { isString } from \"../common/predicates\";\nimport { StateDeclaration, _StateDeclaration } from \"./interface\";\nimport { StateObject } from \"./stateObject\";\nimport { StateBuilder } from \"./stateBuilder\";\nimport { StateRegistryListener, StateRegistry } from \"./stateRegistry\";\nimport { Disposable } from \"../interface\";\nimport { UrlRouter } from \"../url/urlRouter\";\nimport { prop } from \"../common/hof\";\nimport { StateMatcher } from \"./stateMatcher\";\n\n/** @internalapi */\nexport class StateQueueManager implements Disposable {\n queue: StateObject[];\n matcher: StateMatcher;\n\n constructor(\n private $registry: StateRegistry,\n private $urlRouter: UrlRouter,\n public states: { [key: string]: StateObject; },\n public builder: StateBuilder,\n public listeners: StateRegistryListener[]) {\n this.queue = [];\n this.matcher = $registry.matcher;\n }\n\n /** @internalapi */\n dispose() {\n this.queue = [];\n }\n\n register(stateDecl: _StateDeclaration) {\n let queue = this.queue;\n let state = StateObject.create(stateDecl);\n let name = state.name;\n\n if (!isString(name)) throw new Error(\"State must have a valid name\");\n if (this.states.hasOwnProperty(name) || inArray(queue.map(prop('name')), name))\n throw new Error(`State '${name}' is already defined`);\n\n queue.push(state);\n this.flush();\n\n return state;\n }\n\n flush() {\n let {queue, states, builder} = this;\n let registered: StateObject[] = [], // states that got registered\n orphans: StateObject[] = [], // states that don't yet have a parent registered\n previousQueueLength = {}; // keep track of how long the queue when an orphan was first encountered\n const getState = (name) =>\n this.states.hasOwnProperty(name) && this.states[name];\n\n while (queue.length > 0) {\n let state: StateObject = queue.shift();\n let name = state.name;\n let result: StateObject = builder.build(state);\n let orphanIdx: number = orphans.indexOf(state);\n\n if (result) {\n let existingState = getState(name);\n if (existingState && existingState.name === name) {\n throw new Error(`State '${name}' is already defined`);\n }\n\n let existingFutureState = getState(name + \".**\");\n if (existingFutureState) {\n // Remove future state of the same name\n this.$registry.deregister(existingFutureState);\n }\n\n states[name] = state;\n this.attachRoute(state);\n if (orphanIdx >= 0) orphans.splice(orphanIdx, 1);\n registered.push(state);\n continue;\n }\n\n let prev = previousQueueLength[name];\n previousQueueLength[name] = queue.length;\n if (orphanIdx >= 0 && prev === queue.length) {\n // Wait until two consecutive iterations where no additional states were dequeued successfully.\n // throw new Error(`Cannot register orphaned state '${name}'`);\n queue.push(state);\n return states;\n } else if (orphanIdx < 0) {\n orphans.push(state);\n }\n\n queue.push(state);\n }\n\n if (registered.length) {\n this.listeners.forEach(listener => listener(\"registered\", registered.map(s => s.self)));\n }\n\n return states;\n }\n\n attachRoute(state: StateObject) {\n if (state.abstract || !state.url) return;\n\n this.$urlRouter.rule(this.$urlRouter.urlRuleFactory.create(state));\n }\n}\n", - "/**\n * @coreapi\n * @module state\n */ /** for typedoc */\n\nimport { StateObject } from \"./stateObject\";\nimport { StateMatcher } from \"./stateMatcher\";\nimport { StateBuilder } from \"./stateBuilder\";\nimport { StateQueueManager } from \"./stateQueueManager\";\nimport { StateDeclaration, _StateDeclaration } from \"./interface\";\nimport { BuilderFunction } from \"./stateBuilder\";\nimport { StateOrName } from \"./interface\";\nimport { removeFrom } from \"../common/common\";\nimport { UIRouter } from \"../router\";\nimport { propEq } from \"../common/hof\";\n\n/**\n * The signature for the callback function provided to [[StateRegistry.onStatesChanged]].\n *\n * This callback receives two parameters:\n *\n * @param event a string; either \"registered\" or \"deregistered\"\n * @param states the list of [[StateDeclaration]]s that were registered (or deregistered).\n */\nexport type StateRegistryListener = (event: \"registered\"|\"deregistered\", states: StateDeclaration[]) => void;\n\nexport class StateRegistry {\n private _root: StateObject;\n private states: { [key: string]: StateObject } = {};\n\n matcher: StateMatcher;\n private builder: StateBuilder;\n stateQueue: StateQueueManager;\n\n listeners: StateRegistryListener[] = [];\n\n /** @internalapi */\n constructor(private _router: UIRouter) {\n this.matcher = new StateMatcher(this.states);\n this.builder = new StateBuilder(this.matcher, _router.urlMatcherFactory);\n this.stateQueue = new StateQueueManager(this, _router.urlRouter, this.states, this.builder, this.listeners);\n this._registerRoot();\n }\n\n /** @internalapi */\n private _registerRoot() {\n let rootStateDef: StateDeclaration = {\n name: '',\n url: '^',\n views: null,\n params: {\n '#': { value: null, type: 'hash', dynamic: true }\n },\n abstract: true\n };\n\n let _root = this._root = this.stateQueue.register(rootStateDef);\n _root.navigable = null;\n }\n\n /** @internalapi */\n dispose() {\n this.stateQueue.dispose();\n this.listeners = [];\n this.get().forEach(state => this.get(state) && this.deregister(state));\n }\n\n /**\n * Listen for a State Registry events\n *\n * Adds a callback that is invoked when states are registered or deregistered with the StateRegistry.\n *\n * #### Example:\n * ```js\n * let allStates = registry.get();\n *\n * // Later, invoke deregisterFn() to remove the listener\n * let deregisterFn = registry.onStatesChanged((event, states) => {\n * switch(event) {\n * case: 'registered':\n * states.forEach(state => allStates.push(state));\n * break;\n * case: 'deregistered':\n * states.forEach(state => {\n * let idx = allStates.indexOf(state);\n * if (idx !== -1) allStates.splice(idx, 1);\n * });\n * break;\n * }\n * });\n * ```\n *\n * @param listener a callback function invoked when the registered states changes.\n * The function receives two parameters, `event` and `state`.\n * See [[StateRegistryListener]]\n * @return a function that deregisters the listener\n */\n onStatesChanged(listener: StateRegistryListener): () => void {\n this.listeners.push(listener);\n return function deregisterListener() {\n removeFrom(this.listeners)(listener);\n }.bind(this);\n }\n\n /**\n * Gets the implicit root state\n *\n * Gets the root of the state tree.\n * The root state is implicitly created by UI-Router.\n * Note: this returns the internal [[StateObject]] representation, not a [[StateDeclaration]]\n *\n * @return the root [[StateObject]]\n */\n root() {\n return this._root;\n }\n\n /**\n * Adds a state to the registry\n *\n * Registers a [[StateDeclaration]] or queues it for registration.\n *\n * Note: a state will be queued if the state's parent isn't yet registered.\n *\n * @param stateDefinition the definition of the state to register.\n * @returns the internal [[StateObject]] object.\n * If the state was successfully registered, then the object is fully built (See: [[StateBuilder]]).\n * If the state was only queued, then the object is not fully built.\n */\n register(stateDefinition: _StateDeclaration): StateObject {\n return this.stateQueue.register(stateDefinition);\n }\n\n /** @hidden */\n private _deregisterTree(state: StateObject) {\n let all = this.get().map(s => s.$$state());\n const getChildren = (states: StateObject[]) => {\n let children = all.filter(s => states.indexOf(s.parent) !== -1);\n return children.length === 0 ? children : children.concat(getChildren(children));\n };\n\n let children = getChildren([state]);\n let deregistered: StateObject[] = [state].concat(children).reverse();\n\n deregistered.forEach(state => {\n let $ur = this._router.urlRouter;\n // Remove URL rule\n $ur.rules().filter(propEq(\"state\", state)).forEach($ur.removeRule.bind($ur));\n // Remove state from registry\n delete this.states[state.name];\n });\n\n return deregistered;\n }\n\n /**\n * Removes a state from the registry\n *\n * This removes a state from the registry.\n * If the state has children, they are are also removed from the registry.\n *\n * @param stateOrName the state's name or object representation\n * @returns {StateObject[]} a list of removed states\n */\n deregister(stateOrName: StateOrName) {\n let _state = this.get(stateOrName);\n if (!_state) throw new Error(\"Can't deregister state; not found: \" + stateOrName);\n let deregisteredStates = this._deregisterTree(_state.$$state());\n\n this.listeners.forEach(listener => listener(\"deregistered\", deregisteredStates.map(s => s.self)));\n return deregisteredStates;\n }\n\n /**\n * Gets all registered states\n *\n * Calling this method with no arguments will return a list of all the states that are currently registered.\n * Note: this does not return states that are *queued* but not yet registered.\n *\n * @return a list of [[StateDeclaration]]s\n */\n get(): StateDeclaration[];\n\n /**\n * Gets a registered state\n *\n * Given a state or a name, finds and returns the [[StateDeclaration]] from the registry.\n * Note: this does not return states that are *queued* but not yet registered.\n *\n * @param stateOrName either the name of a state, or a state object.\n * @param base the base state to use when stateOrName is relative.\n * @return a registered [[StateDeclaration]] that matched the `stateOrName`, or null if the state isn't registered.\n */\n get(stateOrName: StateOrName, base?: StateOrName): StateDeclaration;\n get(stateOrName?: StateOrName, base?: StateOrName): any {\n if (arguments.length === 0)\n return Object.keys(this.states).map(name => this.states[name].self);\n let found = this.matcher.find(stateOrName, base);\n return found && found.self || null;\n }\n\n decorator(name: string, func: BuilderFunction) {\n return this.builder.builder(name, func);\n }\n}\n", - "/**\n * @internalapi\n * @module url\n */ /** for typedoc */\nimport { forEach, extend } from \"../common/common\";\nimport { isObject, isDefined, isFunction, isString } from \"../common/predicates\";\nimport { UrlMatcher } from \"./urlMatcher\";\nimport { Param, DefType } from \"../params/param\";\nimport { ParamTypes } from \"../params/paramTypes\";\nimport { ParamTypeDefinition } from \"../params/interface\";\nimport { Disposable } from \"../interface\";\nimport { ParamType } from \"../params/paramType\";\nimport { ParamFactory, UrlMatcherConfig } from \"./interface\";\n\n/**\n * Factory for [[UrlMatcher]] instances.\n *\n * The factory is available to ng1 services as\n * `$urlMatcherFactory` or ng1 providers as `$urlMatcherFactoryProvider`.\n */\nexport class UrlMatcherFactory implements Disposable, UrlMatcherConfig {\n /** @hidden */ paramTypes = new ParamTypes();\n /** @hidden */ _isCaseInsensitive: boolean = false;\n /** @hidden */ _isStrictMode: boolean = true;\n /** @hidden */ _defaultSquashPolicy: (boolean|string) = false;\n\n constructor() {\n extend(this, { UrlMatcher, Param });\n }\n\n /** @inheritdoc */\n caseInsensitive(value?: boolean): boolean {\n return this._isCaseInsensitive = isDefined(value) ? value : this._isCaseInsensitive;\n }\n\n /** @inheritdoc */\n strictMode(value?: boolean): boolean {\n return this._isStrictMode = isDefined(value) ? value : this._isStrictMode;\n }\n\n /** @inheritdoc */\n defaultSquashPolicy(value?: (boolean|string)) {\n if (isDefined(value) && value !== true && value !== false && !isString(value))\n throw new Error(`Invalid squash policy: ${value}. Valid policies: false, true, arbitrary-string`);\n return this._defaultSquashPolicy = isDefined(value) ? value : this._defaultSquashPolicy;\n }\n\n /** @hidden */\n private _getConfig = (config) =>\n extend({ strict: this._isStrictMode, caseInsensitive: this._isCaseInsensitive }, config);\n\n /**\n * Creates a [[UrlMatcher]] for the specified pattern.\n *\n * @param pattern The URL pattern.\n * @param config The config object hash.\n * @returns The UrlMatcher.\n */\n compile(pattern: string, config?: { [key: string]: any }) {\n return new UrlMatcher(pattern, this.paramTypes, this.paramFactory, this._getConfig(config));\n }\n\n /**\n * Returns true if the specified object is a [[UrlMatcher]], or false otherwise.\n *\n * @param object The object to perform the type check against.\n * @returns `true` if the object matches the `UrlMatcher` interface, by\n * implementing all the same methods.\n */\n isMatcher(object: any): boolean {\n // TODO: typeof?\n if (!isObject(object)) return false;\n let result = true;\n\n forEach(UrlMatcher.prototype, (val, name) => {\n if (isFunction(val)) result = result && (isDefined(object[name]) && isFunction(object[name]));\n });\n return result;\n };\n\n /**\n * Creates and registers a custom [[ParamType]] object\n *\n * A [[ParamType]] can be used to generate URLs with typed parameters.\n *\n * @param name The type name.\n * @param definition The type definition. See [[ParamTypeDefinition]] for information on the values accepted.\n * @param definitionFn A function that is injected before the app runtime starts.\n * The result of this function should be a [[ParamTypeDefinition]].\n * The result is merged into the existing `definition`.\n * See [[ParamType]] for information on the values accepted.\n *\n * @returns - if a type was registered: the [[UrlMatcherFactory]]\n * - if only the `name` parameter was specified: the currently registered [[ParamType]] object, or undefined\n *\n * Note: Register custom types *before using them* in a state definition.\n *\n * See [[ParamTypeDefinition]] for examples\n */\n type(name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {\n let type = this.paramTypes.type(name, definition, definitionFn);\n return !isDefined(definition) ? type : this;\n };\n\n /** @hidden */\n $get() {\n this.paramTypes.enqueue = false;\n this.paramTypes._flushTypeQueue();\n return this;\n };\n\n /** @internalapi Creates a new [[Param]] for a given location (DefType) */\n paramFactory: ParamFactory = {\n /** Creates a new [[Param]] from a CONFIG block */\n fromConfig: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.CONFIG, this),\n\n /** Creates a new [[Param]] from a url PATH */\n fromPath: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.PATH, this),\n\n /** Creates a new [[Param]] from a url SEARCH */\n fromSearch: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.SEARCH, this),\n };\n\n /** @internalapi */\n dispose() {\n this.paramTypes.dispose();\n }\n}\n", - "/**\n * @coreapi\n * @module url\n */ /** */\nimport { UrlMatcher } from \"./urlMatcher\";\nimport { isString, isDefined, isFunction, isState } from \"../common/predicates\";\nimport { UIRouter } from \"../router\";\nimport { identity, extend } from \"../common/common\";\nimport { is, pattern } from \"../common/hof\";\nimport { StateObject } from \"../state/stateObject\";\nimport { RawParams } from \"../params/interface\";\nimport {\n UrlRule, UrlRuleMatchFn, UrlRuleHandlerFn, UrlRuleType, UrlParts, MatcherUrlRule, StateRule, RegExpRule\n} from \"./interface\";\n\n/**\n * Creates a [[UrlRule]]\n *\n * Creates a [[UrlRule]] from a:\n *\n * - `string`\n * - [[UrlMatcher]]\n * - `RegExp`\n * - [[StateObject]]\n * @internalapi\n */\nexport class UrlRuleFactory {\n constructor(public router: UIRouter) { }\n\n compile(str: string) {\n return this.router.urlMatcherFactory.compile(str);\n }\n\n static isUrlRule = obj =>\n obj && ['type', 'match', 'handler'].every(key => isDefined(obj[key]));\n\n create(what: string|UrlMatcher|StateObject|RegExp|UrlRuleMatchFn, handler?: string|UrlRuleHandlerFn): UrlRule {\n const makeRule = pattern([\n [isString, (_what: string) => makeRule(this.compile(_what))],\n [is(UrlMatcher), (_what: UrlMatcher) => this.fromUrlMatcher(_what, handler)],\n [isState, (_what: StateObject) => this.fromState(_what, this.router)],\n [is(RegExp), (_what: RegExp) => this.fromRegExp(_what, handler)],\n [isFunction, (_what: UrlRuleMatchFn) => new BaseUrlRule(_what, handler as UrlRuleHandlerFn)],\n ]);\n\n let rule = makeRule(what);\n if (!rule) throw new Error(\"invalid 'what' in when()\");\n return rule;\n }\n\n /**\n * A UrlRule which matches based on a UrlMatcher\n *\n * The `handler` may be either a `string`, a [[UrlRuleHandlerFn]] or another [[UrlMatcher]]\n *\n * ## Handler as a function\n *\n * If `handler` is a function, the function is invoked with:\n *\n * - matched parameter values ([[RawParams]] from [[UrlMatcher.exec]])\n * - url: the current Url ([[UrlParts]])\n * - router: the router object ([[UIRouter]])\n *\n * #### Example:\n * ```js\n * var urlMatcher = $umf.compile(\"/foo/:fooId/:barId\");\n * var rule = factory.fromUrlMatcher(urlMatcher, match => \"/home/\" + match.fooId + \"/\" + match.barId);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match); // '/home/123/456'\n * ```\n *\n * ## Handler as UrlMatcher\n *\n * If `handler` is a UrlMatcher, the handler matcher is used to create the new url.\n * The `handler` UrlMatcher is formatted using the matched param from the first matcher.\n * The url is replaced with the result.\n *\n * #### Example:\n * ```js\n * var urlMatcher = $umf.compile(\"/foo/:fooId/:barId\");\n * var handler = $umf.compile(\"/home/:fooId/:barId\");\n * var rule = factory.fromUrlMatcher(urlMatcher, handler);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match); // '/home/123/456'\n * ```\n */\n fromUrlMatcher(urlMatcher: UrlMatcher, handler: string|UrlMatcher|UrlRuleHandlerFn): MatcherUrlRule {\n let _handler: UrlRuleHandlerFn = handler as any;\n if (isString(handler)) handler = this.router.urlMatcherFactory.compile(handler);\n if (is(UrlMatcher)(handler)) _handler = (match: RawParams) => (handler as UrlMatcher).format(match);\n\n function match(url: UrlParts) {\n let match = urlMatcher.exec(url.path, url.search, url.hash);\n return urlMatcher.validates(match) && match;\n }\n\n // Prioritize URLs, lowest to highest:\n // - Some optional URL parameters, but none matched\n // - No optional parameters in URL\n // - Some optional parameters, some matched\n // - Some optional parameters, all matched\n function matchPriority(params: RawParams): number {\n let optional = urlMatcher.parameters().filter(param => param.isOptional);\n if (!optional.length) return 0.000001;\n let matched = optional.filter(param => params[param.id]);\n return matched.length / optional.length;\n }\n\n let details = { urlMatcher, matchPriority, type: \"URLMATCHER\" };\n return extend(new BaseUrlRule(match, _handler), details) as MatcherUrlRule;\n }\n\n\n /**\n * A UrlRule which matches a state by its url\n *\n * #### Example:\n * ```js\n * var rule = factory.fromState($state.get('foo'), router);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match);\n * // Starts a transition to 'foo' with params: { fooId: '123', barId: '456' }\n * ```\n */\n fromState(state: StateObject, router: UIRouter): StateRule {\n /**\n * Handles match by transitioning to matched state\n *\n * First checks if the router should start a new transition.\n * A new transition is not required if the current state's URL\n * and the new URL are already identical\n */\n const handler = (match: RawParams) => {\n let $state = router.stateService;\n let globals = router.globals;\n if ($state.href(state, match) !== $state.href(globals.current, globals.params)) {\n $state.transitionTo(state, match, { inherit: true, source: \"url\" });\n }\n };\n\n let details = { state, type: \"STATE\" };\n return extend(this.fromUrlMatcher(state.url, handler), details) as StateRule;\n }\n\n /**\n * A UrlRule which matches based on a regular expression\n *\n * The `handler` may be either a [[UrlRuleHandlerFn]] or a string.\n *\n * ## Handler as a function\n *\n * If `handler` is a function, the function is invoked with:\n *\n * - regexp match array (from `regexp`)\n * - url: the current Url ([[UrlParts]])\n * - router: the router object ([[UIRouter]])\n *\n * #### Example:\n * ```js\n * var rule = factory.fromRegExp(/^\\/foo\\/(bar|baz)$/, match => \"/home/\" + match[1])\n * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ]\n * var result = rule.handler(match); // '/home/bar'\n * ```\n *\n * ## Handler as string\n *\n * If `handler` is a string, the url is *replaced by the string* when the Rule is invoked.\n * The string is first interpolated using `string.replace()` style pattern.\n *\n * #### Example:\n * ```js\n * var rule = factory.fromRegExp(/^\\/foo\\/(bar|baz)$/, \"/home/$1\")\n * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ]\n * var result = rule.handler(match); // '/home/bar'\n * ```\n */\n fromRegExp(regexp: RegExp, handler: string|UrlRuleHandlerFn): RegExpRule {\n if (regexp.global || regexp.sticky) throw new Error(\"Rule RegExp must not be global or sticky\");\n\n /**\n * If handler is a string, the url will be replaced by the string.\n * If the string has any String.replace() style variables in it (like `$2`),\n * they will be replaced by the captures from [[match]]\n */\n const redirectUrlTo = (match: RegExpExecArray) =>\n // Interpolates matched values into $1 $2, etc using a String.replace()-style pattern\n (handler as string).replace(/\\$(\\$|\\d{1,2})/, (m, what) =>\n match[what === '$' ? 0 : Number(what)]);\n\n const _handler = isString(handler) ? redirectUrlTo : handler;\n\n const match = (url: UrlParts): RegExpExecArray =>\n regexp.exec(url.path);\n\n let details = { regexp, type: \"REGEXP\" };\n return extend(new BaseUrlRule(match, _handler), details) as RegExpRule\n }\n}\n\n/**\n * A base rule which calls `match`\n *\n * The value from the `match` function is passed through to the `handler`.\n * @internalapi\n */\nexport class BaseUrlRule implements UrlRule {\n $id: number;\n priority: number;\n type: UrlRuleType = \"RAW\";\n handler: UrlRuleHandlerFn;\n matchPriority = (match) => 0 - this.$id;\n\n constructor(public match: UrlRuleMatchFn, handler?: UrlRuleHandlerFn) {\n this.handler = handler || identity;\n }\n}", - "/**\n * @coreapi\n * @module view\n */ /** for typedoc */\nimport { equals, applyPairs, removeFrom, TypedMap, inArray } from \"../common/common\";\nimport { curry, prop } from \"../common/hof\";\nimport { isString, isArray } from \"../common/predicates\";\nimport { trace } from \"../common/trace\";\nimport { PathNode } from \"../path/pathNode\";\nimport { ActiveUIView, ViewContext, ViewConfig } from \"./interface\";\nimport { _ViewDeclaration } from \"../state/interface\";\n\nexport type ViewConfigFactory = (path: PathNode[], decl: _ViewDeclaration) => ViewConfig|ViewConfig[];\n\nexport interface ViewServicePluginAPI {\n _rootViewContext(context?: ViewContext): ViewContext;\n _viewConfigFactory(viewType: string, factory: ViewConfigFactory);\n _registeredUIViews(): ActiveUIView[];\n _activeViewConfigs(): ViewConfig[];\n _onSync(listener: ViewSyncListener): Function;\n}\n\n// A uiView and its matching viewConfig\nexport interface ViewTuple {\n uiView: ActiveUIView;\n viewConfig: ViewConfig;\n}\n\nexport interface ViewSyncListener {\n (viewTuples: ViewTuple[]): void;\n}\n\n/**\n * The View service\n *\n * This service pairs existing `ui-view` components (which live in the DOM)\n * with view configs (from the state declaration objects: [[StateDeclaration.views]]).\n *\n * - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]].\n * The views from exited states are deactivated via [[deactivateViewConfig]].\n * (See: the [[registerActivateViews]] Transition Hook)\n *\n * - As `ui-view` components pop in and out of existence, they register themselves using [[registerUIView]].\n *\n * - When the [[sync]] function is called, the registered `ui-view`(s) ([[ActiveUIView]])\n * are configured with the matching [[ViewConfig]](s)\n *\n */\nexport class ViewService {\n private _uiViews: ActiveUIView[] = [];\n private _viewConfigs: ViewConfig[] = [];\n private _rootContext: ViewContext;\n private _viewConfigFactories: { [key: string]: ViewConfigFactory } = {};\n private _listeners: ViewSyncListener[] = [];\n\n constructor() { }\n\n public _pluginapi: ViewServicePluginAPI = {\n _rootViewContext: this._rootViewContext.bind(this),\n _viewConfigFactory: this._viewConfigFactory.bind(this),\n _registeredUIViews: () => this._uiViews,\n _activeViewConfigs: () => this._viewConfigs,\n _onSync: (listener: ViewSyncListener) => {\n this._listeners.push(listener);\n return () => removeFrom(this._listeners, listener);\n },\n };\n\n private _rootViewContext(context?: ViewContext): ViewContext {\n return this._rootContext = context || this._rootContext;\n };\n\n private _viewConfigFactory(viewType: string, factory: ViewConfigFactory) {\n this._viewConfigFactories[viewType] = factory;\n }\n\n createViewConfig(path: PathNode[], decl: _ViewDeclaration): ViewConfig[] {\n let cfgFactory = this._viewConfigFactories[decl.$type];\n if (!cfgFactory) throw new Error(\"ViewService: No view config factory registered for type \" + decl.$type);\n let cfgs = cfgFactory(path, decl);\n return isArray(cfgs) ? cfgs : [cfgs];\n }\n\n /**\n * Deactivates a ViewConfig.\n *\n * This function deactivates a `ViewConfig`.\n * After calling [[sync]], it will un-pair from any `ui-view` with which it is currently paired.\n *\n * @param viewConfig The ViewConfig view to deregister.\n */\n deactivateViewConfig(viewConfig: ViewConfig) {\n trace.traceViewServiceEvent(\"<- Removing\", viewConfig);\n removeFrom(this._viewConfigs, viewConfig);\n }\n\n activateViewConfig(viewConfig: ViewConfig) {\n trace.traceViewServiceEvent(\"-> Registering\", viewConfig);\n this._viewConfigs.push(viewConfig);\n }\n\n /**\n * Given a ui-view and a ViewConfig, determines if they \"match\".\n *\n * A ui-view has a fully qualified name (fqn) and a context object. The fqn is built from its overall location in\n * the DOM, describing its nesting relationship to any parent ui-view tags it is nested inside of.\n *\n * A ViewConfig has a target ui-view name and a context anchor. The ui-view name can be a simple name, or\n * can be a segmented ui-view path, describing a portion of a ui-view fqn.\n *\n * In order for a ui-view to match ViewConfig, ui-view's $type must match the ViewConfig's $type\n *\n * If the ViewConfig's target ui-view name is a simple name (no dots), then a ui-view matches if:\n * - the ui-view's name matches the ViewConfig's target name\n * - the ui-view's context matches the ViewConfig's anchor\n *\n * If the ViewConfig's target ui-view name is a segmented name (with dots), then a ui-view matches if:\n * - There exists a parent ui-view where:\n * - the parent ui-view's name matches the first segment (index 0) of the ViewConfig's target name\n * - the parent ui-view's context matches the ViewConfig's anchor\n * - And the remaining segments (index 1..n) of the ViewConfig's target name match the tail of the ui-view's fqn\n *\n * Example:\n *\n * DOM:\n * \n * \n * \n * \n * \n * \n * \n * \n *\n * uiViews: [\n * { fqn: \"$default\", creationContext: { name: \"\" } },\n * { fqn: \"$default.foo\", creationContext: { name: \"A\" } },\n * { fqn: \"$default.foo.$default\", creationContext: { name: \"A.B\" } }\n * { fqn: \"$default.foo.$default.bar\", creationContext: { name: \"A.B.C\" } }\n * ]\n *\n * These four view configs all match the ui-view with the fqn: \"$default.foo.$default.bar\":\n *\n * - ViewConfig1: { uiViewName: \"bar\", uiViewContextAnchor: \"A.B.C\" }\n * - ViewConfig2: { uiViewName: \"$default.bar\", uiViewContextAnchor: \"A.B\" }\n * - ViewConfig3: { uiViewName: \"foo.$default.bar\", uiViewContextAnchor: \"A\" }\n * - ViewConfig4: { uiViewName: \"$default.foo.$default.bar\", uiViewContextAnchor: \"\" }\n *\n * Using ViewConfig3 as an example, it matches the ui-view with fqn \"$default.foo.$default.bar\" because:\n * - The ViewConfig's segmented target name is: [ \"foo\", \"$default\", \"bar\" ]\n * - There exists a parent ui-view (which has fqn: \"$default.foo\") where:\n * - the parent ui-view's name \"foo\" matches the first segment \"foo\" of the ViewConfig's target name\n * - the parent ui-view's context \"A\" matches the ViewConfig's anchor context \"A\"\n * - And the remaining segments [ \"$default\", \"bar\" ].join(\".\"_ of the ViewConfig's target name match\n * the tail of the ui-view's fqn \"default.bar\"\n *\n * @internalapi\n */\n static matches = (uiViewsByFqn: TypedMap, uiView: ActiveUIView) => (viewConfig: ViewConfig) => {\n // Don't supply an ng1 ui-view with an ng2 ViewConfig, etc\n if (uiView.$type !== viewConfig.viewDecl.$type) return false;\n\n // Split names apart from both viewConfig and uiView into segments\n let vc = viewConfig.viewDecl;\n let vcSegments = vc.$uiViewName.split(\".\");\n let uivSegments = uiView.fqn.split(\".\");\n\n // Check if the tails of the segment arrays match. ex, these arrays' tails match:\n // vc: [\"foo\", \"bar\"], uiv fqn: [\"$default\", \"foo\", \"bar\"]\n if (!equals(vcSegments, uivSegments.slice(0 - vcSegments.length)))\n return false;\n\n // Now check if the fqn ending at the first segment of the viewConfig matches the context:\n // [\"$default\", \"foo\"].join(\".\") == \"$default.foo\", does the ui-view $default.foo context match?\n let negOffset = (1 - vcSegments.length) || undefined;\n let fqnToFirstSegment = uivSegments.slice(0, negOffset).join(\".\");\n let uiViewContext = uiViewsByFqn[fqnToFirstSegment].creationContext;\n return vc.$uiViewContextAnchor === (uiViewContext && uiViewContext.name);\n }\n\n sync() {\n let uiViewsByFqn: TypedMap =\n this._uiViews.map(uiv => [uiv.fqn, uiv]).reduce(applyPairs, {});\n\n // Return a weighted depth value for a uiView.\n // The depth is the nesting depth of ui-views (based on FQN; times 10,000)\n // plus the depth of the state that is populating the uiView\n function uiViewDepth(uiView: ActiveUIView) {\n const stateDepth = (context: ViewContext) =>\n context && context.parent ? stateDepth(context.parent) + 1 : 1;\n return (uiView.fqn.split(\".\").length * 10000) + stateDepth(uiView.creationContext);\n }\n\n // Return the ViewConfig's context's depth in the context tree.\n function viewConfigDepth(config: ViewConfig) {\n let context: ViewContext = config.viewDecl.$context, count = 0;\n while (++count && context.parent) context = context.parent;\n return count;\n }\n\n // Given a depth function, returns a compare function which can return either ascending or descending order\n const depthCompare = curry((depthFn, posNeg, left, right) => posNeg * (depthFn(left) - depthFn(right)));\n\n const matchingConfigPair = (uiView: ActiveUIView): ViewTuple => {\n let matchingConfigs = this._viewConfigs.filter(ViewService.matches(uiViewsByFqn, uiView));\n if (matchingConfigs.length > 1) {\n // This is OK. Child states can target a ui-view that the parent state also targets (the child wins)\n // Sort by depth and return the match from the deepest child\n // console.log(`Multiple matching view configs for ${uiView.fqn}`, matchingConfigs);\n matchingConfigs.sort(depthCompare(viewConfigDepth, -1)); // descending\n }\n return { uiView, viewConfig: matchingConfigs[0] };\n };\n\n const configureUIView = (tuple: ViewTuple) => {\n // If a parent ui-view is reconfigured, it could destroy child ui-views.\n // Before configuring a child ui-view, make sure it's still in the active uiViews array.\n if (this._uiViews.indexOf(tuple.uiView) !== -1)\n tuple.uiView.configUpdated(tuple.viewConfig);\n };\n\n // Sort views by FQN and state depth. Process uiviews nearest the root first.\n const uiViewTuples = this._uiViews.sort(depthCompare(uiViewDepth, 1)).map(matchingConfigPair);\n const matchedViewConfigs = uiViewTuples.map(tuple => tuple.viewConfig);\n const unmatchedConfigTuples = this._viewConfigs\n .filter(config => inArray(matchedViewConfigs, config))\n .map(viewConfig => ({ uiView: undefined, viewConfig }));\n\n const allTuples: ViewTuple[] = uiViewTuples.concat(unmatchedConfigTuples);\n\n uiViewTuples.forEach(configureUIView);\n\n this._listeners.forEach(cb => cb(allTuples));\n trace.traceViewSync(allTuples);\n };\n\n /**\n * Registers a `ui-view` component\n *\n * When a `ui-view` component is created, it uses this method to register itself.\n * After registration the [[sync]] method is used to ensure all `ui-view` are configured with the proper [[ViewConfig]].\n *\n * Note: the `ui-view` component uses the `ViewConfig` to determine what view should be loaded inside the `ui-view`,\n * and what the view's state context is.\n *\n * Note: There is no corresponding `deregisterUIView`.\n * A `ui-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself.\n *\n * @param uiView The metadata for a UIView\n * @return a de-registration function used when the view is destroyed.\n */\n registerUIView(uiView: ActiveUIView) {\n trace.traceViewServiceUIViewEvent(\"-> Registering\", uiView);\n let uiViews = this._uiViews;\n const fqnAndTypeMatches = (uiv: ActiveUIView) => uiv.fqn === uiView.fqn && uiv.$type === uiView.$type;\n if (uiViews.filter(fqnAndTypeMatches).length)\n trace.traceViewServiceUIViewEvent(\"!!!! duplicate uiView named:\", uiView);\n\n uiViews.push(uiView);\n this.sync();\n\n return () => {\n let idx = uiViews.indexOf(uiView);\n if (idx === -1) {\n trace.traceViewServiceUIViewEvent(\"Tried removing non-registered uiView\", uiView);\n return;\n }\n trace.traceViewServiceUIViewEvent(\"<- Deregistering\", uiView);\n removeFrom(uiViews)(uiView);\n };\n };\n\n /**\n * Returns the list of views currently available on the page, by fully-qualified name.\n *\n * @return {Array} Returns an array of fully-qualified view names.\n */\n available() {\n return this._uiViews.map(prop(\"fqn\"));\n }\n\n /**\n * Returns the list of views on the page containing loaded content.\n *\n * @return {Array} Returns an array of fully-qualified view names.\n */\n active() {\n return this._uiViews.filter(prop(\"$config\")).map(prop(\"name\"));\n }\n\n /**\n * Normalizes a view's name from a state.views configuration block.\n *\n * This should be used by a framework implementation to calculate the values for\n * [[_ViewDeclaration.$uiViewName]] and [[_ViewDeclaration.$uiViewContextAnchor]].\n *\n * @param context the context object (state declaration) that the view belongs to\n * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]]\n *\n * @returns the normalized uiViewName and uiViewContextAnchor that the view targets\n */\n static normalizeUIViewTarget(context: ViewContext, rawViewName = \"\") {\n // TODO: Validate incoming view name with a regexp to allow:\n // ex: \"view.name@foo.bar\" , \"^.^.view.name\" , \"view.name@^.^\" , \"\" ,\n // \"@\" , \"$default@^\" , \"!$default.$default\" , \"!foo.bar\"\n let viewAtContext: string[] = rawViewName.split(\"@\");\n let uiViewName = viewAtContext[0] || \"$default\"; // default to unnamed view\n let uiViewContextAnchor = isString(viewAtContext[1]) ? viewAtContext[1] : \"^\"; // default to parent context\n\n // Handle relative view-name sugar syntax.\n // Matches rawViewName \"^.^.^.foo.bar\" into array: [\"^.^.^.foo.bar\", \"^.^.^\", \"foo.bar\"],\n let relativeViewNameSugar = /^(\\^(?:\\.\\^)*)\\.(.*$)/.exec(uiViewName);\n if (relativeViewNameSugar) {\n // Clobbers existing contextAnchor (rawViewName validation will fix this)\n uiViewContextAnchor = relativeViewNameSugar[1]; // set anchor to \"^.^.^\"\n uiViewName = relativeViewNameSugar[2]; // set view-name to \"foo.bar\"\n }\n\n if (uiViewName.charAt(0) === '!') {\n uiViewName = uiViewName.substr(1);\n uiViewContextAnchor = \"\"; // target absolutely from root\n }\n\n // handle parent relative targeting \"^.^.^\"\n let relativeMatch = /^(\\^(?:\\.\\^)*)$/;\n if (relativeMatch.exec(uiViewContextAnchor)) {\n let anchor = uiViewContextAnchor.split(\".\").reduce(((anchor, x) => anchor.parent), context);\n uiViewContextAnchor = anchor.name;\n } else if (uiViewContextAnchor === '.') {\n uiViewContextAnchor = context.name;\n }\n\n return {uiViewName, uiViewContextAnchor};\n }\n}\n", - "/**\n * @coreapi\n * @module core\n */ /** */\nimport {StateParams} from \"./params/stateParams\";\nimport {StateDeclaration} from \"./state/interface\";\nimport {StateObject} from \"./state/stateObject\";\nimport {Transition} from \"./transition/transition\";\nimport {Queue} from \"./common/queue\";\nimport { Disposable } from './interface';\n\n/**\n * Global router state\n *\n * This is where we hold the global mutable state such as current state, current\n * params, current transition, etc.\n */\nexport class UIRouterGlobals implements Disposable {\n /**\n * Current parameter values\n *\n * The parameter values from the latest successful transition\n */\n params: StateParams = new StateParams();\n\n /**\n * Current state\n *\n * The to-state from the latest successful transition\n */\n current: StateDeclaration;\n\n /**\n * Current state (internal object)\n *\n * The to-state from the latest successful transition\n * @internalapi\n */\n $current: StateObject;\n\n /**\n * The current started/running transition.\n * This transition has reached at least the onStart phase, but is not yet complete\n */\n transition: Transition;\n\n /** @internalapi */\n lastStartedTransitionId: number = -1;\n\n /** @internalapi */\n transitionHistory = new Queue([], 1);\n\n /** @internalapi */\n successfulTransitions = new Queue([], 1);\n\n dispose() {\n this.transitionHistory.clear();\n this.successfulTransitions.clear();\n this.transition = null;\n }\n}\n", - "/**\n * @coreapi\n * @module url\n */ /** */\n\nimport { UIRouter } from \"../router\";\nimport { LocationServices, notImplemented, LocationConfig } from \"../common/coreservices\";\nimport { noop, createProxyFunctions } from \"../common/common\";\nimport { UrlConfigApi, UrlSyncApi, UrlRulesApi, UrlParts, MatchResult } from \"./interface\";\n\n/** @hidden */\nconst makeStub = (keys: string[]): any =>\n keys.reduce((acc, key) => (acc[key] = notImplemented(key), acc), { dispose: noop });\n\n/** @hidden */ const locationServicesFns = [\"url\", \"path\", \"search\", \"hash\", \"onChange\"];\n/** @hidden */ const locationConfigFns = [\"port\", \"protocol\", \"host\", \"baseHref\", \"html5Mode\", \"hashPrefix\"];\n/** @hidden */ const umfFns = [\"type\", \"caseInsensitive\", \"strictMode\", \"defaultSquashPolicy\"];\n/** @hidden */ const rulesFns = [\"sort\", \"when\", \"initial\", \"otherwise\", \"rules\", \"rule\", \"removeRule\"];\n/** @hidden */ const syncFns = [\"deferIntercept\", \"listen\", \"sync\", \"match\"];\n\n/**\n * API for URL management\n */\nexport class UrlService implements LocationServices, UrlSyncApi {\n /** @hidden */\n static locationServiceStub: LocationServices = makeStub(locationServicesFns);\n /** @hidden */\n static locationConfigStub: LocationConfig = makeStub(locationConfigFns);\n\n /** @inheritdoc */\n url(): string;\n /** @inheritdoc */\n url(newurl: string, replace?: boolean, state?): void;\n url(newurl?, replace?, state?): any { return };\n /** @inheritdoc */\n path(): string { return };\n /** @inheritdoc */\n search(): { [key: string]: any } { return };\n /** @inheritdoc */\n hash(): string { return };\n /** @inheritdoc */\n onChange(callback: Function): Function { return };\n\n\n /**\n * Returns the current URL parts\n *\n * This method returns the current URL components as a [[UrlParts]] object.\n *\n * @returns the current url parts\n */\n parts(): UrlParts {\n return { path: this.path(), search: this.search(), hash: this.hash() }\n }\n\n dispose() { }\n\n /** @inheritdoc */\n sync(evt?) { return }\n /** @inheritdoc */\n listen(enabled?: boolean): Function { return };\n /** @inheritdoc */\n deferIntercept(defer?: boolean) { return }\n /** @inheritdoc */\n match(urlParts: UrlParts): MatchResult { return }\n\n /**\n * A nested API for managing URL rules and rewrites\n *\n * See: [[UrlRulesApi]] for details\n */\n rules: UrlRulesApi;\n\n /**\n * A nested API to configure the URL and retrieve URL information\n *\n * See: [[UrlConfigApi]] for details\n */\n config: UrlConfigApi;\n\n /** @hidden */\n private router: UIRouter;\n\n /** @hidden */\n constructor(router: UIRouter, lateBind = true) {\n this.router = router;\n this.rules = {} as any;\n this.config = {} as any;\n\n // proxy function calls from UrlService to the LocationService/LocationConfig\n const locationServices = () => router.locationService;\n createProxyFunctions(locationServices, this, locationServices, locationServicesFns, lateBind);\n\n const locationConfig = () => router.locationConfig;\n createProxyFunctions(locationConfig, this.config, locationConfig, locationConfigFns, lateBind);\n\n const umf = () => router.urlMatcherFactory;\n createProxyFunctions(umf, this.config, umf, umfFns);\n\n const urlRouter = () => router.urlRouter;\n createProxyFunctions(urlRouter, this.rules, urlRouter, rulesFns);\n createProxyFunctions(urlRouter, this, urlRouter, syncFns);\n }\n}\n", - "/**\n * @coreapi\n * @module core\n */ /** */\nimport { UrlMatcherFactory } from \"./url/urlMatcherFactory\";\nimport { UrlRouter } from \"./url/urlRouter\";\nimport { TransitionService } from \"./transition/transitionService\";\nimport { ViewService } from \"./view/view\";\nimport { StateRegistry } from \"./state/stateRegistry\";\nimport { StateService } from \"./state/stateService\";\nimport { UIRouterGlobals } from \"./globals\";\nimport { UIRouterPlugin, Disposable } from \"./interface\";\nimport { values, removeFrom } from \"./common/common\";\nimport { isFunction } from \"./common/predicates\";\nimport { UrlService } from \"./url/urlService\";\nimport { LocationServices, LocationConfig } from \"./common/coreservices\";\nimport { Trace, trace } from \"./common/trace\";\n\n/** @hidden */\nlet _routerInstance = 0;\n\n/**\n * The master class used to instantiate an instance of UI-Router.\n *\n * UI-Router (for each specific framework) will create an instance of this class during bootstrap.\n * This class instantiates and wires the UI-Router services together.\n *\n * After a new instance of the UIRouter class is created, it should be configured for your app.\n * For instance, app states should be registered with the [[UIRouter.stateRegistry]].\n *\n * ---\n *\n * Normally the framework code will bootstrap UI-Router.\n * If you are bootstrapping UIRouter manually, tell it to monitor the URL by calling\n * [[UrlService.listen]] then [[UrlService.sync]].\n */\nexport class UIRouter {\n /** @hidden */ $id = _routerInstance++;\n /** @hidden */ _disposed = false;\n /** @hidden */ private _disposables: Disposable[] = [];\n\n /** Provides trace information to the console */\n trace: Trace = trace;\n\n /** Provides services related to ui-view synchronization */\n viewService = new ViewService();\n\n /** Provides services related to Transitions */\n transitionService: TransitionService = new TransitionService(this);\n\n /** Global router state */\n globals: UIRouterGlobals = new UIRouterGlobals();\n\n /**\n * Deprecated for public use. Use [[urlService]] instead.\n * @deprecated Use [[urlService]] instead\n */\n urlMatcherFactory: UrlMatcherFactory = new UrlMatcherFactory();\n\n /**\n * Deprecated for public use. Use [[urlService]] instead.\n * @deprecated Use [[urlService]] instead\n */\n urlRouter: UrlRouter = new UrlRouter(this);\n\n /** Provides a registry for states, and related registration services */\n stateRegistry: StateRegistry = new StateRegistry(this);\n\n /** Provides services related to states */\n stateService = new StateService(this);\n\n /** Provides services related to the URL */\n urlService: UrlService = new UrlService(this);\n\n\n /** Registers an object to be notified when the router is disposed */\n disposable(disposable: Disposable) {\n this._disposables.push(disposable);\n }\n\n /**\n * Disposes this router instance\n *\n * When called, clears resources retained by the router by calling `dispose(this)` on all\n * registered [[disposable]] objects.\n *\n * Or, if a `disposable` object is provided, calls `dispose(this)` on that object only.\n *\n * @param disposable (optional) the disposable to dispose\n */\n dispose(disposable?: any): void {\n if (disposable && isFunction(disposable.dispose)) {\n disposable.dispose(this);\n return undefined;\n }\n\n this._disposed = true;\n this._disposables.slice().forEach(d => {\n try {\n typeof d.dispose === 'function' && d.dispose(this);\n removeFrom(this._disposables, d);\n } catch (ignored) {}\n });\n }\n\n /**\n * Creates a new `UIRouter` object\n *\n * @param locationService a [[LocationServices]] implementation\n * @param locationConfig a [[LocationConfig]] implementation\n * @internalapi\n */\n constructor(\n public locationService: LocationServices = UrlService.locationServiceStub,\n public locationConfig: LocationConfig = UrlService.locationConfigStub\n ) {\n\n this.viewService._pluginapi._rootViewContext(this.stateRegistry.root());\n this.globals.$current = this.stateRegistry.root();\n this.globals.current = this.globals.$current.self;\n\n this.disposable(this.globals);\n this.disposable(this.stateService);\n this.disposable(this.stateRegistry);\n this.disposable(this.transitionService);\n this.disposable(this.urlRouter);\n this.disposable(locationService);\n this.disposable(locationConfig);\n }\n\n /** @hidden */\n private _plugins: { [key: string]: UIRouterPlugin } = {};\n\n /** Add plugin (as ES6 class) */\n plugin(plugin: { new(router: UIRouter, options?: any): T }, options?: any): T;\n /** Add plugin (as javascript constructor function) */\n plugin(plugin: { (router: UIRouter, options?: any): void }, options?: any): T;\n /** Add plugin (as javascript factory function) */\n plugin(plugin: PluginFactory, options?: any): T;\n /**\n * Adds a plugin to UI-Router\n *\n * This method adds a UI-Router Plugin.\n * A plugin can enhance or change UI-Router behavior using any public API.\n *\n * #### Example:\n * ```js\n * import { MyCoolPlugin } from \"ui-router-cool-plugin\";\n *\n * var plugin = router.addPlugin(MyCoolPlugin);\n * ```\n *\n * ### Plugin authoring\n *\n * A plugin is simply a class (or constructor function) which accepts a [[UIRouter]] instance and (optionally) an options object.\n *\n * The plugin can implement its functionality using any of the public APIs of [[UIRouter]].\n * For example, it may configure router options or add a Transition Hook.\n *\n * The plugin can then be published as a separate module.\n *\n * #### Example:\n * ```js\n * export class MyAuthPlugin implements UIRouterPlugin {\n * constructor(router: UIRouter, options: any) {\n * this.name = \"MyAuthPlugin\";\n * let $transitions = router.transitionService;\n * let $state = router.stateService;\n *\n * let authCriteria = {\n * to: (state) => state.data && state.data.requiresAuth\n * };\n *\n * function authHook(transition: Transition) {\n * let authService = transition.injector().get('AuthService');\n * if (!authService.isAuthenticated()) {\n * return $state.target('login');\n * }\n * }\n *\n * $transitions.onStart(authCriteria, authHook);\n * }\n * }\n * ```\n *\n * @param plugin one of:\n * - a plugin class which implements [[UIRouterPlugin]]\n * - a constructor function for a [[UIRouterPlugin]] which accepts a [[UIRouter]] instance\n * - a factory function which accepts a [[UIRouter]] instance and returns a [[UIRouterPlugin]] instance\n * @param options options to pass to the plugin class/factory\n * @returns the registered plugin instance\n */\n plugin(plugin: any, options: any = {}): T {\n let pluginInstance = new plugin(this, options);\n if (!pluginInstance.name) throw new Error(\"Required property `name` missing on plugin: \" + pluginInstance);\n this._disposables.push(pluginInstance);\n return this._plugins[pluginInstance.name] = pluginInstance;\n }\n\n /**\n * Returns registered plugins\n *\n * Returns the registered plugin of the given `pluginName`.\n * If no `pluginName` is given, returns all registered plugins\n *\n * @param pluginName (optional) the name of the plugin to get\n * @return the named plugin (undefined if not found), or all plugins (if `pluginName` is omitted)\n */\n getPlugin(pluginName: string): UIRouterPlugin;\n getPlugin(): UIRouterPlugin[];\n getPlugin(pluginName?: string): UIRouterPlugin|UIRouterPlugin[] {\n return pluginName ? this._plugins[pluginName] : values(this._plugins);\n }\n}\n\n/** @internalapi */\nexport type PluginFactory = (router: UIRouter, options?: any) => T;\n", - "/** @module hooks */ /** */\nimport {isString, isFunction} from \"../common/predicates\"\nimport {Transition} from \"../transition/transition\";\nimport {services} from \"../common/coreservices\";\nimport {TargetState} from \"../state/targetState\";\nimport {TransitionService} from \"../transition/transitionService\";\nimport {TransitionHookFn} from \"../transition/interface\";\n\n/**\n * A [[TransitionHookFn]] that redirects to a different state or params\n *\n * Registered using `transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectHook);`\n * \n * See [[StateDeclaration.redirectTo]]\n */\nconst redirectToHook: TransitionHookFn = (trans: Transition) => {\n let redirect = trans.to().redirectTo;\n if (!redirect) return;\n\n let $state = trans.router.stateService;\n\n function handleResult(result: any) {\n if (!result) return;\n if (result instanceof TargetState) return result;\n if (isString(result)) return $state.target( result, trans.params(), trans.options());\n if (result['state'] || result['params'])\n return $state.target(result['state'] || trans.to(), result['params'] || trans.params(), trans.options());\n }\n\n if (isFunction(redirect)) {\n return services.$q.when(redirect(trans)).then(handleResult);\n }\n return handleResult(redirect);\n};\n\nexport const registerRedirectToHook = (transitionService: TransitionService) =>\n transitionService.onStart({to: (state) => !!state.redirectTo}, redirectToHook);\n", - "/** @module hooks */\n/** for typedoc */\nimport { noop } from '../common/common';\nimport { Transition } from '../transition/transition';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { TransitionStateHookFn, TransitionHookFn } from '../transition/interface';\nimport { TransitionService } from '../transition/transitionService';\nimport { val } from '../common/hof';\nimport { StateDeclaration } from '../state/interface';\n\nexport const RESOLVE_HOOK_PRIORITY = 1000;\n\n/**\n * A [[TransitionHookFn]] which resolves all EAGER Resolvables in the To Path\n *\n * Registered using `transitionService.onStart({}, eagerResolvePath, { priority: 1000 });`\n *\n * When a Transition starts, this hook resolves all the EAGER Resolvables, which the transition then waits for.\n *\n * See [[StateDeclaration.resolve]]\n */\nconst eagerResolvePath: TransitionHookFn = (trans: Transition) =>\n new ResolveContext(trans.treeChanges().to)\n .resolvePath(\"EAGER\", trans)\n .then(noop);\n\nexport const registerEagerResolvePath = (transitionService: TransitionService) =>\n transitionService.onStart({}, eagerResolvePath, {priority: RESOLVE_HOOK_PRIORITY});\n\n/**\n * A [[TransitionHookFn]] which resolves all LAZY Resolvables for the state (and all its ancestors) in the To Path\n *\n * Registered using `transitionService.onEnter({ entering: () => true }, lazyResolveState, { priority: 1000 });`\n *\n * When a State is being entered, this hook resolves all the Resolvables for this state, which the transition then waits for.\n *\n * See [[StateDeclaration.resolve]]\n */\nconst lazyResolveState: TransitionStateHookFn = (trans: Transition, state: StateDeclaration) =>\n new ResolveContext(trans.treeChanges().to)\n .subContext(state.$$state())\n .resolvePath(\"LAZY\", trans)\n .then(noop);\n\nexport const registerLazyResolveState = (transitionService: TransitionService) =>\n transitionService.onEnter({ entering: val(true) }, lazyResolveState, {priority: RESOLVE_HOOK_PRIORITY});\n\n\n/**\n * A [[TransitionHookFn]] which resolves any dynamically added (LAZY or EAGER) Resolvables.\n *\n * Registered using `transitionService.onFinish({}, eagerResolvePath, { priority: 1000 });`\n *\n * After all entering states have been entered, this hook resolves any remaining Resolvables.\n * These are typically dynamic resolves which were added by some Transition Hook using [[Transition.addResolvable]].\n *\n * See [[StateDeclaration.resolve]]\n */\nconst resolveRemaining: TransitionHookFn = (trans: Transition) =>\n new ResolveContext(trans.treeChanges().to)\n .resolvePath(\"LAZY\", trans)\n .then(noop);\n\nexport const registerResolveRemaining = (transitionService: TransitionService) =>\n transitionService.onFinish({}, resolveRemaining, {priority: RESOLVE_HOOK_PRIORITY});\n", - "/** @module hooks */ /** for typedoc */\nimport {noop} from \"../common/common\";\nimport {services} from \"../common/coreservices\";\nimport {Transition} from \"../transition/transition\";\nimport {ViewService} from \"../view/view\";\nimport {ViewConfig} from \"../view/interface\";\nimport {TransitionHookFn} from \"../transition/interface\";\nimport {TransitionService} from \"../transition/transitionService\";\n\n\n/**\n * A [[TransitionHookFn]] which waits for the views to load\n *\n * Registered using `transitionService.onStart({}, loadEnteringViews);`\n *\n * Allows the views to do async work in [[ViewConfig.load]] before the transition continues.\n * In angular 1, this includes loading the templates.\n */\nconst loadEnteringViews: TransitionHookFn = (transition: Transition) => {\n let $q = services.$q;\n let enteringViews = transition.views(\"entering\");\n if (!enteringViews.length) return;\n return $q.all(enteringViews.map(view => $q.when(view.load()))).then(noop);\n};\n\nexport const registerLoadEnteringViews = (transitionService: TransitionService) =>\n transitionService.onFinish({}, loadEnteringViews);\n\n/**\n * A [[TransitionHookFn]] which activates the new views when a transition is successful.\n *\n * Registered using `transitionService.onSuccess({}, activateViews);`\n *\n * After a transition is complete, this hook deactivates the old views from the previous state,\n * and activates the new views from the destination state.\n *\n * See [[ViewService]]\n */\nconst activateViews: TransitionHookFn = (transition: Transition) => {\n let enteringViews = transition.views(\"entering\");\n let exitingViews = transition.views(\"exiting\");\n if (!enteringViews.length && !exitingViews.length) return;\n\n let $view: ViewService = transition.router.viewService;\n\n exitingViews.forEach((vc: ViewConfig) => $view.deactivateViewConfig(vc));\n enteringViews.forEach((vc: ViewConfig) => $view.activateViewConfig(vc));\n\n $view.sync();\n};\n\nexport const registerActivateViews = (transitionService: TransitionService) =>\n transitionService.onSuccess({}, activateViews);\n", - "/** @module hooks */\n/** for typedoc */\nimport { Transition } from '../transition/transition';\nimport { copy } from '../common/common';\nimport { TransitionService } from '../transition/transitionService';\n\n/**\n * A [[TransitionHookFn]] which updates global UI-Router state\n *\n * Registered using `transitionService.onBefore({}, updateGlobalState);`\n *\n * Before a [[Transition]] starts, updates the global value of \"the current transition\" ([[Globals.transition]]).\n * After a successful [[Transition]], updates the global values of \"the current state\"\n * ([[Globals.current]] and [[Globals.$current]]) and \"the current param values\" ([[Globals.params]]).\n *\n * See also the deprecated properties:\n * [[StateService.transition]], [[StateService.current]], [[StateService.params]]\n */\nconst updateGlobalState = (trans: Transition) => {\n let globals = trans.router.globals;\n\n const transitionSuccessful = () => {\n globals.successfulTransitions.enqueue(trans);\n globals.$current = trans.$to();\n globals.current = globals.$current.self;\n\n copy(trans.params(), globals.params);\n };\n\n const clearCurrentTransition = () => {\n // Do not clear globals.transition if a different transition has started in the meantime\n if (globals.transition === trans) globals.transition = null;\n };\n\n trans.onSuccess({}, transitionSuccessful, { priority: 10000 });\n trans.promise.then(clearCurrentTransition, clearCurrentTransition);\n};\n\nexport const registerUpdateGlobalState = (transitionService: TransitionService) =>\n transitionService.onCreate({}, updateGlobalState);\n", - "/** @module hooks */ /** */\nimport {UrlRouter} from \"../url/urlRouter\";\nimport {StateService} from \"../state/stateService\";\nimport {Transition} from \"../transition/transition\";\nimport {TransitionHookFn} from \"../transition/interface\";\nimport {TransitionService} from \"../transition/transitionService\";\n\n/** \n * A [[TransitionHookFn]] which updates the URL after a successful transition\n * \n * Registered using `transitionService.onSuccess({}, updateUrl);`\n */\nconst updateUrl: TransitionHookFn = (transition: Transition) => {\n let options = transition.options();\n let $state: StateService = transition.router.stateService;\n let $urlRouter: UrlRouter = transition.router.urlRouter;\n\n // Dont update the url in these situations:\n // The transition was triggered by a URL sync (options.source === 'url')\n // The user doesn't want the url to update (options.location === false)\n // The destination state, and all parents have no navigable url\n if (options.source !== 'url' && options.location && $state.$current.navigable) {\n var urlOptions = {replace: options.location === 'replace'};\n $urlRouter.push($state.$current.navigable.url, $state.params, urlOptions);\n }\n\n $urlRouter.update(true);\n};\n\nexport const registerUpdateUrl = (transitionService: TransitionService) =>\n transitionService.onSuccess({}, updateUrl, {priority: 9999});\n", - "/** @module transition */ /** */\nimport { TransitionHookPhase, PathType } from \"./interface\";\nimport { GetErrorHandler, GetResultHandler, TransitionHook } from \"./transitionHook\";\n/**\n * This class defines a type of hook, such as `onBefore` or `onEnter`.\n * Plugins can define custom hook types, such as sticky states does for `onInactive`.\n *\n * @interalapi\n */\nexport class TransitionEventType {\n\n constructor(public name: string,\n public hookPhase: TransitionHookPhase,\n public hookOrder: number,\n public criteriaMatchPath: PathType,\n public reverseSort: boolean = false,\n public getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,\n public getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,\n public synchronous: boolean = false,\n ) { }\n}\n", - "/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport {\n IHookRegistry, TransitionOptions, TransitionHookScope, TransitionHookPhase, TransitionCreateHookFn, HookMatchCriteria,\n HookRegOptions, PathTypes, PathType, RegisteredHooks, TransitionHookFn, TransitionStateHookFn,\n} from \"./interface\";\nimport { Transition } from \"./transition\";\nimport { makeEvent, RegisteredHook } from \"./hookRegistry\";\nimport { TargetState } from \"../state/targetState\";\nimport { PathNode } from \"../path/pathNode\";\nimport { ViewService } from \"../view/view\";\nimport { UIRouter } from \"../router\";\nimport { registerAddCoreResolvables } from \"../hooks/coreResolvables\";\nimport { registerRedirectToHook } from \"../hooks/redirectTo\";\nimport { registerOnExitHook, registerOnRetainHook, registerOnEnterHook } from \"../hooks/onEnterExitRetain\";\nimport { registerEagerResolvePath, registerLazyResolveState, registerResolveRemaining } from \"../hooks/resolve\";\nimport { registerLoadEnteringViews, registerActivateViews } from \"../hooks/views\";\nimport { registerUpdateGlobalState } from \"../hooks/updateGlobals\";\nimport { registerUpdateUrl } from \"../hooks/url\";\nimport { registerLazyLoadHook } from \"../hooks/lazyLoad\";\nimport { TransitionEventType } from \"./transitionEventType\";\nimport { TransitionHook, GetResultHandler, GetErrorHandler } from \"./transitionHook\";\nimport { isDefined } from \"../common/predicates\";\nimport { removeFrom, values, createProxyFunctions } from \"../common/common\";\nimport { Disposable } from \"../interface\"; // has or is using\nimport { val } from \"../common/hof\";\nimport { registerIgnoredTransitionHook } from '../hooks/ignoredTransition';\nimport { registerInvalidTransitionHook } from '../hooks/invalidTransition';\n\n/**\n * The default [[Transition]] options.\n *\n * Include this object when applying custom defaults:\n * let reloadOpts = { reload: true, notify: true }\n * let options = defaults(theirOpts, customDefaults, defaultOptions);\n */\nexport let defaultTransOpts: TransitionOptions = {\n location : true,\n relative : null,\n inherit : false,\n notify : true,\n reload : false,\n custom : {},\n current : () => null,\n source : \"unknown\",\n};\n\n\n/**\n * Plugin API for Transition Service\n * @internalapi\n */\nexport interface TransitionServicePluginAPI {\n /**\n * Adds a Path to be used as a criterion against a TreeChanges path\n *\n * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.\n * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`\n * Each state in the exiting path is checked against the criteria and returned as part of the match.\n *\n * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.\n * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`\n * Only the tail of the `to` path is checked against the criteria and returned as part of the match.\n */\n _definePathType(name: string, hookScope: TransitionHookScope);\n\n /**\n * Gets a Path definition used as a criterion against a TreeChanges path\n */\n _getPathTypes(): PathTypes;\n\n /**\n * Defines a transition hook type and returns a transition hook registration\n * function (which can then be used to register hooks of this type).\n */\n _defineEvent(name: string,\n hookPhase: TransitionHookPhase,\n hookOrder: number,\n criteriaMatchPath: PathType,\n reverseSort?: boolean,\n getResultHandler?: GetResultHandler,\n getErrorHandler?: GetErrorHandler,\n rejectIfSuperseded?: boolean);\n\n /**\n * Returns the known event types, such as `onBefore`\n * If a phase argument is provided, returns only events for the given phase.\n */\n _getEvents(phase?: TransitionHookPhase): TransitionEventType[];\n\n /** Returns the hooks registered for the given hook name */\n getHooks(hookName: string): RegisteredHook[];\n}\n\n/**\n * This class provides services related to Transitions.\n *\n * - Most importantly, it allows global Transition Hooks to be registered.\n * - It allows the default transition error handler to be set.\n * - It also has a factory function for creating new [[Transition]] objects, (used internally by the [[StateService]]).\n *\n * At bootstrap, [[UIRouter]] creates a single instance (singleton) of this class.\n */\nexport class TransitionService implements IHookRegistry, Disposable {\n /** @hidden */\n _transitionCount = 0;\n\n /**\n * Registers a [[TransitionHookFn]], called *while a transition is being constructed*.\n *\n * Registers a transition lifecycle hook, which is invoked during transition construction.\n *\n * This low level hook should only be used by plugins.\n * This can be a useful time for plugins to add resolves or mutate the transition as needed.\n * The Sticky States plugin uses this hook to modify the treechanges.\n *\n * ### Lifecycle\n *\n * `onCreate` hooks are invoked *while a transition is being constructed*.\n *\n * ### Return value\n *\n * The hook's return value is ignored\n *\n * @internalapi\n * @param criteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be invoked.\n * @param options the registration options\n * @returns a function which deregisters the hook.\n */\n onCreate(criteria: HookMatchCriteria, callback: TransitionCreateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n\n /** @hidden */\n public $view: ViewService;\n\n /** @hidden The transition hook types, such as `onEnter`, `onStart`, etc */\n private _eventTypes: TransitionEventType[] = [];\n /** @hidden The registered transition hooks */\n _registeredHooks = { } as RegisteredHooks;\n /** @hidden The paths on a criteria object */\n private _criteriaPaths = { } as PathTypes;\n /** @hidden */\n private _router: UIRouter;\n\n /** @internalapi */\n _pluginapi: TransitionServicePluginAPI;\n\n /**\n * This object has hook de-registration functions for the built-in hooks.\n * This can be used by third parties libraries that wish to customize the behaviors\n *\n * @hidden\n */\n _deregisterHookFns: {\n addCoreResolves: Function;\n ignored: Function;\n invalid: Function;\n redirectTo: Function;\n onExit: Function;\n onRetain: Function;\n onEnter: Function;\n eagerResolve: Function;\n lazyResolve: Function;\n resolveAll: Function;\n loadViews: Function;\n activateViews: Function;\n updateGlobals: Function;\n updateUrl: Function;\n lazyLoad: Function;\n };\n\n /** @hidden */\n constructor(_router: UIRouter) {\n this._router = _router;\n this.$view = _router.viewService;\n this._deregisterHookFns = {};\n this._pluginapi = createProxyFunctions(val(this), {}, val(this), [\n '_definePathType',\n '_defineEvent',\n '_getPathTypes',\n '_getEvents',\n 'getHooks',\n ]);\n\n this._defineCorePaths();\n this._defineCoreEvents();\n this._registerCoreTransitionHooks();\n }\n\n /**\n * dispose\n * @internalapi\n */\n dispose(router: UIRouter) {\n values(this._registeredHooks).forEach((hooksArray: RegisteredHook[]) => hooksArray.forEach(hook => {\n hook._deregistered = true;\n removeFrom(hooksArray, hook);\n }));\n }\n\n /**\n * Creates a new [[Transition]] object\n *\n * This is a factory function for creating new Transition objects.\n * It is used internally by the [[StateService]] and should generally not be called by application code.\n *\n * @param fromPath the path to the current state (the from state)\n * @param targetState the target state (destination)\n * @returns a Transition\n */\n create(fromPath: PathNode[], targetState: TargetState): Transition {\n return new Transition(fromPath, targetState, this._router);\n }\n\n /** @hidden */\n private _defineCoreEvents() {\n const Phase = TransitionHookPhase;\n const TH = TransitionHook;\n const paths = this._criteriaPaths;\n const NORMAL_SORT = false, REVERSE_SORT = true;\n const SYNCHRONOUS = true;\n\n this._defineEvent(\"onCreate\", Phase.CREATE, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.THROW_ERROR, SYNCHRONOUS);\n\n this._defineEvent(\"onBefore\", Phase.BEFORE, 0, paths.to);\n\n this._defineEvent(\"onStart\", Phase.RUN, 0, paths.to);\n this._defineEvent(\"onExit\", Phase.RUN, 100, paths.exiting, REVERSE_SORT);\n this._defineEvent(\"onRetain\", Phase.RUN, 200, paths.retained);\n this._defineEvent(\"onEnter\", Phase.RUN, 300, paths.entering);\n this._defineEvent(\"onFinish\", Phase.RUN, 400, paths.to);\n\n this._defineEvent(\"onSuccess\", Phase.SUCCESS, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS);\n this._defineEvent(\"onError\", Phase.ERROR, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS);\n }\n\n /** @hidden */\n private _defineCorePaths() {\n const { STATE, TRANSITION } = TransitionHookScope;\n\n this._definePathType(\"to\", TRANSITION);\n this._definePathType(\"from\", TRANSITION);\n this._definePathType(\"exiting\", STATE);\n this._definePathType(\"retained\", STATE);\n this._definePathType(\"entering\", STATE);\n }\n\n /** @hidden */\n _defineEvent(name: string,\n hookPhase: TransitionHookPhase,\n hookOrder: number,\n criteriaMatchPath: PathType,\n reverseSort: boolean = false,\n getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,\n getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,\n synchronous: boolean = false) {\n let eventType = new TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous);\n\n this._eventTypes.push(eventType);\n makeEvent(this, this, eventType);\n }\n\n /** @hidden */ // tslint:disable-next-line\n private _getEvents(phase?: TransitionHookPhase): TransitionEventType[] {\n let transitionHookTypes = isDefined(phase) ?\n this._eventTypes.filter(type => type.hookPhase === phase) :\n this._eventTypes.slice();\n\n return transitionHookTypes.sort((l, r) => {\n let cmpByPhase = l.hookPhase - r.hookPhase;\n return cmpByPhase === 0 ? l.hookOrder - r.hookOrder : cmpByPhase;\n });\n }\n\n /**\n * Adds a Path to be used as a criterion against a TreeChanges path\n *\n * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.\n * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`\n * Each state in the exiting path is checked against the criteria and returned as part of the match.\n *\n * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.\n * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`\n * Only the tail of the `to` path is checked against the criteria and returned as part of the match.\n *\n * @hidden\n */\n private _definePathType(name: string, hookScope: TransitionHookScope) {\n this._criteriaPaths[name] = { name, scope: hookScope };\n }\n\n /** * @hidden */ // tslint:disable-next-line\n private _getPathTypes(): PathTypes {\n return this._criteriaPaths;\n }\n\n /** @hidden */\n public getHooks(hookName: string): RegisteredHook[] {\n return this._registeredHooks[hookName];\n }\n\n /** @hidden */\n private _registerCoreTransitionHooks() {\n let fns = this._deregisterHookFns;\n\n fns.addCoreResolves = registerAddCoreResolvables(this);\n fns.ignored = registerIgnoredTransitionHook(this);\n fns.invalid = registerInvalidTransitionHook(this);\n\n // Wire up redirectTo hook\n fns.redirectTo = registerRedirectToHook(this);\n\n // Wire up onExit/Retain/Enter state hooks\n fns.onExit = registerOnExitHook(this);\n fns.onRetain = registerOnRetainHook(this);\n fns.onEnter = registerOnEnterHook(this);\n\n // Wire up Resolve hooks\n fns.eagerResolve = registerEagerResolvePath(this);\n fns.lazyResolve = registerLazyResolveState(this);\n fns.resolveAll = registerResolveRemaining(this);\n\n // Wire up the View management hooks\n fns.loadViews = registerLoadEnteringViews(this);\n fns.activateViews = registerActivateViews(this);\n\n // Updates global state after a transition\n fns.updateGlobals = registerUpdateGlobalState(this);\n\n // After globals.current is updated at priority: 10000\n fns.updateUrl = registerUpdateUrl(this);\n\n // Lazy load state trees\n fns.lazyLoad = registerLazyLoadHook(this);\n }\n}\n", - "/**\n * @coreapi\n * @module state\n */\n/** */\nimport { createProxyFunctions, defaults, extend, inArray, noop, removeFrom, silenceUncaughtInPromise, silentRejection } from '../common/common';\nimport { isDefined, isObject, isString } from '../common/predicates';\nimport { Queue } from '../common/queue';\nimport { services } from '../common/coreservices';\n\nimport { PathUtils } from '../path/pathFactory';\nimport { PathNode } from '../path/pathNode';\n\nimport { HookResult, TransitionOptions } from '../transition/interface';\nimport { defaultTransOpts } from '../transition/transitionService';\nimport { Rejection, RejectType } from '../transition/rejectFactory';\nimport { Transition } from '../transition/transition';\n\nimport { HrefOptions, LazyLoadResult, StateDeclaration, StateOrName, TransitionPromise } from './interface';\nimport { StateObject } from './stateObject';\nimport { TargetState } from './targetState';\n\nimport { RawParams } from '../params/interface';\nimport { Param } from '../params/param';\nimport { Glob } from '../common/glob';\nimport { UIRouter } from '../router';\nimport { UIInjector } from '../interface';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { lazyLoadState } from '../hooks/lazyLoad';\nimport { not, val } from '../common/hof';\nimport { StateParams } from '../params/stateParams';\n\nexport type OnInvalidCallback =\n (toState?: TargetState, fromState?: TargetState, injector?: UIInjector) => HookResult;\n\n/**\n * Provides state related service functions\n *\n * This class provides services related to ui-router states.\n * An instance of this class is located on the global [[UIRouter]] object.\n */\nexport class StateService {\n /** @internalapi */\n invalidCallbacks: OnInvalidCallback[] = [];\n\n /**\n * The [[Transition]] currently in progress (or null)\n *\n * This is a passthrough through to [[UIRouterGlobals.transition]]\n */\n get transition() { return this.router.globals.transition; }\n /**\n * The latest successful state parameters\n *\n * This is a passthrough through to [[UIRouterGlobals.params]]\n */\n get params(): StateParams { return this.router.globals.params; }\n /**\n * The current [[StateDeclaration]]\n *\n * This is a passthrough through to [[UIRouterGlobals.current]]\n */\n get current() { return this.router.globals.current; }\n /**\n * The current [[StateObject]]\n *\n * This is a passthrough through to [[UIRouterGlobals.$current]]\n */\n get $current() { return this.router.globals.$current; }\n\n /** @internalapi */\n constructor(private router: UIRouter) {\n let getters = ['current', '$current', 'params', 'transition'];\n let boundFns = Object.keys(StateService.prototype).filter(not(inArray(getters)));\n createProxyFunctions(val(StateService.prototype), this, val(this), boundFns);\n }\n\n /** @internalapi */\n dispose() {\n this.defaultErrorHandler(noop);\n this.invalidCallbacks = [];\n }\n\n /**\n * Handler for when [[transitionTo]] is called with an invalid state.\n *\n * Invokes the [[onInvalid]] callbacks, in natural order.\n * Each callback's return value is checked in sequence until one of them returns an instance of TargetState.\n * The results of the callbacks are wrapped in $q.when(), so the callbacks may return promises.\n *\n * If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned.\n *\n * @internalapi\n */\n private _handleInvalidTargetState(fromPath: PathNode[], toState: TargetState) {\n let fromState = PathUtils.makeTargetState(this.router.stateRegistry, fromPath);\n let globals = this.router.globals;\n const latestThing = () => globals.transitionHistory.peekTail();\n let latest = latestThing();\n let callbackQueue = new Queue(this.invalidCallbacks.slice());\n let injector = new ResolveContext(fromPath).injector();\n\n const checkForRedirect = (result: HookResult) => {\n if (!(result instanceof TargetState)) {\n return;\n }\n\n let target = result;\n // Recreate the TargetState, in case the state is now defined.\n target = this.target(target.identifier(), target.params(), target.options());\n\n if (!target.valid()) {\n return Rejection.invalid(target.error()).toPromise();\n }\n\n if (latestThing() !== latest) {\n return Rejection.superseded().toPromise();\n }\n\n return this.transitionTo(target.identifier(), target.params(), target.options());\n };\n\n function invokeNextCallback() {\n let nextCallback = callbackQueue.dequeue();\n if (nextCallback === undefined) return Rejection.invalid(toState.error()).toPromise();\n\n let callbackResult = services.$q.when(nextCallback(toState, fromState, injector));\n return callbackResult.then(checkForRedirect).then(result => result || invokeNextCallback());\n }\n\n return invokeNextCallback();\n }\n\n /**\n * Registers an Invalid State handler\n *\n * Registers a [[OnInvalidCallback]] function to be invoked when [[StateService.transitionTo]]\n * has been called with an invalid state reference parameter\n *\n * Example:\n * ```js\n * stateService.onInvalid(function(to, from, injector) {\n * if (to.name() === 'foo') {\n * let lazyLoader = injector.get('LazyLoadService');\n * return lazyLoader.load('foo')\n * .then(() => stateService.target('foo'));\n * }\n * });\n * ```\n *\n * @param {function} callback invoked when the toState is invalid\n * This function receives the (invalid) toState, the fromState, and an injector.\n * The function may optionally return a [[TargetState]] or a Promise for a TargetState.\n * If one is returned, it is treated as a redirect.\n *\n * @returns a function which deregisters the callback\n */\n onInvalid(callback: OnInvalidCallback): Function {\n this.invalidCallbacks.push(callback);\n return function deregisterListener() {\n removeFrom(this.invalidCallbacks)(callback);\n }.bind(this);\n }\n\n\n /**\n * Reloads the current state\n *\n * A method that force reloads the current state, or a partial state hierarchy.\n * All resolves are re-resolved, and components reinstantiated.\n *\n * #### Example:\n * ```js\n * let app angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.reload = function(){\n * $state.reload();\n * }\n * });\n * ```\n *\n * Note: `reload()` is just an alias for:\n *\n * ```js\n * $state.transitionTo($state.current, $state.params, {\n * reload: true, inherit: false\n * });\n * ```\n *\n * @param reloadState A state name or a state object.\n * If present, this state and all its children will be reloaded, but ancestors will not reload.\n *\n * #### Example:\n * ```js\n * //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item'\n * //and current state is 'contacts.detail.item'\n * let app angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.reload = function(){\n * //will reload 'contact.detail' and nested 'contact.detail.item' states\n * $state.reload('contact.detail');\n * }\n * });\n * ```\n *\n * @returns A promise representing the state of the new transition. See [[StateService.go]]\n */\n reload(reloadState?: StateOrName): Promise {\n return this.transitionTo(this.current, this.params, {\n reload: isDefined(reloadState) ? reloadState : true,\n inherit: false,\n notify: false,\n });\n };\n\n /**\n * Transition to a different state and/or parameters\n *\n * Convenience method for transitioning to a new state.\n *\n * `$state.go` calls `$state.transitionTo` internally but automatically sets options to\n * `{ location: true, inherit: true, relative: router.globals.$current, notify: true }`.\n * This allows you to use either an absolute or relative `to` argument (because of `relative: router.globals.$current`).\n * It also allows you to specify * only the parameters you'd like to update, while letting unspecified parameters\n * inherit from the current parameter values (because of `inherit: true`).\n *\n * #### Example:\n * ```js\n * let app = angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.changeState = function () {\n * $state.go('contact.detail');\n * };\n * });\n * ```\n *\n * @param to Absolute state name, state object, or relative state path (relative to current state).\n *\n * Some examples:\n *\n * - `$state.go('contact.detail')` - will go to the `contact.detail` state\n * - `$state.go('^')` - will go to the parent state\n * - `$state.go('^.sibling')` - if current state is `home.child`, will go to the `home.sibling` state\n * - `$state.go('.child.grandchild')` - if current state is home, will go to the `home.child.grandchild` state\n *\n * @param params A map of the parameters that will be sent to the state, will populate $stateParams.\n *\n * Any parameters that are not specified will be inherited from current parameter values (because of `inherit: true`).\n * This allows, for example, going to a sibling state that shares parameters defined by a parent state.\n *\n * @param options Transition options\n *\n * @returns {promise} A promise representing the state of the new transition.\n */\n go(to: StateOrName, params?: RawParams, options?: TransitionOptions): TransitionPromise {\n let defautGoOpts = { relative: this.$current, inherit: true };\n let transOpts = defaults(options, defautGoOpts, defaultTransOpts);\n return this.transitionTo(to, params, transOpts);\n };\n\n /**\n * Creates a [[TargetState]]\n *\n * This is a factory method for creating a TargetState\n *\n * This may be returned from a Transition Hook to redirect a transition, for example.\n */\n target(identifier: StateOrName, params?: RawParams, options: TransitionOptions = {}): TargetState {\n // If we're reloading, find the state object to reload from\n if (isObject(options.reload) && !(options.reload).name)\n throw new Error('Invalid reload state object');\n let reg = this.router.stateRegistry;\n options.reloadState = options.reload === true ? reg.root() : reg.matcher.find( options.reload, options.relative);\n\n if (options.reload && !options.reloadState)\n throw new Error(`No such reload state '${(isString(options.reload) ? options.reload : (options.reload).name)}'`);\n\n return new TargetState(this.router.stateRegistry, identifier, params, options);\n };\n\n private getCurrentPath(): PathNode[] {\n let globals = this.router.globals;\n let latestSuccess: Transition = globals.successfulTransitions.peekTail();\n const rootPath = () => [ new PathNode(this.router.stateRegistry.root()) ];\n return latestSuccess ? latestSuccess.treeChanges().to : rootPath();\n }\n\n /**\n * Low-level method for transitioning to a new state.\n *\n * The [[go]] method (which uses `transitionTo` internally) is recommended in most situations.\n *\n * #### Example:\n * ```js\n * let app = angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.changeState = function () {\n * $state.transitionTo('contact.detail');\n * };\n * });\n * ```\n *\n * @param to State name or state object.\n * @param toParams A map of the parameters that will be sent to the state,\n * will populate $stateParams.\n * @param options Transition options\n *\n * @returns A promise representing the state of the new transition. See [[go]]\n */\n transitionTo(to: StateOrName, toParams: RawParams = {}, options: TransitionOptions = {}): TransitionPromise {\n let router = this.router;\n let globals = router.globals;\n options = defaults(options, defaultTransOpts);\n const getCurrent = () =>\n globals.transition;\n options = extend(options, { current: getCurrent });\n\n let ref: TargetState = this.target(to, toParams, options);\n let currentPath = this.getCurrentPath();\n\n if (!ref.exists())\n return this._handleInvalidTargetState(currentPath, ref);\n\n if (!ref.valid())\n return silentRejection(ref.error());\n\n /**\n * Special handling for Ignored, Aborted, and Redirected transitions\n *\n * The semantics for the transition.run() promise and the StateService.transitionTo()\n * promise differ. For instance, the run() promise may be rejected because it was\n * IGNORED, but the transitionTo() promise is resolved because from the user perspective\n * no error occurred. Likewise, the transition.run() promise may be rejected because of\n * a Redirect, but the transitionTo() promise is chained to the new Transition's promise.\n */\n const rejectedTransitionHandler = (transition: Transition) => (error: any): Promise => {\n if (error instanceof Rejection) {\n const isLatest = router.globals.lastStartedTransitionId === transition.$id;\n\n if (error.type === RejectType.IGNORED) {\n isLatest && router.urlRouter.update();\n // Consider ignored `Transition.run()` as a successful `transitionTo`\n return services.$q.when(globals.current);\n }\n\n const detail: any = error.detail;\n if (error.type === RejectType.SUPERSEDED && error.redirected && detail instanceof TargetState) {\n // If `Transition.run()` was redirected, allow the `transitionTo()` promise to resolve successfully\n // by returning the promise for the new (redirect) `Transition.run()`.\n let redirect: Transition = transition.redirect(detail);\n return redirect.run().catch(rejectedTransitionHandler(redirect));\n }\n\n if (error.type === RejectType.ABORTED) {\n isLatest && router.urlRouter.update();\n return services.$q.reject(error);\n }\n }\n\n let errorHandler = this.defaultErrorHandler();\n errorHandler(error);\n\n return services.$q.reject(error);\n };\n\n let transition = this.router.transitionService.create(currentPath, ref);\n let transitionToPromise = transition.run().catch(rejectedTransitionHandler(transition));\n silenceUncaughtInPromise(transitionToPromise); // issue #2676\n\n // Return a promise for the transition, which also has the transition object on it.\n return extend(transitionToPromise, { transition });\n };\n\n /**\n * Checks if the current state *is* the provided state\n *\n * Similar to [[includes]] but only checks for the full state name.\n * If params is supplied then it will be tested for strict equality against the current\n * active params object, so all params must match with none missing and no extras.\n *\n * #### Example:\n * ```js\n * $state.$current.name = 'contacts.details.item';\n *\n * // absolute name\n * $state.is('contact.details.item'); // returns true\n * $state.is(contactDetailItemStateObject); // returns true\n * ```\n *\n * // relative name (. and ^), typically from a template\n * // E.g. from the 'contacts.details' template\n * ```html\n *
    Item
    \n * ```\n *\n * @param stateOrName The state name (absolute or relative) or state object you'd like to check.\n * @param params A param object, e.g. `{sectionId: section.id}`, that you'd like\n * to test against the current active state.\n * @param options An options object. The options are:\n * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will\n * test relative to `options.relative` state (or name).\n *\n * @returns Returns true if it is the state.\n */\n is(stateOrName: StateOrName, params?: RawParams, options?: { relative?: StateOrName }): boolean {\n options = defaults(options, { relative: this.$current });\n let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);\n if (!isDefined(state)) return undefined;\n if (this.$current !== state) return false;\n if (!params) return true;\n\n let schema: Param[] = state.parameters({ inherit: true, matchingKeys: params });\n return Param.equals(schema, Param.values(schema, params), this.params);\n };\n\n /**\n * Checks if the current state *includes* the provided state\n *\n * A method to determine if the current active state is equal to or is the child of the\n * state stateName. If any params are passed then they will be tested for a match as well.\n * Not all the parameters need to be passed, just the ones you'd like to test for equality.\n *\n * #### Example when `$state.$current.name === 'contacts.details.item'`\n * ```js\n * // Using partial names\n * $state.includes(\"contacts\"); // returns true\n * $state.includes(\"contacts.details\"); // returns true\n * $state.includes(\"contacts.details.item\"); // returns true\n * $state.includes(\"contacts.list\"); // returns false\n * $state.includes(\"about\"); // returns false\n * ```\n *\n * #### Glob Examples when `* $state.$current.name === 'contacts.details.item.url'`:\n * ```js\n * $state.includes(\"*.details.*.*\"); // returns true\n * $state.includes(\"*.details.**\"); // returns true\n * $state.includes(\"**.item.**\"); // returns true\n * $state.includes(\"*.details.item.url\"); // returns true\n * $state.includes(\"*.details.*.url\"); // returns true\n * $state.includes(\"*.details.*\"); // returns false\n * $state.includes(\"item.**\"); // returns false\n * ```\n *\n * @param stateOrName A partial name, relative name, glob pattern,\n * or state object to be searched for within the current state name.\n * @param params A param object, e.g. `{sectionId: section.id}`,\n * that you'd like to test against the current active state.\n * @param options An options object. The options are:\n * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will\n * test relative to `options.relative` state (or name).\n *\n * @returns {boolean} Returns true if it does include the state\n */\n includes(stateOrName: StateOrName, params?: RawParams, options?: TransitionOptions): boolean {\n options = defaults(options, { relative: this.$current });\n let glob = isString(stateOrName) && Glob.fromString( stateOrName);\n\n if (glob) {\n if (!glob.matches(this.$current.name)) return false;\n stateOrName = this.$current.name;\n }\n let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative), include = this.$current.includes;\n\n if (!isDefined(state)) return undefined;\n if (!isDefined(include[state.name])) return false;\n if (!params) return true;\n\n let schema: Param[] = state.parameters({ inherit: true, matchingKeys: params });\n return Param.equals(schema, Param.values(schema, params), this.params);\n };\n\n\n /**\n * Generates a URL for a state and parameters\n *\n * Returns the url for the given state populated with the given params.\n *\n * #### Example:\n * ```js\n * expect($state.href(\"about.person\", { person: \"bob\" })).toEqual(\"/about/bob\");\n * ```\n *\n * @param stateOrName The state name or state object you'd like to generate a url from.\n * @param params An object of parameter values to fill the state's required parameters.\n * @param options Options object. The options are:\n *\n * @returns {string} compiled state url\n */\n href(stateOrName: StateOrName, params: RawParams, options?: HrefOptions): string {\n let defaultHrefOpts = {\n lossy: true,\n inherit: true,\n absolute: false,\n relative: this.$current,\n };\n options = defaults(options, defaultHrefOpts);\n params = params || {};\n\n let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);\n\n if (!isDefined(state)) return null;\n if (options.inherit) params = this.params.$inherit(params, this.$current, state);\n\n let nav = (state && options.lossy) ? state.navigable : state;\n\n if (!nav || nav.url === undefined || nav.url === null) {\n return null;\n }\n return this.router.urlRouter.href(nav.url, params, {\n absolute: options.absolute,\n });\n };\n\n /** @hidden */\n private _defaultErrorHandler: ((_error: any) => void) = function $defaultErrorHandler($error$) {\n if ($error$ instanceof Error && $error$.stack) {\n console.error($error$);\n console.error($error$.stack);\n } else if ($error$ instanceof Rejection) {\n console.error($error$.toString());\n if ($error$.detail && $error$.detail.stack)\n console.error($error$.detail.stack);\n } else {\n console.error($error$);\n }\n };\n\n /**\n * Sets or gets the default [[transitionTo]] error handler.\n *\n * The error handler is called when a [[Transition]] is rejected or when any error occurred during the Transition.\n * This includes errors caused by resolves and transition hooks.\n *\n * Note:\n * This handler does not receive certain Transition rejections.\n * Redirected and Ignored Transitions are not considered to be errors by [[StateService.transitionTo]].\n *\n * The built-in default error handler logs the error to the console.\n *\n * You can provide your own custom handler.\n *\n * #### Example:\n * ```js\n * stateService.defaultErrorHandler(function() {\n * // Do not log transitionTo errors\n * });\n * ```\n *\n * @param handler a global error handler function\n * @returns the current global error handler\n */\n defaultErrorHandler(handler?: (error: any) => void): (error: any) => void {\n return this._defaultErrorHandler = handler || this._defaultErrorHandler;\n }\n\n /**\n * Gets a registered [[StateDeclaration]] object\n *\n * Returns the state declaration object for any specific state, or for all registered states.\n *\n * @param stateOrName (absolute or relative) If provided, will only get the declaration object for the requested state.\n * If not provided, returns an array of ALL states.\n * @param base When `stateOrName` is a relative state reference (such as `.bar.baz`), the state will be retrieved relative to this state.\n *\n * @returns a [[StateDeclaration]] object (or array of all registered [[StateDeclaration]] objects.)\n */\n get(stateOrName: StateOrName, base: StateOrName): StateDeclaration;\n get(stateOrName: StateOrName): StateDeclaration;\n get(): StateDeclaration[];\n get(stateOrName?: StateOrName, base?: StateOrName): any {\n let reg = this.router.stateRegistry;\n if (arguments.length === 0) return reg.get();\n return reg.get(stateOrName, base || this.$current);\n }\n\n /**\n * Lazy loads a state\n *\n * Explicitly runs a state's [[StateDeclaration.lazyLoad]] function.\n *\n * @param stateOrName the state that should be lazy loaded\n * @param transition the optional Transition context to use (if the lazyLoad function requires an injector, etc)\n * Note: If no transition is provided, a noop transition is created using the from the current state to the current state.\n * This noop transition is not actually run.\n *\n * @returns a promise to lazy load\n */\n lazyLoad(stateOrName: StateOrName, transition?: Transition): Promise {\n let state: StateDeclaration = this.get(stateOrName);\n if (!state || !state.lazyLoad) throw new Error(\"Can not lazy load \" + stateOrName);\n\n let currentPath = this.getCurrentPath();\n let target = PathUtils.makeTargetState(this.router.stateRegistry, currentPath);\n transition = transition || this.router.transitionService.create(currentPath, target);\n\n return lazyLoadState(transition, state);\n }\n}\n", - "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { isArray, isObject, $QLike } from \"../common/index\";\n\n/**\n * An angular1-like promise api\n *\n * This object implements four methods similar to the\n * [angular 1 promise api](https://docs.angularjs.org/api/ng/service/$q)\n *\n * UI-Router evolved from an angular 1 library to a framework agnostic library.\n * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.\n *\n * This API provides native ES6 promise support wrapped as a $q-like API.\n * Internally, UI-Router uses this $q object to perform promise operations.\n * The `angular-ui-router` (ui-router for angular 1) uses the $q API provided by angular.\n *\n * $q-like promise api\n */\nexport const $q = {\n /** Normalizes a value as a promise */\n when: (val) => new Promise((resolve, reject) => resolve(val)),\n\n /** Normalizes a value as a promise rejection */\n reject: (val) => new Promise((resolve, reject) => { reject(val); }),\n\n /** @returns a deferred object, which has `resolve` and `reject` functions */\n defer: () => {\n let deferred: any = {};\n deferred.promise = new Promise((resolve, reject) => {\n deferred.resolve = resolve;\n deferred.reject = reject;\n });\n return deferred;\n },\n\n /** Like Promise.all(), but also supports object key/promise notation like $q */\n all: (promises: { [key: string]: Promise } | Promise[]) => {\n if (isArray(promises)) {\n return Promise.all(promises);\n }\n\n if (isObject(promises)) {\n // Convert promises map to promises array.\n // When each promise resolves, map it to a tuple { key: key, val: val }\n let chain = Object.keys(promises)\n .map(key => promises[key].then(val => ({key, val})));\n\n // Then wait for all promises to resolve, and convert them back to an object\n return $q.all(chain).then(values =>\n values.reduce((acc, tuple) => { acc[tuple.key] = tuple.val; return acc; }, {}));\n }\n }\n} as $QLike;", - "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport {\n extend, assertPredicate, isFunction, isArray, isInjectable, $InjectorLike, IInjectable\n} from \"../common/index\";\n\n// globally available injectables\nlet globals = {};\nlet STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg;\nlet ARGUMENT_NAMES = /([^\\s,]+)/g;\n\n/**\n * A basic angular1-like injector api\n *\n * This object implements four methods similar to the\n * [angular 1 dependency injector](https://docs.angularjs.org/api/auto/service/$injector)\n *\n * UI-Router evolved from an angular 1 library to a framework agnostic library.\n * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.\n *\n * This object provides a naive implementation of a globally scoped dependency injection system.\n * It supports the following DI approaches:\n *\n * ### Function parameter names\n *\n * A function's `.toString()` is called, and the parameter names are parsed.\n * This only works when the parameter names aren't \"mangled\" by a minifier such as UglifyJS.\n *\n * ```js\n * function injectedFunction(FooService, BarService) {\n * // FooService and BarService are injected\n * }\n * ```\n *\n * ### Function annotation\n *\n * A function may be annotated with an array of dependency names as the `$inject` property.\n *\n * ```js\n * injectedFunction.$inject = [ 'FooService', 'BarService' ];\n * function injectedFunction(fs, bs) {\n * // FooService and BarService are injected as fs and bs parameters\n * }\n * ```\n *\n * ### Array notation\n *\n * An array provides the names of the dependencies to inject (as strings).\n * The function is the last element of the array.\n *\n * ```js\n * [ 'FooService', 'BarService', function (fs, bs) {\n * // FooService and BarService are injected as fs and bs parameters\n * }]\n * ```\n *\n * @type {$InjectorLike}\n */\nexport const $injector = {\n /** Gets an object from DI based on a string token */\n get: name => globals[name],\n\n /** Returns true if an object named `name` exists in global DI */\n has: (name) => $injector.get(name) != null,\n\n /**\n * Injects a function\n *\n * @param fn the function to inject\n * @param context the function's `this` binding\n * @param locals An object with additional DI tokens and values, such as `{ someToken: { foo: 1 } }`\n */\n invoke: (fn: IInjectable, context?, locals?) => {\n let all = extend({}, globals, locals || {});\n let params = $injector.annotate(fn);\n let ensureExist = assertPredicate((key: string) => all.hasOwnProperty(key), key => `DI can't find injectable: '${key}'`);\n let args = params.filter(ensureExist).map(x => all[x]);\n if (isFunction(fn)) return fn.apply(context, args);\n else return (fn as any[]).slice(-1)[0].apply(context, args);\n },\n\n /**\n * Returns a function's dependencies\n *\n * Analyzes a function (or array) and returns an array of DI tokens that the function requires.\n * @return an array of `string`s\n */\n annotate: (fn: IInjectable): any[] => {\n if (!isInjectable(fn)) throw new Error(`Not an injectable function: ${fn}`);\n if (fn && (fn as any).$inject) return (fn as any).$inject;\n if (isArray(fn)) return fn.slice(0, -1);\n let fnStr = fn.toString().replace(STRIP_COMMENTS, '');\n let result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES);\n return result || [];\n }\n} as $InjectorLike;", - "/**\n * @internalapi\n * @module vanilla\n */ /** */\n\nimport { deregAll, isDefined, LocationServices, removeFrom, root } from '../common';\nimport { Disposable } from '../interface';\nimport { UIRouter } from '../router';\nimport { HistoryLike, LocationLike } from './interface';\nimport { buildUrl, getParams, parseUrl } from './utils';\n\n/** A base `LocationServices` */\nexport abstract class BaseLocationServices implements LocationServices, Disposable {\n constructor(router: UIRouter, public fireAfterUpdate: boolean) {\n this._location = root.location;\n this._history = root.history;\n }\n\n _listener = evt => this._listeners.forEach(cb => cb(evt));\n\n private _listeners: Function[] = [];\n _location: LocationLike;\n _history: HistoryLike;\n\n /**\n * This should return the current internal URL representation.\n *\n * The internal URL includes only the portion that UI-Router matches.\n * It does not include:\n * - protocol\n * - server\n * - port\n * - base href or hash\n */\n protected abstract _get(): string;\n\n /**\n * This should set the current URL.\n *\n * The `url` param should include only the portion that UI-Router matches on.\n * It should not include:\n * - protocol\n * - server\n * - port\n * - base href or hash\n *\n * However, after this function completes, the browser URL should reflect the entire (fully qualified)\n * HREF including those data.\n */\n protected abstract _set(state: any, title: string, url: string, replace: boolean);\n\n hash = () => parseUrl(this._get()).hash;\n path = () => parseUrl(this._get()).path;\n search = () => getParams(parseUrl(this._get()).search);\n\n url(url?: string, replace: boolean = true): string {\n if (isDefined(url) && url !== this._get()) {\n this._set(null, null, url, replace);\n\n if (this.fireAfterUpdate) {\n this._listeners.forEach(cb => cb({ url }));\n }\n }\n\n return buildUrl(this);\n }\n\n onChange(cb: EventListener) {\n this._listeners.push(cb);\n return () => removeFrom(this._listeners, cb);\n }\n\n dispose(router: UIRouter) {\n deregAll(this._listeners);\n }\n}\n", + "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport {\n LocationConfig, LocationServices, identity, unnestR, isArray, splitEqual, splitHash, splitQuery,\n} from '../common';\nimport { UIRouter } from '../router';\n\nexport const keyValsToObjectR = (accum, [key, val]) => {\n if (!accum.hasOwnProperty(key)) {\n accum[key] = val;\n } else if (isArray(accum[key])) {\n accum[key].push(val);\n } else {\n accum[key] = [accum[key], val];\n }\n return accum;\n};\n\nexport const getParams = (queryString: string): any =>\n queryString.split('&').filter(identity).map(splitEqual).reduce(keyValsToObjectR, {});\n\nexport function parseUrl(url: string) {\n const orEmptyString = x => x || '';\n const [beforehash, hash] = splitHash(url).map(orEmptyString);\n const [path, search] = splitQuery(beforehash).map(orEmptyString);\n\n return { path, search, hash, url };\n}\n\nexport const buildUrl = (loc: LocationServices) => {\n const path = loc.path();\n const searchObject = loc.search();\n const hash = loc.hash();\n\n const search = Object.keys(searchObject).map(key => {\n const param = searchObject[key];\n const vals = isArray(param) ? param : [param];\n return vals.map(val => key + '=' + val);\n }).reduce(unnestR, []).join('&');\n\n return path + (search ? '?' + search : '') + (hash ? '#' + hash : '');\n};\n\nexport function locationPluginFactory(\n name: string,\n isHtml5: boolean,\n serviceClass: { new(uiRouter?: UIRouter): LocationServices },\n configurationClass: { new(uiRouter?: UIRouter, isHtml5?: boolean): LocationConfig },\n) {\n return function(uiRouter: UIRouter) {\n const service = uiRouter.locationService = new serviceClass(uiRouter);\n const configuration = uiRouter.locationConfig = new configurationClass(uiRouter, isHtml5);\n\n function dispose(router: UIRouter) {\n router.dispose(service);\n router.dispose(configuration);\n }\n\n return { name, service, configuration, dispose };\n };\n}\n", + "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { BrowserLocationConfig } from './browserLocationConfig';\nimport { HashLocationService } from './hashLocationService';\nimport { locationPluginFactory } from './utils';\nimport { LocationPlugin, ServicesPlugin } from './interface';\nimport { UIRouter } from '../router';\nimport { PushStateLocationService } from './pushStateLocationService';\nimport { MemoryLocationService } from './memoryLocationService';\nimport { MemoryLocationConfig } from './memoryLocationConfig';\nimport { $injector } from './injector';\nimport { $q } from './q';\nimport { services } from '../common/coreservices';\n\nexport function servicesPlugin(router: UIRouter): ServicesPlugin {\n services.$injector = $injector;\n services.$q = $q;\n\n return { name: 'vanilla.services', $q, $injector, dispose: () => null };\n}\n\n/** A `UIRouterPlugin` uses the browser hash to get/set the current location */\nexport const hashLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory('vanilla.hashBangLocation', false, HashLocationService, BrowserLocationConfig);\n\n/** A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis */\nexport const pushStateLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory('vanilla.pushStateLocation', true, PushStateLocationService, BrowserLocationConfig);\n\n/** A `UIRouterPlugin` that gets/sets the current location from an in-memory object */\nexport const memoryLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory('vanilla.memoryLocation', false, MemoryLocationService, MemoryLocationConfig);\n", + "/** @module ng1 */ /** */\nimport { ng as angular } from '../angular';\nimport {\n StateObject, pick, forEach, tail, extend,\n isArray, isInjectable, isDefined, isString, services, trace,\n ViewConfig, ViewService, ViewConfigFactory, PathNode, ResolveContext, Resolvable, IInjectable,\n} from '@uirouter/core';\nimport { Ng1ViewDeclaration } from '../interface';\nimport { TemplateFactory } from '../templateFactory';\nimport IInjectorService = angular.auto.IInjectorService;\n\nexport function getNg1ViewConfigFactory(): ViewConfigFactory {\n let templateFactory: TemplateFactory = null;\n return (path, view) => {\n templateFactory = templateFactory || services.$injector.get('$templateFactory');\n return [new Ng1ViewConfig(path, view, templateFactory)];\n };\n}\n\nconst hasAnyKey = (keys, obj) =>\n keys.reduce((acc, key) => acc || isDefined(obj[key]), false);\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `views`.\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * handles the `views` property with logic specific to @uirouter/angularjs (ng1).\n *\n * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object\n * and applies the state-level configuration to a view named `$default`.\n */\nexport function ng1ViewsBuilder(state: StateObject) {\n // Do not process root state\n if (!state.parent) return {};\n\n const tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'],\n ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'],\n compKeys = ['component', 'bindings', 'componentProvider'],\n nonCompKeys = tplKeys.concat(ctrlKeys),\n allViewKeys = compKeys.concat(nonCompKeys);\n\n // Do not allow a state to have both state-level props and also a `views: {}` property.\n // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state.\n // However, the `$default` approach should not be mixed with a separate `views: ` block.\n if (isDefined(state.views) && hasAnyKey(allViewKeys, state)) {\n throw new Error(`State '${state.name}' has a 'views' object. ` +\n `It cannot also have \"view properties\" at the state level. ` +\n `Move the following properties into a view (in the 'views' object): ` +\n ` ${allViewKeys.filter(key => isDefined(state[key])).join(', ')}`);\n }\n\n const views: { [key: string]: Ng1ViewDeclaration } = {},\n viewsObject = state.views || { '$default': pick(state, allViewKeys) };\n\n forEach(viewsObject, function (config: Ng1ViewDeclaration, name: string) {\n // Account for views: { \"\": { template... } }\n name = name || '$default';\n // Account for views: { header: \"headerComponent\" }\n if (isString(config)) config = { component: config };\n\n // Make a shallow copy of the config object\n config = extend({}, config);\n\n // Do not allow a view to mix props for component-style view with props for template/controller-style view\n if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {\n throw new Error(`Cannot combine: ${compKeys.join('|')} with: ${nonCompKeys.join('|')} in stateview: '${name}@${state.name}'`);\n }\n\n config.resolveAs = config.resolveAs || '$resolve';\n config.$type = 'ng1';\n config.$context = state;\n config.$name = name;\n\n const normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name);\n config.$uiViewName = normalized.uiViewName;\n config.$uiViewContextAnchor = normalized.uiViewContextAnchor;\n\n views[name] = config;\n });\n return views;\n}\n\nlet id = 0;\nexport class Ng1ViewConfig implements ViewConfig {\n $id = id++;\n loaded = false;\n controller: Function; // actually IInjectable|string\n template: string;\n component: string;\n locals: any; // TODO: delete me\n\n constructor(public path: PathNode[], public viewDecl: Ng1ViewDeclaration, public factory: TemplateFactory) { }\n\n load() {\n const $q = services.$q;\n const context = new ResolveContext(this.path);\n const params = this.path.reduce((acc, node) => extend(acc, node.paramValues), {});\n\n const promises: any = {\n template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)),\n controller: $q.when(this.getController(context)),\n };\n\n return $q.all(promises).then((results) => {\n trace.traceViewServiceEvent('Loaded', this);\n this.controller = results.controller;\n extend(this, results.template); // Either { template: \"tpl\" } or { component: \"cmpName\" }\n return this;\n });\n }\n\n getTemplate = (uiView, context: ResolveContext) =>\n this.component ? this.factory.makeComponentTemplate(uiView, context, this.component, this.viewDecl.bindings) : this.template;\n\n /**\n * Gets the controller for a view configuration.\n *\n * @returns {Function|Promise.} Returns a controller, or a promise that resolves to a controller.\n */\n getController(context: ResolveContext): (IInjectable|string|Promise) {\n const provider = this.viewDecl.controllerProvider;\n if (!isInjectable(provider)) return this.viewDecl.controller;\n const deps = services.$injector.annotate(provider);\n const providerFn = isArray(provider) ? tail( provider) : provider;\n const resolvable = new Resolvable('', providerFn, deps);\n return resolvable.get(context);\n }\n}\n", + "/** @module view */\n/** for typedoc */\nimport { ng as angular } from './angular';\nimport { IAugmentedJQuery } from 'angular';\nimport {\n isArray, isDefined, isFunction, isObject, services, Obj, IInjectable, tail, kebobString, unnestR, ResolveContext,\n Resolvable, RawParams,\n} from '@uirouter/core';\nimport { Ng1ViewDeclaration, TemplateFactoryProvider } from './interface';\n\n/**\n * Service which manages loading of templates from a ViewConfig.\n */\nexport class TemplateFactory implements TemplateFactoryProvider {\n /** @hidden */ private _useHttp = angular.version.minor < 3;\n /** @hidden */ private $templateRequest;\n /** @hidden */ private $templateCache;\n /** @hidden */ private $http;\n\n /** @hidden */ $get = ['$http', '$templateCache', '$injector', ($http, $templateCache, $injector) => {\n this.$templateRequest = $injector.has && $injector.has('$templateRequest') && $injector.get('$templateRequest');\n this.$http = $http;\n this.$templateCache = $templateCache;\n return this;\n }];\n\n /** @hidden */\n useHttpService(value: boolean) {\n this._useHttp = value;\n }\n\n /**\n * Creates a template from a configuration object.\n *\n * @param config Configuration object for which to load a template.\n * The following properties are search in the specified order, and the first one\n * that is defined is used to create the template:\n *\n * @param params Parameters to pass to the template function.\n * @param context The resolve context associated with the template's view\n *\n * @return {string|object} The template html as a string, or a promise for\n * that string,or `null` if no template is configured.\n */\n fromConfig(config: Ng1ViewDeclaration, params: any, context: ResolveContext): Promise<{ template?: string, component?: string }> {\n const defaultTemplate = '';\n\n const asTemplate = (result) => services.$q.when(result).then(str => ({ template: str }));\n const asComponent = (result) => services.$q.when(result).then(str => ({ component: str }));\n\n return (\n isDefined(config.template) ? asTemplate(this.fromString(config.template, params)) :\n isDefined(config.templateUrl) ? asTemplate(this.fromUrl(config.templateUrl, params)) :\n isDefined(config.templateProvider) ? asTemplate(this.fromProvider(config.templateProvider, params, context)) :\n isDefined(config.component) ? asComponent(config.component) :\n isDefined(config.componentProvider) ? asComponent(this.fromComponentProvider(config.componentProvider, params, context)) :\n asTemplate(defaultTemplate)\n );\n }\n\n /**\n * Creates a template from a string or a function returning a string.\n *\n * @param template html template as a string or function that returns an html template as a string.\n * @param params Parameters to pass to the template function.\n *\n * @return {string|object} The template html as a string, or a promise for that\n * string.\n */\n fromString(template: (string | Function), params?: RawParams) {\n return isFunction(template) ? ( template)(params) : template;\n }\n\n /**\n * Loads a template from the a URL via `$http` and `$templateCache`.\n *\n * @param {string|Function} url url of the template to load, or a function\n * that returns a url.\n * @param {Object} params Parameters to pass to the url function.\n * @return {string|Promise.} The template html as a string, or a promise\n * for that string.\n */\n fromUrl(url: (string | Function), params: any) {\n if (isFunction(url)) url = ( url)(params);\n if (url == null) return null;\n\n if (this._useHttp) {\n return this.$http.get(url, { cache: this.$templateCache, headers: { Accept: 'text/html' } })\n .then(function (response) {\n return response.data;\n });\n }\n\n return this.$templateRequest(url);\n }\n\n /**\n * Creates a template by invoking an injectable provider function.\n *\n * @param provider Function to invoke via `locals`\n * @param {Function} injectFn a function used to invoke the template provider\n * @return {string|Promise.} The template html as a string, or a promise\n * for that string.\n */\n fromProvider(provider: IInjectable, params: any, context: ResolveContext) {\n const deps = services.$injector.annotate(provider);\n const providerFn = isArray(provider) ? tail( provider) : provider;\n const resolvable = new Resolvable('', providerFn, deps);\n return resolvable.get(context);\n }\n\n /**\n * Creates a component's template by invoking an injectable provider function.\n *\n * @param provider Function to invoke via `locals`\n * @param {Function} injectFn a function used to invoke the template provider\n * @return {string} The template html as a string: \"\".\n */\n fromComponentProvider(provider: IInjectable, params: any, context: ResolveContext) {\n const deps = services.$injector.annotate(provider);\n const providerFn = isArray(provider) ? tail( provider) : provider;\n const resolvable = new Resolvable('', providerFn, deps);\n return resolvable.get(context);\n }\n\n /**\n * Creates a template from a component's name\n *\n * This implements route-to-component.\n * It works by retrieving the component (directive) metadata from the injector.\n * It analyses the component's bindings, then constructs a template that instantiates the component.\n * The template wires input and output bindings to resolves or from the parent component.\n *\n * @param uiView {object} The parent ui-view (for binding outputs to callbacks)\n * @param context The ResolveContext (for binding outputs to callbacks returned from resolves)\n * @param component {string} Component's name in camel case.\n * @param bindings An object defining the component's bindings: {foo: '<'}\n * @return {string} The template as a string: \"\".\n */\n makeComponentTemplate(uiView: IAugmentedJQuery, context: ResolveContext, component: string, bindings?: any) {\n bindings = bindings || {};\n\n // Bind once prefix\n const prefix = angular.version.minor >= 3 ? '::' : '';\n // Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-`\n const kebob = (camelCase: string) => {\n const kebobed = kebobString(camelCase);\n return /^(x|data)-/.exec(kebobed) ? `x-${kebobed}` : kebobed;\n };\n\n\n const attributeTpl = (input: BindingTuple) => {\n const { name, type } = input;\n const attrName = kebob(name);\n // If the ui-view has an attribute which matches a binding on the routed component\n // then pass that attribute through to the routed component template.\n // Prefer ui-view wired mappings to resolve data, unless the resolve was explicitly bound using `bindings:`\n if (uiView.attr(attrName) && !bindings[name])\n return `${attrName}='${uiView.attr(attrName)}'`;\n\n const resolveName = bindings[name] || name;\n // Pre-evaluate the expression for \"@\" bindings by enclosing in {{ }}\n // some-attr=\"{{ ::$resolve.someResolveName }}\"\n if (type === '@')\n return `${attrName}='{{${prefix}$resolve.${resolveName}}}'`;\n\n // Wire \"&\" callbacks to resolves that return a callback function\n // Get the result of the resolve (should be a function) and annotate it to get its arguments.\n // some-attr=\"$resolve.someResolveResultName(foo, bar)\"\n if (type === '&') {\n const res = context.getResolvable(resolveName);\n const fn = res && res.data;\n const args = fn && services.$injector.annotate(fn) || [];\n // account for array style injection, i.e., ['foo', function(foo) {}]\n const arrayIdxStr = isArray(fn) ? `[${fn.length - 1}]` : '';\n return `${attrName}='$resolve.${resolveName}${arrayIdxStr}(${args.join(',')})'`;\n }\n\n // some-attr=\"::$resolve.someResolveName\"\n return `${attrName}='${prefix}$resolve.${resolveName}'`;\n };\n\n const attrs = getComponentBindings(component).map(attributeTpl).join(' ');\n const kebobName = kebob(component);\n return `<${kebobName} ${attrs}>`;\n }\n}\n\n// Gets all the directive(s)' inputs ('@', '=', and '<') and outputs ('&')\nfunction getComponentBindings(name: string) {\n const cmpDefs = services.$injector.get(name + 'Directive'); // could be multiple\n if (!cmpDefs || !cmpDefs.length) throw new Error(`Unable to find component named '${name}'`);\n return cmpDefs.map(getBindings).reduce(unnestR, []);\n}\n\n// Given a directive definition, find its object input attributes\n// Use different properties, depending on the type of directive (component, bindToController, normal)\nconst getBindings = (def: any) => {\n if (isObject(def.bindToController)) return scopeBindings(def.bindToController);\n return scopeBindings(def.scope);\n};\n\ninterface BindingTuple {\n name: string;\n type: string;\n}\n\n// for ng 1.2 style, process the scope: { input: \"=foo\" }\n// for ng 1.3 through ng 1.5, process the component's bindToController: { input: \"=foo\" } object\nconst scopeBindings = (bindingsObj: Obj) => Object.keys(bindingsObj || {})\n // [ 'input', [ '=foo', '=', 'foo' ] ]\n .map(key => [key, /^([=<@&])[?]?(.*)/.exec(bindingsObj[key])])\n // skip malformed values\n .filter(tuple => isDefined(tuple) && isArray(tuple[1]))\n // { name: ('foo' || 'input'), type: '=' }\n .map(tuple => ({ name: tuple[1][2] || tuple[0], type: tuple[1][1] } as BindingTuple));\n\n", + "/**\n * # Angular 1 types\n *\n * UI-Router core provides various Typescript types which you can use for code completion and validating parameter values, etc.\n * The customizations to the core types for Angular UI-Router are documented here.\n *\n * The optional [[$resolve]] service is also documented here.\n *\n * @module ng1\n * @preferred\n */\n/** for typedoc */\nimport { ng as angular } from './angular';\nimport {\n IRootScopeService, IQService, ILocationService, ILocationProvider, IHttpService, ITemplateCacheService,\n} from 'angular';\nimport {\n services, applyPairs, isString, trace, extend, UIRouter, StateService, UrlRouter, UrlMatcherFactory, ResolveContext,\n unnestR, TypedMap,\n} from '@uirouter/core';\nimport { ng1ViewsBuilder, getNg1ViewConfigFactory } from './statebuilders/views';\nimport { TemplateFactory } from './templateFactory';\nimport { StateProvider } from './stateProvider';\nimport { getStateHookBuilder } from './statebuilders/onEnterExitRetain';\nimport { Ng1LocationServices } from './locationServices';\nimport { UrlRouterProvider } from './urlRouterProvider';\nimport IInjectorService = angular.auto.IInjectorService; // tslint:disable-line\n\nangular.module('ui.router.angular1', []);\nconst mod_init = angular.module('ui.router.init', []);\nconst mod_util = angular.module('ui.router.util', ['ng', 'ui.router.init']);\nconst mod_rtr = angular.module('ui.router.router', ['ui.router.util']);\nconst mod_state = angular.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']);\nconst mod_main = angular.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']);\nlet mod_cmpt = angular.module('ui.router.compat', ['ui.router']); // tslint:disable-line\n\ndeclare module '@uirouter/core/lib/router' {\n interface UIRouter { // tslint:disable-line:no-shadowed-variable\n /** @hidden */\n stateProvider: StateProvider;\n /** @hidden */\n urlRouterProvider: UrlRouterProvider;\n }\n}\n\nlet router: UIRouter = null;\n\n$uiRouterProvider.$inject = ['$locationProvider'];\n/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */\nfunction $uiRouterProvider($locationProvider: ILocationProvider) {\n\n // Create a new instance of the Router when the $uiRouterProvider is initialized\n router = this.router = new UIRouter();\n router.stateProvider = new StateProvider(router.stateRegistry, router.stateService);\n\n // Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties\n router.stateRegistry.decorator('views', ng1ViewsBuilder);\n router.stateRegistry.decorator('onExit', getStateHookBuilder('onExit'));\n router.stateRegistry.decorator('onRetain', getStateHookBuilder('onRetain'));\n router.stateRegistry.decorator('onEnter', getStateHookBuilder('onEnter'));\n\n router.viewService._pluginapi._viewConfigFactory('ng1', getNg1ViewConfigFactory());\n\n const ng1LocationService = router.locationService = router.locationConfig = new Ng1LocationServices($locationProvider);\n\n Ng1LocationServices.monkeyPatchPathParameterType(router);\n\n // backwards compat: also expose router instance as $uiRouterProvider.router\n router['router'] = router;\n router['$get'] = $get;\n $get.$inject = ['$location', '$browser', '$sniffer', '$rootScope', '$http', '$templateCache'];\n function $get($location: ILocationService, $browser: any, $sniffer: any, $rootScope: ng.IScope, $http: IHttpService, $templateCache: ITemplateCacheService) {\n ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser);\n delete router['router'];\n delete router['$get'];\n return router;\n }\n return router;\n}\n\nconst getProviderFor = (serviceName) => [ '$uiRouterProvider', ($urp) => {\n const service = $urp.router[serviceName];\n service['$get'] = () => service;\n return service;\n}];\n\n// This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime)\nrunBlock.$inject = ['$injector', '$q', '$uiRouter'];\nfunction runBlock($injector: IInjectorService, $q: IQService, $uiRouter: UIRouter) {\n services.$injector = $injector;\n services.$q = $q;\n\n // The $injector is now available.\n // Find any resolvables that had dependency annotation deferred\n $uiRouter.stateRegistry.get()\n .map(x => x.$$state().resolvables)\n .reduce(unnestR, [])\n .filter(x => x.deps === 'deferred')\n .forEach(resolvable => resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi));\n}\n\n// $urlRouter service and $urlRouterProvider\nconst getUrlRouterProvider = (uiRouter: UIRouter) =>\n uiRouter.urlRouterProvider = new UrlRouterProvider(uiRouter);\n\n// $state service and $stateProvider\n// $urlRouter service and $urlRouterProvider\nconst getStateProvider = () =>\n extend(router.stateProvider, { $get: () => router.stateService });\n\nwatchDigests.$inject = ['$rootScope'];\nexport function watchDigests($rootScope: IRootScopeService) {\n $rootScope.$watch(function() { trace.approximateDigests++; });\n}\n\nmod_init .provider('$uiRouter', $uiRouterProvider);\nmod_rtr .provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]);\nmod_util .provider('$urlService', getProviderFor('urlService'));\nmod_util .provider('$urlMatcherFactory', ['$uiRouterProvider', () => router.urlMatcherFactory]);\nmod_util .provider('$templateFactory', () => new TemplateFactory());\nmod_state.provider('$stateRegistry', getProviderFor('stateRegistry'));\nmod_state.provider('$uiRouterGlobals', getProviderFor('globals'));\nmod_state.provider('$transitions', getProviderFor('transitionService'));\nmod_state.provider('$state', ['$uiRouterProvider', getStateProvider]);\n\nmod_state.factory ('$stateParams', ['$uiRouter', ($uiRouter: UIRouter) => $uiRouter.globals.params]);\nmod_main .factory ('$view', () => router.viewService);\nmod_main .service ('$trace', () => trace);\n\nmod_main .run (watchDigests);\nmod_util .run (['$urlMatcherFactory', function ($urlMatcherFactory: UrlMatcherFactory) { }]);\nmod_state.run (['$state', function ($state: StateService) { }]);\nmod_rtr .run (['$urlRouter', function ($urlRouter: UrlRouter) { }]);\nmod_init .run (runBlock);\n\n/** @hidden TODO: find a place to move this */\nexport const getLocals = (ctx: ResolveContext): TypedMap => {\n const tokens = ctx.getTokens().filter(isString);\n\n const tuples = tokens .map(key => {\n const resolvable = ctx.getResolvable(key);\n const waitPolicy = ctx.getPolicy(resolvable).async;\n return [ key, waitPolicy === 'NOWAIT' ? resolvable.promise : resolvable.data ];\n });\n\n return tuples.reduce(applyPairs, {});\n};\n\n", + "/**\n * # Angular 1 Directives\n *\n * These are the directives included in UI-Router for Angular 1.\n * These directives are used in templates to create viewports and link/navigate to states.\n *\n * @ng1api\n * @preferred\n * @module directives\n */ /** for typedoc */\nimport { ng as angular } from '../angular';\nimport { IAugmentedJQuery, ITimeoutService, IScope, IInterpolateService } from 'angular';\n\nimport {\n Obj, extend, forEach, tail, isString, isObject, isArray, parse, noop, unnestR, identity, uniqR, inArray, removeFrom,\n RawParams, PathNode, StateOrName, StateService, StateDeclaration, UIRouter,\n} from '@uirouter/core';\nimport { UIViewData } from './viewDirective';\nimport EventHandler = JQuery.EventHandler;\n\n/** @hidden Used for typedoc */\nexport interface ng1_directive {} // tslint:disable-line:class-name\n\n/** @hidden */\nfunction parseStateRef(ref: string) {\n let parsed;\n const paramsOnly = ref.match(/^\\s*({[^}]*})\\s*$/);\n if (paramsOnly) ref = '(' + paramsOnly[1] + ')';\n\n parsed = ref.replace(/\\n/g, ' ').match(/^\\s*([^(]*?)\\s*(\\((.*)\\))?\\s*$/);\n if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n return { state: parsed[1] || null, paramExpr: parsed[3] || null };\n}\n\n/** @hidden */\nfunction stateContext(el: IAugmentedJQuery) {\n const $uiView: UIViewData = (el.parent() as IAugmentedJQuery).inheritedData('$uiView');\n const path: PathNode[] = parse('$cfg.path')($uiView);\n return path ? tail(path).state.name : undefined;\n}\n\n/** @hidden */\nfunction processedDef($state: StateService, $element: IAugmentedJQuery, def: Def): Def {\n const uiState = def.uiState || $state.current.name;\n const uiStateOpts = extend(defaultOpts($element, $state), def.uiStateOpts || {});\n const href = $state.href(uiState, def.uiStateParams, uiStateOpts);\n return { uiState, uiStateParams: def.uiStateParams, uiStateOpts, href };\n}\n\n/** @hidden */\ninterface TypeInfo {\n attr: string;\n isAnchor: boolean;\n clickable: boolean;\n}\n\n/** @hidden */\nfunction getTypeInfo(el: IAugmentedJQuery): TypeInfo {\n // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.\n const isSvg = Object.prototype.toString.call(el.prop('href')) === '[object SVGAnimatedString]';\n const isForm = el[0].nodeName === 'FORM';\n\n return {\n attr: isForm ? 'action' : (isSvg ? 'xlink:href' : 'href'),\n isAnchor: el.prop('tagName').toUpperCase() === 'A',\n clickable: !isForm,\n };\n}\n\n/** @hidden */\nfunction clickHook(el: IAugmentedJQuery, $state: StateService, $timeout: ITimeoutService, type: TypeInfo, getDef: () => Def) {\n return function (e: JQueryMouseEventObject) {\n const button = e.which || e.button, target = getDef();\n\n if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || el.attr('target'))) {\n // HACK: This is to allow ng-clicks to be processed before the transition is initiated:\n const transition = $timeout(function () {\n $state.go(target.uiState, target.uiStateParams, target.uiStateOpts);\n });\n e.preventDefault();\n\n // if the state has no URL, ignore one preventDefault from the
    directive.\n let ignorePreventDefaultCount = type.isAnchor && !target.href ? 1 : 0;\n\n e.preventDefault = function () {\n if (ignorePreventDefaultCount-- <= 0) $timeout.cancel(transition);\n };\n }\n };\n}\n\n/** @hidden */\nfunction defaultOpts(el: IAugmentedJQuery, $state: StateService) {\n return {\n relative: stateContext(el) || $state.$current,\n inherit: true,\n source: 'sref',\n };\n}\n\n/** @hidden */\nfunction bindEvents(element: IAugmentedJQuery, scope: IScope, hookFn: EventHandler, uiStateOpts: any): void {\n let events;\n\n if (uiStateOpts) {\n events = uiStateOpts.events;\n }\n\n if (!isArray(events)) {\n events = ['click'];\n }\n\n const on = element.on ? 'on' : 'bind';\n for (const event of events) {\n element[on](event, hookFn);\n }\n\n scope.$on('$destroy', function() {\n const off = element.off ? 'off' : 'unbind';\n for (const event of events) {\n element[off](event, hookFn);\n }\n });\n}\n\n/**\n * `ui-sref`: A directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of the `ui-sref` is the name of the state to link to.\n *\n * #### Example:\n * This will activate the `home` state when the link is clicked.\n * ```html\n * Home\n * ```\n *\n * ### Relative Links\n * You can also use relative state paths within `ui-sref`, just like a relative path passed to `$state.go()` ([[StateService.go]]).\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create a relative `ui-sref` which always targets the same destination.\n *\n * #### Example:\n * Both these links are relative to the parent state, even when a child state is currently active.\n * ```html\n * child 1 state\n * child 2 state\n * ```\n *\n * This link activates the parent state.\n * ```html\n * Return\n * ```\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]] method).\n *\n * #### Example:\n * Assuming the `users` state has a url of `/users/`\n * ```html\n * Users\n * ```\n *\n * ### Parameter Values\n * In addition to the state name, a `ui-sref` can include parameter values which are applied when activating the state.\n * Param values can be provided in the `ui-sref` value after the state name, enclosed by parentheses.\n * The content inside the parentheses is an expression, evaluated to the parameter values.\n *\n * #### Example:\n * This example renders a list of links to users.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n *
  • \n * {{ user.displayName }}\n *
  • \n * ```\n *\n * Note:\n * The parameter values expression is `$watch`ed for updates.\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-sref-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n *\n * #### Example:\n * ```html\n * Home\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-sref-opts` attribute.\n *\n * #### Example:\n * ```html\n * \n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Examples\n * If you have the following template:\n *\n * ```html\n * Home\n * About\n * Next page\n *\n * \n * ```\n *\n * Then (assuming the current state is `contacts`) the rendered html including hrefs would be:\n *\n * ```html\n * Home\n * About\n * Next page\n *\n *
      \n *
    • \n * Joe\n *
    • \n *
    • \n * Alice\n *
    • \n *
    • \n * Bob\n *
    • \n *
    \n *\n * Home\n * ```\n *\n * ### Notes\n *\n * - You can use `ui-sref` to change **only the parameter values** by omitting the state name and parentheses.\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * English\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n *\n * - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons).\n * If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive.\n */\nlet uiSrefDirective: ng1_directive;\nuiSrefDirective = ['$uiRouter', '$timeout',\n function $StateRefDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n const $state = $uiRouter.stateService;\n\n return {\n restrict: 'A',\n require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n link: function (scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n const type = getTypeInfo(element);\n const active = uiSrefActive[1] || uiSrefActive[0];\n let unlinkInfoFn: Function = null;\n let hookFn;\n\n const rawDef = {} as Def;\n const getDef = () => processedDef($state, element, rawDef);\n\n const ref = parseStateRef(attrs.uiSref);\n rawDef.uiState = ref.state;\n rawDef.uiStateOpts = attrs.uiSrefOpts ? scope.$eval(attrs.uiSrefOpts) : {};\n\n function update() {\n const def = getDef();\n if (unlinkInfoFn) unlinkInfoFn();\n if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n if (def.href != null) attrs.$set(type.attr, def.href);\n }\n\n if (ref.paramExpr) {\n scope.$watch(ref.paramExpr, function (val) {\n rawDef.uiStateParams = extend({}, val);\n update();\n }, true);\n rawDef.uiStateParams = extend({}, scope.$eval(ref.paramExpr));\n }\n\n update();\n\n scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update));\n scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update));\n\n if (!type.clickable) return;\n hookFn = clickHook(element, $state, $timeout, type, getDef);\n bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n },\n };\n }];\n\n/**\n * `ui-state`: A fully dynamic directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * **This directive is very similar to [[uiSref]], but it `$observe`s and `$watch`es/evaluates all its inputs.**\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of `ui-state` is an expression which is `$watch`ed and evaluated as the state to link to.\n * **This is in contrast with `ui-sref`, which takes a state name as a string literal.**\n *\n * #### Example:\n * Create a list of links.\n * ```html\n *
  • \n * {{ link.displayName }}\n *
  • \n * ```\n *\n * ### Relative Links\n * If the expression evaluates to a relative path, it is processed like [[uiSref]].\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create relative `ui-state` which always targets the same destination.\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]] method).\n *\n * ### Parameter Values\n * In addition to the state name expression, a `ui-state` can include parameter values which are applied when activating the state.\n * Param values should be provided using the `ui-state-params` attribute.\n * The `ui-state-params` attribute value is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * This example renders a list of links with param values.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n *
  • \n * {{ link.displayName }}\n *
  • \n * ```\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-state-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n * The value of the `ui-state-opts` is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * ```html\n * Home\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-state-opts` attribute.\n *\n * #### Example:\n * ```html\n * \n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Notes\n *\n * - You can use `ui-params` to change **only the parameter values** by omitting the state name and supplying only `ui-state-params`.\n * However, it might be simpler to use [[uiSref]] parameter-only links.\n *\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * English\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n * ```\n */\nlet uiStateDirective: ng1_directive;\nuiStateDirective = ['$uiRouter', '$timeout',\n function $StateRefDynamicDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n const $state = $uiRouter.stateService;\n\n return {\n restrict: 'A',\n require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n link: function (scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n const type = getTypeInfo(element);\n const active = uiSrefActive[1] || uiSrefActive[0];\n let unlinkInfoFn: Function = null;\n let hookFn;\n\n const rawDef = {} as Def;\n const getDef = () => processedDef($state, element, rawDef);\n\n const inputAttrs = ['uiState', 'uiStateParams', 'uiStateOpts'];\n const watchDeregFns = inputAttrs.reduce((acc, attr) => (acc[attr] = noop, acc), {});\n\n function update() {\n const def = getDef();\n if (unlinkInfoFn) unlinkInfoFn();\n if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n if (def.href != null) attrs.$set(type.attr, def.href);\n }\n\n inputAttrs.forEach((field) => {\n rawDef[field] = attrs[field] ? scope.$eval(attrs[field]) : null;\n\n attrs.$observe(field, (expr) => {\n watchDeregFns[field]();\n watchDeregFns[field] = scope.$watch(expr, (newval) => {\n rawDef[field] = newval;\n update();\n }, true);\n });\n });\n\n update();\n\n scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update));\n scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update));\n\n if (!type.clickable) return;\n hookFn = clickHook(element, $state, $timeout, type, getDef);\n bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n },\n };\n }];\n\n\n/**\n * `ui-sref-active` and `ui-sref-active-eq`: A directive that adds a CSS class when a `ui-sref` is active\n *\n * A directive working alongside [[uiSref]] and [[uiState]] to add classes to an element when the\n * related directive's state is active (and remove them when it is inactive).\n *\n * The primary use-case is to highlight the active link in navigation menus,\n * distinguishing it from the inactive menu items.\n *\n * ### Linking to a `ui-sref` or `ui-state`\n * `ui-sref-active` can live on the same element as `ui-sref`/`ui-state`, or it can be on a parent element.\n * If a `ui-sref-active` is a parent to more than one `ui-sref`/`ui-state`, it will apply the CSS class when **any of the links are active**.\n *\n * ### Matching\n *\n * The `ui-sref-active` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state **or any child state is active**.\n * This is a \"fuzzy match\" which uses [[StateService.includes]].\n *\n * The `ui-sref-active-eq` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state is directly active (not when child states are active).\n * This is an \"exact match\" which uses [[StateService.is]].\n *\n * ### Parameter values\n * If the `ui-sref`/`ui-state` includes parameter values, the current parameter values must match the link's values for the link to be highlighted.\n * This allows a list of links to the same state with different parameters to be rendered, and the correct one highlighted.\n *\n * #### Example:\n * ```html\n *
  • \n * {{ user.lastName }}\n *
  • \n * ```\n *\n * ### Examples\n *\n * Given the following template:\n * #### Example:\n * ```html\n * \n * ```\n *\n * When the app state is `app.user` (or any child state),\n * and contains the state parameter \"user\" with value \"bilbobaggins\",\n * the resulting HTML will appear as (note the 'active' class):\n *\n * ```html\n * \n * ```\n *\n * ### Glob mode\n *\n * It is possible to pass `ui-sref-active` an expression that evaluates to an object.\n * The objects keys represent active class names and values represent the respective state names/globs.\n * `ui-sref-active` will match if the current active state **includes** any of\n * the specified state names/globs, even the abstract ones.\n *\n * #### Example:\n * Given the following template, with \"admin\" being an abstract state:\n * ```html\n *
    \n * Roles\n *
    \n * ```\n *\n * When the current state is \"admin.roles\" the \"active\" class will be applied to both the `
    ` and `` elements.\n * It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`.\n *\n * ### Notes:\n *\n * - The class name is interpolated **once** during the directives link time (any further changes to the\n * interpolated value are ignored).\n *\n * - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'`\n */\nlet uiSrefActiveDirective: ng1_directive;\nuiSrefActiveDirective = ['$state', '$stateParams', '$interpolate', '$uiRouter',\n function $StateRefActiveDirective($state: StateService, $stateParams: Obj, $interpolate: IInterpolateService, $uiRouter: UIRouter) {\n return {\n restrict: 'A',\n controller: ['$scope', '$element', '$attrs',\n function ($scope: IScope, $element: IAugmentedJQuery, $attrs: any) {\n const states: StateData[] = [];\n let activeEqClass: string;\n let uiSrefActive: any;\n\n // There probably isn't much point in $observing this\n // uiSrefActive and uiSrefActiveEq share the same directive object with some\n // slight difference in logic routing\n activeEqClass = $interpolate($attrs.uiSrefActiveEq || '', false)($scope);\n\n try {\n uiSrefActive = $scope.$eval($attrs.uiSrefActive);\n } catch (e) {\n // Do nothing. uiSrefActive is not a valid expression.\n // Fall back to using $interpolate below\n }\n uiSrefActive = uiSrefActive || $interpolate($attrs.uiSrefActive || '', false)($scope);\n if (isObject(uiSrefActive)) {\n forEach(uiSrefActive, function (stateOrName: StateOrName, activeClass: string) {\n if (isString(stateOrName)) {\n const ref = parseStateRef(stateOrName);\n addState(ref.state, $scope.$eval(ref.paramExpr), activeClass);\n }\n });\n }\n\n // Allow uiSref to communicate with uiSrefActive[Equals]\n this.$$addStateInfo = function (newState: string, newParams: Obj) {\n // we already got an explicit state provided by ui-sref-active, so we\n // shadow the one that comes from ui-sref\n if (isObject(uiSrefActive) && states.length > 0) {\n return;\n }\n const deregister = addState(newState, newParams, uiSrefActive);\n update();\n return deregister;\n };\n\n function updateAfterTransition(trans) {\n trans.promise.then(update, noop);\n }\n\n $scope.$on('$stateChangeSuccess', update);\n $scope.$on('$destroy', $uiRouter.transitionService.onStart({}, updateAfterTransition));\n if ($uiRouter.globals.transition) {\n updateAfterTransition($uiRouter.globals.transition);\n }\n\n function addState(stateName: string, stateParams: Obj, activeClass: string) {\n const state = $state.get(stateName, stateContext($element));\n\n const stateInfo = {\n state: state || { name: stateName },\n params: stateParams,\n activeClass: activeClass,\n };\n\n states.push(stateInfo);\n\n return function removeState() {\n removeFrom(states)(stateInfo);\n };\n }\n\n // Update route state\n function update() {\n const splitClasses = str =>\n str.split(/\\s/).filter(identity);\n const getClasses = (stateList: StateData[]) =>\n stateList.map(x => x.activeClass).map(splitClasses).reduce(unnestR, []);\n\n const allClasses = getClasses(states).concat(splitClasses(activeEqClass)).reduce(uniqR, []);\n const fuzzyClasses = getClasses(states.filter(x => $state.includes(x.state.name, x.params)));\n const exactlyMatchesAny = !!states.filter(x => $state.is(x.state.name, x.params)).length;\n const exactClasses = exactlyMatchesAny ? splitClasses(activeEqClass) : [];\n\n const addClasses = fuzzyClasses.concat(exactClasses).reduce(uniqR, []);\n const removeClasses = allClasses.filter(cls => !inArray(addClasses, cls));\n\n $scope.$evalAsync(() => {\n addClasses.forEach(className => $element.addClass(className));\n removeClasses.forEach(className => $element.removeClass(className));\n });\n }\n\n update();\n }],\n };\n }];\n\n/** @hidden */\ninterface Def { uiState: string; href: string; uiStateParams: Obj; uiStateOpts: any; }\n/** @hidden */\ninterface StateData { state: StateDeclaration; params: RawParams; activeClass: string; }\n\nangular.module('ui.router.state')\n .directive('uiSref', uiSrefDirective)\n .directive('uiSrefActive', uiSrefActiveDirective)\n .directive('uiSrefActiveEq', uiSrefActiveDirective)\n .directive('uiState', uiStateDirective);\n", + "/** @module ng1 */ /** for typedoc */\n\nimport { ng as angular } from './angular';\nimport { Obj, StateService, StateOrName } from '@uirouter/core';\n\n/**\n * `isState` Filter: truthy if the current state is the parameter\n *\n * Translates to [[StateService.is]] `$state.is(\"stateName\")`.\n *\n * #### Example:\n * ```html\n *
    show if state is 'stateName'
    \n * ```\n */\n$IsStateFilter.$inject = ['$state'];\nexport function $IsStateFilter($state: StateService) {\n const isFilter: any = function(state: StateOrName, params: Obj, options?: { relative?: StateOrName }) {\n return $state.is(state, params, options);\n };\n isFilter.$stateful = true;\n return isFilter;\n}\n\n/**\n * `includedByState` Filter: truthy if the current state includes the parameter\n *\n * Translates to [[StateService.includes]]` $state.is(\"fullOrPartialStateName\")`.\n *\n * #### Example:\n * ```html\n *
    show if state includes 'fullOrPartialStateName'
    \n * ```\n */\n$IncludedByStateFilter.$inject = ['$state'];\nexport function $IncludedByStateFilter($state: StateService) {\n const includesFilter: any = function(state: StateOrName, params: Obj, options: { relative?: StateOrName }) {\n return $state.includes(state, params, options);\n };\n includesFilter.$stateful = true;\n return includesFilter;\n}\n\nangular.module('ui.router.state')\n .filter('isState', $IsStateFilter)\n .filter('includedByState', $IncludedByStateFilter);\n", + "/**\n * @ng1api\n * @module directives\n */ /** for typedoc */\nimport { ng as angular } from '../angular';\nimport { IInterpolateService, IScope, ITranscludeFunction, IAugmentedJQuery, ITimeoutService } from 'angular';\n\nimport {\n extend, unnestR, filter, tail, isDefined, isFunction, isString, trace, parse,\n ActiveUIView, TransitionService, ResolveContext, Transition, PathNode, StateDeclaration,\n Param, kebobString, HookRegOptions, ViewService, $QLike, Obj, TypedMap, noop,\n} from '@uirouter/core';\nimport { Ng1ViewConfig } from '../statebuilders/views';\nimport { Ng1Controller, Ng1StateDeclaration } from '../interface';\nimport { getLocals } from '../services';\nimport { ng1_directive } from './stateDirectives';\n\n/** @hidden */\nexport type UIViewData = {\n $cfg: Ng1ViewConfig;\n $uiView: ActiveUIView;\n};\n\n/** @hidden */\nexport type UIViewAnimData = {\n $animEnter: Promise;\n $animLeave: Promise;\n $$animLeave: { resolve: () => any; } // \"deferred\"\n};\n\n/**\n * `ui-view`: A viewport directive which is filled in by a view from the active state.\n *\n * ### Attributes\n *\n * - `name`: (Optional) A view name.\n * The name should be unique amongst the other views in the same state.\n * You can have views of the same name that live in different states.\n * The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]).\n *\n * - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated.\n * Uses [[$uiViewScroll]] to do the scrolling.\n *\n * - `onload`: Expression to evaluate whenever the view updates.\n *\n * #### Example:\n * A view can be unnamed or named.\n * ```html\n * \n *
    \n *\n * \n *
    \n *\n * \n * \n * ```\n *\n * You can only have one unnamed view within any template (or root html). If you are only using a\n * single view and it is unnamed then you can populate it like so:\n *\n * ```html\n *
    \n * $stateProvider.state(\"home\", {\n * template: \"

    HELLO!

    \"\n * })\n * ```\n *\n * The above is a convenient shortcut equivalent to specifying your view explicitly with the\n * [[Ng1StateDeclaration.views]] config property, by name, in this case an empty name:\n *\n * ```js\n * $stateProvider.state(\"home\", {\n * views: {\n * \"\": {\n * template: \"

    HELLO!

    \"\n * }\n * }\n * })\n * ```\n *\n * But typically you'll only use the views property if you name your view or have more than one view\n * in the same template. There's not really a compelling reason to name a view if its the only one,\n * but you could if you wanted, like so:\n *\n * ```html\n *
    \n * ```\n *\n * ```js\n * $stateProvider.state(\"home\", {\n * views: {\n * \"main\": {\n * template: \"

    HELLO!

    \"\n * }\n * }\n * })\n * ```\n *\n * Really though, you'll use views to set up multiple views:\n *\n * ```html\n *
    \n *
    \n *
    \n * ```\n *\n * ```js\n * $stateProvider.state(\"home\", {\n * views: {\n * \"\": {\n * template: \"

    HELLO!

    \"\n * },\n * \"chart\": {\n * template: \"\"\n * },\n * \"data\": {\n * template: \"\"\n * }\n * }\n * })\n * ```\n *\n * #### Examples for `autoscroll`:\n * ```html\n * \n * \n *\n * \n * \n * \n * \n * ```\n *\n * Resolve data:\n *\n * The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this\n * can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template.\n *\n * Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the\n * controller is instantiated. The `$onInit()` hook can be used to perform initialization code which\n * depends on `$resolve` data.\n *\n * #### Example:\n * ```js\n * $stateProvider.state('home', {\n * template: '',\n * resolve: {\n * user: function(UserService) { return UserService.fetchUser(); }\n * }\n * });\n * ```\n */\nexport let uiView: ng1_directive;\nuiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q',\nfunction $ViewDirective($view: ViewService, $animate: any, $uiViewScroll: any, $interpolate: IInterpolateService, $q: $QLike) {\n\n function getRenderer(attrs: Obj, scope: IScope) {\n return {\n enter: function(element: JQuery, target: any, cb: Function) {\n if (angular.version.minor > 2) {\n $animate.enter(element, null, target).then(cb);\n } else {\n $animate.enter(element, null, target, cb);\n }\n },\n leave: function(element: JQuery, cb: Function) {\n if (angular.version.minor > 2) {\n $animate.leave(element).then(cb);\n } else {\n $animate.leave(element, cb);\n }\n },\n };\n }\n\n function configsEqual(config1: Ng1ViewConfig, config2: Ng1ViewConfig) {\n return config1 === config2;\n }\n\n const rootData = {\n $cfg: { viewDecl: { $context: $view._pluginapi._rootViewContext() } },\n $uiView: { },\n };\n\n const directive = {\n count: 0,\n restrict: 'ECA',\n terminal: true,\n priority: 400,\n transclude: 'element',\n compile: function (tElement: JQuery, tAttrs: Obj, $transclude: ITranscludeFunction) {\n\n return function (scope: IScope, $element: IAugmentedJQuery, attrs: Obj) {\n const onloadExp = attrs['onload'] || '',\n autoScrollExp = attrs['autoscroll'],\n renderer = getRenderer(attrs, scope),\n inherited = $element.inheritedData('$uiView') || rootData,\n name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default';\n\n let previousEl: JQuery,\n currentEl: JQuery,\n currentScope: IScope,\n viewConfig: Ng1ViewConfig,\n unregister: Function;\n\n const activeUIView: ActiveUIView = {\n $type: 'ng1',\n id: directive.count++, // Global sequential ID for ui-view tags added to DOM\n name: name, // ui-view name (
    \n fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + '.' + name : name, // fully qualified name, describes location in DOM\n config: null, // The ViewConfig loaded (from a state.views definition)\n configUpdated: configUpdatedCallback, // Called when the matching ViewConfig changes\n get creationContext() { // The context in which this ui-view \"tag\" was created\n const fromParentTagConfig = parse('$cfg.viewDecl.$context')(inherited);\n // Allow \n // See https://github.com/angular-ui/ui-router/issues/3355\n const fromParentTag = parse('$uiView.creationContext')(inherited);\n return fromParentTagConfig || fromParentTag;\n },\n };\n\n trace.traceUIViewEvent('Linking', activeUIView);\n\n function configUpdatedCallback(config?: Ng1ViewConfig) {\n if (config && !(config instanceof Ng1ViewConfig)) return;\n if (configsEqual(viewConfig, config)) return;\n trace.traceUIViewConfigUpdated(activeUIView, config && config.viewDecl && config.viewDecl.$context);\n\n viewConfig = config;\n updateView(config);\n }\n\n $element.data('$uiView', { $uiView: activeUIView });\n\n updateView();\n\n unregister = $view.registerUIView(activeUIView);\n scope.$on('$destroy', function() {\n trace.traceUIViewEvent('Destroying/Unregistering', activeUIView);\n unregister();\n });\n\n function cleanupLastView() {\n if (previousEl) {\n trace.traceUIViewEvent('Removing (previous) el', previousEl.data('$uiView'));\n previousEl.remove();\n previousEl = null;\n }\n\n if (currentScope) {\n trace.traceUIViewEvent('Destroying scope', activeUIView);\n currentScope.$destroy();\n currentScope = null;\n }\n\n if (currentEl) {\n const _viewData = currentEl.data('$uiViewAnim');\n trace.traceUIViewEvent('Animate out', _viewData);\n renderer.leave(currentEl, function() {\n _viewData.$$animLeave.resolve();\n previousEl = null;\n });\n\n previousEl = currentEl;\n currentEl = null;\n }\n }\n\n function updateView(config?: Ng1ViewConfig) {\n const newScope = scope.$new();\n const animEnter = $q.defer(), animLeave = $q.defer();\n\n const $uiViewData: UIViewData = {\n $cfg: config,\n $uiView: activeUIView,\n };\n\n const $uiViewAnim: UIViewAnimData = {\n $animEnter: animEnter.promise,\n $animLeave: animLeave.promise,\n $$animLeave: animLeave,\n };\n\n /**\n * @ngdoc event\n * @name ui.router.state.directive:ui-view#$viewContentLoading\n * @eventOf ui.router.state.directive:ui-view\n * @eventType emits on ui-view directive scope\n * @description\n *\n * Fired once the view **begins loading**, *before* the DOM is rendered.\n *\n * @param {Object} event Event object.\n * @param {string} viewName Name of the view.\n */\n newScope.$emit('$viewContentLoading', name);\n\n const cloned = $transclude(newScope, function(clone) {\n clone.data('$uiViewAnim', $uiViewAnim);\n clone.data('$uiView', $uiViewData);\n renderer.enter(clone, $element, function onUIViewEnter() {\n animEnter.resolve();\n if (currentScope) currentScope.$emit('$viewContentAnimationEnded');\n\n if (isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {\n $uiViewScroll(clone);\n }\n });\n\n cleanupLastView();\n });\n\n currentEl = cloned;\n currentScope = newScope;\n /**\n * @ngdoc event\n * @name ui.router.state.directive:ui-view#$viewContentLoaded\n * @eventOf ui.router.state.directive:ui-view\n * @eventType emits on ui-view directive scope\n * @description *\n * Fired once the view is **loaded**, *after* the DOM is rendered.\n *\n * @param {Object} event Event object.\n */\n currentScope.$emit('$viewContentLoaded', config || viewConfig);\n currentScope.$eval(onloadExp);\n }\n };\n },\n };\n\n return directive;\n}];\n\n$ViewDirectiveFill.$inject = ['$compile', '$controller', '$transitions', '$view', '$q', '$timeout'];\n/** @hidden */\nfunction $ViewDirectiveFill($compile: angular.ICompileService,\n $controller: angular.IControllerService,\n $transitions: TransitionService,\n $view: ViewService,\n $q: angular.IQService,\n $timeout: ITimeoutService) {\n const getControllerAs = parse('viewDecl.controllerAs');\n const getResolveAs = parse('viewDecl.resolveAs');\n\n return {\n restrict: 'ECA',\n priority: -400,\n compile: function (tElement: JQuery) {\n const initial = tElement.html();\n tElement.empty();\n\n return function (scope: IScope, $element: JQuery) {\n const data: UIViewData = $element.data('$uiView');\n if (!data) {\n $element.html(initial);\n $compile($element.contents() as any)(scope);\n return;\n }\n\n const cfg: Ng1ViewConfig = data.$cfg || { viewDecl: {}, getTemplate: noop };\n const resolveCtx: ResolveContext = cfg.path && new ResolveContext(cfg.path);\n $element.html(cfg.getTemplate($element, resolveCtx) || initial);\n trace.traceUIViewFill(data.$uiView, $element.html());\n\n const link = $compile($element.contents() as any);\n const controller = cfg.controller;\n const controllerAs: string = getControllerAs(cfg);\n const resolveAs: string = getResolveAs(cfg);\n const locals = resolveCtx && getLocals(resolveCtx);\n\n scope[resolveAs] = locals;\n\n if (controller) {\n const controllerInstance = $controller(controller, extend({}, locals, { $scope: scope, $element: $element }));\n if (controllerAs) {\n scope[controllerAs] = controllerInstance;\n scope[controllerAs][resolveAs] = locals;\n }\n\n // TODO: Use $view service as a central point for registering component-level hooks\n // Then, when a component is created, tell the $view service, so it can invoke hooks\n // $view.componentLoaded(controllerInstance, { $scope: scope, $element: $element });\n // scope.$on('$destroy', () => $view.componentUnloaded(controllerInstance, { $scope: scope, $element: $element }));\n\n $element.data('$ngControllerController', controllerInstance);\n $element.children().data('$ngControllerController', controllerInstance);\n\n registerControllerCallbacks($q, $transitions, controllerInstance, scope, cfg);\n }\n\n // Wait for the component to appear in the DOM\n if (isString(cfg.viewDecl.component)) {\n const cmp = cfg.viewDecl.component;\n const kebobName = kebobString(cmp);\n const tagRegexp = new RegExp(`^(x-|data-)?${kebobName}$`, 'i');\n\n const getComponentController = () => {\n const directiveEl = [].slice.call($element[0].children)\n .filter((el: Element) => el && el.tagName && tagRegexp.exec(el.tagName)) ;\n\n return directiveEl && angular.element(directiveEl).data(`$${cmp}Controller`);\n };\n\n const deregisterWatch = scope.$watch(getComponentController, function(ctrlInstance) {\n if (!ctrlInstance) return;\n registerControllerCallbacks($q, $transitions, ctrlInstance, scope, cfg);\n deregisterWatch();\n });\n }\n\n link(scope);\n };\n },\n };\n}\n\n/** @hidden */\nconst hasComponentImpl = typeof (angular as any).module('ui.router')['component'] === 'function';\n/** @hidden incrementing id */\nlet _uiCanExitId = 0;\n\n/** @hidden TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */\nfunction registerControllerCallbacks($q: angular.IQService,\n $transitions: TransitionService,\n controllerInstance: Ng1Controller,\n $scope: IScope,\n cfg: Ng1ViewConfig) {\n // Call $onInit() ASAP\n if (isFunction(controllerInstance.$onInit) && !(cfg.viewDecl.component && hasComponentImpl)) {\n controllerInstance.$onInit();\n }\n\n const viewState: Ng1StateDeclaration = tail(cfg.path).state.self;\n\n const hookOptions: HookRegOptions = { bind: controllerInstance };\n // Add component-level hook for onParamsChange\n if (isFunction(controllerInstance.uiOnParamsChanged)) {\n const resolveContext: ResolveContext = new ResolveContext(cfg.path);\n const viewCreationTrans = resolveContext.getResolvable('$transition$').data;\n\n // Fire callback on any successful transition\n const paramsUpdated = ($transition$: Transition) => {\n // Exit early if the $transition$ is the same as the view was created within.\n // Exit early if the $transition$ will exit the state the view is for.\n if ($transition$ === viewCreationTrans || $transition$.exiting().indexOf(viewState as StateDeclaration) !== -1) return;\n\n const toParams = $transition$.params('to') as TypedMap;\n const fromParams = $transition$.params>('from') as TypedMap;\n const toSchema: Param[] = $transition$.treeChanges().to.map((node: PathNode) => node.paramSchema).reduce(unnestR, []);\n const fromSchema: Param[] = $transition$.treeChanges().from.map((node: PathNode) => node.paramSchema).reduce(unnestR, []);\n\n // Find the to params that have different values than the from params\n const changedToParams = toSchema.filter((param: Param) => {\n const idx = fromSchema.indexOf(param);\n return idx === -1 || !fromSchema[idx].type.equals(toParams[param.id], fromParams[param.id]);\n });\n\n // Only trigger callback if a to param has changed or is new\n if (changedToParams.length) {\n const changedKeys: string[] = changedToParams.map(x => x.id);\n // Filter the params to only changed/new to params. `$transition$.params()` may be used to get all params.\n const newValues = filter(toParams, (val, key) => changedKeys.indexOf(key) !== -1);\n controllerInstance.uiOnParamsChanged(newValues, $transition$);\n }\n };\n $scope.$on('$destroy', $transitions.onSuccess({}, paramsUpdated, hookOptions));\n }\n\n // Add component-level hook for uiCanExit\n if (isFunction(controllerInstance.uiCanExit)) {\n const id = _uiCanExitId++;\n const cacheProp = '_uiCanExitIds';\n\n // Returns true if a redirect transition already answered truthy\n const prevTruthyAnswer = (trans: Transition) =>\n !!trans && (trans[cacheProp] && trans[cacheProp][id] === true || prevTruthyAnswer(trans.redirectedFrom()));\n\n // If a user answered yes, but the transition was later redirected, don't also ask for the new redirect transition\n const wrappedHook = (trans: Transition) => {\n let promise;\n const ids = trans[cacheProp] = trans[cacheProp] || {};\n\n if (!prevTruthyAnswer(trans)) {\n promise = $q.when(controllerInstance.uiCanExit(trans));\n promise.then(val => ids[id] = (val !== false));\n }\n return promise;\n };\n\n const criteria = { exiting: viewState.name };\n $scope.$on('$destroy', $transitions.onBefore(criteria, wrappedHook, hookOptions));\n }\n}\n\nangular.module('ui.router.state').directive('uiView', uiView);\nangular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);\n", + "/**\n * @hidden\n * @module ng1\n */ /** */\ndeclare var angular;\nimport * as ng_from_import from 'angular';\nconst ng_from_global = angular;\n\nexport const ng = (ng_from_import && ng_from_import.module) ? ng_from_import : ng_from_global;\n", + "/**\n * @coreapi\n * @module core\n */\n/**\n * Matches state names using glob-like pattern strings.\n *\n * Globs can be used in specific APIs including:\n *\n * - [[StateService.is]]\n * - [[StateService.includes]]\n * - The first argument to Hook Registration functions like [[TransitionService.onStart]]\n * - [[HookMatchCriteria]] and [[HookMatchCriterion]]\n *\n * A `Glob` string is a pattern which matches state names.\n * Nested state names are split into segments (separated by a dot) when processing.\n * The state named `foo.bar.baz` is split into three segments ['foo', 'bar', 'baz']\n *\n * Globs work according to the following rules:\n *\n * ### Exact match:\n *\n * The glob `'A.B'` matches the state named exactly `'A.B'`.\n *\n * | Glob |Matches states named|Does not match state named|\n * |:------------|:--------------------|:---------------------|\n * | `'A'` | `'A'` | `'B'` , `'A.C'` |\n * | `'A.B'` | `'A.B'` | `'A'` , `'A.B.C'` |\n * | `'foo'` | `'foo'` | `'FOO'` , `'foo.bar'`|\n *\n * ### Single star (`*`)\n *\n * A single star (`*`) is a wildcard that matches exactly one segment.\n *\n * | Glob |Matches states named |Does not match state named |\n * |:------------|:---------------------|:--------------------------|\n * | `'*'` | `'A'` , `'Z'` | `'A.B'` , `'Z.Y.X'` |\n * | `'A.*'` | `'A.B'` , `'A.C'` | `'A'` , `'A.B.C'` |\n * | `'A.*.*'` | `'A.B.C'` , `'A.X.Y'`| `'A'`, `'A.B'` , `'Z.Y.X'`|\n *\n * ### Double star (`**`)\n *\n * A double star (`'**'`) is a wildcard that matches *zero or more segments*\n *\n * | Glob |Matches states named |Does not match state named |\n * |:------------|:----------------------------------------------|:----------------------------------|\n * | `'**'` | `'A'` , `'A.B'`, `'Z.Y.X'` | (matches all states) |\n * | `'A.**'` | `'A'` , `'A.B'` , `'A.C.X'` | `'Z.Y.X'` |\n * | `'**.X'` | `'X'` , `'A.X'` , `'Z.Y.X'` | `'A'` , `'A.login.Z'` |\n * | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` |\n *\n */\nexport class Glob {\n text: string;\n glob: Array;\n regexp: RegExp;\n\n /** Returns true if the string has glob-like characters in it */\n static is(text: string) {\n return !!/[!,*]+/.exec(text);\n }\n\n /** Returns a glob from the string, or null if the string isn't Glob-like */\n static fromString(text: string) {\n return Glob.is(text) ? new Glob(text) : null;\n }\n\n constructor(text: string) {\n this.text = text;\n this.glob = text.split('.');\n\n const regexpString = this.text.split('.')\n .map(seg => {\n if (seg === '**') return '(?:|(?:\\\\.[^.]*)*)';\n if (seg === '*') return '\\\\.[^.]*';\n return '\\\\.' + seg;\n }).join('');\n\n this.regexp = new RegExp('^' + regexpString + '$');\n }\n\n matches(name: string) {\n return this.regexp.test('.' + name);\n }\n}\n", + "/**\n * @coreapi\n * @module state\n */\n/** for typedoc */\nimport { StateDeclaration, _ViewDeclaration, _StateDeclaration, LazyLoadResult } from './interface';\nimport { defaults, values, find, inherit } from '../common/common';\nimport { propEq } from '../common/hof';\nimport { Param } from '../params/param';\nimport { UrlMatcher } from '../url/urlMatcher';\nimport { Resolvable } from '../resolve/resolvable';\nimport { TransitionStateHookFn } from '../transition/interface';\nimport { TargetState } from './targetState';\nimport { Transition } from '../transition/transition';\nimport { Glob } from '../common/glob';\nimport { isObject, isFunction } from '../common/predicates';\n\n/**\n * Internal representation of a UI-Router state.\n *\n * Instances of this class are created when a [[StateDeclaration]] is registered with the [[StateRegistry]].\n *\n * A registered [[StateDeclaration]] is augmented with a getter ([[StateDeclaration.$$state]]) which returns the corresponding [[StateObject]] object.\n *\n * This class prototypally inherits from the corresponding [[StateDeclaration]].\n * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]].\n */\nexport class StateObject {\n /** The parent [[StateObject]] */\n public parent: StateObject;\n\n /** The name used to register the state */\n public name: string;\n\n /** Prototypally inherits from [[StateDeclaration.abstract]] */\n public abstract: boolean;\n\n /** Prototypally inherits from [[StateDeclaration.resolve]] */\n public resolve: ({ [key: string]: (string|any[]|Function) }|any[]);\n\n /** A list of [[Resolvable]] objects. The internal representation of [[resolve]]. */\n public resolvables: Resolvable[];\n\n /** Prototypally inherits from [[StateDeclaration.resolvePolicy]] */\n public resolvePolicy: any;\n\n /** A compiled URLMatcher which detects when the state's URL is matched */\n public url: UrlMatcher;\n\n /** The parameters for the state, built from the URL and [[StateDeclaration.params]] */\n public params: { [key: string]: Param };\n\n /**\n * The views for the state.\n * Note: `@uirouter/core` does not register a builder for views.\n * The framework specific code should register a `views` builder.\n */\n public views: { [key: string]: _ViewDeclaration; };\n\n /**\n * The original [[StateDeclaration]] used to build this [[StateObject]].\n * Note: `this` object also prototypally inherits from the `self` declaration object.\n */\n public self: StateDeclaration;\n\n /** The nearest parent [[StateObject]] which has a URL */\n public navigable: StateObject;\n\n /** The parent [[StateObject]] objects from this state up to the root */\n public path: StateObject[];\n\n /**\n * Prototypally inherits from [[StateDeclaration.data]]\n * Note: This is the only field on the [[StateDeclaration]] which is mutated.\n * The definition object's `data` field is replaced with a new object\n * which prototypally inherits from the parent state definition's `data` field.\n */\n public data: any;\n\n /**\n * An object containing the parent States' names as keys and\n * true as their values.\n */\n public includes: { [name: string]: boolean };\n\n /** Prototypally inherits from [[StateDeclaration.onExit]] */\n public onExit: TransitionStateHookFn;\n /** Prototypally inherits from [[StateDeclaration.onRetain]] */\n public onRetain: TransitionStateHookFn;\n /** Prototypally inherits from [[StateDeclaration.onEnter]] */\n public onEnter: TransitionStateHookFn;\n\n /** Prototypally inherits from [[StateDeclaration.lazyLoad]] */\n public lazyLoad: (transition: Transition, state: StateDeclaration) => Promise;\n\n /** Prototypally inherits from [[StateDeclaration.redirectTo]] */\n redirectTo: (\n string |\n (($transition$: Transition) => TargetState) |\n { state: (string|StateDeclaration), params: { [key: string]: any }}\n );\n\n /** @hidden */\n __stateObjectCache: {\n /** Might be null */\n nameGlob?: Glob,\n };\n\n /**\n * Create a state object to put the private/internal implementation details onto.\n * The object's prototype chain looks like:\n * (Internal State Object) -> (Copy of State.prototype) -> (State Declaration object) -> (State Declaration's prototype...)\n *\n * @param stateDecl the user-supplied State Declaration\n * @returns {StateObject} an internal State object\n */\n static create(stateDecl: _StateDeclaration): StateObject {\n stateDecl = StateObject.isStateClass(stateDecl) ? new stateDecl() : stateDecl;\n\n const state = inherit(inherit(stateDecl, StateObject.prototype)) as StateObject;\n stateDecl.$$state = () => state;\n state.self = stateDecl;\n state.__stateObjectCache = {\n nameGlob: Glob.fromString(state.name), // might return null\n };\n return state;\n }\n\n /** Predicate which returns true if the object is an class with @State() decorator */\n static isStateClass = (stateDecl: _StateDeclaration): stateDecl is ({ new (): StateDeclaration }) =>\n isFunction(stateDecl) && stateDecl['__uiRouterState'] === true;\n\n /** Predicate which returns true if the object is an internal [[StateObject]] object */\n static isState = (obj: any): obj is StateObject =>\n isObject(obj['__stateObjectCache']);\n\n\n /** @deprecated use State.create() */\n constructor(config?: StateDeclaration) {\n return StateObject.create(config || {});\n }\n\n /**\n * Returns true if the provided parameter is the same state.\n *\n * Compares the identity of the state against the passed value, which is either an object\n * reference to the actual `State` instance, the original definition object passed to\n * `$stateProvider.state()`, or the fully-qualified name.\n *\n * @param ref Can be one of (a) a `State` instance, (b) an object that was passed\n * into `$stateProvider.state()`, (c) the fully-qualified name of a state as a string.\n * @returns Returns `true` if `ref` matches the current `State` instance.\n */\n is(ref: StateObject|StateDeclaration|string): boolean {\n return this === ref || this.self === ref || this.fqn() === ref;\n }\n\n /**\n * @deprecated this does not properly handle dot notation\n * @returns Returns a dot-separated name of the state.\n */\n fqn(): string {\n if (!this.parent || !(this.parent instanceof this.constructor)) return this.name;\n const name = this.parent.fqn();\n return name ? name + '.' + this.name : this.name;\n }\n\n /**\n * Returns the root node of this state's tree.\n *\n * @returns The root of this state's tree.\n */\n root(): StateObject {\n return this.parent && this.parent.root() || this;\n }\n\n /**\n * Gets the state's `Param` objects\n *\n * Gets the list of [[Param]] objects owned by the state.\n * If `opts.inherit` is true, it also includes the ancestor states' [[Param]] objects.\n * If `opts.matchingKeys` exists, returns only `Param`s whose `id` is a key on the `matchingKeys` object\n *\n * @param opts options\n */\n parameters(opts?: { inherit?: boolean, matchingKeys?: any }): Param[] {\n opts = defaults(opts, { inherit: true, matchingKeys: null });\n const inherited = opts.inherit && this.parent && this.parent.parameters() || [];\n return inherited.concat(values(this.params))\n .filter(param => !opts.matchingKeys || opts.matchingKeys.hasOwnProperty(param.id));\n }\n\n /**\n * Returns a single [[Param]] that is owned by the state\n *\n * If `opts.inherit` is true, it also searches the ancestor states` [[Param]]s.\n * @param id the name of the [[Param]] to return\n * @param opts options\n */\n parameter(id: string, opts: { inherit?: boolean } = {}): Param {\n return (\n this.url && this.url.parameter(id, opts) ||\n find(values(this.params), propEq('id', id)) ||\n opts.inherit && this.parent && this.parent.parameter(id)\n );\n }\n\n toString() {\n return this.fqn();\n }\n}\n", + "/**\n * This module is a stub for core services such as Dependency Injection or Browser Location.\n * Core services may be implemented by a specific framework, such as ng1 or ng2, or be pure javascript.\n *\n * @module common\n */\n/** for typedoc */\nimport { IInjectable, Obj } from './common';\nimport { Disposable } from '../interface';\nimport { UrlParts } from '../url/interface';\n\nexport let notImplemented = (fnname: string) => () => {\n throw new Error(`${fnname}(): No coreservices implementation for UI-Router is loaded.`);\n};\n\nconst services: CoreServices = {\n $q: undefined,\n $injector: undefined,\n};\n\nexport interface $QLikeDeferred {\n resolve: (val?: any) => void;\n reject: (reason?: any) => void;\n promise: Promise;\n}\n\nexport interface $QLike {\n when(value?: T | PromiseLike): Promise;\n reject(reason: any): Promise;\n defer(): $QLikeDeferred;\n all(promises: { [key: string]: Promise }): Promise;\n all(promises: Promise[]): Promise;\n}\n\nexport interface $InjectorLike {\n strictDi?: boolean;\n get(token: any): any;\n get(token: any): T;\n has(token: any): boolean;\n invoke(fn: IInjectable, context?: any, locals?: Obj): any;\n annotate(fn: IInjectable, strictDi?: boolean): any[];\n}\n\nexport interface CoreServices {\n $q: $QLike;\n $injector: $InjectorLike;\n}\n\nexport interface LocationServices extends Disposable {\n /**\n * Gets the current url string\n *\n * The URL is normalized using the internal [[path]]/[[search]]/[[hash]] values.\n *\n * For example, the URL may be stored in the hash ([[HashLocationServices]]) or\n * have a base HREF prepended ([[PushStateLocationServices]]).\n *\n * The raw URL in the browser might be:\n *\n * ```\n * http://mysite.com/somepath/index.html#/internal/path/123?param1=foo#anchor\n * ```\n *\n * or\n *\n * ```\n * http://mysite.com/basepath/internal/path/123?param1=foo#anchor\n * ```\n *\n * then this method returns:\n *\n * ```\n * /internal/path/123?param1=foo#anchor\n * ```\n *\n *\n * #### Example:\n * ```js\n * locationServices.url(); // \"/some/path?query=value#anchor\"\n * ```\n *\n * @returns the current value of the url, as a string.\n */\n url(): string;\n\n /**\n * Updates the url, or gets the current url\n *\n * Updates the url, changing it to the value in `newurl`\n *\n * #### Example:\n * ```js\n * locationServices.url(\"/some/path?query=value#anchor\", true);\n * ```\n *\n * @param newurl The new value for the URL.\n * This url should reflect only the new internal [[path]], [[search]], and [[hash]] values.\n * It should not include the protocol, site, port, or base path of an absolute HREF.\n * @param replace When true, replaces the current history entry (instead of appending it) with this new url\n * @param state The history's state object, i.e., pushState (if the LocationServices implementation supports it)\n * @return the url (after potentially being processed)\n */\n url(newurl: string, replace?: boolean, state?: any): string;\n\n /**\n * Gets the path part of the current url\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`\n *\n * @return the path portion of the url\n */\n path(): string;\n\n /**\n * Gets the search part of the current url as an object\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`\n *\n * @return the search (querystring) portion of the url, as an object\n */\n search(): { [key: string]: any };\n\n /**\n * Gets the hash part of the current url\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `anchor`\n *\n * @return the hash (anchor) portion of the url\n */\n hash(): string;\n\n /**\n * Registers a url change handler\n *\n * #### Example:\n * ```js\n * let deregisterFn = locationServices.onChange((evt) => console.log(\"url change\", evt));\n * ```\n *\n * @param callback a function that will be called when the url is changing\n * @return a function that de-registers the callback\n */\n onChange(callback: Function): Function;\n}\n\n/**\n * This service returns the location configuration\n *\n * This service returns information about the location configuration.\n * This service is primarily used when building URLs (e.g., for `hrefs`)\n */\nexport interface LocationConfig extends Disposable {\n /**\n * Gets the port, e.g., `80`\n *\n * @return the port number\n */\n port(): number;\n /**\n * Gets the protocol, e.g., `http`\n *\n * @return the protocol\n */\n protocol(): string;\n /**\n * Gets the host, e.g., `localhost`\n *\n * @return the protocol\n */\n host(): string;\n /**\n * Gets the base Href, e.g., `http://localhost/approot/`\n *\n * @return the application's base href\n */\n baseHref(): string;\n /**\n * Returns true when running in pushstate mode\n *\n * @return true when running in pushstate mode\n */\n html5Mode(): boolean;\n /**\n * Gets the hashPrefix (when not running in pushstate mode)\n *\n * If the current url is `http://localhost/app#!/uirouter/path/#anchor`, it returns `!` which is the prefix for the \"hashbang\" portion.\n *\n * @return the hash prefix\n */\n hashPrefix(): string;\n /**\n * Sets the hashPrefix (when not running in pushstate mode)\n *\n * @return the new hash prefix\n */\n hashPrefix(newprefix: string): string;\n}\n\nexport { services };\n", + "/**\n * @module common\n */ /** for typedoc */\n\nexport class Queue {\n constructor(private _items: T[] = [], private _limit: number = null) { }\n\n enqueue(item: T) {\n const items = this._items;\n items.push(item);\n if (this._limit && items.length > this._limit) items.shift();\n return item;\n }\n\n dequeue(): T {\n if (this.size())\n return this._items.splice(0, 1)[0];\n }\n\n clear(): Array {\n const current = this._items;\n this._items = [];\n return current;\n }\n\n size(): number {\n return this._items.length;\n }\n\n remove(item: T) {\n const idx = this._items.indexOf(item);\n return idx > -1 && this._items.splice(idx, 1)[0];\n }\n\n peekTail(): T {\n return this._items[this._items.length - 1];\n }\n\n peekHead(): T {\n if (this.size())\n return this._items[0];\n }\n}\n", + "/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\n'use strict';\nimport { extend, silentRejection } from '../common/common';\nimport { stringify } from '../common/strings';\nimport { is } from '../common/hof';\n\nexport enum RejectType {\n SUPERSEDED = 2, ABORTED = 3, INVALID = 4, IGNORED = 5, ERROR = 6,\n}\n\n/** @hidden */\nlet id = 0;\n\nexport class Rejection {\n $id = id++;\n type: number;\n message: string;\n detail: any;\n redirected: boolean;\n\n /** Returns true if the obj is a rejected promise created from the `asPromise` factory */\n static isRejectionPromise(obj: any): boolean {\n return obj && (typeof obj.then === 'function') && is(Rejection)(obj._transitionRejection);\n }\n\n /** Returns a Rejection due to transition superseded */\n static superseded(detail?: any, options?: any): Rejection {\n const message = 'The transition has been superseded by a different transition';\n const rejection = new Rejection(RejectType.SUPERSEDED, message, detail);\n if (options && options.redirected) {\n rejection.redirected = true;\n }\n return rejection;\n }\n\n /** Returns a Rejection due to redirected transition */\n static redirected(detail?: any): Rejection {\n return Rejection.superseded(detail, { redirected: true });\n }\n\n /** Returns a Rejection due to invalid transition */\n static invalid(detail?: any): Rejection {\n const message = 'This transition is invalid';\n return new Rejection(RejectType.INVALID, message, detail);\n }\n\n /** Returns a Rejection due to ignored transition */\n static ignored(detail?: any): Rejection {\n const message = 'The transition was ignored';\n return new Rejection(RejectType.IGNORED, message, detail);\n }\n\n /** Returns a Rejection due to aborted transition */\n static aborted(detail?: any): Rejection {\n const message = 'The transition has been aborted';\n return new Rejection(RejectType.ABORTED, message, detail);\n }\n\n /** Returns a Rejection due to aborted transition */\n static errored(detail?: any): Rejection {\n const message = 'The transition errored';\n return new Rejection(RejectType.ERROR, message, detail);\n }\n\n /**\n * Returns a Rejection\n *\n * Normalizes a value as a Rejection.\n * If the value is already a Rejection, returns it.\n * Otherwise, wraps and returns the value as a Rejection (Rejection type: ERROR).\n *\n * @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection.\n */\n static normalize(detail?: Rejection | Error | any): Rejection {\n return is(Rejection)(detail) ? detail : Rejection.errored(detail);\n }\n\n constructor(type: number, message?: string, detail?: any) {\n this.type = type;\n this.message = message;\n this.detail = detail;\n }\n\n toString() {\n const detailString = (d: any) =>\n d && d.toString !== Object.prototype.toString ? d.toString() : stringify(d);\n const detail = detailString(this.detail);\n const { $id, type, message } = this;\n return `Transition Rejection($id: ${$id} type: ${type}, message: ${message}, detail: ${detail})`;\n }\n\n toPromise(): Promise {\n return extend(silentRejection(this), { _transitionRejection: this });\n }\n}\n", + "/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\nimport { StateDeclaration } from '../state/interface';\nimport { Predicate } from '../common/common';\n\nimport { Transition } from './transition';\nimport { StateObject } from '../state/stateObject';\nimport { PathNode } from '../path/pathNode';\nimport { TargetState } from '../state/targetState';\nimport { RegisteredHook } from './hookRegistry';\n\n/**\n * The TransitionOptions object can be used to change the behavior of a transition.\n *\n * It is passed as the third argument to [[StateService.go]], [[StateService.transitionTo]].\n * It can also be used with a `uiSref`.\n */\nexport interface TransitionOptions {\n /**\n * This option changes how the Transition interacts with the browser's location bar (URL).\n *\n * - If `true`, it will update the url in the location bar.\n * - If `false`, it will not update the url in the location bar.\n * - If it is the string `\"replace\"`, it will update the url and also replace the last history record.\n *\n * @default `true`\n */\n location ?: (boolean|string);\n\n /**\n * When transitioning to relative path (e.g '`^`'), this option defines which state to be relative from.\n * @default `$state.current`\n */\n relative ?: (string|StateDeclaration|StateObject);\n\n /**\n * This option sets whether or not the transition's parameter values should be inherited from\n * the current parameter values.\n *\n * - If `true`, it will inherit parameter values from the current parameter values.\n * - If `false`, only the parameters which are provided to `transitionTo` will be used.\n *\n * @default `false`\n */\n inherit ?: boolean;\n\n /**\n * @deprecated\n */\n notify ?: boolean;\n\n /**\n * This option may be used to force states which are currently active to reload.\n *\n * During a normal transition, a state is \"retained\" if:\n * - It was previously active\n * - The state's parameter values have not changed\n * - All the parent states' parameter values have not changed\n *\n * Forcing a reload of a state will cause it to be exited and entered, which will:\n * - Refetch that state's resolve data\n * - Exit the state (onExit hook)\n * - Re-enter the state (onEnter hook)\n * - Re-render the views (controllers and templates)\n *\n * - When `true`, the destination state (and all parent states) will be reloaded.\n * - When it is a string and is the name of a state, or when it is a State object,\n * that state and any children states will be reloaded.\n *\n * @default `false`\n */\n reload ?: (boolean|string|StateDeclaration|StateObject);\n /**\n * You can define your own Transition Options inside this property and use them, e.g., from a Transition Hook\n */\n custom ?: any;\n /** @internalapi */\n reloadState ?: (StateObject);\n /** @internalapi\n * If this transition is a redirect, this property should be the original Transition (which was redirected to this one)\n */\n redirectedFrom?: Transition;\n /** @internalapi */\n current ?: () => Transition;\n /** @internalapi */\n source ?: 'sref' | 'url' | 'redirect' | 'otherwise' | 'unknown';\n}\n\n/** @internalapi */\nexport interface TransitionHookOptions {\n current ?: () => Transition; // path?\n transition ?: Transition;\n hookType ?: string;\n target ?: any;\n traceData ?: any;\n bind ?: any;\n stateHook ?: boolean;\n}\n\n/**\n * TreeChanges encapsulates the various Paths that are involved in a Transition.\n *\n * Get a TreeChanges object using [[Transition.treeChanges]]\n *\n * A UI-Router Transition is from one Path in a State Tree to another Path. For a given Transition,\n * this object stores the \"to\" and \"from\" paths, as well as subsets of those: the \"retained\",\n * \"exiting\" and \"entering\" paths.\n *\n * Each path in TreeChanges is an array of [[PathNode]] objects. Each PathNode in the array corresponds to a portion\n * of a nested state.\n *\n * For example, if you had a nested state named `foo.bar.baz`, it would have three\n * portions, `foo, bar, baz`. If you transitioned **to** `foo.bar.baz` and inspected the [[TreeChanges.to]]\n * Path, you would find a node in the array for each portion: `foo`, `bar`, and `baz`.\n *\n * ---\n *\n * @todo show visual state tree\n */\nexport interface TreeChanges {\n /** @nodoc */\n [key: string]: PathNode[];\n\n /** The path of nodes in the state tree that the transition is coming *from* */\n from: PathNode[];\n\n /** The path of nodes in the state tree that the transition is going *to* */\n to: PathNode[];\n\n /**\n * The path of active nodes that the transition is retaining.\n *\n * These nodes are neither exited, nor entered.\n * Before and after the transition is successful, these nodes are active.\n */\n retained: PathNode[];\n\n /**\n * The path of previously active nodes that the transition is exiting.\n *\n * After the Transition is successful, these nodes are no longer active.\n *\n * Note that a state that is being reloaded (due to parameter values changing, or `reload: true`) may be in both the\n * `exiting` and `entering` paths.\n */\n exiting: PathNode[];\n\n /**\n * The path of nodes that the transition is entering.\n *\n * After the Transition is successful, these nodes will be active.\n * Because they are entering, they have their resolves fetched, `onEnter` hooks run, and their views\n * (component(s) or controller(s)+template(s)) refreshed.\n *\n * Note that a state that is reloaded (due to parameter values changing, or `reload: true`) may be in both the\n * `exiting` and `entering` paths.\n */\n entering: PathNode[];\n}\n\nexport type IHookRegistration = (matchCriteria: HookMatchCriteria, callback: HookFn, options?: HookRegOptions) => Function;\n\n/**\n * The signature for Transition Hooks.\n *\n * Transition hooks are callback functions that hook into the lifecycle of transitions.\n * As a transition runs, it reaches certain lifecycle events.\n * As each event occurs, the hooks which are registered for the event are called (in priority order).\n *\n * A transition hook may alter a Transition by returning a [[HookResult]].\n *\n * #### See:\n *\n * - [[IHookRegistry.onBefore]]\n * - [[IHookRegistry.onStart]]\n * - [[IHookRegistry.onFinish]]\n * - [[IHookRegistry.onSuccess]]\n * - [[IHookRegistry.onError]]\n *\n * @param transition the current [[Transition]]\n * @param injector (for ng1 or ng2 only) the injector service\n *\n * @returns a [[HookResult]] which may alter the transition\n *\n */\nexport interface TransitionHookFn {\n (transition: Transition): HookResult;\n}\n\n/**\n * The signature for Transition State Hooks.\n *\n * A function which hooks into a lifecycle event for a specific state.\n *\n * Transition State Hooks are callback functions that hook into the lifecycle events of specific states during a transition.\n * As a transition runs, it may exit some states, retain (keep) states, and enter states.\n * As each lifecycle event occurs, the hooks which are registered for the event and that state are called (in priority order).\n *\n * #### See:\n *\n * - [[IHookRegistry.onExit]]\n * - [[IHookRegistry.onRetain]]\n * - [[IHookRegistry.onEnter]]\n *\n * @param transition the current [[Transition]]\n * @param state the [[StateObject]] that the hook is bound to\n * @param injector (for ng1 or ng2 only) the injector service\n *\n * @returns a [[HookResult]] which may alter the transition\n */\nexport interface TransitionStateHookFn {\n (transition: Transition, state: StateDeclaration): HookResult;\n}\n\n/**\n * The signature for Transition onCreate Hooks.\n *\n * Transition onCreate Hooks are callbacks that allow customization or preprocessing of\n * a Transition before it is returned from [[TransitionService.create]]\n *\n * @param transition the [[Transition]] that was just created\n * @return a [[Transition]] which will then be returned from [[TransitionService.create]]\n */\nexport interface TransitionCreateHookFn {\n (transition: Transition): void;\n}\n\nexport type HookFn = (TransitionHookFn|TransitionStateHookFn|TransitionCreateHookFn);\n\n/**\n * The return value of a [[TransitionHookFn]] or [[TransitionStateHookFn]]\n *\n * When returned from a [[TransitionHookFn]] or [[TransitionStateHookFn]], these values alter the running [[Transition]]:\n *\n * - `false`: the transition will be cancelled.\n * - [[TargetState]]: the transition will be redirected to the new target state (see: [[StateService.target]])\n * - `Promise`: the transition will wait for the promise to resolve or reject\n * - If the promise is rejected (or resolves to `false`), the transition will be cancelled\n * - If the promise resolves to a [[TargetState]], the transition will be redirected\n * - If the promise resolves to anything else, the transition will resume\n * - Anything else: the transition will resume\n */\nexport type HookResult = (boolean | TargetState | void | Promise);\n\n/**\n * These options may be provided when registering a Transition Hook (such as `onStart`)\n */\nexport interface HookRegOptions {\n /**\n * Sets the priority of the registered hook\n *\n * Hooks of the same type (onBefore, onStart, etc) are invoked in priority order. A hook with a higher priority\n * is invoked before a hook with a lower priority.\n *\n * The default hook priority is 0\n */\n priority?: number;\n\n /**\n * Specifies what `this` is bound to during hook invocation.\n */\n bind?: any;\n\n /**\n * Limits the number of times that the hook will be invoked.\n * Once the hook has been invoked this many times, it is automatically deregistered.\n */\n invokeLimit?: number;\n}\n\n/**\n * This interface specifies the api for registering Transition Hooks. Both the\n * [[TransitionService]] and also the [[Transition]] object itself implement this interface.\n * Note: the Transition object only allows hooks to be registered before the Transition is started.\n */\nexport interface IHookRegistry {\n /** @hidden place to store the hooks */\n _registeredHooks: { [key: string]: RegisteredHook[] };\n\n /**\n * Registers a [[TransitionHookFn]], called *before a transition starts*.\n *\n * Registers a transition lifecycle hook, which is invoked before a transition even begins.\n * This hook can be useful to implement logic which prevents a transition from even starting, such\n * as authentication, redirection\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onBefore` hooks are invoked *before a Transition starts*.\n * No resolves have been fetched yet.\n * Each `onBefore` hook is invoked synchronously, in the same call stack as [[StateService.transitionTo]].\n * The registered `onBefore` hooks are invoked in priority order.\n *\n * Note: during the `onBefore` phase, additional hooks can be added to the specific [[Transition]] instance.\n * These \"on-the-fly\" hooks only affect the currently running transition..\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * If any hook modifies the transition *synchronously* (by throwing, returning `false`, or returning\n * a [[TargetState]]), the remainder of the hooks are skipped.\n * If a hook returns a promise, the remainder of the `onBefore` hooks are still invoked synchronously.\n * All promises are resolved, and processed asynchronously before the `onStart` phase of the Transition.\n *\n * ### Examples\n *\n * #### Default Substate\n *\n * This example redirects any transition from 'home' to 'home.dashboard'. This is commonly referred to as a\n * \"default substate\".\n *\n * @example\n * ```js\n * // ng2\n * transitionService.onBefore({ to: 'home' }, (trans: Transition) =>\n * trans.router.stateService.target(\"home.dashboard\"));\n * ```\n *\n * #### Data Driven Default Substate\n *\n * This example provides data-driven default substate functionality. It matches on a transition to any state\n * which has `defaultSubstate: \"some.sub.state\"` defined. See: [[Transition.to]] which returns the \"to state\"\n * definition.\n *\n * @example\n * ```js\n * // ng1\n * // state declaration\n * {\n * name: 'home',\n * template: '
    ',\n * defaultSubstate: 'home.dashboard'\n * }\n *\n * var criteria = {\n * to: function(state) {\n * return state.defaultSubstate != null;\n * }\n * }\n *\n * $transitions.onBefore(criteria, function(trans: Transition) {\n * var substate = trans.to().defaultSubstate;\n * return trans.router.stateService.target(substate);\n * });\n * ```\n *\n *\n * #### Require authentication\n *\n * This example cancels a transition to a state which requires authentication, if the user is not currently authenticated.\n *\n * This example assumes a state tree where all states which require authentication are children of a parent `'requireauth'` state.\n * This example assumes `MyAuthService` synchronously returns a boolean from `isAuthenticated()`.\n *\n * #### Example:\n * ```js\n * // ng1\n * $transitions.onBefore( { to: 'requireauth.**' }, function(trans) {\n * var myAuthService = trans.injector().get('MyAuthService');\n * // If isAuthenticated returns false, the transition is cancelled.\n * return myAuthService.isAuthenticated();\n * });\n * ```\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be invoked.\n * @returns a function which deregisters the hook.\n */\n onBefore(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called when a transition starts.\n *\n * Registers a transition lifecycle hook, which is invoked as a transition starts running.\n * This hook can be useful to perform some asynchronous action before completing a transition.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onStart` hooks are invoked asynchronously when the Transition starts running.\n * This happens after the `onBefore` phase is complete.\n * At this point, the Transition has not yet exited nor entered any states.\n * The registered `onStart` hooks are invoked in priority order.\n *\n * Note: A built-in `onStart` hook with high priority is used to fetch any eager resolve data.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Example\n *\n * #### Login during transition\n *\n * This example intercepts any transition to a state which requires authentication, when the user is\n * not currently authenticated. It allows the user to authenticate asynchronously, then resumes the\n * transition. If the user did not authenticate successfully, it redirects to the \"guest\" state, which\n * does not require authentication.\n *\n * This example assumes:\n * - a state tree where all states which require authentication are children of a parent `'auth'` state.\n * - `MyAuthService.isAuthenticated()` synchronously returns a boolean.\n * - `MyAuthService.authenticate()` presents a login dialog, and returns a promise which is resolved\n * or rejected, whether or not the login attempt was successful.\n *\n * #### Example:\n * ```js\n * // ng1\n * $transitions.onStart( { to: 'auth.**' }, function(trans) {\n * var $state = trans.router.stateService;\n * var MyAuthService = trans.injector().get('MyAuthService');\n *\n * // If the user is not authenticated\n * if (!MyAuthService.isAuthenticated()) {\n *\n * // Then return a promise for a successful login.\n * // The transition will wait for this promise to settle\n *\n * return MyAuthService.authenticate().catch(function() {\n *\n * // If the authenticate() method failed for whatever reason,\n * // redirect to a 'guest' state which doesn't require auth.\n * return $state.target(\"guest\");\n * });\n * }\n * });\n * ```\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onStart(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is entered.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being entered.\n *\n * Since this hook is run only when the specific state is being *entered*, it can be useful for\n * performing tasks when entering a submodule/feature area such as initializing a stateful service,\n * or for guarding access to a submodule/feature area.\n *\n * See [[TransitionStateHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onEnter` hooks generally specify `{ entering: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onEnter` hooks are invoked when the Transition is entering a state.\n * States are entered after the `onRetain` phase is complete.\n * If more than one state is being entered, the parent state is entered first.\n * The registered `onEnter` hooks for a state are invoked in priority order.\n *\n * Note: A built-in `onEnter` hook with high priority is used to fetch lazy resolve data for states being entered.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onEnter` hooks using the [[TransitionService]], you may define an `onEnter` hook\n * directly on a state declaration (see: [[StateDeclaration.onEnter]]).\n *\n *\n * ### Examples\n *\n * #### Audit Log\n *\n * This example uses a service to log that a user has entered the admin section of an app.\n * This assumes that there are substates of the \"admin\" state, such as \"admin.users\", \"admin.pages\", etc.\n * @example\n * ```\n *\n * $transitions.onEnter({ entering: 'admin' }, function(transition, state) {\n * var AuditService = trans.injector().get('AuditService');\n * AuditService.log(\"Entered \" + state.name + \" module while transitioning to \" + transition.to().name);\n * }\n * ```\n *\n * #### Audit Log (inside a state declaration)\n *\n * The `onEnter` inside this state declaration is syntactic sugar for the previous Audit Log example.\n * ```\n * {\n * name: 'admin',\n * component: 'admin',\n * onEnter: function($transition$, $state$) {\n * var AuditService = $transition$.injector().get('AuditService');\n * AuditService.log(\"Entered \" + state.name + \" module while transitioning to \" + transition.to().name);\n * }\n * }\n * ```\n *\n * Note: A state declaration's `onEnter` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onEnter(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is retained/kept.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) for\n * a specific state that was previously active will remain active (is not being entered nor exited).\n *\n * This hook is invoked when a state is \"retained\" or \"kept\".\n * It means the transition is coming *from* a substate of the retained state *to* a substate of the retained state.\n * This hook can be used to perform actions when the user moves from one substate to another, such as between steps in a wizard.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onRetain` hooks generally specify `{ retained: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onRetain` hooks are invoked after any `onExit` hooks have been fired.\n * If more than one state is retained, the child states' `onRetain` hooks are invoked first.\n * The registered `onRetain` hooks for a state are invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onRetain` hooks using the [[TransitionService]], you may define an `onRetain` hook\n * directly on a state declaration (see: [[StateDeclaration.onRetain]]).\n *\n * Note: A state declaration's `onRetain` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onRetain(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is exited.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being exited.\n *\n * Since this hook is run only when the specific state is being *exited*, it can be useful for\n * performing tasks when leaving a submodule/feature area such as cleaning up a stateful service,\n * or for preventing the user from leaving a state or submodule until some criteria is satisfied.\n *\n * See [[TransitionStateHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onExit` hooks generally specify `{ exiting: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onExit` hooks are invoked when the Transition is exiting a state.\n * States are exited after any `onStart` phase is complete.\n * If more than one state is being exited, the child states are exited first.\n * The registered `onExit` hooks for a state are invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onExit` hooks using the [[TransitionService]], you may define an `onExit` hook\n * directly on a state declaration (see: [[StateDeclaration.onExit]]).\n *\n * Note: A state declaration's `onExit` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onExit(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called *just before a transition finishes*.\n *\n * Registers a transition lifecycle hook, which is invoked just before a transition finishes.\n * This hook is a last chance to cancel or redirect a transition.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onFinish` hooks are invoked after the `onEnter` phase is complete.\n * These hooks are invoked just before the transition is \"committed\".\n * Each hook is invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onFinish(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called after a successful transition completed.\n *\n * Registers a transition lifecycle hook, which is invoked after a transition successfully completes.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onSuccess` hooks are chained off the Transition's promise (see [[Transition.promise]]).\n * If the Transition is successful and its promise is resolved, then the `onSuccess` hooks are invoked.\n * Since these hooks are run after the transition is over, their return value is ignored.\n * The `onSuccess` hooks are invoked in priority order.\n *\n * ### Return value\n *\n * Since the Transition is already completed, the hook's return value is ignored\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onSuccess(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called after a transition has errored.\n *\n * Registers a transition lifecycle hook, which is invoked after a transition has been rejected for any reason.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * The `onError` hooks are chained off the Transition's promise (see [[Transition.promise]]).\n * If a Transition fails, its promise is rejected and the `onError` hooks are invoked.\n * The `onError` hooks are invoked in priority order.\n *\n * Since these hooks are run after the transition is over, their return value is ignored.\n *\n * A transition \"errors\" if it was started, but failed to complete (for any reason).\n * A *non-exhaustive list* of reasons a transition can error:\n *\n * - A transition was cancelled because a new transition started while it was still running (`Transition superseded`)\n * - A transition was cancelled by a Transition Hook returning false\n * - A transition was redirected by a Transition Hook returning a [[TargetState]]\n * - A Transition Hook or resolve function threw an error\n * - A Transition Hook returned a rejected promise\n * - A resolve function returned a rejected promise\n *\n * To check the failure reason, inspect the return value of [[Transition.error]].\n *\n * Note: `onError` should be used for targeted error handling, or error recovery.\n * For simple catch-all error reporting, use [[StateService.defaultErrorHandler]].\n *\n * ### Return value\n *\n * Since the Transition is already completed, the hook's return value is ignored\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onError(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Returns all the registered hooks of a given `hookName` type\n *\n * #### Example:\n * ```\n * $transitions.getHooks(\"onEnter\")\n * ```\n */\n getHooks(hookName: string): RegisteredHook[];\n}\n\n/** A predicate type which tests if a [[StateObject]] passes some test. Returns a boolean. */\nexport type IStateMatch = Predicate;\n\n/**\n * This object is used to configure whether or not a Transition Hook is invoked for a particular transition,\n * based on the Transition's \"to state\" and \"from state\".\n *\n * Each property (`to`, `from`, `exiting`, `retained`, and `entering`) can be a state [[Glob]] string,\n * a boolean, or a function that takes a state and returns a boolean (see [[HookMatchCriterion]])\n *\n * All properties are optional. If any property is omitted, it is replaced with the value `true`, and always matches.\n * To match any transition, use an empty criteria object `{}`.\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from the `parent` state and going to the `parent.child` state.\n * var match = {\n * to: 'parent',\n * from: 'parent.child'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any substate of `parent` and going directly to the `parent` state.\n * var match = {\n * to: 'parent',\n * from: 'parent.**'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any state and going to any substate of `mymodule`\n * var match = {\n * to: 'mymodule.**'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any state and going to any state that has `data.authRequired`\n * // set to a truthy value.\n * var match = {\n * to: function(state) {\n * return state.data != null && state.data.authRequired === true;\n * }\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition that is exiting `parent.child`\n * var match = {\n * exiting: 'parent.child'\n * }\n * ```\n */\nexport interface HookMatchCriteria {\n [key: string]: HookMatchCriterion | undefined;\n\n /** A [[HookMatchCriterion]] to match the destination state */\n to?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match the original (from) state */\n from?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be exiting */\n exiting?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be retained */\n retained?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be entering */\n entering?: HookMatchCriterion;\n}\n\nexport interface IMatchingNodes {\n [key: string]: PathNode[];\n\n to: PathNode[];\n from: PathNode[];\n exiting: PathNode[];\n retained: PathNode[];\n entering: PathNode[];\n}\n\n/** @hidden */\nexport interface RegisteredHooks {\n [key: string]: RegisteredHook[];\n}\n\n/** @hidden */\nexport interface PathTypes {\n [key: string]: PathType;\n\n to: PathType;\n from: PathType;\n exiting: PathType;\n retained: PathType;\n entering: PathType;\n}\n\n/** @hidden */\nexport interface PathType {\n name: string;\n scope: TransitionHookScope;\n}\n\n/**\n * Hook Criterion used to match a transition.\n *\n * A [[Glob]] string that matches the name of a state.\n *\n * Or, a function with the signature `function(state) { return matches; }`\n * which should return a boolean to indicate if a state matches.\n *\n * Or, `true` to always match\n */\nexport type HookMatchCriterion = (string|IStateMatch|boolean);\n\nexport enum TransitionHookPhase { CREATE, BEFORE, RUN, SUCCESS, ERROR }\nexport enum TransitionHookScope { TRANSITION, STATE }\n", + "/**\n * @coreapi\n * @module state\n */ /** for typedoc */\n\nimport { StateDeclaration, StateOrName, TargetStateDef } from './interface';\nimport { TransitionOptions } from '../transition/interface';\nimport { StateObject } from './stateObject';\nimport { isString } from '../common/predicates';\nimport { stringify } from '../common/strings';\nimport { extend } from '../common';\nimport { StateRegistry } from './stateRegistry';\nimport { RawParams } from '../params';\n\n/**\n * Encapsulate the target (destination) state/params/options of a [[Transition]].\n *\n * This class is frequently used to redirect a transition to a new destination.\n *\n * See:\n *\n * - [[HookResult]]\n * - [[TransitionHookFn]]\n * - [[TransitionService.onStart]]\n *\n * To create a `TargetState`, use [[StateService.target]].\n *\n * ---\n *\n * This class wraps:\n *\n * 1) an identifier for a state\n * 2) a set of parameters\n * 3) and transition options\n * 4) the registered state object (the [[StateDeclaration]])\n *\n * Many UI-Router APIs such as [[StateService.go]] take a [[StateOrName]] argument which can\n * either be a *state object* (a [[StateDeclaration]] or [[StateObject]]) or a *state name* (a string).\n * The `TargetState` class normalizes those options.\n *\n * A `TargetState` may be valid (the state being targeted exists in the registry)\n * or invalid (the state being targeted is not registered).\n */\nexport class TargetState {\n private _definition: StateObject;\n private _params: RawParams;\n private _options: TransitionOptions;\n\n /** Returns true if the object has a state property that might be a state or state name */\n static isDef = (obj): obj is TargetStateDef =>\n obj && obj.state && (isString(obj.state) || isString(obj.state.name));\n\n /**\n * The TargetState constructor\n *\n * Note: Do not construct a `TargetState` manually.\n * To create a `TargetState`, use the [[StateService.target]] factory method.\n *\n * @param _stateRegistry The StateRegistry to use to look up the _definition\n * @param _identifier An identifier for a state.\n * Either a fully-qualified state name, or the object used to define the state.\n * @param _params Parameters for the target state\n * @param _options Transition options.\n *\n * @internalapi\n */\n constructor(\n private _stateRegistry: StateRegistry,\n private _identifier: StateOrName,\n _params?: RawParams,\n _options?: TransitionOptions,\n ) {\n this._identifier = _identifier;\n this._params = extend({}, _params || {});\n this._options = extend({}, _options || {});\n this._definition = _stateRegistry.matcher.find(_identifier, this._options.relative);\n }\n\n /** The name of the state this object targets */\n name(): string {\n return this._definition && this._definition.name || this._identifier;\n }\n\n /** The identifier used when creating this TargetState */\n identifier(): StateOrName {\n return this._identifier;\n }\n\n /** The target parameter values */\n params(): RawParams {\n return this._params;\n }\n\n /** The internal state object (if it was found) */\n $state(): StateObject {\n return this._definition;\n }\n\n /** The internal state declaration (if it was found) */\n state(): StateDeclaration {\n return this._definition && this._definition.self;\n }\n\n /** The target options */\n options() {\n return this._options;\n }\n\n /** True if the target state was found */\n exists(): boolean {\n return !!(this._definition && this._definition.self);\n }\n\n /** True if the object is valid */\n valid(): boolean {\n return !this.error();\n }\n\n /** If the object is invalid, returns the reason why */\n error(): string {\n const base = this.options().relative;\n if (!this._definition && !!base) {\n const stateName = base.name ? base.name : base;\n return `Could not resolve '${this.name()}' from state '${stateName}'`;\n }\n if (!this._definition)\n return `No such state '${this.name()}'`;\n if (!this._definition.self)\n return `State '${this.name()}' has an invalid definition`;\n }\n\n toString() {\n return `'${this.name()}'${stringify(this.params())}`;\n }\n\n /**\n * Returns a copy of this TargetState which targets a different state.\n * The new TargetState has the same parameter values and transition options.\n *\n * @param state The new state that should be targeted\n */\n withState(state: StateOrName): TargetState {\n return new TargetState(this._stateRegistry, state, this._params, this._options);\n }\n\n /**\n * Returns a copy of this TargetState, using the specified parameter values.\n *\n * @param params the new parameter values to use\n * @param replace When false (default) the new parameter values will be merged with the current values.\n * When true the parameter values will be used instead of the current values.\n */\n withParams(params: RawParams, replace = false): TargetState {\n const newParams: RawParams = replace ? params : extend({}, this._params, params);\n return new TargetState(this._stateRegistry, this._identifier, newParams, this._options);\n }\n\n /**\n * Returns a copy of this TargetState, using the specified Transition Options.\n *\n * @param options the new options to use\n * @param replace When false (default) the new options will be merged with the current options.\n * When true the options will be used instead of the current options.\n */\n withOptions(options: TransitionOptions, replace = false): TargetState {\n const newOpts = replace ? options : extend({}, this._options, options);\n return new TargetState(this._stateRegistry, this._identifier, this._params, newOpts);\n }\n}\n", + "/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport { TransitionHookOptions, HookResult, TransitionHookPhase } from './interface';\nimport { defaults, noop, silentRejection } from '../common/common';\nimport { fnToString, maxLength } from '../common/strings';\nimport { isPromise } from '../common/predicates';\nimport { is, parse } from '../common/hof';\nimport { trace } from '../common/trace';\nimport { services } from '../common/coreservices';\nimport { Rejection } from './rejectFactory';\nimport { TargetState } from '../state/targetState';\nimport { Transition } from './transition';\nimport { TransitionEventType } from './transitionEventType';\nimport { RegisteredHook } from './hookRegistry';\nimport { StateDeclaration } from '../state/interface';\n\nconst defaultOptions: TransitionHookOptions = {\n current: noop,\n transition: null,\n traceData: {},\n bind: null,\n};\n\nexport type GetResultHandler = (hook: TransitionHook) => ResultHandler;\nexport type GetErrorHandler = (hook: TransitionHook) => ErrorHandler;\n\nexport type ResultHandler = (result: HookResult) => Promise;\nexport type ErrorHandler = (error: any) => Promise;\n\n/** @hidden */\nexport class TransitionHook {\n type: TransitionEventType;\n\n /**\n * These GetResultHandler(s) are used by [[invokeHook]] below\n * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]])\n */\n static HANDLE_RESULT: GetResultHandler = (hook: TransitionHook) => (result: HookResult) =>\n hook.handleHookResult(result);\n\n /**\n * If the result is a promise rejection, log it.\n * Otherwise, ignore the result.\n */\n static LOG_REJECTED_RESULT: GetResultHandler = (hook: TransitionHook) => (result: HookResult) => {\n isPromise(result) && result.catch(err =>\n hook.logError(Rejection.normalize(err)));\n return undefined;\n }\n\n /**\n * These GetErrorHandler(s) are used by [[invokeHook]] below\n * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]])\n */\n static LOG_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) =>\n hook.logError(error);\n\n static REJECT_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) =>\n silentRejection(error);\n\n static THROW_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) => {\n throw error;\n }\n\n /**\n * Chains together an array of TransitionHooks.\n *\n * Given a list of [[TransitionHook]] objects, chains them together.\n * Each hook is invoked after the previous one completes.\n *\n * #### Example:\n * ```js\n * var hooks: TransitionHook[] = getHooks();\n * let promise: Promise = TransitionHook.chain(hooks);\n *\n * promise.then(handleSuccess, handleError);\n * ```\n *\n * @param hooks the list of hooks to chain together\n * @param waitFor if provided, the chain is `.then()`'ed off this promise\n * @returns a `Promise` for sequentially invoking the hooks (in order)\n */\n static chain(hooks: TransitionHook[], waitFor?: Promise): Promise {\n // Chain the next hook off the previous\n const createHookChainR = (prev: Promise, nextHook: TransitionHook) =>\n prev.then(() => nextHook.invokeHook());\n return hooks.reduce(createHookChainR, waitFor || services.$q.when());\n }\n\n\n /**\n * Invokes all the provided TransitionHooks, in order.\n * Each hook's return value is checked.\n * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned.\n * If no hook returns a promise, then all hooks are processed synchronously.\n *\n * @param hooks the list of TransitionHooks to invoke\n * @param doneCallback a callback that is invoked after all the hooks have successfully completed\n *\n * @returns a promise for the async result, or the result of the callback\n */\n static invokeHooks(hooks: TransitionHook[], doneCallback: (result?: HookResult) => T): Promise | T {\n for (let idx = 0; idx < hooks.length; idx++) {\n const hookResult = hooks[idx].invokeHook();\n\n if (isPromise(hookResult)) {\n const remainingHooks = hooks.slice(idx + 1);\n\n return TransitionHook.chain(remainingHooks, hookResult)\n .then(doneCallback);\n }\n }\n\n return doneCallback();\n }\n\n /**\n * Run all TransitionHooks, ignoring their return value.\n */\n static runAllHooks(hooks: TransitionHook[]): void {\n hooks.forEach(hook => hook.invokeHook());\n }\n\n constructor(private transition: Transition,\n private stateContext: StateDeclaration,\n private registeredHook: RegisteredHook,\n private options: TransitionHookOptions) {\n this.options = defaults(options, defaultOptions);\n this.type = registeredHook.eventType;\n }\n\n private isSuperseded = () =>\n this.type.hookPhase === TransitionHookPhase.RUN && !this.options.transition.isActive();\n\n logError(err): any {\n this.transition.router.stateService.defaultErrorHandler()(err);\n }\n\n invokeHook(): Promise | void {\n const hook = this.registeredHook;\n if (hook._deregistered) return;\n\n const notCurrent = this.getNotCurrentRejection();\n if (notCurrent) return notCurrent;\n\n const options = this.options;\n trace.traceHookInvocation(this, this.transition, options);\n\n const invokeCallback = () =>\n hook.callback.call(options.bind, this.transition, this.stateContext);\n\n const normalizeErr = err =>\n Rejection.normalize(err).toPromise();\n\n const handleError = err =>\n hook.eventType.getErrorHandler(this)(err);\n\n const handleResult = result =>\n hook.eventType.getResultHandler(this)(result);\n\n try {\n const result = invokeCallback();\n\n if (!this.type.synchronous && isPromise(result)) {\n return result.catch(normalizeErr)\n .then(handleResult, handleError);\n } else {\n return handleResult(result);\n }\n } catch (err) {\n // If callback throws (synchronously)\n return handleError(Rejection.normalize(err));\n } finally {\n if (hook.invokeLimit && ++hook.invokeCount >= hook.invokeLimit) {\n hook.deregister();\n }\n }\n }\n\n /**\n * This method handles the return value of a Transition Hook.\n *\n * A hook can return false (cancel), a TargetState (redirect),\n * or a promise (which may later resolve to false or a redirect)\n *\n * This also handles \"transition superseded\" -- when a new transition\n * was started while the hook was still running\n */\n handleHookResult(result: HookResult): Promise {\n const notCurrent = this.getNotCurrentRejection();\n if (notCurrent) return notCurrent;\n\n // Hook returned a promise\n if (isPromise(result)) {\n // Wait for the promise, then reprocess with the resulting value\n return result.then(val => this.handleHookResult(val));\n }\n\n trace.traceHookResult(result, this.transition, this.options);\n\n // Hook returned false\n if (result === false) {\n // Abort this Transition\n return Rejection.aborted('Hook aborted transition').toPromise();\n }\n\n const isTargetState = is(TargetState);\n // hook returned a TargetState\n if (isTargetState(result)) {\n // Halt the current Transition and redirect (a new Transition) to the TargetState.\n return Rejection.redirected(result).toPromise();\n }\n }\n\n\n /**\n * Return a Rejection promise if the transition is no longer current due\n * to a stopped router (disposed), or a new transition has started and superseded this one.\n */\n private getNotCurrentRejection() {\n const router = this.transition.router;\n\n // The router is stopped\n if (router._disposed) {\n return Rejection.aborted(`UIRouter instance #${router.$id} has been stopped (disposed)`).toPromise();\n }\n\n if (this.transition._aborted) {\n return Rejection.aborted().toPromise();\n }\n\n // This transition is no longer current.\n // Another transition started while this hook was still running.\n if (this.isSuperseded()) {\n // Abort this transition\n return Rejection.superseded(this.options.current()).toPromise();\n }\n }\n\n toString() {\n const { options, registeredHook } = this;\n const event = parse('traceData.hookType')(options) || 'internal',\n context = parse('traceData.context.state.name')(options) || parse('traceData.context')(options) || 'unknown',\n name = fnToString(registeredHook.callback);\n return `${event} context: ${context}, ${maxLength(200, name)}`;\n }\n\n}\n", + "/** @module path */ /** for typedoc */\nimport { extend, applyPairs, find, allTrueR, pairs, arrayTuples } from '../common/common';\nimport { propEq } from '../common/hof';\nimport { StateObject } from '../state/stateObject';\nimport { RawParams } from '../params/interface';\nimport { Param } from '../params/param';\nimport { Resolvable } from '../resolve/resolvable';\nimport { ViewConfig } from '../view/interface';\n\n/**\n * @internalapi\n *\n * A node in a [[TreeChanges]] path\n *\n * For a [[TreeChanges]] path, this class holds the stateful information for a single node in the path.\n * Each PathNode corresponds to a state being entered, exited, or retained.\n * The stateful information includes parameter values and resolve data.\n */\nexport class PathNode {\n /** The state being entered, exited, or retained */\n public state: StateObject;\n /** The parameters declared on the state */\n public paramSchema: Param[];\n /** The parameter values that belong to the state */\n public paramValues: { [key: string]: any };\n /** The individual (stateful) resolvable objects that belong to the state */\n public resolvables: Resolvable[];\n /** The state's declared view configuration objects */\n public views: ViewConfig[];\n\n /** Returns a clone of the PathNode */\n static clone(node: PathNode) {\n return new PathNode(node);\n }\n\n /** Creates a copy of a PathNode */\n constructor(node: PathNode);\n /** Creates a new (empty) PathNode for a State */\n constructor(state: StateObject);\n constructor(stateOrNode: any) {\n if (stateOrNode instanceof PathNode) {\n const node: PathNode = stateOrNode;\n this.state = node.state;\n this.paramSchema = node.paramSchema.slice();\n this.paramValues = extend({}, node.paramValues);\n this.resolvables = node.resolvables.slice();\n this.views = node.views && node.views.slice();\n } else {\n const state: StateObject = stateOrNode;\n this.state = state;\n this.paramSchema = state.parameters({ inherit: false });\n this.paramValues = {};\n this.resolvables = state.resolvables.map(res => res.clone());\n }\n }\n\n /** Sets [[paramValues]] for the node, from the values of an object hash */\n applyRawParams(params: RawParams): PathNode {\n const getParamVal = (paramDef: Param) => [ paramDef.id, paramDef.value(params[paramDef.id]) ];\n this.paramValues = this.paramSchema.reduce((memo, pDef) => applyPairs(memo, getParamVal(pDef)), {});\n return this;\n }\n\n /** Gets a specific [[Param]] metadata that belongs to the node */\n parameter(name: string): Param {\n return find(this.paramSchema, propEq('id', name));\n }\n\n /**\n * @returns true if the state and parameter values for another PathNode are\n * equal to the state and param values for this PathNode\n */\n equals(node: PathNode, paramsFn?: GetParamsFn): boolean {\n const diff = this.diff(node, paramsFn);\n return diff && diff.length === 0;\n }\n\n /**\n * Finds Params with different parameter values on another PathNode.\n *\n * Given another node (of the same state), finds the parameter values which differ.\n * Returns the [[Param]] (schema objects) whose parameter values differ.\n *\n * Given another node for a different state, returns `false`\n *\n * @param node The node to compare to\n * @param paramsFn A function that returns which parameters should be compared.\n * @returns The [[Param]]s which differ, or null if the two nodes are for different states\n */\n diff(node: PathNode, paramsFn?: GetParamsFn): Param[] | false {\n if (this.state !== node.state) return false;\n\n const params: Param[] = paramsFn ? paramsFn(this) : this.paramSchema;\n return Param.changed(params, this.paramValues, node.paramValues);\n }\n}\n\n/** @hidden */\nexport type GetParamsFn = (pathNode: PathNode) => Param[];\n", + "/** @module path */ /** for typedoc */\n\nimport {\n extend, find, pick, omit, tail, mergeR, values, unnestR, Predicate, inArray, arrayTuples,\n} from '../common/common';\nimport { prop, propEq, not } from '../common/hof';\n\nimport { RawParams } from '../params/interface';\nimport { TreeChanges } from '../transition/interface';\nimport { ViewConfig } from '../view/interface';\nimport { _ViewDeclaration } from '../state/interface';\n\nimport { StateObject } from '../state/stateObject';\nimport { TargetState } from '../state/targetState';\nimport { GetParamsFn, PathNode } from './pathNode';\nimport { ViewService } from '../view/view';\nimport { Param } from '../params/param';\nimport { StateRegistry } from '../state';\n\n/**\n * This class contains functions which convert TargetStates, Nodes and paths from one type to another.\n */\nexport class PathUtils {\n /** Given a PathNode[], create an TargetState */\n static makeTargetState(registry: StateRegistry, path: PathNode[]): TargetState {\n const state = tail(path).state;\n return new TargetState(registry, state, path.map(prop('paramValues')).reduce(mergeR, {}), {});\n }\n\n static buildPath(targetState: TargetState) {\n const toParams = targetState.params();\n return targetState.$state().path.map(state => new PathNode(state).applyRawParams(toParams));\n }\n\n /** Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[] */\n static buildToPath(fromPath: PathNode[], targetState: TargetState): PathNode[] {\n const toPath: PathNode[] = PathUtils.buildPath(targetState);\n if (targetState.options().inherit) {\n return PathUtils.inheritParams(fromPath, toPath, Object.keys(targetState.params()));\n }\n return toPath;\n }\n\n /**\n * Creates ViewConfig objects and adds to nodes.\n *\n * On each [[PathNode]], creates ViewConfig objects from the views: property of the node's state\n */\n static applyViewConfigs($view: ViewService, path: PathNode[], states: StateObject[]) {\n // Only apply the viewConfigs to the nodes for the given states\n path.filter(node => inArray(states, node.state)).forEach(node => {\n const viewDecls: _ViewDeclaration[] = values(node.state.views || {});\n const subPath = PathUtils.subPath(path, n => n === node);\n const viewConfigs: ViewConfig[][] = viewDecls.map(view => $view.createViewConfig(subPath, view));\n node.views = viewConfigs.reduce(unnestR, []);\n });\n }\n\n /**\n * Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath\n *\n * For a parameter in a node to be inherited from the from path:\n * - The toPath's node must have a matching node in the fromPath (by state).\n * - The parameter name must not be found in the toKeys parameter array.\n *\n * Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some\n * caller, for instance, $state.transitionTo(..., toParams). If a key was found in toParams,\n * it is not inherited from the fromPath.\n */\n static inheritParams(fromPath: PathNode[], toPath: PathNode[], toKeys: string[] = []): PathNode[] {\n function nodeParamVals(path: PathNode[], state: StateObject): RawParams {\n const node: PathNode = find(path, propEq('state', state));\n return extend({}, node && node.paramValues);\n }\n\n const noInherit = fromPath.map(node => node.paramSchema)\n .reduce(unnestR, [])\n .filter(param => !param.inherit)\n .map(prop('id'));\n\n /**\n * Given an [[PathNode]] \"toNode\", return a new [[PathNode]] with param values inherited from the\n * matching node in fromPath. Only inherit keys that aren't found in \"toKeys\" from the node in \"fromPath\"\"\n */\n function makeInheritedParamsNode(toNode: PathNode): PathNode {\n // All param values for the node (may include default key/vals, when key was not found in toParams)\n let toParamVals = extend({}, toNode && toNode.paramValues);\n // limited to only those keys found in toParams\n const incomingParamVals = pick(toParamVals, toKeys);\n toParamVals = omit(toParamVals, toKeys);\n const fromParamVals = omit(nodeParamVals(fromPath, toNode.state) || {}, noInherit);\n // extend toParamVals with any fromParamVals, then override any of those those with incomingParamVals\n const ownParamVals: RawParams = extend(toParamVals, fromParamVals, incomingParamVals);\n return new PathNode(toNode.state).applyRawParams(ownParamVals);\n }\n\n // The param keys specified by the incoming toParams\n return toPath.map(makeInheritedParamsNode);\n }\n\n static nonDynamicParams = (node: PathNode): Param[] =>\n node.state.parameters({ inherit: false })\n .filter(param => !param.dynamic);\n\n /**\n * Computes the tree changes (entering, exiting) between a fromPath and toPath.\n */\n static treeChanges(fromPath: PathNode[], toPath: PathNode[], reloadState: StateObject): TreeChanges {\n const max = Math.min(fromPath.length, toPath.length);\n let keep = 0;\n\n const nodesMatch = (node1: PathNode, node2: PathNode) =>\n node1.equals(node2, PathUtils.nonDynamicParams);\n\n while (keep < max && fromPath[keep].state !== reloadState && nodesMatch(fromPath[keep], toPath[keep])) {\n keep++;\n }\n\n /** Given a retained node, return a new node which uses the to node's param values */\n function applyToParams(retainedNode: PathNode, idx: number): PathNode {\n const cloned = PathNode.clone(retainedNode);\n cloned.paramValues = toPath[idx].paramValues;\n return cloned;\n }\n\n let from: PathNode[], retained: PathNode[], exiting: PathNode[], entering: PathNode[], to: PathNode[];\n\n from = fromPath;\n retained = from.slice(0, keep).map(applyToParams); // applyToParams to update dynamic params\n exiting = from.slice(keep);\n entering = toPath.slice(keep);\n to = (retained).concat(entering);\n\n return { from, to, retained, exiting, entering };\n }\n\n /**\n * Returns a new path which is: the subpath of the first path which matches the second path.\n *\n * The new path starts from root and contains any nodes that match the nodes in the second path.\n * It stops before the first non-matching node.\n *\n * Nodes are compared using their state property and their parameter values.\n * If a `paramsFn` is provided, only the [[Param]] returned by the function will be considered when comparing nodes.\n *\n * @param pathA the first path\n * @param pathB the second path\n * @param paramsFn a function which returns the parameters to consider when comparing\n *\n * @returns an array of PathNodes from the first path which match the nodes in the second path\n */\n static matching(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): PathNode[] {\n let done = false;\n const tuples: PathNode[][] = arrayTuples(pathA, pathB);\n return tuples.reduce((matching, [nodeA, nodeB]) => {\n done = done || !nodeA.equals(nodeB, paramsFn);\n return done ? matching : matching.concat(nodeA);\n }, []);\n }\n\n /**\n * Returns true if two paths are identical.\n *\n * @param pathA\n * @param pathB\n * @param paramsFn a function which returns the parameters to consider when comparing\n * @returns true if the the states and parameter values for both paths are identical\n */\n static equals(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): boolean {\n return pathA.length === pathB.length &&\n PathUtils.matching(pathA, pathB, paramsFn).length === pathA.length;\n }\n\n /**\n * Return a subpath of a path, which stops at the first matching node\n *\n * Given an array of nodes, returns a subset of the array starting from the first node,\n * stopping when the first node matches the predicate.\n *\n * @param path a path of [[PathNode]]s\n * @param predicate a [[Predicate]] fn that matches [[PathNode]]s\n * @returns a subpath up to the matching node, or undefined if no match is found\n */\n static subPath(path: PathNode[], predicate: Predicate): PathNode[] {\n const node = find(path, predicate);\n const elementIdx = path.indexOf(node);\n return elementIdx === -1 ? undefined : path.slice(0, elementIdx + 1);\n }\n\n /** Gets the raw parameter values from a path */\n static paramValues = (path: PathNode[]) =>\n path.reduce((acc, node) => extend(acc, node.paramValues), {});\n}\n", + "/**\n * @coreapi\n * @module resolve\n */ /** for typedoc */\nimport { extend, equals, inArray, identity } from '../common/common';\nimport { services } from '../common/coreservices';\nimport { trace } from '../common/trace';\nimport { ResolvePolicy, ResolvableLiteral, resolvePolicies } from './interface';\n\nimport { ResolveContext } from './resolveContext';\nimport { stringify } from '../common/strings';\nimport { isFunction, isObject } from '../common/predicates';\nimport { Transition } from '../transition/transition';\nimport { StateObject } from '../state/stateObject';\nimport { PathNode } from '../path/pathNode';\nimport { isNullOrUndefined } from '../common/predicates';\n\n\n// TODO: explicitly make this user configurable\nexport let defaultResolvePolicy: ResolvePolicy = {\n when: 'LAZY',\n async: 'WAIT',\n};\n\n/**\n * The basic building block for the resolve system.\n *\n * Resolvables encapsulate a state's resolve's resolveFn, the resolveFn's declared dependencies, the wrapped (.promise),\n * and the unwrapped-when-complete (.data) result of the resolveFn.\n *\n * Resolvable.get() either retrieves the Resolvable's existing promise, or else invokes resolve() (which invokes the\n * resolveFn) and returns the resulting promise.\n *\n * Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first\n * parameter to those fns.\n */\nexport class Resolvable implements ResolvableLiteral {\n token: any;\n policy: ResolvePolicy;\n resolveFn: Function;\n deps: any[];\n\n data: any;\n resolved = false;\n promise: Promise = undefined;\n\n static fromData = (token: any, data: any) =>\n new Resolvable(token, () => data, null, null, data);\n\n /** This constructor creates a Resolvable copy */\n constructor(resolvable: Resolvable)\n\n /** This constructor creates a new Resolvable from the plain old [[ResolvableLiteral]] javascript object */\n constructor(resolvable: ResolvableLiteral)\n\n /**\n * This constructor creates a new `Resolvable`\n *\n * #### Example:\n * ```js\n * var resolvable1 = new Resolvable('mytoken', http => http.get('foo.json').toPromise(), [Http]);\n *\n * var resolvable2 = new Resolvable(UserService, dep => new UserService(dep.data), [SomeDependency]);\n *\n * var resolvable1Clone = new Resolvable(resolvable1);\n * ```\n *\n * @param token The new resolvable's injection token, such as `\"userList\"` (a string) or `UserService` (a class).\n * When this token is used during injection, the resolved value will be injected.\n * @param resolveFn The function that returns the resolved value, or a promise for the resolved value\n * @param deps An array of dependencies, which will be injected into the `resolveFn`\n * @param policy the [[ResolvePolicy]] defines when and how the Resolvable is processed\n * @param data Pre-resolved data. If the resolve value is already known, it may be provided here.\n */\n constructor(token: any, resolveFn: Function, deps?: any[], policy?: ResolvePolicy, data?: any)\n constructor(arg1: any, resolveFn?: Function, deps?: any[], policy?: ResolvePolicy, data?: any) {\n if (arg1 instanceof Resolvable) {\n extend(this, arg1);\n } else if (isFunction(resolveFn)) {\n if (isNullOrUndefined(arg1)) throw new Error('new Resolvable(): token argument is required');\n if (!isFunction(resolveFn)) throw new Error('new Resolvable(): resolveFn argument must be a function');\n\n this.token = arg1;\n this.policy = policy;\n this.resolveFn = resolveFn;\n this.deps = deps || [];\n\n this.data = data;\n this.resolved = data !== undefined;\n this.promise = this.resolved ? services.$q.when(this.data) : undefined;\n } else if (isObject(arg1) && arg1.token && isFunction(arg1.resolveFn)) {\n const literal = arg1;\n return new Resolvable(literal.token, literal.resolveFn, literal.deps, literal.policy, literal.data);\n }\n }\n\n getPolicy(state: StateObject): ResolvePolicy {\n const thisPolicy = this.policy || {};\n const statePolicy = state && state.resolvePolicy || {};\n return {\n when: thisPolicy.when || statePolicy.when || defaultResolvePolicy.when,\n async: thisPolicy.async || statePolicy.async || defaultResolvePolicy.async,\n };\n }\n\n /**\n * Asynchronously resolve this Resolvable's data\n *\n * Given a ResolveContext that this Resolvable is found in:\n * Wait for this Resolvable's dependencies, then invoke this Resolvable's function\n * and update the Resolvable's state\n */\n resolve(resolveContext: ResolveContext, trans?: Transition) {\n const $q = services.$q;\n\n // Gets all dependencies from ResolveContext and wait for them to be resolved\n const getResolvableDependencies = () =>\n $q.all(resolveContext.getDependencies(this).map(resolvable =>\n resolvable.get(resolveContext, trans))) as Promise;\n\n // Invokes the resolve function passing the resolved dependencies as arguments\n const invokeResolveFn = (resolvedDeps: any[]) =>\n this.resolveFn.apply(null, resolvedDeps);\n\n /**\n * For RXWAIT policy:\n *\n * Given an observable returned from a resolve function:\n * - enables .cache() mode (this allows multicast subscribers)\n * - then calls toPromise() (this triggers subscribe() and thus fetches)\n * - Waits for the promise, then return the cached observable (not the first emitted value).\n */\n const waitForRx = (observable$: any) => {\n const cached = observable$.cache(1);\n return cached.take(1).toPromise().then(() => cached);\n };\n\n // If the resolve policy is RXWAIT, wait for the observable to emit something. otherwise pass through.\n const node: PathNode = resolveContext.findNode(this);\n const state: StateObject = node && node.state;\n const maybeWaitForRx = this.getPolicy(state).async === 'RXWAIT' ? waitForRx : identity;\n\n // After the final value has been resolved, update the state of the Resolvable\n const applyResolvedValue = (resolvedValue: any) => {\n this.data = resolvedValue;\n this.resolved = true;\n trace.traceResolvableResolved(this, trans);\n return this.data;\n };\n\n // Sets the promise property first, then getsResolvableDependencies in the context of the promise chain. Always waits one tick.\n return this.promise = $q.when()\n .then(getResolvableDependencies)\n .then(invokeResolveFn)\n .then(maybeWaitForRx)\n .then(applyResolvedValue);\n }\n\n /**\n * Gets a promise for this Resolvable's data.\n *\n * Fetches the data and returns a promise.\n * Returns the existing promise if it has already been fetched once.\n */\n get(resolveContext: ResolveContext, trans?: Transition): Promise {\n return this.promise || this.resolve(resolveContext, trans);\n }\n\n toString() {\n return `Resolvable(token: ${stringify(this.token)}, requires: [${this.deps.map(stringify)}])`;\n }\n\n clone(): Resolvable {\n return new Resolvable(this);\n }\n}\n", + "/**\n * # The Resolve subsystem\n *\n * This subsystem is an asynchronous, hierarchical Dependency Injection system.\n *\n * Typically, resolve is configured on a state using a [[StateDeclaration.resolve]] declaration.\n *\n * @coreapi\n * @module resolve\n */ /** for typedoc */\nimport { Resolvable } from './resolvable';\n\n/**\n * An interface which is similar to an Angular 2 `Provider`\n */\nexport interface ProviderLike {\n provide: any,\n useClass?: any,\n useFactory?: Function,\n useValue?: any,\n useExisting?: any,\n deps?: any[]\n}\n\n/**\n * A plain object used to describe a [[Resolvable]]\n *\n * These objects may be used in the [[StateDeclaration.resolve]] array to declare\n * async data that the state or substates require.\n *\n * #### Example:\n * ```js\n *\n * var state = {\n * name: 'main',\n * resolve: [\n * { token: 'myData', deps: [MyDataApi], resolveFn: (myDataApi) => myDataApi.getData() },\n * ],\n * }\n * ```\n */\nexport interface ResolvableLiteral {\n /**\n * A Dependency Injection token\n *\n * This Resolvable's DI token.\n * The Resolvable will be injectable elsewhere using the token.\n */\n token: any;\n\n /**\n * A function which fetches the Resolvable's data\n *\n * A function which returns one of:\n *\n * - The resolved value (synchronously)\n * - A promise for the resolved value\n * - An Observable of the resolved value(s)\n *\n * This function will be provided the dependencies listed in [[deps]] as its arguments.\n * The resolve system will asynchronously fetch the dependencies before invoking this function.\n */\n resolveFn: Function;\n\n /**\n * Defines the Resolve Policy\n *\n * A policy that defines when to invoke the resolve,\n * and whether to wait for async and unwrap the data\n */\n policy?: ResolvePolicy;\n\n /**\n * The Dependency Injection tokens\n *\n * This is an array of Dependency Injection tokens for the dependencies of the [[resolveFn]].\n *\n * The DI tokens are references to other `Resolvables`, or to other\n * services from the native DI system.\n */\n deps?: any[];\n\n /** Pre-resolved data. */\n data?: any\n}\n\n/**\n * Defines how a resolve is processed during a transition\n *\n * This object is the [[StateDeclaration.resolvePolicy]] property.\n *\n * #### Example:\n * ```js\n * // Fetched when the resolve's state is being entered.\n * // Wait for the promise to resolve.\n * var policy1 = { when: \"LAZY\", async: \"WAIT\" }\n *\n * // Fetched when the Transition is starting.\n * // Do not wait for the returned promise to resolve.\n * // Inject the raw promise/value\n * var policy2 = { when: \"EAGER\", async: \"NOWAIT\" }\n * ```\n *\n * The policy for a given Resolvable is merged from three sources (highest priority first):\n *\n * - 1) Individual resolve definition\n * - 2) State definition\n * - 3) Global default\n *\n * #### Example:\n * ```js\n * // Wait for an Observable to emit one item.\n * // Since `wait` is not specified, it uses the `wait`\n * // policy defined on the state, or the global default\n * // if no `wait` policy is defined on the state\n * var myResolvablePolicy = { async: \"RXWAIT\" }\n * ```\n */\nexport interface ResolvePolicy {\n /**\n * Defines when a Resolvable is resolved (fetched) during a transition\n *\n * - `LAZY` (default)\n * - Resolved as the resolve's state is being entered\n * - `EAGER`\n * - Resolved as the transition is starting\n *\n * #### Example:\n * Resolves for `main` and `main.home` are fetched when each state is entered.\n * All of `main` resolves are processed before fetching `main.home` resolves.\n * ```js\n * var state = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { when: 'LAZY' }, // default\n * }\n *\n * var state = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { when: 'LAZY' }, // default\n * }\n * ```\n *\n * #### Example:\n * Resolves for `main` and `main.home` are fetched at the same time when the transition starts.\n * This happens earlier in the lifecycle than when states are entered.\n * All of the `main` and `main.home` resolves are fetched as soon as possible.\n * ```js\n * var mainState = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { when: 'EAGER' },\n * }\n *\n * var homeState = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { when: 'EAGER' },\n * }\n * ```\n */\n when?: PolicyWhen;\n\n /**\n * Determines the unwrapping behavior of asynchronous resolve values.\n *\n * - `WAIT` (default)\n * - If a promise is returned from the resolveFn, wait for the promise before proceeding\n * - The unwrapped value from the promise\n * - `NOWAIT`\n * - If a promise is returned from the resolve, do not wait for the promise.\n * - Any other value returned is wrapped in a promise.\n * - The promise will not be unwrapped.\n * - The promise itself will be provided when the resolve is injected or bound elsewhere.\n * - `RXWAIT`\n * - When an Observable is returned from the resolveFn, wait until the Observable emits at least one item.\n * - The Observable item will not be unwrapped.\n * - The Observable stream itself will be provided when the resolve is injected or bound elsewhere.\n *\n * #### Example:\n * The `Transition` will not wait for the resolve promise(s) from `main` to settle before continuing.\n * Resolves for `main` will be provided to components wrapped in a `Promise`.\n *\n * The `Transition` will wait for the `main.home` resolve promises.\n * Resolved values will be unwrapped before being provided to components.\n * ```js\n * var mainState = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { async: 'NOWAIT' },\n * }\n * var homeState = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { async: 'WAIT' }, // default\n * }\n * ```\n */\n async?: PolicyAsync;\n}\n\nexport type PolicyWhen = 'LAZY' | 'EAGER' ;\nexport type PolicyAsync = 'WAIT' | 'NOWAIT' | 'RXWAIT' ;\n\n/** @internalapi */\nexport let resolvePolicies = {\n when: {\n LAZY: 'LAZY',\n EAGER: 'EAGER',\n },\n async: {\n WAIT: 'WAIT',\n NOWAIT: 'NOWAIT',\n RXWAIT: 'RXWAIT',\n },\n};\n", + "/** @module resolve */\n/** for typedoc */\nimport { find, tail, uniqR, unnestR, inArray } from '../common/common';\nimport { propEq, not } from '../common/hof';\nimport { trace } from '../common/trace';\nimport { services, $InjectorLike } from '../common/coreservices';\nimport { resolvePolicies, PolicyWhen, ResolvePolicy } from './interface';\nimport { PathNode } from '../path/pathNode';\nimport { Resolvable } from './resolvable';\nimport { StateObject } from '../state/stateObject';\nimport { PathUtils } from '../path/pathUtils';\nimport { stringify } from '../common/strings';\nimport { Transition } from '../transition/transition';\nimport { UIInjector } from '../interface';\nimport { isUndefined } from '../common';\n\nconst whens = resolvePolicies.when;\nconst ALL_WHENS = [whens.EAGER, whens.LAZY];\nconst EAGER_WHENS = [whens.EAGER];\n\n// tslint:disable-next-line:no-inferrable-types\nexport const NATIVE_INJECTOR_TOKEN: string = 'Native Injector';\n\n/**\n * Encapsulates Dependency Injection for a path of nodes\n *\n * UI-Router states are organized as a tree.\n * A nested state has a path of ancestors to the root of the tree.\n * When a state is being activated, each element in the path is wrapped as a [[PathNode]].\n * A `PathNode` is a stateful object that holds things like parameters and resolvables for the state being activated.\n *\n * The ResolveContext closes over the [[PathNode]]s, and provides DI for the last node in the path.\n */\nexport class ResolveContext {\n _injector: UIInjector;\n\n constructor(private _path: PathNode[]) { }\n\n /** Gets all the tokens found in the resolve context, de-duplicated */\n getTokens(): any[] {\n return this._path.reduce((acc, node) => acc.concat(node.resolvables.map(r => r.token)), []).reduce(uniqR, []);\n }\n\n /**\n * Gets the Resolvable that matches the token\n *\n * Gets the last Resolvable that matches the token in this context, or undefined.\n * Throws an error if it doesn't exist in the ResolveContext\n */\n getResolvable(token: any): Resolvable {\n const matching = this._path.map(node => node.resolvables)\n .reduce(unnestR, [])\n .filter((r: Resolvable) => r.token === token);\n return tail(matching);\n }\n\n /** Returns the [[ResolvePolicy]] for the given [[Resolvable]] */\n getPolicy(resolvable: Resolvable): ResolvePolicy {\n const node = this.findNode(resolvable);\n return resolvable.getPolicy(node.state);\n }\n\n /**\n * Returns a ResolveContext that includes a portion of this one\n *\n * Given a state, this method creates a new ResolveContext from this one.\n * The new context starts at the first node (root) and stops at the node for the `state` parameter.\n *\n * #### Why\n *\n * When a transition is created, the nodes in the \"To Path\" are injected from a ResolveContext.\n * A ResolveContext closes over a path of [[PathNode]]s and processes the resolvables.\n * The \"To State\" can inject values from its own resolvables, as well as those from all its ancestor state's (node's).\n * This method is used to create a narrower context when injecting ancestor nodes.\n *\n * @example\n * `let ABCD = new ResolveContext([A, B, C, D]);`\n *\n * Given a path `[A, B, C, D]`, where `A`, `B`, `C` and `D` are nodes for states `a`, `b`, `c`, `d`:\n * When injecting `D`, `D` should have access to all resolvables from `A`, `B`, `C`, `D`.\n * However, `B` should only be able to access resolvables from `A`, `B`.\n *\n * When resolving for the `B` node, first take the full \"To Path\" Context `[A,B,C,D]` and limit to the subpath `[A,B]`.\n * `let AB = ABCD.subcontext(a)`\n */\n subContext(state: StateObject): ResolveContext {\n return new ResolveContext(PathUtils.subPath(this._path, node => node.state === state));\n }\n\n /**\n * Adds Resolvables to the node that matches the state\n *\n * This adds a [[Resolvable]] (generally one created on the fly; not declared on a [[StateDeclaration.resolve]] block).\n * The resolvable is added to the node matching the `state` parameter.\n *\n * These new resolvables are not automatically fetched.\n * The calling code should either fetch them, fetch something that depends on them,\n * or rely on [[resolvePath]] being called when some state is being entered.\n *\n * Note: each resolvable's [[ResolvePolicy]] is merged with the state's policy, and the global default.\n *\n * @param newResolvables the new Resolvables\n * @param state Used to find the node to put the resolvable on\n */\n addResolvables(newResolvables: Resolvable[], state: StateObject) {\n const node = find(this._path, propEq('state', state));\n const keys = newResolvables.map(r => r.token);\n node.resolvables = node.resolvables.filter(r => keys.indexOf(r.token) === -1).concat(newResolvables);\n }\n\n /**\n * Returns a promise for an array of resolved path Element promises\n *\n * @param when\n * @param trans\n * @returns {Promise|any}\n */\n resolvePath(when: PolicyWhen = 'LAZY', trans?: Transition): Promise<{ token: any, value: any }[]> {\n // This option determines which 'when' policy Resolvables we are about to fetch.\n const whenOption: string = inArray(ALL_WHENS, when) ? when : 'LAZY';\n // If the caller specified EAGER, only the EAGER Resolvables are fetched.\n // if the caller specified LAZY, both EAGER and LAZY Resolvables are fetched.`\n const matchedWhens = whenOption === resolvePolicies.when.EAGER ? EAGER_WHENS : ALL_WHENS;\n\n // get the subpath to the state argument, if provided\n trace.traceResolvePath(this._path, when, trans);\n\n const matchesPolicy = (acceptedVals: string[], whenOrAsync: 'when'|'async') =>\n (resolvable: Resolvable) =>\n inArray(acceptedVals, this.getPolicy(resolvable)[whenOrAsync]);\n\n // Trigger all the (matching) Resolvables in the path\n // Reduce all the \"WAIT\" Resolvables into an array\n const promises: Promise[] = this._path.reduce((acc, node) => {\n const nodeResolvables = node.resolvables.filter(matchesPolicy(matchedWhens, 'when'));\n const nowait = nodeResolvables.filter(matchesPolicy(['NOWAIT'], 'async'));\n const wait = nodeResolvables.filter(not(matchesPolicy(['NOWAIT'], 'async')));\n\n // For the matching Resolvables, start their async fetch process.\n const subContext = this.subContext(node.state);\n const getResult = (r: Resolvable) => r.get(subContext, trans)\n // Return a tuple that includes the Resolvable's token\n .then(value => ({ token: r.token, value: value }));\n nowait.forEach(getResult);\n return acc.concat(wait.map(getResult));\n }, []);\n\n // Wait for all the \"WAIT\" resolvables\n return services.$q.all(promises);\n }\n\n injector(): UIInjector {\n return this._injector || (this._injector = new UIInjectorImpl(this));\n }\n\n findNode(resolvable: Resolvable): PathNode {\n return find(this._path, (node: PathNode) => inArray(node.resolvables, resolvable));\n }\n\n /**\n * Gets the async dependencies of a Resolvable\n *\n * Given a Resolvable, returns its dependencies as a Resolvable[]\n */\n getDependencies(resolvable: Resolvable): Resolvable[] {\n const node = this.findNode(resolvable);\n // Find which other resolvables are \"visible\" to the `resolvable` argument\n // subpath stopping at resolvable's node, or the whole path (if the resolvable isn't in the path)\n const subPath: PathNode[] = PathUtils.subPath(this._path, x => x === node) || this._path;\n const availableResolvables: Resolvable[] = subPath\n .reduce((acc, _node) => acc.concat(_node.resolvables), []) // all of subpath's resolvables\n .filter(res => res !== resolvable); // filter out the `resolvable` argument\n\n const getDependency = (token: any) => {\n const matching = availableResolvables.filter(r => r.token === token);\n if (matching.length) return tail(matching);\n\n const fromInjector = this.injector().getNative(token);\n if (isUndefined(fromInjector)) {\n throw new Error('Could not find Dependency Injection token: ' + stringify(token));\n }\n\n return new Resolvable(token, () => fromInjector, [], fromInjector);\n };\n\n return resolvable.deps.map(getDependency);\n }\n}\n\nclass UIInjectorImpl implements UIInjector {\n native: $InjectorLike;\n\n constructor(public context: ResolveContext) {\n this.native = this.get(NATIVE_INJECTOR_TOKEN) || services.$injector;\n }\n\n get(token: any) {\n const resolvable = this.context.getResolvable(token);\n if (resolvable) {\n if (this.context.getPolicy(resolvable).async === 'NOWAIT') {\n return resolvable.get(this.context);\n }\n\n if (!resolvable.resolved) {\n throw new Error('Resolvable async .get() not complete:' + stringify(resolvable.token));\n }\n return resolvable.data;\n }\n\n return this.getNative(token);\n }\n\n getAsync(token: any) {\n const resolvable = this.context.getResolvable(token);\n if (resolvable) return resolvable.get(this.context);\n return services.$q.when(this.native.get(token));\n }\n\n getNative(token: any) {\n return this.native && this.native.get(token);\n }\n}\n", + "/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport { trace } from '../common/trace';\nimport { services } from '../common/coreservices';\nimport { stringify } from '../common/strings';\nimport { map, find, extend, mergeR, tail, omit, arrayTuples, unnestR, identity, anyTrueR } from '../common/common';\nimport { isObject, isUndefined } from '../common/predicates';\nimport { prop, propEq, val, not, is } from '../common/hof';\nimport { StateDeclaration, StateOrName } from '../state/interface';\nimport {\n TransitionOptions, TreeChanges, IHookRegistry, TransitionHookPhase, RegisteredHooks, HookRegOptions,\n HookMatchCriteria, TransitionStateHookFn, TransitionHookFn,\n} from './interface'; // has or is using\nimport { TransitionHook } from './transitionHook';\nimport { matchState, makeEvent, RegisteredHook } from './hookRegistry';\nimport { HookBuilder } from './hookBuilder';\nimport { PathNode } from '../path/pathNode';\nimport { PathUtils } from '../path/pathUtils';\nimport { StateObject } from '../state/stateObject';\nimport { TargetState } from '../state/targetState';\nimport { Param } from '../params/param';\nimport { Resolvable } from '../resolve/resolvable';\nimport { ViewConfig } from '../view/interface';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { UIRouter } from '../router';\nimport { UIInjector } from '../interface';\nimport { RawParams } from '../params/interface';\nimport { ResolvableLiteral } from '../resolve/interface';\n\n/** @hidden */\nconst stateSelf: (_state: StateObject) => StateDeclaration = prop('self');\n\n/**\n * Represents a transition between two states.\n *\n * When navigating to a state, we are transitioning **from** the current state **to** the new state.\n *\n * This object contains all contextual information about the to/from states, parameters, resolves.\n * It has information about all states being entered and exited as a result of the transition.\n */\nexport class Transition implements IHookRegistry {\n\n /** @hidden */\n static diToken = Transition;\n\n /**\n * A unique identifier for the transition.\n *\n * This is an auto incrementing integer, starting from `0`.\n */\n $id: number;\n\n /**\n * A reference to the [[UIRouter]] instance\n *\n * This reference can be used to access the router services, such as the [[StateService]]\n */\n router: UIRouter;\n\n /** @hidden */\n private _deferred = services.$q.defer();\n /**\n * This promise is resolved or rejected based on the outcome of the Transition.\n *\n * When the transition is successful, the promise is resolved\n * When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error\n */\n promise: Promise = this._deferred.promise;\n /**\n * A boolean which indicates if the transition was successful\n *\n * After a successful transition, this value is set to true.\n * After an unsuccessful transition, this value is set to false.\n *\n * The value will be undefined if the transition is not complete\n */\n success: boolean;\n /** @hidden */\n _aborted: boolean;\n /** @hidden */\n private _error: any;\n\n /** @hidden Holds the hook registration functions such as those passed to Transition.onStart() */\n _registeredHooks: RegisteredHooks = { };\n\n /** @hidden */\n private _options: TransitionOptions;\n /** @hidden */\n private _treeChanges: TreeChanges;\n /** @hidden */\n private _targetState: TargetState;\n /** @hidden */\n private _hookBuilder = new HookBuilder(this);\n\n\n /** @hidden */\n onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n\n /** @hidden\n * Creates the transition-level hook registration functions\n * (which can then be used to register hooks)\n */\n private createTransitionHookRegFns() {\n this.router.transitionService._pluginapi._getEvents()\n .filter(type => type.hookPhase !== TransitionHookPhase.CREATE)\n .forEach(type => makeEvent(this, this.router.transitionService, type));\n }\n\n /** @internalapi */\n getHooks(hookName: string): RegisteredHook[] {\n return this._registeredHooks[hookName];\n }\n\n /**\n * Creates a new Transition object.\n *\n * If the target state is not valid, an error is thrown.\n *\n * @internalapi\n *\n * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`\n * encapsulates the \"from state\".\n * @param targetState The target state and parameters being transitioned to (also, the transition options)\n * @param router The [[UIRouter]] instance\n */\n constructor(fromPath: PathNode[], targetState: TargetState, router: UIRouter) {\n this.router = router;\n this._targetState = targetState;\n\n if (!targetState.valid()) {\n throw new Error(targetState.error());\n }\n\n // current() is assumed to come from targetState.options, but provide a naive implementation otherwise.\n this._options = extend({ current: val(this) }, targetState.options());\n this.$id = router.transitionService._transitionCount++;\n const toPath = PathUtils.buildToPath(fromPath, targetState);\n this._treeChanges = PathUtils.treeChanges(fromPath, toPath, this._options.reloadState);\n this.createTransitionHookRegFns();\n\n const onCreateHooks = this._hookBuilder.buildHooksForPhase(TransitionHookPhase.CREATE);\n TransitionHook.invokeHooks(onCreateHooks, () => null);\n\n this.applyViewConfigs(router);\n }\n\n private applyViewConfigs(router: UIRouter) {\n const enteringStates = this._treeChanges.entering.map(node => node.state);\n PathUtils.applyViewConfigs(router.transitionService.$view, this._treeChanges.to, enteringStates);\n }\n\n /**\n * @internalapi\n *\n * @returns the internal from [State] object\n */\n $from() {\n return tail(this._treeChanges.from).state;\n }\n\n /**\n * @internalapi\n *\n * @returns the internal to [State] object\n */\n $to() {\n return tail(this._treeChanges.to).state;\n }\n\n /**\n * Returns the \"from state\"\n *\n * Returns the state that the transition is coming *from*.\n *\n * @returns The state declaration object for the Transition's (\"from state\").\n */\n from(): StateDeclaration {\n return this.$from().self;\n }\n\n /**\n * Returns the \"to state\"\n *\n * Returns the state that the transition is going *to*.\n *\n * @returns The state declaration object for the Transition's target state (\"to state\").\n */\n to(): StateDeclaration {\n return this.$to().self;\n }\n\n /**\n * Gets the Target State\n *\n * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object.\n *\n * @returns the [[TargetState]] of this Transition\n */\n targetState() {\n return this._targetState;\n }\n\n /**\n * Determines whether two transitions are equivalent.\n * @deprecated\n */\n is(compare: (Transition|{to?: any, from?: any})): boolean {\n if (compare instanceof Transition) {\n // TODO: Also compare parameters\n return this.is({ to: compare.$to().name, from: compare.$from().name });\n }\n return !(\n (compare.to && !matchState(this.$to(), compare.to)) ||\n (compare.from && !matchState(this.$from(), compare.from))\n );\n }\n\n /**\n * Gets transition parameter values\n *\n * Returns the parameter values for a transition as key/value pairs.\n * This object is immutable.\n *\n * By default, returns the new parameter values (for the \"to state\").\n *\n * #### Example:\n * ```js\n * var toParams = transition.params();\n * ```\n *\n * To return the previous parameter values, supply `'from'` as the `pathname` argument.\n *\n * #### Example:\n * ```js\n * var fromParams = transition.params('from');\n * ```\n *\n * @param pathname the name of the treeChanges path to get parameter values for:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n *\n * @returns transition parameter values for the desired path.\n */\n params(pathname?: string): any;\n params(pathname?: string): T;\n params(pathname = 'to') {\n return Object.freeze(this._treeChanges[pathname].map(prop('paramValues')).reduce(mergeR, {}));\n }\n\n\n /**\n * Creates a [[UIInjector]] Dependency Injector\n *\n * Returns a Dependency Injector for the Transition's target state (to state).\n * The injector provides resolve values which the target state has access to.\n *\n * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2).\n *\n * #### Example:\n * ```js\n * .onEnter({ entering: 'myState' }, trans => {\n * var myResolveValue = trans.injector().get('myResolve');\n * // Inject a global service from the global/native injector (if it exists)\n * var MyService = trans.injector().get('MyService');\n * })\n * ```\n *\n * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched.\n * You can use [[UIInjector.getAsync]] to get a promise for the data.\n * #### Example:\n * ```js\n * .onBefore({}, trans => {\n * return trans.injector().getAsync('myResolve').then(myResolveValue =>\n * return myResolveValue !== 'ABORT';\n * });\n * });\n * ```\n *\n * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to.\n * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`.\n * #### Example:\n * ```js\n * .onEnter({ to: 'foo.bar' }, trans => {\n * // returns result of `foo` state's `myResolve` resolve\n * // even though `foo.bar` also has a `myResolve` resolve\n * var fooData = trans.injector('foo').get('myResolve');\n * });\n * ```\n *\n * If you need resolve data from the exiting states, pass `'from'` as `pathName`.\n * The resolve data from the `from` path will be returned.\n * #### Example:\n * ```js\n * .onExit({ exiting: 'foo.bar' }, trans => {\n * // Gets the resolve value of `myResolve` from the state being exited\n * var fooData = trans.injector(null, 'from').get('myResolve');\n * });\n * ```\n *\n *\n * @param state Limits the resolves provided to only the resolves the provided state has access to.\n * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states.\n *\n * @returns a [[UIInjector]]\n */\n injector(state?: StateOrName, pathName = 'to'): UIInjector {\n let path: PathNode[] = this._treeChanges[pathName];\n if (state) path = PathUtils.subPath(path, node => node.state === state || node.state.name === state);\n return new ResolveContext(path).injector();\n }\n\n /**\n * Gets all available resolve tokens (keys)\n *\n * This method can be used in conjunction with [[injector]] to inspect the resolve values\n * available to the Transition.\n *\n * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states\n * in the Transition's [[TreeChanges.to]] path.\n *\n * #### Example:\n * This example logs all resolve values\n * ```js\n * let tokens = trans.getResolveTokens();\n * tokens.forEach(token => console.log(token + \" = \" + trans.injector().get(token)));\n * ```\n *\n * #### Example:\n * This example creates promises for each resolve value.\n * This triggers fetches of resolves (if any have not yet been fetched).\n * When all promises have all settled, it logs the resolve values.\n * ```js\n * let tokens = trans.getResolveTokens();\n * let promise = tokens.map(token => trans.injector().getAsync(token));\n * Promise.all(promises).then(values => console.log(\"Resolved values: \" + values));\n * ```\n *\n * Note: Angular 1 users whould use `$q.all()`\n *\n * @param pathname resolve context's path name (e.g., `to` or `from`)\n *\n * @returns an array of resolve tokens (keys)\n */\n getResolveTokens(pathname = 'to'): any[] {\n return new ResolveContext(this._treeChanges[pathname]).getTokens();\n }\n\n /**\n * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition.\n *\n * Allows a transition hook to dynamically add a Resolvable to this Transition.\n *\n * Use the [[Transition.injector]] to retrieve the resolved data in subsequent hooks ([[UIInjector.get]]).\n *\n * If a `state` argument is provided, the Resolvable is processed when that state is being entered.\n * If no `state` is provided then the root state is used.\n * If the given `state` has already been entered, the Resolvable is processed when any child state is entered.\n * If no child states will be entered, the Resolvable is processed during the `onFinish` phase of the Transition.\n *\n * The `state` argument also scopes the resolved data.\n * The resolved data is available from the injector for that `state` and any children states.\n *\n * #### Example:\n * ```js\n * transitionService.onBefore({}, transition => {\n * transition.addResolvable({\n * token: 'myResolve',\n * deps: ['MyService'],\n * resolveFn: myService => myService.getData()\n * });\n * });\n * ```\n *\n * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]])\n * @param state the state in the \"to path\" which should receive the new resolve (otherwise, the root state)\n */\n addResolvable(resolvable: Resolvable|ResolvableLiteral, state: StateOrName = ''): void {\n resolvable = is(Resolvable)(resolvable) ? resolvable : new Resolvable(resolvable);\n\n const stateName: string = (typeof state === 'string') ? state : state.name;\n const topath = this._treeChanges.to;\n const targetNode = find(topath, node => node.state.name === stateName);\n const resolveContext: ResolveContext = new ResolveContext(topath);\n resolveContext.addResolvables([resolvable as Resolvable], targetNode.state);\n }\n\n /**\n * Gets the transition from which this transition was redirected.\n *\n * If the current transition is a redirect, this method returns the transition that was redirected.\n *\n * #### Example:\n * ```js\n * let transitionA = $state.go('A').transition\n * transitionA.onStart({}, () => $state.target('B'));\n * $transitions.onSuccess({ to: 'B' }, (trans) => {\n * trans.to().name === 'B'; // true\n * trans.redirectedFrom() === transitionA; // true\n * });\n * ```\n *\n * @returns The previous Transition, or null if this Transition is not the result of a redirection\n */\n redirectedFrom(): Transition {\n return this._options.redirectedFrom || null;\n }\n\n /**\n * Gets the original transition in a redirect chain\n *\n * A transition might belong to a long chain of multiple redirects.\n * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain.\n *\n * #### Example:\n * ```js\n * // states\n * registry.register({ name: 'A', redirectTo: 'B' });\n * registry.register({ name: 'B', redirectTo: 'C' });\n * registry.register({ name: 'C', redirectTo: 'D' });\n * registry.register({ name: 'D' });\n *\n * let transitionA = $state.go('A').transition\n *\n * $transitions.onSuccess({ to: 'D' }, (trans) => {\n * trans.to().name === 'D'; // true\n * trans.redirectedFrom().to().name === 'C'; // true\n * trans.originalTransition() === transitionA; // true\n * trans.originalTransition().to().name === 'A'; // true\n * });\n * ```\n *\n * @returns The original Transition that started a redirect chain\n */\n originalTransition(): Transition {\n const rf = this.redirectedFrom();\n return (rf && rf.originalTransition()) || this;\n }\n\n /**\n * Get the transition options\n *\n * @returns the options for this Transition.\n */\n options(): TransitionOptions {\n return this._options;\n }\n\n /**\n * Gets the states being entered.\n *\n * @returns an array of states that will be entered during this transition.\n */\n entering(): StateDeclaration[] {\n return map(this._treeChanges.entering, prop('state')).map(stateSelf);\n }\n\n /**\n * Gets the states being exited.\n *\n * @returns an array of states that will be exited during this transition.\n */\n exiting(): StateDeclaration[] {\n return map(this._treeChanges.exiting, prop('state')).map(stateSelf).reverse();\n }\n\n /**\n * Gets the states being retained.\n *\n * @returns an array of states that are already entered from a previous Transition, that will not be\n * exited during this Transition\n */\n retained(): StateDeclaration[] {\n return map(this._treeChanges.retained, prop('state')).map(stateSelf);\n }\n\n /**\n * Get the [[ViewConfig]]s associated with this Transition\n *\n * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects.\n * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., \"to\" or \"entering\").\n *\n * @param pathname the name of the path to fetch views for:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n * @param state If provided, only returns the `ViewConfig`s for a single state in the path\n *\n * @returns a list of ViewConfig objects for the given path.\n */\n views(pathname = 'entering', state?: StateObject): ViewConfig[] {\n let path = this._treeChanges[pathname];\n path = !state ? path : path.filter(propEq('state', state));\n return path.map(prop('views')).filter(identity).reduce(unnestR, []);\n }\n\n /**\n * Return the transition's tree changes\n *\n * A transition goes from one state/parameters to another state/parameters.\n * During a transition, states are entered and/or exited.\n *\n * This function returns various branches (paths) which represent the changes to the\n * active state tree that are caused by the transition.\n *\n * @param pathname The name of the tree changes path to get:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n */\n treeChanges(pathname: string): PathNode[];\n treeChanges(): TreeChanges;\n treeChanges(pathname?: string) {\n return pathname ? this._treeChanges[pathname] : this._treeChanges;\n }\n\n /**\n * Creates a new transition that is a redirection of the current one.\n *\n * This transition can be returned from a [[TransitionService]] hook to\n * redirect a transition to a new state and/or set of parameters.\n *\n * @internalapi\n *\n * @returns Returns a new [[Transition]] instance.\n */\n redirect(targetState: TargetState): Transition {\n let redirects = 1, trans: Transition = this;\n // tslint:disable-next-line:no-conditional-assignment\n while ((trans = trans.redirectedFrom()) != null) {\n if (++redirects > 20) throw new Error(`Too many consecutive Transition redirects (20+)`);\n }\n\n const redirectOpts: TransitionOptions = { redirectedFrom: this, source: 'redirect' };\n // If the original transition was caused by URL sync, then use { location: 'replace' }\n // on the new transition (unless the target state explicitly specifies location: false).\n // This causes the original url to be replaced with the url for the redirect target\n // so the original url disappears from the browser history.\n if (this.options().source === 'url' && targetState.options().location !== false) {\n redirectOpts.location = 'replace';\n }\n\n const newOptions = extend({}, this.options(), targetState.options(), redirectOpts);\n targetState = targetState.withOptions(newOptions, true);\n\n const newTransition = this.router.transitionService.create(this._treeChanges.from, targetState);\n const originalEnteringNodes = this._treeChanges.entering;\n const redirectEnteringNodes = newTransition._treeChanges.entering;\n\n // --- Re-use resolve data from original transition ---\n // When redirecting from a parent state to a child state where the parent parameter values haven't changed\n // (because of the redirect), the resolves fetched by the original transition are still valid in the\n // redirected transition.\n //\n // This allows you to define a redirect on a parent state which depends on an async resolve value.\n // You can wait for the resolve, then redirect to a child state based on the result.\n // The redirected transition does not have to re-fetch the resolve.\n // ---------------------------------------------------------\n\n const nodeIsReloading = (reloadState: StateObject) => (node: PathNode) => {\n return reloadState && node.state.includes[reloadState.name];\n };\n\n // Find any \"entering\" nodes in the redirect path that match the original path and aren't being reloaded\n const matchingEnteringNodes: PathNode[] = PathUtils.matching(redirectEnteringNodes, originalEnteringNodes, PathUtils.nonDynamicParams)\n .filter(not(nodeIsReloading(targetState.options().reloadState)));\n\n // Use the existing (possibly pre-resolved) resolvables for the matching entering nodes.\n matchingEnteringNodes.forEach((node, idx) => {\n node.resolvables = originalEnteringNodes[idx].resolvables;\n });\n\n return newTransition;\n }\n\n /** @hidden If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */\n private _changedParams(): Param[] {\n const tc = this._treeChanges;\n\n /** Return undefined if it's not a \"dynamic\" transition, for the following reasons */\n // If user explicitly wants a reload\n if (this._options.reload) return undefined;\n // If any states are exiting or entering\n if (tc.exiting.length || tc.entering.length) return undefined;\n // If to/from path lengths differ\n if (tc.to.length !== tc.from.length) return undefined;\n // If the to/from paths are different\n const pathsDiffer: boolean = arrayTuples(tc.to, tc.from)\n .map(tuple => tuple[0].state !== tuple[1].state)\n .reduce(anyTrueR, false);\n if (pathsDiffer) return undefined;\n\n // Find any parameter values that differ\n const nodeSchemas: Param[][] = tc.to.map((node: PathNode) => node.paramSchema);\n const [toValues, fromValues] = [tc.to, tc.from].map(path => path.map(x => x.paramValues));\n const tuples = arrayTuples(nodeSchemas, toValues, fromValues);\n\n return tuples.map(([schema, toVals, fromVals]) => Param.changed(schema, toVals, fromVals)).reduce(unnestR, []);\n }\n\n /**\n * Returns true if the transition is dynamic.\n *\n * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed.\n *\n * @returns true if the Transition is dynamic\n */\n dynamic(): boolean {\n const changes = this._changedParams();\n return !changes ? false : changes.map(x => x.dynamic).reduce(anyTrueR, false);\n }\n\n /**\n * Returns true if the transition is ignored.\n *\n * A transition is ignored if no states are entered nor exited, and no parameter values have changed.\n *\n * @returns true if the Transition is ignored.\n */\n ignored(): boolean {\n return !!this._ignoredReason();\n }\n\n /** @hidden */\n _ignoredReason(): 'SameAsCurrent'|'SameAsPending'|undefined {\n const pending = this.router.globals.transition;\n const reloadState = this._options.reloadState;\n\n const same = (pathA, pathB) => {\n if (pathA.length !== pathB.length) return false;\n const matching = PathUtils.matching(pathA, pathB);\n return pathA.length === matching.filter(node => !reloadState || !node.state.includes[reloadState.name]).length;\n };\n\n const newTC = this.treeChanges();\n const pendTC = pending && pending.treeChanges();\n\n if (pendTC && same(pendTC.to, newTC.to) && same(pendTC.exiting, newTC.exiting)) return 'SameAsPending';\n if (newTC.exiting.length === 0 && newTC.entering.length === 0 && same(newTC.from, newTC.to)) return 'SameAsCurrent';\n }\n\n /**\n * Runs the transition\n *\n * This method is generally called from the [[StateService.transitionTo]]\n *\n * @internalapi\n *\n * @returns a promise for a successful transition.\n */\n run(): Promise {\n const runAllHooks = TransitionHook.runAllHooks;\n\n // Gets transition hooks array for the given phase\n const getHooksFor = (phase: TransitionHookPhase) =>\n this._hookBuilder.buildHooksForPhase(phase);\n\n // When the chain is complete, then resolve or reject the deferred\n const transitionSuccess = () => {\n trace.traceSuccess(this.$to(), this);\n this.success = true;\n this._deferred.resolve(this.to());\n runAllHooks(getHooksFor(TransitionHookPhase.SUCCESS));\n };\n\n const transitionError = (reason: any) => {\n trace.traceError(reason, this);\n this.success = false;\n this._deferred.reject(reason);\n this._error = reason;\n runAllHooks(getHooksFor(TransitionHookPhase.ERROR));\n };\n\n const runTransition = () => {\n // Wait to build the RUN hook chain until the BEFORE hooks are done\n // This allows a BEFORE hook to dynamically add additional RUN hooks via the Transition object.\n const allRunHooks = getHooksFor(TransitionHookPhase.RUN);\n const done = () => services.$q.when(undefined);\n return TransitionHook.invokeHooks(allRunHooks, done);\n };\n\n const startTransition = () => {\n const globals = this.router.globals;\n\n globals.lastStartedTransitionId = this.$id;\n globals.transition = this;\n globals.transitionHistory.enqueue(this);\n\n trace.traceTransitionStart(this);\n\n return services.$q.when(undefined);\n };\n\n const allBeforeHooks = getHooksFor(TransitionHookPhase.BEFORE);\n TransitionHook.invokeHooks(allBeforeHooks, startTransition)\n .then(runTransition)\n .then(transitionSuccess, transitionError);\n\n return this.promise;\n }\n\n /** Checks if this transition is currently active/running. */\n isActive = () =>\n this.router.globals.transition === this;\n\n /**\n * Checks if the Transition is valid\n *\n * @returns true if the Transition is valid\n */\n valid() {\n return !this.error() || this.success !== undefined;\n }\n\n /**\n * Aborts this transition\n *\n * Imperative API to abort a Transition.\n * This only applies to Transitions that are not yet complete.\n */\n abort() {\n // Do not set flag if the transition is already complete\n if (isUndefined(this.success)) {\n this._aborted = true;\n }\n }\n\n /**\n * The Transition error reason.\n *\n * If the transition is invalid (and could not be run), returns the reason the transition is invalid.\n * If the transition was valid and ran, but was not successful, returns the reason the transition failed.\n *\n * @returns an error message explaining why the transition is invalid, or the reason the transition failed.\n */\n error() {\n const state: StateObject = this.$to();\n\n if (state.self.abstract)\n return `Cannot transition to abstract state '${state.name}'`;\n\n const paramDefs = state.parameters(), values = this.params();\n const invalidParams = paramDefs.filter(param => !param.validates(values[param.id]));\n if (invalidParams.length) {\n return `Param values not valid for state '${state.name}'. Invalid params: [ ${invalidParams.map(param => param.id).join(', ')} ]`;\n }\n\n if (this.success === false)\n return this._error;\n }\n\n /**\n * A string representation of the Transition\n *\n * @returns A string representation of the Transition\n */\n toString () {\n const fromStateOrName = this.from();\n const toStateOrName = this.to();\n\n const avoidEmptyHash = (params: RawParams) =>\n (params['#'] !== null && params['#'] !== undefined) ? params : omit(params, ['#']);\n\n // (X) means the to state is invalid.\n const id = this.$id,\n from = isObject(fromStateOrName) ? fromStateOrName.name : fromStateOrName,\n fromParams = stringify(avoidEmptyHash(this._treeChanges.from.map(prop('paramValues')).reduce(mergeR, {}))),\n toValid = this.valid() ? '' : '(X) ',\n to = isObject(toStateOrName) ? toStateOrName.name : toStateOrName,\n toParams = stringify(avoidEmptyHash(this.params()));\n\n return `Transition#${id}( '${from}'${fromParams} -> ${toValid}'${to}'${toParams} )`;\n }\n}\n", + "/**\n * @coreapi\n * @module params\n */\n/** */\nimport { fromJson, toJson, identity, equals, inherit, map, extend, pick } from '../common/common';\nimport { isDefined, isNullOrUndefined } from '../common/predicates';\nimport { is } from '../common/hof';\nimport { services } from '../common/coreservices';\nimport { ParamType } from './paramType';\nimport { ParamTypeDefinition } from './interface';\n\n/**\n * A registry for parameter types.\n *\n * This registry manages the built-in (and custom) parameter types.\n *\n * The built-in parameter types are:\n *\n * - [[string]]\n * - [[path]]\n * - [[query]]\n * - [[hash]]\n * - [[int]]\n * - [[bool]]\n * - [[date]]\n * - [[json]]\n * - [[any]]\n */\nexport class ParamTypes {\n /**\n * Built-in parameter type: `string`\n *\n * This parameter type coerces values to strings.\n * It matches anything (`new RegExp(\".*\")`) in the URL\n */\n static string: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `path`\n *\n * This parameter type is the default type for path parameters.\n * A path parameter is any parameter declared in the path portion of a url\n *\n * - `/foo/:param1/:param2`: two path parameters\n *\n * This parameter type behaves exactly like the [[string]] type with one exception.\n * When matching parameter values in the URL, the `path` type does not match forward slashes `/`.\n *\n * #### Angular 1 note:\n * In ng1, this type is overridden with one that pre-encodes slashes as `~2F` instead of `%2F`.\n * For more details about this angular 1 behavior, see: https://github.com/angular-ui/ui-router/issues/2598\n */\n static path: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `query`\n *\n * This parameter type is the default type for query/search parameters.\n * It behaves the same as the [[string]] parameter type.\n *\n * A query parameter is any parameter declared in the query/search portion of a url\n *\n * - `/bar?param2`: a query parameter\n */\n static query: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `hash`\n *\n * This parameter type is used for the `#` parameter (the hash)\n * It behaves the same as the [[string]] parameter type.\n * @coreapi\n */\n static hash: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `int`\n *\n * This parameter type serializes javascript integers (`number`s which represent an integer) to the URL.\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'user',\n * url: '/user/{id:int}'\n * });\n * ```\n * ```js\n * $state.go('user', { id: 1298547 });\n * ```\n *\n * The URL will serialize to: `/user/1298547`.\n *\n * When the parameter value is read, it will be the `number` `1298547`, not the string `\"1298547\"`.\n */\n static int: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `bool`\n *\n * This parameter type serializes `true`/`false` as `1`/`0`\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'inbox',\n * url: '/inbox?{unread:bool}'\n * });\n * ```\n * ```js\n * $state.go('inbox', { unread: true });\n * ```\n *\n * The URL will serialize to: `/inbox?unread=1`.\n *\n * Conversely, if the url is `/inbox?unread=0`, the value of the `unread` parameter will be a `false`.\n */\n static bool: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `date`\n *\n * This parameter type can be used to serialize Javascript dates as parameter values.\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'search',\n * url: '/search?{start:date}'\n * });\n * ```\n * ```js\n * $state.go('search', { start: new Date(2000, 0, 1) });\n * ```\n *\n * The URL will serialize to: `/search?start=2000-01-01`.\n *\n * Conversely, if the url is `/search?start=2016-12-25`, the value of the `start` parameter will be a `Date` object where:\n *\n * - `date.getFullYear() === 2016`\n * - `date.getMonth() === 11` (month is 0-based)\n * - `date.getDate() === 25`\n */\n static date: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `json`\n *\n * This parameter type can be used to serialize javascript objects into the URL using JSON serialization.\n *\n * #### Example:\n * This example serializes an plain javascript object to the URL\n * ```js\n * .state({\n * name: 'map',\n * url: '/map/{coords:json}'\n * });\n * ```\n * ```js\n * $state.go('map', { coords: { x: 10399.2, y: 49071 });\n * ```\n *\n * The URL will serialize to: `/map/%7B%22x%22%3A10399.2%2C%22y%22%3A49071%7D`\n */\n static json: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `any`\n *\n * This parameter type is used by default for url-less parameters (parameters that do not appear in the URL).\n * This type does not encode or decode.\n * It is compared using a deep `equals` comparison.\n *\n * #### Example:\n * This example defines a non-url parameter on a [[StateDeclaration]].\n * ```js\n * .state({\n * name: 'new',\n * url: '/new',\n * params: {\n * inrepyto: null\n * }\n * });\n * ```\n * ```js\n * $state.go('new', { inreplyto: currentMessage });\n * ```\n */\n static any: ParamTypeDefinition;\n\n\n /** @hidden */\n types: any;\n /** @hidden */\n enqueue = true;\n /** @hidden */\n typeQueue: any[] = [];\n\n /** @internalapi */\n private defaultTypes: any = pick(ParamTypes.prototype, ['hash', 'string', 'query', 'path', 'int', 'bool', 'date', 'json', 'any']);\n\n /** @internalapi */\n constructor() {\n // Register default types. Store them in the prototype of this.types.\n const makeType = (definition: ParamTypeDefinition, name: string) =>\n new ParamType(extend({ name }, definition));\n this.types = inherit(map(this.defaultTypes, makeType), {});\n }\n\n /** @internalapi */\n dispose() {\n this.types = {};\n }\n\n /**\n * Registers a parameter type\n *\n * End users should call [[UrlMatcherFactory.type]], which delegates to this method.\n */\n type(name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {\n if (!isDefined(definition)) return this.types[name];\n if (this.types.hasOwnProperty(name)) throw new Error(`A type named '${name}' has already been defined.`);\n\n this.types[name] = new ParamType(extend({ name }, definition));\n\n if (definitionFn) {\n this.typeQueue.push({ name, def: definitionFn });\n if (!this.enqueue) this._flushTypeQueue();\n }\n\n return this;\n }\n\n /** @internalapi */\n _flushTypeQueue() {\n while (this.typeQueue.length) {\n const type = this.typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n extend(this.types[type.name], services.$injector.invoke(type.def));\n }\n }\n}\n\n/** @hidden */\nfunction initDefaultTypes() {\n\n const makeDefaultType = (def) => {\n const valToString = (val: any) =>\n val != null ? val.toString() : val;\n\n const defaultTypeBase = {\n encode: valToString,\n decode: valToString,\n is: is(String),\n pattern: /.*/,\n // tslint:disable-next-line:triple-equals\n equals: (a: any, b: any) => a == b, // allow coersion for null/undefined/\"\"\n };\n\n return extend({}, defaultTypeBase, def) as ParamTypeDefinition;\n };\n\n // Default Parameter Type Definitions\n extend(ParamTypes.prototype, {\n string: makeDefaultType({}),\n\n path: makeDefaultType({\n pattern: /[^/]*/,\n }),\n\n query: makeDefaultType({}),\n\n hash: makeDefaultType({\n inherit: false,\n }),\n\n int: makeDefaultType({\n decode: (val: string) => parseInt(val, 10),\n is: function(val: any) {\n return !isNullOrUndefined(val) && this.decode(val.toString()) === val;\n },\n pattern: /-?\\d+/,\n }),\n\n bool: makeDefaultType({\n encode: (val: any) => val && 1 || 0,\n decode: (val: string) => parseInt(val, 10) !== 0,\n is: is(Boolean),\n pattern: /0|1/,\n }),\n\n date: makeDefaultType({\n encode: function(val: any) {\n return !this.is(val) ? undefined : [\n val.getFullYear(),\n ('0' + (val.getMonth() + 1)).slice(-2),\n ('0' + val.getDate()).slice(-2),\n ].join('-');\n },\n decode: function(val: string) {\n if (this.is(val)) return val as Date;\n const match = this.capture.exec(val);\n return match ? new Date(match[1], match[2] - 1, match[3]) : undefined;\n },\n is: (val: any) => val instanceof Date && !isNaN(val.valueOf()),\n equals(l: any, r: any) {\n return ['getFullYear', 'getMonth', 'getDate']\n .reduce((acc, fn) => acc && l[fn]() === r[fn](), true);\n },\n pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,\n capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/,\n }),\n\n json: makeDefaultType({\n encode: toJson,\n decode: fromJson,\n is: is(Object),\n equals: equals,\n pattern: /[^/]*/,\n }),\n\n // does not encode/decode\n any: makeDefaultType({\n encode: identity,\n decode: identity,\n is: () => true,\n equals: equals,\n }),\n });\n}\n\ninitDefaultTypes();\n\n", + "/**\n * @coreapi\n * @module params\n */\n/** */\nimport { extend, ancestors, Obj } from '../common/common';\nimport { StateObject } from '../state/stateObject';\n\n/** @internalapi */\nexport class StateParams {\n [key: string]: any;\n\n constructor(params: Obj = {}) {\n extend(this, params);\n }\n\n /**\n * Merges a set of parameters with all parameters inherited between the common parents of the\n * current state and a given destination state.\n *\n * @param {Object} newParams The set of parameters which will be composited with inherited params.\n * @param {Object} $current Internal definition of object representing the current state.\n * @param {Object} $to Internal definition of object representing state to transition to.\n */\n $inherit(newParams: Obj, $current: StateObject, $to: StateObject) {\n let parentParams: string[];\n const parents = ancestors($current, $to),\n inherited: Obj = {},\n inheritList: string[] = [];\n\n for (const i in parents) {\n if (!parents[i] || !parents[i].params) continue;\n parentParams = Object.keys(parents[i].params);\n if (!parentParams.length) continue;\n\n for (const j in parentParams) {\n if (inheritList.indexOf(parentParams[j]) >= 0) continue;\n inheritList.push(parentParams[j]);\n inherited[parentParams[j]] = this[parentParams[j]];\n }\n }\n return extend({}, inherited, newParams);\n }\n}\n\n", + "/** @module state */ /** for typedoc */\nimport { isString } from '../common/predicates';\nimport { StateOrName } from './interface';\nimport { StateObject } from './stateObject';\nimport { values } from '../common/common';\n\nexport class StateMatcher {\n constructor (private _states: { [key: string]: StateObject }) { }\n\n isRelative(stateName: string) {\n stateName = stateName || '';\n return stateName.indexOf('.') === 0 || stateName.indexOf('^') === 0;\n }\n\n\n find(stateOrName: StateOrName, base?: StateOrName, matchGlob = true): StateObject {\n if (!stateOrName && stateOrName !== '') return undefined;\n const isStr = isString(stateOrName);\n let name: string = isStr ? stateOrName : (stateOrName).name;\n\n if (this.isRelative(name)) name = this.resolvePath(name, base);\n const state = this._states[name];\n\n if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {\n return state;\n } else if (isStr && matchGlob) {\n const _states = values(this._states);\n const matches = _states.filter(_state =>\n _state.__stateObjectCache.nameGlob &&\n _state.__stateObjectCache.nameGlob.matches(name),\n );\n\n if (matches.length > 1) {\n // tslint:disable-next-line:no-console\n console.log(`stateMatcher.find: Found multiple matches for ${name} using glob: `, matches.map(match => match.name));\n }\n return matches[0];\n }\n return undefined;\n }\n\n resolvePath(name: string, base: StateOrName) {\n if (!base) throw new Error(`No reference point given for path '${name}'`);\n\n const baseState: StateObject = this.find(base);\n\n const splitName = name.split('.');\n const pathLength = splitName.length;\n let i = 0, current = baseState;\n\n for (; i < pathLength; i++) {\n if (splitName[i] === '' && i === 0) {\n current = baseState;\n continue;\n }\n if (splitName[i] === '^') {\n if (!current.parent) throw new Error(`Path '${name}' not valid for state '${baseState.name}'`);\n current = current.parent;\n continue;\n }\n break;\n }\n const relName = splitName.slice(i).join('.');\n return current.name + (current.name && relName ? '.' : '') + relName;\n }\n}\n", + "/** @module state */ /** for typedoc */\nimport { inArray } from '../common/common';\nimport { isString } from '../common/predicates';\nimport { StateDeclaration, _StateDeclaration } from './interface';\nimport { StateObject } from './stateObject';\nimport { StateBuilder } from './stateBuilder';\nimport { StateRegistryListener, StateRegistry } from './stateRegistry';\nimport { Disposable } from '../interface';\nimport { UrlRouter } from '../url/urlRouter';\nimport { prop } from '../common/hof';\nimport { StateMatcher } from './stateMatcher';\n\n/** @internalapi */\nexport class StateQueueManager implements Disposable {\n queue: StateObject[];\n matcher: StateMatcher;\n\n constructor(\n private $registry: StateRegistry,\n private $urlRouter: UrlRouter,\n public states: { [key: string]: StateObject; },\n public builder: StateBuilder,\n public listeners: StateRegistryListener[]) {\n this.queue = [];\n this.matcher = $registry.matcher;\n }\n\n /** @internalapi */\n dispose() {\n this.queue = [];\n }\n\n register(stateDecl: _StateDeclaration) {\n const queue = this.queue;\n const state = StateObject.create(stateDecl);\n const name = state.name;\n\n if (!isString(name)) throw new Error('State must have a valid name');\n if (this.states.hasOwnProperty(name) || inArray(queue.map(prop('name')), name))\n throw new Error(`State '${name}' is already defined`);\n\n queue.push(state);\n this.flush();\n\n return state;\n }\n\n flush() {\n const { queue, states, builder } = this;\n const registered: StateObject[] = [], // states that got registered\n orphans: StateObject[] = [], // states that don't yet have a parent registered\n previousQueueLength = {}; // keep track of how long the queue when an orphan was first encountered\n const getState = (name) =>\n this.states.hasOwnProperty(name) && this.states[name];\n\n while (queue.length > 0) {\n const state: StateObject = queue.shift();\n const name = state.name;\n const result: StateObject = builder.build(state);\n const orphanIdx: number = orphans.indexOf(state);\n\n if (result) {\n const existingState = getState(name);\n if (existingState && existingState.name === name) {\n throw new Error(`State '${name}' is already defined`);\n }\n\n const existingFutureState = getState(name + '.**');\n if (existingFutureState) {\n // Remove future state of the same name\n this.$registry.deregister(existingFutureState);\n }\n\n states[name] = state;\n this.attachRoute(state);\n if (orphanIdx >= 0) orphans.splice(orphanIdx, 1);\n registered.push(state);\n continue;\n }\n\n const prev = previousQueueLength[name];\n previousQueueLength[name] = queue.length;\n if (orphanIdx >= 0 && prev === queue.length) {\n // Wait until two consecutive iterations where no additional states were dequeued successfully.\n // throw new Error(`Cannot register orphaned state '${name}'`);\n queue.push(state);\n return states;\n } else if (orphanIdx < 0) {\n orphans.push(state);\n }\n\n queue.push(state);\n }\n\n if (registered.length) {\n this.listeners.forEach(listener => listener('registered', registered.map(s => s.self)));\n }\n\n return states;\n }\n\n attachRoute(state: StateObject) {\n if (state.abstract || !state.url) return;\n\n this.$urlRouter.rule(this.$urlRouter.urlRuleFactory.create(state));\n }\n}\n", + "/**\n * @coreapi\n * @module state\n */ /** for typedoc */\n\nimport { StateObject } from './stateObject';\nimport { StateMatcher } from './stateMatcher';\nimport { StateBuilder } from './stateBuilder';\nimport { StateQueueManager } from './stateQueueManager';\nimport { StateDeclaration, _StateDeclaration } from './interface';\nimport { BuilderFunction } from './stateBuilder';\nimport { StateOrName } from './interface';\nimport { removeFrom } from '../common/common';\nimport { UIRouter } from '../router';\nimport { propEq } from '../common/hof';\n\n/**\n * The signature for the callback function provided to [[StateRegistry.onStatesChanged]].\n *\n * This callback receives two parameters:\n *\n * @param event a string; either \"registered\" or \"deregistered\"\n * @param states the list of [[StateDeclaration]]s that were registered (or deregistered).\n */\nexport type StateRegistryListener = (event: 'registered'|'deregistered', states: StateDeclaration[]) => void;\n\nexport class StateRegistry {\n private _root: StateObject;\n private states: { [key: string]: StateObject } = {};\n\n matcher: StateMatcher;\n private builder: StateBuilder;\n stateQueue: StateQueueManager;\n\n listeners: StateRegistryListener[] = [];\n\n /** @internalapi */\n constructor(private _router: UIRouter) {\n this.matcher = new StateMatcher(this.states);\n this.builder = new StateBuilder(this.matcher, _router.urlMatcherFactory);\n this.stateQueue = new StateQueueManager(this, _router.urlRouter, this.states, this.builder, this.listeners);\n this._registerRoot();\n }\n\n /** @internalapi */\n private _registerRoot() {\n const rootStateDef: StateDeclaration = {\n name: '',\n url: '^',\n views: null,\n params: {\n '#': { value: null, type: 'hash', dynamic: true },\n },\n abstract: true,\n };\n\n const _root = this._root = this.stateQueue.register(rootStateDef);\n _root.navigable = null;\n }\n\n /** @internalapi */\n dispose() {\n this.stateQueue.dispose();\n this.listeners = [];\n this.get().forEach(state => this.get(state) && this.deregister(state));\n }\n\n /**\n * Listen for a State Registry events\n *\n * Adds a callback that is invoked when states are registered or deregistered with the StateRegistry.\n *\n * #### Example:\n * ```js\n * let allStates = registry.get();\n *\n * // Later, invoke deregisterFn() to remove the listener\n * let deregisterFn = registry.onStatesChanged((event, states) => {\n * switch(event) {\n * case: 'registered':\n * states.forEach(state => allStates.push(state));\n * break;\n * case: 'deregistered':\n * states.forEach(state => {\n * let idx = allStates.indexOf(state);\n * if (idx !== -1) allStates.splice(idx, 1);\n * });\n * break;\n * }\n * });\n * ```\n *\n * @param listener a callback function invoked when the registered states changes.\n * The function receives two parameters, `event` and `state`.\n * See [[StateRegistryListener]]\n * @return a function that deregisters the listener\n */\n onStatesChanged(listener: StateRegistryListener): () => void {\n this.listeners.push(listener);\n return function deregisterListener() {\n removeFrom(this.listeners)(listener);\n }.bind(this);\n }\n\n /**\n * Gets the implicit root state\n *\n * Gets the root of the state tree.\n * The root state is implicitly created by UI-Router.\n * Note: this returns the internal [[StateObject]] representation, not a [[StateDeclaration]]\n *\n * @return the root [[StateObject]]\n */\n root() {\n return this._root;\n }\n\n /**\n * Adds a state to the registry\n *\n * Registers a [[StateDeclaration]] or queues it for registration.\n *\n * Note: a state will be queued if the state's parent isn't yet registered.\n *\n * @param stateDefinition the definition of the state to register.\n * @returns the internal [[StateObject]] object.\n * If the state was successfully registered, then the object is fully built (See: [[StateBuilder]]).\n * If the state was only queued, then the object is not fully built.\n */\n register(stateDefinition: _StateDeclaration): StateObject {\n return this.stateQueue.register(stateDefinition);\n }\n\n /** @hidden */\n private _deregisterTree(state: StateObject) {\n const all = this.get().map(s => s.$$state());\n const getChildren = (states: StateObject[]) => {\n const _children = all.filter(s => states.indexOf(s.parent) !== -1);\n return _children.length === 0 ? _children : _children.concat(getChildren(_children));\n };\n\n const children = getChildren([state]);\n const deregistered: StateObject[] = [state].concat(children).reverse();\n\n deregistered.forEach(_state => {\n const $ur = this._router.urlRouter;\n // Remove URL rule\n $ur.rules().filter(propEq('state', _state)).forEach($ur.removeRule.bind($ur));\n // Remove state from registry\n delete this.states[_state.name];\n });\n\n return deregistered;\n }\n\n /**\n * Removes a state from the registry\n *\n * This removes a state from the registry.\n * If the state has children, they are are also removed from the registry.\n *\n * @param stateOrName the state's name or object representation\n * @returns {StateObject[]} a list of removed states\n */\n deregister(stateOrName: StateOrName) {\n const _state = this.get(stateOrName);\n if (!_state) throw new Error(\"Can't deregister state; not found: \" + stateOrName);\n const deregisteredStates = this._deregisterTree(_state.$$state());\n\n this.listeners.forEach(listener => listener('deregistered', deregisteredStates.map(s => s.self)));\n return deregisteredStates;\n }\n\n /**\n * Gets all registered states\n *\n * Calling this method with no arguments will return a list of all the states that are currently registered.\n * Note: this does not return states that are *queued* but not yet registered.\n *\n * @return a list of [[StateDeclaration]]s\n */\n get(): StateDeclaration[];\n\n /**\n * Gets a registered state\n *\n * Given a state or a name, finds and returns the [[StateDeclaration]] from the registry.\n * Note: this does not return states that are *queued* but not yet registered.\n *\n * @param stateOrName either the name of a state, or a state object.\n * @param base the base state to use when stateOrName is relative.\n * @return a registered [[StateDeclaration]] that matched the `stateOrName`, or null if the state isn't registered.\n */\n get(stateOrName: StateOrName, base?: StateOrName): StateDeclaration;\n get(stateOrName?: StateOrName, base?: StateOrName): any {\n if (arguments.length === 0)\n return Object.keys(this.states).map(name => this.states[name].self);\n const found = this.matcher.find(stateOrName, base);\n return found && found.self || null;\n }\n\n decorator(name: string, func: BuilderFunction) {\n return this.builder.builder(name, func);\n }\n}\n", + "/**\n * @internalapi\n * @module url\n */ /** for typedoc */\nimport { forEach, extend } from '../common/common';\nimport { isObject, isDefined, isFunction, isString } from '../common/predicates';\nimport { UrlMatcher } from './urlMatcher';\nimport { Param, DefType } from '../params/param';\nimport { ParamTypes } from '../params/paramTypes';\nimport { ParamTypeDefinition } from '../params/interface';\nimport { Disposable } from '../interface';\nimport { ParamType } from '../params/paramType';\nimport { ParamFactory, UrlMatcherConfig } from './interface';\n\n/**\n * Factory for [[UrlMatcher]] instances.\n *\n * The factory is available to ng1 services as\n * `$urlMatcherFactory` or ng1 providers as `$urlMatcherFactoryProvider`.\n */\nexport class UrlMatcherFactory implements Disposable, UrlMatcherConfig {\n /** @hidden */ paramTypes = new ParamTypes();\n /** @hidden */ _isCaseInsensitive = false;\n /** @hidden */ _isStrictMode = true;\n /** @hidden */ _defaultSquashPolicy: (boolean|string) = false;\n\n /** @internalapi Creates a new [[Param]] for a given location (DefType) */\n paramFactory: ParamFactory = {\n /** Creates a new [[Param]] from a CONFIG block */\n fromConfig: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.CONFIG, this),\n\n /** Creates a new [[Param]] from a url PATH */\n fromPath: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.PATH, this),\n\n /** Creates a new [[Param]] from a url SEARCH */\n fromSearch: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.SEARCH, this),\n };\n\n constructor() {\n extend(this, { UrlMatcher, Param });\n }\n\n /** @inheritdoc */\n caseInsensitive(value?: boolean): boolean {\n return this._isCaseInsensitive = isDefined(value) ? value : this._isCaseInsensitive;\n }\n\n /** @inheritdoc */\n strictMode(value?: boolean): boolean {\n return this._isStrictMode = isDefined(value) ? value : this._isStrictMode;\n }\n\n /** @inheritdoc */\n defaultSquashPolicy(value?: (boolean|string)) {\n if (isDefined(value) && value !== true && value !== false && !isString(value))\n throw new Error(`Invalid squash policy: ${value}. Valid policies: false, true, arbitrary-string`);\n return this._defaultSquashPolicy = isDefined(value) ? value : this._defaultSquashPolicy;\n }\n\n /** @hidden */\n private _getConfig = (config) =>\n extend({ strict: this._isStrictMode, caseInsensitive: this._isCaseInsensitive }, config);\n\n /**\n * Creates a [[UrlMatcher]] for the specified pattern.\n *\n * @param pattern The URL pattern.\n * @param config The config object hash.\n * @returns The UrlMatcher.\n */\n compile(pattern: string, config?: { [key: string]: any }) {\n return new UrlMatcher(pattern, this.paramTypes, this.paramFactory, this._getConfig(config));\n }\n\n /**\n * Returns true if the specified object is a [[UrlMatcher]], or false otherwise.\n *\n * @param object The object to perform the type check against.\n * @returns `true` if the object matches the `UrlMatcher` interface, by\n * implementing all the same methods.\n */\n isMatcher(object: any): boolean {\n // TODO: typeof?\n if (!isObject(object)) return false;\n let result = true;\n\n forEach(UrlMatcher.prototype, (val, name) => {\n if (isFunction(val)) result = result && (isDefined(object[name]) && isFunction(object[name]));\n });\n return result;\n }\n\n /**\n * Creates and registers a custom [[ParamType]] object\n *\n * A [[ParamType]] can be used to generate URLs with typed parameters.\n *\n * @param name The type name.\n * @param definition The type definition. See [[ParamTypeDefinition]] for information on the values accepted.\n * @param definitionFn A function that is injected before the app runtime starts.\n * The result of this function should be a [[ParamTypeDefinition]].\n * The result is merged into the existing `definition`.\n * See [[ParamType]] for information on the values accepted.\n *\n * @returns - if a type was registered: the [[UrlMatcherFactory]]\n * - if only the `name` parameter was specified: the currently registered [[ParamType]] object, or undefined\n *\n * Note: Register custom types *before using them* in a state definition.\n *\n * See [[ParamTypeDefinition]] for examples\n */\n type(name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {\n const type = this.paramTypes.type(name, definition, definitionFn);\n return !isDefined(definition) ? type : this;\n }\n\n /** @hidden */\n $get() {\n this.paramTypes.enqueue = false;\n this.paramTypes._flushTypeQueue();\n return this;\n }\n\n /** @internalapi */\n dispose() {\n this.paramTypes.dispose();\n }\n}\n", + "/**\n * @coreapi\n * @module url\n */ /** */\nimport { UrlMatcher } from './urlMatcher';\nimport { isString, isDefined, isFunction, isState } from '../common/predicates';\nimport { UIRouter } from '../router';\nimport { identity, extend } from '../common/common';\nimport { is, pattern } from '../common/hof';\nimport { StateObject } from '../state/stateObject';\nimport { RawParams } from '../params/interface';\nimport {\n UrlRule, UrlRuleMatchFn, UrlRuleHandlerFn, UrlRuleType, UrlParts, MatcherUrlRule, StateRule, RegExpRule,\n} from './interface';\n\n/**\n * Creates a [[UrlRule]]\n *\n * Creates a [[UrlRule]] from a:\n *\n * - `string`\n * - [[UrlMatcher]]\n * - `RegExp`\n * - [[StateObject]]\n * @internalapi\n */\nexport class UrlRuleFactory {\n static isUrlRule = obj =>\n obj && ['type', 'match', 'handler'].every(key => isDefined(obj[key]));\n\n constructor(public router: UIRouter) { }\n\n compile(str: string) {\n return this.router.urlMatcherFactory.compile(str);\n }\n\n create(what: string|UrlMatcher|StateObject|RegExp|UrlRuleMatchFn, handler?: string|UrlRuleHandlerFn): UrlRule {\n const makeRule = pattern([\n [isString, (_what: string) => makeRule(this.compile(_what))],\n [is(UrlMatcher), (_what: UrlMatcher) => this.fromUrlMatcher(_what, handler)],\n [isState, (_what: StateObject) => this.fromState(_what, this.router)],\n [is(RegExp), (_what: RegExp) => this.fromRegExp(_what, handler)],\n [isFunction, (_what: UrlRuleMatchFn) => new BaseUrlRule(_what, handler as UrlRuleHandlerFn)],\n ]);\n\n const rule = makeRule(what);\n if (!rule) throw new Error(\"invalid 'what' in when()\");\n return rule;\n }\n\n /**\n * A UrlRule which matches based on a UrlMatcher\n *\n * The `handler` may be either a `string`, a [[UrlRuleHandlerFn]] or another [[UrlMatcher]]\n *\n * ## Handler as a function\n *\n * If `handler` is a function, the function is invoked with:\n *\n * - matched parameter values ([[RawParams]] from [[UrlMatcher.exec]])\n * - url: the current Url ([[UrlParts]])\n * - router: the router object ([[UIRouter]])\n *\n * #### Example:\n * ```js\n * var urlMatcher = $umf.compile(\"/foo/:fooId/:barId\");\n * var rule = factory.fromUrlMatcher(urlMatcher, match => \"/home/\" + match.fooId + \"/\" + match.barId);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match); // '/home/123/456'\n * ```\n *\n * ## Handler as UrlMatcher\n *\n * If `handler` is a UrlMatcher, the handler matcher is used to create the new url.\n * The `handler` UrlMatcher is formatted using the matched param from the first matcher.\n * The url is replaced with the result.\n *\n * #### Example:\n * ```js\n * var urlMatcher = $umf.compile(\"/foo/:fooId/:barId\");\n * var handler = $umf.compile(\"/home/:fooId/:barId\");\n * var rule = factory.fromUrlMatcher(urlMatcher, handler);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match); // '/home/123/456'\n * ```\n */\n fromUrlMatcher(urlMatcher: UrlMatcher, handler: string|UrlMatcher|UrlRuleHandlerFn): MatcherUrlRule {\n let _handler: UrlRuleHandlerFn = handler as any;\n if (isString(handler)) handler = this.router.urlMatcherFactory.compile(handler);\n if (is(UrlMatcher)(handler)) _handler = (match: RawParams) => (handler as UrlMatcher).format(match);\n\n function matchUrlParamters(url: UrlParts): RawParams {\n const params = urlMatcher.exec(url.path, url.search, url.hash);\n return urlMatcher.validates(params) && params;\n }\n\n // Prioritize URLs, lowest to highest:\n // - Some optional URL parameters, but none matched\n // - No optional parameters in URL\n // - Some optional parameters, some matched\n // - Some optional parameters, all matched\n function matchPriority(params: RawParams): number {\n const optional = urlMatcher.parameters().filter(param => param.isOptional);\n if (!optional.length) return 0.000001;\n const matched = optional.filter(param => params[param.id]);\n return matched.length / optional.length;\n }\n\n const details = { urlMatcher, matchPriority, type: 'URLMATCHER' };\n return extend(new BaseUrlRule(matchUrlParamters, _handler), details) as MatcherUrlRule;\n }\n\n\n /**\n * A UrlRule which matches a state by its url\n *\n * #### Example:\n * ```js\n * var rule = factory.fromState($state.get('foo'), router);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match);\n * // Starts a transition to 'foo' with params: { fooId: '123', barId: '456' }\n * ```\n */\n fromState(state: StateObject, router: UIRouter): StateRule {\n /**\n * Handles match by transitioning to matched state\n *\n * First checks if the router should start a new transition.\n * A new transition is not required if the current state's URL\n * and the new URL are already identical\n */\n const handler = (match: RawParams) => {\n const $state = router.stateService;\n const globals = router.globals;\n if ($state.href(state, match) !== $state.href(globals.current, globals.params)) {\n $state.transitionTo(state, match, { inherit: true, source: 'url' });\n }\n };\n\n const details = { state, type: 'STATE' };\n return extend(this.fromUrlMatcher(state.url, handler), details) as StateRule;\n }\n\n /**\n * A UrlRule which matches based on a regular expression\n *\n * The `handler` may be either a [[UrlRuleHandlerFn]] or a string.\n *\n * ## Handler as a function\n *\n * If `handler` is a function, the function is invoked with:\n *\n * - regexp match array (from `regexp`)\n * - url: the current Url ([[UrlParts]])\n * - router: the router object ([[UIRouter]])\n *\n * #### Example:\n * ```js\n * var rule = factory.fromRegExp(/^\\/foo\\/(bar|baz)$/, match => \"/home/\" + match[1])\n * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ]\n * var result = rule.handler(match); // '/home/bar'\n * ```\n *\n * ## Handler as string\n *\n * If `handler` is a string, the url is *replaced by the string* when the Rule is invoked.\n * The string is first interpolated using `string.replace()` style pattern.\n *\n * #### Example:\n * ```js\n * var rule = factory.fromRegExp(/^\\/foo\\/(bar|baz)$/, \"/home/$1\")\n * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ]\n * var result = rule.handler(match); // '/home/bar'\n * ```\n */\n fromRegExp(regexp: RegExp, handler: string|UrlRuleHandlerFn): RegExpRule {\n if (regexp.global || regexp.sticky) throw new Error('Rule RegExp must not be global or sticky');\n\n /**\n * If handler is a string, the url will be replaced by the string.\n * If the string has any String.replace() style variables in it (like `$2`),\n * they will be replaced by the captures from [[match]]\n */\n const redirectUrlTo = (match: RegExpExecArray) =>\n // Interpolates matched values into $1 $2, etc using a String.replace()-style pattern\n (handler as string).replace(/\\$(\\$|\\d{1,2})/, (m, what) =>\n match[what === '$' ? 0 : Number(what)]);\n\n const _handler = isString(handler) ? redirectUrlTo : handler;\n\n const matchParamsFromRegexp = (url: UrlParts): RegExpExecArray =>\n regexp.exec(url.path);\n\n const details = { regexp, type: 'REGEXP' };\n return extend(new BaseUrlRule(matchParamsFromRegexp, _handler), details) as RegExpRule;\n }\n}\n\n/**\n * A base rule which calls `match`\n *\n * The value from the `match` function is passed through to the `handler`.\n * @internalapi\n */\nexport class BaseUrlRule implements UrlRule {\n $id: number;\n priority: number;\n type: UrlRuleType = 'RAW';\n handler: UrlRuleHandlerFn;\n matchPriority = (match) => 0 - this.$id;\n\n constructor(public match: UrlRuleMatchFn, handler?: UrlRuleHandlerFn) {\n this.handler = handler || identity;\n }\n}\n", + "/**\n * @coreapi\n * @module view\n */ /** for typedoc */\nimport { equals, applyPairs, removeFrom, TypedMap, inArray } from '../common/common';\nimport { curry, prop } from '../common/hof';\nimport { isString, isArray } from '../common/predicates';\nimport { trace } from '../common/trace';\nimport { PathNode } from '../path/pathNode';\nimport { ActiveUIView, ViewContext, ViewConfig } from './interface';\nimport { _ViewDeclaration } from '../state/interface';\n\nexport type ViewConfigFactory = (path: PathNode[], decl: _ViewDeclaration) => ViewConfig|ViewConfig[];\n\nexport interface ViewServicePluginAPI {\n _rootViewContext(context?: ViewContext): ViewContext;\n _viewConfigFactory(viewType: string, factory: ViewConfigFactory);\n _registeredUIViews(): ActiveUIView[];\n _activeViewConfigs(): ViewConfig[];\n _onSync(listener: ViewSyncListener): Function;\n}\n\n// A uiView and its matching viewConfig\nexport interface ViewTuple {\n uiView: ActiveUIView;\n viewConfig: ViewConfig;\n}\n\nexport interface ViewSyncListener {\n (viewTuples: ViewTuple[]): void;\n}\n\n/**\n * The View service\n *\n * This service pairs existing `ui-view` components (which live in the DOM)\n * with view configs (from the state declaration objects: [[StateDeclaration.views]]).\n *\n * - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]].\n * The views from exited states are deactivated via [[deactivateViewConfig]].\n * (See: the [[registerActivateViews]] Transition Hook)\n *\n * - As `ui-view` components pop in and out of existence, they register themselves using [[registerUIView]].\n *\n * - When the [[sync]] function is called, the registered `ui-view`(s) ([[ActiveUIView]])\n * are configured with the matching [[ViewConfig]](s)\n *\n */\nexport class ViewService {\n private _uiViews: ActiveUIView[] = [];\n private _viewConfigs: ViewConfig[] = [];\n private _rootContext: ViewContext;\n private _viewConfigFactories: { [key: string]: ViewConfigFactory } = {};\n private _listeners: ViewSyncListener[] = [];\n\n public _pluginapi: ViewServicePluginAPI = {\n _rootViewContext: this._rootViewContext.bind(this),\n _viewConfigFactory: this._viewConfigFactory.bind(this),\n _registeredUIViews: () => this._uiViews,\n _activeViewConfigs: () => this._viewConfigs,\n _onSync: (listener: ViewSyncListener) => {\n this._listeners.push(listener);\n return () => removeFrom(this._listeners, listener);\n },\n };\n\n /**\n * Given a ui-view and a ViewConfig, determines if they \"match\".\n *\n * A ui-view has a fully qualified name (fqn) and a context object. The fqn is built from its overall location in\n * the DOM, describing its nesting relationship to any parent ui-view tags it is nested inside of.\n *\n * A ViewConfig has a target ui-view name and a context anchor. The ui-view name can be a simple name, or\n * can be a segmented ui-view path, describing a portion of a ui-view fqn.\n *\n * In order for a ui-view to match ViewConfig, ui-view's $type must match the ViewConfig's $type\n *\n * If the ViewConfig's target ui-view name is a simple name (no dots), then a ui-view matches if:\n * - the ui-view's name matches the ViewConfig's target name\n * - the ui-view's context matches the ViewConfig's anchor\n *\n * If the ViewConfig's target ui-view name is a segmented name (with dots), then a ui-view matches if:\n * - There exists a parent ui-view where:\n * - the parent ui-view's name matches the first segment (index 0) of the ViewConfig's target name\n * - the parent ui-view's context matches the ViewConfig's anchor\n * - And the remaining segments (index 1..n) of the ViewConfig's target name match the tail of the ui-view's fqn\n *\n * Example:\n *\n * DOM:\n * \n * \n * \n * \n * \n * \n * \n * \n *\n * uiViews: [\n * { fqn: \"$default\", creationContext: { name: \"\" } },\n * { fqn: \"$default.foo\", creationContext: { name: \"A\" } },\n * { fqn: \"$default.foo.$default\", creationContext: { name: \"A.B\" } }\n * { fqn: \"$default.foo.$default.bar\", creationContext: { name: \"A.B.C\" } }\n * ]\n *\n * These four view configs all match the ui-view with the fqn: \"$default.foo.$default.bar\":\n *\n * - ViewConfig1: { uiViewName: \"bar\", uiViewContextAnchor: \"A.B.C\" }\n * - ViewConfig2: { uiViewName: \"$default.bar\", uiViewContextAnchor: \"A.B\" }\n * - ViewConfig3: { uiViewName: \"foo.$default.bar\", uiViewContextAnchor: \"A\" }\n * - ViewConfig4: { uiViewName: \"$default.foo.$default.bar\", uiViewContextAnchor: \"\" }\n *\n * Using ViewConfig3 as an example, it matches the ui-view with fqn \"$default.foo.$default.bar\" because:\n * - The ViewConfig's segmented target name is: [ \"foo\", \"$default\", \"bar\" ]\n * - There exists a parent ui-view (which has fqn: \"$default.foo\") where:\n * - the parent ui-view's name \"foo\" matches the first segment \"foo\" of the ViewConfig's target name\n * - the parent ui-view's context \"A\" matches the ViewConfig's anchor context \"A\"\n * - And the remaining segments [ \"$default\", \"bar\" ].join(\".\"_ of the ViewConfig's target name match\n * the tail of the ui-view's fqn \"default.bar\"\n *\n * @internalapi\n */\n static matches = (uiViewsByFqn: TypedMap, uiView: ActiveUIView) => (viewConfig: ViewConfig) => {\n // Don't supply an ng1 ui-view with an ng2 ViewConfig, etc\n if (uiView.$type !== viewConfig.viewDecl.$type) return false;\n\n // Split names apart from both viewConfig and uiView into segments\n const vc = viewConfig.viewDecl;\n const vcSegments = vc.$uiViewName.split('.');\n const uivSegments = uiView.fqn.split('.');\n\n // Check if the tails of the segment arrays match. ex, these arrays' tails match:\n // vc: [\"foo\", \"bar\"], uiv fqn: [\"$default\", \"foo\", \"bar\"]\n if (!equals(vcSegments, uivSegments.slice(0 - vcSegments.length)))\n return false;\n\n // Now check if the fqn ending at the first segment of the viewConfig matches the context:\n // [\"$default\", \"foo\"].join(\".\") == \"$default.foo\", does the ui-view $default.foo context match?\n const negOffset = (1 - vcSegments.length) || undefined;\n const fqnToFirstSegment = uivSegments.slice(0, negOffset).join('.');\n const uiViewContext = uiViewsByFqn[fqnToFirstSegment].creationContext;\n return vc.$uiViewContextAnchor === (uiViewContext && uiViewContext.name);\n }\n\n /**\n * Normalizes a view's name from a state.views configuration block.\n *\n * This should be used by a framework implementation to calculate the values for\n * [[_ViewDeclaration.$uiViewName]] and [[_ViewDeclaration.$uiViewContextAnchor]].\n *\n * @param context the context object (state declaration) that the view belongs to\n * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]]\n *\n * @returns the normalized uiViewName and uiViewContextAnchor that the view targets\n */\n static normalizeUIViewTarget(context: ViewContext, rawViewName = '') {\n // TODO: Validate incoming view name with a regexp to allow:\n // ex: \"view.name@foo.bar\" , \"^.^.view.name\" , \"view.name@^.^\" , \"\" ,\n // \"@\" , \"$default@^\" , \"!$default.$default\" , \"!foo.bar\"\n const viewAtContext: string[] = rawViewName.split('@');\n let uiViewName = viewAtContext[0] || '$default'; // default to unnamed view\n let uiViewContextAnchor = isString(viewAtContext[1]) ? viewAtContext[1] : '^'; // default to parent context\n\n // Handle relative view-name sugar syntax.\n // Matches rawViewName \"^.^.^.foo.bar\" into array: [\"^.^.^.foo.bar\", \"^.^.^\", \"foo.bar\"],\n const relativeViewNameSugar = /^(\\^(?:\\.\\^)*)\\.(.*$)/.exec(uiViewName);\n if (relativeViewNameSugar) {\n // Clobbers existing contextAnchor (rawViewName validation will fix this)\n uiViewContextAnchor = relativeViewNameSugar[1]; // set anchor to \"^.^.^\"\n uiViewName = relativeViewNameSugar[2]; // set view-name to \"foo.bar\"\n }\n\n if (uiViewName.charAt(0) === '!') {\n uiViewName = uiViewName.substr(1);\n uiViewContextAnchor = ''; // target absolutely from root\n }\n\n // handle parent relative targeting \"^.^.^\"\n const relativeMatch = /^(\\^(?:\\.\\^)*)$/;\n if (relativeMatch.exec(uiViewContextAnchor)) {\n const anchorState = uiViewContextAnchor.split('.')\n .reduce(((anchor, x) => anchor.parent), context);\n uiViewContextAnchor = anchorState.name;\n } else if (uiViewContextAnchor === '.') {\n uiViewContextAnchor = context.name;\n }\n\n return { uiViewName, uiViewContextAnchor };\n }\n\n constructor() { }\n\n private _rootViewContext(context?: ViewContext): ViewContext {\n return this._rootContext = context || this._rootContext;\n }\n\n private _viewConfigFactory(viewType: string, factory: ViewConfigFactory) {\n this._viewConfigFactories[viewType] = factory;\n }\n\n createViewConfig(path: PathNode[], decl: _ViewDeclaration): ViewConfig[] {\n const cfgFactory = this._viewConfigFactories[decl.$type];\n if (!cfgFactory) throw new Error('ViewService: No view config factory registered for type ' + decl.$type);\n const cfgs = cfgFactory(path, decl);\n return isArray(cfgs) ? cfgs : [cfgs];\n }\n\n /**\n * Deactivates a ViewConfig.\n *\n * This function deactivates a `ViewConfig`.\n * After calling [[sync]], it will un-pair from any `ui-view` with which it is currently paired.\n *\n * @param viewConfig The ViewConfig view to deregister.\n */\n deactivateViewConfig(viewConfig: ViewConfig) {\n trace.traceViewServiceEvent('<- Removing', viewConfig);\n removeFrom(this._viewConfigs, viewConfig);\n }\n\n activateViewConfig(viewConfig: ViewConfig) {\n trace.traceViewServiceEvent('-> Registering', viewConfig);\n this._viewConfigs.push(viewConfig);\n }\n\n\n sync() {\n const uiViewsByFqn: TypedMap =\n this._uiViews.map(uiv => [uiv.fqn, uiv]).reduce(applyPairs, {});\n\n // Return a weighted depth value for a uiView.\n // The depth is the nesting depth of ui-views (based on FQN; times 10,000)\n // plus the depth of the state that is populating the uiView\n function uiViewDepth(uiView: ActiveUIView) {\n const stateDepth = (context: ViewContext) =>\n context && context.parent ? stateDepth(context.parent) + 1 : 1;\n return (uiView.fqn.split('.').length * 10000) + stateDepth(uiView.creationContext);\n }\n\n // Return the ViewConfig's context's depth in the context tree.\n function viewConfigDepth(config: ViewConfig) {\n let context: ViewContext = config.viewDecl.$context, count = 0;\n while (++count && context.parent) context = context.parent;\n return count;\n }\n\n // Given a depth function, returns a compare function which can return either ascending or descending order\n const depthCompare = curry((depthFn, posNeg, left, right) => posNeg * (depthFn(left) - depthFn(right)));\n\n const matchingConfigPair = (uiView: ActiveUIView): ViewTuple => {\n const matchingConfigs = this._viewConfigs.filter(ViewService.matches(uiViewsByFqn, uiView));\n if (matchingConfigs.length > 1) {\n // This is OK. Child states can target a ui-view that the parent state also targets (the child wins)\n // Sort by depth and return the match from the deepest child\n // console.log(`Multiple matching view configs for ${uiView.fqn}`, matchingConfigs);\n matchingConfigs.sort(depthCompare(viewConfigDepth, -1)); // descending\n }\n return { uiView, viewConfig: matchingConfigs[0] };\n };\n\n const configureUIView = (tuple: ViewTuple) => {\n // If a parent ui-view is reconfigured, it could destroy child ui-views.\n // Before configuring a child ui-view, make sure it's still in the active uiViews array.\n if (this._uiViews.indexOf(tuple.uiView) !== -1)\n tuple.uiView.configUpdated(tuple.viewConfig);\n };\n\n // Sort views by FQN and state depth. Process uiviews nearest the root first.\n const uiViewTuples = this._uiViews.sort(depthCompare(uiViewDepth, 1)).map(matchingConfigPair);\n const matchedViewConfigs = uiViewTuples.map(tuple => tuple.viewConfig);\n const unmatchedConfigTuples = this._viewConfigs\n .filter(config => !inArray(matchedViewConfigs, config))\n .map(viewConfig => ({ uiView: undefined, viewConfig }));\n\n uiViewTuples.forEach(configureUIView);\n\n const allTuples: ViewTuple[] = uiViewTuples.concat(unmatchedConfigTuples);\n this._listeners.forEach(cb => cb(allTuples));\n trace.traceViewSync(allTuples);\n }\n\n /**\n * Registers a `ui-view` component\n *\n * When a `ui-view` component is created, it uses this method to register itself.\n * After registration the [[sync]] method is used to ensure all `ui-view` are configured with the proper [[ViewConfig]].\n *\n * Note: the `ui-view` component uses the `ViewConfig` to determine what view should be loaded inside the `ui-view`,\n * and what the view's state context is.\n *\n * Note: There is no corresponding `deregisterUIView`.\n * A `ui-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself.\n *\n * @param uiView The metadata for a UIView\n * @return a de-registration function used when the view is destroyed.\n */\n registerUIView(uiView: ActiveUIView) {\n trace.traceViewServiceUIViewEvent('-> Registering', uiView);\n const uiViews = this._uiViews;\n const fqnAndTypeMatches = (uiv: ActiveUIView) => uiv.fqn === uiView.fqn && uiv.$type === uiView.$type;\n if (uiViews.filter(fqnAndTypeMatches).length)\n trace.traceViewServiceUIViewEvent('!!!! duplicate uiView named:', uiView);\n\n uiViews.push(uiView);\n this.sync();\n\n return () => {\n const idx = uiViews.indexOf(uiView);\n if (idx === -1) {\n trace.traceViewServiceUIViewEvent('Tried removing non-registered uiView', uiView);\n return;\n }\n trace.traceViewServiceUIViewEvent('<- Deregistering', uiView);\n removeFrom(uiViews)(uiView);\n };\n }\n\n /**\n * Returns the list of views currently available on the page, by fully-qualified name.\n *\n * @return {Array} Returns an array of fully-qualified view names.\n */\n available() {\n return this._uiViews.map(prop('fqn'));\n }\n\n /**\n * Returns the list of views on the page containing loaded content.\n *\n * @return {Array} Returns an array of fully-qualified view names.\n */\n active() {\n return this._uiViews.filter(prop('$config')).map(prop('name'));\n }\n\n}\n", + "/**\n * @coreapi\n * @module core\n */ /** */\nimport { StateParams } from './params/stateParams';\nimport { StateDeclaration } from './state/interface';\nimport { StateObject } from './state/stateObject';\nimport { Transition } from './transition/transition';\nimport { Queue } from './common/queue';\nimport { Disposable } from './interface';\n\n/**\n * Global router state\n *\n * This is where we hold the global mutable state such as current state, current\n * params, current transition, etc.\n */\nexport class UIRouterGlobals implements Disposable {\n /**\n * Current parameter values\n *\n * The parameter values from the latest successful transition\n */\n params: StateParams = new StateParams();\n\n /**\n * Current state\n *\n * The to-state from the latest successful transition\n */\n current: StateDeclaration;\n\n /**\n * Current state (internal object)\n *\n * The to-state from the latest successful transition\n * @internalapi\n */\n $current: StateObject;\n\n /**\n * The current started/running transition.\n * This transition has reached at least the onStart phase, but is not yet complete\n */\n transition: Transition;\n\n /** @internalapi */\n lastStartedTransitionId = -1;\n\n /** @internalapi */\n transitionHistory = new Queue([], 1);\n\n /** @internalapi */\n successfulTransitions = new Queue([], 1);\n\n dispose() {\n this.transitionHistory.clear();\n this.successfulTransitions.clear();\n this.transition = null;\n }\n}\n", + "/**\n * @coreapi\n * @module url\n */ /** */\n\nimport { UIRouter } from '../router';\nimport { LocationServices, notImplemented, LocationConfig } from '../common/coreservices';\nimport { noop, createProxyFunctions } from '../common/common';\nimport { UrlConfigApi, UrlSyncApi, UrlRulesApi, UrlParts, MatchResult } from './interface';\n\n/** @hidden */\nconst makeStub = (keys: string[]): any =>\n keys.reduce((acc, key) => (acc[key] = notImplemented(key), acc), { dispose: noop });\n\n/* tslint:disable:align */\n/** @hidden */ const locationServicesFns = ['url', 'path', 'search', 'hash', 'onChange'];\n/** @hidden */ const locationConfigFns = ['port', 'protocol', 'host', 'baseHref', 'html5Mode', 'hashPrefix'];\n/** @hidden */ const umfFns = ['type', 'caseInsensitive', 'strictMode', 'defaultSquashPolicy'];\n/** @hidden */ const rulesFns = ['sort', 'when', 'initial', 'otherwise', 'rules', 'rule', 'removeRule'];\n/** @hidden */ const syncFns = ['deferIntercept', 'listen', 'sync', 'match'];\n/* tslint:enable:align */\n\n/**\n * API for URL management\n */\nexport class UrlService implements LocationServices, UrlSyncApi {\n /** @hidden */\n static locationServiceStub: LocationServices = makeStub(locationServicesFns);\n /** @hidden */\n static locationConfigStub: LocationConfig = makeStub(locationConfigFns);\n\n /**\n * A nested API for managing URL rules and rewrites\n *\n * See: [[UrlRulesApi]] for details\n */\n rules: UrlRulesApi;\n\n /**\n * A nested API to configure the URL and retrieve URL information\n *\n * See: [[UrlConfigApi]] for details\n */\n config: UrlConfigApi;\n\n /** @hidden */\n private router: UIRouter;\n\n /** @hidden */\n constructor(router: UIRouter, lateBind = true) {\n this.router = router;\n this.rules = {} as any;\n this.config = {} as any;\n\n // proxy function calls from UrlService to the LocationService/LocationConfig\n const locationServices = () => router.locationService;\n createProxyFunctions(locationServices, this, locationServices, locationServicesFns, lateBind);\n\n const locationConfig = () => router.locationConfig;\n createProxyFunctions(locationConfig, this.config, locationConfig, locationConfigFns, lateBind);\n\n const umf = () => router.urlMatcherFactory;\n createProxyFunctions(umf, this.config, umf, umfFns);\n\n const urlRouter = () => router.urlRouter;\n createProxyFunctions(urlRouter, this.rules, urlRouter, rulesFns);\n createProxyFunctions(urlRouter, this, urlRouter, syncFns);\n }\n\n /** @inheritdoc */\n url(): string;\n /** @inheritdoc */\n url(newurl: string, replace?: boolean, state?): void;\n url(newurl?, replace?, state?): any { return; }\n /** @inheritdoc */\n path(): string { return; }\n /** @inheritdoc */\n search(): { [key: string]: any } { return; }\n /** @inheritdoc */\n hash(): string { return; }\n /** @inheritdoc */\n onChange(callback: Function): Function { return; }\n\n\n /**\n * Returns the current URL parts\n *\n * This method returns the current URL components as a [[UrlParts]] object.\n *\n * @returns the current url parts\n */\n parts(): UrlParts {\n return { path: this.path(), search: this.search(), hash: this.hash() };\n }\n\n dispose() { }\n\n /** @inheritdoc */\n sync(evt?) { return; }\n /** @inheritdoc */\n listen(enabled?: boolean): Function { return; }\n /** @inheritdoc */\n deferIntercept(defer?: boolean) { return; }\n /** @inheritdoc */\n match(urlParts: UrlParts): MatchResult { return; }\n\n}\n", + "/**\n * @coreapi\n * @module core\n */ /** */\nimport { UrlMatcherFactory } from './url/urlMatcherFactory';\nimport { UrlRouter } from './url/urlRouter';\nimport { TransitionService } from './transition/transitionService';\nimport { ViewService } from './view/view';\nimport { StateRegistry } from './state/stateRegistry';\nimport { StateService } from './state/stateService';\nimport { UIRouterGlobals } from './globals';\nimport { UIRouterPlugin, Disposable } from './interface';\nimport { values, removeFrom } from './common/common';\nimport { isFunction } from './common/predicates';\nimport { UrlService } from './url/urlService';\nimport { LocationServices, LocationConfig } from './common/coreservices';\nimport { Trace, trace } from './common/trace';\n\n/** @hidden */\nlet _routerInstance = 0;\n\n/**\n * The master class used to instantiate an instance of UI-Router.\n *\n * UI-Router (for each specific framework) will create an instance of this class during bootstrap.\n * This class instantiates and wires the UI-Router services together.\n *\n * After a new instance of the UIRouter class is created, it should be configured for your app.\n * For instance, app states should be registered with the [[UIRouter.stateRegistry]].\n *\n * ---\n *\n * Normally the framework code will bootstrap UI-Router.\n * If you are bootstrapping UIRouter manually, tell it to monitor the URL by calling\n * [[UrlService.listen]] then [[UrlService.sync]].\n */\nexport class UIRouter {\n /** @hidden */ $id = _routerInstance++;\n /** @hidden */ _disposed = false;\n /** @hidden */ private _disposables: Disposable[] = [];\n\n /** Provides trace information to the console */\n trace: Trace = trace;\n\n /** Provides services related to ui-view synchronization */\n viewService = new ViewService();\n\n /** Provides services related to Transitions */\n transitionService: TransitionService = new TransitionService(this);\n\n /** Global router state */\n globals: UIRouterGlobals = new UIRouterGlobals();\n\n /**\n * Deprecated for public use. Use [[urlService]] instead.\n * @deprecated Use [[urlService]] instead\n */\n urlMatcherFactory: UrlMatcherFactory = new UrlMatcherFactory();\n\n /**\n * Deprecated for public use. Use [[urlService]] instead.\n * @deprecated Use [[urlService]] instead\n */\n urlRouter: UrlRouter = new UrlRouter(this);\n\n /** Provides a registry for states, and related registration services */\n stateRegistry: StateRegistry = new StateRegistry(this);\n\n /** Provides services related to states */\n stateService = new StateService(this);\n\n /** Provides services related to the URL */\n urlService: UrlService = new UrlService(this);\n\n /** @hidden plugin instances are registered here */\n private _plugins: { [key: string]: UIRouterPlugin } = {};\n\n\n /** Registers an object to be notified when the router is disposed */\n disposable(disposable: Disposable) {\n this._disposables.push(disposable);\n }\n\n /**\n * Disposes this router instance\n *\n * When called, clears resources retained by the router by calling `dispose(this)` on all\n * registered [[disposable]] objects.\n *\n * Or, if a `disposable` object is provided, calls `dispose(this)` on that object only.\n *\n * @param disposable (optional) the disposable to dispose\n */\n dispose(disposable?: any): void {\n if (disposable && isFunction(disposable.dispose)) {\n disposable.dispose(this);\n return undefined;\n }\n\n this._disposed = true;\n this._disposables.slice().forEach(d => {\n try {\n typeof d.dispose === 'function' && d.dispose(this);\n removeFrom(this._disposables, d);\n } catch (ignored) {}\n });\n }\n\n /**\n * Creates a new `UIRouter` object\n *\n * @param locationService a [[LocationServices]] implementation\n * @param locationConfig a [[LocationConfig]] implementation\n * @internalapi\n */\n constructor(\n public locationService: LocationServices = UrlService.locationServiceStub,\n public locationConfig: LocationConfig = UrlService.locationConfigStub,\n ) {\n\n this.viewService._pluginapi._rootViewContext(this.stateRegistry.root());\n this.globals.$current = this.stateRegistry.root();\n this.globals.current = this.globals.$current.self;\n\n this.disposable(this.globals);\n this.disposable(this.stateService);\n this.disposable(this.stateRegistry);\n this.disposable(this.transitionService);\n this.disposable(this.urlRouter);\n this.disposable(locationService);\n this.disposable(locationConfig);\n }\n\n /** Add plugin (as ES6 class) */\n plugin(plugin: { new(router: UIRouter, options?: any): T }, options?: any): T;\n /** Add plugin (as javascript constructor function) */\n plugin(plugin: { (router: UIRouter, options?: any): void }, options?: any): T;\n /** Add plugin (as javascript factory function) */\n plugin(plugin: PluginFactory, options?: any): T;\n /**\n * Adds a plugin to UI-Router\n *\n * This method adds a UI-Router Plugin.\n * A plugin can enhance or change UI-Router behavior using any public API.\n *\n * #### Example:\n * ```js\n * import { MyCoolPlugin } from \"ui-router-cool-plugin\";\n *\n * var plugin = router.addPlugin(MyCoolPlugin);\n * ```\n *\n * ### Plugin authoring\n *\n * A plugin is simply a class (or constructor function) which accepts a [[UIRouter]] instance and (optionally) an options object.\n *\n * The plugin can implement its functionality using any of the public APIs of [[UIRouter]].\n * For example, it may configure router options or add a Transition Hook.\n *\n * The plugin can then be published as a separate module.\n *\n * #### Example:\n * ```js\n * export class MyAuthPlugin implements UIRouterPlugin {\n * constructor(router: UIRouter, options: any) {\n * this.name = \"MyAuthPlugin\";\n * let $transitions = router.transitionService;\n * let $state = router.stateService;\n *\n * let authCriteria = {\n * to: (state) => state.data && state.data.requiresAuth\n * };\n *\n * function authHook(transition: Transition) {\n * let authService = transition.injector().get('AuthService');\n * if (!authService.isAuthenticated()) {\n * return $state.target('login');\n * }\n * }\n *\n * $transitions.onStart(authCriteria, authHook);\n * }\n * }\n * ```\n *\n * @param plugin one of:\n * - a plugin class which implements [[UIRouterPlugin]]\n * - a constructor function for a [[UIRouterPlugin]] which accepts a [[UIRouter]] instance\n * - a factory function which accepts a [[UIRouter]] instance and returns a [[UIRouterPlugin]] instance\n * @param options options to pass to the plugin class/factory\n * @returns the registered plugin instance\n */\n plugin(plugin: any, options: any = {}): T {\n const pluginInstance = new plugin(this, options);\n if (!pluginInstance.name) throw new Error('Required property `name` missing on plugin: ' + pluginInstance);\n this._disposables.push(pluginInstance);\n return this._plugins[pluginInstance.name] = pluginInstance;\n }\n\n /**\n * Returns registered plugins\n *\n * Returns the registered plugin of the given `pluginName`.\n * If no `pluginName` is given, returns all registered plugins\n *\n * @param pluginName (optional) the name of the plugin to get\n * @return the named plugin (undefined if not found), or all plugins (if `pluginName` is omitted)\n */\n getPlugin(pluginName: string): UIRouterPlugin;\n getPlugin(): UIRouterPlugin[];\n getPlugin(pluginName?: string): UIRouterPlugin|UIRouterPlugin[] {\n return pluginName ? this._plugins[pluginName] : values(this._plugins);\n }\n}\n\n/** @internalapi */\nexport type PluginFactory = (router: UIRouter, options?: any) => T;\n", + "/** @module hooks */ /** */\nimport { isString, isFunction } from '../common/predicates';\nimport { Transition } from '../transition/transition';\nimport { services } from '../common/coreservices';\nimport { TargetState } from '../state/targetState';\nimport { TransitionService } from '../transition/transitionService';\nimport { TransitionHookFn } from '../transition/interface';\n\n/**\n * A [[TransitionHookFn]] that redirects to a different state or params\n *\n * Registered using `transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectHook);`\n *\n * See [[StateDeclaration.redirectTo]]\n */\nconst redirectToHook: TransitionHookFn = (trans: Transition) => {\n const redirect = trans.to().redirectTo;\n if (!redirect) return;\n\n const $state = trans.router.stateService;\n\n function handleResult(result: any) {\n if (!result) return;\n if (result instanceof TargetState) return result;\n if (isString(result)) return $state.target( result, trans.params(), trans.options());\n if (result['state'] || result['params'])\n return $state.target(result['state'] || trans.to(), result['params'] || trans.params(), trans.options());\n }\n\n if (isFunction(redirect)) {\n return services.$q.when(redirect(trans)).then(handleResult);\n }\n return handleResult(redirect);\n};\n\nexport const registerRedirectToHook = (transitionService: TransitionService) =>\n transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectToHook);\n", + "/** @module hooks */\n/** for typedoc */\nimport { noop } from '../common/common';\nimport { Transition } from '../transition/transition';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { TransitionStateHookFn, TransitionHookFn } from '../transition/interface';\nimport { TransitionService } from '../transition/transitionService';\nimport { val } from '../common/hof';\nimport { StateDeclaration } from '../state/interface';\n\nexport const RESOLVE_HOOK_PRIORITY = 1000;\n\n/**\n * A [[TransitionHookFn]] which resolves all EAGER Resolvables in the To Path\n *\n * Registered using `transitionService.onStart({}, eagerResolvePath, { priority: 1000 });`\n *\n * When a Transition starts, this hook resolves all the EAGER Resolvables, which the transition then waits for.\n *\n * See [[StateDeclaration.resolve]]\n */\nconst eagerResolvePath: TransitionHookFn = (trans: Transition) =>\n new ResolveContext(trans.treeChanges().to)\n .resolvePath('EAGER', trans)\n .then(noop);\n\nexport const registerEagerResolvePath = (transitionService: TransitionService) =>\n transitionService.onStart({}, eagerResolvePath, { priority: RESOLVE_HOOK_PRIORITY });\n\n/**\n * A [[TransitionHookFn]] which resolves all LAZY Resolvables for the state (and all its ancestors) in the To Path\n *\n * Registered using `transitionService.onEnter({ entering: () => true }, lazyResolveState, { priority: 1000 });`\n *\n * When a State is being entered, this hook resolves all the Resolvables for this state, which the transition then waits for.\n *\n * See [[StateDeclaration.resolve]]\n */\nconst lazyResolveState: TransitionStateHookFn = (trans: Transition, state: StateDeclaration) =>\n new ResolveContext(trans.treeChanges().to)\n .subContext(state.$$state())\n .resolvePath('LAZY', trans)\n .then(noop);\n\nexport const registerLazyResolveState = (transitionService: TransitionService) =>\n transitionService.onEnter({ entering: val(true) }, lazyResolveState, { priority: RESOLVE_HOOK_PRIORITY });\n\n\n/**\n * A [[TransitionHookFn]] which resolves any dynamically added (LAZY or EAGER) Resolvables.\n *\n * Registered using `transitionService.onFinish({}, eagerResolvePath, { priority: 1000 });`\n *\n * After all entering states have been entered, this hook resolves any remaining Resolvables.\n * These are typically dynamic resolves which were added by some Transition Hook using [[Transition.addResolvable]].\n *\n * See [[StateDeclaration.resolve]]\n */\nconst resolveRemaining: TransitionHookFn = (trans: Transition) =>\n new ResolveContext(trans.treeChanges().to)\n .resolvePath('LAZY', trans)\n .then(noop);\n\nexport const registerResolveRemaining = (transitionService: TransitionService) =>\n transitionService.onFinish({}, resolveRemaining, { priority: RESOLVE_HOOK_PRIORITY });\n", + "/** @module hooks */ /** for typedoc */\nimport { noop } from '../common/common';\nimport { services } from '../common/coreservices';\nimport { Transition } from '../transition/transition';\nimport { ViewService } from '../view/view';\nimport { ViewConfig } from '../view/interface';\nimport { TransitionHookFn } from '../transition/interface';\nimport { TransitionService } from '../transition/transitionService';\n\n\n/**\n * A [[TransitionHookFn]] which waits for the views to load\n *\n * Registered using `transitionService.onStart({}, loadEnteringViews);`\n *\n * Allows the views to do async work in [[ViewConfig.load]] before the transition continues.\n * In angular 1, this includes loading the templates.\n */\nconst loadEnteringViews: TransitionHookFn = (transition: Transition) => {\n const $q = services.$q;\n const enteringViews = transition.views('entering');\n if (!enteringViews.length) return;\n return $q.all(enteringViews.map(view => $q.when(view.load()))).then(noop);\n};\n\nexport const registerLoadEnteringViews = (transitionService: TransitionService) =>\n transitionService.onFinish({}, loadEnteringViews);\n\n/**\n * A [[TransitionHookFn]] which activates the new views when a transition is successful.\n *\n * Registered using `transitionService.onSuccess({}, activateViews);`\n *\n * After a transition is complete, this hook deactivates the old views from the previous state,\n * and activates the new views from the destination state.\n *\n * See [[ViewService]]\n */\nconst activateViews: TransitionHookFn = (transition: Transition) => {\n const enteringViews = transition.views('entering');\n const exitingViews = transition.views('exiting');\n if (!enteringViews.length && !exitingViews.length) return;\n\n const $view: ViewService = transition.router.viewService;\n\n exitingViews.forEach((vc: ViewConfig) => $view.deactivateViewConfig(vc));\n enteringViews.forEach((vc: ViewConfig) => $view.activateViewConfig(vc));\n\n $view.sync();\n};\n\nexport const registerActivateViews = (transitionService: TransitionService) =>\n transitionService.onSuccess({}, activateViews);\n", + "/** @module hooks */\n/** for typedoc */\nimport { Transition } from '../transition/transition';\nimport { copy } from '../common/common';\nimport { TransitionService } from '../transition/transitionService';\n\n/**\n * A [[TransitionHookFn]] which updates global UI-Router state\n *\n * Registered using `transitionService.onBefore({}, updateGlobalState);`\n *\n * Before a [[Transition]] starts, updates the global value of \"the current transition\" ([[Globals.transition]]).\n * After a successful [[Transition]], updates the global values of \"the current state\"\n * ([[Globals.current]] and [[Globals.$current]]) and \"the current param values\" ([[Globals.params]]).\n *\n * See also the deprecated properties:\n * [[StateService.transition]], [[StateService.current]], [[StateService.params]]\n */\nconst updateGlobalState = (trans: Transition) => {\n const globals = trans.router.globals;\n\n const transitionSuccessful = () => {\n globals.successfulTransitions.enqueue(trans);\n globals.$current = trans.$to();\n globals.current = globals.$current.self;\n\n copy(trans.params(), globals.params);\n };\n\n const clearCurrentTransition = () => {\n // Do not clear globals.transition if a different transition has started in the meantime\n if (globals.transition === trans) globals.transition = null;\n };\n\n trans.onSuccess({}, transitionSuccessful, { priority: 10000 });\n trans.promise.then(clearCurrentTransition, clearCurrentTransition);\n};\n\nexport const registerUpdateGlobalState = (transitionService: TransitionService) =>\n transitionService.onCreate({}, updateGlobalState);\n", + "/** @module hooks */ /** */\nimport { UrlRouter } from '../url/urlRouter';\nimport { StateService } from '../state/stateService';\nimport { Transition } from '../transition/transition';\nimport { TransitionHookFn } from '../transition/interface';\nimport { TransitionService } from '../transition/transitionService';\n\n/**\n * A [[TransitionHookFn]] which updates the URL after a successful transition\n *\n * Registered using `transitionService.onSuccess({}, updateUrl);`\n */\nconst updateUrl: TransitionHookFn = (transition: Transition) => {\n const options = transition.options();\n const $state: StateService = transition.router.stateService;\n const $urlRouter: UrlRouter = transition.router.urlRouter;\n\n // Dont update the url in these situations:\n // The transition was triggered by a URL sync (options.source === 'url')\n // The user doesn't want the url to update (options.location === false)\n // The destination state, and all parents have no navigable url\n if (options.source !== 'url' && options.location && $state.$current.navigable) {\n const urlOptions = { replace: options.location === 'replace' };\n $urlRouter.push($state.$current.navigable.url, $state.params, urlOptions);\n }\n\n $urlRouter.update(true);\n};\n\nexport const registerUpdateUrl = (transitionService: TransitionService) =>\n transitionService.onSuccess({}, updateUrl, { priority: 9999 });\n", + "/** @module transition */ /** */\nimport { TransitionHookPhase, PathType } from './interface';\nimport { GetErrorHandler, GetResultHandler, TransitionHook } from './transitionHook';\n/**\n * This class defines a type of hook, such as `onBefore` or `onEnter`.\n * Plugins can define custom hook types, such as sticky states does for `onInactive`.\n *\n * @interalapi\n */\nexport class TransitionEventType {\n /* tslint:disable:no-inferrable-types */\n constructor(public name: string,\n public hookPhase: TransitionHookPhase,\n public hookOrder: number,\n public criteriaMatchPath: PathType,\n public reverseSort: boolean = false,\n public getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,\n public getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,\n public synchronous: boolean = false,\n ) { }\n}\n", + "/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport {\n IHookRegistry, TransitionOptions, TransitionHookScope, TransitionHookPhase, TransitionCreateHookFn, HookMatchCriteria,\n HookRegOptions, PathTypes, PathType, RegisteredHooks, TransitionHookFn, TransitionStateHookFn,\n} from './interface';\nimport { Transition } from './transition';\nimport { makeEvent, RegisteredHook } from './hookRegistry';\nimport { TargetState } from '../state/targetState';\nimport { PathNode } from '../path/pathNode';\nimport { ViewService } from '../view/view';\nimport { UIRouter } from '../router';\nimport { registerAddCoreResolvables } from '../hooks/coreResolvables';\nimport { registerRedirectToHook } from '../hooks/redirectTo';\nimport { registerOnExitHook, registerOnRetainHook, registerOnEnterHook } from '../hooks/onEnterExitRetain';\nimport { registerEagerResolvePath, registerLazyResolveState, registerResolveRemaining } from '../hooks/resolve';\nimport { registerLoadEnteringViews, registerActivateViews } from '../hooks/views';\nimport { registerUpdateGlobalState } from '../hooks/updateGlobals';\nimport { registerUpdateUrl } from '../hooks/url';\nimport { registerLazyLoadHook } from '../hooks/lazyLoad';\nimport { TransitionEventType } from './transitionEventType';\nimport { TransitionHook, GetResultHandler, GetErrorHandler } from './transitionHook';\nimport { isDefined } from '../common/predicates';\nimport { removeFrom, values, createProxyFunctions } from '../common/common';\nimport { Disposable } from '../interface'; // has or is using\nimport { val } from '../common/hof';\nimport { registerIgnoredTransitionHook } from '../hooks/ignoredTransition';\nimport { registerInvalidTransitionHook } from '../hooks/invalidTransition';\n\n/**\n * The default [[Transition]] options.\n *\n * Include this object when applying custom defaults:\n * let reloadOpts = { reload: true, notify: true }\n * let options = defaults(theirOpts, customDefaults, defaultOptions);\n */\nexport let defaultTransOpts: TransitionOptions = {\n location : true,\n relative : null,\n inherit : false,\n notify : true,\n reload : false,\n custom : {},\n current : () => null,\n source : 'unknown',\n};\n\n\n/**\n * Plugin API for Transition Service\n * @internalapi\n */\nexport interface TransitionServicePluginAPI {\n /**\n * Adds a Path to be used as a criterion against a TreeChanges path\n *\n * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.\n * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`\n * Each state in the exiting path is checked against the criteria and returned as part of the match.\n *\n * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.\n * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`\n * Only the tail of the `to` path is checked against the criteria and returned as part of the match.\n */\n _definePathType(name: string, hookScope: TransitionHookScope);\n\n /**\n * Gets a Path definition used as a criterion against a TreeChanges path\n */\n _getPathTypes(): PathTypes;\n\n /**\n * Defines a transition hook type and returns a transition hook registration\n * function (which can then be used to register hooks of this type).\n */\n _defineEvent(name: string,\n hookPhase: TransitionHookPhase,\n hookOrder: number,\n criteriaMatchPath: PathType,\n reverseSort?: boolean,\n getResultHandler?: GetResultHandler,\n getErrorHandler?: GetErrorHandler,\n rejectIfSuperseded?: boolean);\n\n /**\n * Returns the known event types, such as `onBefore`\n * If a phase argument is provided, returns only events for the given phase.\n */\n _getEvents(phase?: TransitionHookPhase): TransitionEventType[];\n\n /** Returns the hooks registered for the given hook name */\n getHooks(hookName: string): RegisteredHook[];\n}\n\n/**\n * This class provides services related to Transitions.\n *\n * - Most importantly, it allows global Transition Hooks to be registered.\n * - It allows the default transition error handler to be set.\n * - It also has a factory function for creating new [[Transition]] objects, (used internally by the [[StateService]]).\n *\n * At bootstrap, [[UIRouter]] creates a single instance (singleton) of this class.\n */\nexport class TransitionService implements IHookRegistry, Disposable {\n /** @hidden */\n _transitionCount = 0;\n\n /** @hidden */\n public $view: ViewService;\n\n /** @hidden The transition hook types, such as `onEnter`, `onStart`, etc */\n private _eventTypes: TransitionEventType[] = [];\n /** @hidden The registered transition hooks */\n _registeredHooks = { } as RegisteredHooks;\n /** @hidden The paths on a criteria object */\n private _criteriaPaths = { } as PathTypes;\n /** @hidden */\n private _router: UIRouter;\n\n /** @internalapi */\n _pluginapi: TransitionServicePluginAPI;\n\n /**\n * This object has hook de-registration functions for the built-in hooks.\n * This can be used by third parties libraries that wish to customize the behaviors\n *\n * @hidden\n */\n _deregisterHookFns: {\n addCoreResolves: Function;\n ignored: Function;\n invalid: Function;\n redirectTo: Function;\n onExit: Function;\n onRetain: Function;\n onEnter: Function;\n eagerResolve: Function;\n lazyResolve: Function;\n resolveAll: Function;\n loadViews: Function;\n activateViews: Function;\n updateGlobals: Function;\n updateUrl: Function;\n lazyLoad: Function;\n };\n\n /** @hidden */\n constructor(_router: UIRouter) {\n this._router = _router;\n this.$view = _router.viewService;\n this._deregisterHookFns = {};\n this._pluginapi = createProxyFunctions(val(this), {}, val(this), [\n '_definePathType',\n '_defineEvent',\n '_getPathTypes',\n '_getEvents',\n 'getHooks',\n ]);\n\n this._defineCorePaths();\n this._defineCoreEvents();\n this._registerCoreTransitionHooks();\n }\n\n /**\n * Registers a [[TransitionHookFn]], called *while a transition is being constructed*.\n *\n * Registers a transition lifecycle hook, which is invoked during transition construction.\n *\n * This low level hook should only be used by plugins.\n * This can be a useful time for plugins to add resolves or mutate the transition as needed.\n * The Sticky States plugin uses this hook to modify the treechanges.\n *\n * ### Lifecycle\n *\n * `onCreate` hooks are invoked *while a transition is being constructed*.\n *\n * ### Return value\n *\n * The hook's return value is ignored\n *\n * @internalapi\n * @param criteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be invoked.\n * @param options the registration options\n * @returns a function which deregisters the hook.\n */\n onCreate(criteria: HookMatchCriteria, callback: TransitionCreateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n\n /**\n * dispose\n * @internalapi\n */\n dispose(router: UIRouter) {\n values(this._registeredHooks).forEach((hooksArray: RegisteredHook[]) => hooksArray.forEach(hook => {\n hook._deregistered = true;\n removeFrom(hooksArray, hook);\n }));\n }\n\n /**\n * Creates a new [[Transition]] object\n *\n * This is a factory function for creating new Transition objects.\n * It is used internally by the [[StateService]] and should generally not be called by application code.\n *\n * @param fromPath the path to the current state (the from state)\n * @param targetState the target state (destination)\n * @returns a Transition\n */\n create(fromPath: PathNode[], targetState: TargetState): Transition {\n return new Transition(fromPath, targetState, this._router);\n }\n\n /** @hidden */\n private _defineCoreEvents() {\n const Phase = TransitionHookPhase;\n const TH = TransitionHook;\n const paths = this._criteriaPaths;\n const NORMAL_SORT = false, REVERSE_SORT = true;\n const SYNCHRONOUS = true;\n\n this._defineEvent('onCreate', Phase.CREATE, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.THROW_ERROR, SYNCHRONOUS);\n\n this._defineEvent('onBefore', Phase.BEFORE, 0, paths.to);\n\n this._defineEvent('onStart', Phase.RUN, 0, paths.to);\n this._defineEvent('onExit', Phase.RUN, 100, paths.exiting, REVERSE_SORT);\n this._defineEvent('onRetain', Phase.RUN, 200, paths.retained);\n this._defineEvent('onEnter', Phase.RUN, 300, paths.entering);\n this._defineEvent('onFinish', Phase.RUN, 400, paths.to);\n\n this._defineEvent('onSuccess', Phase.SUCCESS, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS);\n this._defineEvent('onError', Phase.ERROR, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS);\n }\n\n /** @hidden */\n private _defineCorePaths() {\n const { STATE, TRANSITION } = TransitionHookScope;\n\n this._definePathType('to', TRANSITION);\n this._definePathType('from', TRANSITION);\n this._definePathType('exiting', STATE);\n this._definePathType('retained', STATE);\n this._definePathType('entering', STATE);\n }\n\n /** @hidden */\n _defineEvent(name: string,\n hookPhase: TransitionHookPhase,\n hookOrder: number,\n criteriaMatchPath: PathType,\n reverseSort = false,\n getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,\n getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,\n synchronous = false) {\n const eventType = new TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous);\n\n this._eventTypes.push(eventType);\n makeEvent(this, this, eventType);\n }\n\n /** @hidden */ // tslint:disable-next-line\n private _getEvents(phase?: TransitionHookPhase): TransitionEventType[] {\n const transitionHookTypes = isDefined(phase) ?\n this._eventTypes.filter(type => type.hookPhase === phase) :\n this._eventTypes.slice();\n\n return transitionHookTypes.sort((l, r) => {\n const cmpByPhase = l.hookPhase - r.hookPhase;\n return cmpByPhase === 0 ? l.hookOrder - r.hookOrder : cmpByPhase;\n });\n }\n\n /**\n * Adds a Path to be used as a criterion against a TreeChanges path\n *\n * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.\n * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`\n * Each state in the exiting path is checked against the criteria and returned as part of the match.\n *\n * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.\n * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`\n * Only the tail of the `to` path is checked against the criteria and returned as part of the match.\n *\n * @hidden\n */\n private _definePathType(name: string, hookScope: TransitionHookScope) {\n this._criteriaPaths[name] = { name, scope: hookScope };\n }\n\n /** * @hidden */ // tslint:disable-next-line\n private _getPathTypes(): PathTypes {\n return this._criteriaPaths;\n }\n\n /** @hidden */\n public getHooks(hookName: string): RegisteredHook[] {\n return this._registeredHooks[hookName];\n }\n\n /** @hidden */\n private _registerCoreTransitionHooks() {\n const fns = this._deregisterHookFns;\n\n fns.addCoreResolves = registerAddCoreResolvables(this);\n fns.ignored = registerIgnoredTransitionHook(this);\n fns.invalid = registerInvalidTransitionHook(this);\n\n // Wire up redirectTo hook\n fns.redirectTo = registerRedirectToHook(this);\n\n // Wire up onExit/Retain/Enter state hooks\n fns.onExit = registerOnExitHook(this);\n fns.onRetain = registerOnRetainHook(this);\n fns.onEnter = registerOnEnterHook(this);\n\n // Wire up Resolve hooks\n fns.eagerResolve = registerEagerResolvePath(this);\n fns.lazyResolve = registerLazyResolveState(this);\n fns.resolveAll = registerResolveRemaining(this);\n\n // Wire up the View management hooks\n fns.loadViews = registerLoadEnteringViews(this);\n fns.activateViews = registerActivateViews(this);\n\n // Updates global state after a transition\n fns.updateGlobals = registerUpdateGlobalState(this);\n\n // After globals.current is updated at priority: 10000\n fns.updateUrl = registerUpdateUrl(this);\n\n // Lazy load state trees\n fns.lazyLoad = registerLazyLoadHook(this);\n }\n}\n", + "/**\n * @coreapi\n * @module state\n */\n/** */\nimport { createProxyFunctions, defaults, extend, inArray, noop, removeFrom, silenceUncaughtInPromise, silentRejection } from '../common/common';\nimport { isDefined, isObject, isString } from '../common/predicates';\nimport { Queue } from '../common/queue';\nimport { services } from '../common/coreservices';\n\nimport { PathUtils } from '../path/pathUtils';\nimport { PathNode } from '../path/pathNode';\n\nimport { HookResult, TransitionOptions } from '../transition/interface';\nimport { defaultTransOpts } from '../transition/transitionService';\nimport { Rejection, RejectType } from '../transition/rejectFactory';\nimport { Transition } from '../transition/transition';\n\nimport { HrefOptions, LazyLoadResult, StateDeclaration, StateOrName, TransitionPromise } from './interface';\nimport { StateObject } from './stateObject';\nimport { TargetState } from './targetState';\n\nimport { RawParams } from '../params/interface';\nimport { Param } from '../params/param';\nimport { Glob } from '../common/glob';\nimport { UIRouter } from '../router';\nimport { UIInjector } from '../interface';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { lazyLoadState } from '../hooks/lazyLoad';\nimport { not, val } from '../common/hof';\nimport { StateParams } from '../params/stateParams';\n\nexport type OnInvalidCallback =\n (toState?: TargetState, fromState?: TargetState, injector?: UIInjector) => HookResult;\n\n/**\n * Provides state related service functions\n *\n * This class provides services related to ui-router states.\n * An instance of this class is located on the global [[UIRouter]] object.\n */\nexport class StateService {\n /** @internalapi */\n invalidCallbacks: OnInvalidCallback[] = [];\n\n /**\n * The [[Transition]] currently in progress (or null)\n *\n * This is a passthrough through to [[UIRouterGlobals.transition]]\n */\n get transition() { return this.router.globals.transition; }\n /**\n * The latest successful state parameters\n *\n * This is a passthrough through to [[UIRouterGlobals.params]]\n */\n get params(): StateParams { return this.router.globals.params; }\n /**\n * The current [[StateDeclaration]]\n *\n * This is a passthrough through to [[UIRouterGlobals.current]]\n */\n get current() { return this.router.globals.current; }\n /**\n * The current [[StateObject]]\n *\n * This is a passthrough through to [[UIRouterGlobals.$current]]\n */\n get $current() { return this.router.globals.$current; }\n\n /** @internalapi */\n constructor(private router: UIRouter) {\n const getters = ['current', '$current', 'params', 'transition'];\n const boundFns = Object.keys(StateService.prototype).filter(not(inArray(getters)));\n createProxyFunctions(val(StateService.prototype), this, val(this), boundFns);\n }\n\n /** @internalapi */\n dispose() {\n this.defaultErrorHandler(noop);\n this.invalidCallbacks = [];\n }\n\n /**\n * Handler for when [[transitionTo]] is called with an invalid state.\n *\n * Invokes the [[onInvalid]] callbacks, in natural order.\n * Each callback's return value is checked in sequence until one of them returns an instance of TargetState.\n * The results of the callbacks are wrapped in $q.when(), so the callbacks may return promises.\n *\n * If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned.\n *\n * @internalapi\n */\n private _handleInvalidTargetState(fromPath: PathNode[], toState: TargetState) {\n const fromState = PathUtils.makeTargetState(this.router.stateRegistry, fromPath);\n const globals = this.router.globals;\n const latestThing = () => globals.transitionHistory.peekTail();\n const latest = latestThing();\n const callbackQueue = new Queue(this.invalidCallbacks.slice());\n const injector = new ResolveContext(fromPath).injector();\n\n const checkForRedirect = (result: HookResult) => {\n if (!(result instanceof TargetState)) {\n return;\n }\n\n let target = result;\n // Recreate the TargetState, in case the state is now defined.\n target = this.target(target.identifier(), target.params(), target.options());\n\n if (!target.valid()) {\n return Rejection.invalid(target.error()).toPromise();\n }\n\n if (latestThing() !== latest) {\n return Rejection.superseded().toPromise();\n }\n\n return this.transitionTo(target.identifier(), target.params(), target.options());\n };\n\n function invokeNextCallback() {\n const nextCallback = callbackQueue.dequeue();\n if (nextCallback === undefined) return Rejection.invalid(toState.error()).toPromise();\n\n const callbackResult = services.$q.when(nextCallback(toState, fromState, injector));\n return callbackResult.then(checkForRedirect).then(result => result || invokeNextCallback());\n }\n\n return invokeNextCallback();\n }\n\n /**\n * Registers an Invalid State handler\n *\n * Registers a [[OnInvalidCallback]] function to be invoked when [[StateService.transitionTo]]\n * has been called with an invalid state reference parameter\n *\n * Example:\n * ```js\n * stateService.onInvalid(function(to, from, injector) {\n * if (to.name() === 'foo') {\n * let lazyLoader = injector.get('LazyLoadService');\n * return lazyLoader.load('foo')\n * .then(() => stateService.target('foo'));\n * }\n * });\n * ```\n *\n * @param {function} callback invoked when the toState is invalid\n * This function receives the (invalid) toState, the fromState, and an injector.\n * The function may optionally return a [[TargetState]] or a Promise for a TargetState.\n * If one is returned, it is treated as a redirect.\n *\n * @returns a function which deregisters the callback\n */\n onInvalid(callback: OnInvalidCallback): Function {\n this.invalidCallbacks.push(callback);\n return function deregisterListener() {\n removeFrom(this.invalidCallbacks)(callback);\n }.bind(this);\n }\n\n\n /**\n * Reloads the current state\n *\n * A method that force reloads the current state, or a partial state hierarchy.\n * All resolves are re-resolved, and components reinstantiated.\n *\n * #### Example:\n * ```js\n * let app angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.reload = function(){\n * $state.reload();\n * }\n * });\n * ```\n *\n * Note: `reload()` is just an alias for:\n *\n * ```js\n * $state.transitionTo($state.current, $state.params, {\n * reload: true, inherit: false\n * });\n * ```\n *\n * @param reloadState A state name or a state object.\n * If present, this state and all its children will be reloaded, but ancestors will not reload.\n *\n * #### Example:\n * ```js\n * //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item'\n * //and current state is 'contacts.detail.item'\n * let app angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.reload = function(){\n * //will reload 'contact.detail' and nested 'contact.detail.item' states\n * $state.reload('contact.detail');\n * }\n * });\n * ```\n *\n * @returns A promise representing the state of the new transition. See [[StateService.go]]\n */\n reload(reloadState?: StateOrName): Promise {\n return this.transitionTo(this.current, this.params, {\n reload: isDefined(reloadState) ? reloadState : true,\n inherit: false,\n notify: false,\n });\n }\n\n /**\n * Transition to a different state and/or parameters\n *\n * Convenience method for transitioning to a new state.\n *\n * `$state.go` calls `$state.transitionTo` internally but automatically sets options to\n * `{ location: true, inherit: true, relative: router.globals.$current, notify: true }`.\n * This allows you to use either an absolute or relative `to` argument (because of `relative: router.globals.$current`).\n * It also allows you to specify * only the parameters you'd like to update, while letting unspecified parameters\n * inherit from the current parameter values (because of `inherit: true`).\n *\n * #### Example:\n * ```js\n * let app = angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.changeState = function () {\n * $state.go('contact.detail');\n * };\n * });\n * ```\n *\n * @param to Absolute state name, state object, or relative state path (relative to current state).\n *\n * Some examples:\n *\n * - `$state.go('contact.detail')` - will go to the `contact.detail` state\n * - `$state.go('^')` - will go to the parent state\n * - `$state.go('^.sibling')` - if current state is `home.child`, will go to the `home.sibling` state\n * - `$state.go('.child.grandchild')` - if current state is home, will go to the `home.child.grandchild` state\n *\n * @param params A map of the parameters that will be sent to the state, will populate $stateParams.\n *\n * Any parameters that are not specified will be inherited from current parameter values (because of `inherit: true`).\n * This allows, for example, going to a sibling state that shares parameters defined by a parent state.\n *\n * @param options Transition options\n *\n * @returns {promise} A promise representing the state of the new transition.\n */\n go(to: StateOrName, params?: RawParams, options?: TransitionOptions): TransitionPromise {\n const defautGoOpts = { relative: this.$current, inherit: true };\n const transOpts = defaults(options, defautGoOpts, defaultTransOpts);\n return this.transitionTo(to, params, transOpts);\n }\n\n /**\n * Creates a [[TargetState]]\n *\n * This is a factory method for creating a TargetState\n *\n * This may be returned from a Transition Hook to redirect a transition, for example.\n */\n target(identifier: StateOrName, params?: RawParams, options: TransitionOptions = {}): TargetState {\n // If we're reloading, find the state object to reload from\n if (isObject(options.reload) && !(options.reload).name)\n throw new Error('Invalid reload state object');\n const reg = this.router.stateRegistry;\n options.reloadState = options.reload === true ? reg.root() : reg.matcher.find( options.reload, options.relative);\n\n if (options.reload && !options.reloadState)\n throw new Error(`No such reload state '${(isString(options.reload) ? options.reload : (options.reload).name)}'`);\n\n return new TargetState(this.router.stateRegistry, identifier, params, options);\n }\n\n private getCurrentPath(): PathNode[] {\n const globals = this.router.globals;\n const latestSuccess: Transition = globals.successfulTransitions.peekTail();\n const rootPath = () => [ new PathNode(this.router.stateRegistry.root()) ];\n return latestSuccess ? latestSuccess.treeChanges().to : rootPath();\n }\n\n /**\n * Low-level method for transitioning to a new state.\n *\n * The [[go]] method (which uses `transitionTo` internally) is recommended in most situations.\n *\n * #### Example:\n * ```js\n * let app = angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.changeState = function () {\n * $state.transitionTo('contact.detail');\n * };\n * });\n * ```\n *\n * @param to State name or state object.\n * @param toParams A map of the parameters that will be sent to the state,\n * will populate $stateParams.\n * @param options Transition options\n *\n * @returns A promise representing the state of the new transition. See [[go]]\n */\n transitionTo(to: StateOrName, toParams: RawParams = {}, options: TransitionOptions = {}): TransitionPromise {\n const router = this.router;\n const globals = router.globals;\n options = defaults(options, defaultTransOpts);\n const getCurrent = () =>\n globals.transition;\n options = extend(options, { current: getCurrent });\n\n const ref: TargetState = this.target(to, toParams, options);\n const currentPath = this.getCurrentPath();\n\n if (!ref.exists())\n return this._handleInvalidTargetState(currentPath, ref);\n\n if (!ref.valid())\n return silentRejection(ref.error());\n\n /**\n * Special handling for Ignored, Aborted, and Redirected transitions\n *\n * The semantics for the transition.run() promise and the StateService.transitionTo()\n * promise differ. For instance, the run() promise may be rejected because it was\n * IGNORED, but the transitionTo() promise is resolved because from the user perspective\n * no error occurred. Likewise, the transition.run() promise may be rejected because of\n * a Redirect, but the transitionTo() promise is chained to the new Transition's promise.\n */\n const rejectedTransitionHandler = (trans: Transition) => (error: any): Promise => {\n if (error instanceof Rejection) {\n const isLatest = router.globals.lastStartedTransitionId === trans.$id;\n\n if (error.type === RejectType.IGNORED) {\n isLatest && router.urlRouter.update();\n // Consider ignored `Transition.run()` as a successful `transitionTo`\n return services.$q.when(globals.current);\n }\n\n const detail: any = error.detail;\n if (error.type === RejectType.SUPERSEDED && error.redirected && detail instanceof TargetState) {\n // If `Transition.run()` was redirected, allow the `transitionTo()` promise to resolve successfully\n // by returning the promise for the new (redirect) `Transition.run()`.\n const redirect: Transition = trans.redirect(detail);\n return redirect.run().catch(rejectedTransitionHandler(redirect));\n }\n\n if (error.type === RejectType.ABORTED) {\n isLatest && router.urlRouter.update();\n return services.$q.reject(error);\n }\n }\n\n const errorHandler = this.defaultErrorHandler();\n errorHandler(error);\n\n return services.$q.reject(error);\n };\n\n const transition = this.router.transitionService.create(currentPath, ref);\n const transitionToPromise = transition.run().catch(rejectedTransitionHandler(transition));\n silenceUncaughtInPromise(transitionToPromise); // issue #2676\n\n // Return a promise for the transition, which also has the transition object on it.\n return extend(transitionToPromise, { transition });\n }\n\n /**\n * Checks if the current state *is* the provided state\n *\n * Similar to [[includes]] but only checks for the full state name.\n * If params is supplied then it will be tested for strict equality against the current\n * active params object, so all params must match with none missing and no extras.\n *\n * #### Example:\n * ```js\n * $state.$current.name = 'contacts.details.item';\n *\n * // absolute name\n * $state.is('contact.details.item'); // returns true\n * $state.is(contactDetailItemStateObject); // returns true\n * ```\n *\n * // relative name (. and ^), typically from a template\n * // E.g. from the 'contacts.details' template\n * ```html\n *
    Item
    \n * ```\n *\n * @param stateOrName The state name (absolute or relative) or state object you'd like to check.\n * @param params A param object, e.g. `{sectionId: section.id}`, that you'd like\n * to test against the current active state.\n * @param options An options object. The options are:\n * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will\n * test relative to `options.relative` state (or name).\n *\n * @returns Returns true if it is the state.\n */\n is(stateOrName: StateOrName, params?: RawParams, options?: { relative?: StateOrName }): boolean {\n options = defaults(options, { relative: this.$current });\n const state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);\n if (!isDefined(state)) return undefined;\n if (this.$current !== state) return false;\n if (!params) return true;\n\n const schema: Param[] = state.parameters({ inherit: true, matchingKeys: params });\n return Param.equals(schema, Param.values(schema, params), this.params);\n }\n\n /**\n * Checks if the current state *includes* the provided state\n *\n * A method to determine if the current active state is equal to or is the child of the\n * state stateName. If any params are passed then they will be tested for a match as well.\n * Not all the parameters need to be passed, just the ones you'd like to test for equality.\n *\n * #### Example when `$state.$current.name === 'contacts.details.item'`\n * ```js\n * // Using partial names\n * $state.includes(\"contacts\"); // returns true\n * $state.includes(\"contacts.details\"); // returns true\n * $state.includes(\"contacts.details.item\"); // returns true\n * $state.includes(\"contacts.list\"); // returns false\n * $state.includes(\"about\"); // returns false\n * ```\n *\n * #### Glob Examples when `* $state.$current.name === 'contacts.details.item.url'`:\n * ```js\n * $state.includes(\"*.details.*.*\"); // returns true\n * $state.includes(\"*.details.**\"); // returns true\n * $state.includes(\"**.item.**\"); // returns true\n * $state.includes(\"*.details.item.url\"); // returns true\n * $state.includes(\"*.details.*.url\"); // returns true\n * $state.includes(\"*.details.*\"); // returns false\n * $state.includes(\"item.**\"); // returns false\n * ```\n *\n * @param stateOrName A partial name, relative name, glob pattern,\n * or state object to be searched for within the current state name.\n * @param params A param object, e.g. `{sectionId: section.id}`,\n * that you'd like to test against the current active state.\n * @param options An options object. The options are:\n * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will\n * test relative to `options.relative` state (or name).\n *\n * @returns {boolean} Returns true if it does include the state\n */\n includes(stateOrName: StateOrName, params?: RawParams, options?: TransitionOptions): boolean {\n options = defaults(options, { relative: this.$current });\n const glob = isString(stateOrName) && Glob.fromString( stateOrName);\n\n if (glob) {\n if (!glob.matches(this.$current.name)) return false;\n stateOrName = this.$current.name;\n }\n const state = this.router.stateRegistry.matcher.find(stateOrName, options.relative), include = this.$current.includes;\n\n if (!isDefined(state)) return undefined;\n if (!isDefined(include[state.name])) return false;\n if (!params) return true;\n\n const schema: Param[] = state.parameters({ inherit: true, matchingKeys: params });\n return Param.equals(schema, Param.values(schema, params), this.params);\n }\n\n\n /**\n * Generates a URL for a state and parameters\n *\n * Returns the url for the given state populated with the given params.\n *\n * #### Example:\n * ```js\n * expect($state.href(\"about.person\", { person: \"bob\" })).toEqual(\"/about/bob\");\n * ```\n *\n * @param stateOrName The state name or state object you'd like to generate a url from.\n * @param params An object of parameter values to fill the state's required parameters.\n * @param options Options object. The options are:\n *\n * @returns {string} compiled state url\n */\n href(stateOrName: StateOrName, params: RawParams, options?: HrefOptions): string {\n const defaultHrefOpts = {\n lossy: true,\n inherit: true,\n absolute: false,\n relative: this.$current,\n };\n options = defaults(options, defaultHrefOpts);\n params = params || {};\n\n const state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);\n\n if (!isDefined(state)) return null;\n if (options.inherit) params = this.params.$inherit(params, this.$current, state);\n\n const nav = (state && options.lossy) ? state.navigable : state;\n\n if (!nav || nav.url === undefined || nav.url === null) {\n return null;\n }\n return this.router.urlRouter.href(nav.url, params, {\n absolute: options.absolute,\n });\n }\n\n /** @hidden */\n private _defaultErrorHandler: ((_error: any) => void) = function $defaultErrorHandler($error$) {\n if ($error$ instanceof Error && $error$.stack) {\n console.error($error$);\n console.error($error$.stack);\n } else if ($error$ instanceof Rejection) {\n console.error($error$.toString());\n if ($error$.detail && $error$.detail.stack)\n console.error($error$.detail.stack);\n } else {\n console.error($error$);\n }\n };\n\n /**\n * Sets or gets the default [[transitionTo]] error handler.\n *\n * The error handler is called when a [[Transition]] is rejected or when any error occurred during the Transition.\n * This includes errors caused by resolves and transition hooks.\n *\n * Note:\n * This handler does not receive certain Transition rejections.\n * Redirected and Ignored Transitions are not considered to be errors by [[StateService.transitionTo]].\n *\n * The built-in default error handler logs the error to the console.\n *\n * You can provide your own custom handler.\n *\n * #### Example:\n * ```js\n * stateService.defaultErrorHandler(function() {\n * // Do not log transitionTo errors\n * });\n * ```\n *\n * @param handler a global error handler function\n * @returns the current global error handler\n */\n defaultErrorHandler(handler?: (error: any) => void): (error: any) => void {\n return this._defaultErrorHandler = handler || this._defaultErrorHandler;\n }\n\n /**\n * Gets a registered [[StateDeclaration]] object\n *\n * Returns the state declaration object for any specific state, or for all registered states.\n *\n * @param stateOrName (absolute or relative) If provided, will only get the declaration object for the requested state.\n * If not provided, returns an array of ALL states.\n * @param base When `stateOrName` is a relative state reference (such as `.bar.baz`), the state will be retrieved relative to this state.\n *\n * @returns a [[StateDeclaration]] object (or array of all registered [[StateDeclaration]] objects.)\n */\n get(stateOrName: StateOrName, base: StateOrName): StateDeclaration;\n get(stateOrName: StateOrName): StateDeclaration;\n get(): StateDeclaration[];\n get(stateOrName?: StateOrName, base?: StateOrName): any {\n const reg = this.router.stateRegistry;\n if (arguments.length === 0) return reg.get();\n return reg.get(stateOrName, base || this.$current);\n }\n\n /**\n * Lazy loads a state\n *\n * Explicitly runs a state's [[StateDeclaration.lazyLoad]] function.\n *\n * @param stateOrName the state that should be lazy loaded\n * @param transition the optional Transition context to use (if the lazyLoad function requires an injector, etc)\n * Note: If no transition is provided, a noop transition is created using the from the current state to the current state.\n * This noop transition is not actually run.\n *\n * @returns a promise to lazy load\n */\n lazyLoad(stateOrName: StateOrName, transition?: Transition): Promise {\n const state: StateDeclaration = this.get(stateOrName);\n if (!state || !state.lazyLoad) throw new Error('Can not lazy load ' + stateOrName);\n\n const currentPath = this.getCurrentPath();\n const target = PathUtils.makeTargetState(this.router.stateRegistry, currentPath);\n transition = transition || this.router.transitionService.create(currentPath, target);\n\n return lazyLoadState(transition, state);\n }\n}\n", + "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { isArray, isObject, $QLike } from '../common/index';\n\n/**\n * An angular1-like promise api\n *\n * This object implements four methods similar to the\n * [angular 1 promise api](https://docs.angularjs.org/api/ng/service/$q)\n *\n * UI-Router evolved from an angular 1 library to a framework agnostic library.\n * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.\n *\n * This API provides native ES6 promise support wrapped as a $q-like API.\n * Internally, UI-Router uses this $q object to perform promise operations.\n * The `angular-ui-router` (ui-router for angular 1) uses the $q API provided by angular.\n *\n * $q-like promise api\n */\nexport const $q = {\n /** Normalizes a value as a promise */\n when: (val) => new Promise((resolve, reject) => resolve(val)),\n\n /** Normalizes a value as a promise rejection */\n reject: (val) => new Promise((resolve, reject) => { reject(val); }),\n\n /** @returns a deferred object, which has `resolve` and `reject` functions */\n defer: () => {\n const deferred: any = {};\n deferred.promise = new Promise((resolve, reject) => {\n deferred.resolve = resolve;\n deferred.reject = reject;\n });\n return deferred;\n },\n\n /** Like Promise.all(), but also supports object key/promise notation like $q */\n all: (promises: { [key: string]: Promise } | Promise[]) => {\n if (isArray(promises)) {\n return Promise.all(promises);\n }\n\n if (isObject(promises)) {\n // Convert promises map to promises array.\n // When each promise resolves, map it to a tuple { key: key, val: val }\n const chain = Object.keys(promises)\n .map(key => promises[key].then(val => ({ key, val })));\n\n // Then wait for all promises to resolve, and convert them back to an object\n return $q.all(chain).then(values =>\n values.reduce((acc, tuple) => { acc[tuple.key] = tuple.val; return acc; }, {}));\n }\n },\n} as $QLike;\n", + "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport {\n extend, assertPredicate, isFunction, isArray, isInjectable, $InjectorLike, IInjectable,\n} from '../common/index';\n\n// globally available injectables\nconst globals = {};\nconst STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg;\nconst ARGUMENT_NAMES = /([^\\s,]+)/g;\n\n/**\n * A basic angular1-like injector api\n *\n * This object implements four methods similar to the\n * [angular 1 dependency injector](https://docs.angularjs.org/api/auto/service/$injector)\n *\n * UI-Router evolved from an angular 1 library to a framework agnostic library.\n * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.\n *\n * This object provides a naive implementation of a globally scoped dependency injection system.\n * It supports the following DI approaches:\n *\n * ### Function parameter names\n *\n * A function's `.toString()` is called, and the parameter names are parsed.\n * This only works when the parameter names aren't \"mangled\" by a minifier such as UglifyJS.\n *\n * ```js\n * function injectedFunction(FooService, BarService) {\n * // FooService and BarService are injected\n * }\n * ```\n *\n * ### Function annotation\n *\n * A function may be annotated with an array of dependency names as the `$inject` property.\n *\n * ```js\n * injectedFunction.$inject = [ 'FooService', 'BarService' ];\n * function injectedFunction(fs, bs) {\n * // FooService and BarService are injected as fs and bs parameters\n * }\n * ```\n *\n * ### Array notation\n *\n * An array provides the names of the dependencies to inject (as strings).\n * The function is the last element of the array.\n *\n * ```js\n * [ 'FooService', 'BarService', function (fs, bs) {\n * // FooService and BarService are injected as fs and bs parameters\n * }]\n * ```\n *\n * @type {$InjectorLike}\n */\nexport const $injector = {\n /** Gets an object from DI based on a string token */\n get: name => globals[name],\n\n /** Returns true if an object named `name` exists in global DI */\n has: (name) => $injector.get(name) != null,\n\n /**\n * Injects a function\n *\n * @param fn the function to inject\n * @param context the function's `this` binding\n * @param locals An object with additional DI tokens and values, such as `{ someToken: { foo: 1 } }`\n */\n invoke: (fn: IInjectable, context?, locals?) => {\n const all = extend({}, globals, locals || {});\n const params = $injector.annotate(fn);\n const ensureExist = assertPredicate((key: string) => all.hasOwnProperty(key), key => `DI can't find injectable: '${key}'`);\n const args = params.filter(ensureExist).map(x => all[x]);\n if (isFunction(fn)) return fn.apply(context, args);\n else return (fn as any[]).slice(-1)[0].apply(context, args);\n },\n\n /**\n * Returns a function's dependencies\n *\n * Analyzes a function (or array) and returns an array of DI tokens that the function requires.\n * @return an array of `string`s\n */\n annotate: (fn: IInjectable): any[] => {\n if (!isInjectable(fn)) throw new Error(`Not an injectable function: ${fn}`);\n if (fn && (fn as any).$inject) return (fn as any).$inject;\n if (isArray(fn)) return fn.slice(0, -1);\n const fnStr = fn.toString().replace(STRIP_COMMENTS, '');\n const result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES);\n return result || [];\n },\n} as $InjectorLike;\n", + "/**\n * @internalapi\n * @module vanilla\n */ /** */\n\nimport { deregAll, isDefined, LocationServices, removeFrom, root } from '../common';\nimport { Disposable } from '../interface';\nimport { UIRouter } from '../router';\nimport { HistoryLike, LocationLike } from './interface';\nimport { buildUrl, getParams, parseUrl } from './utils';\n\n/** A base `LocationServices` */\nexport abstract class BaseLocationServices implements LocationServices, Disposable {\n private _listeners: Function[] = [];\n _location: LocationLike;\n _history: HistoryLike;\n\n _listener = evt => this._listeners.forEach(cb => cb(evt));\n\n constructor(router: UIRouter, public fireAfterUpdate: boolean) {\n this._location = root.location;\n this._history = root.history;\n }\n\n /**\n * This should return the current internal URL representation.\n *\n * The internal URL includes only the portion that UI-Router matches.\n * It does not include:\n * - protocol\n * - server\n * - port\n * - base href or hash\n */\n protected abstract _get(): string;\n\n /**\n * This should set the current URL.\n *\n * The `url` param should include only the portion that UI-Router matches on.\n * It should not include:\n * - protocol\n * - server\n * - port\n * - base href or hash\n *\n * However, after this function completes, the browser URL should reflect the entire (fully qualified)\n * HREF including those data.\n */\n protected abstract _set(state: any, title: string, url: string, replace: boolean);\n\n hash = () => parseUrl(this._get()).hash;\n path = () => parseUrl(this._get()).path;\n search = () => getParams(parseUrl(this._get()).search);\n\n url(url?: string, replace = true): string {\n if (isDefined(url) && url !== this._get()) {\n this._set(null, null, url, replace);\n\n if (this.fireAfterUpdate) {\n this._listeners.forEach(cb => cb({ url }));\n }\n }\n\n return buildUrl(this);\n }\n\n onChange(cb: EventListener) {\n this._listeners.push(cb);\n return () => removeFrom(this._listeners, cb);\n }\n\n dispose(router: UIRouter) {\n deregAll(this._listeners);\n }\n}\n", "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { root, trimHashVal } from '../common';\nimport { UIRouter } from '../router';\nimport { BaseLocationServices } from './baseLocationService';\n\n/** A `LocationServices` that uses the browser hash \"#\" to get/set the current location */\nexport class HashLocationService extends BaseLocationServices {\n constructor(router: UIRouter) {\n super(router, false);\n root.addEventListener('hashchange', this._listener, false);\n }\n\n _get() {\n return trimHashVal(this._location.hash);\n }\n _set(state: any, title: string, url: string, replace: boolean) {\n this._location.hash = url;\n }\n\n dispose (router: UIRouter) {\n super.dispose(router);\n root.removeEventListener('hashchange', this._listener);\n }\n}\n\n", "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { BaseLocationServices } from './baseLocationService';\nimport { UIRouter } from '../router';\n\n/** A `LocationServices` that gets/sets the current location from an in-memory object */\nexport class MemoryLocationService extends BaseLocationServices {\n _url: string;\n\n constructor(router: UIRouter) {\n super(router, true);\n }\n\n _get() {\n return this._url;\n }\n\n _set(state: any, title: string, url: string, replace: boolean) {\n this._url = url;\n }\n}\n", - "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { UIRouter } from '../router';\nimport { BaseLocationServices } from './baseLocationService';\nimport { LocationConfig, root, splitHash, splitQuery, stripLastPathElement } from '../common';\n\n/**\n * A `LocationServices` that gets/sets the current location using the browser's `location` and `history` apis\n *\n * Uses `history.pushState` and `history.replaceState`\n */\nexport class PushStateLocationService extends BaseLocationServices {\n _config: LocationConfig;\n\n constructor(router: UIRouter) {\n super(router, true);\n this._config = router.urlService.config;\n root.addEventListener('popstate', this._listener, false);\n };\n\n /**\n * Gets the base prefix without:\n * - trailing slash\n * - trailing filename\n * - protocol and hostname\n *\n * If , this returns '/base'.\n * If , this returns '/foo/base'.\n * If , this returns '/base'.\n * If , this returns '/base'.\n * If , this returns ''.\n * If , this returns ''.\n * If , this returns ''.\n *\n * See: https://html.spec.whatwg.org/dev/semantics.html#the-base-element\n */\n private _getBasePrefix() {\n return stripLastPathElement(this._config.baseHref());\n }\n\n protected _get() {\n let { pathname, hash, search } = this._location;\n search = splitQuery(search)[1]; // strip ? if found\n hash = splitHash(hash)[1]; // strip # if found\n\n const basePrefix = this._getBasePrefix();\n const exactBaseHrefMatch = pathname === this._config.baseHref();\n const startsWithBase = pathname.substr(0, basePrefix.length) === basePrefix;\n pathname = exactBaseHrefMatch ? '/' : startsWithBase ? pathname.substring(basePrefix.length) : pathname;\n\n return pathname + (search ? '?' + search : '') + (hash ? '#' + hash : '');\n }\n\n protected _set(state: any, title: string, url: string, replace: boolean) {\n const basePrefix = this._getBasePrefix();\n const slash = url && url[0] !== '/' ? '/' : '';\n const fullUrl = (url === '' || url === '/') ? this._config.baseHref() : basePrefix + slash + url;\n\n if (replace) {\n this._history.replaceState(state, title, fullUrl);\n } else {\n this._history.pushState(state, title, fullUrl);\n }\n }\n\n public dispose(router: UIRouter) {\n super.dispose(router);\n root.removeEventListener('popstate', this._listener);\n }\n}\n\n", - "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { LocationConfig } from \"../common/coreservices\";\nimport { isDefined } from \"../common/predicates\";\nimport { noop } from \"../common/common\";\n\n/** A `LocationConfig` mock that gets/sets all config from an in-memory object */\nexport class MemoryLocationConfig implements LocationConfig {\n _baseHref = '';\n _port = 80;\n _protocol = \"http\";\n _host = \"localhost\";\n _hashPrefix = \"\";\n\n port = () => this._port;\n protocol = () => this._protocol;\n host = () => this._host;\n baseHref = () => this._baseHref;\n html5Mode = () => false;\n hashPrefix = (newval?) => isDefined(newval) ? this._hashPrefix = newval : this._hashPrefix;\n dispose = noop;\n}", - "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { isDefined } from \"../common/predicates\";\nimport { LocationConfig } from \"../common/coreservices\";\n\n/** A `LocationConfig` that delegates to the browser's `location` object */\nexport class BrowserLocationConfig implements LocationConfig {\n private _baseHref = undefined;\n private _hashPrefix = \"\";\n\n constructor(router?, private _isHtml5 = false) { }\n\n port(): number {\n if (location.port) {\n return Number(location.port);\n }\n\n return this.protocol() === 'https' ? 443 : 80;\n }\n\n protocol(): string {\n return location.protocol.replace(/:/g, '');\n }\n\n host(): string {\n return location.hostname;\n }\n\n html5Mode(): boolean {\n return this._isHtml5;\n }\n\n hashPrefix(): string;\n hashPrefix(newprefix?: string): string {\n return isDefined(newprefix) ? this._hashPrefix = newprefix : this._hashPrefix;\n };\n\n baseHref(href?: string): string {\n return isDefined(href) ? this._baseHref = href :\n isDefined(this._baseHref) ? this._baseHref : this.applyDocumentBaseHref();\n }\n\n applyDocumentBaseHref() {\n let baseTag: HTMLBaseElement = document.getElementsByTagName(\"base\")[0];\n return this._baseHref = baseTag ? baseTag.href.substr(location.origin.length) : location.pathname || '/';\n }\n\n dispose() {}\n}\n", - "/**\n * # Core classes and interfaces\n *\n * The classes and interfaces that are core to ui-router and do not belong\n * to a more specific subsystem (such as resolve).\n *\n * @coreapi\n * @preferred\n * @module core\n */ /** for typedoc */\n\n// Need to import or export at least one concrete something\nimport {noop} from \"./common/common\";\nimport {UIRouter} from \"./router\";\n\n/**\n * An interface for getting values from dependency injection.\n *\n * This is primarily used to get resolve values for a given token.\n * An instance of the `UIInjector` can be retrieved from the current transition using [[Transition.injector]].\n *\n * ---\n *\n * If no resolve is found for a token, then it will delegate to the native injector.\n * The native injector may be Angular 1 `$injector`, Angular 2 `Injector`, or a simple polyfill.\n *\n * In Angular 2, the native injector might be the root Injector,\n * or it might be a lazy loaded `NgModule` injector scoped to a lazy load state tree.\n */\nexport interface UIInjector {\n /**\n * Gets a value from the injector.\n *\n * For a given token, returns the value from the injector that matches the token.\n * If the token is for a resolve that has not yet been fetched, this throws an error.\n *\n * #### Example:\n * ```js\n * var myResolve = injector.get('myResolve');\n * ```\n *\n * #### ng1 Example:\n * ```js\n * // Fetch StateService\n * injector.get('$state').go('home');\n * ```\n *\n * #### ng2 Example:\n * ```js\n * import {StateService} from \"ui-router-ng2\";\n * // Fetch StateService\n * injector.get(StateService).go('home');\n * ```\n *\n * #### Typescript Example:\n * ```js\n * var stringArray = injector.get('myStringArray');\n * ```\n *\n * ### `NOWAIT` policy\n *\n * When using [[ResolvePolicy.async]] === `NOWAIT`, the value returned from `get()` is a promise for the result.\n * The promise is not automatically unwrapped.\n *\n * @param token the key for the value to get. May be a string, a class, or any arbitrary object.\n * @return the Dependency Injection value that matches the token\n */\n get(token: any): any;\n /** Gets a value as type `T` (generics parameter) */\n get(token: any): T;\n\n /**\n * Asynchronously gets a value from the injector\n *\n * For a given token, returns a promise for the value from the injector that matches the token.\n * If the token is for a resolve that has not yet been fetched, this triggers the resolve to load.\n *\n * #### Example:\n * ```js\n * return injector.getAsync('myResolve').then(value => {\n * if (value === 'declined') return false;\n * });\n * ```\n *\n * @param token the key for the value to get. May be a string or arbitrary object.\n * @return a Promise for the Dependency Injection value that matches the token\n */\n getAsync(token: any): Promise;\n /** Asynchronously gets a value as type `T` (generics parameter) */\n getAsync(token: any): Promise;\n\n /**\n * Gets a value from the native injector\n *\n * Returns a value from the native injector, bypassing anything in the [[ResolveContext]].\n *\n * Example:\n * ```js\n * let someThing = injector.getNative(SomeToken);\n * ```\n *\n * @param token the key for the value to get. May be a string or arbitrary object.\n * @return the Dependency Injection value that matches the token\n */\n getNative(token: any): any;\n getNative(token: any): T;\n}\n\n/** @internalapi */\nexport interface UIRouterPlugin extends Disposable {\n name: string;\n}\n\n/** @internalapi */\nexport abstract class UIRouterPluginBase implements UIRouterPlugin, Disposable {\n abstract name: string;\n dispose(router: UIRouter) { }\n}\n\n/** @internalapi */\nexport interface Disposable {\n /** Instructs the Disposable to clean up any resources */\n dispose(router?: UIRouter);\n}", - "/** @module ng1 */ /** for typedoc */\nimport {\n val, isObject, createProxyFunctions, BuilderFunction, StateRegistry, StateService, OnInvalidCallback\n} from \"@uirouter/core\";\nimport { Ng1StateDeclaration } from \"./interface\";\n\n/**\n * The Angular 1 `StateProvider`\n *\n * The `$stateProvider` works similar to Angular's v1 router, but it focuses purely\n * on state.\n *\n * A state corresponds to a \"place\" in the application in terms of the overall UI and\n * navigation. A state describes (via the controller / template / view properties) what\n * the UI looks like and does at that place.\n *\n * States often have things in common, and the primary way of factoring out these\n * commonalities in this model is via the state hierarchy, i.e. parent/child states aka\n * nested states.\n *\n * The `$stateProvider` provides interfaces to declare these states for your app.\n */\nexport class StateProvider {\n constructor(private stateRegistry: StateRegistry, private stateService: StateService) {\n createProxyFunctions(val(StateProvider.prototype), this, val(this));\n }\n\n /**\n * Decorates states when they are registered\n *\n * Allows you to extend (carefully) or override (at your own peril) the\n * `stateBuilder` object used internally by [[StateRegistry]].\n * This can be used to add custom functionality to ui-router,\n * for example inferring templateUrl based on the state name.\n *\n * When passing only a name, it returns the current (original or decorated) builder\n * function that matches `name`.\n *\n * The builder functions that can be decorated are listed below. Though not all\n * necessarily have a good use case for decoration, that is up to you to decide.\n *\n * In addition, users can attach custom decorators, which will generate new\n * properties within the state's internal definition. There is currently no clear\n * use-case for this beyond accessing internal states (i.e. $state.$current),\n * however, expect this to become increasingly relevant as we introduce additional\n * meta-programming features.\n *\n * **Warning**: Decorators should not be interdependent because the order of\n * execution of the builder functions in non-deterministic. Builder functions\n * should only be dependent on the state definition object and super function.\n *\n *\n * Existing builder functions and current return values:\n *\n * - **parent** `{object}` - returns the parent state object.\n * - **data** `{object}` - returns state data, including any inherited data that is not\n * overridden by own values (if any).\n * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}\n * or `null`.\n * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is\n * navigable).\n * - **params** `{object}` - returns an array of state params that are ensured to\n * be a super-set of parent's params.\n * - **views** `{object}` - returns a views object where each key is an absolute view\n * name (i.e. \"viewName@stateName\") and each value is the config object\n * (template, controller) for the view. Even when you don't use the views object\n * explicitly on a state config, one is still created for you internally.\n * So by decorating this builder function you have access to decorating template\n * and controller properties.\n * - **ownParams** `{object}` - returns an array of params that belong to the state,\n * not including any params defined by ancestor states.\n * - **path** `{string}` - returns the full path from the root down to this state.\n * Needed for state activation.\n * - **includes** `{object}` - returns an object that includes every state that\n * would pass a `$state.includes()` test.\n *\n * #### Example:\n * Override the internal 'views' builder with a function that takes the state\n * definition, and a reference to the internal function being overridden:\n * ```js\n * $stateProvider.decorator('views', function (state, parent) {\n * let result = {},\n * views = parent(state);\n *\n * angular.forEach(views, function (config, name) {\n * let autoName = (state.name + '.' + name).replace('.', '/');\n * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';\n * result[name] = config;\n * });\n * return result;\n * });\n *\n * $stateProvider.state('home', {\n * views: {\n * 'contact.list': { controller: 'ListController' },\n * 'contact.item': { controller: 'ItemController' }\n * }\n * });\n * ```\n *\n *\n * ```js\n * // Auto-populates list and item views with /partials/home/contact/list.html,\n * // and /partials/home/contact/item.html, respectively.\n * $state.go('home');\n * ```\n *\n * @param {string} name The name of the builder function to decorate.\n * @param {object} func A function that is responsible for decorating the original\n * builder function. The function receives two parameters:\n *\n * - `{object}` - state - The state config object.\n * - `{object}` - super - The original builder function.\n *\n * @return {object} $stateProvider - $stateProvider instance\n */\n decorator(name: string, func: BuilderFunction) {\n return this.stateRegistry.decorator(name, func) || this;\n }\n\n /**\n * Registers a state\n *\n * ### This is a passthrough to [[StateRegistry.register]].\n *\n * Registers a state configuration under a given state name.\n * The stateConfig object has the following acceptable properties.\n *\n *
    \n *\n * - **`template`** - {string|function=} - html template as a string or a function that returns\n * an html template as a string which should be used by the uiView directives. This property\n * takes precedence over templateUrl.\n *\n * If `template` is a function, it will be called with the following parameters:\n *\n * - {array.<object>} - state parameters extracted from the current $location.path() by\n * applying the current state\n *\n * \n *\n * - **`templateUrl`** - {string|function=} - path or function that returns a path to an html\n * template that should be used by uiView.\n *\n * If `templateUrl` is a function, it will be called with the following parameters:\n *\n * - {array.<object>} - state parameters extracted from the current $location.path() by\n * applying the current state\n *\n * \n *\n * - **`templateProvider`** - {function=} - Provider function that returns HTML content\n * string.\n *\n * \n *\n * - **`controller`** - {string|function=} - Controller fn that should be associated with newly\n * related scope or the name of a registered controller if passed as a string.\n *\n * \n *\n * - **`controllerProvider`** - {function=} - Injectable provider function that returns\n * the actual controller or string.\n *\n * \n *\n * - **`controllerAs`** – {string=} – A controller alias name. If present the controller will be\n * published to scope under the controllerAs name.\n *\n * \n *\n * - **`resolve`** - {object.<string, function>=} - An optional map of dependencies which\n * should be injected into the controller. If any of these dependencies are promises,\n * the router will wait for them all to be resolved or one to be rejected before the\n * controller is instantiated. If all the promises are resolved successfully, the values\n * of the resolved promises are injected and $stateChangeSuccess event is fired. If any\n * of the promises are rejected the $stateChangeError event is fired. The map object is:\n *\n * - key - {string}: name of dependency to be injected into controller\n * - factory - {string|function}: If string then it is alias for service. Otherwise if function,\n * it is injected and return value it treated as dependency. If result is a promise, it is\n * resolved before its value is injected into controller.\n *\n * \n *\n * - **`url`** - {string=} - A url with optional parameters. When a state is navigated or\n * transitioned to, the `$stateParams` service will be populated with any\n * parameters that were passed.\n *\n * \n *\n * - **`params`** - {object=} - An array of parameter names or regular expressions. Only\n * use this within a state if you are not using url. Otherwise you can specify your\n * parameters within the url. When a state is navigated or transitioned to, the\n * $stateParams service will be populated with any parameters that were passed.\n *\n * \n *\n * - **`views`** - {object=} - Use the views property to set up multiple views or to target views\n * manually/explicitly.\n *\n * \n *\n * - **`abstract`** - {boolean=} - An abstract state will never be directly activated,\n * but can provide inherited properties to its common children states.\n *\n * \n *\n * - **`onEnter`** - {object=} - Callback function for when a state is entered. Good way\n * to trigger an action or dispatch an event, such as opening a dialog.\n * If minifying your scripts, make sure to use the `['injection1', 'injection2', function(injection1, injection2){}]` syntax.\n *\n * \n *\n * - **`onExit`** - {object=} - Callback function for when a state is exited. Good way to\n * trigger an action or dispatch an event, such as opening a dialog.\n * If minifying your scripts, make sure to use the `['injection1', 'injection2', function(injection1, injection2){}]` syntax.\n *\n * \n *\n * - **`reloadOnSearch = true`** - {boolean=} - If `false`, will not retrigger the same state\n * just because a search/query parameter has changed (via $location.search() or $location.hash()).\n * Useful for when you'd like to modify $location.search() without triggering a reload.\n *\n * \n *\n * - **`data`** - {object=} - Arbitrary data object, useful for custom configuration.\n *\n * #### Example:\n * Some state name examples\n * ```js\n * // stateName can be a single top-level name (must be unique).\n * $stateProvider.state(\"home\", {});\n *\n * // Or it can be a nested state name. This state is a child of the\n * // above \"home\" state.\n * $stateProvider.state(\"home.newest\", {});\n *\n * // Nest states as deeply as needed.\n * $stateProvider.state(\"home.newest.abc.xyz.inception\", {});\n *\n * // state() returns $stateProvider, so you can chain state declarations.\n * $stateProvider\n * .state(\"home\", {})\n * .state(\"about\", {})\n * .state(\"contacts\", {});\n * ```\n *\n * @param {string} name A unique state name, e.g. \"home\", \"about\", \"contacts\".\n * To create a parent/child state use a dot, e.g. \"about.sales\", \"home.newest\".\n * @param {object} definition State configuration object.\n */\n state(name: string, definition: Ng1StateDeclaration): StateProvider;\n state(definition: Ng1StateDeclaration): StateProvider;\n state(name: any, definition?: any) {\n if (isObject(name)) {\n definition = name;\n } else {\n definition.name = name;\n }\n this.stateRegistry.register(definition);\n return this;\n }\n\n /**\n * Registers an invalid state handler\n *\n * This is a passthrough to [[StateService.onInvalid]] for ng1.\n */\n\n onInvalid(callback: OnInvalidCallback): Function {\n return this.stateService.onInvalid(callback);\n }\n}\n", - "/** @module ng1 */ /** */\nimport {\n StateObject, TransitionStateHookFn, HookResult, Transition, services, ResolveContext, extend, BuilderFunction\n} from \"@uirouter/core\";\nimport { getLocals } from \"../services\";\nimport { Ng1StateDeclaration } from '../interface';\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`,\n * `onRetain` callback hooks on a [[Ng1StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * ensures that those hooks are injectable for @uirouter/angularjs (ng1).\n */\nexport const getStateHookBuilder = (hookName: \"onEnter\"|\"onExit\"|\"onRetain\") =>\nfunction stateHookBuilder(state: StateObject, parentFn: BuilderFunction): TransitionStateHookFn {\n const hook = state[hookName];\n const pathname = hookName === 'onExit' ? 'from' : 'to';\n\n function decoratedNg1Hook(trans: Transition, state: Ng1StateDeclaration): HookResult {\n const resolveContext = new ResolveContext(trans.treeChanges(pathname));\n const subContext = resolveContext.subContext(state.$$state());\n const locals = extend(getLocals(subContext), { $state$: state, $transition$: trans });\n return services.$injector.invoke(hook, this, locals);\n }\n\n return hook ? decoratedNg1Hook : undefined;\n};\n", - "/**\n * @internalapi\n * @module ng1\n */ /** */\nimport { LocationConfig, LocationServices, UIRouter, ParamType, isDefined } from \"@uirouter/core\";\nimport { val, createProxyFunctions, removeFrom, isObject } from \"@uirouter/core\";\nimport { ILocationService, ILocationProvider } from \"angular\";\n\n/**\n * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service\n */\nexport class Ng1LocationServices implements LocationConfig, LocationServices {\n private $locationProvider: ILocationProvider;\n private $location: ILocationService;\n private $sniffer;\n\n path;\n search;\n hash;\n hashPrefix;\n port;\n protocol;\n host;\n baseHref;\n\n // .onChange() registry\n private _urlListeners: Function[] = [];\n\n dispose() { }\n\n constructor($locationProvider: ILocationProvider) {\n this.$locationProvider = $locationProvider;\n let _lp = val($locationProvider);\n createProxyFunctions(_lp, this, _lp, ['hashPrefix']);\n }\n\n onChange(callback: Function) {\n this._urlListeners.push(callback);\n return () => removeFrom(this._urlListeners)(callback);\n }\n\n html5Mode() {\n let html5Mode: any = this.$locationProvider.html5Mode();\n html5Mode = isObject(html5Mode) ? html5Mode.enabled : html5Mode;\n return html5Mode && this.$sniffer.history;\n }\n\n url(newUrl?: string, replace = false, state?) {\n if (isDefined(newUrl)) this.$location.url(newUrl);\n if (replace) this.$location.replace();\n if (state) this.$location.state(state);\n return this.$location.url();\n }\n\n _runtimeServices($rootScope, $location: ILocationService, $sniffer, $browser) {\n this.$location = $location;\n this.$sniffer = $sniffer;\n\n // Bind $locationChangeSuccess to the listeners registered in LocationService.onChange\n $rootScope.$on(\"$locationChangeSuccess\", evt => this._urlListeners.forEach(fn => fn(evt)));\n let _loc = val($location);\n let _browser = val($browser);\n\n // Bind these LocationService functions to $location\n createProxyFunctions(_loc, this, _loc, [\"replace\", \"path\", \"search\", \"hash\"]);\n // Bind these LocationConfig functions to $location\n createProxyFunctions(_loc, this, _loc, ['port', 'protocol', 'host']);\n // Bind these LocationConfig functions to $browser\n createProxyFunctions(_browser, this, _browser, ['baseHref']);\n }\n\n /**\n * Applys ng1-specific path parameter encoding\n *\n * The Angular 1 `$location` service is a bit weird.\n * It doesn't allow slashes to be encoded/decoded bi-directionally.\n *\n * See the writeup at https://github.com/angular-ui/ui-router/issues/2598\n *\n * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F\n *\n * @param router\n */\n static monkeyPatchPathParameterType(router: UIRouter) {\n let pathType: ParamType = router.urlMatcherFactory.type('path');\n\n pathType.encode = (val: any) =>\n val != null ? val.toString().replace(/(~|\\/)/g, m => ({ '~': '~~', '/': '~2F' }[m])) : val;\n\n pathType.decode = (val: string) =>\n val != null ? val.toString().replace(/(~~|~2F)/g, m => ({ '~~': '~', '~2F': '/' }[m])) : val;\n\n }\n}\n", - "/** @module url */ /** */\nimport {\n UIRouter, UrlRouter, LocationServices, $InjectorLike, BaseUrlRule, UrlRuleHandlerFn, UrlMatcher,\n IInjectable\n} from \"@uirouter/core\";\nimport { services, isString, isFunction, isArray, identity } from \"@uirouter/core\";\n\nexport interface RawNg1RuleFunction {\n ($injector: $InjectorLike, $location: LocationServices): string|void;\n}\n\n/**\n * Manages rules for client-side URL\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class manages the router rules for what to do when the URL changes.\n *\n * This provider remains for backwards compatibility.\n *\n * @deprecated\n */\nexport class UrlRouterProvider {\n /** @hidden */ _router: UIRouter;\n /** @hidden */ _urlRouter: UrlRouter;\n\n /** @hidden */\n constructor(router: UIRouter) {\n this._router = router;\n this._urlRouter = router.urlRouter;\n }\n\n /** @hidden */\n $get() {\n let urlRouter = this._urlRouter;\n urlRouter.update(true);\n if (!urlRouter.interceptDeferred) urlRouter.listen();\n return urlRouter;\n }\n\n /**\n * Registers a url handler function.\n *\n * Registers a low level url handler (a `rule`).\n * A rule detects specific URL patterns and returns a redirect, or performs some action.\n *\n * If a rule returns a string, the URL is replaced with the string, and all rules are fired again.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // Here's an example of how you might allow case insensitive urls\n * $urlRouterProvider.rule(function ($injector, $location) {\n * var path = $location.path(),\n * normalized = path.toLowerCase();\n *\n * if (path !== normalized) {\n * return normalized;\n * }\n * });\n * });\n * ```\n *\n * @param ruleFn\n * Handler function that takes `$injector` and `$location` services as arguments.\n * You can use them to detect a url and return a different url as a string.\n *\n * @return [[UrlRouterProvider]] (`this`)\n */\n rule(ruleFn: RawNg1RuleFunction): UrlRouterProvider {\n if (!isFunction(ruleFn)) throw new Error(\"'rule' must be a function\");\n\n const match = () =>\n ruleFn(services.$injector, this._router.locationService);\n\n let rule = new BaseUrlRule(match, identity);\n this._urlRouter.rule(rule);\n return this;\n };\n\n /**\n * Defines the path or behavior to use when no url can be matched.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // if the path doesn't match any of the urls you configured\n * // otherwise will take care of routing the user to the\n * // specified url\n * $urlRouterProvider.otherwise('/index');\n *\n * // Example of using function rule as param\n * $urlRouterProvider.otherwise(function ($injector, $location) {\n * return '/a/valid/url';\n * });\n * });\n * ```\n *\n * @param rule\n * The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`.\n * The function version is passed two params: `$injector` and `$location` services, and should return a url string.\n *\n * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n */\n otherwise(rule: string | RawNg1RuleFunction): UrlRouterProvider {\n let urlRouter = this._urlRouter;\n\n if (isString(rule)) {\n urlRouter.otherwise(rule);\n } else if (isFunction(rule)) {\n urlRouter.otherwise(() => rule(services.$injector, this._router.locationService));\n } else {\n throw new Error(\"'rule' must be a string or function\");\n }\n\n return this;\n };\n\n /**\n * Registers a handler for a given url matching.\n *\n * If the handler is a string, it is\n * treated as a redirect, and is interpolated according to the syntax of match\n * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).\n *\n * If the handler is a function, it is injectable.\n * It gets invoked if `$location` matches.\n * You have the option of inject the match object as `$match`.\n *\n * The handler can return\n *\n * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n * will continue trying to find another one that matches.\n * - **string** which is treated as a redirect and passed to `$location.url()`\n * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n * if ($state.$current.navigable !== state ||\n * !equalForKeys($match, $stateParams) {\n * $state.transitionTo(state, $match, false);\n * }\n * });\n * });\n * ```\n *\n * @param what A pattern string to match, compiled as a [[UrlMatcher]].\n * @param handler The path (or function that returns a path) that you want to redirect your user to.\n * @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]]\n *\n * Note: the handler may also invoke arbitrary code, such as `$state.go()`\n */\n when(what: (RegExp|UrlMatcher|string), handler: string|IInjectable) {\n if (isArray(handler) || isFunction(handler)) {\n handler = UrlRouterProvider.injectableHandler(this._router, handler);\n }\n\n this._urlRouter.when(what, handler as any);\n return this;\n };\n\n static injectableHandler(router: UIRouter, handler): UrlRuleHandlerFn {\n return match =>\n services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params });\n }\n\n /**\n * Disables monitoring of the URL.\n *\n * Call this method before UI-Router has bootstrapped.\n * It will stop UI-Router from performing the initial url sync.\n *\n * This can be useful to perform some asynchronous initialization before the router starts.\n * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // Prevent $urlRouter from automatically intercepting URL changes;\n * $urlRouterProvider.deferIntercept();\n * })\n *\n * app.run(function (MyService, $urlRouter, $http) {\n * $http.get(\"/stuff\").then(function(resp) {\n * MyService.doStuff(resp.data);\n * $urlRouter.listen();\n * $urlRouter.sync();\n * });\n * });\n * ```\n *\n * @param defer Indicates whether to defer location change interception.\n * Passing no parameter is equivalent to `true`.\n */\n deferIntercept(defer?: boolean) {\n this._urlRouter.deferIntercept(defer);\n };\n}\n", - "/** @module ng1 */ /** */\nimport { ng as angular } from \"./angular\";\nimport { IServiceProviderFactory } from \"angular\";\nimport IAnchorScrollService = angular.IAnchorScrollService;\nimport ITimeoutService = angular.ITimeoutService;\n\nexport interface UIViewScrollProvider {\n /**\n * Uses standard anchorScroll behavior\n *\n * Reverts [[$uiViewScroll]] back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)\n * service for scrolling based on the url anchor.\n */\n useAnchorScroll(): void;\n}\n\n\n/** @hidden */\nfunction $ViewScrollProvider() {\n\n var useAnchorScroll = false;\n\n this.useAnchorScroll = function () {\n useAnchorScroll = true;\n };\n\n this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll: IAnchorScrollService, $timeout: ITimeoutService): Function {\n if (useAnchorScroll) {\n return $anchorScroll;\n }\n\n return function ($element: JQuery) {\n return $timeout(function () {\n $element[0].scrollIntoView();\n }, 0, false);\n };\n }];\n}\n\nangular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);\n", - "/**\n * Main entry point for angular 1.x build\n * @module ng1\n */ /** */\n\nexport * from \"./interface\";\nexport * from \"./services\";\nexport * from \"./statebuilders/views\";\nexport * from \"./stateProvider\";\nexport * from \"./urlRouterProvider\";\n\nimport \"./injectables\";\nimport \"./directives/stateDirectives\";\nimport \"./stateFilters\";\nimport \"./directives/viewDirective\";\nimport \"./viewScroll\";\n\nexport default \"ui.router\";\n\nimport * as core from \"@uirouter/core\";\nexport { core };\nexport * from \"@uirouter/core\";\n\n" + "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { UIRouter } from '../router';\nimport { BaseLocationServices } from './baseLocationService';\nimport { LocationConfig, root, splitHash, splitQuery, stripLastPathElement } from '../common';\n\n/**\n * A `LocationServices` that gets/sets the current location using the browser's `location` and `history` apis\n *\n * Uses `history.pushState` and `history.replaceState`\n */\nexport class PushStateLocationService extends BaseLocationServices {\n _config: LocationConfig;\n\n constructor(router: UIRouter) {\n super(router, true);\n this._config = router.urlService.config;\n root.addEventListener('popstate', this._listener, false);\n }\n\n /**\n * Gets the base prefix without:\n * - trailing slash\n * - trailing filename\n * - protocol and hostname\n *\n * If , this returns '/base'.\n * If , this returns '/foo/base'.\n * If , this returns '/base'.\n * If , this returns '/base'.\n * If , this returns ''.\n * If , this returns ''.\n * If , this returns ''.\n *\n * See: https://html.spec.whatwg.org/dev/semantics.html#the-base-element\n */\n private _getBasePrefix() {\n return stripLastPathElement(this._config.baseHref());\n }\n\n protected _get() {\n let { pathname, hash, search } = this._location;\n search = splitQuery(search)[1]; // strip ? if found\n hash = splitHash(hash)[1]; // strip # if found\n\n const basePrefix = this._getBasePrefix();\n const exactBaseHrefMatch = pathname === this._config.baseHref();\n const startsWithBase = pathname.substr(0, basePrefix.length) === basePrefix;\n pathname = exactBaseHrefMatch ? '/' : startsWithBase ? pathname.substring(basePrefix.length) : pathname;\n\n return pathname + (search ? '?' + search : '') + (hash ? '#' + hash : '');\n }\n\n protected _set(state: any, title: string, url: string, replace: boolean) {\n const basePrefix = this._getBasePrefix();\n const slash = url && url[0] !== '/' ? '/' : '';\n const fullUrl = (url === '' || url === '/') ? this._config.baseHref() : basePrefix + slash + url;\n\n if (replace) {\n this._history.replaceState(state, title, fullUrl);\n } else {\n this._history.pushState(state, title, fullUrl);\n }\n }\n\n public dispose(router: UIRouter) {\n super.dispose(router);\n root.removeEventListener('popstate', this._listener);\n }\n}\n\n", + "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { LocationConfig } from '../common/coreservices';\nimport { isDefined } from '../common/predicates';\nimport { noop } from '../common/common';\n\n/** A `LocationConfig` mock that gets/sets all config from an in-memory object */\nexport class MemoryLocationConfig implements LocationConfig {\n dispose = noop;\n\n _baseHref = '';\n _port = 80;\n _protocol = 'http';\n _host = 'localhost';\n _hashPrefix = '';\n\n port = () => this._port;\n protocol = () => this._protocol;\n host = () => this._host;\n baseHref = () => this._baseHref;\n html5Mode = () => false;\n hashPrefix = (newval?) => isDefined(newval) ? this._hashPrefix = newval : this._hashPrefix;\n}\n", + "/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { isDefined } from '../common/predicates';\nimport { LocationConfig } from '../common/coreservices';\n\n/** A `LocationConfig` that delegates to the browser's `location` object */\nexport class BrowserLocationConfig implements LocationConfig {\n private _baseHref = undefined;\n private _hashPrefix = '';\n\n constructor(router?, private _isHtml5 = false) { }\n\n port(): number {\n if (location.port) {\n return Number(location.port);\n }\n\n return this.protocol() === 'https' ? 443 : 80;\n }\n\n protocol(): string {\n return location.protocol.replace(/:/g, '');\n }\n\n host(): string {\n return location.hostname;\n }\n\n html5Mode(): boolean {\n return this._isHtml5;\n }\n\n hashPrefix(): string;\n hashPrefix(newprefix?: string): string {\n return isDefined(newprefix) ? this._hashPrefix = newprefix : this._hashPrefix;\n }\n\n baseHref(href?: string): string {\n return isDefined(href) ? this._baseHref = href :\n isDefined(this._baseHref) ? this._baseHref : this.applyDocumentBaseHref();\n }\n\n applyDocumentBaseHref() {\n const baseTag: HTMLBaseElement = document.getElementsByTagName('base')[0];\n return this._baseHref = baseTag ? baseTag.href.substr(location.origin.length) : location.pathname || '/';\n }\n\n dispose() {}\n}\n", + "/**\n * # Core classes and interfaces\n *\n * The classes and interfaces that are core to ui-router and do not belong\n * to a more specific subsystem (such as resolve).\n *\n * @coreapi\n * @preferred\n * @module core\n */ /** for typedoc */\n\n// Need to import or export at least one concrete something\nimport { noop } from './common/common';\nimport { UIRouter } from './router';\n\n/**\n * An interface for getting values from dependency injection.\n *\n * This is primarily used to get resolve values for a given token.\n * An instance of the `UIInjector` can be retrieved from the current transition using [[Transition.injector]].\n *\n * ---\n *\n * If no resolve is found for a token, then it will delegate to the native injector.\n * The native injector may be Angular 1 `$injector`, Angular 2 `Injector`, or a simple polyfill.\n *\n * In Angular 2, the native injector might be the root Injector,\n * or it might be a lazy loaded `NgModule` injector scoped to a lazy load state tree.\n */\nexport interface UIInjector {\n /**\n * Gets a value from the injector.\n *\n * For a given token, returns the value from the injector that matches the token.\n * If the token is for a resolve that has not yet been fetched, this throws an error.\n *\n * #### Example:\n * ```js\n * var myResolve = injector.get('myResolve');\n * ```\n *\n * #### ng1 Example:\n * ```js\n * // Fetch StateService\n * injector.get('$state').go('home');\n * ```\n *\n * #### ng2 Example:\n * ```js\n * import {StateService} from \"ui-router-ng2\";\n * // Fetch StateService\n * injector.get(StateService).go('home');\n * ```\n *\n * #### Typescript Example:\n * ```js\n * var stringArray = injector.get('myStringArray');\n * ```\n *\n * ### `NOWAIT` policy\n *\n * When using [[ResolvePolicy.async]] === `NOWAIT`, the value returned from `get()` is a promise for the result.\n * The promise is not automatically unwrapped.\n *\n * @param token the key for the value to get. May be a string, a class, or any arbitrary object.\n * @return the Dependency Injection value that matches the token\n */\n get(token: any): any;\n /** Gets a value as type `T` (generics parameter) */\n get(token: any): T;\n\n /**\n * Asynchronously gets a value from the injector\n *\n * For a given token, returns a promise for the value from the injector that matches the token.\n * If the token is for a resolve that has not yet been fetched, this triggers the resolve to load.\n *\n * #### Example:\n * ```js\n * return injector.getAsync('myResolve').then(value => {\n * if (value === 'declined') return false;\n * });\n * ```\n *\n * @param token the key for the value to get. May be a string or arbitrary object.\n * @return a Promise for the Dependency Injection value that matches the token\n */\n getAsync(token: any): Promise;\n /** Asynchronously gets a value as type `T` (generics parameter) */\n getAsync(token: any): Promise;\n\n /**\n * Gets a value from the native injector\n *\n * Returns a value from the native injector, bypassing anything in the [[ResolveContext]].\n *\n * Example:\n * ```js\n * let someThing = injector.getNative(SomeToken);\n * ```\n *\n * @param token the key for the value to get. May be a string or arbitrary object.\n * @return the Dependency Injection value that matches the token\n */\n getNative(token: any): any;\n getNative(token: any): T;\n}\n\n/** @internalapi */\nexport interface UIRouterPlugin extends Disposable {\n name: string;\n}\n\n/** @internalapi */\nexport abstract class UIRouterPluginBase implements UIRouterPlugin, Disposable {\n abstract name: string;\n dispose(router: UIRouter) { }\n}\n\n/** @internalapi */\nexport interface Disposable {\n /** Instructs the Disposable to clean up any resources */\n dispose(router?: UIRouter);\n}\n", + "/** @module ng1 */ /** for typedoc */\nimport {\n val, isObject, createProxyFunctions, BuilderFunction, StateRegistry, StateService, OnInvalidCallback,\n} from '@uirouter/core';\nimport { Ng1StateDeclaration } from './interface';\n\n/**\n * The Angular 1 `StateProvider`\n *\n * The `$stateProvider` works similar to Angular's v1 router, but it focuses purely\n * on state.\n *\n * A state corresponds to a \"place\" in the application in terms of the overall UI and\n * navigation. A state describes (via the controller / template / view properties) what\n * the UI looks like and does at that place.\n *\n * States often have things in common, and the primary way of factoring out these\n * commonalities in this model is via the state hierarchy, i.e. parent/child states aka\n * nested states.\n *\n * The `$stateProvider` provides interfaces to declare these states for your app.\n */\nexport class StateProvider {\n constructor(private stateRegistry: StateRegistry, private stateService: StateService) {\n createProxyFunctions(val(StateProvider.prototype), this, val(this));\n }\n\n /**\n * Decorates states when they are registered\n *\n * Allows you to extend (carefully) or override (at your own peril) the\n * `stateBuilder` object used internally by [[StateRegistry]].\n * This can be used to add custom functionality to ui-router,\n * for example inferring templateUrl based on the state name.\n *\n * When passing only a name, it returns the current (original or decorated) builder\n * function that matches `name`.\n *\n * The builder functions that can be decorated are listed below. Though not all\n * necessarily have a good use case for decoration, that is up to you to decide.\n *\n * In addition, users can attach custom decorators, which will generate new\n * properties within the state's internal definition. There is currently no clear\n * use-case for this beyond accessing internal states (i.e. $state.$current),\n * however, expect this to become increasingly relevant as we introduce additional\n * meta-programming features.\n *\n * **Warning**: Decorators should not be interdependent because the order of\n * execution of the builder functions in non-deterministic. Builder functions\n * should only be dependent on the state definition object and super function.\n *\n *\n * Existing builder functions and current return values:\n *\n * - **parent** `{object}` - returns the parent state object.\n * - **data** `{object}` - returns state data, including any inherited data that is not\n * overridden by own values (if any).\n * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}\n * or `null`.\n * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is\n * navigable).\n * - **params** `{object}` - returns an array of state params that are ensured to\n * be a super-set of parent's params.\n * - **views** `{object}` - returns a views object where each key is an absolute view\n * name (i.e. \"viewName@stateName\") and each value is the config object\n * (template, controller) for the view. Even when you don't use the views object\n * explicitly on a state config, one is still created for you internally.\n * So by decorating this builder function you have access to decorating template\n * and controller properties.\n * - **ownParams** `{object}` - returns an array of params that belong to the state,\n * not including any params defined by ancestor states.\n * - **path** `{string}` - returns the full path from the root down to this state.\n * Needed for state activation.\n * - **includes** `{object}` - returns an object that includes every state that\n * would pass a `$state.includes()` test.\n *\n * #### Example:\n * Override the internal 'views' builder with a function that takes the state\n * definition, and a reference to the internal function being overridden:\n * ```js\n * $stateProvider.decorator('views', function (state, parent) {\n * let result = {},\n * views = parent(state);\n *\n * angular.forEach(views, function (config, name) {\n * let autoName = (state.name + '.' + name).replace('.', '/');\n * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';\n * result[name] = config;\n * });\n * return result;\n * });\n *\n * $stateProvider.state('home', {\n * views: {\n * 'contact.list': { controller: 'ListController' },\n * 'contact.item': { controller: 'ItemController' }\n * }\n * });\n * ```\n *\n *\n * ```js\n * // Auto-populates list and item views with /partials/home/contact/list.html,\n * // and /partials/home/contact/item.html, respectively.\n * $state.go('home');\n * ```\n *\n * @param {string} name The name of the builder function to decorate.\n * @param {object} func A function that is responsible for decorating the original\n * builder function. The function receives two parameters:\n *\n * - `{object}` - state - The state config object.\n * - `{object}` - super - The original builder function.\n *\n * @return {object} $stateProvider - $stateProvider instance\n */\n decorator(name: string, func: BuilderFunction) {\n return this.stateRegistry.decorator(name, func) || this;\n }\n\n /**\n * Registers a state\n *\n * ### This is a passthrough to [[StateRegistry.register]].\n *\n * Registers a state configuration under a given state name.\n * The stateConfig object has the following acceptable properties.\n *\n * \n *\n * - **`template`** - {string|function=} - html template as a string or a function that returns\n * an html template as a string which should be used by the uiView directives. This property\n * takes precedence over templateUrl.\n *\n * If `template` is a function, it will be called with the following parameters:\n *\n * - {array.<object>} - state parameters extracted from the current $location.path() by\n * applying the current state\n *\n * \n *\n * - **`templateUrl`** - {string|function=} - path or function that returns a path to an html\n * template that should be used by uiView.\n *\n * If `templateUrl` is a function, it will be called with the following parameters:\n *\n * - {array.<object>} - state parameters extracted from the current $location.path() by\n * applying the current state\n *\n * \n *\n * - **`templateProvider`** - {function=} - Provider function that returns HTML content\n * string.\n *\n * \n *\n * - **`controller`** - {string|function=} - Controller fn that should be associated with newly\n * related scope or the name of a registered controller if passed as a string.\n *\n * \n *\n * - **`controllerProvider`** - {function=} - Injectable provider function that returns\n * the actual controller or string.\n *\n * \n *\n * - **`controllerAs`** – {string=} – A controller alias name. If present the controller will be\n * published to scope under the controllerAs name.\n *\n * \n *\n * - **`resolve`** - {object.<string, function>=} - An optional map of dependencies which\n * should be injected into the controller. If any of these dependencies are promises,\n * the router will wait for them all to be resolved or one to be rejected before the\n * controller is instantiated. If all the promises are resolved successfully, the values\n * of the resolved promises are injected and $stateChangeSuccess event is fired. If any\n * of the promises are rejected the $stateChangeError event is fired. The map object is:\n *\n * - key - {string}: name of dependency to be injected into controller\n * - factory - {string|function}: If string then it is alias for service. Otherwise if function,\n * it is injected and return value it treated as dependency. If result is a promise, it is\n * resolved before its value is injected into controller.\n *\n * \n *\n * - **`url`** - {string=} - A url with optional parameters. When a state is navigated or\n * transitioned to, the `$stateParams` service will be populated with any\n * parameters that were passed.\n *\n * \n *\n * - **`params`** - {object=} - An array of parameter names or regular expressions. Only\n * use this within a state if you are not using url. Otherwise you can specify your\n * parameters within the url. When a state is navigated or transitioned to, the\n * $stateParams service will be populated with any parameters that were passed.\n *\n * \n *\n * - **`views`** - {object=} - Use the views property to set up multiple views or to target views\n * manually/explicitly.\n *\n * \n *\n * - **`abstract`** - {boolean=} - An abstract state will never be directly activated,\n * but can provide inherited properties to its common children states.\n *\n * \n *\n * - **`onEnter`** - {object=} - Callback function for when a state is entered. Good way\n * to trigger an action or dispatch an event, such as opening a dialog.\n * If minifying your scripts, make sure to use the `['injection1', 'injection2', function(injection1, injection2){}]` syntax.\n *\n * \n *\n * - **`onExit`** - {object=} - Callback function for when a state is exited. Good way to\n * trigger an action or dispatch an event, such as opening a dialog.\n * If minifying your scripts, make sure to use the `['injection1', 'injection2', function(injection1, injection2){}]` syntax.\n *\n * \n *\n * - **`reloadOnSearch = true`** - {boolean=} - If `false`, will not retrigger the same state\n * just because a search/query parameter has changed (via $location.search() or $location.hash()).\n * Useful for when you'd like to modify $location.search() without triggering a reload.\n *\n * \n *\n * - **`data`** - {object=} - Arbitrary data object, useful for custom configuration.\n *\n * #### Example:\n * Some state name examples\n * ```js\n * // stateName can be a single top-level name (must be unique).\n * $stateProvider.state(\"home\", {});\n *\n * // Or it can be a nested state name. This state is a child of the\n * // above \"home\" state.\n * $stateProvider.state(\"home.newest\", {});\n *\n * // Nest states as deeply as needed.\n * $stateProvider.state(\"home.newest.abc.xyz.inception\", {});\n *\n * // state() returns $stateProvider, so you can chain state declarations.\n * $stateProvider\n * .state(\"home\", {})\n * .state(\"about\", {})\n * .state(\"contacts\", {});\n * ```\n *\n * @param {string} name A unique state name, e.g. \"home\", \"about\", \"contacts\".\n * To create a parent/child state use a dot, e.g. \"about.sales\", \"home.newest\".\n * @param {object} definition State configuration object.\n */\n state(name: string, definition: Ng1StateDeclaration): StateProvider;\n state(definition: Ng1StateDeclaration): StateProvider;\n state(name: any, definition?: any) {\n if (isObject(name)) {\n definition = name;\n } else {\n definition.name = name;\n }\n this.stateRegistry.register(definition);\n return this;\n }\n\n /**\n * Registers an invalid state handler\n *\n * This is a passthrough to [[StateService.onInvalid]] for ng1.\n */\n\n onInvalid(callback: OnInvalidCallback): Function {\n return this.stateService.onInvalid(callback);\n }\n}\n", + "/** @module ng1 */ /** */\nimport {\n StateObject, TransitionStateHookFn, HookResult, Transition, services, ResolveContext, extend, BuilderFunction,\n} from '@uirouter/core';\nimport { getLocals } from '../services';\nimport { Ng1StateDeclaration } from '../interface';\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`,\n * `onRetain` callback hooks on a [[Ng1StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * ensures that those hooks are injectable for @uirouter/angularjs (ng1).\n */\nexport const getStateHookBuilder = (hookName: 'onEnter'|'onExit'|'onRetain') =>\nfunction stateHookBuilder(stateObject: StateObject, parentFn: BuilderFunction): TransitionStateHookFn {\n const hook = stateObject[hookName];\n const pathname = hookName === 'onExit' ? 'from' : 'to';\n\n function decoratedNg1Hook(trans: Transition, state: Ng1StateDeclaration): HookResult {\n const resolveContext = new ResolveContext(trans.treeChanges(pathname));\n const subContext = resolveContext.subContext(state.$$state());\n const locals = extend(getLocals(subContext), { $state$: state, $transition$: trans });\n return services.$injector.invoke(hook, this, locals);\n }\n\n return hook ? decoratedNg1Hook : undefined;\n};\n", + "/**\n * @internalapi\n * @module ng1\n */ /** */\nimport { LocationConfig, LocationServices, UIRouter, ParamType, isDefined } from '@uirouter/core';\nimport { val, createProxyFunctions, removeFrom, isObject } from '@uirouter/core';\nimport { ILocationService, ILocationProvider } from 'angular';\n\n/**\n * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service\n */\nexport class Ng1LocationServices implements LocationConfig, LocationServices {\n private $locationProvider: ILocationProvider;\n private $location: ILocationService;\n private $sniffer;\n\n path;\n search;\n hash;\n hashPrefix;\n port;\n protocol;\n host;\n baseHref;\n\n // .onChange() registry\n private _urlListeners: Function[] = [];\n\n /**\n * Applys ng1-specific path parameter encoding\n *\n * The Angular 1 `$location` service is a bit weird.\n * It doesn't allow slashes to be encoded/decoded bi-directionally.\n *\n * See the writeup at https://github.com/angular-ui/ui-router/issues/2598\n *\n * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F\n *\n * @param router\n */\n static monkeyPatchPathParameterType(router: UIRouter) {\n const pathType: ParamType = router.urlMatcherFactory.type('path');\n\n pathType.encode = (x: any) =>\n x != null ? x.toString().replace(/(~|\\/)/g, m => ({ '~': '~~', '/': '~2F' }[m])) : x;\n\n pathType.decode = (x: string) =>\n x != null ? x.toString().replace(/(~~|~2F)/g, m => ({ '~~': '~', '~2F': '/' }[m])) : x;\n\n }\n\n dispose() { }\n\n constructor($locationProvider: ILocationProvider) {\n this.$locationProvider = $locationProvider;\n const _lp = val($locationProvider);\n createProxyFunctions(_lp, this, _lp, ['hashPrefix']);\n }\n\n onChange(callback: Function) {\n this._urlListeners.push(callback);\n return () => removeFrom(this._urlListeners)(callback);\n }\n\n html5Mode() {\n let html5Mode: any = this.$locationProvider.html5Mode();\n html5Mode = isObject(html5Mode) ? html5Mode.enabled : html5Mode;\n return html5Mode && this.$sniffer.history;\n }\n\n url(newUrl?: string, replace = false, state?) {\n if (isDefined(newUrl)) this.$location.url(newUrl);\n if (replace) this.$location.replace();\n if (state) this.$location.state(state);\n return this.$location.url();\n }\n\n _runtimeServices($rootScope, $location: ILocationService, $sniffer, $browser) {\n this.$location = $location;\n this.$sniffer = $sniffer;\n\n // Bind $locationChangeSuccess to the listeners registered in LocationService.onChange\n $rootScope.$on('$locationChangeSuccess', evt => this._urlListeners.forEach(fn => fn(evt)));\n const _loc = val($location);\n const _browser = val($browser);\n\n // Bind these LocationService functions to $location\n createProxyFunctions(_loc, this, _loc, ['replace', 'path', 'search', 'hash']);\n // Bind these LocationConfig functions to $location\n createProxyFunctions(_loc, this, _loc, ['port', 'protocol', 'host']);\n // Bind these LocationConfig functions to $browser\n createProxyFunctions(_browser, this, _browser, ['baseHref']);\n }\n}\n", + "/** @module url */ /** */\nimport {\n UIRouter, UrlRouter, LocationServices, $InjectorLike, BaseUrlRule, UrlRuleHandlerFn, UrlMatcher,\n IInjectable,\n} from '@uirouter/core';\nimport { services, isString, isFunction, isArray, identity } from '@uirouter/core';\n\nexport interface RawNg1RuleFunction {\n ($injector: $InjectorLike, $location: LocationServices): string|void;\n}\n\n/**\n * Manages rules for client-side URL\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class manages the router rules for what to do when the URL changes.\n *\n * This provider remains for backwards compatibility.\n *\n * @deprecated\n */\nexport class UrlRouterProvider {\n /** @hidden */ _router: UIRouter;\n /** @hidden */ _urlRouter: UrlRouter;\n\n static injectableHandler(router: UIRouter, handler): UrlRuleHandlerFn {\n return match =>\n services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params });\n }\n\n /** @hidden */\n constructor(router: UIRouter) {\n this._router = router;\n this._urlRouter = router.urlRouter;\n }\n\n /** @hidden */\n $get() {\n const urlRouter = this._urlRouter;\n urlRouter.update(true);\n if (!urlRouter.interceptDeferred) urlRouter.listen();\n return urlRouter;\n }\n\n /**\n * Registers a url handler function.\n *\n * Registers a low level url handler (a `rule`).\n * A rule detects specific URL patterns and returns a redirect, or performs some action.\n *\n * If a rule returns a string, the URL is replaced with the string, and all rules are fired again.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // Here's an example of how you might allow case insensitive urls\n * $urlRouterProvider.rule(function ($injector, $location) {\n * var path = $location.path(),\n * normalized = path.toLowerCase();\n *\n * if (path !== normalized) {\n * return normalized;\n * }\n * });\n * });\n * ```\n *\n * @param ruleFn\n * Handler function that takes `$injector` and `$location` services as arguments.\n * You can use them to detect a url and return a different url as a string.\n *\n * @return [[UrlRouterProvider]] (`this`)\n */\n rule(ruleFn: RawNg1RuleFunction): UrlRouterProvider {\n if (!isFunction(ruleFn)) throw new Error(\"'rule' must be a function\");\n\n const match = () =>\n ruleFn(services.$injector, this._router.locationService);\n\n const rule = new BaseUrlRule(match, identity);\n this._urlRouter.rule(rule);\n return this;\n }\n\n /**\n * Defines the path or behavior to use when no url can be matched.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // if the path doesn't match any of the urls you configured\n * // otherwise will take care of routing the user to the\n * // specified url\n * $urlRouterProvider.otherwise('/index');\n *\n * // Example of using function rule as param\n * $urlRouterProvider.otherwise(function ($injector, $location) {\n * return '/a/valid/url';\n * });\n * });\n * ```\n *\n * @param rule\n * The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`.\n * The function version is passed two params: `$injector` and `$location` services, and should return a url string.\n *\n * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n */\n otherwise(rule: string | RawNg1RuleFunction): UrlRouterProvider {\n const urlRouter = this._urlRouter;\n\n if (isString(rule)) {\n urlRouter.otherwise(rule);\n } else if (isFunction(rule)) {\n urlRouter.otherwise(() => rule(services.$injector, this._router.locationService));\n } else {\n throw new Error(\"'rule' must be a string or function\");\n }\n\n return this;\n }\n\n /**\n * Registers a handler for a given url matching.\n *\n * If the handler is a string, it is\n * treated as a redirect, and is interpolated according to the syntax of match\n * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).\n *\n * If the handler is a function, it is injectable.\n * It gets invoked if `$location` matches.\n * You have the option of inject the match object as `$match`.\n *\n * The handler can return\n *\n * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n * will continue trying to find another one that matches.\n * - **string** which is treated as a redirect and passed to `$location.url()`\n * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n * if ($state.$current.navigable !== state ||\n * !equalForKeys($match, $stateParams) {\n * $state.transitionTo(state, $match, false);\n * }\n * });\n * });\n * ```\n *\n * @param what A pattern string to match, compiled as a [[UrlMatcher]].\n * @param handler The path (or function that returns a path) that you want to redirect your user to.\n * @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]]\n *\n * Note: the handler may also invoke arbitrary code, such as `$state.go()`\n */\n when(what: (RegExp|UrlMatcher|string), handler: string|IInjectable) {\n if (isArray(handler) || isFunction(handler)) {\n handler = UrlRouterProvider.injectableHandler(this._router, handler);\n }\n\n this._urlRouter.when(what, handler as any);\n return this;\n }\n\n /**\n * Disables monitoring of the URL.\n *\n * Call this method before UI-Router has bootstrapped.\n * It will stop UI-Router from performing the initial url sync.\n *\n * This can be useful to perform some asynchronous initialization before the router starts.\n * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // Prevent $urlRouter from automatically intercepting URL changes;\n * $urlRouterProvider.deferIntercept();\n * })\n *\n * app.run(function (MyService, $urlRouter, $http) {\n * $http.get(\"/stuff\").then(function(resp) {\n * MyService.doStuff(resp.data);\n * $urlRouter.listen();\n * $urlRouter.sync();\n * });\n * });\n * ```\n *\n * @param defer Indicates whether to defer location change interception.\n * Passing no parameter is equivalent to `true`.\n */\n deferIntercept(defer?: boolean) {\n this._urlRouter.deferIntercept(defer);\n }\n}\n", + "/** @module ng1 */ /** */\nimport { ng as angular } from './angular';\nimport { IServiceProviderFactory } from 'angular';\nimport IAnchorScrollService = angular.IAnchorScrollService;\nimport ITimeoutService = angular.ITimeoutService;\n\nexport interface UIViewScrollProvider {\n /**\n * Uses standard anchorScroll behavior\n *\n * Reverts [[$uiViewScroll]] back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)\n * service for scrolling based on the url anchor.\n */\n useAnchorScroll(): void;\n}\n\n\n/** @hidden */\nfunction $ViewScrollProvider() {\n\n let useAnchorScroll = false;\n\n this.useAnchorScroll = function () {\n useAnchorScroll = true;\n };\n\n this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll: IAnchorScrollService, $timeout: ITimeoutService): Function {\n if (useAnchorScroll) {\n return $anchorScroll;\n }\n\n return function ($element: JQuery) {\n return $timeout(function () {\n $element[0].scrollIntoView();\n }, 0, false);\n };\n }];\n}\n\nangular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);\n", + "/**\n * Main entry point for angular 1.x build\n * @module ng1\n */ /** */\n\nexport * from './interface';\nexport * from './services';\nexport * from './statebuilders/views';\nexport * from './stateProvider';\nexport * from './urlRouterProvider';\n\nimport './injectables';\nimport './directives/stateDirectives';\nimport './stateFilters';\nimport './directives/viewDirective';\nimport './viewScroll';\n\nexport default 'ui.router';\n\nimport * as core from '@uirouter/core';\nexport { core };\nexport * from '@uirouter/core';\n\n" ], "names": [ "fn", @@ -217,7 +217,7 @@ "n", "propNames", "objCopy", - "prop_1", + "_prop", "inArray", "key", "collection", @@ -334,10 +334,10 @@ "defaultPolicy", "squash", "arrayMode", - "replace", - "configuredKeys", "from", "to", + "replace", + "configuredKeys", "max", "str", "substr", @@ -372,9 +372,10 @@ "$injector", "services", "strictDi", - "token", + "getToken", "p", "provide", + "token", "literal2Resolvable", "Resolvable", "resolveFn", @@ -395,7 +396,6 @@ "resolvePolicies", "objects2Tuples", "resolvePolicy", - "string", "param", "surroundPattern", "url", @@ -448,6 +448,7 @@ "search", "serviceClass", "configurationClass", + "uiRouter", "service", "locationService", "configuration", @@ -541,9 +542,10 @@ "ctrlKey", "metaKey", "shiftKey", + "transition_1", "go", "preventDefault", - "ignorePreventDefaultCount", + "ignorePreventDefaultCount_1", "cancel", "relative", "stateContext", @@ -634,6 +636,7 @@ "ng_from_import.module", "propEq", "curry", + "_val", "ctor", "constructor", "eq", @@ -707,8 +710,6 @@ "RejectType", "message", "detail", - "d", - "detailString", "_transitionRejection", "rejection", "SUPERSEDED", @@ -719,6 +720,8 @@ "ABORTED", "ERROR", "errored", + "d", + "detailString", "viewConfigString", "viewConfig", "$id", @@ -759,10 +762,10 @@ "uiViewString", "traceUIViewEvent", "VIEWCONFIG", + "uivheader", "mapping", "uiView", - "ui-view fqn", - "state: view name", + "uiv", "sort", "a", "localeCompare", @@ -784,6 +787,13 @@ "RUN", "isActive", "TransitionHook", + "waitFor", + "prev", + "nextHook", + "invokeHook", + "doneCallback", + "remainingHooks", + "chain", "defaultErrorHandler", "_deregistered", "notCurrent", @@ -804,13 +814,6 @@ "_disposed", "_aborted", "isSuperseded", - "waitFor", - "prev", - "nextHook", - "invokeHook", - "doneCallback", - "remainingHooks", - "chain", "logError", "tranSvc", "matchCriteria", @@ -860,6 +863,12 @@ "defaultSquashPolicy", "getReplace", "Param", + "paramValues", + "params_1", + "values1", + "values2", + "changed", + "validates", "replaceSpecialValues", "_defaultValueCache", "defaultValue", @@ -868,12 +877,6 @@ "$normalize", "encoded", "encode", - "paramValues", - "params_1", - "values1", - "values2", - "changed", - "validates", "stateOrNode", "PathNode", "res", @@ -911,7 +914,6 @@ "nonDynamicParams", "nodesMatch", "retained", - "retainedWithToParams", "retainedNode", "cloned", "pathA", @@ -1057,6 +1059,7 @@ "valToString", "defaultTypeBase", "String", + "string", "query", "int", "bool", @@ -1150,6 +1153,7 @@ "_root", "stateDefinition", "getChildren", + "_children", "deregistered", "$ur", "rules", @@ -1163,47 +1167,30 @@ "splitOnDelim", "strict", "caseInsensitive", - "m", + "matchArray", "segment", "placeholder", "searchPlaceholder", - "last", "patterns", + "last", "checkParamErrors", "UrlMatcher", "nameValidator", "matchDetails", + "m", "index", "makeRegexpType", "_segments", "lastIndex", "fromSearch", "_compiled", + "_pattern", "quoteRegExp", - "_children", - "_cache", - "allParams", - "pathParams", - "searchParams", - "nPathSegments", - "urlm", - "reverseString", - "decodePathArray", - "findParam", - "validParamVal", - "isValid", - "isDefaultValue", - "urlMatchers", - "pathSegmentsAndParams", - "getDetails", - "queryParams", - "pathString", - "encodeDashes", "encodeURIComponent", - "queryString", - "paramDetails", "c", "charCodeAt", + "_cache", + "pathSegmentsAndParams", "joinNeighborsR", "weights", "weightsA", @@ -1212,6 +1199,26 @@ "len", "padArrays", "cmp", + "_pairs", + "allParams", + "pathParams", + "searchParams", + "nPathSegments", + "urlm", + "paramVal", + "reverseString", + "decodePathArray", + "findParam", + "validParamVal", + "isValid", + "isDefaultValue", + "urlMatchers", + "getDetails", + "queryParams", + "pathString", + "encodeDashes", + "queryString", + "paramDetails", "_isStrictMode", "_isCaseInsensitive", "UrlMatcherFactory", @@ -1275,6 +1282,7 @@ "hashPrefix", "appendBasePath", "slash", + "cfgPort", "port", "protocol", "host", @@ -1291,6 +1299,10 @@ "_viewConfigs", "_onSync", "_listeners", + "rawViewName", + "viewAtContext", + "relativeViewNameSugar", + "anchor", "_rootContext", "viewType", "factory", @@ -1300,7 +1312,6 @@ "traceViewServiceEvent", "count", "uiViewsByFqn", - "uiv", "depthCompare", "depthFn", "posNeg", @@ -1310,15 +1321,11 @@ "viewConfigDepth", "matchedViewConfigs", "unmatchedConfigTuples", - "allTuples", "configUpdated", + "allTuples", "traceViewSync", "traceViewServiceUIViewEvent", "uiViews", - "rawViewName", - "viewAtContext", - "relativeViewNameSugar", - "anchor", "vc", "vcSegments", "uivSegments", @@ -1556,24 +1563,25 @@ "bindToController", "bindingsObj", "onInvalid", + "stateObject", "$state$", "_lp", - "_urlListeners", - "newUrl", - "_loc", - "_browser", "pathType", "~", "/", "~~", "~2F", + "_urlListeners", + "newUrl", + "_loc", + "_browser", "_urlRouter", "UrlRouterProvider", + "$match", + "$stateParams", "ruleFn", "otherwise", "injectableHandler", - "$match", - "$stateParams", "deferIntercept", "module", "mod_init", @@ -1581,15 +1589,15 @@ "mod_rtr", "mod_state", "mod_main", + "$uiRouterProvider", "getProviderFor", "serviceName", "$urp", "runBlock", "watchDigests", - "uiRouter", "urlRouterProvider", "$urlMatcherFactory", - "uiSref", + "uiSrefDirective", "ctx", "require", "uiSrefActive", @@ -1601,16 +1609,19 @@ "rawDef", "processedDef", "parseStateRef", + "uiSref", "uiSrefOpts", "$eval", "onStatesChanged", "clickHook", "bindEvents", + "uiStateDirective", "inputAttrs", "watchDeregFns", "field", "$observe", "expr", + "uiSrefActiveDirective", "$interpolate", "$attrs", "stateParams", @@ -1682,5 +1693,5 @@ "$anchorScroll", "scrollIntoView" ], - "mappings": ";;;;;;;;;;kPAoDA,WAAsBA,GAIpB,WAAiBC,GACf,OAAIA,EAAKC,QAAUC,EACVH,EAAGI,MAAM,KAAMH,GACjB,WACL,OAAOI,EAAQJ,EAAKK,UAAUC,MAAMH,MAAMI,cAP9C,IAAIC,KAAk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