UNPKG

angular-ui-router

Version:

State-based routing for AngularJS 1.x

12 lines 111 kB
/** * State-based routing for AngularJS 1.x * NOTICE: This monolithic bundle also bundles the @uirouter/core code. * 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 http://ui-router.github.io/blog/angular-ui-router-umd-bundles * @version v1.0.5 * @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["@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<arguments.length;e++)t[e]=arguments[e];return n.apply(null,[].slice.call(arguments).reverse())}function o(t,e){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.apply(null,r)&&e.apply(null,r)}}function a(t,e){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.apply(null,r)||e.apply(null,r)}}function u(t,e){return function(r){return r[t].apply(r,e)}}function s(t){return function(e){for(var r=0;r<t.length;r++)if(t[r][0](e))return t[r][1](e)}}function c(t){if(re(t)&&t.length){var e=t.slice(0,-1),r=t.slice(-1);return!(e.filter(Dt(te)).length||r.filter(Dt(Zt)).length)}return Zt(t)}function f(t){return t}function l(){}function p(t,e,r,n,i){void 0===i&&(i=!1);var o=function(e){return t()[e].bind(r())},a=function(t){return function(){return e[t]=o(t),e[t].apply(null,arguments)}};return n=n||Object.keys(t()),n.reduce(function(t,e){return t[e]=i?a(e):o(e),t},e)}function h(t,e){return-1!==t.indexOf(e)}function d(t,e){var r=t.indexOf(e);return r>=0&&t.splice(r,1),t}function v(t,e){return t.push(e),e}function m(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=e.concat({}).reverse(),i=ve.apply(null,n);return ve({},i,g(t||{},Object.keys(i)))}function y(t,e){var r=[];for(var n in t.path){if(t.path[n]!==e.path[n])break;r.push(t.path[n])}return r}function g(t,e){var r={};for(var n in t)-1!==e.indexOf(n)&&(r[n]=t[n]);return r}function w(t,e){return Object.keys(t).filter(Dt(ge(e))).reduce(function(e,r){return e[r]=t[r],e},{})}function _(t,e){return b(t,At(e))}function $(t,e){var r=re(t),n=r?[]:{},i=r?function(t){return n.push(t)}:function(t,e){return n[e]=t};return de(t,function(t,r){e(t,r)&&i(t,r)}),n}function S(t,e){var r;return de(t,function(t,n){r||e(t,n)&&(r=t)}),r}function b(t,e){var r=re(t)?[]:{};return de(t,function(t,n){return r[n]=e(t,n)}),r}function R(t,e){return t.push(e),t}function E(t,e){return void 0===e&&(e="assert failure"),function(r){var n=t(r);if(!n)throw new Error(Zt(e)?e(r):e);return n}}function C(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)return[];var r,n=t.reduce(function(t,e){return Math.min(e.length,t)},9007199254740991),i=[];for(r=0;r<n;r++)switch(t.length){case 1:i.push([t[0][r]]);break;case 2:i.push([t[0][r],t[1][r]]);break;case 3:i.push([t[0][r],t[1][r],t[2][r]]);break;case 4:i.push([t[0][r],t[1][r],t[2][r],t[3][r]]);break;default:i.push(t.map(function(t){return t[r]}))}return i}function T(t,e){var r,n;if(re(e)&&(r=e[0],n=e[1]),!te(r))throw new Error("invalid parameters to applyPairs");return t[r]=n,t}function P(t){return t.length&&t[t.length-1]||void 0}function k(t,e){return e&&Object.keys(e).forEach(function(t){return delete e[t]}),e||(e={}),ve(e,t)}function O(t,e,r){if(re(t))return t.forEach(e,r);Object.keys(t).forEach(function(r){return e(t[r],r)})}function x(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];if(r)for(var n=Object.keys(r),i=0;i<n.length;i++)t[n[i]]=r[n[i]]}return t}function j(t,e){if(t===e)return!0;if(null===t||null===e)return!1;if(t!==t&&e!==e)return!0;var r=typeof t;if(r!==typeof e||"object"!==r)return!1;var n=[t,e];if(Nt(re)(n))return I(t,e);if(Nt(ne)(n))return t.getTime()===e.getTime();if(Nt(ie)(n))return t.toString()===e.toString();if(Nt(Zt)(n))return!0;if([Zt,re,ne,ie].map(Ft).reduce(function(t,e){return t||!!e(n)},!1))return!1;var i,o={};for(i in t){if(!j(t[i],e[i]))return!1;o[i]=!0}for(i in e)if(!o[i])return!1;return!0}function I(t,e){return t.length===e.length&&C(t,e).reduce(function(t,e){return t&&j(e[0],e[1])},!0)}function V(t){if(!t)return"ui-view (defunct)";var e=t.creationContext?t.creationContext.name||"(root)":"(none)";return"[ui-view#"+t.id+" "+t.$type+":"+t.fqn+" ("+t.name+"@"+e+")]"}function A(e){return Xt(e)?t.Category[e]:t.Category[t.Category[e]]}function H(t,e){function r(t){for(var e=n,r=0;r<e.length;r++){var i=new Bt(e[r]);if(i&&i.matches(t.name)||!i&&e[r]===t.name)return!0}return!1}var n=te(e)?[e]:e;return!!(Zt(n)?n:r)(t)}function q(t,e,r){function n(t,n,i){void 0===i&&(i={});var a=new Ye(e,r,n,t,i);return o.push(a),function(){a._deregistered=!0,we(o)(a)}}var i=t._registeredHooks=t._registeredHooks||{},o=i[r.name]=[];return t[r.name]=n,n}function D(t){return void 0===t&&(t=!1),function(e,r){var n=t?-1:1,i=(e.node.state.path.length-r.node.state.path.length)*n;return 0!==i?i:r.hook.priority-e.hook.priority}}function N(t,e){function r(t){return re(t)?t:Qt(t)?[t]:[]}function n(t){switch(t.length){case 0:return;case 1:return"auto"===e?t[0]:t;default:return t}}function i(t,e){return function(i){if(re(i)&&0===i.length)return i;var o=r(i),a=b(o,t);return!0===e?0===$(a,function(t){return!t}).length:n(a)}}function o(t){return function(e,n){var i=r(e),o=r(n);if(i.length!==o.length)return!1;for(var a=0;a<i.length;a++)if(!t(i[a],o[a]))return!1;return!0}}var a=this;["encode","decode","equals","$normalize"].forEach(function(e){var r=t[e].bind(t),n="equals"===e?o:i;a[e]=n(r)}),ve(this,{dynamic:t.dynamic,name:t.name,pattern:t.pattern,inherit:t.inherit,is:i(t.is.bind(t),!0),$arrayMode:e})}function F(t){function e(){return t.value}return t=er(t)&&{value:t}||t,e.__cacheable=!0,ve(t,{$$fn:c(t.value)?t.value:e})}function U(e,r,n,i,o){if(e.type&&r&&"string"!==r.name)throw new Error("Param '"+i+"' has two type configurations.");if(e.type&&r&&"string"===r.name&&o.type(e.type))return o.type(e.type);if(r)return r;if(!e.type){var a=n===t.DefType.CONFIG?"any":n===t.DefType.PATH?"path":n===t.DefType.SEARCH?"query":"string";return o.type(a)}return e.type instanceof Xe?e.type:o.type(e.type)}function L(t,e,r){var n=t.squash;if(!e||!1===n)return!1;if(!Qt(n)||null==n)return r;if(!0===n||te(n))return n;throw new Error("Invalid squash policy: '"+n+"'. Valid policies: false, true, or arbitrary string")}function M(t,e,r,n){var i,o,a=[{from:"",to:r||e?void 0:""},{from:null,to:r||e?void 0:""}];return i=re(t.replace)?t.replace:[],te(n)&&i.push({from:n,to:void 0}),o=b(i,At("from")),$(a,function(t){return-1===o.indexOf(t.from)}).concat(i)}function B(t,e){return e.length<=t?e:e.substr(0,t-3)+"..."}function G(t,e){for(;e.length<t;)e+=" ";return e}function W(t){return t.replace(/^([A-Z])/,function(t){return t.toLowerCase()}).replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}function z(t){var e=J(t),r=e.match(/^(function [^ ]+\([^)]*\))/),n=r?r[1]:e,i=t.name||"";return i&&n.match(/function \(/)?"function "+i+n.substr(9):n}function J(t){var e=re(t)?t.slice(-1)[0]:t;return e&&e.toString()||"undefined"}function Q(t){function e(t){if(ee(t)){if(-1!==r.indexOf(t))return"[circular ref]";r.push(t)}return yr(t)}var r=[];return JSON.stringify(t,function(t,r){return e(r)}).replace(/\\"/g,'"')}function K(t){var e=new RegExp("("+t+")","g");return function(t){return t.split(e).filter(f)}}function Y(t,e){return te(P(t))&&te(e)?t.slice(0,-1).concat(P(t)+e):R(t,e)}function Z(t){return t.name}function X(t){return t.self.$$state=function(){return t},t.self}function tt(t){return t.parent&&t.parent.data&&(t.data=t.self.data=ye(t.parent.data,t.data)),t.data}function et(t){return t.parent?t.parent.path.concat(t):[t]}function rt(t){var e=t.parent?ve({},t.parent.includes):{};return e[t.name]=!0,e}function nt(t){var e=function(t){var e=se.$injector;return t.$inject||e&&e.annotate(t,e.strictDi)||"deferred"},r=function(t){return!(!t.token||!t.resolveFn)},n=function(t){return!(!t.provide&&!t.token||!(t.useValue||t.useFactory||t.useExisting||t.useClass))},o=function(t){return!!(t&&t.val&&(te(t.val)||re(t.val)||Zt(t.val)))},a=function(t){return t.provide||t.token},u=s([[At("resolveFn"),function(t){return new ar(a(t),t.resolveFn,t.deps,t.policy)}],[At("useFactory"),function(t){return new ar(a(t),t.useFactory,t.deps||t.dependencies,t.policy)}],[At("useClass"),function(t){return new ar(a(t),function(){return new t.useClass},[],t.policy)}],[At("useValue"),function(t){return new ar(a(t),function(){return t.useValue},[],t.policy,t.useValue)}],[At("useExisting"),function(t){return new ar(a(t),f,[t.useExisting],t.policy)}]]),c=s([[i(At("val"),te),function(t){return new ar(t.token,f,[t.val],t.policy)}],[i(At("val"),re),function(t){return new ar(t.token,P(t.val),t.val.slice(0,-1),t.policy)}],[i(At("val"),Zt),function(t){return new ar(t.token,t.val,e(t.val),t.policy)}]]),l=s([[Ut(ar),function(t){return t}],[r,u],[n,u],[o,c],[Mt(!0),function(t){throw new Error("Invalid resolve value: "+Q(t))}]]),p=t.resolve;return(re(p)?p:function(t,e){return Object.keys(t||{}).map(function(r){return{token:r,val:t[r],deps:void 0,policy:e[r]}})}(p,t.resolvePolicy||{})).map(l)}function it(t,e){var r=["",""],n=t.replace(/[\\\[\]\^$*+?.()|{}]/g,"\\$&");if(!e)return n;switch(e.squash){case!1:r=["(",")"+(e.isOptional?"?":"")];break;case!0:n=n.replace(/\/$/,""),r=["(?:/(",")|/)?"];break;default:r=["("+e.squash+"|",")?"]}return n+r[0]+e.type.pattern.source+r[1]}function ot(t,e,r,n){return"/"===n?t:e?n.slice(0,-1)+t:r?n.slice(1)+t:t}function at(t){if(!(Zt(t)||te(t)||Ut(Je)(t)||Je.isDef(t)))throw new Error("'handler' must be a string, function, TargetState, or have a state: 'newtarget' property");return Zt(t)?t:Mt(t)}function ut(t){t.addResolvable({token:Jr,deps:[],resolveFn:function(){return t.router},data:t.router},""),t.addResolvable({token:vr,deps:[],resolveFn:function(){return t},data:t},""),t.addResolvable({token:"$transition$",deps:[],resolveFn:function(){return t},data:t},""),t.addResolvable({token:"$stateParams",deps:[],resolveFn:function(){return t.params()},data:t.params()},""),t.entering().forEach(function(e){t.addResolvable({token:"$state$",deps:[],resolveFn:function(){return e},data:e},e)})}function st(t){return function(e,r){return(0,r.$$state()[t])(e,r)}}function ct(t,e){function r(e){return e&&Array.isArray(e.states)&&e.states.forEach(function(e){return t.router.stateRegistry.register(e)}),e}var n=e.$$state().lazyLoad,i=n._promise;if(!i){var o=function(t){return delete e.lazyLoad,delete e.$$state().lazyLoad,delete n._promise,t},a=function(t){return delete n._promise,se.$q.reject(t)};i=n._promise=se.$q.when(n(t,e)).then(r).then(o,a)}return i}function ft(t){var e=t._ignoredReason();if(e){ze.traceTransitionIgnored(t);var r=t.router.globals.transition;return"SameAsCurrent"===e&&r&&r.abort(),Ue.ignored().toPromise()}}function lt(t){if(!t.valid())throw new Error(t.error())}function pt(t){var e=function(t){return t||""},r=xn(t).map(e),n=r[0],i=r[1],o=jn(n).map(e);return{path:o[0],search:o[1],hash:i,url:t}}function ht(t,e,r,n){return function(i){function o(t){t.dispose(a),t.dispose(u)}var a=i.locationService=new r(i),u=i.locationConfig=new n(i,e);return{name:t,service:a,configuration:u,dispose:o}}}function dt(t){return se.$injector=kn,se.$q=En,{name:"vanilla.services",$q:En,$injector:kn,dispose:function(){return null}}}function vt(){var t=null;return function(e,r){return t=t||se.$injector.get("$templateFactory"),[new ti(e,r,t)]}}function mt(t){if(!t.parent)return{};var e=["templateProvider","templateUrl","template","notify","async"],r=["controller","controllerProvider","controllerAs","resolveAs"],n=["component","bindings","componentProvider"],i=e.concat(r),o=n.concat(i);if(Qt(t.views)&&Zn(o,t))throw new Error("State '"+t.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): "+o.filter(function(e){return Qt(t[e])}).join(", "));var a={},u=t.views||{$default:g(t,o)};return de(u,function(e,r){if(r=r||"$default",te(e)&&(e={component:e}),e=ve({},e),Zn(n,e)&&Zn(i,e))throw new Error("Cannot combine: "+n.join("|")+" with: "+i.join("|")+" in stateview: '"+r+"@"+t.name+"'");e.resolveAs=e.resolveAs||"$resolve",e.$type="ng1",e.$context=t,e.$name=r;var o=Dr.normalizeUIViewTarget(e.$context,e.$name);e.$uiViewName=o.uiViewName,e.$uiViewContextAnchor=o.uiViewContextAnchor,a[r]=e}),a}function yt(t){var e=se.$injector.get(t+"Directive");if(!e||!e.length)throw new Error("Unable to find component named '"+t+"'");return e.map(ri).reduce(Te,[])}function gt(t){function e(t,e,n,i,o,a){return r._runtimeServices(i,t,n,e),delete hi.router,delete hi.$get,hi}hi=this.router=new Jr,hi.stateProvider=new ii(hi.stateRegistry,hi.stateService),hi.stateRegistry.decorator("views",mt),hi.stateRegistry.decorator("onExit",oi("onExit")),hi.stateRegistry.decorator("onRetain",oi("onRetain")),hi.stateRegistry.decorator("onEnter",oi("onEnter")),hi.viewService._pluginapi._viewConfigFactory("ng1",vt());var r=hi.locationService=hi.locationConfig=new ai(t);return ai.monkeyPatchPathParameterType(hi),hi.router=hi,hi.$get=e,e.$inject=["$location","$browser","$sniffer","$rootScope","$http","$templateCache"],hi}function wt(t,e,r){se.$injector=t,se.$q=e,r.stateRegistry.get().map(function(t){return t.$$state().resolvables}).reduce(Te,[]).filter(function(t){return"deferred"===t.deps}).forEach(function(e){return e.deps=t.annotate(e.resolveFn,t.strictDi)})}function _t(t){t.$watch(function(){ze.approximateDigests++})}function $t(t){var e,r=t.match(/^\s*({[^}]*})\s*$/);if(r&&(t="("+r[1]+")"),!(e=t.replace(/\n/g," ").match(/^\s*([^(]*?)\s*(\((.*)\))?\s*$/))||4!==e.length)throw new Error("Invalid state ref '"+t+"'");return{state:e[1]||null,paramExpr:e[3]||null}}function St(t){var e=t.parent().inheritedData("$uiView"),r=qt("$cfg.path")(e);return r?P(r).state.name:void 0}function bt(t,e,r){var n=r.uiState||t.current.name,i=ve(Ct(e,t),r.uiStateOpts||{}),o=t.href(n,r.uiStateParams,i);return{uiState:n,uiStateParams:r.uiStateParams,uiStateOpts:i,href:o}}function Rt(t){var e="[object SVGAnimatedString]"===Object.prototype.toString.call(t.prop("href")),r="FORM"===t[0].nodeName;return{attr:r?"action":e?"xlink:href":"href",isAnchor:"A"===t.prop("tagName").toUpperCase(),clickable:!r}}function Et(t,e,r,n,i){return function(o){var a=o.which||o.button,u=i();if(!(a>1||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 Ct(t,e){return{relative:St(t)||e.$current,inherit:!0,source:"sref"}}function Tt(t,e,r,n){var i;n&&(i=n.events),re(i)||(i=["click"]);for(var o=t.on?"on":"bind",a=0,u=i;a<u.length;a++){var s=u[a];t[o](s,r)}e.$on("$destroy",function(){for(var e=t.off?"off":"unbind",n=0,o=i;n<o.length;n++){var a=o[n];t[e](a,r)}})}function Pt(t){var e=function(e,r,n){return t.is(e,r,n)};return e.$stateful=!0,e}function kt(t){var e=function(e,r,n){return t.includes(e,r,n)};return e.$stateful=!0,e}function Ot(t,r,n,i,o,a){var u=qt("viewDecl.controllerAs"),s=qt("viewDecl.resolveAs");return{restrict:"ECA",priority:-400,compile:function(i){var a=i.html();return i.empty(),function(i,c){var f=c.data("$uiView");if(!f)return c.html(a),void t(c.contents())(i);var l=f.$cfg||{viewDecl:{},getTemplate:e.noop},p=l.path&&new pr(l.path);c.html(l.getTemplate(c,p)||a),ze.traceUIViewFill(f.$uiView,c.html());var h=t(c.contents()),d=l.controller,v=u(l),m=s(l),y=p&&gi(p);if(i[m]=y,d){var g=r(d,ve({},y,{$scope:i,$element:c}));v&&(i[v]=g,i[v][m]=y),c.data("$ngControllerController",g),c.children().data("$ngControllerController",g),xt(o,n,g,i,l)}if(te(l.viewDecl.component))var w=l.viewDecl.component,_=W(w),$=new RegExp("^(x-|data-)?"+_+"$","i"),S=function(){var t=[].slice.call(c[0].children).filter(function(t){return t&&t.tagName&&$.exec(t.tagName)});return t&&Vt.element(t).data("$"+w+"Controller")},b=i.$watch(S,function(t){t&&(xt(o,n,t,i,l),b())});h(i)}}}}function xt(t,e,r,n,i){!Zt(r.$onInit)||i.viewDecl.component&&Si||r.$onInit();var o=P(i.path).state.self,a={bind:r};if(Zt(r.uiOnParamsChanged)){var u=new pr(i.path),s=u.getResolvable("$transition$").data,c=function(t){if(t!==s&&-1===t.exiting().indexOf(o)){var e=t.params("to"),n=t.params("from"),i=t.treeChanges().to.map(function(t){return t.paramSchema}).reduce(Te,[]),a=t.treeChanges().from.map(function(t){return t.paramSchema}).reduce(Te,[]),u=i.filter(function(t){var r=a.indexOf(t);return-1===r||!a[r].type.equals(e[t.id],n[t.id])});if(u.length){var c=u.map(function(t){return t.id}),f=$(e,function(t,e){return-1!==c.indexOf(e)});r.uiOnParamsChanged(f,t)}}};n.$on("$destroy",e.onSuccess({},c,a))}if(Zt(r.uiCanExit)){var f=bi++,l=function(t){return!!t&&(t._uiCanExitIds&&!0===t._uiCanExitIds[f]||l(t.redirectedFrom()))},p=function(e){var n,i=e._uiCanExitIds=e._uiCanExitIds||{};return l(e)||(n=t.when(r.uiCanExit(e)),n.then(function(t){return i[f]=!1!==t})),n},h={exiting:o.name};n.$on("$destroy",e.onBefore(h,p,a))}}function jt(){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)}}]}var It=angular,Vt=e&&e.module?e:It,At=function(t){return function(e){return e&&e[t]}},Ht=r(function(t,e,r){return r&&r[t]===e}),qt=function(t){return i.apply(null,t.split(".").map(At))},Dt=function(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return!t.apply(null,e)}},Nt=function(t){return function(e){return e.reduce(function(e,r){return e&&!!t(r)},!0)}},Ft=function(t){return function(e){return e.reduce(function(e,r){return e||!!t(r)},!1)}},Ut=function(t){return function(e){return null!=e&&e.constructor===t||e instanceof t}},Lt=function(t){return function(e){return t===e}},Mt=function(t){return function(){return t}},Bt=function(){function t(t){this.text=t,this.glob=t.split(".");var e=this.text.split(".").map(function(t){return"**"===t?"(?:|(?:\\.[^.]*)*)":"*"===t?"\\.[^.]*":"\\."+t}).join("");this.regexp=new RegExp("^"+e+"$")}return t.prototype.matches=function(t){return this.regexp.test("."+t)},t.is=function(t){return!!/[!,*]+/.exec(t)},t.fromString=function(e){return t.is(e)?new t(e):null},t}(),Gt=function(){function t(e){return t.create(e||{})}return t.create=function(e){e=t.isStateClass(e)?new e:e;var r=ye(ye(e,t.prototype));return e.$$state=function(){return r},r.self=e,r.__stateObjectCache={nameGlob:Bt.fromString(r.name)},r},t.prototype.is=function(t){return this===t||this.self===t||this.fqn()===t},t.prototype.fqn=function(){if(!(this.parent&&this.parent instanceof this.constructor))return this.name;var t=this.parent.fqn();return t?t+"."+this.name:this.name},t.prototype.root=function(){return this.parent&&this.parent.root()||this},t.prototype.parameters=function(t){return t=m(t,{inherit:!0,matchingKeys:null}),(t.inherit&&this.parent&&this.parent.parameters()||[]).concat(Re(this.params)).filter(function(e){return!t.matchingKeys||t.matchingKeys.hasOwnProperty(e.id)})},t.prototype.parameter=function(t,e){return void 0===e&&(e={}),this.url&&this.url.parameter(t,e)||S(Re(this.params),Ht("id",t))||e.inherit&&this.parent&&this.parent.parameter(t)},t.prototype.toString=function(){return this.fqn()},t.isStateClass=function(t){return Zt(t)&&!0===t.__uiRouterState},t.isState=function(t){return ee(t.__stateObjectCache)},t}(),Wt=Object.prototype.toString,zt=function(t){return function(e){return typeof e===t}},Jt=zt("undefined"),Qt=Dt(Jt),Kt=function(t){return null===t},Yt=a(Kt,Jt),Zt=zt("function"),Xt=zt("number"),te=zt("string"),ee=function(t){return null!==t&&"object"==typeof t},re=Array.isArray,ne=function(t){return"[object Date]"===Wt.call(t)},ie=function(t){return"[object RegExp]"===Wt.call(t)},oe=Gt.isState,ae=o(ee,i(At("then"),Zt)),ue=function(t){return function(){throw new Error(t+"(): No coreservices implementation for UI-Router is loaded.")}},se={$q:void 0,$injector:void 0},ce="undefined"==typeof window?{}:window,fe=ce.angular||{},le=fe.fromJson||JSON.parse.bind(JSON),pe=fe.toJson||JSON.stringify.bind(JSON),he=fe.copy||k,de=fe.forEach||O,ve=Object.assign||x,me=fe.equals||j,ye=function(t,e){return ve(Object.create(t),e)},ge=r(h),we=r(d),_e=r(v),$e=function(t){return t.slice().forEach(function(e){"function"==typeof e&&e(),we(t,e)})},Se=function(t,e){return ve(t,e)},be=b,Re=function(t){return Object.keys(t).map(function(e){return t[e]})},Ee=function(t,e){return t&&e},Ce=function(t,e){return t||e},Te=function(t,e){return t.concat(e)},Pe=function(t,e){return re(e)?t.concat(e.reduce(Pe,[])):R(t,e)},ke=function(t,e){return ge(t,e)?t:R(t,e)},Oe=function(t){return t.reduce(Te,[])},xe=function(t){return t.reduce(Pe,[])},je=E,Ie=E,Ve=function(t){return Object.keys(t).map(function(e){return[e,t[e]]})},Ae=function(t,e){return void 0===e&&(e=Mt(!0)),function(r,n){return e(r)&&e(n)?t(r)-t(n):0}},He=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e,r){return t.reduce(function(t,n){return t||n(e,r)},0)}},qe=function(t){return t.catch(function(t){return 0})&&t},De=function(t){return qe(se.$q.reject(t))},Ne=function(){function t(t,e){void 0===t&&(t=[]),void 0===e&&(e=null),this._items=t,this._limit=e}return t.prototype.enqueue=function(t){var e=this._items;return e.push(t),this._limit&&e.length>this._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 Fe=0,Ue=function(){function e(t,e,r){this.$id=Fe++,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():Q(t)}(this.detail),e=this;return"Transition Rejection($id: "+e.$id+" type: "+e.type+", message: "+e.message+", detail: "+t+")"},e.prototype.toPromise=function(){return ve(De(this),{_transitionRejection:this})},e.isRejectionPromise=function(t){return t&&"function"==typeof t.then&&Ut(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 Ut(e)(t)?t:e.errored(t)},e}(),Le=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+"'"};!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 Me=qt("$id"),Be=qt("router.$id"),Ge=function(t){return"Transition #"+Me(t)+"-"+Be(t)},We=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(A).forEach(function(t){return n._enabled[t]=e})},e.prototype.enable=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._set(!0,t)},e.prototype.disable=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._set(!1,t)},e.prototype.enabled=function(t){return!!this._enabled[A(t)]},e.prototype.traceTransitionStart=function(e){this.enabled(t.Category.TRANSITION)&&console.log(Ge(e)+": Started -> "+Q(e))},e.prototype.traceTransitionIgnored=function(e){this.enabled(t.Category.TRANSITION)&&console.log(Ge(e)+": Ignored <> "+Q(e))},e.prototype.traceHookInvocation=function(e,r,n){if(this.enabled(t.Category.HOOK)){var i=qt("traceData.hookType")(n)||"internal",o=qt("traceData.context.state.name")(n)||qt("traceData.context")(n)||"unknown",a=z(e.registeredHook.callback);console.log(Ge(r)+": Hook -> "+i+" context: "+o+", "+B(200,a))}},e.prototype.traceHookResult=function(e,r,n){this.enabled(t.Category.HOOK)&&console.log(Ge(r)+": <- Hook returned: "+B(200,Q(e)))},e.prototype.traceResolvePath=function(e,r,n){this.enabled(t.Category.RESOLVE)&&console.log(Ge(n)+": Resolving "+e+" ("+r+")")},e.prototype.traceResolvableResolved=function(e,r){this.enabled(t.Category.RESOLVE)&&console.log(Ge(r)+": <- Resolved "+e+" to: "+B(200,Q(e.data)))},e.prototype.traceError=function(e,r){this.enabled(t.Category.TRANSITION)&&console.log(Ge(r)+": <- Rejected "+Q(r)+", reason: "+e)},e.prototype.traceSuccess=function(e,r){this.enabled(t.Category.TRANSITION)&&console.log(Ge(r)+": <- Success "+Q(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: "+G(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: "+B(200,r))},e.prototype.traceViewSync=function(e){if(this.enabled(t.Category.VIEWCONFIG)){var r=e.map(function(t){var e=t[0],r=t[1];return{"ui-view fqn":e.$type+":"+e.fqn,"state: view name":r&&r.viewDecl.$context.name+": "+r.viewDecl.$name+" ("+r.viewDecl.$type+")"}}).sort(function(t,e){return t["ui-view fqn"].localeCompare(e["ui-view fqn"])});console.table(r)}},e.prototype.traceViewServiceEvent=function(e,r){this.enabled(t.Category.VIEWCONFIG)&&console.log("VIEWCONFIG: "+e+" "+Le(r))},e.prototype.traceViewServiceUIViewEvent=function(e,r){this.enabled(t.Category.VIEWCONFIG)&&console.log("VIEWCONFIG: "+e+" "+V(r))},e}(),ze=new We;!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 Je=function(){function t(t,e,r,n){void 0===n&&(n={}),this._identifier=t,this._definition=e,this._options=n,this._params=r||{}}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()+"'"+pe(this.params())},t.isDef=function(t){return t&&t.state&&(te(t.state)||te(t.state.name))},t}(),Qe={current:l,transition:null,traceData:{},bind:null},Ke=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,Qe),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;ze.traceHookInvocation(this,this.transition,n);var i=function(t){return Ue.normalize(t).toPromise()},o=function(r){return e.eventType.getErrorHandler(t)(r)},a=function(r){return e.eventType.getResultHandler(t)(r)};try{var u=function(){return e.callback.call(n.bind,t.transition,t.stateContext)}();return!this.type.synchronous&&ae(u)?u.catch(i).then(a,o):a(u)}catch(t){return o(Ue.normalize(t))}}},e.prototype.handleHookResult=function(t){var e=this,r=this.getNotCurrentRejection();return r||(ae(t)?t.then(function(t){return e.handleHookResult(t)}):(ze.traceHookResult(t,this.transition,this.options),!1===t?Ue.aborted("Hook aborted transition").toPromise():Ut(Je)(t)?Ue.redirected(t).toPromise():void 0))},e.prototype.getNotCurrentRejection=function(){var t=this.transition.router;return t._disposed?Ue.aborted("UIRouter instance #"+t.$id+" has been stopped (disposed)").toPromise():this.transition._aborted?Ue.aborted().toPromise():this.isSuperseded()?Ue.superseded(this.options.current()).toPromise():void 0},e.prototype.toString=function(){var t=this,e=t.options,r=t.registeredHook;return(qt("traceData.hookType")(e)||"internal")+" context: "+(qt("traceData.context.state.name")(e)||qt("traceData.context")(e)||"unknown")+", "+B(200,J(r.callback))},e.chain=function(t,e){var r=function(t,e){return t.then(function(){return e.invokeHook()})};return t.reduce(r,e||se.$q.when())},e.invokeHooks=function(t,r){for(var n=0;n<t.length;n++){var i=t[n].invokeHook();if(ae(i)){var o=t.slice(n+1);return e.chain(o,i).then(r)}}return r()},e.runAllHooks=function(t){t.forEach(function(t){return t.invokeHook()})},e.HANDLE_RESULT=function(t){return function(e){return t.handleHookResult(e)}},e.LOG_REJECTED_RESULT=function(t){return function(e){ae(e)&&e.catch(function(e){return t.logError(Ue.normalize(e))})}},e.LOG_ERROR=function(t){return function(e){return t.logError(e)}},e.REJECT_ERROR=function(t){return function(t){return De(t)}},e.THROW_ERROR=function(t){return function(t){throw t}},e}(),Ye=function(){function e(t,e,r,n,i){void 0===i&&(i={}),this.tranSvc=t,this.eventType=e,this.callback=r,this.matchCriteria=n,this.priority=i.priority||0,this.bind=i.bind||null,this._deregistered=!1}return e.prototype._matchingNodes=function(t,e){if(!0===e)return t;var r=t.filter(function(t){return H(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=ve(this._getDefaultMatchCriteria(),this.matchCriteria);return Re(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 Re(e).every(f)?e:null},e}(),Ze=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(Te,[]).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},a=function(i){return i.matches(n)[e.criteriaMatchPath.name].map(function(n){var a=ve({bind:i.bind,traceData:{hookType:e.name,context:n} },o),u=e.criteriaMatchPath.scope===t.TransitionHookScope.STATE?n.state.self:null,s=new Ke(r,u,i,a);return{hook:i,node:n,transitionHook:s}})};return i.map(a).reduce(Te,[]).sort(D(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(je(re,"broken event named: "+e.name)).reduce(Te,[]).filter(function(t){return t.matches(r)})},e}(),Xe=function(){function t(t){this.pattern=/.*/,this.inherit=!0,ve(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 N(this,t)},t}(),tr=Object.prototype.hasOwnProperty,er=function(t){return 0===["value","type","squash","array","dynamic"].filter(tr.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 rr=function(){function e(e,r,n,i,o){n=F(n),r=U(n,r,i,e,o.paramTypes);var a=function(){var r={array:i===t.DefType.SEARCH&&"auto"},o=e.match(/\[\]$/)?{array:!0}:{};return ve(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=Qt(n.dynamic)?!!n.dynamic:!!r.dynamic,c=Qt(n.raw)?!!n.raw:!!r.raw,f=L(n,u,o.defaultSquashPolicy()),l=M(n,a,u,f),p=Qt(n.inherit)?!!n.inherit:!!r.inherit;ve(this,{id:e,type:r,location:i,isOptional:u,dynamic:s,raw:c,squash:f,replace:l,inherit:p,array:a,config:n})}return e.prototype.isDefaultValue=function(t){return this.isOptional&&this.type.equals(this.value(),t)},e.prototype.value=function(t){var e=this;return t=function(t){for(var r=0,n=e.replace;r<n.length;r++){var i=n[r];if(i.from===t)return i.to}return t}(t),Jt(t)?function(){if(e._defaultValueCache)return e._defaultValueCache.defaultValue;if(!se.$injector)throw new Error("Injectable functions cannot be called at configuration time");var t=se.$injector.invoke(e.config.$$fn);if(null!==t&&void 0!==t&&!e.type.is(t))throw new Error("Default value ("+t+") for parameter '"+e.id+"' is not an instance of ParamType ("+e.type.name+")");return e.config.$$fn.__cacheable&&(e._defaultValueCache={defaultValue:t}),t}():this.type.$normalize(t)},e.prototype.isSearch=function(){return this.location===t.DefType.SEARCH},e.prototype.validates=function(t){if((Jt(t)||null===t)&&this.isOptional)return!0;var e=this.type.$normalize(t);if(!this.type.is(e))return!1;var r=this.type.encode(e);return!(te(r)&&!this.type.pattern.exec(r))},e.prototype.toString=function(){return"{Param:"+this.id+" "+this.type+" squash: '"+this.squash+"' optional: "+this.isOptional+"}"},e.values=function(t,e){void 0===e&&(e={});for(var r={},n=0,i=t;n<i.length;n++){var o=i[n];r[o.id]=o.value(e[o.id])}return r},e.changed=function(t,e,r){return void 0===e&&(e={}),void 0===r&&(r={}),t.filter(function(t){return!t.type.equals(e[t.id],r[t.id])})},e.equals=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n={}),0===e.changed(t,r,n).length},e.validates=function(t,e){return void 0===e&&(e={}),t.map(function(t){return t.validates(e[t.id])}).reduce(Ee,!0)},e}(),nr=function(){function t(e){if(e instanceof t){var r=e;this.state=r.state,this.paramSchema=r.paramSchema.slice(),this.paramValues=ve({},r.paramValues),this.resolvables=r.resolvables.slice(),this.views=r.views&&r.views.slice()}else{var n=e;this.state=n,this.paramSchema=n.parameters({inherit:!1}),this.paramValues={},this.resolvables=n.resolvables.map(function(t){return t.clone()})}}return t.prototype.applyRawParams=function(t){var e=function(e){return[e.id,e.value(t[e.id])]};return this.paramValues=this.paramSchema.reduce(function(t,r){return T(t,e(r))},{}),this},t.prototype.parameter=function(t){return S(this.paramSchema,Ht("id",t))},t.prototype.equals=function(t,e){var r=this.diff(t,e);return r&&0===r.length},t.prototype.diff=function(t,e){if(this.state!==t.state)return!1;var r=e?e(this):this.paramSchema;return rr.changed(r,this.paramValues,t.paramValues)},t.clone=function(e){return new t(e)},t}(),ir=function(){function t(){}return t.makeTargetState=function(t){var e=P(t).state;return new Je(e,e,t.map(At("paramValues")).reduce(Se,{}))},t.buildPath=function(t){var e=t.params();return t.$state().path.map(function(t){return new nr(t).applyRawParams(e)})},t.buildToPath=function(e,r){var n=t.buildPath(r);return r.options().inherit?t.inheritParams(e,n,Object.keys(r.params())):n},t.applyViewConfigs=function(e,r,n){r.filter(function(t){return ge(n,t.state)}).forEach(function(n){var i=Re(n.state.views||{}),o=t.subPath(r,function(t){return t===n}),a=i.map(function(t){return e.createViewConfig(o,t)});n.views=a.reduce(Te,[])})},t.inheritParams=function(t,e,r){function n(t,e){var r=S(t,Ht("state",e));return ve({},r&&r.paramValues)}function i(e){var i=ve({},e&&e.paramValues),a=g(i,r);i=w(i,r);var u=w(n(t,e.state)||{},o),s=ve(i,u,a);return new nr(e.state).applyRawParams(s)}void 0===r&&(r=[]);var o=t.map(function(t){return t.paramSchema}).reduce(Te,[]).filter(function(t){return!t.inherit}).map(At("id"));return e.map(i)},t.treeChanges=function(e,r,n){function i(t,e){var n=nr.clone(t);return n.paramValues=r[e].paramValues,n}for(var o=0,a=Math.min(e.length,r.length);o<a&&e[o].state!==n&&function(e,r){return e.equals(r,t.nonDynamicParams)}(e[o],r[o]);)o++;var u,s,c,f,l;u=e,s=u.slice(0,o),c=u.slice(o);var p=s.map(i);return f=r.slice(o),l=p.concat(f),{from:u,to:l,retained:s,exiting:c,entering:f}},t.matching=function(t,e,r){var n=!1;return C(t,e).reduce(function(t,e){var i=e[0],o=e[1];return n=n||!i.equals(o,r),n?t:t.concat(i)},[])},t.equals=function(e,r,n){return e.length===r.length&&t.matching(e,r,n).length===e.length},t.subPath=function(t,e){var r=S(t,e),n=t.indexOf(r);return-1===n?void 0:t.slice(0,n+1)},t.nonDynamicParams=function(t){return t.state.parameters({inherit:!1}).filter(function(t){return!t.dynamic})},t.paramValues=function(t){return t.reduce(function(t,e){return ve(t,e.paramValues)},{})},t}(),or={when:"LAZY",async:"WAIT"},ar=function(){function t(e,r,n,i,o){if(this.resolved=!1,this.promise=void 0,e instanceof t)ve(this,e);else if(Zt(r)){if(Yt(e))throw new Error("new Resolvable(): token argument is required");if(!Zt(r))throw new Error("new Resolvable(): resolveFn argument must be a function");this.token=e,this.policy=i,this.resolveFn=r,this.deps=n||[],this.data=o,this.resolved=void 0!==o,this.promise=this.resolved?se.$q.when(this.data):void 0}else if(ee(e)&&e.token&&Zt(e.resolveFn)){var a=e;return new t(a.token,a.resolveFn,a.deps,a.policy,a.data)}}return t.prototype.getPolicy=function(t){var e=this.policy||{},r=t&&t.resolvePolicy||{};return{when:e.when||r.when||or.when,async:e.async||r.async||or.async}},t.prototype.resolve=function(t,e){var r=this,n=se.$q,i=function(){return n.all(t.getDependencies(r).map(function(r){return r.get(t,e)}))},o=function(t){return r.resolveFn.apply(null,t)},a=function(t){var e=t.cache(1);return e.take(1).toPromise().then(function(){return e})},u=t.findNode(this),s=u&&u.state,c="RXWAIT"===this.getPolicy(s).async?a:f,l=function(t){return r.data=t,r.resolved=!0,ze.traceResolvableResolved(r,e),r.data};return this.promise=n.when().then(i).then(o).then(c).then(l)},t.prototype.get=function(t,e){return this.promise||this.resolve(t,e)},t.prototype.toString=function(){return"Resolvable(token: "+Q(this.token)+", requires: ["+this.deps.map(Q)+"])"},t.prototype.clone=function(){return new t(this)},t.fromData=function(e,r){return new t(e,function(){return r},null,null,r)},t}(),ur={when:{LAZY:"LAZY",EAGER:"EAGER"},async:{WAIT:"WAIT",NOWAIT:"NOWAIT",RXWAIT:"RXWAIT"}},sr=ur.when,cr=[sr.EAGER,sr.LAZY],fr=[sr.EAGER],lr="Native Injector",pr=function(){function t(t){this._path=t}return t.prototype.getTokens=function(){return this._path.reduce(function(t,e){return t.concat(e.resolvables.map(function(t){return t.token}))},[]).reduce(ke,[])},t.prototype.getResolvable=function(t){return P(this._path.map(function(t){return t.resolvables}).reduce(Te,[]).filter(function(e){return e.token===t}))},t.prototype.getPolicy=function(t){var e=this.findNode(t);return t.getPolicy(e.state)},t.prototype.subContext=function(e){return new t(ir.subPath(this._path,function(t){return t.state===e}))},t.prototype.addResolvables=function(t,e){var r=S(this._path,Ht("state",e)),n=t.map(function(t){return t.token});r.resolvables=r.resolvables.filter(function(t){return-1===n.indexOf(t.token)}).concat(t)},t.prototype.resolvePath=function(t,e){var r=this;void 0===t&&(t="LAZY");var n=ge(cr,t)?t:"LAZY",i=n===ur.when.EAGER?fr:cr;ze.traceResolvePath(this._path,t,e);var o=function(t,e){return function(n){return ge(t,r.getPolicy(n)[e])}},a=this._path.reduce(function(t,n){var a=n.resolvables.filter(o(i,"when")),u=a.filter(o(["NOWAIT"],"async")),s=a.filter(Dt(o(["NOWAIT"],"async"))),c=r.subContext(n.state),f=function(t){return t.get(c,e).then(function(e){return{token:t.token,value:e}})};return u.forEach(f),t.concat(s.map(f))},[]);return se.$q.all(a)},t.prototype.injector=function(){return this._injector||(this._injector=new hr(this))},t.prototype.findNode=function(t){return S(this._path,function(e){return ge(e.resolvables,t)})},t.prototype.getDependencies=function(t){var e=this,r=this.findNode(t),n=ir.subPath(this._path,function(t){return t===r})||this._path,i=n.reduce(function(t,e){return t.concat(e.resolvables)},[]).filter(function(e){return e!==t}),o=function(t){var r=i.filter(function(e){return e.token===t});if(r.length)return P(r);var n=e.injector().getNative(t);if(!n)throw new Error("Could not find Dependency Injection token: "+Q(t));return new ar(t,function(){return n},[],n)};return t.deps.map(o)},t}(),hr=function(){function t(t){this.context=t,this.native=this.get(lr)||se.$injector}return t.prototype.get=function(t){var e=this.context.getResolvable(t);if(e){if("NOWAIT"===this.context.getPolicy(e).async)return e.get(this.context);if(!e.resolved)throw new Error("Resolvable async .get() not complete:"+Q(e.token));return e.data}return this.native&&this.native.get(t)},t.prototype.getAsync=function(t){var e=this.context.getResolvable(t);return e?e.get(this.context):se.$q.when(this.native.get(t))},t.prototype.getNative=function(t){return this.native&&this.native.get(t)},t}(),dr=At("self"),vr=function(){function e(e,r,n){var i=this;if(this._deferred=se.$q.defer(),this.promise=this._deferred.promise,this._registeredHooks={},this._hookBuilder=new Ze(this),this.isActive=function(){return i.router.globals.transition===i},this.router=n,this._targetState=r,!r.valid())throw new Error(r.error());this._options=ve({current:Mt(this)},r.options()),this.$id=n.transitionService._transitionCount++;var o=ir.buildToPath(e,r);this._treeChanges=ir.treeChanges(e,o,this._options.reloadState),this.createTransitionHookRegFns();var a=this._hookBuilder.buildHooksForPhase(t.TransitionHookPhase.CREATE);Ke.invokeHooks(a,function(){return null}),this.applyViewConfigs(n)}return 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.createTransitionHookRegFns=function(){var e=this;this.router.transitionService._pluginapi._getEvents().filter(function(e){return e.hookPhase!==t.TransitionHookPhase.CREATE}).forEach(function(t){return q(e,e.router.transitionService,t)})},e.prototype.getHooks=function(t){return this._registeredHooks[t]},e.prototype.applyViewConfigs=function(t){var e=this._treeChanges.entering.map(function(t){return t.state});ir.applyViewConfigs(t.transitionService.$view,this._treeChanges.to,e)},e.prototype.$from=function(){return P(this._treeChanges.from).state},e.prototype.$to=function(){return P(this._treeChanges.to).state},e.prototype.from=function(){return this.$from().self},e.prototype.to=function(){return this.$to().self},e.prototype.targetState=function(){return this._targetState},e.prototype.is=function(t){return t instanceof e?this.is({to:t.$to().name,from:t.$from().name}):!(t.to&&!H(this.$to(),t.to)||t.from&&!H(this.$from(),t.from))},e.prototype.params=function(t){return void 0===t&&(t="to"),Object.freeze(this._treeChanges[t].map(At("paramValues")).reduce(Se,{}))},e.prototype.injector=function(t,e){void 0===e&&(e="to");var r=this._treeChanges[e];return t&&(r=ir.subPath(r,function(e){return e.state===t||e.state.name===t})),new pr(r).injector()},e.prototype.getResolveTokens=function(t){return void 0===t&&(t="to"),new pr(this._treeChanges[t]).getTokens()},e.prototype.addResolvable=function(t,e){void 0===e&&(e=""),t=Ut(ar)(t)?t:new ar(t);var r="string"==typeof e?e:e.name,n=this._treeChanges.to,i=S(n,function(t){return t.state.name===r});new pr(n).addResolvables([t],i.state)},e.prototype.redirectedFrom=function(){return this._options.redirectedFrom||null},e.prototype.originalTransition=function(){var t=this.redirectedFrom();return t&&t.originalTransition()||this},e.prototype.options=function(){return this._options},e.prototype.entering=function(){return b(this._treeChanges.entering,At("state")).map(dr)},e.prototype.exiting=function(){return b(this._treeChanges.exiting,At("state")).map(dr).reverse()},e.prototype.retained=function(){return b(this._treeChanges.retained,At("state")).map(dr)},e.prototype.views=function(t,e){void 0===t&&(t="entering");var r=this._treeChanges[t];return r=e?r.filter(Ht("state",e)):r,r.map(At("views")).filter(f).reduce(Te,[])},e.prototype.treeChanges=function(t){return t?this._treeChanges[t]:this._treeChanges},e.prototype.redirect=function(t){for(var e=1,r=this;null!=(r=r.redirectedFrom());)if(++e>20)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=ve({},this.options(),t.options(),n);t=new Je(t.identifier(),t.$state(),t.params(),i);var o=this.router.transitionService.create(this._treeChanges.from,t),a=this._treeChanges.entering,u=o._treeChanges.entering;return ir.matching(u,a,ir.nonDynamicParams).filter(Dt(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){if(!C(t.to,t.from).map(function(t){return t[0].state!==t[1].state}).reduce(Ce,!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 rr.changed(e,r,n)}).reduce(Te,[])}}},e.prototype.dynamic=function(){var t=this._changedParams();return!!t&&t.map(function(t){return t.dynamic}).reduce(Ce,!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=ir.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=Ke.runAllHooks,n=function(t){return e._hookBuilder.buildHooksForPhase(t)},i=function(){ze.traceSuccess(e.$to(),e),e.success=!0,e._deferred.resolve(e.to()),r(n(t.TransitionHookPhase.SUCCESS))},o=function(i){ze.traceError(i,e),e.success=!1,e._deferred.reject(i),e._error=i,r(n(t.TransitionHookPhase.ERROR))},a=function(){var e=n(t.TransitionHookPhase.RUN),r=function(){return se.$q.when(void 0)};return Ke.invokeHooks(e,r)},u=function(){var t=e.router.globals;return t.lastStartedTransitionId=e.$id,t.transition=e,t.transitionHistory.enqueue(e),ze.traceTransitionStart(e),se.$q.when(void 0)},s=n(t.TransitionHookPhase.BEFORE);return Ke.invokeHooks(s,u).then(a).then(i,o),this.promise},e.prototype.valid=function(){return!this.error()||void 0!==this.success},e.prototype.abort=function(){Jt(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:w(t,["#"])};return"Transition#"+this.$id+"( '"+(ee(t)?t.name:t)+"'"+pe(r(this._treeChanges.from.map(At("paramValues")).reduce(Se,{})))+" -> "+(this.valid()?"":"(X) ")+"'"+(ee(e)?e.name:e)+"'"+pe(r(this.params()))+" )"},e.diToken=e,e}(),mr=null,yr=function(t){var e=Ue.isRejectionPromise;return(m