Files
ionic-framework/config/lib/js/angular-ui/angular-ui-router.min.js
2014-11-16 23:12:53 -06:00

9 lines
20 KiB
JavaScript

/**
* State-based routing for AngularJS
* @version v0.2.10
* Ionic fork, updated for Angular v1.3
* @link http://angular-ui.github.com/
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(r,t,e){"use strict";function n(r,t){return R(new(R(function(){},{prototype:r})),t)}function o(r){return M(arguments,function(t){t!==r&&M(t,function(t,e){r.hasOwnProperty(e)||(r[e]=t)})}),r}function i(r,t){var e=[];for(var n in r.path){if(r.path[n]!==t.path[n])break;e.push(r.path[n])}return e}function a(r,t){if(Array.prototype.indexOf)return r.indexOf(t,+arguments[2]||0);var e=r.length>>>0,n=+arguments[2]||0;for(n=0>n?Math.ceil(n):Math.floor(n),0>n&&(n+=e);e>n;n++)if(n in r&&r[n]===t)return n;return-1}function u(r,t,e,n){var o,u=i(e,n),l={},s=[];for(var c in u)if(u[c].params&&u[c].params.length){o=u[c].params;for(var f in o)a(s,o[f])<0&&(s.push(o[f]),l[o[f]]=r[o[f]])}return R({},l,t)}function l(r,t){var e={};return M(r,function(r){var n=t[r];e[r]=null!=n?n+"":null}),e}function s(r,t,e){if(!e){e=[];for(var n in r)e.push(n)}for(var o=0;o<e.length;o++){var i=e[o];if(r[i]!=t[i])return!1}return!0}function c(r,t){var e={};return M(r,function(r){e[r]=t[r]}),e}function f(r,t){var n=1,i=2,a={},u=[],l=a,s=R(r.when(a),{$$promises:a,$$values:a});this.study=function(a){function c(r,e){if(p[e]!==i){if($.push(e),p[e]===n)throw $.splice(0,$.indexOf(e)),Error("Cyclic dependency: "+$.join(" -> "));if(p[e]=n,I(r))h.push(e,[function(){return t.get(r)}],u);else{var o=t.annotate(r);M(o,function(r){r!==e&&a.hasOwnProperty(r)&&c(a[r],r)}),h.push(e,r,o)}$.pop(),p[e]=i}}function f(r){return V(r)&&r.then&&r.$$promises}if(!V(a))throw Error("'invocables' must be an object");var h=[],$=[],p={};return M(a,c),a=$=p=null,function(n,i,a){function u(){--g||(w||o(d,i.$$values),v.$$values=d,v.$$promises=!0,p.resolve(d))}function c(r){v.$$failure=r,p.reject(r)}function $(e,o,i){function l(r){f.reject(r),c(r)}function s(){if(!O(v.$$failure))try{f.resolve(t.invoke(o,a,d)),f.promise.then(function(r){d[e]=r,u()},l)}catch(r){l(r)}}var f=r.defer(),h=0;M(i,function(r){m.hasOwnProperty(r)&&!n.hasOwnProperty(r)&&(h++,m[r].then(function(t){d[r]=t,--h||s()},l))}),h||s(),m[e]=f.promise}if(f(n)&&a===e&&(a=i,i=n,n=null),n){if(!V(n))throw Error("'locals' must be an object")}else n=l;if(i){if(!f(i))throw Error("'parent' must be a promise returned by $resolve.resolve()")}else i=s;var p=r.defer(),v=p.promise,m=v.$$promises={},d=R({},n),g=1+h.length/3,w=!1;if(O(i.$$failure))return c(i.$$failure),v;i.$$values?(w=o(d,i.$$values),u()):(R(m,i.$$promises),i.then(u,c));for(var b=0,y=h.length;y>b;b+=3)n.hasOwnProperty(h[b])?u():$(h[b],h[b+1],h[b+2]);return v}},this.resolve=function(r,t,e,n){return this.study(r)(t,e,n)}}function h(r,t,e){this.fromConfig=function(r,t,e){return O(r.template)?this.fromString(r.template,t):O(r.templateUrl)?this.fromUrl(r.templateUrl,t):O(r.templateProvider)?this.fromProvider(r.templateProvider,t,e):null},this.fromString=function(r,t){return A(r)?r(t):r},this.fromUrl=function(e,n){return A(e)&&(e=e(n)),null==e?null:r.get(e,{cache:t}).then(function(r){return r.data})},this.fromProvider=function(r,t,n){return e.invoke(r,null,n||{params:t})}}function $(r){function t(t){if(!/^\w+(-+\w+)*$/.test(t))throw Error("Invalid parameter name '"+t+"' in pattern '"+r+"'");if(i[t])throw Error("Duplicate parameter name '"+t+"' in pattern '"+r+"'");i[t]=!0,s.push(t)}function e(r){return r.replace(/[\\\[\]\^$*+?.()|{}]/g,"\\$&")}var n,o=/([:*])(\w+)|\{(\w+)(?:\:((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,i={},a="^",u=0,l=this.segments=[],s=this.params=[];this.source=r;for(var c,f,h;(n=o.exec(r))&&(c=n[2]||n[3],f=n[4]||("*"==n[1]?".*":"[^/]*"),h=r.substring(u,n.index),h.indexOf("?")<0);)a+=e(h)+"("+f+")",t(c),l.push(h),u=o.lastIndex;h=r.substring(u);var $=h.indexOf("?");if($<0)this.sourcePath=r,this.sourceSearch="";else{var p=this.sourceSearch=h.substring($);h=h.substring(0,$),this.sourcePath=r.substring(0,u+$),M(p.substring(1).split(/[&?]/),t)}a+=e(h)+"$",l.push(h),this.regexp=RegExp(a),this.prefix=l[0]}function p(){this.compile=function(r){return new $(r)},this.isMatcher=function(r){return V(r)&&A(r.exec)&&A(r.format)&&A(r.concat)},this.$get=function(){return this}}function v(r){function t(r){var t=/^\^((?:\\[^a-zA-Z0-9]|[^\\\[\]\^$*+?.()|{}]+)*)/.exec(r.source);return null!=t?t[1].replace(/\\(.)/g,"$1"):""}function e(r,t){return r.replace(/\$(\$|\d{1,2})/,function(r,e){return t["$"===e?0:+e]})}function n(r,t,e){if(!e)return!1;var n=r.invoke(t,t,{$match:e});return O(n)?n:!0}var o=[],i=null;this.rule=function(r){if(!A(r))throw Error("'rule' must be a function");return o.push(r),this},this.otherwise=function(r){if(I(r)){var t=r;r=function(){return t}}else if(!A(r))throw Error("'rule' must be a function");return i=r,this},this.when=function(o,i){var a,u=I(i);if(I(o)&&(o=r.compile(o)),!u&&!A(i)&&!k(i))throw Error("invalid 'handler' in when()");var l={matcher:function(t,e){return u&&(a=r.compile(e),e=["$match",function(r){return a.format(r)}]),R(function(r,o){return n(r,e,t.exec(o.path(),o.search()))},{prefix:I(t.prefix)?t.prefix:""})},regex:function(r,o){if(r.global||r.sticky)throw Error("when() RegExp must not be global or sticky");return u&&(a=o,o=["$match",function(r){return e(a,r)}]),R(function(t,e){return n(t,o,r.exec(e.path()))},{prefix:t(r)})}},s={matcher:r.isMatcher(o),regex:o instanceof RegExp};for(var c in s)if(s[c])return this.rule(l[c](o,i));throw Error("invalid 'what' in when()")},this.$get=["$location","$rootScope","$injector","$log",function(r,t,e,n){function a(t){function a(t){var n=t(e,r);return n?(I(n)&&r.replace().url(n),!0):!1}if(!t||!t.defaultPrevented){var u,l=o.length;for(u=0;l>u;u++)if(a(o[u]))return;r.$$path&&"/"!==r.$$path&&n.warn("Routing: No route matched for",r.$$path+". Check your Ionic route definitions."),i&&a(i)}}return t.$on("$locationChangeSuccess",a),{sync:function(){a()}}}]}function m(r,o,i){function a(r){return 0===r.indexOf(".")||0===r.indexOf("^")}function f(r,t){var n=I(r),o=n?r:r.name,i=a(o);if(i){if(!t)throw Error("No reference point given for path '"+o+"'");for(var u=o.split("."),l=0,s=u.length,c=t;s>l;l++)if(""!==u[l]||0!==l){if("^"!==u[l])break;if(!c.parent)throw Error("Path '"+o+"' not valid for state '"+t.name+"'");c=c.parent}else c=t;u=u.slice(l).join("."),o=c.name+(c.name&&u?".":"")+u}var f=x[o];return!f||!n&&(n||f!==r&&f.self!==r)?e:f}function h(r,t){E[r]||(E[r]=[]),E[r].push(t)}function $(t){t=n(t,{self:t,resolve:t.resolve||{},toString:function(){return this.name}});var e=t.name;if(!I(e)||e.indexOf("@")>=0)throw Error("State must have a valid name");if(x.hasOwnProperty(e))throw Error("State '"+e+"'' is already defined");var o=-1!==e.indexOf(".")?e.substring(0,e.lastIndexOf(".")):I(t.parent)?t.parent:"";if(o&&!x[o])return h(o,t.self);for(var i in S)A(S[i])&&(t[i]=S[i](t,S.$delegates[i]));if(x[e]=t,!t[P]&&t.url&&r.when(t.url,["$match","$stateParams",function(r,e){y.$current.navigable==t&&s(r,e)||y.transitionTo(t,r,{location:!1})}]),E[e])for(var a=0;a<E[e].length;a++)$(E[e][a]);return t}function p(r){return r.indexOf("*")>-1}function v(r){var t=r.split("."),e=y.$current.name.split(".");if("**"===t[0]&&(e=e.slice(e.indexOf(t[1])),e.unshift("**")),"**"===t[t.length-1]&&(e.splice(e.indexOf(t[t.length-2])+1,Number.MAX_VALUE),e.push("**")),t.length!=e.length)return!1;for(var n=0,o=t.length;o>n;n++)"*"===t[n]&&(e[n]="*");return e.join("")===t.join("")}function m(r,t){return I(r)&&!O(t)?S[r]:A(t)&&I(r)?(S[r]&&!S.$delegates[r]&&(S.$delegates[r]=S[r]),S[r]=t,this):this}function d(r,t){return V(r)?t=r:t.name=r,$(t),this}function g(r,o,a,h,$,m,d,g,E){function S(){d.url()!==D&&(d.url(D),d.replace())}function j(r,e,n,i,u){var l=n?e:c(r.params,e),s={$stateParams:l};u.resolve=$.resolve(r.resolve,s,u.resolve,r);var f=[u.resolve.then(function(r){u.globals=r})];return i&&f.push(i),M(r.views,function(e,n){var o=e.resolve&&e.resolve!==r.resolve?e.resolve:{};o.$template=[function(){return a.load(n,{view:e,locals:s,params:l,notify:!1})||""}],f.push($.resolve(o,s,u.resolve,r).then(function(i){if(A(e.controllerProvider)||k(e.controllerProvider)){var a=t.extend({},o,s);i.$$controller=h.invoke(e.controllerProvider,null,a)}else i.$$controller=e.controller;i.$$state=r,i.$$controllerAs=e.controllerAs,u[n]=i}))}),o.all(f).then(function(){return u})}var C=o.reject(Error("transition superseded")),U=o.reject(Error("transition prevented")),F=o.reject(Error("transition aborted")),T=o.reject(Error("transition failed")),D=d.url(),q=E.baseHref();return b.locals={resolve:null,globals:{$stateParams:{}}},y={params:{},current:b.self,$current:b,transition:null},y.reload=function(){y.transitionTo(y.current,m,{reload:!0,inherit:!1,notify:!1})},y.go=function(r,t,e){return this.transitionTo(r,t,R({inherit:!0,relative:y.$current},e))},y.transitionTo=function(t,e,i){e=e||{},i=R({location:!0,inherit:!1,relative:null,notify:!0,reload:!1,$retry:!1},i||{});var a,c=y.$current,$=y.params,p=c.path,v=f(t,i.relative);if(!O(v)){var g={to:t,toParams:e,options:i};if(a=r.$broadcast("$stateNotFound",g,c.self,$),a.defaultPrevented)return S(),F;if(a.retry){if(i.$retry)return S(),T;var x=y.transition=o.when(a.retry);return x.then(function(){return x!==y.transition?C:(g.options.$retry=!0,y.transitionTo(g.to,g.toParams,g.options))},function(){return F}),S(),x}if(t=g.to,e=g.toParams,i=g.options,v=f(t,i.relative),!O(v)){if(i.relative)throw Error("Could not resolve '"+t+"' from state '"+i.relative+"'");throw Error("No such state '"+t+"'")}}if(v[P])throw Error("Cannot transition to abstract state '"+t+"'");i.inherit&&(e=u(m,e||{},y.$current,v)),t=v;var E,A,I=t.path,V=b.locals,k=[];for(E=0,A=I[E];A&&A===p[E]&&s(e,$,A.ownParams)&&!i.reload;E++,A=I[E])V=k[E]=A.locals;if(w(t,c,V,i))return t.self.reloadOnSearch!==!1&&S(),y.transition=null,o.when(y.current);if(e=l(t.params,e||{}),i.notify&&(a=r.$broadcast("$stateChangeStart",t.self,e,c.self,$),a.defaultPrevented))return S(),U;for(var M=o.when(V),q=E;q<I.length;q++,A=I[q])V=k[q]=n(V),M=j(A,e,A===t,M,V);var L=y.transition=M.then(function(){var n,o,a;if(y.transition!==L)return C;for(n=p.length-1;n>=E;n--)a=p[n],a.self.onExit&&h.invoke(a.self.onExit,a.self,a.locals.globals),a.locals=null;for(n=E;n<I.length;n++)o=I[n],o.locals=k[n],o.self.onEnter&&h.invoke(o.self.onEnter,o.self,o.locals.globals);if(y.transition!==L)return C;y.$current=t,y.current=t.self,y.params=e,N(y.params,m),y.transition=null;var u=t.navigable;return i.location&&u&&(d.url(u.url.format(u.locals.globals.$stateParams)),"replace"===i.location&&d.replace()),i.notify&&r.$broadcast("$stateChangeSuccess",t.self,e,c.self,$),D=d.url(),y.current},function(n){return y.transition!==L?C:(y.transition=null,r.$broadcast("$stateChangeError",t.self,e,c.self,$,n),S(),o.reject(n))});return L},y.is=function(r,n){var o=f(r);return O(o)?y.$current!==o?!1:O(n)&&null!==n?t.equals(m,n):!0:e},y.includes=function(r,n){if(I(r)&&p(r)){if(!v(r))return!1;r=y.$current.name}var o=f(r);if(!O(o))return e;if(!O(y.$current.includes[o.name]))return!1;var i=!0;return t.forEach(n,function(r,t){O(m[t])&&m[t]===r||(i=!1)}),i},y.href=function(r,t,e){e=R({lossy:!0,inherit:!1,absolute:!1,relative:y.$current},e||{});var n=f(r,e.relative);if(!O(n))return null;t=u(m,t||{},y.$current,n);var o=n&&e.lossy?n.navigable:n,a=o&&o.url?o.url.format(l(n.params,t||{})):null,s=i.html5Mode();return V(s)&&(s=s.enabled),!s&&a&&(a="#"+i.hashPrefix()+a),"/"!==q&&(s?a=q.slice(0,-1)+a:e.absolute&&(a=q.slice(1)+a)),e.absolute&&a&&(a=d.protocol()+"://"+d.host()+(80==d.port()||443==d.port()?"":":"+d.port())+(!s&&a?"/":"")+a),a},y.get=function(r,t){if(!O(r)){var e=[];return M(x,function(r){e.push(r.self)}),e}var n=f(r,t);return n&&n.self?n.self:null},y}function w(r,t,n,o){return r!==t||(n!==t.locals||o.reload)&&r.self.reloadOnSearch!==!1?e:!0}var b,y,x={},E={},P="abstract",S={parent:function(r){if(O(r.parent)&&r.parent)return f(r.parent);var t=/^(.+)\.[^.]+$/.exec(r.name);return t?f(t[1]):b},data:function(r){return r.parent&&r.parent.data&&(r.data=r.self.data=R({},r.parent.data,r.data)),r.data},url:function(r){var t=r.url;if(I(t))return"^"==t.charAt(0)?o.compile(t.substring(1)):(r.parent.navigable||b).url.concat(t);if(o.isMatcher(t)||null==t)return t;throw Error("Invalid url '"+t+"' in state '"+r+"'")},navigable:function(r){return r.url?r:r.parent?r.parent.navigable:null},params:function(r){if(!r.params)return r.url?r.url.parameters():r.parent.params;if(!k(r.params))throw Error("Invalid params in state '"+r+"'");if(r.url)throw Error("Both params and url specicified in state '"+r+"'");return r.params},views:function(r){var t={};return M(O(r.views)?r.views:{"":r},function(e,n){n.indexOf("@")<0&&(n+="@"+r.parent.name),t[n]=e}),t},ownParams:function(r){if(!r.parent)return r.params;var t={};M(r.params,function(r){t[r]=!0}),M(r.parent.params,function(e){if(!t[e])throw Error("Missing required parameter '"+e+"' in state '"+r.name+"'");t[e]=!1});var e=[];return M(t,function(r,t){r&&e.push(t)}),e},path:function(r){return r.parent?r.parent.path.concat(r):[]},includes:function(r){var t=r.parent?R({},r.parent.includes):{};return t[r.name]=!0,t},$delegates:{}};b=$({name:"",url:"^",views:null,"abstract":!0}),b.navigable=null,this.decorator=m,this.state=d,this.$get=g,g.$inject=["$rootScope","$q","$view","$injector","$resolve","$stateParams","$location","$urlRouter","$browser"]}function d(){function r(r,t){return{load:function(e,n){var o,i={template:null,controller:null,view:null,locals:null,notify:!0,async:!0,params:{}};return n=R(i,n),n.view&&(o=t.fromConfig(n.view,n.params,n.locals)),o&&n.notify&&r.$broadcast("$viewContentLoading",n),o}}}this.$get=r,r.$inject=["$rootScope","$templateFactory"]}function g(){var r=!1;this.useAnchorScroll=function(){r=!0},this.$get=["$anchorScroll","$timeout",function(t,e){return r?t:function(r){e(function(){r[0].scrollIntoView()},0,!1)}}]}function w(r,e,n){function o(){return e.has?function(r){return e.has(r)?e.get(r):null}:function(r){try{return e.get(r)}catch(t){return null}}}function i(r,t){var e=function(){return{enter:function(r,t,e){t.after(r),e()},leave:function(r,t){r.remove(),t()}}};if(l)return{enter:function(r,t,e){var n=l.enter(r,null,t,e);n&&n.then&&n.then(e)},leave:function(r,t){var e=l.leave(r,t);e&&e.then&&e.then(t)}};if(u){var n=u&&u(t,r);return{enter:function(r,t,e){n.enter(r,null,t),e()},leave:function(r,t){n.leave(r),t()}}}return e()}var a=o(),u=a("$animator"),l=a("$animate"),s={restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(e,o,a){return function(e,o,u){function l(){c&&(c.remove(),c=null),h&&(h.$destroy(),h=null),f&&(m.leave(f,function(){c=null}),c=f,f=null)}function s(i){var u=e.$new(),s=f&&f.data("$uiViewName"),c=s&&r.$current&&r.$current.locals[s];if(i||c!==$){var d=a(u,function(r){m.enter(r,o,function(){(t.isDefined(v)&&!v||e.$eval(v))&&n(r)}),l()});$=r.$current.locals[d.data("$uiViewName")],f=d,h=u,h.$emit("$viewContentLoaded"),h.$eval(p)}}var c,f,h,$,p=u.onload||"",v=u.autoscroll,m=i(u,e);e.$on("$stateChangeSuccess",function(){s(!1)}),e.$on("$viewContentLoading",function(){s(!1)}),s(!0)}}};return s}function b(r,t,e){return{restrict:"ECA",priority:-400,compile:function(n){var o=n.html();return function(n,i,a){var u=a.uiView||a.name||"",l=i.inheritedData("$uiView");u.indexOf("@")<0&&(u=u+"@"+(l?l.state.name:"")),i.data("$uiViewName",u);var s=e.$current,c=s&&s.locals[u];if(c){i.data("$uiView",{name:u,state:c.$$state}),i.html(c.$template?c.$template:o);var f=r(i.contents());if(c.$$controller){c.$scope=n;var h=t(c.$$controller,c);c.$$controllerAs&&(n[c.$$controllerAs]=h),i.data("$ngControllerController",h),i.children().data("$ngControllerController",h)}f(n)}}}}}function y(r){var t=r.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/);if(!t||4!==t.length)throw Error("Invalid state ref '"+r+"'");return{state:t[1],paramExpr:t[3]||null}}function x(r){var t=r.parent().inheritedData("$uiView");return t&&t.state&&t.state.name?t.state:e}function E(r,n){var o=["location","inherit","reload"];return{restrict:"A",require:"?^uiSrefActive",link:function(i,a,u,l){var s=y(u.uiSref),c=null,f=x(a)||r.$current,h="FORM"===a[0].nodeName,$=h?"action":"href",p=!0,v={relative:f},m=i.$eval(u.uiSrefOpts)||{};t.forEach(o,function(r){r in m&&(v[r]=m[r])});var d=function(t){if(t&&(c=t),p){var n=r.href(s.state,c,v);return l&&l.$$setStateInfo(s.state,c),n?(a[0][$]=n,e):(p=!1,!1)}};s.paramExpr&&(i.$watch(s.paramExpr,function(r){r!==c&&d(r)},!0),c=i.$eval(s.paramExpr)),d(),h||a.bind("click",function(t){var e=t.which||t.button;e>1||t.ctrlKey||t.metaKey||t.shiftKey||a.attr("target")||(n(function(){r.go(s.state,c,v)}),t.preventDefault())})}}}function P(r,t,e){return{restrict:"A",controller:["$scope","$element","$attrs",function(n,o,i){function a(){r.$current.self===l&&u()?o.addClass(f):o.removeClass(f)}function u(){return!c||s(c,t)}var l,c,f;f=e(i.uiSrefActive||"",!1)(n),this.$$setStateInfo=function(t,e){l=r.get(t,x(o)),c=e,a()},n.$on("$stateChangeSuccess",a)}]}}function S(r){return function(t){return r.is(t)}}function j(r){return function(t){return r.includes(t)}}function C(r,t){function o(r){this.locals=r.locals.globals,this.params=this.locals.$stateParams}function i(){this.locals=null,this.params=null}function a(e,a){if(null!=a.redirectTo){var u,s=a.redirectTo;if(I(s))u=s;else{if(!A(s))throw Error("Invalid 'redirectTo' in when()");u=function(r,t){return s(r,t.path(),t.search())}}t.when(e,u)}else r.state(n(a,{parent:null,name:"route:"+encodeURIComponent(e),url:e,onEnter:o,onExit:i}));return l.push(a),this}function u(r,t,n){function o(r){return""!==r.name?r:e}var i={routes:l,params:n,current:e};return t.$on("$stateChangeStart",function(r,e,n,i){t.$broadcast("$routeChangeStart",o(e),o(i))}),t.$on("$stateChangeSuccess",function(r,e,n,a){i.current=o(e),t.$broadcast("$routeChangeSuccess",o(e),o(a)),N(n,i.params)}),t.$on("$stateChangeError",function(r,e,n,i,a,u){t.$broadcast("$routeChangeError",o(e),o(i),u)}),i}var l=[];o.$inject=["$$state"],this.when=a,this.$get=u,u.$inject=["$state","$rootScope","$routeParams"]}var O=t.isDefined,A=t.isFunction,I=t.isString,V=t.isObject,k=t.isArray,M=t.forEach,R=t.extend,N=t.copy;t.module("ui.router.util",["ng"]),t.module("ui.router.router",["ui.router.util"]),t.module("ui.router.state",["ui.router.router","ui.router.util"]),t.module("ui.router",["ui.router.state"]),t.module("ui.router.compat",["ui.router"]),f.$inject=["$q","$injector"],t.module("ui.router.util").service("$resolve",f),h.$inject=["$http","$templateCache","$injector"],t.module("ui.router.util").service("$templateFactory",h),$.prototype.concat=function(r){return new $(this.sourcePath+r+this.sourceSearch)},$.prototype.toString=function(){return this.source},$.prototype.exec=function(r,t){var e=this.regexp.exec(r);if(!e)return null;var n,o=this.params,i=o.length,a=this.segments.length-1,u={};if(a!==e.length-1)throw Error("Unbalanced capture group in route '"+this.source+"'");for(n=0;a>n;n++)u[o[n]]=e[n+1];for(;i>n;n++)u[o[n]]=t[o[n]];return u},$.prototype.parameters=function(){return this.params},$.prototype.format=function(r){var t=this.segments,e=this.params;if(!r)return t.join("");var n,o,i,a=t.length-1,u=e.length,l=t[0];for(n=0;a>n;n++)i=r[e[n]],null!=i&&(l+=encodeURIComponent(i)),l+=t[n+1];for(;u>n;n++)i=r[e[n]],null!=i&&(l+=(o?"&":"?")+e[n]+"="+encodeURIComponent(i),o=!0);return l},t.module("ui.router.util").provider("$urlMatcherFactory",p),v.$inject=["$urlMatcherFactoryProvider"],t.module("ui.router.router").provider("$urlRouter",v),m.$inject=["$urlRouterProvider","$urlMatcherFactoryProvider","$locationProvider"],t.module("ui.router.state").value("$stateParams",{}).provider("$state",m),d.$inject=[],t.module("ui.router.state").provider("$view",d),t.module("ui.router.state").provider("$uiViewScroll",g),w.$inject=["$state","$injector","$uiViewScroll"],b.$inject=["$compile","$controller","$state"],t.module("ui.router.state").directive("uiView",w),t.module("ui.router.state").directive("uiView",b),E.$inject=["$state","$timeout"],P.$inject=["$state","$stateParams","$interpolate"],t.module("ui.router.state").directive("uiSref",E).directive("uiSrefActive",P),S.$inject=["$state"],j.$inject=["$state"],t.module("ui.router.state").filter("isState",S).filter("includedByState",j),C.$inject=["$stateProvider","$urlRouterProvider"],t.module("ui.router.compat").provider("$route",C).directive("ngView",w)}(window,window.angular);