text: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t["@uirouter/core"]={})}(this,function(t){"use strict";function e(t){function e(n){return n.length>=r?t.apply(null,n):function(){return e(n.concat([].slice.apply(arguments)))}}var n=[].slice.apply(arguments,[1]),r=t.length;return e(n)}function n(){var t=arguments,e=t.length-1;return function(){for(var n=e,r=t[e].apply(this,arguments);n--;)r=t[n].call(this,r);return r}}function r(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.apply(null,[].slice.call(arguments).reverse())}function i(t,e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return t.apply(null,n)&&e.apply(null,n)}}function o(t,e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return t.apply(null,n)||e.apply(null,n)}}function a(t,e){return function(n){return n[t].apply(n,e)}}function s(t){return function(e){for(var n=0;n<t.length;n++)if(t[n][0](e))return t[n][1](e)}}function u(t){if(Rt(t)&&t.length){var e=t.slice(0,-1),n=t.slice(-1);return!(e.filter(at(bt)).length||n.filter(at(_t)).length)}return _t(t)}function c(t){return t}function f(){}function h(t,e,n,r,i){void 0===i&&(i=!1);var o=function(e){return t()[e].bind(n())};return(r=r||Object.keys(t())).reduce(function(t,n){return t[n]=i?function(t){return function(){return e[t]=o(t),e[t].apply(null,arguments)}}(n):o(n),t},e)}function p(t,e){return-1!==t.indexOf(e)}function l(t,e){var n=t.indexOf(e);return n>=0&&t.splice(n,1),t}function d(t,e){return t.push(e),e}function v(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=e.concat({}).reverse(),i=jt.apply(null,r);return jt({},i,g(t||{},Object.keys(i)))}function y(t,e){var n=[];for(var r in t.path){if(t.path[r]!==e.path[r])break;n.push(t.path[r])}return n}function g(t,e){var n={};for(var r in t)-1!==e.indexOf(r)&&(n[r]=t[r]);return n}function m(t,e){return Object.keys(t).filter(at(qt(e))).reduce(function(e,n){return e[n]=t[n],e},{})}function _(t,e){var n=Rt(t),r=n?[]:{},i=n?function(t){return r.push(t)}:function(t,e){return r[e]=t};return Vt(t,function(t,n){e(t,n)&&i(t,n)}),r}function w(t,e){var n;return Vt(t,function(t,r){n||e(t,r)&&(n=t)}),n}function b(t,e){var n=Rt(t)?[]:{};return Vt(t,function(t,r){return n[r]=e(t,r)}),n}function E(t,e){return t.push(e),t}function R(t,e){return void 0===e&&(e="assert failure"),function(n){var r=t(n);if(!r)throw new Error(_t(e)?e(n):e);return r}}function S(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)return[];for(var n=t.reduce(function(t,e){return Math.min(e.length,t)},9007199254740991),r=[],i=function(e){switch(t.length){case 1:r.push([t[0][e]]);break;case 2:r.push([t[0][e],t[1][e]]);break;case 3:r.push([t[0][e],t[1][e],t[2][e]]);break;case 4:r.push([t[0][e],t[1][e],t[2][e],t[3][e]]);break;default:r.push(t.map(function(t){return t[e]}))}},o=0;o<n;o++)i(o);return r}function T(t,e){var n,r;if(Rt(e)&&(n=e[0],r=e[1]),!bt(n))throw new Error("invalid parameters to applyPairs");return t[n]=r,t}function C(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={}),jt(e,t)}function P(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];if(n)for(var r=Object.keys(n),i=0;i<r.length;i++)t[r[i]]=n[r[i]]}return t}function O(t,e){if(t===e)return!0;if(null===t||null===e)return!1;if(t!=t&&e!=e)return!0;var n=typeof t;if(n!==typeof e||"object"!==n)return!1;var r=[t,e];if(st(Rt)(r))return function(t,e){return t.length===e.length&&S(t,e).reduce(function(t,e){return t&&O(e[0],e[1])},!0)}(t,e);if(st(St)(r))return t.getTime()===e.getTime();if(st(Tt)(r))return t.toString()===e.toString();if(st(_t)(r))return!0;if([_t,Rt,St,Tt].map(ut).reduce(function(t,e){return t||!!e(r)},!1))return!1;var i={};for(var o in t){if(!O(t[o],e[o]))return!1;i[o]=!0}for(var o in e)if(!i[o])return!1;return!0}function $(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 x(e){return wt(e)?t.Category[e]:t.Category[t.Category[e]]}function H(t,e){var n=bt(e)?[e]:e;return!!(_t(n)?n:function(t){for(var e=n,r=0;r<e.length;r++){var i=new ht(e[r]);if(i&&i.matches(t.name)||!i&&e[r]===t.name)return!0}return!1})(t)}function I(t,e,n){function r(t,r,a){void 0===a&&(a={});var s=new de(e,n,r,t,o,a);return i.push(s),s.deregister.bind(s)}var i=(t._registeredHooks=t._registeredHooks||{})[n.name]=[],o=Ft(i);return t[n.name]=r,r}function V(t,e){function n(t){return Rt(t)?t:yt(t)?[t]:[]}function r(t,r){return function(i){if(Rt(i)&&0===i.length)return i;var o=b(n(i),t);return!0===r?0===_(o,function(t){return!t}).length:function(t){switch(t.length){case 0:return;case 1:return"auto"===e?t[0]:t;default:return t}}(o)}}function i(t){return function(e,r){var i=n(e),o=n(r);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 o=this;["encode","decode","equals","$normalize"].forEach(function(e){var n=t[e].bind(t),a="equals"===e?i:r;o[e]=a(n)}),jt(this,{dynamic:t.dynamic,name:t.name,pattern:t.pattern,inherit:t.inherit,is:r(t.is.bind(t),!0),$arrayMode:e})}function j(t,e){return e.length<=t?e:e.substr(0,t-3)+"..."}function A(t,e){for(;e.length<t;)e+=" ";return e}function N(t){var e=q(t),n=e.match(/^(function [^ ]+\([^)]*\))/),r=n?n[1]:e,i=t.name||"";return i&&r.match(/function \(/)?"function "+i+r.substr(9):r}function q(t){var e=Rt(t)?t.slice(-1)[0]:t;return e&&e.toString()||"undefined"}function F(t){var e=[];return JSON.stringify(t,function(t,n){return function(t){if(Et(t)){if(-1!==e.indexOf(t))return"[circular ref]";e.push(t)}return Ve(t)}(n)}).replace(/\\"/g,'"')}function D(t){var e=new RegExp("("+t+")","g");return function(t){return t.split(e).filter(c)}}function U(t,e){return bt(C(t))&&bt(e)?t.slice(0,-1).concat(C(t)+e):E(t,e)}function L(t){return t.name}function M(t){return t.self.$$state=function(){return t},t.self}function G(t){return t.parent&&t.parent.data&&(t.data=t.self.data=Nt(t.parent.data,t.data)),t.data}function B(t){return t.parent?t.parent.path.concat(t):[t]}function W(t){var e=t.parent?jt({},t.parent.includes):{};return e[t.name]=!0,e}function z(t){var e=function(t){return t.provide||t.token},n=s([[rt("resolveFn"),function(t){return new Re(e(t),t.resolveFn,t.deps,t.policy)}],[rt("useFactory"),function(t){return new Re(e(t),t.useFactory,t.deps||t.dependencies,t.policy)}],[rt("useClass"),function(t){return new Re(e(t),function(){return new t.useClass},[],t.policy)}],[rt("useValue"),function(t){return new Re(e(t),function(){return t.useValue},[],t.policy,t.useValue)}],[rt("useExisting"),function(t){return new Re(e(t),c,[t.useExisting],t.policy)}]]),i=s([[r(rt("val"),bt),function(t){return new Re(t.token,c,[t.val],t.policy)}],[r(rt("val"),Rt),function(t){return new Re(t.token,C(t.val),t.val.slice(0,-1),t.policy)}],[r(rt("val"),_t),function(t){return new Re(t.token,t.val,function(t){var e=Ot.$injector;return t.$inject||e&&e.annotate(t,e.strictDi)||"deferred"}(t.val),t.policy)}]]),o=s([[ct(Re),function(t){return t}],[function(t){return!(!t.token||!t.resolveFn)},n],[function(t){return!(!t.provide&&!t.token||!(t.useValue||t.useFactory||t.useExisting||t.useClass))},n],[function(t){return!!(t&&t.val&&(bt(t.val)||Rt(t.val)||_t(t.val)))},i],[ft(!0),function(t){throw new Error("Invalid resolve value: "+F(t))}]]),a=t.resolve;return(Rt(a)?a:function(t,e){return Object.keys(t||{}).map(function(n){return{token:n,val:t[n],deps:void 0,policy:e[n]}})}(a,t.resolvePolicy||{})).map(o)}function J(t,e){var n=["",""],r=t.replace(/[\\\[\]\^$*+?.()|{}]/g,"\\$&");if(!e)return r;switch(e.squash){case!1:n=["(",")"+(e.isOptional?"?":"")];break;case!0:r=r.replace(/\/$/,""),n=["(?:/(",")|/)?"];break;default:n=["("+e.squash+"|",")?"]}return r+n[0]+e.type.pattern.source+n[1]}function Q(t){if(!(_t(t)||bt(t)||ct(he)(t)||he.isDef(t)))throw new Error("'handler' must be a string, function, TargetState, or have a state: 'newtarget' property");return _t(t)?t:ft(t)}function Y(t){t.addResolvable({token:vn,deps:[],resolveFn:function(){return t.router},data:t.router},""),t.addResolvable({token:He,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 K(t){return function(e,n){return(0,n.$$state()[t])(e,n)}}function Z(t,e){var n=e.$$state().lazyLoad,r=n._promise;if(!r){r=n._promise=Ot.$q.when(n(t,e)).then(function(e){return e&&Array.isArray(e.states)&&e.states.forEach(function(e){return t.router.stateRegistry.register(e)}),e}).then(function(t){return delete e.lazyLoad,delete e.$$state().lazyLoad,delete n._promise,t},function(t){return delete n._promise,Ot.$q.reject(t)})}return r}function X(t){var e=t._ignoredReason();if(e){fe.traceTransitionIgnored(t);var n=t.router.globals.transition;return"SameAsCurrent"===e&&n&&n.abort(),re.ignored().toPromise()}}function tt(t){if(!t.valid())throw new Error(t.error())}function et(t){var e=function(t){return t||""},n=qe(t).map(e),r=n[0],i=n[1],o=Fe(r).map(e);return{path:o[0],search:o[1],hash:i,url:t}}function nt(t,e,n,r){return function(i){var o=i.locationService=new n(i),a=i.locationConfig=new r(i,e);return{name:t,service:o,configuration:a,dispose:function(t){t.dispose(o),t.dispose(a)}}}}var rt=function(t){return function(e){return e&&e[t]}},it=e(function(t,e,n){return n&&n[t]===e}),ot=function(t){return r.apply(null,t.split(".").map(rt))},at=function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return!t.apply(null,e)}},st=function(t){return function(e){return e.reduce(function(e,n){return e&&!!t(n)},!0)}},ut=function(t){return function(e){return e.reduce(function(e,n){return e||!!t(n)},!1)}},ct=function(t){return function(e){return null!=e&&e.constructor===t||e instanceof t}},ft=function(t){return function(){return t}},ht=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.is=function(t){return!!/[!,*]+/.exec(t)},t.fromString=function(e){return t.is(e)?new t(e):null},t.prototype.matches=function(t){return this.regexp.test("."+t)},t}(),pt=function(){function t(e){return t.create(e||{})}return t.create=function(e){e=t.isStateClass(e)?new e:e;var n=Nt(Nt(e,t.prototype));return e.$$state=function(){return n},n.self=e,n.__stateObjectCache={nameGlob:ht.fromString(n.name)},n},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=v(t,{inherit:!0,matchingKeys:null})).inherit&&this.parent&&this.parent.parameters()||[]).concat(Gt(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)||w(Gt(this.params),it("id",t))||e.inherit&&this.parent&&this.parent.parameter(t)},t.prototype.toString=function(){return this.fqn()},t.isStateClass=function(t){return _t(t)&&!0===t.__uiRouterState},t.isState=function(t){return Et(t.__stateObjectCache)},t}(),lt=Object.prototype.toString,dt=function(t){return function(e){return typeof e===t}},vt=dt("undefined"),yt=at(vt),gt=function(t){return null===t},mt=o(gt,vt),_t=dt("function"),wt=dt("number"),bt=dt("string"),Et=function(t){return null!==t&&"object"==typeof t},Rt=Array.isArray,St=function(t){return"[object Date]"===lt.call(t)},Tt=function(t){return"[object RegExp]"===lt.call(t)},Ct=pt.isState,kt=i(Et,r(rt("then"),_t)),Pt=function(t){return function(){throw new Error(t+"(): No coreservices implementation for UI-Router is loaded.")}},Ot={$q:void 0,$injector:void 0},$t="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||void 0,xt=$t.angular||{},Ht=xt.fromJson||JSON.parse.bind(JSON),It=xt.toJson||JSON.stringify.bind(JSON),Vt=xt.forEach||function(t,e,n){if(Rt(t))return t.forEach(e,n);Object.keys(t).forEach(function(n){return e(t[n],n)})},jt=Object.assign||P,At=xt.equals||O,Nt=function(t,e){return jt(Object.create(t),e)},qt=e(p),Ft=e(l),Dt=e(d),Ut=function(t){return t.slice().forEach(function(e){"function"==typeof e&&e(),Ft(t,e)})},Lt=function(t,e){return jt(t,e)},Mt=b,Gt=function(t){return Object.keys(t).map(function(e){return t[e]})},Bt=function(t,e){return t&&e},Wt=function(t,e){return t||e},zt=function(t,e){return t.concat(e)},Jt=function(t,e){return Rt(e)?t.concat(e.reduce(Jt,[])):E(t,e)},Qt=function(t,e){return qt(t,e)?t:E(t,e)},Yt=function(t){return t.reduce(zt,[])},Kt=R,Zt=R,Xt=function(t){return t.catch(function(t){return 0})&&t},te=function(t){return Xt(Ot.$q.reject(t))},ee=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 ne=0,re=function(){function e(t,e,n){this.$id=ne++,this.type=t,this.message=e,this.detail=n}return e.isRejectionPromise=function(t){return t&&"function"==typeof t.then&&ct(e)(t._transitionRejection)},e.superseded=function(n,r){var i=new e(t.RejectType.SUPERSEDED,"The transition has been superseded by a different transition",n);return r&&r.redirected&&(i.redirected=!0),i},e.redirected=function(t){return e.superseded(t,{redirected:!0})},e.invalid=function(n){return new e(t.RejectType.INVALID,"This transition is invalid",n)},e.ignored=function(n){return new e(t.RejectType.IGNORED,"The transition was ignored",n)},e.aborted=function(n){return new e(t.RejectType.ABORTED,"The transition has been aborted",n)},e.errored=function(n){return new e(t.RejectType.ERROR,"The transition errored",n)},e.normalize=function(t){return ct(e)(t)?t:e.errored(t)},e.prototype.toString=function(){var t=function(t){return t&&t.toString!==Object.prototype.toString?t.toString():F(t)}(this.detail);return"Transition Rejection($id: "+this.$id+" type: "+this.type+", message: "+this.message+", detail: "+t+")"},e.prototype.toPromise=function(){return jt(te(this),{_transitionRejection:this})},e}(),ie=Function.prototype.bind.call(console.log,console),oe=_t(console.table)?console.table.bind(console):ie.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 ae=ot("$id"),se=ot("router.$id"),ue=function(t){return"Transition #"+ae(t)+"-"+se(t)},ce=function(){function e(){this._enabled={},this.approximateDigests=0}return e.prototype._set=function(e,n){var r=this;n.length||(n=Object.keys(t.Category).map(function(t){return parseInt(t,10)}).filter(function(t){return!isNaN(t)}).map(function(e){return t.Category[e]})),n.map(x).forEach(function(t){return r._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[x(t)]},e.prototype.traceTransitionStart=function(e){this.enabled(t.Category.TRANSITION)&&console.log(ue(e)+": Started  -> "+F(e))},e.prototype.traceTransitionIgnored=function(e){this.enabled(t.Category.TRANSITION)&&console.log(ue(e)+": Ignored  <> "+F(e))},e.prototype.traceHookInvocation=function(e,n,r){if(this.enabled(t.Category.HOOK)){var i=ot("traceData.hookType")(r)||"internal",o=ot("traceData.context.state.name")(r)||ot("traceData.context")(r)||"unknown",a=N(e.registeredHook.callback);console.log(ue(n)+":   Hook -> "+i+" context: "+o+", "+j(200,a))}},e.prototype.traceHookResult=function(e,n,r){this.enabled(t.Category.HOOK)&&console.log(ue(n)+":   <- Hook returned: "+j(200,F(e)))},e.prototype.traceResolvePath=function(e,n,r){this.enabled(t.Category.RESOLVE)&&console.log(ue(r)+":         Resolving "+e+" ("+n+")")},e.prototype.traceResolvableResolved=function(e,n){this.enabled(t.Category.RESOLVE)&&console.log(ue(n)+":               <- Resolved  "+e+" to: "+j(200,F(e.data)))},e.prototype.traceError=function(e,n){this.enabled(t.Category.TRANSITION)&&console.log(ue(n)+": <- Rejected "+F(n)+", reason: "+e)},e.prototype.traceSuccess=function(e,n){this.enabled(t.Category.TRANSITION)&&console.log(ue(n)+": <- Success  "+F(n)+", final state: "+e.name)},e.prototype.traceUIViewEvent=function(e,n,r){void 0===r&&(r=""),this.enabled(t.Category.UIVIEW)&&console.log("ui-view: "+A(30,e)+" "+$(n)+r)},e.prototype.traceUIViewConfigUpdated=function(e,n){this.enabled(t.Category.UIVIEW)&&this.traceUIViewEvent("Updating",e," with ViewConfig from context='"+n+"'")},e.prototype.traceUIViewFill=function(e,n){this.enabled(t.Category.UIVIEW)&&this.traceUIViewEvent("Fill",e," with: "+j(200,n))},e.prototype.traceViewSync=function(e){if(this.enabled(t.Category.VIEWCONFIG)){var n="uiview component fqn",r=e.map(function(t){var e=t.uiView,r=t.viewConfig,i=e&&e.fqn,o=r&&r.viewDecl.$context.name+": ("+r.viewDecl.$name+")";return a={},a[n]=i,a["view config state (view name)"]=o,a;var a}).sort(function(t,e){return(t[n]||"").localeCompare(e[n]||"")});oe(r)}},e.prototype.traceViewServiceEvent=function(e,n){this.enabled(t.Category.VIEWCONFIG)&&console.log("VIEWCONFIG: "+e+" "+function(t){var e=t.viewDecl,n=e.$context.name||"(root)";return"[View#"+t.$id+" from '"+n+"' state]: target ui-view: '"+e.$uiViewName+"@"+e.$uiViewContextAnchor+"'"}(n))},e.prototype.traceViewServiceUIViewEvent=function(e,n){this.enabled(t.Category.VIEWCONFIG)&&console.log("VIEWCONFIG: "+e+" "+$(n))},e}(),fe=new ce;!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 he=function(){function t(t,e,n,r){this._stateRegistry=t,this._identifier=e,this._identifier=e,this._params=jt({},n||{}),this._options=jt({},r||{}),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()+"'"+F(this.params())},t.prototype.withState=function(e){return new t(this._stateRegistry,e,this._params,this._options)},t.prototype.withParams=function(e,n){void 0===n&&(n=!1);var r=n?e:jt({},this._params,e);return new t(this._stateRegistry,this._identifier,r,this._options)},t.prototype.withOptions=function(e,n){void 0===n&&(n=!1);var r=n?e:jt({},this._options,e);return new t(this._stateRegistry,this._identifier,this._params,r)},t.isDef=function(t){return t&&t.state&&(bt(t.state)||bt(t.state.name))},t}(),pe={current:f,transition:null,traceData:{},bind:null},le=function(){function e(e,n,r,i){var o=this;this.transition=e,this.stateContext=n,this.registeredHook=r,this.options=i,this.isSuperseded=function(){return o.type.hookPhase===t.TransitionHookPhase.RUN&&!o.options.transition.isActive()},this.options=v(i,pe),this.type=r.eventType}return e.chain=function(t,e){return t.reduce(function(t,e){return t.then(function(){return e.invokeHook()})},e||Ot.$q.when())},e.invokeHooks=function(t,n){for(var r=0;r<t.length;r++){var i=t[r].invokeHook();if(kt(i)){var o=t.slice(r+1);return e.chain(o,i).then(n)}}return n()},e.runAllHooks=function(t){t.forEach(function(t){return t.invokeHook()})},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 n=this.getNotCurrentRejection();if(n)return n;var r=this.options;fe.traceHookInvocation(this,this.transition,r);var i=function(n){return e.eventType.getErrorHandler(t)(n)},o=function(n){return e.eventType.getResultHandler(t)(n)};try{var a=e.callback.call(r.bind,t.transition,t.stateContext);return!this.type.synchronous&&kt(a)?a.catch(function(t){return re.normalize(t).toPromise()}).then(o,i):o(a)}catch(t){return i(re.normalize(t))}finally{e.invokeLimit&&++e.invokeCount>=e.invokeLimit&&e.deregister()}}},e.prototype.handleHookResult=function(t){var e=this,n=this.getNotCurrentRejection();if(n)return n;if(kt(t))return t.then(function(t){return e.handleHookResult(t)});if(fe.traceHookResult(t,this.transition,this.options),!1===t)return re.aborted("Hook aborted transition").toPromise();return ct(he)(t)?re.redirected(t).toPromise():void 0},e.prototype.getNotCurrentRejection=function(){var t=this.transition.router;return t._disposed?re.aborted("UIRouter instance #"+t.$id+" has been stopped (disposed)").toPromise():this.transition._aborted?re.aborted().toPromise():this.isSuperseded()?re.superseded(this.options.current()).toPromise():void 0},e.prototype.toString=function(){var t=this.options,e=this.registeredHook;return(ot("traceData.hookType")(t)||"internal")+" context: "+(ot("traceData.context.state.name")(t)||ot("traceData.context")(t)||"unknown")+", "+j(200,q(e.callback))},e.HANDLE_RESULT=function(t){return function(e){return t.handleHookResult(e)}},e.LOG_REJECTED_RESULT=function(t){return function(e){kt(e)&&e.catch(function(e){return t.logError(re.normalize(e))})}},e.LOG_ERROR=function(t){return function(e){return t.logError(e)}},e.REJECT_ERROR=function(t){return function(t){return te(t)}},e.THROW_ERROR=function(t){return function(t){throw t}},e}(),de=function(){function e(t,e,n,r,i,o){void 0===o&&(o={}),this.tranSvc=t,this.eventType=e,this.callback=n,this.matchCriteria=r,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 n=t.filter(function(t){return H(t.state,e)});return n.length?n:null},e.prototype._getDefaultMatchCriteria=function(){return b(this.tranSvc._pluginapi._getPathTypes(),function(){return!0})},e.prototype._getMatchingNodes=function(e){var n=this,r=jt(this._getDefaultMatchCriteria(),this.matchCriteria);return Gt(this.tranSvc._pluginapi._getPathTypes()).reduce(function(i,o){var a=o.scope===t.TransitionHookScope.STATE,s=e[o.name]||[],u=a?s:[C(s)];return i[o.name]=n._matchingNodes(u,r[o.name]),i},{})},e.prototype.matches=function(t){var e=this._getMatchingNodes(t);return Gt(e).every(c)?e:null},e.prototype.deregister=function(){this.removeHookFromRegistry(this),this._deregistered=!0},e}(),ve=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(zt,[]).filter(c)},e.prototype.buildHooks=function(e){var n=this.transition,r=n.treeChanges(),i=this.getMatchingHooks(e,r);if(!i)return[];var o={transition:n,current:n.options().current};return i.map(function(i){return i.matches(r)[e.criteriaMatchPath.name].map(function(r){var a=jt({bind:i.bind,traceData:{hookType:e.name,context:r}},o),s=e.criteriaMatchPath.scope===t.TransitionHookScope.STATE?r.state.self:null,u=new le(n,s,i,a);return{hook:i,node:r,transitionHook:u}})}).reduce(zt,[]).sort(function(t){return void 0===t&&(t=!1),function(e,n){var r=t?-1:1,i=(e.node.state.path.length-n.node.state.path.length)*r;return 0!==i?i:n.hook.priority-e.hook.priority}}(e.reverseSort)).map(function(t){return t.transitionHook})},e.prototype.getMatchingHooks=function(e,n){var r=e.hookPhase===t.TransitionHookPhase.CREATE,i=this.transition.router.transitionService;return(r?[i]:[this.transition,i]).map(function(t){return t.getHooks(e.name)}).filter(Kt(Rt,"broken event named: "+e.name)).reduce(zt,[]).filter(function(t){return t.matches(n)})},e}(),ye=function(){function t(t){this.pattern=/.*/,this.inherit=!0,jt(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 V(this,t)},t}(),ge=Object.prototype.hasOwnProperty,me=function(t){return 0===["value","type","squash","array","dynamic"].filter(ge.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 _e=function(){function e(e,n,r,i,o){n=function(e,n,r,i,o){if(e.type&&n&&"string"!==n.name)throw new Error("Param '"+i+"' has two type configurations.");if(e.type&&n&&"string"===n.name&&o.type(e.type))return o.type(e.type);if(n)return n;if(!e.type){var a=r===t.DefType.CONFIG?"any":r===t.DefType.PATH?"path":r===t.DefType.SEARCH?"query":"string";return o.type(a)}return e.type instanceof ye?e.type:o.type(e.type)}(r=function(t){function e(){return t.value}return t=me(t)&&{value:t}||t,e.__cacheable=!0,jt(t,{$$fn:u(t.value)?t.value:e})}(r),n,i,e,o.paramTypes);var a=function(){var n={array:i===t.DefType.SEARCH&&"auto"},o=e.match(/\[\]$/)?{array:!0}:{};return jt(n,o,r).array}();n=a?n.$asArray(a,i===t.DefType.SEARCH):n;var s=void 0!==r.value||i===t.DefType.SEARCH,c=yt(r.dynamic)?!!r.dynamic:!!n.dynamic,f=yt(r.raw)?!!r.raw:!!n.raw,h=function(t,e,n){var r=t.squash;if(!e||!1===r)return!1;if(!yt(r)||null==r)return n;if(!0===r||bt(r))return r;throw new Error("Invalid squash policy: '"+r+"'. Valid policies: false, true, or arbitrary string")}(r,s,o.defaultSquashPolicy()),p=function(t,e,n,r){var i=[{from:"",to:n||e?void 0:""},{from:null,to:n||e?void 0:""}],o=Rt(t.replace)?t.replace:[];bt(r)&&o.push({from:r,to:void 0});var a=b(o,rt("from"));return _(i,function(t){return-1===a.indexOf(t.from)}).concat(o)}(r,a,s,h),l=yt(r.inherit)?!!r.inherit:!!n.inherit;jt(this,{id:e,type:n,location:i,isOptional:s,dynamic:c,raw:f,squash:h,replace:p,inherit:l,array:a,config:r})}return e.values=function(t,e){void 0===e&&(e={});for(var n={},r=0,i=t;r<i.length;r++){var o=i[r];n[o.id]=o.value(e[o.id])}return n},e.changed=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n={}),t.filter(function(t){return!t.type.equals(e[t.id],n[t.id])})},e.equals=function(t,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),0===e.changed(t,n,r).length},e.validates=function(t,e){return void 0===e&&(e={}),t.map(function(t){return t.validates(e[t.id])}).reduce(Bt,!0)},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 n=0,r=e.replace;n<r.length;n++){var i=r[n];if(i.from===t)return i.to}return t}(t),vt(t)?function(){if(e._defaultValueCache)return e._defaultValueCache.defaultValue;if(!Ot.$injector)throw new Error("Injectable functions cannot be called at configuration time");var t=Ot.$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((vt(t)||null===t)&&this.isOptional)return!0;var e=this.type.$normalize(t);if(!this.type.is(e))return!1;var n=this.type.encode(e);return!(bt(n)&&!this.type.pattern.exec(n))},e.prototype.toString=function(){return"{Param:"+this.id+" "+this.type+" squash: '"+this.squash+"' optional: "+this.isOptional+"}"},e}(),we=function(){function t(e){if(e instanceof t){var n=e;this.state=n.state,this.paramSchema=n.paramSchema.slice(),this.paramValues=jt({},n.paramValues),this.resolvables=n.resolvables.slice(),this.views=n.views&&n.views.slice()}else{var r=e;this.state=r,this.paramSchema=r.parameters({inherit:!1}),this.paramValues={},this.resolvables=r.resolvables.map(function(t){return t.clone()})}}return t.clone=function(e){return new t(e)},t.prototype.applyRawParams=function(t){return this.paramValues=this.paramSchema.reduce(function(e,n){return T(e,function(e){return[e.id,e.value(t[e.id])]}(n))},{}),this},t.prototype.parameter=function(t){return w(this.paramSchema,it("id",t))},t.prototype.equals=function(t,e){var n=this.diff(t,e);return n&&0===n.length},t.prototype.diff=function(t,e){if(this.state!==t.state)return!1;var n=e?e(this):this.paramSchema;return _e.changed(n,this.paramValues,t.paramValues)},t}(),be=function(){function t(){}return t.makeTargetState=function(t,e){var n=C(e).state;return new he(t,n,e.map(rt("paramValues")).reduce(Lt,{}),{})},t.buildPath=function(t){var e=t.params();return t.$state().path.map(function(t){return new we(t).applyRawParams(e)})},t.buildToPath=function(e,n){var r=t.buildPath(n);return n.options().inherit?t.inheritParams(e,r,Object.keys(n.params())):r},t.applyViewConfigs=function(e,n,r){n.filter(function(t){return qt(r,t.state)}).forEach(function(r){var i=Gt(r.state.views||{}),o=t.subPath(n,function(t){return t===r}),a=i.map(function(t){return e.createViewConfig(o,t)});r.views=a.reduce(zt,[])})},t.inheritParams=function(t,e,n){void 0===n&&(n=[]);var r=t.map(function(t){return t.paramSchema}).reduce(zt,[]).filter(function(t){return!t.inherit}).map(rt("id"));return e.map(function(e){var i=jt({},e&&e.paramValues),o=g(i,n);i=m(i,n);var a=m(function(t,e){var n=w(t,it("state",e));return jt({},n&&n.paramValues)}(t,e.state)||{},r),s=jt(i,a,o);return new we(e.state).applyRawParams(s)})},t.treeChanges=function(e,n,r){for(var i=Math.min(e.length,n.length),o=0,a=function(e,n){return e.equals(n,t.nonDynamicParams)};o<i&&e[o].state!==r&&a(e[o],n[o]);)o++;var s,u,c,f,h;return s=e,u=s.slice(0,o).map(function(t,e){var r=we.clone(t);return r.paramValues=n[e].paramValues,r}),c=s.slice(o),f=n.slice(o),h=u.concat(f),{from:s,to:h,retained:u,exiting:c,entering:f}},t.matching=function(t,e,n){var r=!1;return S(t,e).reduce(function(t,e){var i=e[0],o=e[1];return(r=r||!i.equals(o,n))?t:t.concat(i)},[])},t.equals=function(e,n,r){return e.length===n.length&&t.matching(e,n,r).length===e.length},t.subPath=function(t,e){var n=w(t,e),r=t.indexOf(n);return-1===r?void 0:t.slice(0,r+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 jt(t,e.paramValues)},{})},t}(),Ee={when:"LAZY",async:"WAIT"},Re=function(){function t(e,n,r,i,o){if(this.resolved=!1,this.promise=void 0,e instanceof t)jt(this,e);else if(_t(n)){if(mt(e))throw new Error("new Resolvable(): token argument is required");if(!_t(n))throw new Error("new Resolvable(): resolveFn argument must be a function");this.token=e,this.policy=i,this.resolveFn=n,this.deps=r||[],this.data=o,this.resolved=void 0!==o,this.promise=this.resolved?Ot.$q.when(this.data):void 0}else if(Et(e)&&e.token&&_t(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||{},n=t&&t.resolvePolicy||{};return{when:e.when||n.when||Ee.when,async:e.async||n.async||Ee.async}},t.prototype.resolve=function(t,e){var n=this,r=Ot.$q,i=t.findNode(this),o=i&&i.state,a="RXWAIT"===this.getPolicy(o).async?function(t){var e=t.cache(1);return e.take(1).toPromise().then(function(){return e})}:c;return this.promise=r.when().then(function(){return r.all(t.getDependencies(n).map(function(n){return n.get(t,e)}))}).then(function(t){return n.resolveFn.apply(null,t)}).then(a).then(function(t){return n.data=t,n.resolved=!0,fe.traceResolvableResolved(n,e),n.data})},t.prototype.get=function(t,e){return this.promise||this.resolve(t,e)},t.prototype.toString=function(){return"Resolvable(token: "+F(this.token)+", requires: ["+this.deps.map(F)+"])"},t.prototype.clone=function(){return new t(this)},t.fromData=function(e,n){return new t(e,function(){return n},null,null,n)},t}(),Se={when:{LAZY:"LAZY",EAGER:"EAGER"},async:{WAIT:"WAIT",NOWAIT:"NOWAIT",RXWAIT:"RXWAIT"}},Te=Se.when,Ce=[Te.EAGER,Te.LAZY],ke=[Te.EAGER],Pe="Native Injector",Oe=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(Qt,[])},t.prototype.getResolvable=function(t){return C(this._path.map(function(t){return t.resolvables}).reduce(zt,[]).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(be.subPath(this._path,function(t){return t.state===e}))},t.prototype.addResolvables=function(t,e){var n=w(this._path,it("state",e)),r=t.map(function(t){return t.token});n.resolvables=n.resolvables.filter(function(t){return-1===r.indexOf(t.token)}).concat(t)},t.prototype.resolvePath=function(t,e){var n=this;void 0===t&&(t="LAZY");var r=(qt(Ce,t)?t:"LAZY")===Se.when.EAGER?ke:Ce;fe.traceResolvePath(this._path,t,e);var i=function(t,e){return function(r){return qt(t,n.getPolicy(r)[e])}},o=this._path.reduce(function(t,o){var a=o.resolvables.filter(i(r,"when")),s=a.filter(i(["NOWAIT"],"async")),u=a.filter(at(i(["NOWAIT"],"async"))),c=n.subContext(o.state),f=function(t){return t.get(c,e).then(function(e){return{token:t.token,value:e}})};return s.forEach(f),t.concat(u.map(f))},[]);return Ot.$q.all(o)},t.prototype.injector=function(){return this._injector||(this._injector=new $e(this))},t.prototype.findNode=function(t){return w(this._path,function(e){return qt(e.resolvables,t)})},t.prototype.getDependencies=function(t){var e=this,n=this.findNode(t),r=(be.subPath(this._path,function(t){return t===n})||this._path).reduce(function(t,e){return t.concat(e.resolvables)},[]).filter(function(e){return e!==t});return t.deps.map(function(t){var n=r.filter(function(e){return e.token===t});if(n.length)return C(n);var i=e.injector().getNative(t);if(vt(i))throw new Error("Could not find Dependency Injection token: "+F(t));return new Re(t,function(){return i},[],i)})},t}(),$e=function(){function t(t){this.context=t,this.native=this.get(Pe)||Ot.$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:"+F(e.token));return e.data}return this.getNative(t)},t.prototype.getAsync=function(t){var e=this.context.getResolvable(t);return e?e.get(this.context):Ot.$q.when(this.native.get(t))},t.prototype.getNative=function(t){return this.native&&this.native.get(t)},t}(),xe=rt("self"),He=function(){function e(e,n,r){var i=this;if(this._deferred=Ot.$q.defer(),this.promise=this._deferred.promise,this._registeredHooks={},this._hookBuilder=new ve(this),this.isActive=function(){return i.router.globals.transition===i},this.router=r,this._targetState=n,!n.valid())throw new Error(n.error());this._options=jt({current:ft(this)},n.options()),this.$id=r.transitionService._transitionCount++;var o=be.buildToPath(e,n);this._treeChanges=be.treeChanges(e,o,this._options.reloadState),this.createTransitionHookRegFns();var a=this._hookBuilder.buildHooksForPhase(t.TransitionHookPhase.CREATE);le.invokeHooks(a,function(){return null}),this.applyViewConfigs(r)}return e.prototype.onBefore=function(t,e,n){},e.prototype.onStart=function(t,e,n){},e.prototype.onExit=function(t,e,n){},e.prototype.onRetain=function(t,e,n){},e.prototype.onEnter=function(t,e,n){},e.prototype.onFinish=function(t,e,n){},e.prototype.onSuccess=function(t,e,n){},e.prototype.onError=function(t,e,n){},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 I(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});be.applyViewConfigs(t.transitionService.$view,this._treeChanges.to,e)},e.prototype.$from=function(){return C(this._treeChanges.from).state},e.prototype.$to=function(){return C(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(rt("paramValues")).reduce(Lt,{}))},e.prototype.injector=function(t,e){void 0===e&&(e="to");var n=this._treeChanges[e];return t&&(n=be.subPath(n,function(e){return e.state===t||e.state.name===t})),new Oe(n).injector()},e.prototype.getResolveTokens=function(t){return void 0===t&&(t="to"),new Oe(this._treeChanges[t]).getTokens()},e.prototype.addResolvable=function(t,e){void 0===e&&(e=""),t=ct(Re)(t)?t:new Re(t);var n="string"==typeof e?e:e.name,r=this._treeChanges.to,i=w(r,function(t){return t.state.name===n});new Oe(r).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,rt("state")).map(xe)},e.prototype.exiting=function(){return b(this._treeChanges.exiting,rt("state")).map(xe).reverse()},e.prototype.retained=function(){return b(this._treeChanges.retained,rt("state")).map(xe)},e.prototype.views=function(t,e){void 0===t&&(t="entering");var n=this._treeChanges[t];return(n=e?n.filter(it("state",e)):n).map(rt("views")).filter(c).reduce(zt,[])},e.prototype.treeChanges=function(t){return t?this._treeChanges[t]:this._treeChanges},e.prototype.redirect=function(t){for(var e=1,n=this;null!=(n=n.redirectedFrom());)if(++e>20)throw new Error("Too many consecutive Transition redirects (20+)");var r={redirectedFrom:this,source:"redirect"};"url"===this.options().source&&!1!==t.options().location&&(r.location="replace");var i=jt({},this.options(),t.options(),r);t=t.withOptions(i,!0);var o=this.router.transitionService.create(this._treeChanges.from,t),a=this._treeChanges.entering,s=o._treeChanges.entering;return be.matching(s,a,be.nonDynamicParams).filter(at(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(!S(t.to,t.from).map(function(t){return t[0].state!==t[1].state}).reduce(Wt,!1)){var e=t.to.map(function(t){return t.paramSchema}),n=[t.to,t.from].map(function(t){return t.map(function(t){return t.paramValues})});return S(e,n[0],n[1]).map(function(t){var e=t[0],n=t[1],r=t[2];return _e.changed(e,n,r)}).reduce(zt,[])}}},e.prototype.dynamic=function(){var t=this._changedParams();return!!t&&t.map(function(t){return t.dynamic}).reduce(Wt,!1)},e.prototype.ignored=function(){return!!this._ignoredReason()},e.prototype._ignoredReason=function(){var t=this.router.globals.transition,e=this._options.reloadState,n=function(t,n){if(t.length!==n.length)return!1;var r=be.matching(t,n);return t.length===r.filter(function(t){return!e||!t.state.includes[e.name]}).length},r=this.treeChanges(),i=t&&t.treeChanges();return i&&n(i.to,r.to)&&n(i.exiting,r.exiting)?"SameAsPending":0===r.exiting.length&&0===r.entering.length&&n(r.from,r.to)?"SameAsCurrent":void 0},e.prototype.run=function(){var e=this,n=le.runAllHooks,r=function(t){return e._hookBuilder.buildHooksForPhase(t)},i=r(t.TransitionHookPhase.BEFORE);return le.invokeHooks(i,function(){var t=e.router.globals;return t.lastStartedTransitionId=e.$id,t.transition=e,t.transitionHistory.enqueue(e),fe.traceTransitionStart(e),Ot.$q.when(void 0)}).then(function(){var e=r(t.TransitionHookPhase.RUN);return le.invokeHooks(e,function(){return Ot.$q.when(void 0)})}).then(function(){fe.traceSuccess(e.$to(),e),e.success=!0,e._deferred.resolve(e.to()),n(r(t.TransitionHookPhase.SUCCESS))},function(i){fe.traceError(i,e),e.success=!1,e._deferred.reject(i),e._error=i,n(r(t.TransitionHookPhase.ERROR))}),this.promise},e.prototype.valid=function(){return!this.error()||void 0!==this.success},e.prototype.abort=function(){vt(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(),n=this.params(),r=e.filter(function(t){return!t.validates(n[t.id])});return r.length?"Param values not valid for state '"+t.name+"'. Invalid params: [ "+r.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(),n=function(t){return null!==t["#"]&&void 0!==t["#"]?t:m(t,["#"])};return"Transition#"+this.$id+"( '"+(Et(t)?t.name:t)+"'"+F(n(this._treeChanges.from.map(rt("paramValues")).reduce(Lt,{})))+" -> "+(this.valid()?"":"(X) ")+"'"+(Et(e)?e.name:e)+"'"+F(n(this.params()))+" )"},e.diToken=e,e}(),Ie=null,Ve=function(t){var e=re.isRejectionPromise;return(Ie=Ie||s([[at(yt),ft("undefined")],[gt,ft("null")],[kt,ft("[Promise]")],[e,function(t){return t._transitionRejection.toString()}],[ct(re),a("toString")],[ct(He),a("toString")],[ct(Re),a("toString")],[u,N],[ft(!0),c]]))(t)},je=function(t){return function(e){if(!e)return["",""];var n=e.indexOf(t);return-1===n?[e,""]:[e.substr(0,n),e.substr(n+1)]}},Ae=new RegExp("^(?:[a-z]+:)?//[^/]+/"),Ne=function(t){return t.replace(/\/[^/]*$/,"")},qe=je("#"),Fe=je("?"),De=je("="),Ue=function(t){return t?t.replace(/^#/,""):""},Le=function(){function t(){this.enqueue=!0,this.typeQueue=[],this.defaultTypes=g(t.prototype,["hash","string","query","path","int","bool","date","json","any"]);this.types=Nt(b(this.defaultTypes,function(t,e){return new ye(jt({name:e},t))}),{})}return t.prototype.dispose=function(){this.types={}},t.prototype.type=function(t,e,n){if(!yt(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 ye(jt({name:t},e)),n&&(this.typeQueue.push({name:t,def:n}),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.");jt(this.types[t.name],Ot.$injector.invoke(t.def))}},t}();!function(){var t=function(t){var e=function(t){return null!=t?t.toString():t},n={encode:e,decode:e,is:ct(String),pattern:/.*/,equals:function(t,e){return t==e}};return jt({},n,t)};jt(Le.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!mt(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:ct(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(n,r){return n&&t[r]()===e[r]()},!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:It,decode:Ht,is:ct(Object),equals:At,pattern:/[^/]*/}),any:t({encode:c,decode:c,is:function(){return!0},equals:At})})}();var Me,Ge=function(){function t(t){void 0===t&&(t={}),jt(this,t)}return t.prototype.$inherit=function(t,e,n){var r,i=y(e,n),o={},a=[];for(var s in i)if(i[s]&&i[s].params&&(r=Object.keys(i[s].params)).length)for(var u in r)a.indexOf(r[u])>=0||(a.push(r[u]),o[r[u]]=this[r[u]]);return jt({},o,t)},t}(),Be=function(t,e){return function(n){var r=n;r&&r.url&&r.name&&r.name.match(/\.\*\*$/)&&(r.url+="{remainder:any}");var i=function(t){if(!bt(t))return!1;var e="^"===t.charAt(0);return{val:e?t.substring(1):t,root:e}}(r.url),o=n.parent,a=i?t.compile(i.val,{params:n.params||{},paramMap:function(t,e){return!1===r.reloadOnSearch&&e&&(t=jt(t||{},{dynamic:!0})),t}}):r.url;if(!a)return null;if(!t.isMatcher(a))throw new Error("Invalid url '"+a+"' in state '"+n+"'");return i&&i.root?a:(o&&o.navigable||e()).url.append(a)}},We=function(t){return function(e){return!t(e)&&e.url?e:e.parent?e.parent.navigable:null}},ze=function(t){return function(e){var n=e.url&&e.url.parameters({inherit:!1})||[],r=Gt(Mt(m(e.params||{},n.map(rt("id"))),function(e,n){return t.fromConfig(n,null,e)}));return n.concat(r).map(function(t){return[t.id,t]}).reduce(T,{})}},Je=function(){function t(t,e){this.matcher=t;var n=this,r=function(){return t.find("")},i=function(t){return""===t.name};this.builders={name:[L],self:[M],parent:[function(e){return i(e)?null:t.find(n.parentName(e))||r()}],data:[G],url:[Be(e,r)],navigable:[We(i)],params:[ze(e.paramFactory)],views:[],path:[B],includes:[W],resolvables:[z]}}return t.prototype.builder=function(t,e){var n=this.builders,r=n[t]||[];return bt(t)&&!yt(e)?r.length>1?r:r[0]:bt(t)&&_t(e)?(n[t]=r,n[t].push(e),function(){return n[t].splice(n[t].indexOf(e,1))&&null}):void 0},t.prototype.build=function(t){var e=this.matcher,n=this.builders,r=this.parentName(t);if(r&&!e.find(r,void 0,!1))return null;for(var i in n)if(n.hasOwnProperty(i)){var o=n[i].reduce(function(t,e){return function(n){return e(n,t)}},f);t[i]=o(t)}return t},t.prototype.parentName=function(t){var e=t.name||"",n=e.split(".");if("**"===n.pop()&&n.pop(),n.length){if(t.parent)throw new Error("States that specify the 'parent:' property should not have a '.' in their name ("+e+")");return n.join(".")}return t.parent?bt(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 n=bt(t.parent)?t.parent:t.parent.name;return n?n+"."+e:e},t}(),Qe=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,n){if(void 0===n&&(n=!0),t||""===t){var r=bt(t),i=r?t:t.name;this.isRelative(i)&&(i=this.resolvePath(i,e));var o=this._states[i];if(o&&(r||!(r||o!==t&&o.self!==t)))return o;if(r&&n){var a=Gt(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 n=this.find(e),r=t.split("."),i=r.length,o=0,a=n;o<i;o++)if(""!==r[o]||0!==o){if("^"!==r[o])break;if(!a.parent)throw new Error("Path '"+t+"' not valid for state '"+n.name+"'");a=a.parent}else a=n;var s=r.slice(o).join(".");return a.name+(a.name&&s?".":"")+s},t}(),Ye=function(){function t(t,e,n,r,i){this.$registry=t,this.$urlRouter=e,this.states=n,this.builder=r,this.listeners=i,this.queue=[],this.matcher=t.matcher}return t.prototype.dispose=function(){this.queue=[]},t.prototype.register=function(t){var e=this.queue,n=pt.create(t),r=n.name;if(!bt(r))throw new Error("State must have a valid name");if(this.states.hasOwnProperty(r)||qt(e.map(rt("name")),r))throw new Error("State '"+r+"' is already defined");return e.push(n),this.flush(),n},t.prototype.flush=function(){for(var t=this,e=this.queue,n=this.states,r=this.builder,i=[],o=[],a={},s=function(e){return t.states.hasOwnProperty(e)&&t.states[e]};e.length>0;){var u=e.shift(),c=u.name,f=r.build(u),h=o.indexOf(u);if(f){var p=s(c);if(p&&p.name===c)throw new Error("State '"+c+"' is already defined");var l=s(c+".**");l&&this.$registry.deregister(l),n[c]=u,this.attachRoute(u),h>=0&&o.splice(h,1),i.push(u)}else{var d=a[c];if(a[c]=e.length,h>=0&&d===e.length)return e.push(u),n;h<0&&o.push(u),e.push(u)}}return i.length&&this.listeners.forEach(function(t){return t("registered",i.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}(),Ke=function(){function t(t){this._router=t,this.states={},this.listeners=[],this.matcher=new Qe(this.states),this.builder=new Je(this.matcher,t.urlMatcherFactory),this.stateQueue=new Ye(this,t.urlRouter,this.states,this.builder,this.listeners),this._registerRoot()}return t.prototype._registerRoot=function(){(this._root=this.stateQueue.register({name:"",url:"^",views:null,params:{"#":{value:null,type:"hash",dynamic:!0}},abstract:!0})).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(){Ft(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,n=this.get().map(function(t){return t.$$state()}),r=function(t){var e=n.filter(function(e){return-1!==t.indexOf(e.parent)});return 0===e.length?e:e.concat(r(e))},i=r([t]),o=[t].concat(i).reverse();return o.forEach(function(t){var n=e._router.urlRouter;n.rules().filter(it("state",t)).forEach(n.removeRule.bind(n)),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 n=this._deregisterTree(e.$$state());return this.listeners.forEach(function(t){return t("deregistered",n.map(function(t){return t.self}))}),n},t.prototype.get=function(t,e){var n=this;if(0===arguments.length)return Object.keys(this.states).map(function(t){return n.states[t].self});var r=this.matcher.find(t,e);return r&&r.self||null},t.prototype.decorator=function(t,e){return this.builder.builder(t,e)},t}(),Ze=D("/"),Xe=function(){function e(t,n,r,i){var o=this;this.config=i,this._cache={path:[this]},this._children=[],this._params=[],this._segments=[],this._compiled=[],this.pattern=t,this.config=v(this.config,{params:{},strict:!0,caseInsensitive:!1,paramMap:c});for(var a,s,u,f=/([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,h=/([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,p=[],l=0,d=function(n){if(!e.nameValidator.test(n))throw new Error("Invalid parameter name '"+n+"' in pattern '"+t+"'");if(w(o._params,it("id",n)))throw new Error("Duplicate parameter name '"+n+"' in pattern '"+t+"'")},y=function(e,r){var i=e[2]||e[3],a=r?e[4]:e[4]||("*"===e[1]?"[\\s\\S]*":null);return{id:i,regexp:a,cfg:o.config.params[i],segment:t.substring(l,e.index),type:a?n.type(a)||function(t){return Nt(n.type(r?"query":"path"),{pattern:new RegExp(t,o.config.caseInsensitive?"i":void 0)})}(a):null}};(a=f.exec(t))&&!((s=y(a,!1)).segment.indexOf("?")>=0);)d(s.id),this._params.push(r.fromPath(s.id,s.type,this.config.paramMap(s.cfg,!1))),this._segments.push(s.segment),p.push([s.segment,C(this._params)]),l=f.lastIndex;var g=(u=t.substring(l)).indexOf("?");if(g>=0){var m=u.substring(g);if(u=u.substring(0,g),m.length>0)for(l=0;a=h.exec(m);)d((s=y(a,!0)).id),this._params.push(r.fromSearch(s.id,s.type,this.config.paramMap(s.cfg,!0))),l=f.lastIndex}this._segments.push(u),this._compiled=p.map(function(t){return J.apply(null,t)}).concat(J(u))}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 S(e._segments,e._params.filter(function(e){return e.location===t.DefType.PATH}).concat(void 0)).reduce(zt,[]).filter(function(t){return""!==t&&yt(t)})},e.queryParams=function(e){return e._params.filter(function(e){return e.location===t.DefType.SEARCH})},e.compare=function(t,n){var r=function(t){return t._cache.weights=t._cache.weights||function(t){return t._cache.segments=t._cache.segments||t._cache.path.map(e.pathSegmentsAndParams).reduce(zt,[]).reduce(U,[]).map(function(t){return bt(t)?Ze(t):t}).reduce(zt,[])}(t).map(function(t){return"/"===t?1:bt(t)?2:t instanceof _e?3:void 0})},i=r(t),o=r(n);!function(t,e,n){for(var r=Math.max(t.length,e.length);t.length<r;)t.push(n);for(;e.length<r;)e.push(n)}(i,o,0);var a,s,u=S(i,o);for(s=0;s<u.length;s++)if(0!=(a=u[s][0]-u[s][1]))return a;return 0},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,n,r){function i(t){var e=function(t){return t.split("").reverse().join("")};return b(b(e(t).split(/-(?!\\)/),e),function(t){return t.replace(/\\-/g,"-")}).reverse()}var o=this;void 0===e&&(e={}),void 0===r&&(r={});var a=function(t,e,n){return t[e]=t[e]||n()}(this._cache,"pattern",function(){return new RegExp(["^",Yt(o._cache.path.map(rt("_compiled"))).join(""),!1===o.config.strict?"/?":"","$"].join(""),o.config.caseInsensitive?"i":void 0)}).exec(t);if(!a)return null;var s=this.parameters(),u=s.filter(function(t){return!t.isSearch()}),c=s.filter(function(t){return t.isSearch()}),f=this._cache.path.map(function(t){return t._segments.length-1}).reduce(function(t,e){return t+e}),h={};if(f!==a.length-1)throw new Error("Unbalanced capture group in route '"+this.pattern+"'");for(var p=0;p<f;p++){for(var l=u[p],d=a[p+1],v=0;v<l.replace.length;v++)l.replace[v].from===d&&(d=l.replace[v].to);d&&!0===l.array&&(d=i(d)),yt(d)&&(d=l.type.decode(d)),h[l.id]=l.value(d)}return c.forEach(function(t){for(var n=e[t.id],r=0;r<t.replace.length;r++)t.replace[r].from===n&&(n=t.replace[r].to);yt(n)&&(n=t.type.decode(n)),h[t.id]=t.value(n)}),n&&(h["#"]=n),h},e.prototype.parameters=function(t){return void 0===t&&(t={}),!1===t.inherit?this._params:Yt(this._cache.path.map(function(t){return t._params}))},e.prototype.parameter=function(t,e){var n=this;void 0===e&&(e={});var r=this._cache.parent;return function(){for(var e=0,r=n._params;e<r.length;e++){var i=r[e];if(i.id===t)return i}}()||!1!==e.inherit&&r&&r.parameter(t,e)||null},e.prototype.validates=function(t){t=t||{};return this.parameters().filter(function(e){return t.hasOwnProperty(e.id)}).map(function(e){return function(t,e){return!t||t.validates(e)}(e,t[e.id])}).reduce(Bt,!0)},e.prototype.format=function(t){function n(e){var n=e.value(t[e.id]),r=e.validates(n),i=e.isDefaultValue(n);return{param:e,value:n,isValid:r,isDefaultValue:i,squash:!!i&&e.squash,encoded:e.type.encode(n)}}void 0===t&&(t={});var r=this._cache.path,i=r.map(e.pathSegmentsAndParams).reduce(zt,[]).map(function(t){return bt(t)?t:n(t)}),o=r.map(e.queryParams).reduce(zt,[]).map(n);if(i.concat(o).filter(function(t){return!1===t.isValid}).length)return null;var a=i.reduce(function(t,n){if(bt(n))return t+n;var r=n.squash,i=n.encoded,o=n.param;return!0===r?t.match(/\/$/)?t.slice(0,-1):t:bt(r)?t+r:!1!==r?t:null==i?t:Rt(i)?t+b(i,e.encodeDashes).join("-"):o.raw?t+i:t+encodeURIComponent(i)},""),s=o.map(function(t){var e=t.param,n=t.squash,r=t.encoded,i=t.isDefaultValue;if(!(null==r||i&&!1!==n)&&(Rt(r)||(r=[r]),0!==r.length))return e.raw||(r=b(r,encodeURIComponent)),r.map(function(t){return e.id+"="+t})}).filter(c).reduce(zt,[]).join("&");return a+(s?"?"+s:"")+(t["#"]?"#"+t["#"]:"")},e.nameValidator=/^\w+([-.]+\w+)*(?:\[\])?$/,e}(),tn=function(){function e(){var e=this;this.paramTypes=new Le,this._isCaseInsensitive=!1,this._isStrictMode=!0,this._defaultSquashPolicy=!1,this.paramFactory={fromConfig:function(n,r,i){return new _e(n,r,i,t.DefType.CONFIG,e)},fromPath:function(n,r,i){return new _e(n,r,i,t.DefType.PATH,e)},fromSearch:function(n,r,i){return new _e(n,r,i,t.DefType.SEARCH,e)}},this._getConfig=function(t){return jt({strict:e._isStrictMode,caseInsensitive:e._isCaseInsensitive},t)},jt(this,{UrlMatcher:Xe,Param:_e})}return e.prototype.caseInsensitive=function(t){return this._isCaseInsensitive=yt(t)?t:this._isCaseInsensitive},e.prototype.strictMode=function(t){return this._isStrictMode=yt(t)?t:this._isStrictMode},e.prototype.defaultSquashPolicy=function(t){if(yt(t)&&!0!==t&&!1!==t&&!bt(t))throw new Error("Invalid squash policy: "+t+". Valid policies: false, true, arbitrary-string");return this._defaultSquashPolicy=yt(t)?t:this._defaultSquashPolicy},e.prototype.compile=function(t,e){return new Xe(t,this.paramTypes,this.paramFactory,this._getConfig(e))},e.prototype.isMatcher=function(t){if(!Et(t))return!1;var e=!0;return Vt(Xe.prototype,function(n,r){_t(n)&&(e=e&&yt(t[r])&&_t(t[r]))}),e},e.prototype.type=function(t,e,n){var r=this.paramTypes.type(t,e,n);return yt(e)?this:r},e.prototype.$get=function(){return this.paramTypes.enqueue=!1,this.paramTypes._flushTypeQueue(),this},e.prototype.dispose=function(){this.paramTypes.dispose()},e}(),en=function(){function t(t){this.router=t}return t.prototype.compile=function(t){return this.router.urlMatcherFactory.compile(t)},t.prototype.create=function(t,e){var n=this,r=s([[bt,function(t){return r(n.compile(t))}],[ct(Xe),function(t){return n.fromUrlMatcher(t,e)}],[Ct,function(t){return n.fromState(t,n.router)}],[ct(RegExp),function(t){return n.fromRegExp(t,e)}],[_t,function(t){return new nn(t,e)}]]),i=r(t);if(!i)throw new Error("invalid 'what' in when()");return i},t.prototype.fromUrlMatcher=function(t,e){var n=e;bt(e)&&(e=this.router.urlMatcherFactory.compile(e)),ct(Xe)(e)&&(n=function(t){return e.format(t)});var r={urlMatcher:t,matchPriority:function(e){var n=t.parameters().filter(function(t){return t.isOptional});return n.length?n.filter(function(t){return e[t.id]}).length/n.length:1e-6},type:"URLMATCHER"};return jt(new nn(function(e){var n=t.exec(e.path,e.search,e.hash);return t.validates(n)&&n},n),r)},t.prototype.fromState=function(t,e){var n={state:t,type:"STATE"};return jt(this.fromUrlMatcher(t.url,function(n){var r=e.stateService,i=e.globals;r.href(t,n)!==r.href(i.current,i.params)&&r.transitionTo(t,n,{inherit:!0,source:"url"})}),n)},t.prototype.fromRegExp=function(t,e){if(t.global||t.sticky)throw new Error("Rule RegExp must not be global or sticky");var n=bt(e)?function(t){return e.replace(/\$(\$|\d{1,2})/,function(e,n){return t["$"===n?0:Number(n)]})}:e,r={regexp:t,type:"REGEXP"};return jt(new nn(function(e){return t.exec(e.path)},n),r)},t.isUrlRule=function(t){return t&&["type","match","handler"].every(function(e){return yt(t[e])})},t}(),nn=function(){return function(t,e){var n=this;this.match=t,this.type="RAW",this.matchPriority=function(t){return 0-n.$id},this.handler=e||c}}();Me=function(t,e){var n=function(t,e){return(e.priority||0)-(t.priority||0)}(t,e);return 0!==n?n:0!==(n=function(t,e){var n={STATE:4,URLMATCHER:4,REGEXP:3,RAW:2,OTHER:1};return(n[t.type]||0)-(n[e.type]||0)}(t,e))?n:0!==(n=function(t,e){return t.urlMatcher&&e.urlMatcher?Xe.compare(t.urlMatcher,e.urlMatcher):0}(t,e))?n:function(t,e){var n={STATE:!0,URLMATCHER:!0};return n[t.type]&&n[e.type]?0:(t.$id||0)-(e.$id||0)}(t,e)};var rn=function(){function t(e){this._sortFn=Me,this._rules=[],this.interceptDeferred=!1,this._id=0,this._sorted=!1,this._router=e,this.urlRuleFactory=new en(e),h(ft(t.prototype),this,ft(this))}return t.prototype.dispose=function(){this.listen(!1),this._rules=[],delete this._otherwiseFn},t.prototype.sort=function(t){this._rules=this.stableSort(this._rules,this._sortFn=t||this._sortFn),this._sorted=!0},t.prototype.ensureSorted=function(){this._sorted||this.sort()},t.prototype.stableSort=function(t,e){var n=t.map(function(t,e){return{elem:t,idx:e}});return n.sort(function(t,n){var r=e(t.elem,n.elem);return 0===r?t.idx-n.idx:r}),n.map(function(t){return t.elem})},t.prototype.match=function(t){var e=this;this.ensureSorted(),t=jt({path:"",search:{},hash:""},t);var n=this.rules();this._otherwiseFn&&n.push(this._otherwiseFn);for(var r,i=function(n){var r=n.match(t,e._router);return r&&{match:r,rule:n,weight:n.matchPriority(r)}},o=0;o<n.length&&(!r||0===this._sortFn(n[o],r.rule));o++){var a=i(n[o]);r=!r||a&&a.weight>r.weight?a:r}return r},t.prototype.sync=function(t){if(!t||!t.defaultPrevented){var e=this._router,n=e.urlService,r=e.stateService,i={path:n.path(),search:n.search(),hash:n.hash()},o=this.match(i);s([[bt,function(t){return n.url(t,!0)}],[he.isDef,function(t){return r.go(t.state,t.params,t.options)}],[ct(he),function(t){return r.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,n){var r=n&&!!n.replace;this._router.urlService.url(t.format(e||{}),r)},t.prototype.href=function(t,e,n){var r=t.format(e);if(null==r)return null;n=n||{absolute:!1};var i=this._router.urlService.config,o=i.html5Mode();if(o||null===r||(r="#"+i.hashPrefix()+r),r=function(t,e,n,r){return"/"===r?t:e?Ne(r)+t:n?r.slice(1)+t:t}(r,o,n.absolute,i.baseHref()),!n.absolute||!r)return r;var a=!o&&r?"/":"",s=i.port(),u=80===s||443===s?"":":"+s;return[i.protocol(),"://",i.host(),u,a,r].join("")},t.prototype.rule=function(t){var e=this;if(!en.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){Ft(this._rules,t)},t.prototype.rules=function(){return this.ensureSorted(),this._rules.slice()},t.prototype.otherwise=function(t){var e=Q(t);this._otherwiseFn=this.urlRuleFactory.create(ft(!0),e),this._sorted=!1},t.prototype.initial=function(t){var e=Q(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,n){var r=this.urlRuleFactory.create(t,e);return yt(n&&n.priority)&&(r.priority=n.priority),this.rule(r),r},t.prototype.deferIntercept=function(t){void 0===t&&(t=!0),this.interceptDeferred=t},t}(),on=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 Ft(t._listeners,e)}}}}return t.normalizeUIViewTarget=function(t,e){void 0===e&&(e="");var n=e.split("@"),r=n[0]||"$default",i=bt(n[1])?n[1]:"^",o=/^(\^(?:\.\^)*)\.(.*$)/.exec(r);o&&(i=o[1],r=o[2]),"!"===r.charAt(0)&&(r=r.substr(1),i="");if(/^(\^(?:\.\^)*)$/.exec(i)){i=i.split(".").reduce(function(t,e){return t.parent},t).name}else"."===i&&(i=t.name);return{uiViewName:r,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 n=this._viewConfigFactories[e.$type];if(!n)throw new Error("ViewService: No view config factory registered for type "+e.$type);var r=n(t,e);return Rt(r)?r:[r]},t.prototype.deactivateViewConfig=function(t){fe.traceViewServiceEvent("<- Removing",t),Ft(this._viewConfigs,t)},t.prototype.activateViewConfig=function(t){fe.traceViewServiceEvent("-> Registering",t),this._viewConfigs.push(t)},t.prototype.sync=function(){function n(t){for(var e=t.viewDecl.$context,n=0;++n&&e.parent;)e=e.parent;return n}var r=this,i=this._uiViews.map(function(t){return[t.fqn,t]}).reduce(T,{}),o=e(function(t,e,n,r){return e*(t(n)-t(r))}),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(e){var a=r._viewConfigs.filter(t.matches(i,e));return a.length>1&&a.sort(o(n,-1)),{uiView:e,viewConfig:a[0]}}),s=a.map(function(t){return t.viewConfig}),u=this._viewConfigs.filter(function(t){return!qt(s,t)}).map(function(t){return{uiView:void 0,viewConfig:t}});a.forEach(function(t){-1!==r._uiViews.indexOf(t.uiView)&&t.uiView.configUpdated(t.viewConfig)});var c=a.concat(u);this._listeners.forEach(function(t){return t(c)}),fe.traceViewSync(c)},t.prototype.registerUIView=function(t){fe.traceViewServiceUIViewEvent("-> Registering",t);var e=this._uiViews;return e.filter(function(e){return e.fqn===t.fqn&&e.$type===t.$type}).length&&fe.traceViewServiceUIViewEvent("!!!! duplicate uiView named:",t),e.push(t),this.sync(),function(){-1!==e.indexOf(t)?(fe.traceViewServiceUIViewEvent("<- Deregistering",t),Ft(e)(t)):fe.traceViewServiceUIViewEvent("Tried removing non-registered uiView",t)}},t.prototype.available=function(){return this._uiViews.map(rt("fqn"))},t.prototype.active=function(){return this._uiViews.filter(rt("$config")).map(rt("name"))},t.matches=function(t,e){return function(n){if(e.$type!==n.viewDecl.$type)return!1;var r=n.viewDecl,i=r.$uiViewName.split("."),o=e.fqn.split(".");if(!At(i,o.slice(0-i.length)))return!1;var a=1-i.length||void 0,s=o.slice(0,a).join("."),u=t[s].creationContext;return r.$uiViewContextAnchor===(u&&u.name)}},t}(),an=function(){function t(){this.params=new Ge,this.lastStartedTransitionId=-1,this.transitionHistory=new ee([],1),this.successfulTransitions=new ee([],1)}return t.prototype.dispose=function(){this.transitionHistory.clear(),this.successfulTransitions.clear(),this.transition=null},t}(),sn=function(t){return t.reduce(function(t,e){return t[e]=Pt(e),t},{dispose:f})},un=["url","path","search","hash","onChange"],cn=["port","protocol","host","baseHref","html5Mode","hashPrefix"],fn=["type","caseInsensitive","strictMode","defaultSquashPolicy"],hn=["sort","when","initial","otherwise","rules","rule","removeRule"],pn=["deferIntercept","listen","sync","match"],ln=function(){function t(t,e){void 0===e&&(e=!0),this.router=t,this.rules={},this.config={};var n=function(){return t.locationService};h(n,this,n,un,e);var r=function(){return t.locationConfig};h(r,this.config,r,cn,e);var i=function(){return t.urlMatcherFactory};h(i,this.config,i,fn);var o=function(){return t.urlRouter};h(o,this.rules,o,hn),h(o,this,o,pn)}return t.prototype.url=function(t,e,n){},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=sn(un),t.locationConfigStub=sn(cn),t}(),dn=0,vn=function(){function t(t,e){void 0===t&&(t=ln.locationServiceStub),void 0===e&&(e=ln.locationConfigStub),this.locationService=t,this.locationConfig=e,this.$id=dn++,this._disposed=!1,this._disposables=[],this.trace=fe,this.viewService=new on,this.transitionService=new $n(this),this.globals=new an,this.urlMatcherFactory=new tn,this.urlRouter=new rn(this),this.stateRegistry=new Ke(this),this.stateService=new xn(this),this.urlService=new ln(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&&_t(t.dispose)?t.dispose(this):(this._disposed=!0,this._disposables.slice().forEach(function(t){try{"function"==typeof t.dispose&&t.dispose(e),Ft(e._disposables,t)}catch(t){}}))},t.prototype.plugin=function(t,e){void 0===e&&(e={});var n=new t(this,e);if(!n.name)throw new Error("Required property `name` missing on plugin: "+n);return this._disposables.push(n),this._plugins[n.name]=n},t.prototype.getPlugin=function(t){return t?this._plugins[t]:Gt(this._plugins)},t}(),yn=function(t){function e(e){if(e)return e instanceof he?e:bt(e)?r.target(e,t.params(),t.options()):e.state||e.params?r.target(e.state||t.to(),e.params||t.params(),t.options()):void 0}var n=t.to().redirectTo;if(n){var r=t.router.stateService;return _t(n)?Ot.$q.when(n(t)).then(e):e(n)}},gn=K("onExit"),mn=K("onRetain"),_n=K("onEnter"),wn=function(t){return new Oe(t.treeChanges().to).resolvePath("EAGER",t).then(f)},bn=function(t,e){return new Oe(t.treeChanges().to).subContext(e.$$state()).resolvePath("LAZY",t).then(f)},En=function(t){return new Oe(t.treeChanges().to).resolvePath("LAZY",t).then(f)},Rn=function(t){var e=Ot.$q,n=t.views("entering");if(n.length)return e.all(n.map(function(t){return e.when(t.load())})).then(f)},Sn=function(t){var e=t.views("entering"),n=t.views("exiting");if(e.length||n.length){var r=t.router.viewService;n.forEach(function(t){return r.deactivateViewConfig(t)}),e.forEach(function(t){return r.activateViewConfig(t)}),r.sync()}},Tn=function(t){var e=t.router.globals,n=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(n,n)},Cn=function(t){var e=t.options(),n=t.router.stateService,r=t.router.urlRouter;if("url"!==e.source&&e.location&&n.$current.navigable){var i={replace:"replace"===e.location};r.push(n.$current.navigable.url,n.params,i)}r.update(!0)},kn=function(t){var e=t.router,n=t.entering().filter(function(t){return!!t.$$state().lazyLoad}).map(function(e){return Z(t,e)});return Ot.$q.all(n).then(function(){if("url"!==t.originalTransition().options().source){var n=t.targetState();return e.stateService.target(n.identifier(),n.params(),n.options())}var r=e.urlService,i=r.match(r.parts()),o=i&&i.rule;if(o&&"STATE"===o.type){var a=o.state,s=i.match;return e.stateService.target(a,s,t.options())}e.urlService.sync()})},Pn=function(){return function(t,e,n,r,i,o,a,s){void 0===i&&(i=!1),void 0===o&&(o=le.HANDLE_RESULT),void 0===a&&(a=le.REJECT_ERROR),void 0===s&&(s=!1),this.name=t,this.hookPhase=e,this.hookOrder=n,this.criteriaMatchPath=r,this.reverseSort=i,this.getResultHandler=o,this.getErrorHandler=a,this.synchronous=s}}(),On={location:!0,relative:null,inherit:!1,notify:!0,reload:!1,custom:{},current:function(){return null},source:"unknown"},$n=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(ft(this),{},ft(this),["_definePathType","_defineEvent","_getPathTypes","_getEvents","getHooks"]),this._defineCorePaths(),this._defineCoreEvents(),this._registerCoreTransitionHooks()}return e.prototype.onCreate=function(t,e,n){},e.prototype.onBefore=function(t,e,n){},e.prototype.onStart=function(t,e,n){},e.prototype.onExit=function(t,e,n){},e.prototype.onRetain=function(t,e,n){},e.prototype.onEnter=function(t,e,n){},e.prototype.onFinish=function(t,e,n){},e.prototype.onSuccess=function(t,e,n){},e.prototype.onError=function(t,e,n){},e.prototype.dispose=function(t){Gt(this._registeredHooks).forEach(function(t){return t.forEach(function(e){e._deregistered=!0,Ft(t,e)})})},e.prototype.create=function(t,e){return new He(t,e,this._router)},e.prototype._defineCoreEvents=function(){var e=t.TransitionHookPhase,n=le,r=this._criteriaPaths;this._defineEvent("onCreate",e.CREATE,0,r.to,!1,n.LOG_REJECTED_RESULT,n.THROW_ERROR,!0),this._defineEvent("onBefore",e.BEFORE,0,r.to),this._defineEvent("onStart",e.RUN,0,r.to),this._defineEvent("onExit",e.RUN,100,r.exiting,!0),this._defineEvent("onRetain",e.RUN,200,r.retained),this._defineEvent("onEnter",e.RUN,300,r.entering),this._defineEvent("onFinish",e.RUN,400,r.to),this._defineEvent("onSuccess",e.SUCCESS,0,r.to,!1,n.LOG_REJECTED_RESULT,n.LOG_ERROR,!0),this._defineEvent("onError",e.ERROR,0,r.to,!1,n.LOG_REJECTED_RESULT,n.LOG_ERROR,!0)},e.prototype._defineCorePaths=function(){var e=t.TransitionHookScope.STATE,n=t.TransitionHookScope.TRANSITION;this._definePathType("to",n),this._definePathType("from",n),this._definePathType("exiting",e),this._definePathType("retained",e),this._definePathType("entering",e)},e.prototype._defineEvent=function(t,e,n,r,i,o,a,s){void 0===i&&(i=!1),void 0===o&&(o=le.HANDLE_RESULT),void 0===a&&(a=le.REJECT_ERROR),void 0===s&&(s=!1);var u=new Pn(t,e,n,r,i,o,a,s);this._eventTypes.push(u),I(this,this,u)},e.prototype._getEvents=function(t){return(yt(t)?this._eventTypes.filter(function(e){return e.hookPhase===t}):this._eventTypes.slice()).sort(function(t,e){var n=t.hookPhase-e.hookPhase;return 0===n?t.hookOrder-e.hookOrder:n})},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=function(t){return t.onCreate({},Y)}(this),t.ignored=function(t){return t.onBefore({},X,{priority:-9999})}(this),t.invalid=function(t){return t.onBefore({},tt,{priority:-1e4})}(this),t.redirectTo=function(t){return t.onStart({to:function(t){return!!t.redirectTo}},yn)}(this),t.onExit=function(t){return t.onExit({exiting:function(t){return!!t.onExit}},gn)}(this),t.onRetain=function(t){return t.onRetain({retained:function(t){return!!t.onRetain}},mn)}(this),t.onEnter=function(t){return t.onEnter({entering:function(t){return!!t.onEnter}},_n)}(this),t.eagerResolve=function(t){return t.onStart({},wn,{priority:1e3})}(this),t.lazyResolve=function(t){return t.onEnter({entering:ft(!0)},bn,{priority:1e3})}(this),t.resolveAll=function(t){return t.onFinish({},En,{priority:1e3})}(this),t.loadViews=function(t){return t.onFinish({},Rn)}(this),t.activateViews=function(t){return t.onSuccess({},Sn)}(this),t.updateGlobals=function(t){return t.onCreate({},Tn)}(this),t.updateUrl=function(t){return t.onSuccess({},Cn,{priority:9999})}(this),t.lazyLoad=function(t){return t.onBefore({entering:function(t){return!!t.lazyLoad}},kn)}(this)},e}(),xn=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 re?(console.error(t.toString()),t.detail&&t.detail.stack&&console.error(t.detail.stack)):console.error(t)};var n=Object.keys(e.prototype).filter(at(qt(["current","$current","params","transition"])));h(ft(e.prototype),this,ft(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(f),this.invalidCallbacks=[]},e.prototype._handleInvalidTargetState=function(t,e){function n(){var t=u.dequeue();if(void 0===t)return re.invalid(e.error()).toPromise();return Ot.$q.when(t(e,i,c)).then(f).then(function(t){return t||n()})}var r=this,i=be.makeTargetState(this.router.stateRegistry,t),o=this.router.globals,a=function(){return o.transitionHistory.peekTail()},s=a(),u=new ee(this.invalidCallbacks.slice()),c=new Oe(t).injector(),f=function(t){if(t instanceof he){var e=t;return(e=r.target(e.identifier(),e.params(),e.options())).valid()?a()!==s?re.superseded().toPromise():r.transitionTo(e.identifier(),e.params(),e.options()):re.invalid(e.error()).toPromise()}};return n()},e.prototype.onInvalid=function(t){return this.invalidCallbacks.push(t),function(){Ft(this.invalidCallbacks)(t)}.bind(this)},e.prototype.reload=function(t){return this.transitionTo(this.current,this.params,{reload:!yt(t)||t,inherit:!1,notify:!1})},e.prototype.go=function(t,e,n){var r=v(n,{relative:this.$current,inherit:!0},On);return this.transitionTo(t,e,r)},e.prototype.target=function(t,e,n){if(void 0===n&&(n={}),Et(n.reload)&&!n.reload.name)throw new Error("Invalid reload state object");var r=this.router.stateRegistry;if(n.reloadState=!0===n.reload?r.root():r.matcher.find(n.reload,n.relative),n.reload&&!n.reloadState)throw new Error("No such reload state '"+(bt(n.reload)?n.reload:n.reload.name)+"'");return new he(this.router.stateRegistry,t,e,n)},e.prototype.getCurrentPath=function(){var t=this,e=this.router.globals.successfulTransitions.peekTail();return e?e.treeChanges().to:[new we(t.router.stateRegistry.root())]},e.prototype.transitionTo=function(e,n,r){var i=this;void 0===n&&(n={}),void 0===r&&(r={});var o=this.router,a=o.globals;r=v(r,On);r=jt(r,{current:function(){return a.transition}});var s=this.target(e,n,r),u=this.getCurrentPath();if(!s.exists())return this._handleInvalidTargetState(u,s);if(!s.valid())return te(s.error());var c=function(e){return function(n){if(n instanceof re){var r=o.globals.lastStartedTransitionId===e.$id;if(n.type===t.RejectType.IGNORED)return r&&o.urlRouter.update(),Ot.$q.when(a.current);var s=n.detail;if(n.type===t.RejectType.SUPERSEDED&&n.redirected&&s instanceof he){var u=e.redirect(s);return u.run().catch(c(u))}if(n.type===t.RejectType.ABORTED)return r&&o.urlRouter.update(),Ot.$q.reject(n)}return i.defaultErrorHandler()(n),Ot.$q.reject(n)}},f=this.router.transitionService.create(u,s),h=f.run().catch(c(f));return Xt(h),jt(h,{transition:f})},e.prototype.is=function(t,e,n){n=v(n,{relative:this.$current});var r=this.router.stateRegistry.matcher.find(t,n.relative);if(yt(r)){if(this.$current!==r)return!1;if(!e)return!0;var i=r.parameters({inherit:!0,matchingKeys:e});return _e.equals(i,_e.values(i,e),this.params)}},e.prototype.includes=function(t,e,n){n=v(n,{relative:this.$current});var r=bt(t)&&ht.fromString(t);if(r){if(!r.matches(this.$current.name))return!1;t=this.$current.name}var i=this.router.stateRegistry.matcher.find(t,n.relative),o=this.$current.includes;if(yt(i)){if(!yt(o[i.name]))return!1;if(!e)return!0;var a=i.parameters({inherit:!0,matchingKeys:e});return _e.equals(a,_e.values(a,e),this.params)}},e.prototype.href=function(t,e,n){n=v(n,{lossy:!0,inherit:!0,absolute:!1,relative:this.$current}),e=e||{};var r=this.router.stateRegistry.matcher.find(t,n.relative);if(!yt(r))return null;n.inherit&&(e=this.params.$inherit(e,this.$current,r));var i=r&&n.lossy?r.navigable:r;return i&&void 0!==i.url&&null!==i.url?this.router.urlRouter.href(i.url,e,{absolute:n.absolute}):null},e.prototype.defaultErrorHandler=function(t){return this._defaultErrorHandler=t||this._defaultErrorHandler},e.prototype.get=function(t,e){var n=this.router.stateRegistry;return 0===arguments.length?n.get():n.get(t,e||this.$current)},e.prototype.lazyLoad=function(t,e){var n=this.get(t);if(!n||!n.lazyLoad)throw new Error("Can not lazy load "+t);var r=this.getCurrentPath(),i=be.makeTargetState(this.router.stateRegistry,r);return e=e||this.router.transitionService.create(r,i),Z(e,n)},e}(),Hn={when:function(t){return new Promise(function(e,n){return e(t)})},reject:function(t){return new Promise(function(e,n){n(t)})},defer:function(){var t={};return t.promise=new Promise(function(e,n){t.resolve=e,t.reject=n}),t},all:function(t){if(Rt(t))return Promise.all(t);if(Et(t)){var e=Object.keys(t).map(function(e){return t[e].then(function(t){return{key:e,val:t}})});return Hn.all(e).then(function(t){return t.reduce(function(t,e){return t[e.key]=e.val,t},{})})}}},In={},Vn=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,jn=/([^\s,]+)/g,An={get:function(t){return In[t]},has:function(t){return null!=An.get(t)},invoke:function(t,e,n){var r=jt({},In,n||{}),i=An.annotate(t),o=Kt(function(t){return r.hasOwnProperty(t)},function(t){return"DI can't find injectable: '"+t+"'"}),a=i.filter(o).map(function(t){return r[t]});return _t(t)?t.apply(e,a):t.slice(-1)[0].apply(e,a)},annotate:function(t){if(!u(t))throw new Error("Not an injectable function: "+t);if(t&&t.$inject)return t.$inject;if(Rt(t))return t.slice(0,-1);var e=t.toString().replace(Vn,"");return e.slice(e.indexOf("(")+1,e.indexOf(")")).match(jn)||[]}},Nn=function(t,e){var n=e[0],r=e[1];return t.hasOwnProperty(n)?Rt(t[n])?t[n].push(r):t[n]=[t[n],r]:t[n]=r,t},qn=function(t){return t.split("&").filter(c).map(De).reduce(Nn,{})},Fn=function(t){var e=t.path(),n=t.search(),r=t.hash(),i=Object.keys(n).map(function(t){var e=n[t];return(Rt(e)?e:[e]).map(function(e){return t+"="+e})}).reduce(zt,[]).join("&");return e+(i?"?"+i:"")+(r?"#"+r:"")},Dn=function(){function t(t,e){var n=this;this.fireAfterUpdate=e,this._listeners=[],this._listener=function(t){return n._listeners.forEach(function(e){return e(t)})},this.hash=function(){return et(n._get()).hash},this.path=function(){return et(n._get()).path},this.search=function(){return qn(et(n._get()).search)},this._location=$t.location,this._history=$t.history}return t.prototype.url=function(t,e){return void 0===e&&(e=!0),yt(t)&&t!==this._get()&&(this._set(null,null,t,e),this.fireAfterUpdate&&this._listeners.forEach(function(e){return e({url:t})})),Fn(this)},t.prototype.onChange=function(t){var e=this;return this._listeners.push(t),function(){return Ft(e._listeners,t)}},t.prototype.dispose=function(t){Ut(this._listeners)},t}(),Un=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ln=function(t){function e(e){var n=t.call(this,e,!1)||this;return $t.addEventListener("hashchange",n._listener,!1),n}return Un(e,t),e.prototype._get=function(){return Ue(this._location.hash)},e.prototype._set=function(t,e,n,r){this._location.hash=n},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),$t.removeEventListener("hashchange",this._listener)},e}(Dn),Mn=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Gn=function(t){function e(e){return t.call(this,e,!0)||this}return Mn(e,t),e.prototype._get=function(){return this._url},e.prototype._set=function(t,e,n,r){this._url=n},e}(Dn),Bn=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Wn=function(t){function e(e){var n=t.call(this,e,!0)||this;return n._config=e.urlService.config,$t.addEventListener("popstate",n._listener,!1),n}return Bn(e,t),e.prototype._getBasePrefix=function(){return Ne(this._config.baseHref())},e.prototype._get=function(){var t=this._location,e=t.pathname,n=t.hash,r=t.search;r=Fe(r)[1],n=qe(n)[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)+(r?"?"+r:"")+(n?"#"+n:"")},e.prototype._set=function(t,e,n,r){var i=this._getBasePrefix(),o=n&&"/"!==n[0]?"/":"",a=""===n||"/"===n?this._config.baseHref():i+o+n;r?this._history.replaceState(t,e,a):this._history.pushState(t,e,a)},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),$t.removeEventListener("popstate",this._listener)},e}(Dn),zn=function(){return function(){var t=this;this.dispose=f,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 yt(e)?t._hashPrefix=e:t._hashPrefix}}}(),Jn=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 yt(t)?this._hashPrefix=t:this._hashPrefix},t.prototype.baseHref=function(t){return yt(t)?this._baseHref=t:yt(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}(),Qn=nt("vanilla.hashBangLocation",!1,Ln,Jn),Yn=nt("vanilla.pushStateLocation",!0,Wn,Jn),Kn=nt("vanilla.memoryLocation",!1,Gn,zn),Zn=function(){function t(){}return t.prototype.dispose=function(t){},t}();t.root=$t,t.fromJson=Ht,t.toJson=It,t.forEach=Vt,t.extend=jt,t.equals=At,t.identity=c,t.noop=f,t.createProxyFunctions=h,t.inherit=Nt,t.inArray=qt,t._inArray=p,t.removeFrom=Ft,t._removeFrom=l,t.pushTo=Dt,t._pushTo=d,t.deregAll=Ut,t.defaults=v,t.mergeR=Lt,t.ancestors=y,t.pick=g,t.omit=m,t.pluck=function(t,e){return b(t,rt(e))},t.filter=_,t.find=w,t.mapObj=Mt,t.map=b,t.values=Gt,t.allTrueR=Bt,t.anyTrueR=Wt,t.unnestR=zt,t.flattenR=Jt,t.pushR=E,t.uniqR=Qt,t.unnest=Yt,t.flatten=function(t){return t.reduce(Jt,[])},t.assertPredicate=Kt,t.assertMap=Zt,t.assertFn=R,t.pairs=function(t){return Object.keys(t).map(function(e){return[e,t[e]]})},t.arrayTuples=S,t.applyPairs=T,t.tail=C,t.copy=k,t._extend=P,t.silenceUncaughtInPromise=Xt,t.silentRejection=te,t.notImplemented=Pt,t.services=Ot,t.Glob=ht,t.curry=e,t.compose=n,t.pipe=r,t.prop=rt,t.propEq=it,t.parse=ot,t.not=at,t.and=i,t.or=o,t.all=st,t.any=ut,t.is=ct,t.eq=function(t){return function(e){return t===e}},t.val=ft,t.invoke=a,t.pattern=s,t.isUndefined=vt,t.isDefined=yt,t.isNull=gt,t.isNullOrUndefined=mt,t.isFunction=_t,t.isNumber=wt,t.isString=bt,t.isObject=Et,t.isArray=Rt,t.isDate=St,t.isRegExp=Tt,t.isState=Ct,t.isInjectable=u,t.isPromise=kt,t.Queue=ee,t.maxLength=j,t.padString=A,t.kebobString=function(t){return t.replace(/^([A-Z])/,function(t){return t.toLowerCase()}).replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})},t.functionToString=N,t.fnToString=q,t.stringify=F,t.beforeAfterSubstr=je,t.hostRegex=Ae,t.stripLastPathElement=Ne,t.splitHash=qe,t.splitQuery=Fe,t.splitEqual=De,t.trimHashVal=Ue,t.splitOnDelim=D,t.joinNeighborsR=U,t.Trace=ce,t.trace=fe,t.Param=_e,t.ParamTypes=Le,t.StateParams=Ge,t.ParamType=ye,t.PathNode=we,t.PathUtils=be,t.resolvePolicies=Se,t.defaultResolvePolicy=Ee,t.Resolvable=Re,t.NATIVE_INJECTOR_TOKEN=Pe,t.ResolveContext=Oe,t.resolvablesBuilder=z,t.StateBuilder=Je,t.StateObject=pt,t.StateMatcher=Qe,t.StateQueueManager=Ye,t.StateRegistry=Ke,t.StateService=xn,t.TargetState=he,t.HookBuilder=ve,t.matchState=H,t.RegisteredHook=de,t.makeEvent=I,t.Rejection=re,t.Transition=He,t.TransitionHook=le,t.TransitionEventType=Pn,t.defaultTransOpts=On,t.TransitionService=$n,t.UrlMatcher=Xe,t.UrlMatcherFactory=tn,t.UrlRouter=rn,t.UrlRuleFactory=en,t.BaseUrlRule=nn,t.UrlService=ln,t.ViewService=on,t.UIRouterGlobals=an,t.UIRouter=vn,t.$q=Hn,t.$injector=An,t.BaseLocationServices=Dn,t.HashLocationService=Ln,t.MemoryLocationService=Gn,t.PushStateLocationService=Wn,t.MemoryLocationConfig=zn,t.BrowserLocationConfig=Jn,t.keyValsToObjectR=Nn,t.getParams=qn,t.parseUrl=et,t.buildUrl=Fn,t.locationPluginFactory=nt,t.servicesPlugin=function(t){return Ot.$injector=An,Ot.$q=Hn,{name:"vanilla.services",$q:Hn,$injector:An,dispose:function(){return null}}},t.hashLocationPlugin=Qn,t.pushStateLocationPlugin=Yn,t.memoryLocationPlugin=Kn,t.UIRouterPluginBase=Zn,Object.defineProperty(t,"__esModule",{value:!0})});
  //# sourceMappingURL=ui-router-core.min.js.map
  