!function(t,e){"object"==typeofexports&&"undefined"!=typeofmodule?e(exports,require("angular")):"function"==typeofdefine&&define.amd?define(["exports","angular"],e):e(t["@uirouter/angularjs"]=t["@uirouter/angularjs"]||{},t.angular)}(this,function(t,e){"use strict";functionr(t){functione(r){returnr.length>=n?t.apply(null,r):function(){returne(r.concat([].slice.apply(arguments)))}}varr=[].slice.apply(arguments,[1]),n=t.length;returne(r)}functionn(){vart=arguments,e=t.length-1;returnfunction(){for(varr=e,n=t[e].apply(this,arguments);r--;)n=t[r].call(this,n);returnn}}functioni(){for(vart=[],e=0;e<arguments.length;e++)t[e]=arguments[e];returnn.apply(null,[].slice.call(arguments).reverse())}functiono(t,e){returnfunction(){for(varr=[],n=0;n<arguments.length;n++)r[n]=arguments[n];returnt.apply(null,r)&&e.apply(null,r)}}functiona(t,e){returnfunction(){for(varr=[],n=0;n<arguments.length;n++)r[n]=arguments[n];returnt.apply(null,r)||e.apply(null,r)}}functionu(t,e){returnfunction(r){returnr[t].apply(r,e)}}functions(t){returnfunction(e){for(varr=0;r<t.length;r++)if(t[r][0](e))returnt[r][1](e)}}functionc(t){if(re(t)&&t.length){vare=t.slice(0,-1),r=t.slice(-1);return!(e.filter(Dt(te)).length||r.filter(Dt(Zt)).length)}returnZt(t)}functionf(t){returnt}functionl(){}functionh(t,e,r,n,i){void0===i&&(i=!1);varo=function(e){returnt()[e].bind(r())},a=function(t){returnfunction(){returne[t]=o(t),e[t].apply(null,arguments)}};returnn=n||Object.keys(t()),n.reduce(function(t,e){returnt[e]=i?a(e):o(e),t},e)}functionp(t,e){return-1!==t.indexOf(e)}functiond(t,e){varr=t.indexOf(e);returnr>=0&&t.splice(r,1),t}functionv(t,e){returnt.push(e),e}functionm(t){for(vare=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];varn=e.concat({}).reverse(),i=ve.apply(null,n);returnve({},i,g(t||{},Object.keys(i)))}functiony(t,e){varr=[];for(varnint.path){if(t.path[n]!==e.path[n])break;r.push(t.path[n])}returnr}functiong(t,e){varr={};for(varnint)-1!==e.indexOf(n)&&(r[n]=t[n]);returnr}functionw(t,e){returnObject.keys(t).filter(Dt(ge(e))).reduce(function(e,r){returne[r]=t[r],e},{})}function_(t,e){returnb(t,At(e))}function$(t,e){varr=re(t),n=r?[]:{},i=r?function(t){returnn.push(t)}:function(t,e){returnn[e]=t};returnde(t,function(t,r){e(t,r)&&i(t,r)}),n}functionS(t,e){varr;returnde(t,function(t,n){r||e(t,n)&&(r=t)}),r}functionb(t,e){varr=re(t)?[]:{};returnde(t,function(t,n){returnr[n]=e(t,n)}),r}functionR(t,e){returnt.push(e),t}functionE(t,e){returnvoid0===e&&(e="assert failure"),function(r){varn=t(r);if(!n)thrownewError(Zt(e)?e(r):e);returnn}}functionT(){for(vart=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)return[];varr,n=t.reduce(function(t,e){returnMath.min(e.length,t)},9007199254740991),i=[];for(r=0;r<n;r++)switch(t.length){case1:i.push([t[0][r]]);break;case2:i.push([t[0][r],t[1][r]]);break;case3:i.push([t[0][r],t[1][r],t[2][r]]);break;case4:i.push([t[0][r],t[1][r],t[2][r],t[3][r]]);break;default:i.push(t.map(function(t){returnt[r]}))}returni}functionC(t,e){varr,n;if(re(e)&&(r=e[0],n=e[1]),!te(r))thrownewError("invalid parameters to applyPairs");returnt[r]=n,t}functionP(t){returnt.length&&t[t.length-1]||void0}functionk(t,e){returne&&Object.keys(e).forEach(function(t){returndeletee[t]}),e||(e={}),ve(e,t)}functionO(t,e,r){if(re(t))returnt.forEach(e,r);Object.keys(t).forEach(function(r){returne(t[r],r)})}functionx(t){for(vare=1;e<arguments.length;e++){varr=arguments[e];if(r)for(varn=Object.keys(r),i=0;i<n.length;i++)t[n[i]]=r[n[i]]}returnt}functionj(t,e){if(t===e)return!0;if(null===t||null===e)return!1;if(t!==t&&e!==e)return!0;varr=typeoft;if(r!==typeofe||"object"!==r)return!1;varn=[t,e];if(Nt(re)(n))returnI(t,e);if(Nt(ne)(n))returnt.getTime()===e.getTime();if(Nt(ie)(n))returnt.toString()===e.toString();if(Nt(Zt)(n))return!0;if([Zt,re,ne,ie].map(Ft).reduce(function(t,e){returnt||!!e(n)},!1))return!1;vari,o={};for(iint){if(!j(t[i],e[i]))return!1;o[i]=!0}for(iine)if(!o[i])return!1;return!0}functionI(t,e){returnt.length=
varn=e.hookPhase===t.TransitionHookPhase.CREATE,i=this.transition.router.transitionService;return(n?[i]:[this.transition,i]).map(function(t){returnt.getHooks(e.name)}).filter(je(re,"broken event named: "+e.name)).reduce(Ce,[]).filter(function(t){returnt.matches(r)})},e}(),Ye=function(){functiont(t){this.pattern=/.*/,this.inherit=!0,ve(this,t)}returnt.prototype.is=function(t,e){return!0},t.prototype.encode=function(t,e){returnt},t.prototype.decode=function(t,e){returnt},t.prototype.equals=function(t,e){returnt==e},t.prototype.$subPattern=function(){vart=this.pattern.toString();returnt.substr(1,t.length-2)},t.prototype.toString=function(){return"{ParamType:"+this.name+"}"},t.prototype.$normalize=function(t){returnthis.is(t)?t:this.decode(t)},t.prototype.$asArray=function(t,e){if(!t)returnthis;if("auto"===t&&!e)thrownewError("'auto' array mode is for query parameters only");returnnewN(this,t)},t}(),Ze=Object.prototype.hasOwnProperty,Xe=function(t){return0===["value","type","squash","array","dynamic"].filter(Ze.bind(t||{})).length};!function(t){t[t.PATH=0]="PATH",t[t.SEARCH=1]="SEARCH",t[t.CONFIG=2]="CONFIG"}(t.DefType||(t.DefType={}));vartr=function(){functione(e,r,n,i,o){n=F(n),r=U(n,r,i,e,o.paramTypes);vara=function(){varr={array:i===t.DefType.SEARCH&&"auto"},o=e.match(/\[\]$/)?{array:!0}:{};returnve(r,o,n).array}();r=a?r.$asArray(a,i===t.DefType.SEARCH):r;varu=void0!==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),h=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:h,array:a,config:n})}returne.prototype.isDefaultValue=function(t){returnthis.isOptional&&this.type.equals(this.value(),t)},e.prototype.value=function(t){vare=this;returnt=function(t){for(varr=0,n=e.replace;r<n.length;r++){vari=n[r];if(i.from===t)returni.to}returnt}(t),Jt(t)?function(){if(e._defaultValueCache)returne._defaultValueCache.defaultValue;if(!se.$injector)thrownewError("Injectable functions cannot be called at configuration time");vart=se.$injector.invoke(e.config.$$fn);if(null!==t&&void0!==t&&!e.type.is(t))thrownewError("Default value ("+t+") for parameter '"+e.id+"' is not an instance of ParamType ("+e.type.name+")");returne.config.$$fn.__cacheable&&(e._defaultValueCache={defaultValue:t}),t}():this.type.$normalize(t)},e.prototype.isSearch=function(){returnthis.location===t.DefType.SEARCH},e.prototype.validates=function(t){if((Jt(t)||null===t)&&this.isOptional)return!0;vare=this.type.$normalize(t);if(!this.type.is(e))return!1;varr=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){void0===e&&(e={});for(varr={},n=0,i=t;n<i.length;n++){varo=i[n];r[o.id]=o.value(e[o.id])}returnr},e.changed=function(t,e,r){returnvoid0===e&&(e={}),void0===r&&(r={}),t.filter(function(t){return!t.type.equals(e[t.id],r[t.id])})},e.equals=function(t,r,n){returnvoid0===r&&(r={}),void0===n&&(n={}),0===e.changed(t,r,n).length},e.validates=function(t,e){returnvoid0===e&&(e={}),t.map(function(t){returnt.validates(e[t.id])}).reduce(Ee,!0)},e}(),er=function(){functiont(e){if(einstanceoft){varr=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{varn=e;this.state=n,this.paramSchema=n.parameters({inherit:!1}),this.paramValues={},this.resolvables=n.resolvables.map(function(t){returnt.clone()})}}returnt.prototype.applyRawParams=function(t){vare=function(e){return[e.id,e.value(t[e.id])]};returnthis.paramValues=this.paramSchema.reduce(function(t,r){returnC(t,e(r))},{}),this},t.prototype.parameter=function(t){returnS(this.paramSchema,Ht("id",t))},t.prototype.equals=function(t,e){varr=this.diff(t,e);returnr&&0===r.length},t.prototype.diff=function(t,e){if(this.stat
returnnewtr(r,n,i,t.DefType.PATH,e)},fromSearch:function(r,n,i){returnnewtr(r,n,i,t.DefType.SEARCH,e)}},ve(this,{UrlMatcher:Or,Param:tr})}returne.prototype.caseInsensitive=function(t){returnthis._isCaseInsensitive=Qt(t)?t:this._isCaseInsensitive},e.prototype.strictMode=function(t){returnthis._isStrictMode=Qt(t)?t:this._isStrictMode},e.prototype.defaultSquashPolicy=function(t){if(Qt(t)&&!0!==t&&!1!==t&&!te(t))thrownewError("Invalid squash policy: "+t+". Valid policies: false, true, arbitrary-string");returnthis._defaultSquashPolicy=Qt(t)?t:this._defaultSquashPolicy},e.prototype.compile=function(t,e){returnnewOr(t,this.paramTypes,this.paramFactory,this._getConfig(e))},e.prototype.isMatcher=function(t){if(!ee(t))return!1;vare=!0;returnde(Or.prototype,function(r,n){Zt(r)&&(e=e&&Qt(t[n])&&Zt(t[n]))}),e},e.prototype.type=function(t,e,r){varn=this.paramTypes.type(t,e,r);returnQt(e)?this:n},e.prototype.$get=function(){returnthis.paramTypes.enqueue=!1,this.paramTypes._flushTypeQueue(),this},e.prototype.dispose=function(){this.paramTypes.dispose()},e}(),jr=function(){functiont(t){this.router=t}returnt.prototype.compile=function(t){returnthis.router.urlMatcherFactory.compile(t)},t.prototype.create=function(t,e){varr=this,n=s([[te,function(t){returnn(r.compile(t))}],[Ut(Or),function(t){returnr.fromUrlMatcher(t,e)}],[oe,function(t){returnr.fromState(t,r.router)}],[Ut(RegExp),function(t){returnr.fromRegExp(t,e)}],[Zt,function(t){returnnewIr(t,e)}]]),i=n(t);if(!i)thrownewError("invalid 'what' in when()");returni},t.prototype.fromUrlMatcher=function(t,e){functionr(e){varr=t.exec(e.path,e.search,e.hash);returnt.validates(r)&&r}functionn(e){varr=t.parameters().filter(function(t){returnt.isOptional});returnr.length?r.filter(function(t){returne[t.id]}).length/r.length:1e-6}vari=e;te(e)&&(e=this.router.urlMatcherFactory.compile(e)),Ut(Or)(e)&&(i=function(t){returne.format(t)});varo={urlMatcher:t,matchPriority:n,type:"URLMATCHER"};returnve(newIr(r,i),o)},t.prototype.fromState=function(t,e){varr=function(r){varn=e.stateService,i=e.globals;n.href(t,r)!==n.href(i.current,i.params)&&n.transitionTo(t,r,{inherit:!0,source:"url"})},n={state:t,type:"STATE"};returnve(this.fromUrlMatcher(t.url,r),n)},t.prototype.fromRegExp=function(t,e){if(t.global||t.sticky)thrownewError("Rule RegExp must not be global or sticky");varr=function(t){returne.replace(/\$(\$|\d{1,2})/,function(e,r){returnt["$"===r?0:Number(r)]})},n=te(e)?r:e,i=function(e){returnt.exec(e.path)},o={regexp:t,type:"REGEXP"};returnve(newIr(i,n),o)},t.isUrlRule=function(t){returnt&&["type","match","handler"].every(function(e){returnQt(t[e])})},t}(),Ir=function(){functiont(t,e){varr=this;this.match=t,this.type="RAW",this.matchPriority=function(t){return0-r.$id},this.handler=e||f}returnt}(),Vr=function(t,e){return(e.priority||0)-(t.priority||0)},Ar=function(t,e){varr={STATE:4,URLMATCHER:4,REGEXP:3,RAW:2,OTHER:1};return(r[t.type]||0)-(r[e.type]||0)},Hr=function(t,e){returnt.urlMatcher&&e.urlMatcher?Or.compare(t.urlMatcher,e.urlMatcher):0},qr=function(t,e){varr={STATE:!0,URLMATCHER:!0};returnr[t.type]&&r[e.type]?0:(t.$id||0)-(e.$id||0)};gr=function(t,e){varr=Vr(t,e);return0!==r?r:0!==(r=Ar(t,e))?r:(r=Hr(t,e),0!==r?r:qr(t,e))};varDr=function(){functiont(e){this._sortFn=gr,this._rules=[],this.interceptDeferred=!1,this._id=0,this._sorted=!1,this._router=e,this.urlRuleFactory=newjr(e),h(Mt(t.prototype),this,Mt(this))}returnt.prototype.dispose=function(){this.listen(!1),this._rules=[],deletethis._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){varr=t.map(function(t,e){return{elem:t,idx:e}});returnr.sort(function(t,r){varn=e(t.elem,r.elem);return0===n?t.idx-r.idx:n}),r.map(function(t){returnt.elem})},t.prototype.match=function(t){vare=this;this.ensureSorted(),t=ve({path:"",search:{},hash:""},t);varr=this.rules();this._otherwiseFn&&r.push(this._otherw