diff --git a/UI/WebServerResources/js/vendor/angular-ui-router.js b/UI/WebServerResources/js/vendor/angular-ui-router.js index 8a46fdfe6..0369b8af4 100644 --- a/UI/WebServerResources/js/vendor/angular-ui-router.js +++ b/UI/WebServerResources/js/vendor/angular-ui-router.js @@ -4,14 +4,14 @@ * This causes it to be incompatible with plugins that depend on @uirouter/core. * We recommend switching to the ui-router-core.js and ui-router-angularjs.js bundles instead. * For more information, see https://ui-router.github.io/blog/uirouter-for-angularjs-umd-bundles - * @version v1.0.6 + * @version v1.0.7 * @link https://ui-router.github.io * @license MIT License, http://www.opensource.org/licenses/MIT */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('angular')) : - typeof define === 'function' && define.amd ? define(['exports', 'angular'], factory) : - (factory((global['@uirouter/angularjs'] = global['@uirouter/angularjs'] || {}),global.angular)); + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('angular')) : + typeof define === 'function' && define.amd ? define(['exports', 'angular'], factory) : + (factory((global['@uirouter/angularjs'] = {}),global.angular)); }(this, (function (exports,ng_from_import) { 'use strict'; var ng_from_global = angular; @@ -305,7 +305,7 @@ function pattern(struct) { * | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` | * */ -var Glob = (function () { +var Glob = /** @class */ (function () { function Glob(text) { this.text = text; this.glob = text.split('.'); @@ -343,7 +343,7 @@ var Glob = (function () { * This class prototypally inherits from the corresponding [[StateDeclaration]]. * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]]. */ -var StateObject = (function () { +var StateObject = /** @class */ (function () { /** @deprecated use State.create() */ function StateObject(config) { return StateObject.create(config || {}); @@ -503,7 +503,6 @@ var w = typeof window === 'undefined' ? {} : window; var angular$1 = w.angular || {}; var fromJson = angular$1.fromJson || JSON.parse.bind(JSON); var toJson = angular$1.toJson || JSON.stringify.bind(JSON); -var copy = angular$1.copy || _copy; var forEach = angular$1.forEach || _forEach; var extend = Object.assign || _extend; var equals = angular$1.equals || _equals; @@ -951,11 +950,8 @@ function tail(arr) { } /** * shallow copy from src to dest - * - * note: This is a shallow copy, while angular.copy is a deep copy. - * ui-router uses `copy` only to make copies of state parameters. */ -function _copy(src, dest) { +function copy(src, dest) { if (dest) Object.keys(dest).forEach(function (key) { return delete dest[key]; }); if (!dest) @@ -1030,7 +1026,7 @@ var silentRejection = function (error) { /** * @module common */ /** for typedoc */ -var Queue = (function () { +var Queue = /** @class */ (function () { function Queue(_items, _limit) { if (_items === void 0) { _items = []; } if (_limit === void 0) { _limit = null; } @@ -1074,6 +1070,7 @@ var Queue = (function () { * @coreapi * @module transition */ /** for typedoc */ +"use strict"; (function (RejectType) { RejectType[RejectType["SUPERSEDED"] = 2] = "SUPERSEDED"; @@ -1083,7 +1080,7 @@ var Queue = (function () { RejectType[RejectType["ERROR"] = 6] = "ERROR"; })(exports.RejectType || (exports.RejectType = {})); /** @hidden */ var id = 0; -var Rejection = (function () { +var Rejection = /** @class */ (function () { function Rejection(type, message, detail) { this.$id = id++; this.type = type; @@ -1205,6 +1202,8 @@ var viewConfigString = function (viewConfig) { function normalizedCat(input) { return isNumber(input) ? exports.Category[input] : exports.Category[exports.Category[input]]; } +/** @hidden */ +var consoletable = isFunction(console.table) ? console.table.bind(console) : console.log.bind(console); /** * Trace categories Enum * @@ -1232,7 +1231,7 @@ function normalizedCat(input) { /** * Prints UI-Router Transition trace information to the console. */ -var Trace = (function () { +var Trace = /** @class */ (function () { /** @hidden */ function Trace() { /** @hidden */ @@ -1354,7 +1353,7 @@ var Trace = (function () { var view = config && config.viewDecl.$context.name + ": " + config.viewDecl.$name + " (" + config.viewDecl.$type + ")"; return { 'ui-view fqn': uiView, 'state: view name': view }; }).sort(function (a, b) { return a['ui-view fqn'].localeCompare(b['ui-view fqn']); }); - console.table(mapping); + consoletable(mapping); }; /** @internalapi called by ui-router code */ Trace.prototype.traceViewServiceEvent = function (event, viewConfig) { @@ -1427,27 +1426,28 @@ var trace = new Trace(); * A `TargetState` may be valid (the state being targeted exists in the registry) * or invalid (the state being targeted is not registered). */ -var TargetState = (function () { +var TargetState = /** @class */ (function () { /** * The TargetState constructor * * Note: Do not construct a `TargetState` manually. * To create a `TargetState`, use the [[StateService.target]] factory method. * + * @param _stateRegistry The StateRegistry to use to look up the _definition * @param _identifier An identifier for a state. * Either a fully-qualified state name, or the object used to define the state. - * @param _definition The internal state representation, if exists. * @param _params Parameters for the target state * @param _options Transition options. * * @internalapi */ - function TargetState(_identifier, _definition, _params, _options) { - if (_options === void 0) { _options = {}; } + function TargetState(_stateRegistry, _identifier, _params, _options) { + this._stateRegistry = _stateRegistry; this._identifier = _identifier; - this._definition = _definition; - this._options = _options; - this._params = _params || {}; + this._identifier = _identifier; + this._params = extend({}, _params || {}); + this._options = extend({}, _options || {}); + this._definition = _stateRegistry.matcher.find(_identifier, this._options.relative); } /** The name of the state this object targets */ TargetState.prototype.name = function () { @@ -1494,7 +1494,40 @@ var TargetState = (function () { return "State '" + this.name() + "' has an invalid definition"; }; TargetState.prototype.toString = function () { - return "'" + this.name() + "'" + toJson(this.params()); + return "'" + this.name() + "'" + stringify(this.params()); + }; + /** + * Returns a copy of this TargetState which targets a different state. + * The new TargetState has the same parameter values and transition options. + * + * @param state The new state that should be targeted + */ + TargetState.prototype.withState = function (state) { + return new TargetState(this._stateRegistry, state, this._params, this._options); + }; + /** + * Returns a copy of this TargetState, using the specified parameter values. + * + * @param params the new parameter values to use + * @param replace When false (default) the new parameter values will be merged with the current values. + * When true the parameter values will be used instead of the current values. + */ + TargetState.prototype.withParams = function (params, replace) { + if (replace === void 0) { replace = false; } + var newParams = replace ? params : extend({}, this._params, params); + return new TargetState(this._stateRegistry, this._identifier, newParams, this._options); + }; + /** + * Returns a copy of this TargetState, using the specified Transition Options. + * + * @param options the new options to use + * @param replace When false (default) the new options will be merged with the current options. + * When true the options will be used instead of the current options. + */ + TargetState.prototype.withOptions = function (options, replace) { + if (replace === void 0) { replace = false; } + var newOpts = replace ? options : extend({}, this._options, options); + return new TargetState(this._stateRegistry, this._identifier, this._params, newOpts); }; /** Returns true if the object has a state property that might be a state or state name */ TargetState.isDef = function (obj) { @@ -1515,7 +1548,7 @@ var defaultOptions = { bind: null, }; /** @hidden */ -var TransitionHook = (function () { +var TransitionHook = /** @class */ (function () { function TransitionHook(transition, stateContext, registeredHook, options) { var _this = this; this.transition = transition; @@ -1747,7 +1780,7 @@ function matchState(state, criterion) { * @internalapi * The registration data for a registered transition hook */ -var RegisteredHook = (function () { +var RegisteredHook = /** @class */ (function () { function RegisteredHook(tranSvc, eventType, callback, matchCriteria, options) { if (options === void 0) { options = {}; } this.tranSvc = tranSvc; @@ -1876,7 +1909,7 @@ function makeEvent(registry, transitionService, eventType) { * in the Transition class, so we must also provide the Transition's _treeChanges) * */ -var HookBuilder = (function () { +var HookBuilder = /** @class */ (function () { function HookBuilder(transition) { this.transition = transition; } @@ -1999,7 +2032,7 @@ function tupleSort(reverseDepthSort) { * ``` * @internalapi */ -var ParamType = (function () { +var ParamType = /** @class */ (function () { /** * @param def A configuration object which contains the custom type definition. The object's * properties will override the default methods and/or pattern in `ParamType`'s public interface. @@ -2176,7 +2209,7 @@ function getReplace(config, arrayMode, isOptional, squash) { return filter(defaultPolicy, function (item) { return configuredKeys.indexOf(item.from) === -1; }).concat(replace); } /** @internalapi */ -var Param = (function () { +var Param = /** @class */ (function () { function Param(id, type, config, location, urlMatcherFactory) { config = unwrapShorthand(config); type = getType(config, type, location, id, urlMatcherFactory.paramTypes); @@ -2307,7 +2340,7 @@ var Param = (function () { * Each PathNode corresponds to a state being entered, exited, or retained. * The stateful information includes parameter values and resolve data. */ -var PathNode = (function () { +var PathNode = /** @class */ (function () { function PathNode(stateOrNode) { if (stateOrNode instanceof PathNode) { var node = stateOrNode; @@ -2372,13 +2405,13 @@ var PathNode = (function () { /** * This class contains functions which convert TargetStates, Nodes and paths from one type to another. */ -var PathUtils = (function () { +var PathUtils = /** @class */ (function () { function PathUtils() { } /** Given a PathNode[], create an TargetState */ - PathUtils.makeTargetState = function (path) { + PathUtils.makeTargetState = function (registry, path) { var state = tail(path).state; - return new TargetState(state, state, path.map(prop("paramValues")).reduce(mergeR, {})); + return new TargetState(registry, state, path.map(prop("paramValues")).reduce(mergeR, {}), {}); }; PathUtils.buildPath = function (targetState) { var toParams = targetState.params(); @@ -2555,7 +2588,7 @@ var defaultResolvePolicy = { * Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first * parameter to those fns. */ -var Resolvable = (function () { +var Resolvable = /** @class */ (function () { function Resolvable(arg1, resolveFn, deps, policy, data) { this.resolved = false; this.promise = undefined; @@ -2674,9 +2707,9 @@ var resolvePolicies = { /** @module resolve */ /** for typedoc */ -var when = resolvePolicies.when; -var ALL_WHENS = [when.EAGER, when.LAZY]; -var EAGER_WHENS = [when.EAGER]; +var whens = resolvePolicies.when; +var ALL_WHENS = [whens.EAGER, whens.LAZY]; +var EAGER_WHENS = [whens.EAGER]; var NATIVE_INJECTOR_TOKEN = "Native Injector"; /** * Encapsulates Dependency Injection for a path of nodes @@ -2688,7 +2721,7 @@ var NATIVE_INJECTOR_TOKEN = "Native Injector"; * * The ResolveContext closes over the [[PathNode]]s, and provides DI for the last node in the path. */ -var ResolveContext = (function () { +var ResolveContext = /** @class */ (function () { function ResolveContext(_path) { this._path = _path; } @@ -2815,14 +2848,14 @@ var ResolveContext = (function () { // subpath stopping at resolvable's node, or the whole path (if the resolvable isn't in the path) var subPath = PathUtils.subPath(this._path, function (x) { return x === node; }) || this._path; var availableResolvables = subPath - .reduce(function (acc, node) { return acc.concat(node.resolvables); }, []) //all of subpath's resolvables + .reduce(function (acc, _node) { return acc.concat(_node.resolvables); }, []) //all of subpath's resolvables .filter(function (res) { return res !== resolvable; }); // filter out the `resolvable` argument var getDependency = function (token) { var matching = availableResolvables.filter(function (r) { return r.token === token; }); if (matching.length) return tail(matching); var fromInjector = _this.injector().getNative(token); - if (!fromInjector) { + if (isUndefined(fromInjector)) { throw new Error("Could not find Dependency Injection token: " + stringify(token)); } return new Resolvable(token, function () { return fromInjector; }, [], fromInjector); @@ -2831,7 +2864,7 @@ var ResolveContext = (function () { }; return ResolveContext; }()); -var UIInjectorImpl = (function () { +var UIInjectorImpl = /** @class */ (function () { function UIInjectorImpl(context) { this.context = context; this.native = this.get(NATIVE_INJECTOR_TOKEN) || services.$injector; @@ -2847,7 +2880,7 @@ var UIInjectorImpl = (function () { } return resolvable.data; } - return this.native && this.native.get(token); + return this.getNative(token); }; UIInjectorImpl.prototype.getAsync = function (token) { var resolvable = this.context.getResolvable(token); @@ -2876,7 +2909,7 @@ var stateSelf = prop("self"); * This object contains all contextual information about the to/from states, parameters, resolves. * It has information about all states being entered and exited as a result of the transition. */ -var Transition = (function () { +var Transition = /** @class */ (function () { /** * Creates a new Transition object. * @@ -3272,7 +3305,7 @@ var Transition = (function () { redirectOpts.location = 'replace'; } var newOptions = extend({}, this.options(), targetState.options(), redirectOpts); - targetState = new TargetState(targetState.identifier(), targetState.$state(), targetState.params(), newOptions); + targetState = targetState.withOptions(newOptions, true); var newTransition = this.router.transitionService.create(this._treeChanges.from, targetState); var originalEnteringNodes = this._treeChanges.entering; var redirectEnteringNodes = newTransition._treeChanges.entering; @@ -3466,7 +3499,7 @@ var Transition = (function () { return (params["#"] !== null && params["#"] !== undefined) ? params : omit(params, ["#"]); }; // (X) means the to state is invalid. - var id = this.$id, from = isObject(fromStateOrName) ? fromStateOrName.name : fromStateOrName, fromParams = toJson(avoidEmptyHash(this._treeChanges.from.map(prop('paramValues')).reduce(mergeR, {}))), toValid = this.valid() ? "" : "(X) ", to = isObject(toStateOrName) ? toStateOrName.name : toStateOrName, toParams = toJson(avoidEmptyHash(this.params())); + var id = this.$id, from = isObject(fromStateOrName) ? fromStateOrName.name : fromStateOrName, fromParams = stringify(avoidEmptyHash(this._treeChanges.from.map(prop('paramValues')).reduce(mergeR, {}))), toValid = this.valid() ? "" : "(X) ", to = isObject(toStateOrName) ? toStateOrName.name : toStateOrName, toParams = stringify(avoidEmptyHash(this.params())); return "Transition#" + id + "( '" + from + "'" + fromParams + " -> " + toValid + "'" + to + "'" + toParams + " )"; }; /** @hidden */ @@ -3565,6 +3598,12 @@ var beforeAfterSubstr = function (char) { return function (str) { return [str, ""]; return [str.substr(0, idx), str.substr(idx + 1)]; }; }; +var hostRegex = new RegExp('^(?:[a-z]+:)?//[^/]+/'); +var stripFile = function (str) { return str.replace(/\/[^/]*$/, ''); }; +var splitHash = beforeAfterSubstr("#"); +var splitQuery = beforeAfterSubstr("?"); +var splitEqual = beforeAfterSubstr("="); +var trimHashVal = function (str) { return str ? str.replace(/^#/, "") : ""; }; /** * Splits on a delimiter, but returns the delimiters in the array * @@ -3624,7 +3663,7 @@ function joinNeighborsR(acc, x) { * - [[json]] * - [[any]] */ -var ParamTypes = (function () { +var ParamTypes = /** @class */ (function () { /** @internalapi */ function ParamTypes() { /** @hidden */ @@ -3708,14 +3747,14 @@ function initDefaultTypes() { encode: function (val$$1) { return val$$1 && 1 || 0; }, decode: function (val$$1) { return parseInt(val$$1, 10) !== 0; }, is: is(Boolean), - pattern: /0|1/ + pattern: /0|1/, }), date: makeDefaultType({ encode: function (val$$1) { return !this.is(val$$1) ? undefined : [ val$$1.getFullYear(), ('0' + (val$$1.getMonth() + 1)).slice(-2), - ('0' + val$$1.getDate()).slice(-2) + ('0' + val$$1.getDate()).slice(-2), ].join("-"); }, decode: function (val$$1) { @@ -3730,14 +3769,14 @@ function initDefaultTypes() { .reduce(function (acc, fn) { return acc && l[fn]() === r[fn](); }, true); }, 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])/ + capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/, }), json: makeDefaultType({ encode: toJson, decode: fromJson, is: is(Object), equals: equals, - pattern: /[^/]*/ + pattern: /[^/]*/, }), // does not encode/decode any: makeDefaultType({ @@ -3756,7 +3795,7 @@ initDefaultTypes(); */ /** */ /** @internalapi */ -var StateParams = (function () { +var StateParams = /** @class */ (function () { function StateParams(params) { if (params === void 0) { params = {}; } extend(this, params); @@ -3852,7 +3891,7 @@ var getParamsBuilder = function (paramFactory) { }; }; function pathBuilder(state) { - return state.parent ? state.parent.path.concat(state) : [state]; + return state.parent ? state.parent.path.concat(state) : /*root*/ [state]; } function includesBuilder(state) { var includes = state.parent ? extend({}, state.parent.includes) : {}; @@ -3959,7 +3998,7 @@ function resolvablesBuilder(state) { * Custom properties or API may be added to the internal [[StateObject]] object by registering a decorator function * using the [[builder]] method. */ -var StateBuilder = (function () { +var StateBuilder = /** @class */ (function () { function StateBuilder(matcher, urlMatcherFactory) { this.matcher = matcher; var self = this; @@ -4065,7 +4104,7 @@ var StateBuilder = (function () { }()); /** @module state */ /** for typedoc */ -var StateMatcher = (function () { +var StateMatcher = /** @class */ (function () { function StateMatcher(_states) { this._states = _states; } @@ -4124,7 +4163,7 @@ var StateMatcher = (function () { /** @module state */ /** for typedoc */ /** @internalapi */ -var StateQueueManager = (function () { +var StateQueueManager = /** @class */ (function () { function StateQueueManager($registry, $urlRouter, states, builder, listeners) { this.$registry = $registry; this.$urlRouter = $urlRouter; @@ -4211,7 +4250,7 @@ var StateQueueManager = (function () { * @coreapi * @module state */ /** for typedoc */ -var StateRegistry = (function () { +var StateRegistry = /** @class */ (function () { /** @internalapi */ function StateRegistry(_router) { this._router = _router; @@ -4436,7 +4475,7 @@ var splitOnSlash = splitOnDelim('/'); * in the built-in `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start * */ -var UrlMatcher = (function () { +var UrlMatcher = /** @class */ (function () { /** * @param pattern The pattern to compile into a matcher. * @param paramTypes The [[ParamTypes]] registry @@ -4870,9 +4909,9 @@ var UrlMatcher = (function () { * Factory for [[UrlMatcher]] instances. * * The factory is available to ng1 services as - * `$urlMatcherFactor` or ng1 providers as `$urlMatcherFactoryProvider`. + * `$urlMatcherFactory` or ng1 providers as `$urlMatcherFactoryProvider`. */ -var UrlMatcherFactory = (function () { +var UrlMatcherFactory = /** @class */ (function () { function UrlMatcherFactory() { var _this = this; /** @hidden */ this.paramTypes = new ParamTypes(); @@ -4996,7 +5035,7 @@ var UrlMatcherFactory = (function () { * - [[StateObject]] * @internalapi */ -var UrlRuleFactory = (function () { +var UrlRuleFactory = /** @class */ (function () { function UrlRuleFactory(router) { this.router = router; } @@ -5171,7 +5210,7 @@ var UrlRuleFactory = (function () { * The value from the `match` function is passed through to the `handler`. * @internalapi */ -var BaseUrlRule = (function () { +var BaseUrlRule = /** @class */ (function () { function BaseUrlRule(match, handler) { var _this = this; this.match = match; @@ -5192,7 +5231,7 @@ function appendBasePath(url, isHtml5, absolute, baseHref) { if (baseHref === '/') return url; if (isHtml5) - return baseHref.slice(0, -1) + url; + return stripFile(baseHref) + url; if (absolute) return baseHref.slice(1) + url; return url; @@ -5255,7 +5294,7 @@ defaultRuleSortFn = function (a, b) { * This class updates the URL when the state changes. * It also responds to changes in the URL. */ -var UrlRouter = (function () { +var UrlRouter = /** @class */ (function () { /** @hidden */ function UrlRouter(router) { /** @hidden */ this._sortFn = defaultRuleSortFn; @@ -5507,7 +5546,7 @@ function getHandlerFn(handler) { * are configured with the matching [[ViewConfig]](s) * */ -var ViewService = (function () { +var ViewService = /** @class */ (function () { function ViewService() { var _this = this; this._uiViews = []; @@ -5775,7 +5814,7 @@ var ViewService = (function () { * This is where we hold the global mutable state such as current state, current * params, current transition, etc. */ -var UIRouterGlobals = (function () { +var UIRouterGlobals = /** @class */ (function () { function UIRouterGlobals() { /** * Current parameter values @@ -5814,7 +5853,7 @@ var makeStub = function (keys) { /** * API for URL management */ -var UrlService = (function () { +var UrlService = /** @class */ (function () { /** @hidden */ function UrlService(router, lateBind) { if (lateBind === void 0) { lateBind = true; } @@ -5894,7 +5933,7 @@ var _routerInstance = 0; * If you are bootstrapping UIRouter manually, tell it to monitor the URL by calling * [[UrlService.listen]] then [[UrlService.sync]]. */ -var UIRouter = (function () { +var UIRouter = /** @class */ (function () { /** * Creates a new `UIRouter` object * @@ -6379,7 +6418,7 @@ function lazyLoadState(transition, state) { * * @interalapi */ -var TransitionEventType = (function () { +var TransitionEventType = /** @class */ (function () { function TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous) { if (reverseSort === void 0) { reverseSort = false; } if (getResultHandler === void 0) { getResultHandler = TransitionHook.HANDLE_RESULT; } @@ -6472,7 +6511,7 @@ var defaultTransOpts = { * * At bootstrap, [[UIRouter]] creates a single instance (singleton) of this class. */ -var TransitionService = (function () { +var TransitionService = /** @class */ (function () { /** @hidden */ function TransitionService(_router) { /** @hidden */ @@ -6670,7 +6709,7 @@ var TransitionService = (function () { * This class provides services related to ui-router states. * An instance of this class is located on the global [[UIRouter]] object. */ -var StateService = (function () { +var StateService = /** @class */ (function () { /** @internalapi */ function StateService(router) { this.router = router; @@ -6753,7 +6792,7 @@ var StateService = (function () { */ StateService.prototype._handleInvalidTargetState = function (fromPath, toState) { var _this = this; - var fromState = PathUtils.makeTargetState(fromPath); + var fromState = PathUtils.makeTargetState(this.router.stateRegistry, fromPath); var globals = this.router.globals; var latestThing = function () { return globals.transitionHistory.peekTail(); }; var latest = latestThing(); @@ -6927,8 +6966,7 @@ var StateService = (function () { options.reloadState = options.reload === true ? reg.root() : reg.matcher.find(options.reload, options.relative); if (options.reload && !options.reloadState) throw new Error("No such reload state '" + (isString(options.reload) ? options.reload : options.reload.name) + "'"); - var stateDefinition = reg.matcher.find(identifier, options.relative); - return new TargetState(identifier, stateDefinition, params, options); + return new TargetState(this.router.stateRegistry, identifier, params, options); }; StateService.prototype.getCurrentPath = function () { @@ -7208,7 +7246,7 @@ var StateService = (function () { if (!state || !state.lazyLoad) throw new Error("Can not lazy load " + stateOrName); var currentPath = this.getCurrentPath(); - var target = PathUtils.makeTargetState(currentPath); + var target = PathUtils.makeTargetState(this.router.stateRegistry, currentPath); transition = transition || this.router.transitionService.create(currentPath, target); return lazyLoadState(transition, state); }; @@ -7252,9 +7290,9 @@ var StateService = (function () { */ var $q = { /** Normalizes a value as a promise */ - when: function (val$$1) { return new Promise(function (resolve, reject) { return resolve(val$$1); }); }, + when: function (val) { return new Promise(function (resolve, reject) { return resolve(val); }); }, /** Normalizes a value as a promise rejection */ - reject: function (val$$1) { return new Promise(function (resolve, reject) { reject(val$$1); }); }, + reject: function (val) { return new Promise(function (resolve, reject) { reject(val); }); }, /** @returns a deferred object, which has `resolve` and `reject` functions */ defer: function () { var deferred = {}; @@ -7273,10 +7311,10 @@ var $q = { // Convert promises map to promises array. // When each promise resolves, map it to a tuple { key: key, val: val } var chain = Object.keys(promises) - .map(function (key) { return promises[key].then(function (val$$1) { return ({ key: key, val: val$$1 }); }); }); + .map(function (key) { return promises[key].then(function (val) { return ({ key: key, val: val }); }); }); // Then wait for all promises to resolve, and convert them back to an object - return $q.all(chain).then(function (values$$1) { - return values$$1.reduce(function (acc, tuple) { acc[tuple.key] = tuple.val; return acc; }, {}); + return $q.all(chain).then(function (values) { + return values.reduce(function (acc, tuple) { acc[tuple.key] = tuple.val; return acc; }, {}); }); } } @@ -7351,10 +7389,10 @@ var $injector = { * @param locals An object with additional DI tokens and values, such as `{ someToken: { foo: 1 } }` */ invoke: function (fn, context, locals) { - var all$$1 = extend({}, globals, locals || {}); + var all = extend({}, globals, locals || {}); var params = $injector.annotate(fn); - var ensureExist = assertPredicate(function (key) { return all$$1.hasOwnProperty(key); }, function (key) { return "DI can't find injectable: '" + key + "'"; }); - var args = params.filter(ensureExist).map(function (x) { return all$$1[x]; }); + var ensureExist = assertPredicate(function (key) { return all.hasOwnProperty(key); }, function (key) { return "DI can't find injectable: '" + key + "'"; }); + var args = params.filter(ensureExist).map(function (x) { return all[x]; }); if (isFunction(fn)) return fn.apply(context, args); else @@ -7384,28 +7422,16 @@ var $injector = { * @module vanilla */ /** */ -var beforeAfterSubstr$1 = function (char) { return function (str) { - if (!str) - return ["", ""]; - var idx = str.indexOf(char); - if (idx === -1) - return [str, ""]; - return [str.substr(0, idx), str.substr(idx + 1)]; -}; }; -var splitHash = beforeAfterSubstr$1("#"); -var splitQuery = beforeAfterSubstr$1("?"); -var splitEqual = beforeAfterSubstr$1("="); -var trimHashVal = function (str) { return str ? str.replace(/^#/, "") : ""; }; var keyValsToObjectR = function (accum, _a) { - var key = _a[0], val$$1 = _a[1]; + var key = _a[0], val = _a[1]; if (!accum.hasOwnProperty(key)) { - accum[key] = val$$1; + accum[key] = val; } else if (isArray(accum[key])) { - accum[key].push(val$$1); + accum[key].push(val); } else { - accum[key] = [accum[key], val$$1]; + accum[key] = [accum[key], val]; } return accum; }; @@ -7425,7 +7451,7 @@ var buildUrl = function (loc) { var search = Object.keys(searchObject).map(function (key) { var param = searchObject[key]; var vals = isArray(param) ? param : [param]; - return vals.map(function (val$$1) { return key + "=" + val$$1; }); + return vals.map(function (val) { return key + "=" + val; }); }).reduce(unnestR, []).join("&"); return path + (search ? "?" + search : "") + (hash ? "#" + hash : ""); }; @@ -7440,13 +7466,31 @@ function locationPluginFactory(name, isHtml5, serviceClass, configurationClass) return { name: name, service: service, configuration: configuration, dispose: dispose }; }; } +function getCustomEventCtor() { + // CustomEvent Polyfill + function _CustomEvent(event, params) { + params = params || { bubbles: false, cancelable: false, detail: undefined }; + var evt = document.createEvent('CustomEvent'); + evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); + return evt; + } + _CustomEvent.prototype = Event.prototype; + try { + new CustomEvent('foo'); + return CustomEvent; + } + catch (_err) { + return _CustomEvent; + } +} /** * @internalapi * @module vanilla */ /** */ +var Evt = getCustomEventCtor(); /** A base `LocationServices` */ -var BaseLocationServices = (function () { +var BaseLocationServices = /** @class */ (function () { function BaseLocationServices(router, fireAfterUpdate) { var _this = this; this.fireAfterUpdate = fireAfterUpdate; @@ -7455,15 +7499,15 @@ var BaseLocationServices = (function () { this.hash = function () { return parseUrl$1(_this._get()).hash; }; this.path = function () { return parseUrl$1(_this._get()).path; }; this.search = function () { return getParams(parseUrl$1(_this._get()).search); }; - this._location = window && window.location; - this._history = window && window.history; + this._location = self && self.location; + this._history = self && self.history; } BaseLocationServices.prototype.url = function (url, replace) { if (replace === void 0) { replace = true; } if (isDefined(url) && url !== this._get()) { this._set(null, null, url, replace); if (this.fireAfterUpdate) { - var evt_1 = extend(new Event("locationchange"), { url: url }); + var evt_1 = extend(new Evt("locationchange"), { url: url }); this._listeners.forEach(function (cb) { return cb(evt_1); }); } } @@ -7496,11 +7540,11 @@ var __extends = (undefined && undefined.__extends) || (function () { */ /** */ /** A `LocationServices` that uses the browser hash "#" to get/set the current location */ -var HashLocationService = (function (_super) { +var HashLocationService = /** @class */ (function (_super) { __extends(HashLocationService, _super); function HashLocationService(router) { var _this = _super.call(this, router, false) || this; - window.addEventListener('hashchange', _this._listener, false); + self.addEventListener('hashchange', _this._listener, false); return _this; } HashLocationService.prototype._get = function () { @@ -7511,7 +7555,7 @@ var HashLocationService = (function (_super) { }; HashLocationService.prototype.dispose = function (router) { _super.prototype.dispose.call(this, router); - window.removeEventListener('hashchange', this._listener); + self.removeEventListener('hashchange', this._listener); }; return HashLocationService; }(BaseLocationServices)); @@ -7532,7 +7576,7 @@ var __extends$1 = (undefined && undefined.__extends) || (function () { */ /** */ /** A `LocationServices` that gets/sets the current location from an in-memory object */ -var MemoryLocationService = (function (_super) { +var MemoryLocationService = /** @class */ (function (_super) { __extends$1(MemoryLocationService, _super); function MemoryLocationService(router) { return _super.call(this, router, true) || this; @@ -7561,40 +7605,57 @@ var __extends$2 = (undefined && undefined.__extends) || (function () { * * Uses `history.pushState` and `history.replaceState` */ -var PushStateLocationService = (function (_super) { +var PushStateLocationService = /** @class */ (function (_super) { __extends$2(PushStateLocationService, _super); function PushStateLocationService(router) { var _this = _super.call(this, router, true) || this; _this._config = router.urlService.config; - window.addEventListener("popstate", _this._listener, false); + self.addEventListener("popstate", _this._listener, false); return _this; } + /** + * Gets the base prefix without: + * - trailing slash + * - trailing filename + * - protocol and hostname + * + * If , this returns '/base'. + * If , this returns '/base'. + * + * See: https://html.spec.whatwg.org/dev/semantics.html#the-base-element + */ + PushStateLocationService.prototype._getBasePrefix = function () { + return stripFile(this._config.baseHref()); + }; PushStateLocationService.prototype._get = function () { var _a = this._location, pathname = _a.pathname, hash = _a.hash, search = _a.search; search = splitQuery(search)[1]; // strip ? if found hash = splitHash(hash)[1]; // strip # if found - return pathname + (search ? "?" + search : "") + (hash ? "$" + search : ""); + var basePrefix = this._getBasePrefix(); + var exactMatch = pathname === this._config.baseHref(); + var startsWith = pathname.startsWith(basePrefix); + pathname = exactMatch ? '/' : startsWith ? pathname.substring(basePrefix.length) : pathname; + return pathname + (search ? "?" + search : "") + (hash ? "#" + hash : ""); }; PushStateLocationService.prototype._set = function (state, title, url, replace) { - var _a = this, _config = _a._config, _history = _a._history; - var fullUrl = _config.baseHref() + url; + var fullUrl = this._getBasePrefix() + url; if (replace) { - _history.replaceState(state, title, fullUrl); + this._history.replaceState(state, title, fullUrl); } else { - _history.pushState(state, title, fullUrl); + this._history.pushState(state, title, fullUrl); } }; PushStateLocationService.prototype.dispose = function (router) { _super.prototype.dispose.call(this, router); - window.removeEventListener("popstate", this._listener); + self.removeEventListener("popstate", this._listener); }; return PushStateLocationService; }(BaseLocationServices)); /** A `LocationConfig` mock that gets/sets all config from an in-memory object */ -var MemoryLocationConfig = (function () { +var MemoryLocationConfig = /** @class */ (function () { function MemoryLocationConfig() { var _this = this; this._baseHref = ''; @@ -7619,7 +7680,7 @@ var MemoryLocationConfig = (function () { */ /** */ /** A `LocationConfig` that delegates to the browser's `location` object */ -var BrowserLocationConfig = (function () { +var BrowserLocationConfig = /** @class */ (function () { function BrowserLocationConfig(router, _isHtml5) { if (_isHtml5 === void 0) { _isHtml5 = false; } this._isHtml5 = _isHtml5; @@ -7646,11 +7707,12 @@ var BrowserLocationConfig = (function () { }; BrowserLocationConfig.prototype.baseHref = function (href) { - return isDefined(href) ? this._baseHref = href : this._baseHref || this.applyDocumentBaseHref(); + return isDefined(href) ? this._baseHref = href : + isDefined(this._baseHref) ? this._baseHref : this.applyDocumentBaseHref(); }; BrowserLocationConfig.prototype.applyDocumentBaseHref = function () { - var baseTags = document.getElementsByTagName("base"); - return this._baseHref = baseTags.length ? baseTags[0].href.substr(location.origin.length) : ""; + var baseTag = document.getElementsByTagName("base")[0]; + return this._baseHref = baseTag ? baseTag.href.substr(location.origin.length) : ""; }; BrowserLocationConfig.prototype.dispose = function () { }; return BrowserLocationConfig; @@ -7690,7 +7752,7 @@ var memoryLocationPlugin = locationPluginFactory("vanilla.memoryLocation", false * @module core */ /** for typedoc */ /** @internalapi */ -var UIRouterPluginBase = (function () { +var UIRouterPluginBase = /** @class */ (function () { function UIRouterPluginBase() { } UIRouterPluginBase.prototype.dispose = function (router) { }; @@ -7707,7 +7769,6 @@ var UIRouterPluginBase = (function () { var index$1 = Object.freeze({ fromJson: fromJson, toJson: toJson, - copy: copy, forEach: forEach, extend: extend, equals: equals, @@ -7748,6 +7809,7 @@ var index$1 = Object.freeze({ arrayTuples: arrayTuples, applyPairs: applyPairs, tail: tail, + copy: copy, _extend: _extend, silenceUncaughtInPromise: silenceUncaughtInPromise, silentRejection: silentRejection, @@ -7792,6 +7854,12 @@ var index$1 = Object.freeze({ fnToString: fnToString, stringify: stringify, beforeAfterSubstr: beforeAfterSubstr, + hostRegex: hostRegex, + stripFile: stripFile, + splitHash: splitHash, + splitQuery: splitQuery, + splitEqual: splitEqual, + trimHashVal: trimHashVal, splitOnDelim: splitOnDelim, joinNeighborsR: joinNeighborsR, get Category () { return exports.Category; }, @@ -7847,15 +7915,12 @@ var index$1 = Object.freeze({ PushStateLocationService: PushStateLocationService, MemoryLocationConfig: MemoryLocationConfig, BrowserLocationConfig: BrowserLocationConfig, - splitHash: splitHash, - splitQuery: splitQuery, - splitEqual: splitEqual, - trimHashVal: trimHashVal, keyValsToObjectR: keyValsToObjectR, getParams: getParams, parseUrl: parseUrl$1, buildUrl: buildUrl, locationPluginFactory: locationPluginFactory, + getCustomEventCtor: getCustomEventCtor, servicesPlugin: servicesPlugin, hashLocationPlugin: hashLocationPlugin, pushStateLocationPlugin: pushStateLocationPlugin, @@ -7921,7 +7986,7 @@ function ng1ViewsBuilder(state) { return views; } var id$1 = 0; -var Ng1ViewConfig = (function () { +var Ng1ViewConfig = /** @class */ (function () { function Ng1ViewConfig(path, viewDecl, factory) { var _this = this; this.path = path; @@ -7935,14 +8000,14 @@ var Ng1ViewConfig = (function () { } Ng1ViewConfig.prototype.load = function () { var _this = this; - var $q$$1 = services.$q; + var $q = services.$q; var context = new ResolveContext(this.path); var params = this.path.reduce(function (acc, node) { return extend(acc, node.paramValues); }, {}); var promises = { - template: $q$$1.when(this.factory.fromConfig(this.viewDecl, params, context)), - controller: $q$$1.when(this.getController(context)) + template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)), + controller: $q.when(this.getController(context)) }; - return $q$$1.all(promises).then(function (results) { + return $q.all(promises).then(function (results) { trace.traceViewServiceEvent("Loaded", _this); _this.controller = results.controller; extend(_this, results.template); // Either { template: "tpl" } or { component: "cmpName" } @@ -7971,12 +8036,12 @@ var Ng1ViewConfig = (function () { /** * Service which manages loading of templates from a ViewConfig. */ -var TemplateFactory = (function () { +var TemplateFactory = /** @class */ (function () { function TemplateFactory() { var _this = this; /** @hidden */ this._useHttp = ng.version.minor < 3; - /** @hidden */ this.$get = ['$http', '$templateCache', '$injector', function ($http, $templateCache, $injector$$1) { - _this.$templateRequest = $injector$$1.has && $injector$$1.has('$templateRequest') && $injector$$1.get('$templateRequest'); + /** @hidden */ this.$get = ['$http', '$templateCache', '$injector', function ($http, $templateCache, $injector) { + _this.$templateRequest = $injector.has && $injector.has('$templateRequest') && $injector.get('$templateRequest'); _this.$http = $http; _this.$templateCache = $templateCache; return _this; @@ -8172,7 +8237,7 @@ var scopeBindings = function (bindingsObj) { return Object.keys(bindingsObj || { * * The `$stateProvider` provides interfaces to declare these states for your app. */ -var StateProvider = (function () { +var StateProvider = /** @class */ (function () { function StateProvider(stateRegistry, stateService) { this.stateRegistry = stateRegistry; this.stateService = stateService; @@ -8315,7 +8380,7 @@ var getStateHookBuilder = function (hookName) { /** * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service */ -var Ng1LocationServices = (function () { +var Ng1LocationServices = /** @class */ (function () { function Ng1LocationServices($locationProvider) { // .onChange() registry this._urlListeners = []; @@ -8373,11 +8438,11 @@ var Ng1LocationServices = (function () { */ Ng1LocationServices.monkeyPatchPathParameterType = function (router) { var pathType = router.urlMatcherFactory.type('path'); - pathType.encode = function (val$$1) { - return val$$1 != null ? val$$1.toString().replace(/(~|\/)/g, function (m) { return ({ '~': '~~', '/': '~2F' }[m]); }) : val$$1; + pathType.encode = function (val) { + return val != null ? val.toString().replace(/(~|\/)/g, function (m) { return ({ '~': '~~', '/': '~2F' }[m]); }) : val; }; - pathType.decode = function (val$$1) { - return val$$1 != null ? val$$1.toString().replace(/(~~|~2F)/g, function (m) { return ({ '~~': '~', '~2F': '/' }[m]); }) : val$$1; + pathType.decode = function (val) { + return val != null ? val.toString().replace(/(~~|~2F)/g, function (m) { return ({ '~~': '~', '~2F': '/' }[m]); }) : val; }; }; return Ng1LocationServices; @@ -8398,7 +8463,7 @@ var Ng1LocationServices = (function () { * * @deprecated */ -var UrlRouterProvider = (function () { +var UrlRouterProvider = /** @class */ (function () { /** @hidden */ function UrlRouterProvider(router) { this._router = router; @@ -8637,16 +8702,16 @@ var getProviderFor = function (serviceName) { return ['$uiRouterProvider', funct }]; }; // This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime) runBlock.$inject = ['$injector', '$q', '$uiRouter']; -function runBlock($injector$$1, $q$$1, $uiRouter) { - services.$injector = $injector$$1; - services.$q = $q$$1; +function runBlock($injector, $q, $uiRouter) { + services.$injector = $injector; + services.$q = $q; // The $injector is now available. // Find any resolvables that had dependency annotation deferred $uiRouter.stateRegistry.get() .map(function (x) { return x.$$state().resolvables; }) .reduce(unnestR, []) .filter(function (x) { return x.deps === "deferred"; }) - .forEach(function (resolvable) { return resolvable.deps = $injector$$1.annotate(resolvable.resolveFn, $injector$$1.strictDi); }); + .forEach(function (resolvable) { return resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi); }); } // $urlRouter service and $urlRouterProvider var getUrlRouterProvider = function (uiRouter) { @@ -9056,8 +9121,8 @@ uiSref = ['$uiRouter', '$timeout', attrs.$set(type.attr, def.href); } if (ref.paramExpr) { - scope.$watch(ref.paramExpr, function (val$$1) { - rawDef.uiStateParams = extend({}, val$$1); + scope.$watch(ref.paramExpr, function (val) { + rawDef.uiStateParams = extend({}, val); update(); }, true); rawDef.uiStateParams = extend({}, scope.$eval(ref.paramExpr)); @@ -9542,7 +9607,7 @@ ng.module('ui.router.state') */ var uiView; uiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q', - function $ViewDirective($view, $animate, $uiViewScroll, $interpolate, $q$$1) { + function $ViewDirective($view, $animate, $uiViewScroll, $interpolate, $q) { function getRenderer(attrs, scope) { return { enter: function (element, target, cb) { @@ -9635,7 +9700,7 @@ uiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q', } function updateView(config) { var newScope = scope.$new(); - var animEnter = $q$$1.defer(), animLeave = $q$$1.defer(); + var animEnter = $q.defer(), animLeave = $q.defer(); var $uiViewData = { $cfg: config, $uiView: activeUIView, @@ -9693,7 +9758,7 @@ uiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q', }]; $ViewDirectiveFill.$inject = ['$compile', '$controller', '$transitions', '$view', '$q', '$timeout']; /** @hidden */ -function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q$$1, $timeout) { +function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q, $timeout) { var getControllerAs = parse('viewDecl.controllerAs'); var getResolveAs = parse('viewDecl.resolveAs'); return { @@ -9731,7 +9796,7 @@ function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q$$1, $ // scope.$on('$destroy', () => $view.componentUnloaded(controllerInstance, { $scope: scope, $element: $element })); $element.data('$ngControllerController', controllerInstance); $element.children().data('$ngControllerController', controllerInstance); - registerControllerCallbacks($q$$1, $transitions, controllerInstance, scope, cfg); + registerControllerCallbacks($q, $transitions, controllerInstance, scope, cfg); } // Wait for the component to appear in the DOM if (isString(cfg.viewDecl.component)) { @@ -9746,7 +9811,7 @@ function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q$$1, $ var deregisterWatch_1 = scope.$watch(getComponentController, function (ctrlInstance) { if (!ctrlInstance) return; - registerControllerCallbacks($q$$1, $transitions, ctrlInstance, scope, cfg); + registerControllerCallbacks($q, $transitions, ctrlInstance, scope, cfg); deregisterWatch_1(); }); } @@ -9760,7 +9825,7 @@ var hasComponentImpl = typeof ng.module('ui.router')['component'] === 'function' /** @hidden incrementing id */ var _uiCanExitId = 0; /** @hidden TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */ -function registerControllerCallbacks($q$$1, $transitions, controllerInstance, $scope, cfg) { +function registerControllerCallbacks($q, $transitions, controllerInstance, $scope, cfg) { // Call $onInit() ASAP if (isFunction(controllerInstance.$onInit) && !(cfg.viewDecl.component && hasComponentImpl)) { controllerInstance.$onInit(); @@ -9790,7 +9855,7 @@ function registerControllerCallbacks($q$$1, $transitions, controllerInstance, $s if (changedToParams.length) { var changedKeys_1 = changedToParams.map(function (x) { return x.id; }); // Filter the params to only changed/new to params. `$transition$.params()` may be used to get all params. - var newValues = filter(toParams, function (val$$1, key) { return changedKeys_1.indexOf(key) !== -1; }); + var newValues = filter(toParams, function (val, key) { return changedKeys_1.indexOf(key) !== -1; }); controllerInstance.uiOnParamsChanged(newValues, $transition$); } }; @@ -9808,8 +9873,8 @@ function registerControllerCallbacks($q$$1, $transitions, controllerInstance, $s var wrappedHook = function (trans) { var promise, ids = trans[cacheProp_1] = trans[cacheProp_1] || {}; if (!prevTruthyAnswer_1(trans)) { - promise = $q$$1.when(controllerInstance.uiCanExit(trans)); - promise.then(function (val$$1) { return ids[id_1] = (val$$1 !== false); }); + promise = $q.when(controllerInstance.uiCanExit(trans)); + promise.then(function (val) { return ids[id_1] = (val !== false); }); } return promise; }; @@ -9857,7 +9922,6 @@ exports.StateProvider = StateProvider; exports.UrlRouterProvider = UrlRouterProvider; exports.fromJson = fromJson; exports.toJson = toJson; -exports.copy = copy; exports.forEach = forEach; exports.extend = extend; exports.equals = equals; @@ -9898,6 +9962,7 @@ exports.pairs = pairs; exports.arrayTuples = arrayTuples; exports.applyPairs = applyPairs; exports.tail = tail; +exports.copy = copy; exports._extend = _extend; exports.silenceUncaughtInPromise = silenceUncaughtInPromise; exports.silentRejection = silentRejection; @@ -9942,6 +10007,12 @@ exports.functionToString = functionToString; exports.fnToString = fnToString; exports.stringify = stringify; exports.beforeAfterSubstr = beforeAfterSubstr; +exports.hostRegex = hostRegex; +exports.stripFile = stripFile; +exports.splitHash = splitHash; +exports.splitQuery = splitQuery; +exports.splitEqual = splitEqual; +exports.trimHashVal = trimHashVal; exports.splitOnDelim = splitOnDelim; exports.joinNeighborsR = joinNeighborsR; exports.Trace = Trace; @@ -9992,15 +10063,12 @@ exports.MemoryLocationService = MemoryLocationService; exports.PushStateLocationService = PushStateLocationService; exports.MemoryLocationConfig = MemoryLocationConfig; exports.BrowserLocationConfig = BrowserLocationConfig; -exports.splitHash = splitHash; -exports.splitQuery = splitQuery; -exports.splitEqual = splitEqual; -exports.trimHashVal = trimHashVal; exports.keyValsToObjectR = keyValsToObjectR; exports.getParams = getParams; exports.parseUrl = parseUrl$1; exports.buildUrl = buildUrl; exports.locationPluginFactory = locationPluginFactory; +exports.getCustomEventCtor = getCustomEventCtor; exports.servicesPlugin = servicesPlugin; exports.hashLocationPlugin = hashLocationPlugin; exports.pushStateLocationPlugin = pushStateLocationPlugin; diff --git a/UI/WebServerResources/js/vendor/angular-ui-router.js.map b/UI/WebServerResources/js/vendor/angular-ui-router.js.map index 4eaea3158..bc9122556 100644 --- a/UI/WebServerResources/js/vendor/angular-ui-router.js.map +++ b/UI/WebServerResources/js/vendor/angular-ui-router.js.map @@ -1 +1 @@ -{"version":3,"file":null,"sources":["@uirouter/angularjs/angular.ts","../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/hof.ts","../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/glob.ts","../node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateObject.ts","../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/predicates.ts","../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/coreservices.ts","../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/common.ts","../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/queue.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/rejectFactory.ts","../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/trace.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/interface.ts","../node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/targetState.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/transitionHook.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/hookRegistry.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/hookBuilder.ts","../node_modules/@uirouter/core/lib-esm/params/@uirouter/core/params/paramType.ts","../node_modules/@uirouter/core/lib-esm/params/@uirouter/core/params/param.ts","../node_modules/@uirouter/core/lib-esm/path/@uirouter/core/path/pathNode.ts","../node_modules/@uirouter/core/lib-esm/path/@uirouter/core/path/pathFactory.ts","../node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/resolvable.ts","../node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/interface.ts","../node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/resolveContext.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/transition.ts","../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/strings.ts","../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/index.ts","../node_modules/@uirouter/core/lib-esm/params/@uirouter/core/params/paramTypes.ts","../node_modules/@uirouter/core/lib-esm/params/@uirouter/core/params/stateParams.ts","../node_modules/@uirouter/core/lib-esm/path/@uirouter/core/path/index.ts","../node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/index.ts","../node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateBuilder.ts","../node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateMatcher.ts","../node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateQueueManager.ts","../node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateRegistry.ts","../node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlMatcher.ts","../node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlMatcherFactory.ts","../node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlRule.ts","../node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlRouter.ts","../node_modules/@uirouter/core/lib-esm/view/@uirouter/core/view/view.ts","../node_modules/@uirouter/core/lib-esm/@uirouter/core/globals.ts","../node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlService.ts","../node_modules/@uirouter/core/lib-esm/@uirouter/core/router.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/coreResolvables.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/redirectTo.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/onEnterExitRetain.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/resolve.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/views.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/updateGlobals.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/url.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/lazyLoad.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/transitionEventType.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/ignoredTransition.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/invalidTransition.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/transitionService.ts","../node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateService.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/index.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/q.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/injector.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/utils.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/baseLocationService.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/hashLocationService.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/memoryLocationService.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/pushStateLocationService.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/memoryLocationConfig.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/browserLocationConfig.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/plugins.ts","../node_modules/@uirouter/core/lib-esm/@uirouter/core/vanilla.ts","../node_modules/@uirouter/core/lib-esm/@uirouter/core/interface.ts","../node_modules/@uirouter/core/lib-esm/@uirouter/core/index.ts","@uirouter/angularjs/statebuilders/views.ts","@uirouter/angularjs/templateFactory.ts","@uirouter/angularjs/stateProvider.ts","@uirouter/angularjs/statebuilders/onEnterExitRetain.ts","@uirouter/angularjs/locationServices.ts","@uirouter/angularjs/urlRouterProvider.ts","@uirouter/angularjs/services.ts","@uirouter/angularjs/injectables.ts","@uirouter/angularjs/directives/stateDirectives.ts","@uirouter/angularjs/stateFilters.ts","@uirouter/angularjs/directives/viewDirective.ts","@uirouter/angularjs/viewScroll.ts","@uirouter/angularjs/index.ts"],"sourcesContent":["/**\n * @hidden\n * @module ng1\n */ /** */\ndeclare var angular;\nimport * as ng_from_import from \"angular\";\nlet ng_from_global = angular;\n\nexport const ng = (ng_from_import && ng_from_import.module) ? ng_from_import : ng_from_global;\n","/**\n * Higher order functions\n *\n * These utility functions are exported, but are subject to change without notice.\n *\n * @module common_hof\n */ /** */\n\nimport {Predicate} from \"./common\";\n/**\n * Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function.\n *\n * Given a function with N parameters, returns a new function that supports partial application.\n * The new function accepts anywhere from 1 to N parameters. When that function is called with M parameters,\n * where M is less than N, it returns a new function that accepts the remaining parameters. It continues to\n * accept more parameters until all N parameters have been supplied.\n *\n *\n * This contrived example uses a partially applied function as an predicate, which returns true\n * if an object is found in both arrays.\n * @example\n * ```\n * // returns true if an object is in both of the two arrays\n * function inBoth(array1, array2, object) {\n * return array1.indexOf(object) !== -1 &&\n * array2.indexOf(object) !== 1;\n * }\n * let obj1, obj2, obj3, obj4, obj5, obj6, obj7\n * let foos = [obj1, obj3]\n * let bars = [obj3, obj4, obj5]\n *\n * // A curried \"copy\" of inBoth\n * let curriedInBoth = curry(inBoth);\n * // Partially apply both the array1 and array2\n * let inFoosAndBars = curriedInBoth(foos, bars);\n *\n * // Supply the final argument; since all arguments are\n * // supplied, the original inBoth function is then called.\n * let obj1InBoth = inFoosAndBars(obj1); // false\n *\n * // Use the inFoosAndBars as a predicate.\n * // Filter, on each iteration, supplies the final argument\n * let allObjs = [ obj1, obj2, obj3, obj4, obj5, obj6, obj7 ];\n * let foundInBoth = allObjs.filter(inFoosAndBars); // [ obj3 ]\n *\n * ```\n *\n * Stolen from: http://stackoverflow.com/questions/4394747/javascript-curry-function\n *\n * @param fn\n * @returns {*|function(): (*|any)}\n */\nexport function curry(fn: Function): Function {\n let initial_args = [].slice.apply(arguments, [1]);\n let func_args_length = fn.length;\n\n function curried(args: any[]) {\n if (args.length >= func_args_length)\n return fn.apply(null, args);\n return function () {\n return curried(args.concat([].slice.apply(arguments)));\n };\n }\n return curried(initial_args);\n}\n\n\n\n/**\n * Given a varargs list of functions, returns a function that composes the argument functions, right-to-left\n * given: f(x), g(x), h(x)\n * let composed = compose(f,g,h)\n * then, composed is: f(g(h(x)))\n */\nexport function compose() {\n let args = arguments;\n let start = args.length - 1;\n return function() {\n let i = start, result = args[start].apply(this, arguments);\n while (i--) result = args[i].call(this, result);\n return result;\n };\n}\n\n/**\n * Given a varargs list of functions, returns a function that is composes the argument functions, left-to-right\n * given: f(x), g(x), h(x)\n * let piped = pipe(f,g,h);\n * then, piped is: h(g(f(x)))\n */\nexport function pipe(...funcs: Function[]): (obj: any) => any {\n return compose.apply(null, [].slice.call(arguments).reverse());\n}\n\n/**\n * Given a property name, returns a function that returns that property from an object\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = prop(\"name\");\n * getName(obj) === \"blarg\"\n */\nexport const prop = (name: string) =>\n (obj: any) => obj && obj[name];\n\n/**\n * Given a property name and a value, returns a function that returns a boolean based on whether\n * the passed object has a property that matches the value\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = propEq(\"name\", \"blarg\");\n * getName(obj) === true\n */\nexport const propEq = curry((name: string, val: any, obj: any) => obj && obj[name] === val);\n\n/**\n * Given a dotted property name, returns a function that returns a nested property from an object, or undefined\n * let obj = { id: 1, nestedObj: { foo: 1, name: \"blarg\" }, };\n * let getName = prop(\"nestedObj.name\");\n * getName(obj) === \"blarg\"\n * let propNotFound = prop(\"this.property.doesnt.exist\");\n * propNotFound(obj) === undefined\n */\nexport const parse = (name: string) =>\n pipe.apply(null, name.split(\".\").map(prop));\n\n/**\n * Given a function that returns a truthy or falsey value, returns a\n * function that returns the opposite (falsey or truthy) value given the same inputs\n */\nexport const not: (fn: Predicate) => Predicate = (fn: Predicate) =>\n (...args: any[]) => !fn.apply(null, args);\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if both functions return truthy for the given arguments\n */\nexport function and(fn1: Predicate, fn2: Predicate): Predicate {\n return (...args: any[]) => fn1.apply(null, args) && fn2.apply(null, args);\n}\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if at least one of the functions returns truthy for the given arguments\n */\nexport function or(fn1: Predicate, fn2: Predicate): Predicate {\n return (...args: any[]) => fn1.apply(null, args) || fn2.apply(null, args);\n}\n\n/**\n * Check if all the elements of an array match a predicate function\n *\n * @param fn1 a predicate function `fn1`\n * @returns a function which takes an array and returns true if `fn1` is true for all elements of the array\n */\nexport const all = (fn1: Predicate) =>\n (arr: any[]) => arr.reduce((b, x) => b && !!fn1(x), true) as boolean;\nexport const any = (fn1: Predicate) =>\n (arr: any[]) => arr.reduce((b, x) => b || !!fn1(x), false) as boolean;\n\n/** Given a class, returns a Predicate function that returns true if the object is of that class */\nexport const is = (ctor: { new(...args): T }) =>\n (obj: any): obj is T =>\n (obj != null && obj.constructor === ctor || obj instanceof ctor);\n\n/** Given a value, returns a Predicate function that returns true if another value is === equal to the original value */\nexport const eq: (comp: any) => Predicate = (val: any) => (other: any) =>\n val === other;\n\n/** Given a value, returns a function which returns the value */\nexport const val = (v: T) => () => v;\n\n\n\nexport function invoke(fnName: string): Function;\nexport function invoke(fnName: string, args: any[]): Function;\nexport function invoke(fnName: string, args?: any[]): Function {\n return (obj: any) =>\n obj[fnName].apply(obj, args);\n}\n\n/**\n * Sorta like Pattern Matching (a functional programming conditional construct)\n *\n * See http://c2.com/cgi/wiki?PatternMatching\n *\n * This is a conditional construct which allows a series of predicates and output functions\n * to be checked and then applied. Each predicate receives the input. If the predicate\n * returns truthy, then its matching output function (mapping function) is provided with\n * the input and, then the result is returned.\n *\n * Each combination (2-tuple) of predicate + output function should be placed in an array\n * of size 2: [ predicate, mapFn ]\n *\n * These 2-tuples should be put in an outer array.\n *\n * @example\n * ```\n *\n * // Here's a 2-tuple where the first element is the isString predicate\n * // and the second element is a function that returns a description of the input\n * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];\n *\n * // Second tuple: predicate \"isNumber\", mapfn returns a description\n * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];\n *\n * let third = [ (input) => input === null, (input) => `Oh, null...` ];\n *\n * let fourth = [ (input) => input === undefined, (input) => `notdefined` ];\n *\n * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);\n *\n * console.log(descriptionOf(undefined)); // 'notdefined'\n * console.log(descriptionOf(55)); // '(55) That's a number!'\n * console.log(descriptionOf(\"foo\")); // 'Here's your string foo'\n * ```\n *\n * @param struct A 2D array. Each element of the array should be an array, a 2-tuple,\n * with a Predicate and a mapping/output function\n * @returns {function(any): *}\n */\nexport function pattern(struct: Function[][]): Function {\n return function(x: any) {\n for (var i = 0; i < struct.length; i++) {\n if (struct[i][0](x)) return struct[i][1](x);\n }\n };\n}\n\n","/**\n * @coreapi\n * @module core\n */\n/** \n * Matches state names using glob-like pattern strings.\n *\n * Globs can be used in specific APIs including:\n *\n * - [[StateService.is]]\n * - [[StateService.includes]]\n * - The first argument to Hook Registration functions like [[TransitionService.onStart]]\n * - [[HookMatchCriteria]] and [[HookMatchCriterion]]\n *\n * A `Glob` string is a pattern which matches state names.\n * Nested state names are split into segments (separated by a dot) when processing.\n * The state named `foo.bar.baz` is split into three segments ['foo', 'bar', 'baz']\n *\n * Globs work according to the following rules:\n *\n * ### Exact match:\n *\n * The glob `'A.B'` matches the state named exactly `'A.B'`.\n *\n * | Glob |Matches states named|Does not match state named|\n * |:------------|:--------------------|:---------------------|\n * | `'A'` | `'A'` | `'B'` , `'A.C'` |\n * | `'A.B'` | `'A.B'` | `'A'` , `'A.B.C'` |\n * | `'foo'` | `'foo'` | `'FOO'` , `'foo.bar'`|\n *\n * ### Single star (`*`)\n *\n * A single star (`*`) is a wildcard that matches exactly one segment.\n *\n * | Glob |Matches states named |Does not match state named |\n * |:------------|:---------------------|:--------------------------|\n * | `'*'` | `'A'` , `'Z'` | `'A.B'` , `'Z.Y.X'` |\n * | `'A.*'` | `'A.B'` , `'A.C'` | `'A'` , `'A.B.C'` |\n * | `'A.*.*'` | `'A.B.C'` , `'A.X.Y'`| `'A'`, `'A.B'` , `'Z.Y.X'`|\n *\n * ### Double star (`**`)\n *\n * A double star (`'**'`) is a wildcard that matches *zero or more segments*\n *\n * | Glob |Matches states named |Does not match state named |\n * |:------------|:----------------------------------------------|:----------------------------------|\n * | `'**'` | `'A'` , `'A.B'`, `'Z.Y.X'` | (matches all states) |\n * | `'A.**'` | `'A'` , `'A.B'` , `'A.C.X'` | `'Z.Y.X'` |\n * | `'**.X'` | `'X'` , `'A.X'` , `'Z.Y.X'` | `'A'` , `'A.login.Z'` |\n * | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` |\n *\n */\nexport class Glob {\n text: string;\n glob: Array;\n regexp: RegExp;\n\n constructor(text: string) {\n this.text = text;\n this.glob = text.split('.');\n\n let regexpString = this.text.split('.')\n .map(seg => {\n if (seg === '**') return '(?:|(?:\\\\.[^.]*)*)';\n if (seg === '*') return '\\\\.[^.]*';\n return '\\\\.' + seg;\n }).join('');\n\n this.regexp = new RegExp(\"^\" + regexpString + \"$\");\n }\n\n matches(name: string) {\n return this.regexp.test('.' + name);\n }\n\n /** Returns true if the string has glob-like characters in it */\n static is(text: string) {\n return !!/[!,*]+/.exec(text);\n }\n\n /** Returns a glob from the string, or null if the string isn't Glob-like */\n static fromString(text: string) {\n return Glob.is(text) ? new Glob(text) : null;\n }\n}\n","/**\n * @coreapi\n * @module state\n */\n/** for typedoc */\nimport { StateDeclaration, _ViewDeclaration, _StateDeclaration, LazyLoadResult } from \"./interface\";\nimport { defaults, values, find, inherit } from \"../common/common\";\nimport { propEq } from \"../common/hof\";\nimport { Param } from \"../params/param\";\nimport { UrlMatcher } from \"../url/urlMatcher\";\nimport { Resolvable } from \"../resolve/resolvable\";\nimport { TransitionStateHookFn } from \"../transition/interface\";\nimport { TargetState } from \"./targetState\";\nimport { Transition } from \"../transition/transition\";\nimport { Glob } from \"../common/glob\";\nimport { isObject, isFunction } from \"../common/predicates\";\n\n/**\n * Internal representation of a UI-Router state.\n *\n * Instances of this class are created when a [[StateDeclaration]] is registered with the [[StateRegistry]].\n *\n * A registered [[StateDeclaration]] is augmented with a getter ([[StateDeclaration.$$state]]) which returns the corresponding [[StateObject]] object.\n *\n * This class prototypally inherits from the corresponding [[StateDeclaration]].\n * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]].\n */\nexport class StateObject {\n /** The parent [[StateObject]] */\n public parent: StateObject;\n\n /** The name used to register the state */\n public name: string;\n\n /** Prototypally inherits from [[StateDeclaration.abstract]] */\n public abstract: boolean;\n\n /** Prototypally inherits from [[StateDeclaration.resolve]] */\n public resolve: ({ [key: string]: (string|any[]|Function) }|any[]);\n\n /** A list of [[Resolvable]] objects. The internal representation of [[resolve]]. */\n public resolvables: Resolvable[];\n\n /** Prototypally inherits from [[StateDeclaration.resolvePolicy]] */\n public resolvePolicy: any;\n\n /** A compiled URLMatcher which detects when the state's URL is matched */\n public url: UrlMatcher;\n\n /** The parameters for the state, built from the URL and [[StateDeclaration.params]] */\n public params: { [key: string]: Param };\n\n /**\n * The views for the state.\n * Note: `@uirouter/core` does not register a builder for views.\n * The framework specific code should register a `views` builder.\n */\n public views: { [key: string]: _ViewDeclaration; };\n\n /**\n * The original [[StateDeclaration]] used to build this [[StateObject]].\n * Note: `this` object also prototypally inherits from the `self` declaration object.\n */\n public self: StateDeclaration;\n\n /** The nearest parent [[StateObject]] which has a URL */\n public navigable: StateObject;\n\n /** The parent [[StateObject]] objects from this state up to the root */\n public path: StateObject[];\n\n /**\n * Prototypally inherits from [[StateDeclaration.data]]\n * Note: This is the only field on the [[StateDeclaration]] which is mutated.\n * The definition object's `data` field is replaced with a new object\n * which prototypally inherits from the parent state definition's `data` field.\n */\n public data: any;\n\n /** \n * An object containing the parent States' names as keys and \n * true as their values.\n */\n public includes: { [name: string]: boolean };\n\n /** Prototypally inherits from [[StateDeclaration.onExit]] */\n public onExit: TransitionStateHookFn;\n /** Prototypally inherits from [[StateDeclaration.onRetain]] */\n public onRetain: TransitionStateHookFn;\n /** Prototypally inherits from [[StateDeclaration.onEnter]] */\n public onEnter: TransitionStateHookFn;\n\n /** Prototypally inherits from [[StateDeclaration.lazyLoad]] */\n public lazyLoad: (transition: Transition, state: StateDeclaration) => Promise;\n\n /** Prototypally inherits from [[StateDeclaration.redirectTo]] */\n redirectTo: (\n string |\n (($transition$: Transition) => TargetState) |\n { state: (string|StateDeclaration), params: { [key: string]: any }}\n );\n\n /** @hidden */\n __stateObjectCache: {\n /** Might be null */\n nameGlob?: Glob\n };\n\n\n /** @deprecated use State.create() */\n constructor(config?: StateDeclaration) {\n return StateObject.create(config || {});\n }\n\n /**\n * Create a state object to put the private/internal implementation details onto.\n * The object's prototype chain looks like:\n * (Internal State Object) -> (Copy of State.prototype) -> (State Declaration object) -> (State Declaration's prototype...)\n *\n * @param stateDecl the user-supplied State Declaration\n * @returns {StateObject} an internal State object\n */\n static create(stateDecl: _StateDeclaration): StateObject {\n stateDecl = StateObject.isStateClass(stateDecl) ? new stateDecl() : stateDecl;\n\n let state = inherit(inherit(stateDecl, StateObject.prototype)) as StateObject;\n stateDecl.$$state = () => state;\n state.self = stateDecl;\n state.__stateObjectCache = {\n nameGlob: Glob.fromString(state.name) // might return null\n };\n return state;\n }\n\n /** Predicate which returns true if the object is an class with @State() decorator */\n static isStateClass = (stateDecl: _StateDeclaration): stateDecl is ({ new (): StateDeclaration }) =>\n isFunction(stateDecl) && stateDecl['__uiRouterState'] === true;\n\n /** Predicate which returns true if the object is an internal [[StateObject]] object */\n static isState = (obj: any): obj is StateObject =>\n isObject(obj['__stateObjectCache']);\n\n /**\n * Returns true if the provided parameter is the same state.\n *\n * Compares the identity of the state against the passed value, which is either an object\n * reference to the actual `State` instance, the original definition object passed to\n * `$stateProvider.state()`, or the fully-qualified name.\n *\n * @param ref Can be one of (a) a `State` instance, (b) an object that was passed\n * into `$stateProvider.state()`, (c) the fully-qualified name of a state as a string.\n * @returns Returns `true` if `ref` matches the current `State` instance.\n */\n is(ref: StateObject|StateDeclaration|string): boolean {\n return this === ref || this.self === ref || this.fqn() === ref;\n }\n\n /**\n * @deprecated this does not properly handle dot notation\n * @returns Returns a dot-separated name of the state.\n */\n fqn(): string {\n if (!this.parent || !(this.parent instanceof this.constructor)) return this.name;\n let name = this.parent.fqn();\n return name ? name + \".\" + this.name : this.name;\n }\n\n /**\n * Returns the root node of this state's tree.\n *\n * @returns The root of this state's tree.\n */\n root(): StateObject {\n return this.parent && this.parent.root() || this;\n }\n\n /**\n * Gets the state's `Param` objects\n *\n * Gets the list of [[Param]] objects owned by the state.\n * If `opts.inherit` is true, it also includes the ancestor states' [[Param]] objects.\n * If `opts.matchingKeys` exists, returns only `Param`s whose `id` is a key on the `matchingKeys` object\n *\n * @param opts options\n */\n parameters(opts?: { inherit?: boolean, matchingKeys?: any }): Param[] {\n opts = defaults(opts, { inherit: true, matchingKeys: null });\n let inherited = opts.inherit && this.parent && this.parent.parameters() || [];\n return inherited.concat(values(this.params))\n .filter(param => !opts.matchingKeys || opts.matchingKeys.hasOwnProperty(param.id));\n }\n\n /**\n * Returns a single [[Param]] that is owned by the state\n *\n * If `opts.inherit` is true, it also searches the ancestor states` [[Param]]s.\n * @param id the name of the [[Param]] to return\n * @param opts options\n */\n parameter(id: string, opts: { inherit?: boolean } = {}): Param {\n return (\n this.url && this.url.parameter(id, opts) ||\n find(values(this.params), propEq('id', id)) ||\n opts.inherit && this.parent && this.parent.parameter(id)\n );\n }\n\n toString() {\n return this.fqn();\n }\n}\n","/** Predicates\n *\n * These predicates return true/false based on the input.\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_predicates\n */\n/** */\nimport { and, not, pipe, prop, or } from \"./hof\";\nimport { Predicate } from \"./common\"; // has or is using\nimport { StateObject } from \"../state/stateObject\";\n\nconst toStr = Object.prototype.toString;\nconst tis = (t: string) => (x: any) => typeof(x) === t;\nexport const isUndefined = tis('undefined');\nexport const isDefined = not(isUndefined);\nexport const isNull = (o: any) => o === null;\nexport const isNullOrUndefined = or(isNull, isUndefined);\nexport const isFunction: (x: any) => x is Function = tis('function');\nexport const isNumber: (x: any) => x is number = tis('number');\nexport const isString = <(x: any) => x is string> tis('string');\nexport const isObject = (x: any) => x !== null && typeof x === 'object';\nexport const isArray = Array.isArray;\nexport const isDate: (x: any) => x is Date = ((x: any) => toStr.call(x) === '[object Date]');\nexport const isRegExp: (x: any) => x is RegExp = ((x: any) => toStr.call(x) === '[object RegExp]');\nexport const isState: (x: any) => x is StateObject = StateObject.isState;\n\n/**\n * Predicate which checks if a value is injectable\n *\n * A value is \"injectable\" if it is a function, or if it is an ng1 array-notation-style array\n * where all the elements in the array are Strings, except the last one, which is a Function\n */\nexport function isInjectable(val: any) {\n if (isArray(val) && val.length) {\n let head = val.slice(0, -1), tail = val.slice(-1);\n return !(head.filter(not(isString)).length || tail.filter(not(isFunction)).length);\n }\n return isFunction(val);\n}\n\n/**\n * Predicate which checks if a value looks like a Promise\n *\n * It is probably a Promise if it's an object, and it has a `then` property which is a Function\n */\nexport const isPromise = <(x: any) => x is Promise> and(isObject, pipe(prop('then'), isFunction));\n\n","/**\n * This module is a stub for core services such as Dependency Injection or Browser Location.\n * Core services may be implemented by a specific framework, such as ng1 or ng2, or be pure javascript.\n *\n * @module common\n */\n/** for typedoc */\nimport {IInjectable, Obj} from \"./common\";\nimport { Disposable } from \"../interface\";\nimport { UrlParts } from \"../url/interface\";\n\nexport let notImplemented = (fnname: string) => () => {\n throw new Error(`${fnname}(): No coreservices implementation for UI-Router is loaded.`);\n};\n\nlet services: CoreServices = {\n $q: undefined,\n $injector: undefined,\n};\n\nexport interface $QLikeDeferred {\n resolve: (val?: any) => void;\n reject: (reason?: any) => void;\n promise: Promise;\n}\n\nexport interface $QLike {\n when(value?: T | PromiseLike): Promise;\n reject(reason: any): Promise;\n defer(): $QLikeDeferred;\n all(promises: { [key: string]: Promise }): Promise;\n all(promises: Promise[]): Promise;\n}\n\nexport interface $InjectorLike {\n get(token: any): any;\n get(token: any): T;\n has(token: any): boolean;\n invoke(fn: IInjectable, context?: any, locals?: Obj): any;\n annotate(fn: IInjectable, strictDi?: boolean): any[];\n strictDi?: boolean;\n}\n\nexport interface CoreServices {\n $q: $QLike;\n $injector: $InjectorLike;\n}\n\nexport interface LocationServices extends Disposable {\n /**\n * Gets the current url string\n *\n * The URL is normalized using the internal [[path]]/[[search]]/[[hash]] values.\n *\n * For example, the URL may be stored in the hash ([[HashLocationServices]]) or\n * have a base HREF prepended ([[PushStateLocationServices]]).\n *\n * The raw URL in the browser might be:\n *\n * ```\n * http://mysite.com/somepath/index.html#/internal/path/123?param1=foo#anchor\n * ```\n *\n * or\n *\n * ```\n * http://mysite.com/basepath/internal/path/123?param1=foo#anchor\n * ```\n *\n * then this method returns:\n *\n * ```\n * /internal/path/123?param1=foo#anchor\n * ```\n *\n *\n * #### Example:\n * ```js\n * locationServices.url(); // \"/some/path?query=value#anchor\"\n * ```\n *\n * @returns the current value of the url, as a string.\n */\n url(): string;\n\n /**\n * Updates the url, or gets the current url\n *\n * Updates the url, changing it to the value in `newurl`\n *\n * #### Example:\n * ```js\n * locationServices.url(\"/some/path?query=value#anchor\", true);\n * ```\n *\n * @param newurl The new value for the URL.\n * This url should reflect only the new internal [[path]], [[search]], and [[hash]] values.\n * It should not include the protocol, site, port, or base path of an absolute HREF.\n * @param replace When true, replaces the current history entry (instead of appending it) with this new url\n * @param state The history's state object, i.e., pushState (if the LocationServices implementation supports it)\n * @return the url (after potentially being processed)\n */\n url(newurl: string, replace?: boolean, state?: any): string;\n\n /**\n * Gets the path part of the current url\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`\n *\n * @return the path portion of the url\n */\n path(): string;\n\n /**\n * Gets the search part of the current url as an object\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`\n *\n * @return the search (querystring) portion of the url, as an object\n */\n search(): { [key: string]: any };\n\n /**\n * Gets the hash part of the current url\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `anchor`\n *\n * @return the hash (anchor) portion of the url\n */\n hash(): string;\n\n /**\n * Registers a url change handler\n *\n * #### Example:\n * ```js\n * let deregisterFn = locationServices.onChange((evt) => console.log(\"url change\", evt));\n * ```\n *\n * @param callback a function that will be called when the url is changing\n * @return a function that de-registers the callback\n */\n onChange(callback: Function): Function;\n}\n\n/**\n * This service returns the location configuration\n *\n * This service returns information about the location configuration.\n * This service is primarily used when building URLs (e.g., for `hrefs`)\n */\nexport interface LocationConfig extends Disposable {\n /**\n * Gets the port, e.g., `80`\n *\n * @return the port number\n */\n port(): number;\n /**\n * Gets the protocol, e.g., `http`\n *\n * @return the protocol\n */\n protocol(): string;\n /**\n * Gets the host, e.g., `localhost`\n *\n * @return the protocol\n */\n host(): string;\n /**\n * Gets the base Href, e.g., `http://localhost/approot/`\n *\n * @return the application's base href\n */\n baseHref(): string;\n /**\n * Returns true when running in pushstate mode\n *\n * @return true when running in pushstate mode\n */\n html5Mode(): boolean;\n /**\n * Gets the hashPrefix (when not running in pushstate mode)\n *\n * If the current url is `http://localhost/app#!/uirouter/path/#anchor`, it returns `!` which is the prefix for the \"hashbang\" portion.\n *\n * @return the hash prefix\n */\n hashPrefix(): string;\n /**\n * Sets the hashPrefix (when not running in pushstate mode)\n *\n * @return the new hash prefix\n */\n hashPrefix(newprefix: string): string;\n}\n\nexport {services};\n","/**\n * Random utility functions used in the UI-Router code\n *\n * These functions are exported, but are subject to change without notice.\n *\n * @preferred\n * @module common\n */\n/** for typedoc */\nimport { isFunction, isString, isArray, isRegExp, isDate } from \"./predicates\";\nimport { all, any, prop, curry, not } from \"./hof\";\nimport { services } from \"./coreservices\";\nimport { StateObject } from \"../state/stateObject\";\n\nlet w: any = typeof window === 'undefined' ? {} : window;\nlet angular = w.angular || {};\nexport const fromJson = angular.fromJson || JSON.parse.bind(JSON);\nexport const toJson = angular.toJson || JSON.stringify.bind(JSON);\nexport const copy = angular.copy || _copy;\nexport const forEach = angular.forEach || _forEach;\nexport const extend = Object.assign || _extend;\nexport const equals = angular.equals || _equals;\nexport function identity(x: any) { return x; }\nexport function noop(): any {}\n\nexport type Mapper = (x: X, key?: (string|number)) => T;\nexport interface TypedMap { [key: string]: T; }\nexport type Predicate = (x?: X) => boolean;\n/**\n * An ng1-style injectable\n *\n * This could be a (non-minified) function such as:\n * ```js\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an explicitly annotated function (minify safe)\n * ```js\n * injectableFunction.$inject = [ 'SomeDependency' ];\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an array style annotated function (minify safe)\n * ```js\n * ['SomeDependency', function injectableFunction(SomeDependency) {\n *\n * }];\n * ```\n *\n * @publicapi\n */\nexport type IInjectable = (Function|any[]);\n\nexport interface Obj extends Object {\n [key: string]: any;\n}\n\n/**\n * Builds proxy functions on the `to` object which pass through to the `from` object.\n *\n * For each key in `fnNames`, creates a proxy function on the `to` object.\n * The proxy function calls the real function on the `from` object.\n *\n *\n * #### Example:\n * This example creates an new class instance whose functions are prebound to the new'd object.\n * ```js\n * class Foo {\n * constructor(data) {\n * // Binds all functions from Foo.prototype to 'this',\n * // then copies them to 'this'\n * bindFunctions(Foo.prototype, this, this);\n * this.data = data;\n * }\n *\n * log() {\n * console.log(this.data);\n * }\n * }\n *\n * let myFoo = new Foo([1,2,3]);\n * var logit = myFoo.log;\n * logit(); // logs [1, 2, 3] from the myFoo 'this' instance\n * ```\n *\n * #### Example:\n * This example creates a bound version of a service function, and copies it to another object\n * ```\n *\n * var SomeService = {\n * this.data = [3, 4, 5];\n * this.log = function() {\n * console.log(this.data);\n * }\n * }\n *\n * // Constructor fn\n * function OtherThing() {\n * // Binds all functions from SomeService to SomeService,\n * // then copies them to 'this'\n * bindFunctions(SomeService, this, SomeService);\n * }\n *\n * let myOtherThing = new OtherThing();\n * myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this'\n * ```\n *\n * @param source A function that returns the source object which contains the original functions to be bound\n * @param target A function that returns the target object which will receive the bound functions\n * @param bind A function that returns the object which the functions will be bound to\n * @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object)\n * @param latebind If true, the binding of the function is delayed until the first time it's invoked\n */\nexport function createProxyFunctions(source: Function, target: Obj, bind: Function, fnNames?: string[], latebind = false): Obj {\n const bindFunction = (fnName) =>\n source()[fnName].bind(bind());\n\n const makeLateRebindFn = fnName => function lateRebindFunction() {\n target[fnName] = bindFunction(fnName);\n return target[fnName].apply(null, arguments);\n };\n\n fnNames = fnNames || Object.keys(source());\n\n return fnNames.reduce((acc, name) => {\n acc[name] = latebind ? makeLateRebindFn(name) : bindFunction(name);\n return acc;\n }, target);\n}\n\n\n/**\n * prototypal inheritance helper.\n * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it\n */\nexport const inherit = (parent: Obj, extra?: Obj) =>\n extend(Object.create(parent), extra);\n\n/** Given an array, returns true if the object is found in the array, (using indexOf) */\nexport const inArray: typeof _inArray = curry(_inArray) as any;\nexport function _inArray(array: any[], obj: any): boolean;\nexport function _inArray(array: any[]): (obj: any) => boolean;\nexport function _inArray(array, obj?): any {\n return array.indexOf(obj) !== -1;\n}\n\n/**\n * Given an array, and an item, if the item is found in the array, it removes it (in-place).\n * The same array is returned\n */\nexport const removeFrom: typeof _removeFrom = curry(_removeFrom) as any;\nexport function _removeFrom(array: T[], obj: T): T[];\nexport function _removeFrom(array: T[]): (obj: T) => T[];\nexport function _removeFrom(array, obj?) {\n let idx = array.indexOf(obj);\n if (idx >= 0) array.splice(idx, 1);\n return array;\n}\n\n/** pushes a values to an array and returns the value */\nexport const pushTo: typeof _pushTo = curry(_pushTo) as any;\nexport function _pushTo(arr: T[], val: T): T ;\nexport function _pushTo(arr: T[]): (val: T) => T ;\nexport function _pushTo(arr, val?): any {\n return (arr.push(val), val);\n}\n\n/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */\nexport const deregAll = (functions: Function[]) =>\n functions.slice().forEach(fn => {\n typeof fn === 'function' && fn();\n removeFrom(functions, fn);\n });\n/**\n * Applies a set of defaults to an options object. The options object is filtered\n * to only those properties of the objects in the defaultsList.\n * Earlier objects in the defaultsList take precedence when applying defaults.\n */\nexport function defaults(opts, ...defaultsList: Obj[]) {\n let _defaultsList = defaultsList.concat({}).reverse();\n let defaultVals = extend.apply(null, _defaultsList);\n return extend({}, defaultVals, pick(opts || {}, Object.keys(defaultVals)));\n}\n\n/** Reduce function that merges each element of the list into a single object, using extend */\nexport const mergeR = (memo: Obj, item: Obj) => extend(memo, item);\n\n/**\n * Finds the common ancestor path between two states.\n *\n * @param {Object} first The first state.\n * @param {Object} second The second state.\n * @return {Array} Returns an array of state names in descending order, not including the root.\n */\nexport function ancestors(first: StateObject, second: StateObject) {\n let path: StateObject[] = [];\n\n for (let n in first.path) {\n if (first.path[n] !== second.path[n]) break;\n path.push(first.path[n]);\n }\n return path;\n}\n\n/**\n * Return a copy of the object only containing the whitelisted properties.\n *\n * #### Example:\n * ```\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the whitelisted property names\n */\nexport function pick(obj: Obj, propNames: string[]): Obj {\n let objCopy = {};\n for (let prop in obj) {\n if (propNames.indexOf(prop) !== -1) {\n objCopy[prop] = obj[prop];\n }\n }\n return objCopy;\n}\n\n/**\n * Return a copy of the object omitting the blacklisted properties.\n *\n * @example\n * ```\n *\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = omit(foo, ['a', 'b']); // { c: 3 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the blacklisted property names\n */\nexport function omit(obj: Obj, propNames: string[]): Obj {\n return Object.keys(obj)\n .filter(not(inArray(propNames)))\n .reduce((acc, key) => (acc[key] = obj[key], acc), {});\n}\n\n\n/** Given an array of objects, maps each element to a named property of the element. */\nexport function pluck(collection: Obj[], propName: string): T[];\n/** Given an object, maps each property of the object to a named property of the property. */\nexport function pluck(collection: { [key: string]: any }, propName: string): { [key: string]: any };\n/**\n * Maps an array, or object to a property (by name)\n */\nexport function pluck(collection: any, propName: string): any {\n return map(collection, > prop(propName));\n}\n\n\n/** Given an array of objects, returns a new array containing only the elements which passed the callback predicate */\nexport function filter(collection: T[], callback: (t: T, key?: number) => boolean): T[];\n/** Given an object, returns a new object with only those properties that passed the callback predicate */\nexport function filter(collection: TypedMap, callback: (t: T, key?: string) => boolean): TypedMap;\n/** Filters an Array or an Object's properties based on a predicate */\nexport function filter(collection: any, callback: Function): T {\n let arr = isArray(collection), result: any = arr ? [] : {};\n let accept = arr ? x => result.push(x) : (x, key) => result[key] = x;\n forEach(collection, function(item, i) {\n if (callback(item, i)) accept(item, i);\n });\n return result;\n}\n\n\n/** Given an object, return the first property of that object which passed the callback predicate */\nexport function find(collection: TypedMap, callback: Predicate): T;\n/** Given an array of objects, returns the first object which passed the callback predicate */\nexport function find(collection: T[], callback: Predicate): T;\n/** Finds an object from an array, or a property of an object, that matches a predicate */\nexport function find(collection: any, callback: any) {\n let result;\n\n forEach(collection, function(item, i) {\n if (result) return;\n if (callback(item, i)) result = item;\n });\n\n return result;\n}\n\n/** Given an object, returns a new object, where each property is transformed by the callback function */\nexport let mapObj: (collection: { [key: string]: T }, callback: Mapper) => { [key: string]: U } = map;\n/** Given an array, returns a new array, where each element is transformed by the callback function */\nexport function map(collection: T[], callback: Mapper): U[];\nexport function map(collection: { [key: string]: T }, callback: Mapper): { [key: string]: U };\n/** Maps an array or object properties using a callback function */\nexport function map(collection: any, callback: any): any {\n let result = isArray(collection) ? [] : {};\n forEach(collection, (item, i) => result[i] = callback(item, i));\n return result;\n}\n\n/**\n * Given an object, return its enumerable property values\n *\n * @example\n * ```\n *\n * let foo = { a: 1, b: 2, c: 3 }\n * let vals = values(foo); // [ 1, 2, 3 ]\n * ```\n */\nexport const values: ( (obj: TypedMap) => T[]) = (obj: Obj) =>\n Object.keys(obj).map(key => obj[key]);\n\n/**\n * Reduce function that returns true if all of the values are truthy.\n *\n * @example\n * ```\n *\n * let vals = [ 1, true, {}, \"hello world\"];\n * vals.reduce(allTrueR, true); // true\n *\n * vals.push(0);\n * vals.reduce(allTrueR, true); // false\n * ```\n */\nexport const allTrueR = (memo: boolean, elem: any) => memo && elem;\n\n/**\n * Reduce function that returns true if any of the values are truthy.\n *\n * * @example\n * ```\n *\n * let vals = [ 0, null, undefined ];\n * vals.reduce(anyTrueR, true); // false\n *\n * vals.push(\"hello world\");\n * vals.reduce(anyTrueR, true); // true\n * ```\n */\nexport const anyTrueR = (memo: boolean, elem: any) => memo || elem;\n\n/**\n * Reduce function which un-nests a single level of arrays\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnestR = (memo: any[], elem: any[]) => memo.concat(elem);\n\n/**\n * Reduce function which recursively un-nests all arrays\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flattenR = (memo: any[], elem: any) =>\n isArray(elem) ? memo.concat(elem.reduce(flattenR, [])) : pushR(memo, elem);\n\n/**\n * Reduce function that pushes an object to an array, then returns the array.\n * Mostly just for [[flattenR]] and [[uniqR]]\n */\nexport function pushR(arr: any[], obj: any) {\n arr.push(obj);\n return arr;\n}\n\n/** Reduce function that filters out duplicates */\nexport const uniqR = (acc: T[], token: T): T[] =>\n inArray(acc, token) ? acc : pushR(acc, token);\n\n/**\n * Return a new array with a single level of arrays unnested.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * unnest(input) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnest = (arr: any[]) => arr.reduce(unnestR, []);\n/**\n * Return a completely flattened version of an array.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * flatten(input) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flatten = (arr: any[]) => arr.reduce(flattenR, []);\n\n/**\n * Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass.\n * @example\n * ```\n *\n * let isNumber = (obj) => typeof(obj) === 'number';\n * let allNumbers = [ 1, 2, 3, 4, 5 ];\n * allNumbers.filter(assertPredicate(isNumber)); //OK\n *\n * let oneString = [ 1, 2, 3, 4, \"5\" ];\n * oneString.filter(assertPredicate(isNumber, \"Not all numbers\")); // throws Error(\"\"Not all numbers\"\");\n * ```\n */\nexport const assertPredicate: (predicate: Predicate, errMsg: (string|Function)) => Predicate = assertFn;\n/**\n * Given a .map function, builds a .map function which throws an error if any mapped elements do not pass a truthyness test.\n * @example\n * ```\n *\n * var data = { foo: 1, bar: 2 };\n *\n * let keys = [ 'foo', 'bar' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // values is [1, 2]\n *\n * let keys = [ 'foo', 'bar', 'baz' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // throws Error(\"Key not found\")\n * ```\n */\nexport const assertMap: (mapFn: (t: T) => U, errMsg: (string|Function)) => (t: T) => U = assertFn;\nexport function assertFn(predicateOrMap: Function, errMsg: (string|Function) = \"assert failure\"): any {\n return (obj) => {\n let result = predicateOrMap(obj);\n if (!result) {\n throw new Error(isFunction(errMsg) ? ( errMsg)(obj) : errMsg);\n }\n return result;\n };\n}\n\n/**\n * Like _.pairs: Given an object, returns an array of key/value pairs\n *\n * @example\n * ```\n *\n * pairs({ foo: \"FOO\", bar: \"BAR }) // [ [ \"foo\", \"FOO\" ], [ \"bar\": \"BAR\" ] ]\n * ```\n */\nexport const pairs = (obj: Obj) =>\n Object.keys(obj).map(key => [ key, obj[key]] );\n\n/**\n * Given two or more parallel arrays, returns an array of tuples where\n * each tuple is composed of [ a[i], b[i], ... z[i] ]\n *\n * @example\n * ```\n *\n * let foo = [ 0, 2, 4, 6 ];\n * let bar = [ 1, 3, 5, 7 ];\n * let baz = [ 10, 30, 50, 70 ];\n * arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ]\n * arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ]\n * ```\n */\nexport function arrayTuples(...args: any[]): any[] {\n if (args.length === 0) return [];\n let maxArrayLen = args.reduce((min, arr) => Math.min(arr.length, min), 9007199254740991); // aka 2^53 − 1 aka Number.MAX_SAFE_INTEGER\n\n let i, result = [];\n\n for (i = 0; i < maxArrayLen; i++) {\n // This is a hot function\n // Unroll when there are 1-4 arguments\n switch (args.length) {\n case 1: result.push([args[0][i]]); break;\n case 2: result.push([args[0][i], args[1][i]]); break;\n case 3: result.push([args[0][i], args[1][i], args[2][i]]); break;\n case 4: result.push([args[0][i], args[1][i], args[2][i], args[3][i]]); break;\n default:\n result.push(args.map(array => array[i])); break;\n }\n }\n\n return result;\n}\n\n/**\n * Reduce function which builds an object from an array of [key, value] pairs.\n *\n * Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration.\n *\n * Each keyValueTuple should be an array with values [ key: string, value: any ]\n *\n * @example\n * ```\n *\n * var pairs = [ [\"fookey\", \"fooval\"], [\"barkey\", \"barval\"] ]\n *\n * var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n *\n * // Or, more simply:\n * var pairsToObj = pairs.reduce(applyPairs, {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n * ```\n */\nexport function applyPairs(memo: TypedMap, keyValTuple: any[]) {\n let key: string, value: any;\n if (isArray(keyValTuple)) [key, value] = keyValTuple;\n if (!isString(key)) throw new Error(\"invalid parameters to applyPairs\");\n memo[key] = value;\n return memo;\n}\n\n/** Get the last element of an array */\nexport function tail(arr: T[]): T {\n return arr.length && arr[arr.length - 1] || undefined;\n}\n\n/**\n * shallow copy from src to dest\n *\n * note: This is a shallow copy, while angular.copy is a deep copy.\n * ui-router uses `copy` only to make copies of state parameters.\n */\nfunction _copy(src: Obj, dest: Obj) {\n if (dest) Object.keys(dest).forEach(key => delete dest[key]);\n if (!dest) dest = {};\n return extend(dest, src);\n}\n\n/** Naive forEach implementation works with Objects or Arrays */\nfunction _forEach(obj: (any[]|any), cb: (el, idx?) => void, _this: Obj) {\n if (isArray(obj)) return obj.forEach(cb, _this);\n Object.keys(obj).forEach(key => cb(obj[key], key));\n}\n\n/** Like Object.assign() */\nexport function _extend(toObj: Obj, ...fromObjs: Obj[]): any;\nexport function _extend(toObj: Obj): any {\n for (let i = 1; i < arguments.length; i++) {\n let obj = arguments[i];\n if (!obj) continue;\n let keys = Object.keys(obj);\n\n for (let j = 0; j < keys.length; j++) {\n toObj[keys[j]] = obj[keys[j]];\n }\n }\n\n return toObj;\n}\n\nfunction _equals(o1: any, o2: any): boolean {\n if (o1 === o2) return true;\n if (o1 === null || o2 === null) return false;\n if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN\n let t1 = typeof o1, t2 = typeof o2;\n if (t1 !== t2 || t1 !== 'object') return false;\n\n const tup = [o1, o2];\n if (all(isArray)(tup)) return _arraysEq(o1, o2);\n if (all(isDate)(tup)) return o1.getTime() === o2.getTime();\n if (all(isRegExp)(tup)) return o1.toString() === o2.toString();\n if (all(isFunction)(tup)) return true; // meh\n\n let predicates = [isFunction, isArray, isDate, isRegExp];\n if (predicates.map(any).reduce((b, fn) => b || !!fn(tup), false)) return false;\n\n let key: string, keys: { [i: string]: boolean } = {};\n for (key in o1) {\n if (!_equals(o1[key], o2[key])) return false;\n keys[key] = true;\n }\n for (key in o2) {\n if (!keys[key]) return false;\n }\n\n return true;\n}\n\nfunction _arraysEq(a1: any[], a2: any[]) {\n if (a1.length !== a2.length) return false;\n return arrayTuples(a1, a2).reduce((b, t) => b && _equals(t[0], t[1]), true);\n}\n\n// issue #2676\nexport const silenceUncaughtInPromise = (promise: Promise) =>\n promise.catch(e => 0) && promise;\nexport const silentRejection = (error: any) =>\n silenceUncaughtInPromise(services.$q.reject(error));\n","/**\n * @module common\n */ /** for typedoc */\n\nexport class Queue {\n constructor(private _items: T[] = [], private _limit: number = null) { }\n\n enqueue(item: T) {\n let items = this._items;\n items.push(item);\n if (this._limit && items.length > this._limit) items.shift();\n return item;\n }\n\n dequeue(): T {\n if (this.size())\n return this._items.splice(0, 1)[0];\n }\n\n clear(): Array {\n let current = this._items;\n this._items = [];\n return current;\n }\n\n size(): number {\n return this._items.length;\n }\n\n remove(item: T) {\n let idx = this._items.indexOf(item);\n return idx > -1 && this._items.splice(idx, 1)[0];\n }\n\n peekTail(): T {\n return this._items[this._items.length - 1];\n }\n\n peekHead(): T {\n if (this.size())\n return this._items[0];\n }\n}\n","/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\n\"use strict\";\nimport {extend, silentRejection} from \"../common/common\";\nimport {stringify} from \"../common/strings\";\nimport { is } from '../common/hof';\n\nexport enum RejectType {\n SUPERSEDED = 2, ABORTED = 3, INVALID = 4, IGNORED = 5, ERROR = 6\n}\n\n/** @hidden */ let id = 0;\n\nexport class Rejection {\n $id = id++;\n type: number;\n message: string;\n detail: any;\n redirected: boolean;\n\n constructor(type: number, message?: string, detail?: any) {\n this.type = type;\n this.message = message;\n this.detail = detail;\n }\n\n toString() {\n const detailString = (d: any) => \n d && d.toString !== Object.prototype.toString ? d.toString() : stringify(d);\n let detail = detailString(this.detail);\n let { $id, type, message } = this;\n return `Transition Rejection($id: ${$id} type: ${type}, message: ${message}, detail: ${detail})`;\n }\n\n toPromise(): Promise {\n return extend(silentRejection(this), { _transitionRejection: this });\n }\n\n /** Returns true if the obj is a rejected promise created from the `asPromise` factory */\n static isRejectionPromise(obj: any): boolean {\n return obj && (typeof obj.then === 'function') && is(Rejection)(obj._transitionRejection);\n }\n\n /** Returns a Rejection due to transition superseded */\n static superseded(detail?: any, options?: any): Rejection {\n let message = \"The transition has been superseded by a different transition\";\n let rejection = new Rejection(RejectType.SUPERSEDED, message, detail);\n if (options && options.redirected) {\n rejection.redirected = true;\n }\n return rejection;\n }\n\n /** Returns a Rejection due to redirected transition */\n static redirected(detail?: any): Rejection {\n return Rejection.superseded(detail, { redirected: true });\n }\n\n /** Returns a Rejection due to invalid transition */\n static invalid(detail?: any): Rejection {\n let message = \"This transition is invalid\";\n return new Rejection(RejectType.INVALID, message, detail);\n }\n\n /** Returns a Rejection due to ignored transition */\n static ignored(detail?: any): Rejection {\n let message = \"The transition was ignored\";\n return new Rejection(RejectType.IGNORED, message, detail);\n }\n\n /** Returns a Rejection due to aborted transition */\n static aborted(detail?: any): Rejection {\n let message = \"The transition has been aborted\";\n return new Rejection(RejectType.ABORTED, message, detail);\n }\n\n /** Returns a Rejection due to aborted transition */\n static errored(detail?: any): Rejection {\n let message = \"The transition errored\";\n return new Rejection(RejectType.ERROR, message, detail);\n }\n \n /**\n * Returns a Rejection\n *\n * Normalizes a value as a Rejection.\n * If the value is already a Rejection, returns it.\n * Otherwise, wraps and returns the value as a Rejection (Rejection type: ERROR).\n *\n * @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection.\n */\n static normalize(detail?: Rejection | Error | any): Rejection {\n return is(Rejection)(detail) ? detail : Rejection.errored(detail);\n }\n}\n","/**\n * # Transition tracing (debug)\n *\n * Enable transition tracing to print transition information to the console,\n * in order to help debug your application.\n * Tracing logs detailed information about each Transition to your console.\n *\n * To enable tracing, import the [[Trace]] singleton and enable one or more categories.\n *\n * ### ES6\n * ```js\n * import {trace} from \"ui-router-ng2\"; // or \"angular-ui-router\"\n * trace.enable(1, 5); // TRANSITION and VIEWCONFIG\n * ```\n *\n * ### CJS\n * ```js\n * let trace = require(\"angular-ui-router\").trace; // or \"ui-router-ng2\"\n * trace.enable(\"TRANSITION\", \"VIEWCONFIG\");\n * ```\n *\n * ### Globals\n * ```js\n * let trace = window[\"angular-ui-router\"].trace; // or \"ui-router-ng2\"\n * trace.enable(); // Trace everything (very verbose)\n * ```\n *\n * ### Angular 1:\n * ```js\n * app.run($trace => $trace.enable());\n * ```\n *\n * @coreapi\n * @module trace\n */ /** for typedoc */\nimport {parse} from \"../common/hof\";\nimport {isNumber} from \"../common/predicates\";\nimport {Transition} from \"../transition/transition\";\nimport {ActiveUIView, ViewConfig, ViewContext} from \"../view/interface\";\nimport {stringify, functionToString, maxLength, padString} from \"./strings\";\nimport {Resolvable} from \"../resolve/resolvable\";\nimport {PathNode} from \"../path/pathNode\";\nimport {PolicyWhen} from \"../resolve/interface\";\nimport {TransitionHook} from \"../transition/transitionHook\";\nimport {HookResult} from \"../transition/interface\";\nimport {StateObject} from \"../state/stateObject\";\n\n/** @hidden */\nfunction uiViewString (uiview: ActiveUIView) {\n if (!uiview) return 'ui-view (defunct)';\n const state = uiview.creationContext ? uiview.creationContext.name || '(root)' : '(none)';\n return `[ui-view#${uiview.id} ${uiview.$type}:${uiview.fqn} (${uiview.name}@${state})]`;\n}\n\n/** @hidden */\nconst viewConfigString = (viewConfig: ViewConfig) => {\n let view = viewConfig.viewDecl;\n const state = view.$context.name || '(root)';\n return `[View#${viewConfig.$id} from '${state}' state]: target ui-view: '${view.$uiViewName}@${view.$uiViewContextAnchor}'`;\n};\n\n/** @hidden */\nfunction normalizedCat(input: Category|string): string {\n return isNumber(input) ? Category[input] : Category[Category[input]];\n}\n\n\n/**\n * Trace categories Enum\n *\n * Enable or disable a category using [[Trace.enable]] or [[Trace.disable]]\n *\n * `trace.enable(Category.TRANSITION)`\n *\n * These can also be provided using a matching string, or position ordinal\n *\n * `trace.enable(\"TRANSITION\")`\n *\n * `trace.enable(1)`\n */\nexport enum Category {\n RESOLVE, TRANSITION, HOOK, UIVIEW, VIEWCONFIG,\n}\n\n/** @hidden */ const _tid = parse(\"$id\");\n/** @hidden */ const _rid = parse(\"router.$id\");\n/** @hidden */ const transLbl = (trans) => `Transition #${_tid(trans)}-${_rid(trans)}`;\n\n/**\n * Prints UI-Router Transition trace information to the console.\n */\nexport class Trace {\n /** @hidden */\n approximateDigests: number;\n\n /** @hidden */\n constructor() {\n this.approximateDigests = 0;\n }\n\n /** @hidden */\n private _enabled: { [key: string]: boolean } = {};\n\n /** @hidden */\n private _set(enabled: boolean, categories: Category[]) {\n if (!categories.length) {\n categories = Object.keys(Category)\n .map(k => parseInt(k, 10))\n .filter(k => !isNaN(k))\n .map(key => Category[key]);\n }\n categories.map(normalizedCat).forEach(category => this._enabled[category] = enabled);\n }\n\n /**\n * Enables a trace [[Category]]\n *\n * ```js\n * trace.enable(\"TRANSITION\");\n * ```\n *\n * @param categories categories to enable. If `categories` is omitted, all categories are enabled.\n * Also takes strings (category name) or ordinal (category position)\n */\n enable(...categories: (Category|string|number)[]);\n enable(...categories: any[]) { this._set(true, categories); }\n /**\n * Disables a trace [[Category]]\n *\n * ```js\n * trace.disable(\"VIEWCONFIG\");\n * ```\n *\n * @param categories categories to disable. If `categories` is omitted, all categories are disabled.\n * Also takes strings (category name) or ordinal (category position)\n */\n disable(...categories: (Category|string|number)[]);\n disable(...categories: any[]) { this._set(false, categories); }\n\n /**\n * Retrieves the enabled stateus of a [[Category]]\n *\n * ```js\n * trace.enabled(\"VIEWCONFIG\"); // true or false\n * ```\n *\n * @returns boolean true if the category is enabled\n */\n enabled(category: (Category|string|number)): boolean {\n return !!this._enabled[normalizedCat(category)];\n }\n\n /** @internalapi called by ui-router code */\n traceTransitionStart(trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: Started -> ${stringify(trans)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceTransitionIgnored(trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: Ignored <> ${stringify(trans)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceHookInvocation(step: TransitionHook, trans: Transition, options: any) {\n if (!this.enabled(Category.HOOK)) return;\n let event = parse(\"traceData.hookType\")(options) || \"internal\",\n context = parse(\"traceData.context.state.name\")(options) || parse(\"traceData.context\")(options) || \"unknown\",\n name = functionToString((step as any).registeredHook.callback);\n console.log(`${transLbl(trans)}: Hook -> ${event} context: ${context}, ${maxLength(200, name)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceHookResult(hookResult: HookResult, trans: Transition, transitionOptions: any) {\n if (!this.enabled(Category.HOOK)) return;\n console.log(`${transLbl(trans)}: <- Hook returned: ${maxLength(200, stringify(hookResult))}`);\n }\n\n /** @internalapi called by ui-router code */\n traceResolvePath(path: PathNode[], when: PolicyWhen, trans?: Transition) {\n if (!this.enabled(Category.RESOLVE)) return;\n console.log(`${transLbl(trans)}: Resolving ${path} (${when})`);\n }\n\n /** @internalapi called by ui-router code */\n traceResolvableResolved(resolvable: Resolvable, trans?: Transition) {\n if (!this.enabled(Category.RESOLVE)) return;\n console.log(`${transLbl(trans)}: <- Resolved ${resolvable} to: ${maxLength(200, stringify(resolvable.data))}`);\n }\n\n /** @internalapi called by ui-router code */\n traceError(reason: any, trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: <- Rejected ${stringify(trans)}, reason: ${reason}`);\n }\n\n /** @internalapi called by ui-router code */\n traceSuccess(finalState: StateObject, trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: <- Success ${stringify(trans)}, final state: ${finalState.name}`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewEvent(event: string, viewData: ActiveUIView, extra = \"\") {\n if (!this.enabled(Category.UIVIEW)) return;\n console.log(`ui-view: ${padString(30, event)} ${uiViewString(viewData)}${extra}`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewConfigUpdated(viewData: ActiveUIView, context: ViewContext) {\n if (!this.enabled(Category.UIVIEW)) return;\n this.traceUIViewEvent(\"Updating\", viewData, ` with ViewConfig from context='${context}'`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewFill(viewData: ActiveUIView, html: string) {\n if (!this.enabled(Category.UIVIEW)) return;\n this.traceUIViewEvent(\"Fill\", viewData, ` with: ${maxLength(200, html)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceViewSync(pairs: any[]) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n const mapping = pairs.map(([ uiViewData, config ]) => {\n const uiView = `${uiViewData.$type}:${uiViewData.fqn}`;\n const view = config && `${config.viewDecl.$context.name}: ${config.viewDecl.$name} (${config.viewDecl.$type})`;\n\n return { 'ui-view fqn': uiView, 'state: view name': view };\n }).sort((a, b) => a['ui-view fqn'].localeCompare(b['ui-view fqn']));\n\n console.table(mapping);\n }\n\n /** @internalapi called by ui-router code */\n traceViewServiceEvent(event: string, viewConfig: ViewConfig) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n console.log(`VIEWCONFIG: ${event} ${viewConfigString(viewConfig)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceViewServiceUIViewEvent(event: string, viewData: ActiveUIView) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n console.log(`VIEWCONFIG: ${event} ${uiViewString(viewData)}`);\n }\n}\n\n/**\n * The [[Trace]] singleton\n *\n * #### Example:\n * ```js\n * import {trace} from \"angular-ui-router\";\n * trace.enable(1, 5);\n * ```\n */\nlet trace = new Trace();\nexport {trace};\n","/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\nimport {StateDeclaration} from \"../state/interface\";\nimport {Predicate} from \"../common/common\";\n\nimport {Transition} from \"./transition\";\nimport {StateObject} from \"../state/stateObject\";\nimport {PathNode} from \"../path/pathNode\";\nimport {TargetState} from \"../state/targetState\";\nimport {RegisteredHook} from \"./hookRegistry\";\n\n/**\n * The TransitionOptions object can be used to change the behavior of a transition.\n *\n * It is passed as the third argument to [[StateService.go]], [[StateService.transitionTo]].\n * It can also be used with a `uiSref`.\n */\nexport interface TransitionOptions {\n /**\n * This option changes how the Transition interacts with the browser's location bar (URL).\n *\n * - If `true`, it will update the url in the location bar.\n * - If `false`, it will not update the url in the location bar.\n * - If it is the string `\"replace\"`, it will update the url and also replace the last history record.\n *\n * @default `true`\n */\n location ?: (boolean|string);\n\n /**\n * When transitioning to relative path (e.g '`^`'), this option defines which state to be relative from.\n * @default `$state.current`\n */\n relative ?: (string|StateDeclaration|StateObject);\n\n /**\n * This option sets whether or not the transition's parameter values should be inherited from\n * the current parameter values.\n *\n * - If `true`, it will inherit parameter values from the current parameter values.\n * - If `false`, only the parameters which are provided to `transitionTo` will be used.\n *\n * @default `false`\n */\n inherit ?: boolean;\n\n /**\n * @deprecated\n */\n notify ?: boolean;\n\n /**\n * This option may be used to force states which are currently active to reload.\n *\n * During a normal transition, a state is \"retained\" if:\n * - It was previously active\n * - The state's parameter values have not changed\n * - All the parent states' parameter values have not changed\n *\n * Forcing a reload of a state will cause it to be exited and entered, which will:\n * - Refetch that state's resolve data\n * - Exit the state (onExit hook)\n * - Re-enter the state (onEnter hook)\n * - Re-render the views (controllers and templates)\n *\n * - When `true`, the destination state (and all parent states) will be reloaded.\n * - When it is a string and is the name of a state, or when it is a State object,\n * that state and any children states will be reloaded.\n *\n * @default `false`\n */\n reload ?: (boolean|string|StateDeclaration|StateObject);\n /**\n * You can define your own Transition Options inside this property and use them, e.g., from a Transition Hook\n */\n custom ?: any;\n /** @internalapi */\n reloadState ?: (StateObject);\n /** @internalapi\n * If this transition is a redirect, this property should be the original Transition (which was redirected to this one)\n */\n redirectedFrom?: Transition;\n /** @internalapi */\n current ?: () => Transition;\n /** @internalapi */\n source ?: \"sref\" | \"url\" | \"redirect\" | \"otherwise\" | \"unknown\";\n}\n\n/** @internalapi */\nexport interface TransitionHookOptions {\n current ?: () => Transition; //path?\n transition ?: Transition;\n hookType ?: string;\n target ?: any;\n traceData ?: any;\n bind ?: any;\n stateHook ?: boolean;\n}\n\n/**\n * TreeChanges encapsulates the various Paths that are involved in a Transition.\n *\n * Get a TreeChanges object using [[Transition.treeChanges]]\n *\n * A UI-Router Transition is from one Path in a State Tree to another Path. For a given Transition,\n * this object stores the \"to\" and \"from\" paths, as well as subsets of those: the \"retained\",\n * \"exiting\" and \"entering\" paths.\n *\n * Each path in TreeChanges is an array of [[PathNode]] objects. Each PathNode in the array corresponds to a portion\n * of a nested state.\n *\n * For example, if you had a nested state named `foo.bar.baz`, it would have three\n * portions, `foo, bar, baz`. If you transitioned **to** `foo.bar.baz` and inspected the [[TreeChanges.to]]\n * Path, you would find a node in the array for each portion: `foo`, `bar`, and `baz`.\n *\n * ---\n *\n * @todo show visual state tree\n */\nexport interface TreeChanges {\n /** @nodoc */\n [key: string]: PathNode[];\n\n /** The path of nodes in the state tree that the transition is coming *from* */\n from: PathNode[];\n\n /** The path of nodes in the state tree that the transition is going *to* */\n to: PathNode[];\n\n /**\n * The path of active nodes that the transition is retaining.\n *\n * These nodes are neither exited, nor entered.\n * Before and after the transition is successful, these nodes are active.\n */\n retained: PathNode[];\n\n /**\n * The path of previously active nodes that the transition is exiting.\n *\n * After the Transition is successful, these nodes are no longer active.\n *\n * Note that a state that is being reloaded (due to parameter values changing, or `reload: true`) may be in both the\n * `exiting` and `entering` paths.\n */\n exiting: PathNode[];\n\n /**\n * The path of nodes that the transition is entering.\n *\n * After the Transition is successful, these nodes will be active.\n * Because they are entering, they have their resolves fetched, `onEnter` hooks run, and their views\n * (component(s) or controller(s)+template(s)) refreshed.\n *\n * Note that a state that is reloaded (due to parameter values changing, or `reload: true`) may be in both the\n * `exiting` and `entering` paths.\n */\n entering: PathNode[];\n}\n\nexport type IHookRegistration = (matchCriteria: HookMatchCriteria, callback: HookFn, options?: HookRegOptions) => Function;\n\n/**\n * The signature for Transition Hooks.\n *\n * Transition hooks are callback functions that hook into the lifecycle of transitions.\n * As a transition runs, it reaches certain lifecycle events.\n * As each event occurs, the hooks which are registered for the event are called (in priority order).\n *\n * A transition hook may alter a Transition by returning a [[HookResult]].\n *\n * #### See:\n *\n * - [[IHookRegistry.onBefore]]\n * - [[IHookRegistry.onStart]]\n * - [[IHookRegistry.onFinish]]\n * - [[IHookRegistry.onSuccess]]\n * - [[IHookRegistry.onError]]\n *\n * @param transition the current [[Transition]]\n * @param injector (for ng1 or ng2 only) the injector service\n *\n * @returns a [[HookResult]] which may alter the transition\n *\n */\nexport interface TransitionHookFn {\n (transition: Transition) : HookResult;\n}\n\n/**\n * The signature for Transition State Hooks.\n *\n * A function which hooks into a lifecycle event for a specific state.\n *\n * Transition State Hooks are callback functions that hook into the lifecycle events of specific states during a transition.\n * As a transition runs, it may exit some states, retain (keep) states, and enter states.\n * As each lifecycle event occurs, the hooks which are registered for the event and that state are called (in priority order).\n *\n * #### See:\n *\n * - [[IHookRegistry.onExit]]\n * - [[IHookRegistry.onRetain]]\n * - [[IHookRegistry.onEnter]]\n *\n * @param transition the current [[Transition]]\n * @param state the [[StateObject]] that the hook is bound to\n * @param injector (for ng1 or ng2 only) the injector service\n *\n * @returns a [[HookResult]] which may alter the transition\n */\nexport interface TransitionStateHookFn {\n (transition: Transition, state: StateDeclaration) : HookResult;\n}\n\n/**\n * The signature for Transition onCreate Hooks.\n *\n * Transition onCreate Hooks are callbacks that allow customization or preprocessing of\n * a Transition before it is returned from [[TransitionService.create]]\n *\n * @param transition the [[Transition]] that was just created\n * @return a [[Transition]] which will then be returned from [[TransitionService.create]]\n */\nexport interface TransitionCreateHookFn {\n (transition: Transition): void;\n}\n\nexport type HookFn = (TransitionHookFn|TransitionStateHookFn|TransitionCreateHookFn);\n\n/**\n * The return value of a [[TransitionHookFn]] or [[TransitionStateHookFn]]\n *\n * When returned from a [[TransitionHookFn]] or [[TransitionStateHookFn]], these values alter the running [[Transition]]:\n *\n * - `false`: the transition will be cancelled.\n * - [[TargetState]]: the transition will be redirected to the new target state (see: [[StateService.target]])\n * - `Promise`: the transition will wait for the promise to resolve or reject\n * - If the promise is rejected (or resolves to `false`), the transition will be cancelled\n * - If the promise resolves to a [[TargetState]], the transition will be redirected\n * - If the promise resolves to anything else, the transition will resume\n * - Anything else: the transition will resume\n */\nexport type HookResult = (boolean | TargetState | void | Promise);\n\n/**\n * These options may be provided when registering a Transition Hook (such as `onStart`)\n */\nexport interface HookRegOptions {\n /**\n * Sets the priority of the registered hook\n *\n * Hooks of the same type (onBefore, onStart, etc) are invoked in priority order. A hook with a higher priority\n * is invoked before a hook with a lower priority.\n *\n * The default hook priority is 0\n */\n priority?: number;\n\n /**\n * Specifies what `this` is bound to during hook invocation.\n */\n bind?: any;\n}\n\n/**\n * This interface specifies the api for registering Transition Hooks. Both the\n * [[TransitionService]] and also the [[Transition]] object itself implement this interface.\n * Note: the Transition object only allows hooks to be registered before the Transition is started.\n */\nexport interface IHookRegistry {\n /**\n * Registers a [[TransitionHookFn]], called *before a transition starts*.\n *\n * Registers a transition lifecycle hook, which is invoked before a transition even begins.\n * This hook can be useful to implement logic which prevents a transition from even starting, such\n * as authentication, redirection\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onBefore` hooks are invoked *before a Transition starts*.\n * No resolves have been fetched yet.\n * Each `onBefore` hook is invoked synchronously, in the same call stack as [[StateService.transitionTo]].\n * The registered `onBefore` hooks are invoked in priority order.\n *\n * Note: during the `onBefore` phase, additional hooks can be added to the specific [[Transition]] instance.\n * These \"on-the-fly\" hooks only affect the currently running transition..\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * If any hook modifies the transition *synchronously* (by throwing, returning `false`, or returning\n * a [[TargetState]]), the remainder of the hooks are skipped.\n * If a hook returns a promise, the remainder of the `onBefore` hooks are still invoked synchronously.\n * All promises are resolved, and processed asynchronously before the `onStart` phase of the Transition.\n *\n * ### Examples\n *\n * #### Default Substate\n *\n * This example redirects any transition from 'home' to 'home.dashboard'. This is commonly referred to as a\n * \"default substate\".\n *\n * @example\n * ```js\n * // ng2\n * transitionService.onBefore({ to: 'home' }, (trans: Transition) =>\n * trans.router.stateService.target(\"home.dashboard\"));\n * ```\n *\n * #### Data Driven Default Substate\n *\n * This example provides data-driven default substate functionality. It matches on a transition to any state\n * which has `defaultSubstate: \"some.sub.state\"` defined. See: [[Transition.to]] which returns the \"to state\"\n * definition.\n *\n * @example\n * ```js\n * // ng1\n * // state declaration\n * {\n * name: 'home',\n * template: '
',\n * defaultSubstate: 'home.dashboard'\n * }\n *\n * var criteria = {\n * to: function(state) {\n * return state.defaultSubstate != null;\n * }\n * }\n *\n * $transitions.onBefore(criteria, function(trans: Transition) {\n * var substate = trans.to().defaultSubstate;\n * return trans.router.stateService.target(substate);\n * });\n * ```\n *\n *\n * #### Require authentication\n *\n * This example cancels a transition to a state which requires authentication, if the user is not currently authenticated.\n *\n * This example assumes a state tree where all states which require authentication are children of a parent `'requireauth'` state.\n * This example assumes `MyAuthService` synchronously returns a boolean from `isAuthenticated()`.\n *\n * #### Example:\n * ```js\n * // ng1\n * $transitions.onBefore( { to: 'requireauth.**' }, function(trans) {\n * var myAuthService = trans.injector().get('MyAuthService');\n * // If isAuthenticated returns false, the transition is cancelled.\n * return myAuthService.isAuthenticated();\n * });\n * ```\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be invoked.\n * @returns a function which deregisters the hook.\n */\n onBefore(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called when a transition starts.\n *\n * Registers a transition lifecycle hook, which is invoked as a transition starts running.\n * This hook can be useful to perform some asynchronous action before completing a transition.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onStart` hooks are invoked asynchronously when the Transition starts running.\n * This happens after the `onBefore` phase is complete.\n * At this point, the Transition has not yet exited nor entered any states.\n * The registered `onStart` hooks are invoked in priority order.\n *\n * Note: A built-in `onStart` hook with high priority is used to fetch any eager resolve data.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Example\n *\n * #### Login during transition\n *\n * This example intercepts any transition to a state which requires authentication, when the user is\n * not currently authenticated. It allows the user to authenticate asynchronously, then resumes the\n * transition. If the user did not authenticate successfully, it redirects to the \"guest\" state, which\n * does not require authentication.\n *\n * This example assumes:\n * - a state tree where all states which require authentication are children of a parent `'auth'` state.\n * - `MyAuthService.isAuthenticated()` synchronously returns a boolean.\n * - `MyAuthService.authenticate()` presents a login dialog, and returns a promise which is resolved\n * or rejected, whether or not the login attempt was successful.\n *\n * #### Example:\n * ```js\n * // ng1\n * $transitions.onStart( { to: 'auth.**' }, function(trans) {\n * var $state = trans.router.stateService;\n * var MyAuthService = trans.injector().get('MyAuthService');\n *\n * // If the user is not authenticated\n * if (!MyAuthService.isAuthenticated()) {\n *\n * // Then return a promise for a successful login.\n * // The transition will wait for this promise to settle\n *\n * return MyAuthService.authenticate().catch(function() {\n *\n * // If the authenticate() method failed for whatever reason,\n * // redirect to a 'guest' state which doesn't require auth.\n * return $state.target(\"guest\");\n * });\n * }\n * });\n * ```\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onStart(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is entered.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being entered.\n *\n * Since this hook is run only when the specific state is being *entered*, it can be useful for\n * performing tasks when entering a submodule/feature area such as initializing a stateful service, \n * or for guarding access to a submodule/feature area.\n *\n * See [[TransitionStateHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onEnter` hooks generally specify `{ entering: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onEnter` hooks are invoked when the Transition is entering a state.\n * States are entered after the `onRetain` phase is complete.\n * If more than one state is being entered, the parent state is entered first.\n * The registered `onEnter` hooks for a state are invoked in priority order.\n *\n * Note: A built-in `onEnter` hook with high priority is used to fetch lazy resolve data for states being entered.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onEnter` hooks using the [[TransitionService]], you may define an `onEnter` hook\n * directly on a state declaration (see: [[StateDeclaration.onEnter]]).\n * \n *\n * ### Examples\n *\n * #### Audit Log\n *\n * This example uses a service to log that a user has entered the admin section of an app.\n * This assumes that there are substates of the \"admin\" state, such as \"admin.users\", \"admin.pages\", etc.\n * @example\n * ```\n *\n * $transitions.onEnter({ entering: 'admin' }, function(transition, state) {\n * var AuditService = trans.injector().get('AuditService');\n * AuditService.log(\"Entered \" + state.name + \" module while transitioning to \" + transition.to().name);\n * }\n * ```\n *\n * #### Audit Log (inside a state declaration)\n *\n * The `onEnter` inside this state declaration is syntactic sugar for the previous Audit Log example.\n * ```\n * {\n * name: 'admin',\n * component: 'admin',\n * onEnter: function($transition$, $state$) {\n * var AuditService = $transition$.injector().get('AuditService');\n * AuditService.log(\"Entered \" + state.name + \" module while transitioning to \" + transition.to().name);\n * }\n * }\n * ```\n *\n * Note: A state declaration's `onEnter` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onEnter(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is retained/kept.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) for\n * a specific state that was previously active will remain active (is not being entered nor exited).\n * \n * This hook is invoked when a state is \"retained\" or \"kept\".\n * It means the transition is coming *from* a substate of the retained state *to* a substate of the retained state.\n * This hook can be used to perform actions when the user moves from one substate to another, such as between steps in a wizard.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onRetain` hooks generally specify `{ retained: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onRetain` hooks are invoked after any `onExit` hooks have been fired.\n * If more than one state is retained, the child states' `onRetain` hooks are invoked first.\n * The registered `onRetain` hooks for a state are invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onRetain` hooks using the [[TransitionService]], you may define an `onRetain` hook\n * directly on a state declaration (see: [[StateDeclaration.onRetain]]).\n *\n * Note: A state declaration's `onRetain` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onRetain(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is exited.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being exited.\n *\n * Since this hook is run only when the specific state is being *exited*, it can be useful for\n * performing tasks when leaving a submodule/feature area such as cleaning up a stateful service, \n * or for preventing the user from leaving a state or submodule until some criteria is satisfied.\n *\n * See [[TransitionStateHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onExit` hooks generally specify `{ exiting: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onExit` hooks are invoked when the Transition is exiting a state.\n * States are exited after any `onStart` phase is complete.\n * If more than one state is being exited, the child states are exited first.\n * The registered `onExit` hooks for a state are invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onExit` hooks using the [[TransitionService]], you may define an `onExit` hook\n * directly on a state declaration (see: [[StateDeclaration.onExit]]).\n *\n * Note: A state declaration's `onExit` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onExit(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called *just before a transition finishes*.\n *\n * Registers a transition lifecycle hook, which is invoked just before a transition finishes.\n * This hook is a last chance to cancel or redirect a transition.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onFinish` hooks are invoked after the `onEnter` phase is complete.\n * These hooks are invoked just before the transition is \"committed\".\n * Each hook is invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onFinish(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called after a successful transition completed.\n *\n * Registers a transition lifecycle hook, which is invoked after a transition successfully completes.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onSuccess` hooks are chained off the Transition's promise (see [[Transition.promise]]).\n * If the Transition is successful and its promise is resolved, then the `onSuccess` hooks are invoked.\n * Since these hooks are run after the transition is over, their return value is ignored.\n * The `onSuccess` hooks are invoked in priority order.\n *\n * ### Return value\n *\n * Since the Transition is already completed, the hook's return value is ignored\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onSuccess(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called after a transition has errored.\n *\n * Registers a transition lifecycle hook, which is invoked after a transition has been rejected for any reason.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * The `onError` hooks are chained off the Transition's promise (see [[Transition.promise]]).\n * If a Transition fails, its promise is rejected and the `onError` hooks are invoked.\n * The `onError` hooks are invoked in priority order.\n *\n * Since these hooks are run after the transition is over, their return value is ignored.\n *\n * A transition \"errors\" if it was started, but failed to complete (for any reason).\n * A *non-exhaustive list* of reasons a transition can error:\n *\n * - A transition was cancelled because a new transition started while it was still running (`Transition superseded`)\n * - A transition was cancelled by a Transition Hook returning false\n * - A transition was redirected by a Transition Hook returning a [[TargetState]]\n * - A Transition Hook or resolve function threw an error\n * - A Transition Hook returned a rejected promise\n * - A resolve function returned a rejected promise\n *\n * To check the failure reason, inspect the return value of [[Transition.error]].\n * \n * Note: `onError` should be used for targeted error handling, or error recovery.\n * For simple catch-all error reporting, use [[StateService.defaultErrorHandler]].\n *\n * ### Return value\n *\n * Since the Transition is already completed, the hook's return value is ignored\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onError(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Returns all the registered hooks of a given `hookName` type\n *\n * #### Example:\n * ```\n * $transitions.getHooks(\"onEnter\")\n * ```\n */\n getHooks(hookName: string): RegisteredHook[];\n\n /** @hidden place to store the hooks */\n _registeredHooks: { [key: string]: RegisteredHook[] };\n}\n\n/** A predicate type which tests if a [[StateDeclaration]] passes some test. Returns a boolean. */\nexport type IStateMatch = Predicate\n\n/**\n * This object is used to configure whether or not a Transition Hook is invoked for a particular transition,\n * based on the Transition's \"to state\" and \"from state\".\n *\n * Each property (`to`, `from`, `exiting`, `retained`, and `entering`) can be a state [[Glob]] string,\n * a boolean, or a function that takes a state and returns a boolean (see [[HookMatchCriterion]])\n *\n * All properties are optional. If any property is omitted, it is replaced with the value `true`, and always matches.\n * To match any transition, use an empty criteria object `{}`.\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from the `parent` state and going to the `parent.child` state.\n * var match = {\n * to: 'parent',\n * from: 'parent.child'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any substate of `parent` and going directly to the `parent` state.\n * var match = {\n * to: 'parent',\n * from: 'parent.**'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any state and going to any substate of `mymodule`\n * var match = {\n * to: 'mymodule.**'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any state and going to any state that has `data.authRequired`\n * // set to a truthy value.\n * var match = {\n * to: function(state) {\n * return state.data != null && state.data.authRequired === true;\n * }\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition that is exiting `parent.child`\n * var match = {\n * exiting: 'parent.child'\n * }\n * ```\n */\nexport interface HookMatchCriteria {\n [key: string]: HookMatchCriterion | undefined;\n\n /** A [[HookMatchCriterion]] to match the destination state */\n to?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match the original (from) state */\n from?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be exiting */\n exiting?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be retained */\n retained?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be entering */\n entering?: HookMatchCriterion;\n}\n\nexport interface IMatchingNodes {\n [key: string]: PathNode[];\n\n to: PathNode[];\n from: PathNode[];\n exiting: PathNode[];\n retained: PathNode[];\n entering: PathNode[];\n}\n\n/** @hidden */\nexport interface RegisteredHooks {\n [key: string]: RegisteredHook[];\n}\n\n/** @hidden */\nexport interface PathTypes {\n [key: string]: PathType;\n\n to: PathType;\n from: PathType;\n exiting: PathType;\n retained: PathType;\n entering: PathType;\n}\n\n/** @hidden */\nexport interface PathType {\n name: string;\n scope: TransitionHookScope;\n}\n\n/**\n * Hook Criterion used to match a transition.\n *\n * A [[Glob]] string that matches the name of a state.\n *\n * Or, a function with the signature `function(state) { return matches; }`\n * which should return a boolean to indicate if a state matches.\n *\n * Or, `true` to always match\n */\nexport type HookMatchCriterion = (string|IStateMatch|boolean)\n\nexport enum TransitionHookPhase { CREATE, BEFORE, RUN, SUCCESS, ERROR }\nexport enum TransitionHookScope { TRANSITION, STATE }\n","/**\n * @coreapi\n * @module state\n */ /** for typedoc */\n\nimport { StateDeclaration, StateOrName, TargetStateDef } from \"./interface\";\nimport { ParamsOrArray } from \"../params/interface\";\nimport { TransitionOptions } from \"../transition/interface\";\nimport { StateObject } from \"./stateObject\";\nimport { toJson } from \"../common/common\";\nimport { isString } from \"../common/predicates\";\n\n/**\n * Encapsulate the target (destination) state/params/options of a [[Transition]].\n *\n * This class is frequently used to redirect a transition to a new destination.\n *\n * See:\n *\n * - [[HookResult]]\n * - [[TransitionHookFn]]\n * - [[TransitionService.onStart]]\n *\n * To create a `TargetState`, use [[StateService.target]].\n *\n * ---\n *\n * This class wraps:\n *\n * 1) an identifier for a state\n * 2) a set of parameters\n * 3) and transition options\n * 4) the registered state object (the [[StateDeclaration]])\n *\n * Many UI-Router APIs such as [[StateService.go]] take a [[StateOrName]] argument which can\n * either be a *state object* (a [[StateDeclaration]] or [[StateObject]]) or a *state name* (a string).\n * The `TargetState` class normalizes those options.\n *\n * A `TargetState` may be valid (the state being targeted exists in the registry)\n * or invalid (the state being targeted is not registered).\n */\nexport class TargetState {\n private _params: ParamsOrArray;\n\n /**\n * The TargetState constructor\n *\n * Note: Do not construct a `TargetState` manually.\n * To create a `TargetState`, use the [[StateService.target]] factory method.\n *\n * @param _identifier An identifier for a state.\n * Either a fully-qualified state name, or the object used to define the state.\n * @param _definition The internal state representation, if exists.\n * @param _params Parameters for the target state\n * @param _options Transition options.\n *\n * @internalapi\n */\n constructor(\n private _identifier: StateOrName,\n private _definition?: StateObject,\n _params?: ParamsOrArray,\n private _options: TransitionOptions = {}\n ) {\n this._params = _params || {};\n }\n\n /** The name of the state this object targets */\n name(): string {\n return this._definition && this._definition.name || this._identifier;\n }\n\n /** The identifier used when creating this TargetState */\n identifier(): StateOrName {\n return this._identifier;\n }\n\n /** The target parameter values */\n params(): ParamsOrArray {\n return this._params;\n }\n\n /** The internal state object (if it was found) */\n $state(): StateObject {\n return this._definition;\n }\n\n /** The internal state declaration (if it was found) */\n state(): StateDeclaration {\n return this._definition && this._definition.self;\n }\n\n /** The target options */\n options() {\n return this._options;\n }\n\n /** True if the target state was found */\n exists(): boolean {\n return !!(this._definition && this._definition.self);\n }\n\n /** True if the object is valid */\n valid(): boolean {\n return !this.error();\n }\n\n /** If the object is invalid, returns the reason why */\n error(): string {\n let base = this.options().relative;\n if (!this._definition && !!base) {\n let stateName = base.name ? base.name : base;\n return `Could not resolve '${this.name()}' from state '${stateName}'`;\n }\n if (!this._definition)\n return `No such state '${this.name()}'`;\n if (!this._definition.self)\n return `State '${this.name()}' has an invalid definition`;\n }\n\n toString() {\n return `'${this.name()}'${toJson(this.params())}`;\n }\n\n /** Returns true if the object has a state property that might be a state or state name */\n static isDef = (obj): obj is TargetStateDef =>\n obj && obj.state && (isString(obj.state) || isString(obj.state.name));\n\n // /** Returns a new TargetState based on this one, but using the specified options */\n // withOptions(_options: TransitionOptions): TargetState {\n // return extend(this._clone(), { _options });\n // }\n //\n // /** Returns a new TargetState based on this one, but using the specified params */\n // withParams(_params: ParamsOrArray): TargetState {\n // return extend(this._clone(), { _params });\n // }\n\n // private _clone = () =>\n // new TargetState(this._identifier, this._definition, this._params, this._options);\n}\n","/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport { TransitionHookOptions, HookResult, TransitionHookPhase } from './interface';\nimport { defaults, noop, silentRejection } from '../common/common';\nimport { fnToString, maxLength } from '../common/strings';\nimport { isPromise } from '../common/predicates';\nimport { is, parse } from '../common/hof';\nimport { trace } from '../common/trace';\nimport { services } from '../common/coreservices';\nimport { Rejection } from './rejectFactory';\nimport { TargetState } from '../state/targetState';\nimport { Transition } from './transition';\nimport { TransitionEventType } from './transitionEventType';\nimport { RegisteredHook } from './hookRegistry';\nimport { StateDeclaration } from '../state/interface';\n\nlet defaultOptions: TransitionHookOptions = {\n current: noop,\n transition: null,\n traceData: {},\n bind: null,\n};\n\nexport type GetResultHandler = (hook: TransitionHook) => ResultHandler;\nexport type GetErrorHandler = (hook: TransitionHook) => ErrorHandler;\n\nexport type ResultHandler = (result: HookResult) => Promise;\nexport type ErrorHandler = (error: any) => Promise;\n\n/** @hidden */\nexport class TransitionHook {\n type: TransitionEventType;\n constructor(private transition: Transition,\n private stateContext: StateDeclaration,\n private registeredHook: RegisteredHook,\n private options: TransitionHookOptions) {\n this.options = defaults(options, defaultOptions);\n this.type = registeredHook.eventType;\n }\n\n /**\n * These GetResultHandler(s) are used by [[invokeHook]] below\n * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]])\n */\n static HANDLE_RESULT: GetResultHandler = (hook: TransitionHook) => (result: HookResult) =>\n hook.handleHookResult(result);\n\n /**\n * If the result is a promise rejection, log it.\n * Otherwise, ignore the result.\n */\n static LOG_REJECTED_RESULT: GetResultHandler = (hook: TransitionHook) => (result: HookResult) => {\n isPromise(result) && result.catch(err =>\n hook.logError(Rejection.normalize(err)));\n return undefined;\n }\n\n /**\n * These GetErrorHandler(s) are used by [[invokeHook]] below\n * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]])\n */\n static LOG_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) =>\n hook.logError(error);\n\n static REJECT_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) =>\n silentRejection(error);\n\n static THROW_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) => {\n throw error;\n }\n\n private isSuperseded = () =>\n this.type.hookPhase === TransitionHookPhase.RUN && !this.options.transition.isActive();\n\n logError(err): any {\n this.transition.router.stateService.defaultErrorHandler()(err);\n }\n\n invokeHook(): Promise | void {\n let hook = this.registeredHook;\n if (hook._deregistered) return;\n\n let notCurrent = this.getNotCurrentRejection();\n if (notCurrent) return notCurrent;\n\n let options = this.options;\n trace.traceHookInvocation(this, this.transition, options);\n\n const invokeCallback = () =>\n hook.callback.call(options.bind, this.transition, this.stateContext);\n\n const normalizeErr = err =>\n Rejection.normalize(err).toPromise();\n\n const handleError = err =>\n hook.eventType.getErrorHandler(this)(err);\n\n const handleResult = result =>\n hook.eventType.getResultHandler(this)(result);\n\n try {\n let result = invokeCallback();\n\n if (!this.type.synchronous && isPromise(result)) {\n return result.catch(normalizeErr)\n .then(handleResult, handleError);\n } else {\n return handleResult(result);\n }\n } catch (err) {\n // If callback throws (synchronously)\n return handleError(Rejection.normalize(err));\n }\n }\n\n /**\n * This method handles the return value of a Transition Hook.\n *\n * A hook can return false (cancel), a TargetState (redirect),\n * or a promise (which may later resolve to false or a redirect)\n *\n * This also handles \"transition superseded\" -- when a new transition\n * was started while the hook was still running\n */\n handleHookResult(result: HookResult): Promise {\n let notCurrent = this.getNotCurrentRejection();\n if (notCurrent) return notCurrent;\n\n // Hook returned a promise\n if (isPromise(result)) {\n // Wait for the promise, then reprocess with the resulting value\n return result.then(val => this.handleHookResult(val));\n }\n\n trace.traceHookResult(result, this.transition, this.options);\n\n // Hook returned false\n if (result === false) {\n // Abort this Transition\n return Rejection.aborted(\"Hook aborted transition\").toPromise();\n }\n\n const isTargetState = is(TargetState);\n // hook returned a TargetState\n if (isTargetState(result)) {\n // Halt the current Transition and redirect (a new Transition) to the TargetState.\n return Rejection.redirected(result).toPromise();\n }\n }\n\n\n /**\n * Return a Rejection promise if the transition is no longer current due\n * to a stopped router (disposed), or a new transition has started and superseded this one.\n */\n private getNotCurrentRejection() {\n let router = this.transition.router;\n\n // The router is stopped\n if (router._disposed) {\n return Rejection.aborted(`UIRouter instance #${router.$id} has been stopped (disposed)`).toPromise();\n }\n\n if (this.transition._aborted) {\n return Rejection.aborted().toPromise();\n }\n\n // This transition is no longer current.\n // Another transition started while this hook was still running.\n if (this.isSuperseded()) {\n // Abort this transition\n return Rejection.superseded(this.options.current()).toPromise();\n }\n }\n\n toString() {\n let { options, registeredHook } = this;\n let event = parse(\"traceData.hookType\")(options) || \"internal\",\n context = parse(\"traceData.context.state.name\")(options) || parse(\"traceData.context\")(options) || \"unknown\",\n name = fnToString(registeredHook.callback);\n return `${event} context: ${context}, ${maxLength(200, name)}`;\n }\n\n /**\n * Chains together an array of TransitionHooks.\n *\n * Given a list of [[TransitionHook]] objects, chains them together.\n * Each hook is invoked after the previous one completes.\n *\n * #### Example:\n * ```js\n * var hooks: TransitionHook[] = getHooks();\n * let promise: Promise = TransitionHook.chain(hooks);\n *\n * promise.then(handleSuccess, handleError);\n * ```\n *\n * @param hooks the list of hooks to chain together\n * @param waitFor if provided, the chain is `.then()`'ed off this promise\n * @returns a `Promise` for sequentially invoking the hooks (in order)\n */\n static chain(hooks: TransitionHook[], waitFor?: Promise): Promise {\n // Chain the next hook off the previous\n const createHookChainR = (prev: Promise, nextHook: TransitionHook) =>\n prev.then(() => nextHook.invokeHook());\n return hooks.reduce(createHookChainR, waitFor || services.$q.when());\n }\n\n\n /**\n * Invokes all the provided TransitionHooks, in order.\n * Each hook's return value is checked.\n * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned.\n * If no hook returns a promise, then all hooks are processed synchronously.\n *\n * @param hooks the list of TransitionHooks to invoke\n * @param doneCallback a callback that is invoked after all the hooks have successfully completed\n *\n * @returns a promise for the async result, or the result of the callback\n */\n static invokeHooks(hooks: TransitionHook[], doneCallback: (result?: HookResult) => T): Promise | T {\n for (let idx = 0; idx < hooks.length; idx++) {\n let hookResult = hooks[idx].invokeHook();\n\n if (isPromise(hookResult)) {\n let remainingHooks = hooks.slice(idx + 1);\n\n return TransitionHook.chain(remainingHooks, hookResult)\n .then(doneCallback);\n }\n }\n\n return doneCallback();\n }\n\n /**\n * Run all TransitionHooks, ignoring their return value.\n */\n static runAllHooks(hooks: TransitionHook[]): void {\n hooks.forEach(hook => hook.invokeHook());\n }\n\n}","/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\nimport { extend, removeFrom, tail, values, identity, map } from \"../common/common\";\nimport {isString, isFunction} from \"../common/predicates\";\nimport {PathNode} from \"../path/pathNode\";\nimport {\n TransitionStateHookFn, TransitionHookFn, TransitionHookPhase, TransitionHookScope, IHookRegistry, PathType\n} from \"./interface\"; // has or is using\n\nimport {\n HookRegOptions, HookMatchCriteria, TreeChanges,\n HookMatchCriterion, IMatchingNodes, HookFn\n} from \"./interface\";\nimport {Glob} from \"../common/glob\";\nimport {StateObject} from \"../state/stateObject\";\nimport {TransitionEventType} from \"./transitionEventType\";\nimport { TransitionService } from \"./transitionService\";\n\n/**\n * Determines if the given state matches the matchCriteria\n *\n * @hidden\n *\n * @param state a State Object to test against\n * @param criterion\n * - If a string, matchState uses the string as a glob-matcher against the state name\n * - If an array (of strings), matchState uses each string in the array as a glob-matchers against the state name\n * and returns a positive match if any of the globs match.\n * - If a function, matchState calls the function with the state and returns true if the function's result is truthy.\n * @returns {boolean}\n */\nexport function matchState(state: StateObject, criterion: HookMatchCriterion) {\n let toMatch = isString(criterion) ? [criterion] : criterion;\n\n function matchGlobs(_state: StateObject) {\n let globStrings = toMatch;\n for (let i = 0; i < globStrings.length; i++) {\n let glob = new Glob(globStrings[i]);\n\n if ((glob && glob.matches(_state.name)) || (!glob && globStrings[i] === _state.name)) {\n return true;\n }\n }\n return false;\n }\n\n let matchFn = (isFunction(toMatch) ? toMatch : matchGlobs);\n return !!matchFn(state);\n}\n\n/**\n * @internalapi\n * The registration data for a registered transition hook\n */\nexport class RegisteredHook {\n priority: number;\n bind: any;\n _deregistered: boolean;\n\n constructor(public tranSvc: TransitionService,\n public eventType: TransitionEventType,\n public callback: HookFn,\n public matchCriteria: HookMatchCriteria,\n options: HookRegOptions = {} as any) {\n this.priority = options.priority || 0;\n this.bind = options.bind || null;\n this._deregistered = false;\n }\n\n /**\n * Gets the matching [[PathNode]]s\n *\n * Given an array of [[PathNode]]s, and a [[HookMatchCriterion]], returns an array containing\n * the [[PathNode]]s that the criteria matches, or `null` if there were no matching nodes.\n *\n * Returning `null` is significant to distinguish between the default\n * \"match-all criterion value\" of `true` compared to a `() => true` function,\n * when the nodes is an empty array.\n *\n * This is useful to allow a transition match criteria of `entering: true`\n * to still match a transition, even when `entering === []`. Contrast that\n * with `entering: (state) => true` which only matches when a state is actually\n * being entered.\n */\n private _matchingNodes(nodes: PathNode[], criterion: HookMatchCriterion): PathNode[] {\n if (criterion === true) return nodes;\n let matching = nodes.filter(node => matchState(node.state, criterion));\n return matching.length ? matching : null;\n }\n\n /**\n * Gets the default match criteria (all `true`)\n *\n * Returns an object which has all the criteria match paths as keys and `true` as values, i.e.:\n *\n * ```js\n * {\n * to: true,\n * from: true,\n * entering: true,\n * exiting: true,\n * retained: true,\n * }\n */\n private _getDefaultMatchCriteria(): HookMatchCriteria {\n return map(this.tranSvc._pluginapi._getPathTypes(), () => true);\n }\n\n /**\n * Gets matching nodes as [[IMatchingNodes]]\n *\n * Create a IMatchingNodes object from the TransitionHookTypes that is roughly equivalent to:\n *\n * ```js\n * let matches: IMatchingNodes = {\n * to: _matchingNodes([tail(treeChanges.to)], mc.to),\n * from: _matchingNodes([tail(treeChanges.from)], mc.from),\n * exiting: _matchingNodes(treeChanges.exiting, mc.exiting),\n * retained: _matchingNodes(treeChanges.retained, mc.retained),\n * entering: _matchingNodes(treeChanges.entering, mc.entering),\n * };\n * ```\n */\n private _getMatchingNodes(treeChanges: TreeChanges): IMatchingNodes {\n let criteria = extend(this._getDefaultMatchCriteria(), this.matchCriteria);\n let paths: PathType[] = values(this.tranSvc._pluginapi._getPathTypes());\n\n return paths.reduce((mn: IMatchingNodes, pathtype: PathType) => {\n // STATE scope criteria matches against every node in the path.\n // TRANSITION scope criteria matches against only the last node in the path\n let isStateHook = pathtype.scope === TransitionHookScope.STATE;\n let path = treeChanges[pathtype.name] || [];\n let nodes: PathNode[] = isStateHook ? path : [tail(path)];\n\n mn[pathtype.name] = this._matchingNodes(nodes, criteria[pathtype.name]);\n return mn;\n }, {} as IMatchingNodes);\n }\n\n /**\n * Determines if this hook's [[matchCriteria]] match the given [[TreeChanges]]\n *\n * @returns an IMatchingNodes object, or null. If an IMatchingNodes object is returned, its values\n * are the matching [[PathNode]]s for each [[HookMatchCriterion]] (to, from, exiting, retained, entering)\n */\n matches(treeChanges: TreeChanges): IMatchingNodes {\n let matches = this._getMatchingNodes(treeChanges);\n\n // Check if all the criteria matched the TreeChanges object\n let allMatched = values(matches).every(identity);\n return allMatched ? matches : null;\n }\n}\n\n/** @hidden Return a registration function of the requested type. */\nexport function makeEvent(registry: IHookRegistry, transitionService: TransitionService, eventType: TransitionEventType) {\n // Create the object which holds the registered transition hooks.\n let _registeredHooks = registry._registeredHooks = (registry._registeredHooks || {});\n let hooks = _registeredHooks[eventType.name] = [];\n\n // Create hook registration function on the IHookRegistry for the event\n registry[eventType.name] = hookRegistrationFn;\n\n function hookRegistrationFn(matchObject, callback, options = {}) {\n let registeredHook = new RegisteredHook(transitionService, eventType, callback, matchObject, options);\n hooks.push(registeredHook);\n\n return function deregisterEventHook() {\n registeredHook._deregistered = true;\n removeFrom(hooks)(registeredHook);\n };\n }\n\n return hookRegistrationFn;\n}","/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\n\nimport {extend, tail, assertPredicate, unnestR, identity} from \"../common/common\";\nimport {isArray} from \"../common/predicates\";\n\nimport {\n TransitionOptions, TransitionHookOptions, IHookRegistry, TreeChanges, IMatchingNodes,\n TransitionHookPhase, TransitionHookScope\n} from \"./interface\";\n\nimport {Transition} from \"./transition\";\nimport {TransitionHook} from \"./transitionHook\";\nimport {StateObject} from \"../state/stateObject\";\nimport {PathNode} from \"../path/pathNode\";\nimport {TransitionService} from \"./transitionService\";\nimport {TransitionEventType} from \"./transitionEventType\";\nimport {RegisteredHook} from \"./hookRegistry\";\n\n/**\n * This class returns applicable TransitionHooks for a specific Transition instance.\n *\n * Hooks ([[RegisteredHook]]) may be registered globally, e.g., $transitions.onEnter(...), or locally, e.g.\n * myTransition.onEnter(...). The HookBuilder finds matching RegisteredHooks (where the match criteria is\n * determined by the type of hook)\n *\n * The HookBuilder also converts RegisteredHooks objects to TransitionHook objects, which are used to run a Transition.\n *\n * The HookBuilder constructor is given the $transitions service and a Transition instance. Thus, a HookBuilder\n * instance may only be used for one specific Transition object. (side note: the _treeChanges accessor is private\n * in the Transition class, so we must also provide the Transition's _treeChanges)\n *\n */\nexport class HookBuilder {\n constructor(private transition: Transition) { }\n\n buildHooksForPhase(phase: TransitionHookPhase): TransitionHook[] {\n let $transitions = this.transition.router.transitionService;\n return $transitions._pluginapi._getEvents(phase)\n .map(type => this.buildHooks(type))\n .reduce(unnestR, [])\n .filter(identity);\n }\n\n /**\n * Returns an array of newly built TransitionHook objects.\n *\n * - Finds all RegisteredHooks registered for the given `hookType` which matched the transition's [[TreeChanges]].\n * - Finds [[PathNode]] (or `PathNode[]`) to use as the TransitionHook context(s)\n * - For each of the [[PathNode]]s, creates a TransitionHook\n *\n * @param hookType the type of the hook registration function, e.g., 'onEnter', 'onFinish'.\n */\n buildHooks(hookType: TransitionEventType): TransitionHook[] {\n let transition = this.transition;\n let treeChanges = transition.treeChanges();\n\n // Find all the matching registered hooks for a given hook type\n let matchingHooks = this.getMatchingHooks(hookType, treeChanges);\n if (!matchingHooks) return [];\n\n let baseHookOptions = {\n transition: transition,\n current: transition.options().current\n };\n\n const makeTransitionHooks = (hook: RegisteredHook) => {\n // Fetch the Nodes that caused this hook to match.\n let matches: IMatchingNodes = hook.matches(treeChanges);\n // Select the PathNode[] that will be used as TransitionHook context objects\n let matchingNodes: PathNode[] = matches[hookType.criteriaMatchPath.name];\n\n // Return an array of HookTuples\n return matchingNodes.map(node => {\n let _options = extend({\n bind: hook.bind,\n traceData: { hookType: hookType.name, context: node }\n }, baseHookOptions);\n\n let state = hookType.criteriaMatchPath.scope === TransitionHookScope.STATE ? node.state.self : null;\n let transitionHook = new TransitionHook(transition, state, hook, _options);\n return { hook, node, transitionHook };\n });\n };\n\n return matchingHooks.map(makeTransitionHooks)\n .reduce(unnestR, [])\n .sort(tupleSort(hookType.reverseSort))\n .map(tuple => tuple.transitionHook);\n }\n\n /**\n * Finds all RegisteredHooks from:\n * - The Transition object instance hook registry\n * - The TransitionService ($transitions) global hook registry\n *\n * which matched:\n * - the eventType\n * - the matchCriteria (to, from, exiting, retained, entering)\n *\n * @returns an array of matched [[RegisteredHook]]s\n */\n public getMatchingHooks(hookType: TransitionEventType, treeChanges: TreeChanges): RegisteredHook[] {\n let isCreate = hookType.hookPhase === TransitionHookPhase.CREATE;\n\n // Instance and Global hook registries\n let $transitions = this.transition.router.transitionService;\n let registries = isCreate ? [ $transitions ] : [ this.transition, $transitions ];\n\n return registries.map((reg: IHookRegistry) => reg.getHooks(hookType.name)) // Get named hooks from registries\n .filter(assertPredicate(isArray, `broken event named: ${hookType.name}`)) // Sanity check\n .reduce(unnestR, []) // Un-nest RegisteredHook[][] to RegisteredHook[] array\n .filter(hook => hook.matches(treeChanges)); // Only those satisfying matchCriteria\n }\n}\n\ninterface HookTuple { hook: RegisteredHook, node: PathNode, transitionHook: TransitionHook }\n\n/**\n * A factory for a sort function for HookTuples.\n *\n * The sort function first compares the PathNode depth (how deep in the state tree a node is), then compares\n * the EventHook priority.\n *\n * @param reverseDepthSort a boolean, when true, reverses the sort order for the node depth\n * @returns a tuple sort function\n */\nfunction tupleSort(reverseDepthSort = false) {\n return function nodeDepthThenPriority(l: HookTuple, r: HookTuple): number {\n let factor = reverseDepthSort ? -1 : 1;\n let depthDelta = (l.node.state.path.length - r.node.state.path.length) * factor;\n return depthDelta !== 0 ? depthDelta : r.hook.priority - l.hook.priority;\n }\n}","/**\n * @coreapi\n * @module params\n */\n/** */\nimport {extend, filter, map} from \"../common/common\";\nimport {isArray, isDefined} from \"../common/predicates\";\nimport {ParamTypeDefinition} from \"./interface\";\n\n/**\n * An internal class which implements [[ParamTypeDefinition]].\n *\n * A [[ParamTypeDefinition]] is a plain javascript object used to register custom parameter types.\n * When a param type definition is registered, an instance of this class is created internally.\n *\n * This class has naive implementations for all the [[ParamTypeDefinition]] methods.\n *\n * Used by [[UrlMatcher]] when matching or formatting URLs, or comparing and validating parameter values.\n *\n * #### Example:\n * ```js\n * var paramTypeDef = {\n * decode: function(val) { return parseInt(val, 10); },\n * encode: function(val) { return val && val.toString(); },\n * equals: function(a, b) { return this.is(a) && a === b; },\n * is: function(val) { return angular.isNumber(val) && isFinite(val) && val % 1 === 0; },\n * pattern: /\\d+/\n * }\n *\n * var paramType = new ParamType(paramTypeDef);\n * ```\n * @internalapi\n */\nexport class ParamType implements ParamTypeDefinition {\n /** @inheritdoc */\n pattern: RegExp = /.*/;\n /** The name/id of the parameter type */\n name: string;\n /** @inheritdoc */\n raw: boolean;\n /** @inheritdoc */\n dynamic: boolean;\n /** @inheritdoc */\n inherit = true;\n\n /**\n * @param def A configuration object which contains the custom type definition. The object's\n * properties will override the default methods and/or pattern in `ParamType`'s public interface.\n * @returns a new ParamType object\n */\n constructor(def: ParamTypeDefinition) {\n extend(this, def);\n }\n\n\n // consider these four methods to be \"abstract methods\" that should be overridden\n /** @inheritdoc */\n is(val: any, key?: string): boolean { return true; }\n /** @inheritdoc */\n encode(val: any, key?: string): (string|string[]) { return val; }\n /** @inheritdoc */\n decode(val: string, key?: string): any { return val; }\n /** @inheritdoc */\n equals(a: any, b: any): boolean { return a == b; }\n\n\n $subPattern() {\n let sub = this.pattern.toString();\n return sub.substr(1, sub.length - 2);\n }\n\n toString() {\n return `{ParamType:${this.name}}`;\n }\n\n /** Given an encoded string, or a decoded object, returns a decoded object */\n $normalize(val: any) {\n return this.is(val) ? val : this.decode(val);\n }\n\n /**\n * Wraps an existing custom ParamType as an array of ParamType, depending on 'mode'.\n * e.g.:\n * - urlmatcher pattern \"/path?{queryParam[]:int}\"\n * - url: \"/path?queryParam=1&queryParam=2\n * - $stateParams.queryParam will be [1, 2]\n * if `mode` is \"auto\", then\n * - url: \"/path?queryParam=1 will create $stateParams.queryParam: 1\n * - url: \"/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2]\n */\n $asArray(mode: (boolean|\"auto\"), isSearch: boolean) {\n if (!mode) return this;\n if (mode === \"auto\" && !isSearch) throw new Error(\"'auto' array mode is for query parameters only\");\n return new ( ArrayType)(this, mode);\n }\n}\n\n/**\n * Wraps up a `ParamType` object to handle array values.\n * @internalapi\n */\nfunction ArrayType(type: ParamType, mode: (boolean|\"auto\")) {\n // Wrap non-array value as array\n function arrayWrap(val: any): any[] {\n return isArray(val) ? val : (isDefined(val) ? [ val ] : []);\n }\n\n // Unwrap array value for \"auto\" mode. Return undefined for empty array.\n function arrayUnwrap(val: any) {\n switch (val.length) {\n case 0: return undefined;\n case 1: return mode === \"auto\" ? val[0] : val;\n default: return val;\n }\n }\n\n // Wraps type (.is/.encode/.decode) functions to operate on each value of an array\n function arrayHandler(callback: (x: any) => any, allTruthyMode?: boolean) {\n return function handleArray(val: any) {\n if (isArray(val) && val.length === 0) return val;\n let arr = arrayWrap(val);\n let result = map(arr, callback);\n return (allTruthyMode === true) ? filter(result, x => !x).length === 0 : arrayUnwrap(result);\n };\n }\n\n // Wraps type (.equals) functions to operate on each value of an array\n function arrayEqualsHandler(callback: (l: any, r: any) => boolean) {\n return function handleArray(val1: any, val2: any) {\n let left = arrayWrap(val1), right = arrayWrap(val2);\n if (left.length !== right.length) return false;\n for (let i = 0; i < left.length; i++) {\n if (!callback(left[i], right[i])) return false;\n }\n return true;\n };\n }\n\n ['encode', 'decode', 'equals', '$normalize'].forEach(name => {\n var paramTypeFn = type[name].bind(type);\n var wrapperFn: Function = name === 'equals' ? arrayEqualsHandler : arrayHandler;\n this[name] = wrapperFn(paramTypeFn);\n });\n\n extend(this, {\n dynamic: type.dynamic,\n name: type.name,\n pattern: type.pattern,\n inherit: type.inherit,\n is: arrayHandler(type.is.bind(type), true),\n $arrayMode: mode\n });\n}\n","/**\n * @coreapi\n * @module params\n */ /** for typedoc */\nimport { extend, filter, map, allTrueR } from \"../common/common\";\nimport { prop } from \"../common/hof\";\nimport { isInjectable, isDefined, isString, isArray, isUndefined } from \"../common/predicates\";\nimport { RawParams, ParamDeclaration } from \"../params/interface\";\nimport { services } from \"../common/coreservices\";\nimport { ParamType } from \"./paramType\";\nimport { ParamTypes } from \"./paramTypes\";\nimport { UrlMatcherFactory } from \"../url/urlMatcherFactory\";\n\n/** @hidden */ let hasOwn = Object.prototype.hasOwnProperty;\n/** @hidden */ let isShorthand = (cfg: ParamDeclaration) =>\n [\"value\", \"type\", \"squash\", \"array\", \"dynamic\"].filter(hasOwn.bind(cfg || {})).length === 0;\n\n/** @internalapi */\nexport enum DefType {\n PATH,\n SEARCH,\n CONFIG,\n}\n\n/** @hidden */\nfunction unwrapShorthand(cfg: ParamDeclaration): ParamDeclaration {\n cfg = isShorthand(cfg) && { value: cfg } as any || cfg;\n\n getStaticDefaultValue['__cacheable'] = true;\n function getStaticDefaultValue() {\n return cfg.value;\n }\n\n return extend(cfg, {\n $$fn: isInjectable(cfg.value) ? cfg.value : getStaticDefaultValue,\n });\n}\n\n/** @hidden */\nfunction getType(cfg: ParamDeclaration, urlType: ParamType, location: DefType, id: string, paramTypes: ParamTypes) {\n if (cfg.type && urlType && urlType.name !== 'string') throw new Error(`Param '${id}' has two type configurations.`);\n if (cfg.type && urlType && urlType.name === 'string' && paramTypes.type(cfg.type as string)) return paramTypes.type(cfg.type as string);\n if (urlType) return urlType;\n if (!cfg.type) {\n let type = location === DefType.CONFIG ? \"any\" :\n location === DefType.PATH ? \"path\" :\n location === DefType.SEARCH ? \"query\" : \"string\";\n return paramTypes.type(type);\n }\n return cfg.type instanceof ParamType ? cfg.type : paramTypes.type(cfg.type as string);\n}\n\n/**\n * @internalapi\n * returns false, true, or the squash value to indicate the \"default parameter url squash policy\".\n */\nfunction getSquashPolicy(config: ParamDeclaration, isOptional: boolean, defaultPolicy: (boolean|string)) {\n let squash = config.squash;\n if (!isOptional || squash === false) return false;\n if (!isDefined(squash) || squash == null) return defaultPolicy;\n if (squash === true || isString(squash)) return squash;\n throw new Error(`Invalid squash policy: '${squash}'. Valid policies: false, true, or arbitrary string`);\n}\n\n/** @internalapi */\nfunction getReplace(config: ParamDeclaration, arrayMode: boolean, isOptional: boolean, squash: (string|boolean)) {\n let replace: any, configuredKeys: string[], defaultPolicy = [\n {from: \"\", to: (isOptional || arrayMode ? undefined : \"\")},\n {from: null, to: (isOptional || arrayMode ? undefined : \"\")},\n ];\n replace = isArray(config.replace) ? config.replace : [];\n if (isString(squash)) replace.push({ from: squash, to: undefined });\n configuredKeys = map(replace, prop(\"from\"));\n return filter(defaultPolicy, item => configuredKeys.indexOf(item.from) === -1).concat(replace);\n}\n\n\n/** @internalapi */\nexport class Param {\n id: string;\n type: ParamType;\n location: DefType;\n isOptional: boolean;\n dynamic: boolean;\n raw: boolean;\n squash: (boolean|string);\n replace: [{ to: any, from: any }];\n inherit: boolean;\n array: boolean;\n config: any;\n /** Cache the default value if it is a static value */\n _defaultValueCache: {\n defaultValue: any,\n };\n\n constructor(id: string, type: ParamType, config: ParamDeclaration, location: DefType, urlMatcherFactory: UrlMatcherFactory) {\n config = unwrapShorthand(config);\n type = getType(config, type, location, id, urlMatcherFactory.paramTypes);\n let arrayMode = getArrayMode();\n type = arrayMode ? type.$asArray(arrayMode, location === DefType.SEARCH) : type;\n let isOptional = config.value !== undefined || location === DefType.SEARCH;\n let dynamic = isDefined(config.dynamic) ? !!config.dynamic : !!type.dynamic;\n let raw = isDefined(config.raw) ? !!config.raw : !!type.raw;\n let squash = getSquashPolicy(config, isOptional, urlMatcherFactory.defaultSquashPolicy());\n let replace = getReplace(config, arrayMode, isOptional, squash);\n let inherit = isDefined(config.inherit) ? !!config.inherit : !!type.inherit;\n\n // array config: param name (param[]) overrides default settings. explicit config overrides param name.\n function getArrayMode() {\n let arrayDefaults = { array: (location === DefType.SEARCH ? \"auto\" : false) };\n let arrayParamNomenclature = id.match(/\\[\\]$/) ? { array: true } : {};\n return extend(arrayDefaults, arrayParamNomenclature, config).array;\n }\n\n extend(this, {id, type, location, isOptional, dynamic, raw, squash, replace, inherit, array: arrayMode, config });\n }\n\n isDefaultValue(value: any): boolean {\n return this.isOptional && this.type.equals(this.value(), value);\n }\n\n /**\n * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the\n * default value, which may be the result of an injectable function.\n */\n value(value?: any): any {\n /**\n * [Internal] Get the default value of a parameter, which may be an injectable function.\n */\n const getDefaultValue = () => {\n if (this._defaultValueCache) return this._defaultValueCache.defaultValue;\n\n if (!services.$injector) throw new Error(\"Injectable functions cannot be called at configuration time\");\n\n let defaultValue = services.$injector.invoke(this.config.$$fn);\n\n if (defaultValue !== null && defaultValue !== undefined && !this.type.is(defaultValue))\n throw new Error(`Default value (${defaultValue}) for parameter '${this.id}' is not an instance of ParamType (${this.type.name})`);\n\n if (this.config.$$fn['__cacheable']) {\n this._defaultValueCache = { defaultValue };\n }\n\n return defaultValue;\n };\n\n const replaceSpecialValues = (val: any) => {\n for (let tuple of this.replace) {\n if (tuple.from === val) return tuple.to;\n }\n return val;\n };\n\n value = replaceSpecialValues(value);\n\n return isUndefined(value) ? getDefaultValue() : this.type.$normalize(value);\n }\n\n isSearch(): boolean {\n return this.location === DefType.SEARCH;\n }\n\n validates(value: any): boolean {\n // There was no parameter value, but the param is optional\n if ((isUndefined(value) || value === null) && this.isOptional) return true;\n\n // The value was not of the correct ParamType, and could not be decoded to the correct ParamType\n const normalized = this.type.$normalize(value);\n if (!this.type.is(normalized)) return false;\n\n // The value was of the correct type, but when encoded, did not match the ParamType's regexp\n const encoded = this.type.encode(normalized);\n return !(isString(encoded) && !this.type.pattern.exec( encoded));\n }\n\n toString() {\n return `{Param:${this.id} ${this.type} squash: '${this.squash}' optional: ${this.isOptional}}`;\n }\n\n static values(params: Param[], values: RawParams = {}): RawParams {\n const paramValues = {} as RawParams;\n for (let param of params) {\n paramValues[param.id] = param.value(values[param.id]);\n }\n return paramValues;\n }\n\n /**\n * Finds [[Param]] objects which have different param values\n *\n * Filters a list of [[Param]] objects to only those whose parameter values differ in two param value objects\n *\n * @param params: The list of Param objects to filter\n * @param values1: The first set of parameter values\n * @param values2: the second set of parameter values\n *\n * @returns any Param objects whose values were different between values1 and values2\n */\n static changed(params: Param[], values1: RawParams = {}, values2: RawParams = {}): Param[] {\n return params.filter(param => !param.type.equals(values1[param.id], values2[param.id]));\n }\n\n /**\n * Checks if two param value objects are equal (for a set of [[Param]] objects)\n *\n * @param params The list of [[Param]] objects to check\n * @param values1 The first set of param values\n * @param values2 The second set of param values\n *\n * @returns true if the param values in values1 and values2 are equal\n */\n static equals(params: Param[], values1 = {}, values2 = {}): boolean {\n return Param.changed(params, values1, values2).length === 0;\n }\n\n /** Returns true if a the parameter values are valid, according to the Param definitions */\n static validates(params: Param[], values: RawParams = {}): boolean {\n return params.map(param => param.validates(values[param.id])).reduce(allTrueR, true);\n }\n}","/** @module path */ /** for typedoc */\nimport {extend, applyPairs, find, allTrueR, pairs, arrayTuples} from \"../common/common\";\nimport {propEq} from \"../common/hof\";\nimport {StateObject} from \"../state/stateObject\";\nimport {RawParams} from \"../params/interface\";\nimport {Param} from \"../params/param\";\nimport {Resolvable} from \"../resolve/resolvable\";\nimport {ViewConfig} from \"../view/interface\";\n\n/**\n * @internalapi\n *\n * A node in a [[TreeChanges]] path\n *\n * For a [[TreeChanges]] path, this class holds the stateful information for a single node in the path.\n * Each PathNode corresponds to a state being entered, exited, or retained.\n * The stateful information includes parameter values and resolve data.\n */\nexport class PathNode {\n /** The state being entered, exited, or retained */\n public state: StateObject;\n /** The parameters declared on the state */\n public paramSchema: Param[];\n /** The parameter values that belong to the state */\n public paramValues: { [key: string]: any };\n /** The individual (stateful) resolvable objects that belong to the state */\n public resolvables: Resolvable[];\n /** The state's declared view configuration objects */\n public views: ViewConfig[];\n\n /** Creates a copy of a PathNode */\n constructor(node: PathNode);\n /** Creates a new (empty) PathNode for a State */\n constructor(state: StateObject);\n constructor(stateOrNode: any) {\n if (stateOrNode instanceof PathNode) {\n let node: PathNode = stateOrNode;\n this.state = node.state;\n this.paramSchema = node.paramSchema.slice();\n this.paramValues = extend({}, node.paramValues);\n this.resolvables = node.resolvables.slice();\n this.views = node.views && node.views.slice();\n } else {\n let state: StateObject = stateOrNode;\n this.state = state;\n this.paramSchema = state.parameters({ inherit: false });\n this.paramValues = {};\n this.resolvables = state.resolvables.map(res => res.clone());\n }\n }\n\n /** Sets [[paramValues]] for the node, from the values of an object hash */\n applyRawParams(params: RawParams): PathNode {\n const getParamVal = (paramDef: Param) => [ paramDef.id, paramDef.value(params[paramDef.id]) ];\n this.paramValues = this.paramSchema.reduce((memo, pDef) => applyPairs(memo, getParamVal(pDef)), {});\n return this;\n }\n\n /** Gets a specific [[Param]] metadata that belongs to the node */\n parameter(name: string): Param {\n return find(this.paramSchema, propEq(\"id\", name));\n }\n\n /**\n * @returns true if the state and parameter values for another PathNode are\n * equal to the state and param values for this PathNode\n */\n equals(node: PathNode, paramsFn?: GetParamsFn): boolean {\n const diff = this.diff(node, paramsFn);\n return diff && diff.length === 0;\n }\n\n /**\n * Finds Params with different parameter values on another PathNode.\n *\n * Given another node (of the same state), finds the parameter values which differ.\n * Returns the [[Param]] (schema objects) whose parameter values differ.\n *\n * Given another node for a different state, returns `false`\n *\n * @param node The node to compare to\n * @param paramsFn A function that returns which parameters should be compared.\n * @returns The [[Param]]s which differ, or null if the two nodes are for different states\n */\n diff(node: PathNode, paramsFn?: GetParamsFn): Param[] | false {\n if (this.state !== node.state) return false;\n\n const params: Param[] = paramsFn ? paramsFn(this) : this.paramSchema;\n return Param.changed(params, this.paramValues, node.paramValues);\n }\n\n /** Returns a clone of the PathNode */\n static clone(node: PathNode) {\n return new PathNode(node);\n }\n}\n\n/** @hidden */\nexport type GetParamsFn = (pathNode: PathNode) => Param[];","/** @module path */ /** for typedoc */\n\nimport {\n extend, find, pick, omit, tail, mergeR, values, unnestR, Predicate, inArray, arrayTuples,\n} from \"../common/common\";\nimport {prop, propEq, not} from \"../common/hof\";\n\nimport {RawParams} from \"../params/interface\";\nimport {TreeChanges} from \"../transition/interface\";\nimport {ViewConfig} from \"../view/interface\";\nimport {_ViewDeclaration} from \"../state/interface\";\n\nimport {StateObject} from \"../state/stateObject\";\nimport {TargetState} from \"../state/targetState\";\nimport {GetParamsFn, PathNode} from \"./pathNode\";\nimport {ViewService} from \"../view/view\";\nimport { Param } from '../params/param';\n\n/**\n * This class contains functions which convert TargetStates, Nodes and paths from one type to another.\n */\nexport class PathUtils {\n\n constructor() { }\n\n /** Given a PathNode[], create an TargetState */\n static makeTargetState(path: PathNode[]): TargetState {\n let state = tail(path).state;\n return new TargetState(state, state, path.map(prop(\"paramValues\")).reduce(mergeR, {}));\n }\n\n static buildPath(targetState: TargetState) {\n let toParams = targetState.params();\n return targetState.$state().path.map(state => new PathNode(state).applyRawParams(toParams));\n }\n\n /** Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[] */\n static buildToPath(fromPath: PathNode[], targetState: TargetState): PathNode[] {\n let toPath: PathNode[] = PathUtils.buildPath(targetState);\n if (targetState.options().inherit) {\n return PathUtils.inheritParams(fromPath, toPath, Object.keys(targetState.params()));\n }\n return toPath;\n }\n\n /**\n * Creates ViewConfig objects and adds to nodes.\n *\n * On each [[PathNode]], creates ViewConfig objects from the views: property of the node's state\n */\n static applyViewConfigs($view: ViewService, path: PathNode[], states: StateObject[]) {\n // Only apply the viewConfigs to the nodes for the given states\n path.filter(node => inArray(states, node.state)).forEach(node => {\n let viewDecls: _ViewDeclaration[] = values(node.state.views || {});\n let subPath = PathUtils.subPath(path, n => n === node);\n let viewConfigs: ViewConfig[][] = viewDecls.map(view => $view.createViewConfig(subPath, view));\n node.views = viewConfigs.reduce(unnestR, []);\n });\n }\n\n /**\n * Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath\n *\n * For a parameter in a node to be inherited from the from path:\n * - The toPath's node must have a matching node in the fromPath (by state).\n * - The parameter name must not be found in the toKeys parameter array.\n *\n * Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some\n * caller, for instance, $state.transitionTo(..., toParams). If a key was found in toParams,\n * it is not inherited from the fromPath.\n */\n static inheritParams(fromPath: PathNode[], toPath: PathNode[], toKeys: string[] = []): PathNode[] {\n function nodeParamVals(path: PathNode[], state: StateObject): RawParams {\n let node: PathNode = find(path, propEq('state', state));\n return extend({}, node && node.paramValues);\n }\n\n let noInherit = fromPath.map(node => node.paramSchema)\n .reduce(unnestR, [])\n .filter(param => !param.inherit)\n .map(prop('id'));\n\n /**\n * Given an [[PathNode]] \"toNode\", return a new [[PathNode]] with param values inherited from the\n * matching node in fromPath. Only inherit keys that aren't found in \"toKeys\" from the node in \"fromPath\"\"\n */\n function makeInheritedParamsNode(toNode: PathNode): PathNode {\n // All param values for the node (may include default key/vals, when key was not found in toParams)\n let toParamVals = extend({}, toNode && toNode.paramValues);\n // limited to only those keys found in toParams\n let incomingParamVals = pick(toParamVals, toKeys);\n toParamVals = omit(toParamVals, toKeys);\n let fromParamVals = omit(nodeParamVals(fromPath, toNode.state) || {}, noInherit);\n // extend toParamVals with any fromParamVals, then override any of those those with incomingParamVals\n let ownParamVals: RawParams = extend(toParamVals, fromParamVals, incomingParamVals);\n return new PathNode(toNode.state).applyRawParams(ownParamVals);\n }\n\n // The param keys specified by the incoming toParams\n return toPath.map(makeInheritedParamsNode);\n }\n\n static nonDynamicParams = (node: PathNode): Param[] =>\n node.state.parameters({ inherit: false })\n .filter(param => !param.dynamic);\n\n /**\n * Computes the tree changes (entering, exiting) between a fromPath and toPath.\n */\n static treeChanges(fromPath: PathNode[], toPath: PathNode[], reloadState: StateObject): TreeChanges {\n let keep = 0, max = Math.min(fromPath.length, toPath.length);\n\n const nodesMatch = (node1: PathNode, node2: PathNode) =>\n node1.equals(node2, PathUtils.nonDynamicParams);\n\n while (keep < max && fromPath[keep].state !== reloadState && nodesMatch(fromPath[keep], toPath[keep])) {\n keep++;\n }\n\n /** Given a retained node, return a new node which uses the to node's param values */\n function applyToParams(retainedNode: PathNode, idx: number): PathNode {\n let cloned = PathNode.clone(retainedNode);\n cloned.paramValues = toPath[idx].paramValues;\n return cloned;\n }\n\n let from: PathNode[], retained: PathNode[], exiting: PathNode[], entering: PathNode[], to: PathNode[];\n\n from = fromPath;\n retained = from.slice(0, keep);\n exiting = from.slice(keep);\n\n // Create a new retained path (with shallow copies of nodes) which have the params of the toPath mapped\n let retainedWithToParams = retained.map(applyToParams);\n entering = toPath.slice(keep);\n to = (retainedWithToParams).concat(entering);\n\n return { from, to, retained, exiting, entering };\n }\n\n /**\n * Returns a new path which is: the subpath of the first path which matches the second path.\n *\n * The new path starts from root and contains any nodes that match the nodes in the second path.\n * It stops before the first non-matching node.\n *\n * Nodes are compared using their state property and their parameter values.\n * If a `paramsFn` is provided, only the [[Param]] returned by the function will be considered when comparing nodes.\n *\n * @param pathA the first path\n * @param pathB the second path\n * @param paramsFn a function which returns the parameters to consider when comparing\n *\n * @returns an array of PathNodes from the first path which match the nodes in the second path\n */\n static matching(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): PathNode[] {\n let done = false;\n let tuples: PathNode[][] = arrayTuples(pathA, pathB);\n return tuples.reduce((matching, [nodeA, nodeB]) => {\n done = done || !nodeA.equals(nodeB, paramsFn);\n return done ? matching : matching.concat(nodeA);\n }, []);\n }\n\n /**\n * Returns true if two paths are identical.\n *\n * @param pathA\n * @param pathB\n * @param paramsFn a function which returns the parameters to consider when comparing\n * @returns true if the the states and parameter values for both paths are identical\n */\n static equals(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): boolean {\n return pathA.length === pathB.length &&\n PathUtils.matching(pathA, pathB, paramsFn).length === pathA.length;\n }\n\n /**\n * Return a subpath of a path, which stops at the first matching node\n *\n * Given an array of nodes, returns a subset of the array starting from the first node,\n * stopping when the first node matches the predicate.\n *\n * @param path a path of [[PathNode]]s\n * @param predicate a [[Predicate]] fn that matches [[PathNode]]s\n * @returns a subpath up to the matching node, or undefined if no match is found\n */\n static subPath(path: PathNode[], predicate: Predicate): PathNode[] {\n let node = find(path, predicate);\n let elementIdx = path.indexOf(node);\n return elementIdx === -1 ? undefined : path.slice(0, elementIdx + 1);\n }\n\n /** Gets the raw parameter values from a path */\n static paramValues = (path: PathNode[]) =>\n path.reduce((acc, node) => extend(acc, node.paramValues), {});\n}\n","/**\n * @coreapi\n * @module resolve\n */ /** for typedoc */\nimport {extend, equals, inArray, identity} from \"../common/common\";\nimport {services} from \"../common/coreservices\";\nimport {trace} from \"../common/trace\";\nimport {ResolvePolicy, ResolvableLiteral, resolvePolicies} from \"./interface\";\n\nimport {ResolveContext} from \"./resolveContext\";\nimport {stringify} from \"../common/strings\";\nimport {isFunction, isObject} from \"../common/predicates\";\nimport {Transition} from \"../transition/transition\";\nimport {StateObject} from \"../state/stateObject\";\nimport {PathNode} from \"../path/pathNode\";\nimport { isNullOrUndefined } from '../common';\n\n\n// TODO: explicitly make this user configurable\nexport let defaultResolvePolicy: ResolvePolicy = {\n when: \"LAZY\",\n async: \"WAIT\"\n};\n\n/**\n * The basic building block for the resolve system.\n *\n * Resolvables encapsulate a state's resolve's resolveFn, the resolveFn's declared dependencies, the wrapped (.promise),\n * and the unwrapped-when-complete (.data) result of the resolveFn.\n *\n * Resolvable.get() either retrieves the Resolvable's existing promise, or else invokes resolve() (which invokes the\n * resolveFn) and returns the resulting promise.\n *\n * Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first\n * parameter to those fns.\n */\nexport class Resolvable implements ResolvableLiteral {\n token: any;\n policy: ResolvePolicy;\n resolveFn: Function;\n deps: any[];\n\n data: any;\n resolved: boolean = false;\n promise: Promise = undefined;\n\n /** This constructor creates a Resolvable copy */\n constructor(resolvable: Resolvable)\n\n /** This constructor creates a new Resolvable from the plain old [[ResolvableLiteral]] javascript object */\n constructor(resolvable: ResolvableLiteral)\n\n /**\n * This constructor creates a new `Resolvable`\n *\n * #### Example:\n * ```js\n * var resolvable1 = new Resolvable('mytoken', http => http.get('foo.json').toPromise(), [Http]);\n *\n * var resolvable2 = new Resolvable(UserService, dep => new UserService(dep.data), [SomeDependency]);\n *\n * var resolvable1Clone = new Resolvable(resolvable1);\n * ```\n *\n * @param token The new resolvable's injection token, such as `\"userList\"` (a string) or `UserService` (a class).\n * When this token is used during injection, the resolved value will be injected.\n * @param resolveFn The function that returns the resolved value, or a promise for the resolved value\n * @param deps An array of dependencies, which will be injected into the `resolveFn`\n * @param policy the [[ResolvePolicy]] defines when and how the Resolvable is processed\n * @param data Pre-resolved data. If the resolve value is already known, it may be provided here.\n */\n constructor(token: any, resolveFn: Function, deps?: any[], policy?: ResolvePolicy, data?: any)\n constructor(arg1: any, resolveFn?: Function, deps?: any[], policy?: ResolvePolicy, data?: any) {\n if (arg1 instanceof Resolvable) {\n extend(this, arg1);\n } else if (isFunction(resolveFn)) {\n if (isNullOrUndefined(arg1)) throw new Error(\"new Resolvable(): token argument is required\");\n if (!isFunction(resolveFn)) throw new Error(\"new Resolvable(): resolveFn argument must be a function\");\n\n this.token = arg1;\n this.policy = policy;\n this.resolveFn = resolveFn;\n this.deps = deps || [];\n\n this.data = data;\n this.resolved = data !== undefined;\n this.promise = this.resolved ? services.$q.when(this.data) : undefined;\n } else if (isObject(arg1) && arg1.token && isFunction(arg1.resolveFn)) {\n let literal = arg1;\n return new Resolvable(literal.token, literal.resolveFn, literal.deps, literal.policy, literal.data);\n }\n }\n\n getPolicy(state: StateObject): ResolvePolicy {\n let thisPolicy = this.policy || {};\n let statePolicy = state && state.resolvePolicy || {};\n return {\n when: thisPolicy.when || statePolicy.when || defaultResolvePolicy.when,\n async: thisPolicy.async || statePolicy.async || defaultResolvePolicy.async,\n };\n }\n\n /**\n * Asynchronously resolve this Resolvable's data\n *\n * Given a ResolveContext that this Resolvable is found in:\n * Wait for this Resolvable's dependencies, then invoke this Resolvable's function\n * and update the Resolvable's state\n */\n resolve(resolveContext: ResolveContext, trans?: Transition) {\n let $q = services.$q;\n\n // Gets all dependencies from ResolveContext and wait for them to be resolved\n const getResolvableDependencies = () =>\n $q.all(resolveContext.getDependencies(this).map(resolvable =>\n resolvable.get(resolveContext, trans))) as Promise;\n\n // Invokes the resolve function passing the resolved dependencies as arguments\n const invokeResolveFn = (resolvedDeps: any[]) =>\n this.resolveFn.apply(null, resolvedDeps);\n\n /**\n * For RXWAIT policy:\n *\n * Given an observable returned from a resolve function:\n * - enables .cache() mode (this allows multicast subscribers)\n * - then calls toPromise() (this triggers subscribe() and thus fetches)\n * - Waits for the promise, then return the cached observable (not the first emitted value).\n */\n const waitForRx = (observable$: any) => {\n let cached = observable$.cache(1);\n return cached.take(1).toPromise().then(() => cached);\n };\n\n // If the resolve policy is RXWAIT, wait for the observable to emit something. otherwise pass through.\n let node: PathNode = resolveContext.findNode(this);\n let state: StateObject = node && node.state;\n let maybeWaitForRx = this.getPolicy(state).async === \"RXWAIT\" ? waitForRx : identity;\n\n // After the final value has been resolved, update the state of the Resolvable\n const applyResolvedValue = (resolvedValue: any) => {\n this.data = resolvedValue;\n this.resolved = true;\n trace.traceResolvableResolved(this, trans);\n return this.data;\n };\n\n // Sets the promise property first, then getsResolvableDependencies in the context of the promise chain. Always waits one tick.\n return this.promise = $q.when()\n .then(getResolvableDependencies)\n .then(invokeResolveFn)\n .then(maybeWaitForRx)\n .then(applyResolvedValue);\n }\n\n /**\n * Gets a promise for this Resolvable's data.\n *\n * Fetches the data and returns a promise.\n * Returns the existing promise if it has already been fetched once.\n */\n get(resolveContext: ResolveContext, trans?: Transition): Promise {\n return this.promise || this.resolve(resolveContext, trans);\n }\n\n toString() {\n return `Resolvable(token: ${stringify(this.token)}, requires: [${this.deps.map(stringify)}])`;\n }\n\n clone(): Resolvable {\n return new Resolvable(this);\n }\n \n static fromData = (token: any, data: any) => \n new Resolvable(token, () => data, null, null, data);\n}\n","/**\n * # The Resolve subsystem\n *\n * This subsystem is an asynchronous, hierarchical Dependency Injection system.\n *\n * Typically, resolve is configured on a state using a [[StateDeclaration.resolve]] declaration.\n *\n * @coreapi\n * @module resolve\n */ /** for typedoc */\nimport {Resolvable} from \"./resolvable\";\n\n/**\n * An interface which is similar to an Angular 2 `Provider`\n */\nexport interface ProviderLike {\n provide: any,\n useClass?: any,\n useFactory?: Function,\n useValue?: any,\n useExisting?: any,\n deps?: any[]\n}\n\n/**\n * A plain object used to describe a [[Resolvable]]\n *\n * These objects may be used in the [[StateDeclaration.resolve]] array to declare\n * async data that the state or substates require.\n *\n * #### Example:\n * ```js\n *\n * var state = {\n * name: 'main',\n * resolve: [\n * { token: 'myData', deps: [MyDataApi], resolveFn: (myDataApi) => myDataApi.getData() },\n * ],\n * }\n * ```\n */\nexport interface ResolvableLiteral {\n /**\n * A Dependency Injection token\n *\n * This Resolvable's DI token.\n * The Resolvable will be injectable elsewhere using the token.\n */\n token: any;\n\n /**\n * A function which fetches the Resolvable's data\n *\n * A function which returns one of:\n *\n * - The resolved value (synchronously)\n * - A promise for the resolved value\n * - An Observable of the resolved value(s)\n *\n * This function will be provided the dependencies listed in [[deps]] as its arguments.\n * The resolve system will asynchronously fetch the dependencies before invoking this function.\n */\n resolveFn: Function;\n\n /**\n * Defines the Resolve Policy\n *\n * A policy that defines when to invoke the resolve,\n * and whether to wait for async and unwrap the data\n */\n policy?: ResolvePolicy;\n\n /**\n * The Dependency Injection tokens\n *\n * This is an array of Dependency Injection tokens for the dependencies of the [[resolveFn]].\n *\n * The DI tokens are references to other `Resolvables`, or to other\n * services from the native DI system.\n */\n deps?: any[];\n\n /** Pre-resolved data. */\n data?: any\n}\n\n/**\n * Defines how a resolve is processed during a transition\n *\n * This object is the [[StateDeclaration.resolvePolicy]] property.\n *\n * #### Example:\n * ```js\n * // Fetched when the resolve's state is being entered.\n * // Wait for the promise to resolve.\n * var policy1 = { when: \"LAZY\", async: \"WAIT\" }\n *\n * // Fetched when the Transition is starting.\n * // Do not wait for the returned promise to resolve.\n * // Inject the raw promise/value\n * var policy2 = { when: \"EAGER\", async: \"NOWAIT\" }\n * ```\n *\n * The policy for a given Resolvable is merged from three sources (highest priority first):\n *\n * - 1) Individual resolve definition\n * - 2) State definition\n * - 3) Global default\n *\n * #### Example:\n * ```js\n * // Wait for an Observable to emit one item.\n * // Since `wait` is not specified, it uses the `wait`\n * // policy defined on the state, or the global default\n * // if no `wait` policy is defined on the state\n * var myResolvablePolicy = { async: \"RXWAIT\" }\n * ```\n */\nexport interface ResolvePolicy {\n /**\n * Defines when a Resolvable is resolved (fetched) during a transition\n *\n * - `LAZY` (default)\n * - Resolved as the resolve's state is being entered\n * - `EAGER`\n * - Resolved as the transition is starting\n *\n * #### Example:\n * Resolves for `main` and `main.home` are fetched when each state is entered.\n * All of `main` resolves are processed before fetching `main.home` resolves.\n * ```js\n * var state = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { when: 'LAZY' }, // default\n * }\n *\n * var state = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { when: 'LAZY' }, // default\n * }\n * ```\n *\n * #### Example:\n * Resolves for `main` and `main.home` are fetched at the same time when the transition starts.\n * This happens earlier in the lifecycle than when states are entered.\n * All of the `main` and `main.home` resolves are fetched as soon as possible.\n * ```js\n * var mainState = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { when: 'EAGER' },\n * }\n *\n * var homeState = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { when: 'EAGER' },\n * }\n * ```\n */\n when?: PolicyWhen;\n\n /**\n * Determines the unwrapping behavior of asynchronous resolve values.\n *\n * - `WAIT` (default)\n * - If a promise is returned from the resolveFn, wait for the promise before proceeding\n * - The unwrapped value from the promise\n * - `NOWAIT`\n * - If a promise is returned from the resolve, do not wait for the promise.\n * - Any other value returned is wrapped in a promise.\n * - The promise will not be unwrapped.\n * - The promise itself will be provided when the resolve is injected or bound elsewhere.\n * - `RXWAIT`\n * - When an Observable is returned from the resolveFn, wait until the Observable emits at least one item.\n * - The Observable item will not be unwrapped.\n * - The Observable stream itself will be provided when the resolve is injected or bound elsewhere.\n *\n * #### Example:\n * The `Transition` will not wait for the resolve promise(s) from `main` to settle before continuing.\n * Resolves for `main` will be provided to components wrapped in a `Promise`.\n *\n * The `Transition` will wait for the `main.home` resolve promises.\n * Resolved values will be unwrapped before being provided to components.\n * ```js\n * var mainState = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { async: 'NOWAIT' },\n * }\n * var homeState = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { async: 'WAIT' }, // default\n * }\n * ```\n */\n async?: PolicyAsync;\n}\n\nexport type PolicyWhen = \"LAZY\" | \"EAGER\" ;\nexport type PolicyAsync = \"WAIT\" | \"NOWAIT\" | \"RXWAIT\" ;\n\n/** @internalapi */\nexport let resolvePolicies = {\n when: {\n LAZY: \"LAZY\",\n EAGER: \"EAGER\"\n },\n async: {\n WAIT: \"WAIT\",\n NOWAIT: \"NOWAIT\",\n RXWAIT: \"RXWAIT\"\n }\n};\n","/** @module resolve */\n/** for typedoc */\nimport { find, tail, uniqR, unnestR, inArray } from \"../common/common\";\nimport { propEq, not } from \"../common/hof\";\nimport { trace } from \"../common/trace\";\nimport { services, $InjectorLike } from \"../common/coreservices\";\nimport { resolvePolicies, PolicyWhen, ResolvePolicy } from \"./interface\";\nimport { PathNode } from \"../path/pathNode\";\nimport { Resolvable } from \"./resolvable\";\nimport { StateObject } from \"../state/stateObject\";\nimport { PathUtils } from \"../path/pathFactory\";\nimport { stringify } from \"../common/strings\";\nimport { Transition } from \"../transition/transition\";\nimport { UIInjector } from \"../interface\";\n\nconst when = resolvePolicies.when;\nconst ALL_WHENS = [when.EAGER, when.LAZY];\nconst EAGER_WHENS = [when.EAGER];\n\nexport const NATIVE_INJECTOR_TOKEN: string = \"Native Injector\";\n\n/**\n * Encapsulates Dependency Injection for a path of nodes\n *\n * UI-Router states are organized as a tree.\n * A nested state has a path of ancestors to the root of the tree.\n * When a state is being activated, each element in the path is wrapped as a [[PathNode]].\n * A `PathNode` is a stateful object that holds things like parameters and resolvables for the state being activated.\n *\n * The ResolveContext closes over the [[PathNode]]s, and provides DI for the last node in the path.\n */\nexport class ResolveContext {\n _injector: UIInjector;\n\n constructor(private _path: PathNode[]) { }\n\n /** Gets all the tokens found in the resolve context, de-duplicated */\n getTokens(): any[] {\n return this._path.reduce((acc, node) => acc.concat(node.resolvables.map(r => r.token)), []).reduce(uniqR, []);\n }\n\n /**\n * Gets the Resolvable that matches the token\n *\n * Gets the last Resolvable that matches the token in this context, or undefined.\n * Throws an error if it doesn't exist in the ResolveContext\n */\n getResolvable(token: any): Resolvable {\n let matching = this._path.map(node => node.resolvables)\n .reduce(unnestR, [])\n .filter((r: Resolvable) => r.token === token);\n return tail(matching);\n }\n\n /** Returns the [[ResolvePolicy]] for the given [[Resolvable]] */\n getPolicy(resolvable: Resolvable): ResolvePolicy {\n let node = this.findNode(resolvable);\n return resolvable.getPolicy(node.state);\n }\n\n /**\n * Returns a ResolveContext that includes a portion of this one\n *\n * Given a state, this method creates a new ResolveContext from this one.\n * The new context starts at the first node (root) and stops at the node for the `state` parameter.\n *\n * #### Why\n *\n * When a transition is created, the nodes in the \"To Path\" are injected from a ResolveContext.\n * A ResolveContext closes over a path of [[PathNode]]s and processes the resolvables.\n * The \"To State\" can inject values from its own resolvables, as well as those from all its ancestor state's (node's).\n * This method is used to create a narrower context when injecting ancestor nodes.\n *\n * @example\n * `let ABCD = new ResolveContext([A, B, C, D]);`\n *\n * Given a path `[A, B, C, D]`, where `A`, `B`, `C` and `D` are nodes for states `a`, `b`, `c`, `d`:\n * When injecting `D`, `D` should have access to all resolvables from `A`, `B`, `C`, `D`.\n * However, `B` should only be able to access resolvables from `A`, `B`.\n *\n * When resolving for the `B` node, first take the full \"To Path\" Context `[A,B,C,D]` and limit to the subpath `[A,B]`.\n * `let AB = ABCD.subcontext(a)`\n */\n subContext(state: StateObject): ResolveContext {\n return new ResolveContext(PathUtils.subPath(this._path, node => node.state === state));\n }\n\n /**\n * Adds Resolvables to the node that matches the state\n *\n * This adds a [[Resolvable]] (generally one created on the fly; not declared on a [[StateDeclaration.resolve]] block).\n * The resolvable is added to the node matching the `state` parameter.\n *\n * These new resolvables are not automatically fetched.\n * The calling code should either fetch them, fetch something that depends on them,\n * or rely on [[resolvePath]] being called when some state is being entered.\n *\n * Note: each resolvable's [[ResolvePolicy]] is merged with the state's policy, and the global default.\n *\n * @param newResolvables the new Resolvables\n * @param state Used to find the node to put the resolvable on\n */\n addResolvables(newResolvables: Resolvable[], state: StateObject) {\n let node = find(this._path, propEq('state', state));\n let keys = newResolvables.map(r => r.token);\n node.resolvables = node.resolvables.filter(r => keys.indexOf(r.token) === -1).concat(newResolvables);\n }\n \n /**\n * Returns a promise for an array of resolved path Element promises\n *\n * @param when\n * @param trans\n * @returns {Promise|any}\n */\n resolvePath(when: PolicyWhen = \"LAZY\", trans?: Transition): Promise<{ token: any, value: any }[]> {\n // This option determines which 'when' policy Resolvables we are about to fetch.\n let whenOption: string = inArray(ALL_WHENS, when) ? when : \"LAZY\";\n // If the caller specified EAGER, only the EAGER Resolvables are fetched.\n // if the caller specified LAZY, both EAGER and LAZY Resolvables are fetched.`\n let matchedWhens = whenOption === resolvePolicies.when.EAGER ? EAGER_WHENS : ALL_WHENS;\n \n // get the subpath to the state argument, if provided\n trace.traceResolvePath(this._path, when, trans);\n\n const matchesPolicy = (acceptedVals: string[], whenOrAsync: \"when\"|\"async\") =>\n (resolvable: Resolvable) =>\n inArray(acceptedVals, this.getPolicy(resolvable)[whenOrAsync]);\n\n // Trigger all the (matching) Resolvables in the path\n // Reduce all the \"WAIT\" Resolvables into an array\n let promises: Promise[] = this._path.reduce((acc, node) => {\n let nodeResolvables = node.resolvables.filter(matchesPolicy(matchedWhens, 'when'));\n let nowait = nodeResolvables.filter(matchesPolicy(['NOWAIT'], 'async'));\n let wait = nodeResolvables.filter(not(matchesPolicy(['NOWAIT'], 'async')));\n\n // For the matching Resolvables, start their async fetch process.\n let subContext = this.subContext(node.state);\n let getResult = (r: Resolvable) => r.get(subContext, trans)\n // Return a tuple that includes the Resolvable's token\n .then(value => ({ token: r.token, value: value }));\n nowait.forEach(getResult);\n return acc.concat(wait.map(getResult));\n }, []);\n\n // Wait for all the \"WAIT\" resolvables\n return services.$q.all(promises);\n }\n\n injector(): UIInjector {\n return this._injector || (this._injector = new UIInjectorImpl(this));\n }\n\n findNode(resolvable: Resolvable): PathNode {\n return find(this._path, (node: PathNode) => inArray(node.resolvables, resolvable));\n }\n\n /**\n * Gets the async dependencies of a Resolvable\n *\n * Given a Resolvable, returns its dependencies as a Resolvable[]\n */\n getDependencies(resolvable: Resolvable): Resolvable[] {\n let node = this.findNode(resolvable);\n // Find which other resolvables are \"visible\" to the `resolvable` argument\n // subpath stopping at resolvable's node, or the whole path (if the resolvable isn't in the path)\n let subPath: PathNode[] = PathUtils.subPath(this._path, x => x === node) || this._path;\n let availableResolvables: Resolvable[] = subPath\n .reduce((acc, node) => acc.concat(node.resolvables), []) //all of subpath's resolvables\n .filter(res => res !== resolvable); // filter out the `resolvable` argument\n\n const getDependency = (token: any) => {\n let matching = availableResolvables.filter(r => r.token === token);\n if (matching.length) return tail(matching);\n\n let fromInjector = this.injector().getNative(token);\n if (!fromInjector) {\n throw new Error(\"Could not find Dependency Injection token: \" + stringify(token));\n }\n\n return new Resolvable(token, () => fromInjector, [], fromInjector);\n };\n\n return resolvable.deps.map(getDependency);\n }\n}\n\nclass UIInjectorImpl implements UIInjector {\n native: $InjectorLike;\n\n constructor(public context: ResolveContext) {\n this.native = this.get(NATIVE_INJECTOR_TOKEN) || services.$injector;\n }\n\n get(token: any) {\n let resolvable = this.context.getResolvable(token);\n if (resolvable) {\n if (this.context.getPolicy(resolvable).async === 'NOWAIT') {\n return resolvable.get(this.context);\n }\n\n if (!resolvable.resolved) {\n throw new Error(\"Resolvable async .get() not complete:\" + stringify(resolvable.token))\n }\n return resolvable.data;\n }\n return this.native && this.native.get(token);\n }\n\n getAsync(token: any) {\n let resolvable = this.context.getResolvable(token);\n if (resolvable) return resolvable.get(this.context);\n return services.$q.when(this.native.get(token));\n }\n\n getNative(token: any) {\n return this.native && this.native.get(token);\n }\n}","/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport { trace } from '../common/trace';\nimport { services } from '../common/coreservices';\nimport {\n map, find, extend, mergeR, tail, omit, toJson, arrayTuples, unnestR, identity, anyTrueR,\n} from '../common/common';\nimport {isObject, isUndefined} from '../common/predicates';\nimport { prop, propEq, val, not, is } from '../common/hof';\nimport { StateDeclaration, StateOrName } from '../state/interface';\nimport {\n TransitionOptions, TreeChanges, IHookRegistry, TransitionHookPhase, RegisteredHooks, HookRegOptions,\n HookMatchCriteria, TransitionStateHookFn, TransitionHookFn,\n} from './interface'; // has or is using\nimport { TransitionHook } from './transitionHook';\nimport { matchState, makeEvent, RegisteredHook } from './hookRegistry';\nimport { HookBuilder } from './hookBuilder';\nimport { PathNode } from '../path/pathNode';\nimport { PathUtils } from '../path/pathFactory';\nimport { StateObject } from '../state/stateObject';\nimport { TargetState } from '../state/targetState';\nimport { Param } from '../params/param';\nimport { Resolvable } from '../resolve/resolvable';\nimport { ViewConfig } from '../view/interface';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { UIRouter } from '../router';\nimport { UIInjector } from '../interface';\nimport { RawParams } from '../params/interface';\nimport { ResolvableLiteral } from '../resolve/interface';\n\n/** @hidden */\nconst stateSelf: (_state: StateObject) => StateDeclaration = prop(\"self\");\n\n/**\n * Represents a transition between two states.\n *\n * When navigating to a state, we are transitioning **from** the current state **to** the new state.\n *\n * This object contains all contextual information about the to/from states, parameters, resolves.\n * It has information about all states being entered and exited as a result of the transition.\n */\nexport class Transition implements IHookRegistry {\n\n /** @hidden */\n static diToken = Transition;\n\n /**\n * A unique identifier for the transition.\n *\n * This is an auto incrementing integer, starting from `0`.\n */\n $id: number;\n\n /**\n * A reference to the [[UIRouter]] instance\n *\n * This reference can be used to access the router services, such as the [[StateService]]\n */\n router: UIRouter;\n\n /** @hidden */\n private _deferred = services.$q.defer();\n /**\n * This promise is resolved or rejected based on the outcome of the Transition.\n *\n * When the transition is successful, the promise is resolved\n * When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error\n */\n promise: Promise = this._deferred.promise;\n /**\n * A boolean which indicates if the transition was successful\n *\n * After a successful transition, this value is set to true.\n * After an unsuccessful transition, this value is set to false.\n *\n * The value will be undefined if the transition is not complete\n */\n success: boolean;\n /** @hidden */\n _aborted: boolean;\n /** @hidden */\n private _error: any;\n\n /** @hidden Holds the hook registration functions such as those passed to Transition.onStart() */\n _registeredHooks: RegisteredHooks = { };\n\n /** @hidden */\n private _options: TransitionOptions;\n /** @hidden */\n private _treeChanges: TreeChanges;\n /** @hidden */\n private _targetState: TargetState;\n /** @hidden */\n private _hookBuilder = new HookBuilder(this);\n\n\n /** @hidden */\n onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n\n /** @hidden\n * Creates the transition-level hook registration functions\n * (which can then be used to register hooks)\n */\n private createTransitionHookRegFns() {\n this.router.transitionService._pluginapi._getEvents()\n .filter(type => type.hookPhase !== TransitionHookPhase.CREATE)\n .forEach(type => makeEvent(this, this.router.transitionService, type));\n }\n\n /** @internalapi */\n getHooks(hookName: string): RegisteredHook[] {\n return this._registeredHooks[hookName];\n }\n\n /**\n * Creates a new Transition object.\n *\n * If the target state is not valid, an error is thrown.\n *\n * @internalapi\n *\n * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`\n * encapsulates the \"from state\".\n * @param targetState The target state and parameters being transitioned to (also, the transition options)\n * @param router The [[UIRouter]] instance\n */\n constructor(fromPath: PathNode[], targetState: TargetState, router: UIRouter) {\n this.router = router;\n this._targetState = targetState;\n\n if (!targetState.valid()) {\n throw new Error(targetState.error());\n }\n\n // current() is assumed to come from targetState.options, but provide a naive implementation otherwise.\n this._options = extend({ current: val(this) }, targetState.options());\n this.$id = router.transitionService._transitionCount++;\n let toPath = PathUtils.buildToPath(fromPath, targetState);\n this._treeChanges = PathUtils.treeChanges(fromPath, toPath, this._options.reloadState);\n this.createTransitionHookRegFns();\n\n let onCreateHooks = this._hookBuilder.buildHooksForPhase(TransitionHookPhase.CREATE);\n TransitionHook.invokeHooks(onCreateHooks, () => null);\n\n this.applyViewConfigs(router);\n }\n\n private applyViewConfigs(router: UIRouter) {\n let enteringStates = this._treeChanges.entering.map(node => node.state);\n PathUtils.applyViewConfigs(router.transitionService.$view, this._treeChanges.to, enteringStates);\n }\n\n /**\n * @internalapi\n *\n * @returns the internal from [State] object\n */\n $from() {\n return tail(this._treeChanges.from).state;\n }\n\n /**\n * @internalapi\n *\n * @returns the internal to [State] object\n */\n $to() {\n return tail(this._treeChanges.to).state;\n }\n\n /**\n * Returns the \"from state\"\n *\n * Returns the state that the transition is coming *from*.\n *\n * @returns The state declaration object for the Transition's (\"from state\").\n */\n from(): StateDeclaration {\n return this.$from().self;\n }\n\n /**\n * Returns the \"to state\"\n *\n * Returns the state that the transition is going *to*.\n *\n * @returns The state declaration object for the Transition's target state (\"to state\").\n */\n to(): StateDeclaration {\n return this.$to().self;\n }\n\n /**\n * Gets the Target State\n *\n * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object.\n *\n * @returns the [[TargetState]] of this Transition\n */\n targetState() {\n return this._targetState;\n }\n\n /**\n * Determines whether two transitions are equivalent.\n * @deprecated\n */\n is(compare: (Transition|{to?: any, from?: any})): boolean {\n if (compare instanceof Transition) {\n // TODO: Also compare parameters\n return this.is({ to: compare.$to().name, from: compare.$from().name });\n }\n return !(\n (compare.to && !matchState(this.$to(), compare.to)) ||\n (compare.from && !matchState(this.$from(), compare.from))\n );\n }\n\n /**\n * Gets transition parameter values\n *\n * Returns the parameter values for a transition as key/value pairs.\n * This object is immutable.\n *\n * By default, returns the new parameter values (for the \"to state\").\n * To return the previous parameter values, supply `'from'` as the `pathname` argument.\n *\n * @param pathname the name of the treeChanges path to get parameter values for:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n *\n * @returns transition parameter values for the desired path.\n */\n params(pathname?: string): any;\n params(pathname?: string): T;\n params(pathname: string = \"to\") {\n return Object.freeze(this._treeChanges[pathname].map(prop(\"paramValues\")).reduce(mergeR, {}));\n }\n\n\n /**\n * Creates a [[UIInjector]] Dependency Injector\n *\n * Returns a Dependency Injector for the Transition's target state (to state).\n * The injector provides resolve values which the target state has access to.\n *\n * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2).\n *\n * #### Example:\n * ```js\n * .onEnter({ entering: 'myState' }, trans => {\n * var myResolveValue = trans.injector().get('myResolve');\n * // Inject a global service from the global/native injector (if it exists)\n * var MyService = trans.injector().get('MyService');\n * })\n * ```\n *\n * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched.\n * You can use [[UIInjector.getAsync]] to get a promise for the data.\n * #### Example:\n * ```js\n * .onBefore({}, trans => {\n * return trans.injector().getAsync('myResolve').then(myResolveValue =>\n * return myResolveValue !== 'ABORT';\n * });\n * });\n * ```\n *\n * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to.\n * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`.\n * #### Example:\n * ```js\n * .onEnter({ to: 'foo.bar' }, trans => {\n * // returns result of `foo` state's `data` resolve\n * // even though `foo.bar` also has a `data` resolve\n * var fooData = trans.injector('foo').get('data');\n * });\n * ```\n *\n * If you need resolve data from the exiting states, pass `'from'` as `pathName`.\n * The resolve data from the `from` path will be returned.\n * #### Example:\n * ```js\n * .onExit({ exiting: 'foo.bar' }, trans => {\n * // Gets the resolve value of `data` from the exiting state.\n * var fooData = trans.injector(null, 'foo.bar').get('data');\n * });\n * ```\n *\n *\n * @param state Limits the resolves provided to only the resolves the provided state has access to.\n * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states.\n *\n * @returns a [[UIInjector]]\n */\n injector(state?: StateOrName, pathName = \"to\"): UIInjector {\n let path: PathNode[] = this._treeChanges[pathName];\n if (state) path = PathUtils.subPath(path, node => node.state === state || node.state.name === state);\n return new ResolveContext(path).injector();\n }\n\n /**\n * Gets all available resolve tokens (keys)\n *\n * This method can be used in conjunction with [[injector]] to inspect the resolve values\n * available to the Transition.\n *\n * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states\n * in the Transition's [[TreeChanges.to]] path.\n *\n * #### Example:\n * This example logs all resolve values\n * ```js\n * let tokens = trans.getResolveTokens();\n * tokens.forEach(token => console.log(token + \" = \" + trans.injector().get(token)));\n * ```\n *\n * #### Example:\n * This example creates promises for each resolve value.\n * This triggers fetches of resolves (if any have not yet been fetched).\n * When all promises have all settled, it logs the resolve values.\n * ```js\n * let tokens = trans.getResolveTokens();\n * let promise = tokens.map(token => trans.injector().getAsync(token));\n * Promise.all(promises).then(values => console.log(\"Resolved values: \" + values));\n * ```\n *\n * Note: Angular 1 users whould use `$q.all()`\n *\n * @param pathname resolve context's path name (e.g., `to` or `from`)\n *\n * @returns an array of resolve tokens (keys)\n */\n getResolveTokens(pathname: string = \"to\"): any[] {\n return new ResolveContext(this._treeChanges[pathname]).getTokens();\n }\n\n /**\n * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition.\n *\n * #### Example:\n * ```js\n * transitionService.onBefore({}, transition => {\n * transition.addResolvable({\n * token: 'myResolve',\n * deps: ['MyService'],\n * resolveFn: myService => myService.getData()\n * });\n * });\n * ```\n *\n * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]])\n * @param state the state in the \"to path\" which should receive the new resolve (otherwise, the root state)\n */\n addResolvable(resolvable: Resolvable|ResolvableLiteral, state: StateOrName = \"\"): void {\n resolvable = is(Resolvable)(resolvable) ? resolvable : new Resolvable(resolvable);\n\n let stateName: string = (typeof state === \"string\") ? state : state.name;\n let topath = this._treeChanges.to;\n let targetNode = find(topath, node => node.state.name === stateName);\n let resolveContext: ResolveContext = new ResolveContext(topath);\n resolveContext.addResolvables([resolvable as Resolvable], targetNode.state);\n }\n\n /**\n * Gets the transition from which this transition was redirected.\n *\n * If the current transition is a redirect, this method returns the transition that was redirected.\n *\n * #### Example:\n * ```js\n * let transitionA = $state.go('A').transition\n * transitionA.onStart({}, () => $state.target('B'));\n * $transitions.onSuccess({ to: 'B' }, (trans) => {\n * trans.to().name === 'B'; // true\n * trans.redirectedFrom() === transitionA; // true\n * });\n * ```\n *\n * @returns The previous Transition, or null if this Transition is not the result of a redirection\n */\n redirectedFrom(): Transition {\n return this._options.redirectedFrom || null;\n }\n\n /**\n * Gets the original transition in a redirect chain\n *\n * A transition might belong to a long chain of multiple redirects.\n * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain.\n *\n * #### Example:\n * ```js\n * // states\n * registry.register({ name: 'A', redirectTo: 'B' });\n * registry.register({ name: 'B', redirectTo: 'C' });\n * registry.register({ name: 'C', redirectTo: 'D' });\n * registry.register({ name: 'D' });\n *\n * let transitionA = $state.go('A').transition\n *\n * $transitions.onSuccess({ to: 'D' }, (trans) => {\n * trans.to().name === 'D'; // true\n * trans.redirectedFrom().to().name === 'C'; // true\n * trans.originalTransition() === transitionA; // true\n * trans.originalTransition().to().name === 'A'; // true\n * });\n * ```\n *\n * @returns The original Transition that started a redirect chain\n */\n originalTransition(): Transition {\n let rf = this.redirectedFrom();\n return (rf && rf.originalTransition()) || this;\n }\n\n /**\n * Get the transition options\n *\n * @returns the options for this Transition.\n */\n options(): TransitionOptions {\n return this._options;\n }\n\n /**\n * Gets the states being entered.\n *\n * @returns an array of states that will be entered during this transition.\n */\n entering(): StateDeclaration[] {\n return map(this._treeChanges.entering, prop('state')).map(stateSelf);\n }\n\n /**\n * Gets the states being exited.\n *\n * @returns an array of states that will be exited during this transition.\n */\n exiting(): StateDeclaration[] {\n return map(this._treeChanges.exiting, prop('state')).map(stateSelf).reverse();\n }\n\n /**\n * Gets the states being retained.\n *\n * @returns an array of states that are already entered from a previous Transition, that will not be\n * exited during this Transition\n */\n retained(): StateDeclaration[] {\n return map(this._treeChanges.retained, prop('state')).map(stateSelf);\n }\n\n /**\n * Get the [[ViewConfig]]s associated with this Transition\n *\n * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects.\n * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., \"to\" or \"entering\").\n *\n * @param pathname the name of the path to fetch views for:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n * @param state If provided, only returns the `ViewConfig`s for a single state in the path\n *\n * @returns a list of ViewConfig objects for the given path.\n */\n views(pathname: string = \"entering\", state?: StateObject): ViewConfig[] {\n let path = this._treeChanges[pathname];\n path = !state ? path : path.filter(propEq('state', state));\n return path.map(prop(\"views\")).filter(identity).reduce(unnestR, []);\n }\n\n /**\n * Return the transition's tree changes\n *\n * A transition goes from one state/parameters to another state/parameters.\n * During a transition, states are entered and/or exited.\n *\n * This function returns various branches (paths) which represent the changes to the\n * active state tree that are caused by the transition.\n *\n * @param pathname The name of the tree changes path to get:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n */\n treeChanges(pathname: string): PathNode[];\n treeChanges(): TreeChanges;\n treeChanges(pathname?: string) {\n return pathname ? this._treeChanges[pathname] : this._treeChanges;\n }\n\n /**\n * Creates a new transition that is a redirection of the current one.\n *\n * This transition can be returned from a [[TransitionService]] hook to\n * redirect a transition to a new state and/or set of parameters.\n *\n * @internalapi\n *\n * @returns Returns a new [[Transition]] instance.\n */\n redirect(targetState: TargetState): Transition {\n let redirects = 1, trans: Transition = this;\n while ((trans = trans.redirectedFrom()) != null) {\n if (++redirects > 20) throw new Error(`Too many consecutive Transition redirects (20+)`);\n }\n\n let redirectOpts: TransitionOptions = { redirectedFrom: this, source: \"redirect\" };\n // If the original transition was caused by URL sync, then use { location: 'replace' }\n // on the new transition (unless the target state explicitly specifies location: false).\n // This causes the original url to be replaced with the url for the redirect target\n // so the original url disappears from the browser history.\n if (this.options().source === 'url' && targetState.options().location !== false) {\n redirectOpts.location = 'replace';\n }\n\n let newOptions = extend({}, this.options(), targetState.options(), redirectOpts);\n\n targetState = new TargetState(targetState.identifier(), targetState.$state(), targetState.params(), newOptions);\n\n let newTransition = this.router.transitionService.create(this._treeChanges.from, targetState);\n let originalEnteringNodes = this._treeChanges.entering;\n let redirectEnteringNodes = newTransition._treeChanges.entering;\n\n // --- Re-use resolve data from original transition ---\n // When redirecting from a parent state to a child state where the parent parameter values haven't changed\n // (because of the redirect), the resolves fetched by the original transition are still valid in the\n // redirected transition.\n //\n // This allows you to define a redirect on a parent state which depends on an async resolve value.\n // You can wait for the resolve, then redirect to a child state based on the result.\n // The redirected transition does not have to re-fetch the resolve.\n // ---------------------------------------------------------\n\n const nodeIsReloading = (reloadState: StateObject) => (node: PathNode) => {\n return reloadState && node.state.includes[reloadState.name];\n };\n\n // Find any \"entering\" nodes in the redirect path that match the original path and aren't being reloaded\n let matchingEnteringNodes: PathNode[] = PathUtils.matching(redirectEnteringNodes, originalEnteringNodes, PathUtils.nonDynamicParams)\n .filter(not(nodeIsReloading(targetState.options().reloadState)));\n\n // Use the existing (possibly pre-resolved) resolvables for the matching entering nodes.\n matchingEnteringNodes.forEach((node, idx) => {\n node.resolvables = originalEnteringNodes[idx].resolvables;\n });\n\n return newTransition;\n }\n\n /** @hidden If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */\n private _changedParams(): Param[] {\n let tc = this._treeChanges;\n\n /** Return undefined if it's not a \"dynamic\" transition, for the following reasons */\n // If user explicitly wants a reload\n if (this._options.reload) return undefined;\n // If any states are exiting or entering\n if (tc.exiting.length || tc.entering.length) return undefined;\n // If to/from path lengths differ\n if (tc.to.length !== tc.from.length) return undefined;\n // If the to/from paths are different\n let pathsDiffer: boolean = arrayTuples(tc.to, tc.from)\n .map(tuple => tuple[0].state !== tuple[1].state)\n .reduce(anyTrueR, false);\n if (pathsDiffer) return undefined;\n\n // Find any parameter values that differ\n let nodeSchemas: Param[][] = tc.to.map((node: PathNode) => node.paramSchema);\n let [toValues, fromValues] = [tc.to, tc.from].map(path => path.map(x => x.paramValues));\n let tuples = arrayTuples(nodeSchemas, toValues, fromValues);\n\n return tuples.map(([schema, toVals, fromVals]) => Param.changed(schema, toVals, fromVals)).reduce(unnestR, []);\n }\n\n /**\n * Returns true if the transition is dynamic.\n *\n * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed.\n *\n * @returns true if the Transition is dynamic\n */\n dynamic(): boolean {\n let changes = this._changedParams();\n return !changes ? false : changes.map(x => x.dynamic).reduce(anyTrueR, false);\n }\n\n /**\n * Returns true if the transition is ignored.\n *\n * A transition is ignored if no states are entered nor exited, and no parameter values have changed.\n *\n * @returns true if the Transition is ignored.\n */\n ignored(): boolean {\n return !!this._ignoredReason();\n }\n\n /** @hidden */\n _ignoredReason(): \"SameAsCurrent\"|\"SameAsPending\"|undefined {\n const pending = this.router.globals.transition;\n const reloadState = this._options.reloadState;\n\n const same = (pathA, pathB) => {\n if (pathA.length !== pathB.length) return false;\n const matching = PathUtils.matching(pathA, pathB);\n return pathA.length === matching.filter(node => !reloadState || !node.state.includes[reloadState.name]).length;\n };\n\n let newTC = this.treeChanges();\n let pendTC = pending && pending.treeChanges();\n\n if (pendTC && same(pendTC.to, newTC.to) && same(pendTC.exiting, newTC.exiting)) return \"SameAsPending\";\n if (newTC.exiting.length === 0 && newTC.entering.length === 0 && same(newTC.from, newTC.to)) return \"SameAsCurrent\";\n }\n\n /**\n * Runs the transition\n *\n * This method is generally called from the [[StateService.transitionTo]]\n *\n * @internalapi\n *\n * @returns a promise for a successful transition.\n */\n run(): Promise {\n let runAllHooks = TransitionHook.runAllHooks;\n\n // Gets transition hooks array for the given phase\n const getHooksFor = (phase: TransitionHookPhase) =>\n this._hookBuilder.buildHooksForPhase(phase);\n\n // When the chain is complete, then resolve or reject the deferred\n const transitionSuccess = () => {\n trace.traceSuccess(this.$to(), this);\n this.success = true;\n this._deferred.resolve(this.to());\n runAllHooks(getHooksFor(TransitionHookPhase.SUCCESS));\n };\n\n const transitionError = (reason: any) => {\n trace.traceError(reason, this);\n this.success = false;\n this._deferred.reject(reason);\n this._error = reason;\n runAllHooks(getHooksFor(TransitionHookPhase.ERROR));\n };\n\n const runTransition = () => {\n // Wait to build the RUN hook chain until the BEFORE hooks are done\n // This allows a BEFORE hook to dynamically add additional RUN hooks via the Transition object.\n let allRunHooks = getHooksFor(TransitionHookPhase.RUN);\n let done = () => services.$q.when(undefined);\n return TransitionHook.invokeHooks(allRunHooks, done);\n };\n\n const startTransition = () => {\n let globals = this.router.globals;\n\n globals.lastStartedTransitionId = this.$id;\n globals.transition = this;\n globals.transitionHistory.enqueue(this);\n\n trace.traceTransitionStart(this);\n\n return services.$q.when(undefined);\n };\n\n let allBeforeHooks = getHooksFor(TransitionHookPhase.BEFORE);\n TransitionHook.invokeHooks(allBeforeHooks, startTransition)\n .then(runTransition)\n .then(transitionSuccess, transitionError);\n\n return this.promise;\n }\n\n /** Checks if this transition is currently active/running. */\n isActive = () =>\n this.router.globals.transition === this;\n\n /**\n * Checks if the Transition is valid\n *\n * @returns true if the Transition is valid\n */\n valid() {\n return !this.error() || this.success !== undefined;\n }\n\n /**\n * Aborts this transition\n *\n * Imperative API to abort a Transition.\n * This only applies to Transitions that are not yet complete.\n */\n abort() {\n // Do not set flag if the transition is already complete\n if (isUndefined(this.success)) {\n this._aborted = true;\n }\n }\n\n /**\n * The Transition error reason.\n *\n * If the transition is invalid (and could not be run), returns the reason the transition is invalid.\n * If the transition was valid and ran, but was not successful, returns the reason the transition failed.\n *\n * @returns an error message explaining why the transition is invalid, or the reason the transition failed.\n */\n error() {\n let state: StateObject = this.$to();\n\n if (state.self.abstract)\n return `Cannot transition to abstract state '${state.name}'`;\n\n const paramDefs = state.parameters(), values = this.params();\n const invalidParams = paramDefs.filter(param => !param.validates(values[param.id]));\n if (invalidParams.length) {\n return `Param values not valid for state '${state.name}'. Invalid params: [ ${invalidParams.map(param => param.id).join(', ')} ]`;\n }\n\n if (this.success === false)\n return this._error;\n }\n\n /**\n * A string representation of the Transition\n *\n * @returns A string representation of the Transition\n */\n toString () {\n let fromStateOrName = this.from();\n let toStateOrName = this.to();\n\n const avoidEmptyHash = (params: RawParams) =>\n (params[\"#\"] !== null && params[\"#\"] !== undefined) ? params : omit(params, [\"#\"]);\n\n // (X) means the to state is invalid.\n let id = this.$id,\n from = isObject(fromStateOrName) ? fromStateOrName.name : fromStateOrName,\n fromParams = toJson(avoidEmptyHash(this._treeChanges.from.map(prop('paramValues')).reduce(mergeR, {}))),\n toValid = this.valid() ? \"\" : \"(X) \",\n to = isObject(toStateOrName) ? toStateOrName.name : toStateOrName,\n toParams = toJson(avoidEmptyHash(this.params()));\n\n return `Transition#${id}( '${from}'${fromParams} -> ${toValid}'${to}'${toParams} )`;\n }\n}\n","/**\n * Functions that manipulate strings\n *\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_strings\n */ /** */\n\nimport { isString, isArray, isDefined, isNull, isPromise, isInjectable, isObject } from \"./predicates\";\nimport { Rejection } from \"../transition/rejectFactory\";\nimport { IInjectable, identity, Obj, tail, pushR } from \"./common\";\nimport { pattern, is, not, val, invoke } from \"./hof\";\nimport { Transition } from \"../transition/transition\";\nimport { Resolvable } from \"../resolve/resolvable\";\n\n/**\n * Returns a string shortened to a maximum length\n *\n * If the string is already less than the `max` length, return the string.\n * Else return the string, shortened to `max - 3` and append three dots (\"...\").\n *\n * @param max the maximum length of the string to return\n * @param str the input string\n */\nexport function maxLength(max: number, str: string) {\n if (str.length <= max) return str;\n return str.substr(0, max - 3) + \"...\";\n}\n\n/**\n * Returns a string, with spaces added to the end, up to a desired str length\n *\n * If the string is already longer than the desired length, return the string.\n * Else returns the string, with extra spaces on the end, such that it reaches `length` characters.\n *\n * @param length the desired length of the string to return\n * @param str the input string\n */\nexport function padString(length: number, str: string) {\n while (str.length < length) str += \" \";\n return str;\n}\n\nexport function kebobString(camelCase: string) {\n return camelCase\n .replace(/^([A-Z])/, $1 => $1.toLowerCase()) // replace first char\n .replace(/([A-Z])/g, $1 => \"-\" + $1.toLowerCase()); // replace rest\n}\n\nfunction _toJson(obj: Obj) {\n return JSON.stringify(obj);\n}\n\nfunction _fromJson(json: string) {\n return isString(json) ? JSON.parse(json) : json;\n}\n\n\nfunction promiseToString(p: Promise) {\n return `Promise(${JSON.stringify(p)})`;\n}\n\nexport function functionToString(fn: Function) {\n let fnStr = fnToString(fn);\n let namedFunctionMatch = fnStr.match(/^(function [^ ]+\\([^)]*\\))/);\n let toStr = namedFunctionMatch ? namedFunctionMatch[1] : fnStr;\n\n let fnName = fn['name'] || \"\";\n if (fnName && toStr.match(/function \\(/)) {\n return 'function ' + fnName + toStr.substr(9);\n }\n return toStr;\n}\n\nexport function fnToString(fn: IInjectable) {\n let _fn = isArray(fn) ? fn.slice(-1)[0] : fn;\n return _fn && _fn.toString() || \"undefined\";\n}\n\nlet stringifyPatternFn: (val: any) => string = null;\nlet stringifyPattern = function(value: any) {\n let isRejection = Rejection.isRejectionPromise;\n\n stringifyPatternFn = stringifyPatternFn || pattern([\n [not(isDefined), val(\"undefined\")],\n [isNull, val(\"null\")],\n [isPromise, val(\"[Promise]\")],\n [isRejection, (x: any) => x._transitionRejection.toString()],\n [is(Rejection), invoke(\"toString\")],\n [is(Transition), invoke(\"toString\")],\n [is(Resolvable), invoke(\"toString\")],\n [isInjectable, functionToString],\n [val(true), identity]\n ]);\n\n return stringifyPatternFn(value);\n};\n\nexport function stringify(o: any) {\n var seen: any[] = [];\n\n function format(val: any) {\n if (isObject(val)) {\n if (seen.indexOf(val) !== -1) return '[circular ref]';\n seen.push(val);\n }\n return stringifyPattern(val);\n }\n\n return JSON.stringify(o, (key, val) => format(val)).replace(/\\\\\"/g, '\"');\n}\n\n/** Returns a function that splits a string on a character or substring */\nexport const beforeAfterSubstr = (char: string) => (str: string) => {\n if (!str) return [\"\", \"\"];\n let idx = str.indexOf(char);\n if (idx === -1) return [str, \"\"];\n return [str.substr(0, idx), str.substr(idx + 1)];\n};\n\n/**\n * Splits on a delimiter, but returns the delimiters in the array\n *\n * #### Example:\n * ```js\n * var splitOnSlashes = splitOnDelim('/');\n * splitOnSlashes(\"/foo\"); // [\"/\", \"foo\"]\n * splitOnSlashes(\"/foo/\"); // [\"/\", \"foo\", \"/\"]\n * ```\n */\nexport function splitOnDelim(delim: string) {\n let re = new RegExp(\"(\" + delim + \")\", \"g\");\n return (str: string) =>\n str.split(re).filter(identity);\n};\n\n\n/**\n * Reduce fn that joins neighboring strings\n *\n * Given an array of strings, returns a new array\n * where all neighboring strings have been joined.\n *\n * #### Example:\n * ```js\n * let arr = [\"foo\", \"bar\", 1, \"baz\", \"\", \"qux\" ];\n * arr.reduce(joinNeighborsR, []) // [\"foobar\", 1, \"bazqux\" ]\n * ```\n */\nexport function joinNeighborsR(acc: any[], x: any) {\n if (isString(tail(acc)) && isString(x))\n return acc.slice(0, -1).concat(tail(acc)+ x);\n return pushR(acc, x);\n};\n\n","/** @module common */ /** for typedoc */\nexport * from \"./common\";\nexport * from \"./coreservices\";\nexport * from \"./glob\";\nexport * from \"./hof\";\nexport * from \"./predicates\";\nexport * from \"./queue\";\nexport * from \"./strings\";\nexport * from \"./trace\";\n","/**\n * @coreapi\n * @module params\n */\n/** */\nimport { fromJson, toJson, identity, equals, inherit, map, extend, pick } from \"../common/common\";\nimport { isDefined, isNullOrUndefined } from \"../common/predicates\";\nimport { is } from \"../common/hof\";\nimport { services } from \"../common/coreservices\";\nimport { ParamType } from \"./paramType\";\nimport { ParamTypeDefinition } from \"./interface\";\n\n/**\n * A registry for parameter types.\n *\n * This registry manages the built-in (and custom) parameter types.\n *\n * The built-in parameter types are:\n *\n * - [[string]]\n * - [[path]]\n * - [[query]]\n * - [[hash]]\n * - [[int]]\n * - [[bool]]\n * - [[date]]\n * - [[json]]\n * - [[any]]\n */\nexport class ParamTypes {\n /** @hidden */\n types: any;\n /** @hidden */\n enqueue: boolean = true;\n /** @hidden */\n typeQueue: any[] = [];\n\n /**\n * Built-in parameter type: `string`\n *\n * This parameter type coerces values to strings.\n * It matches anything (`new RegExp(\".*\")`) in the URL\n */\n static string: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `path`\n *\n * This parameter type is the default type for path parameters.\n * A path parameter is any parameter declared in the path portion of a url\n *\n * - `/foo/:param1/:param2`: two path parameters\n *\n * This parameter type behaves exactly like the [[string]] type with one exception.\n * When matching parameter values in the URL, the `path` type does not match forward slashes `/`.\n *\n * #### Angular 1 note:\n * In ng1, this type is overridden with one that pre-encodes slashes as `~2F` instead of `%2F`.\n * For more details about this angular 1 behavior, see: https://github.com/angular-ui/ui-router/issues/2598\n */\n static path: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `query`\n *\n * This parameter type is the default type for query/search parameters.\n * It behaves the same as the [[string]] parameter type.\n *\n * A query parameter is any parameter declared in the query/search portion of a url\n *\n * - `/bar?param2`: a query parameter\n */\n static query: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `hash`\n *\n * This parameter type is used for the `#` parameter (the hash)\n * It behaves the same as the [[string]] parameter type.\n * @coreapi\n */\n static hash: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `int`\n *\n * This parameter type serializes javascript integers (`number`s which represent an integer) to the URL.\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'user',\n * url: '/user/{id:int}'\n * });\n * ```\n * ```js\n * $state.go('user', { id: 1298547 });\n * ```\n *\n * The URL will serialize to: `/user/1298547`.\n *\n * When the parameter value is read, it will be the `number` `1298547`, not the string `\"1298547\"`.\n */\n static int: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `bool`\n *\n * This parameter type serializes `true`/`false` as `1`/`0`\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'inbox',\n * url: '/inbox?{unread:bool}'\n * });\n * ```\n * ```js\n * $state.go('inbox', { unread: true });\n * ```\n *\n * The URL will serialize to: `/inbox?unread=1`.\n *\n * Conversely, if the url is `/inbox?unread=0`, the value of the `unread` parameter will be a `false`.\n */\n static bool: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `date`\n *\n * This parameter type can be used to serialize Javascript dates as parameter values.\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'search',\n * url: '/search?{start:date}'\n * });\n * ```\n * ```js\n * $state.go('search', { start: new Date(2000, 0, 1) });\n * ```\n *\n * The URL will serialize to: `/search?start=2000-01-01`.\n *\n * Conversely, if the url is `/search?start=2016-12-25`, the value of the `start` parameter will be a `Date` object where:\n *\n * - `date.getFullYear() === 2016`\n * - `date.getMonth() === 11` (month is 0-based)\n * - `date.getDate() === 25`\n */\n static date: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `json`\n *\n * This parameter type can be used to serialize javascript objects into the URL using JSON serialization.\n *\n * #### Example:\n * This example serializes an plain javascript object to the URL\n * ```js\n * .state({\n * name: 'map',\n * url: '/map/{coords:json}'\n * });\n * ```\n * ```js\n * $state.go('map', { coords: { x: 10399.2, y: 49071 });\n * ```\n *\n * The URL will serialize to: `/map/%7B%22x%22%3A10399.2%2C%22y%22%3A49071%7D`\n */\n static json: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `any`\n *\n * This parameter type is used by default for url-less parameters (parameters that do not appear in the URL).\n * This type does not encode or decode.\n * It is compared using a deep `equals` comparison.\n *\n * #### Example:\n * This example defines a non-url parameter on a [[StateDeclaration]].\n * ```js\n * .state({\n * name: 'new',\n * url: '/new',\n * params: {\n * inrepyto: null\n * }\n * });\n * ```\n * ```js\n * $state.go('new', { inreplyto: currentMessage });\n * ```\n */\n static any: ParamTypeDefinition;\n\n\n /** @internalapi */\n private defaultTypes: any = pick(ParamTypes.prototype, [\"hash\", \"string\", \"query\", \"path\", \"int\", \"bool\", \"date\", \"json\", \"any\"]);\n\n /** @internalapi */\n constructor() {\n // Register default types. Store them in the prototype of this.types.\n const makeType = (definition: ParamTypeDefinition, name: string) =>\n new ParamType(extend({ name }, definition));\n this.types = inherit(map(this.defaultTypes, makeType), {});\n }\n\n /** @internalapi */\n dispose() {\n this.types = {};\n }\n\n /**\n * Registers a parameter type\n *\n * End users should call [[UrlMatcherFactory.type]], which delegates to this method.\n */\n type(name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {\n if (!isDefined(definition)) return this.types[name];\n if (this.types.hasOwnProperty(name)) throw new Error(`A type named '${name}' has already been defined.`);\n\n this.types[name] = new ParamType(extend({ name }, definition));\n\n if (definitionFn) {\n this.typeQueue.push({ name, def: definitionFn });\n if (!this.enqueue) this._flushTypeQueue();\n }\n\n return this;\n }\n\n /** @internalapi */\n _flushTypeQueue() {\n while (this.typeQueue.length) {\n let type = this.typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n extend(this.types[type.name], services.$injector.invoke(type.def));\n }\n }\n}\n\n/** @hidden */\nfunction initDefaultTypes() {\n\n const makeDefaultType = (def) => {\n const valToString = (val: any) =>\n val != null ? val.toString() : val;\n\n const defaultTypeBase = {\n encode: valToString,\n decode: valToString,\n is: is(String),\n pattern: /.*/,\n equals: (a: any, b: any) => a == b, // allow coersion for null/undefined/\"\"\n };\n\n return extend({}, defaultTypeBase, def) as ParamTypeDefinition;\n };\n\n // Default Parameter Type Definitions\n extend(ParamTypes.prototype, {\n string: makeDefaultType({}),\n\n path: makeDefaultType({\n pattern: /[^/]*/,\n }),\n\n query: makeDefaultType({}),\n\n hash: makeDefaultType({\n inherit: false,\n }),\n\n int: makeDefaultType({\n decode: (val: string) => parseInt(val, 10),\n is: function(val: any) {\n return !isNullOrUndefined(val) && this.decode(val.toString()) === val;\n },\n pattern: /-?\\d+/,\n }),\n\n bool: makeDefaultType({\n encode: (val: any) => val && 1 || 0,\n decode: (val: string) => parseInt(val, 10) !== 0,\n is: is(Boolean),\n pattern: /0|1/\n }),\n\n date: makeDefaultType({\n encode: function(val: any) {\n return !this.is(val) ? undefined : [\n val.getFullYear(),\n ('0' + (val.getMonth() + 1)).slice(-2),\n ('0' + val.getDate()).slice(-2)\n ].join(\"-\");\n },\n decode: function(val: string) {\n if (this.is(val)) return val as Date;\n let match = this.capture.exec(val);\n return match ? new Date(match[1], match[2] - 1, match[3]) : undefined;\n },\n is: (val: any) => val instanceof Date && !isNaN(val.valueOf()),\n equals(l: any, r: any) {\n return ['getFullYear', 'getMonth', 'getDate']\n .reduce((acc, fn) => acc && l[fn]() === r[fn](), true)\n },\n pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,\n capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/\n }),\n\n json: makeDefaultType({\n encode: toJson,\n decode: fromJson,\n is: is(Object),\n equals: equals,\n pattern: /[^/]*/\n }),\n\n // does not encode/decode\n any: makeDefaultType({\n encode: identity,\n decode: identity,\n is: () => true,\n equals: equals,\n }),\n })\n\n}\n\ninitDefaultTypes();\n\n","/**\n * @coreapi\n * @module params\n */\n/** */\nimport {extend, ancestors, Obj} from \"../common/common\";\nimport {StateObject} from \"../state/stateObject\";\n\n/** @internalapi */\nexport class StateParams {\n [key: string]: any;\n\n constructor(params: Obj = {}) {\n extend(this, params);\n }\n\n /**\n * Merges a set of parameters with all parameters inherited between the common parents of the\n * current state and a given destination state.\n *\n * @param {Object} newParams The set of parameters which will be composited with inherited params.\n * @param {Object} $current Internal definition of object representing the current state.\n * @param {Object} $to Internal definition of object representing state to transition to.\n */\n $inherit(newParams: Obj, $current: StateObject, $to: StateObject) {\n let parents = ancestors($current, $to),\n parentParams: string[],\n inherited: Obj = {},\n inheritList: string[] = [];\n\n for (let i in parents) {\n if (!parents[i] || !parents[i].params) continue;\n parentParams = Object.keys(parents[i].params);\n if (!parentParams.length) continue;\n\n for (let j in parentParams) {\n if (inheritList.indexOf(parentParams[j]) >= 0) continue;\n inheritList.push(parentParams[j]);\n inherited[parentParams[j]] = this[parentParams[j]];\n }\n }\n return extend({}, inherited, newParams);\n };\n}\n\n","/** @module path */ /** for typedoc */\nexport * from \"./pathNode\";\nexport * from \"./pathFactory\";","/** @module resolve */ /** for typedoc */\nexport * from \"./interface\";\nexport * from \"./resolvable\";\nexport * from \"./resolveContext\";\n","/** @module state */ /** for typedoc */\nimport {Obj, omit, noop, extend, inherit, values, applyPairs, tail, mapObj, identity} from \"../common/common\";\nimport {isDefined, isFunction, isString, isArray} from \"../common/predicates\";\nimport {stringify} from \"../common/strings\";\nimport {prop, pattern, is, pipe, val} from \"../common/hof\";\nimport {StateDeclaration} from \"./interface\";\n\nimport {StateObject} from \"./stateObject\";\nimport {StateMatcher} from \"./stateMatcher\";\nimport {Param} from \"../params/param\";\nimport {UrlMatcherFactory} from \"../url/urlMatcherFactory\";\nimport {UrlMatcher} from \"../url/urlMatcher\";\nimport {Resolvable} from \"../resolve/resolvable\";\nimport {services} from \"../common/coreservices\";\nimport {ResolvePolicy} from \"../resolve/interface\";\nimport { ParamFactory } from \"../url/interface\";\n\nconst parseUrl = (url: string): any => {\n if (!isString(url)) return false;\n let root = url.charAt(0) === '^';\n return { val: root ? url.substring(1) : url, root };\n};\n\nexport type BuilderFunction = (state: StateObject, parent?: BuilderFunction) => any;\n\ninterface Builders {\n [key: string]: BuilderFunction[];\n\n name: BuilderFunction[];\n parent: BuilderFunction[];\n data: BuilderFunction[];\n url: BuilderFunction[];\n navigable: BuilderFunction[];\n params: BuilderFunction[];\n views: BuilderFunction[];\n path: BuilderFunction[];\n includes: BuilderFunction[];\n resolvables: BuilderFunction[];\n}\n\n\nfunction nameBuilder(state: StateObject) {\n return state.name;\n}\n\nfunction selfBuilder(state: StateObject) {\n state.self.$$state = () => state;\n return state.self;\n}\n\nfunction dataBuilder(state: StateObject) {\n if (state.parent && state.parent.data) {\n state.data = state.self.data = inherit(state.parent.data, state.data);\n }\n return state.data;\n}\n\nconst getUrlBuilder = ($urlMatcherFactoryProvider: UrlMatcherFactory, root: () => StateObject) =>\nfunction urlBuilder(state: StateObject) {\n let stateDec: StateDeclaration = state;\n\n // For future states, i.e., states whose name ends with `.**`,\n // match anything that starts with the url prefix\n if (stateDec && stateDec.url && stateDec.name && stateDec.name.match(/\\.\\*\\*$/)) {\n stateDec.url += \"{remainder:any}\"; // match any path (.*)\n }\n\n const parsed = parseUrl(stateDec.url), parent = state.parent;\n const url = !parsed ? stateDec.url : $urlMatcherFactoryProvider.compile(parsed.val, {\n params: state.params || {},\n paramMap: function (paramConfig: any, isSearch: boolean) {\n if (stateDec.reloadOnSearch === false && isSearch) paramConfig = extend(paramConfig || {}, {dynamic: true});\n return paramConfig;\n }\n });\n\n if (!url) return null;\n if (!$urlMatcherFactoryProvider.isMatcher(url)) throw new Error(`Invalid url '${url}' in state '${state}'`);\n return (parsed && parsed.root) ? url : ((parent && parent.navigable) || root()).url.append( url);\n};\n\nconst getNavigableBuilder = (isRoot: (state: StateObject) => boolean) =>\nfunction navigableBuilder(state: StateObject) {\n return !isRoot(state) && state.url ? state : (state.parent ? state.parent.navigable : null);\n};\n\nconst getParamsBuilder = (paramFactory: ParamFactory) =>\nfunction paramsBuilder(state: StateObject): { [key: string]: Param } {\n const makeConfigParam = (config: any, id: string) => paramFactory.fromConfig(id, null, config);\n let urlParams: Param[] = (state.url && state.url.parameters({inherit: false})) || [];\n let nonUrlParams: Param[] = values(mapObj(omit(state.params || {}, urlParams.map(prop('id'))), makeConfigParam));\n return urlParams.concat(nonUrlParams).map(p => [p.id, p]).reduce(applyPairs, {});\n};\n\nfunction pathBuilder(state: StateObject) {\n return state.parent ? state.parent.path.concat(state) : /*root*/ [state];\n}\n\nfunction includesBuilder(state: StateObject) {\n let includes = state.parent ? extend({}, state.parent.includes) : {};\n includes[state.name] = true;\n return includes;\n}\n\n/**\n * This is a [[StateBuilder.builder]] function for the `resolve:` block on a [[StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * validates the `resolve` property and converts it to a [[Resolvable]] array.\n *\n * resolve: input value can be:\n *\n * {\n * // analyzed but not injected\n * myFooResolve: function() { return \"myFooData\"; },\n *\n * // function.toString() parsed, \"DependencyName\" dep as string (not min-safe)\n * myBarResolve: function(DependencyName) { return DependencyName.fetchSomethingAsPromise() },\n *\n * // Array split; \"DependencyName\" dep as string\n * myBazResolve: [ \"DependencyName\", function(dep) { return dep.fetchSomethingAsPromise() },\n *\n * // Array split; DependencyType dep as token (compared using ===)\n * myQuxResolve: [ DependencyType, function(dep) { return dep.fetchSometingAsPromise() },\n *\n * // val.$inject used as deps\n * // where:\n * // corgeResolve.$inject = [\"DependencyName\"];\n * // function corgeResolve(dep) { dep.fetchSometingAsPromise() }\n * // then \"DependencyName\" dep as string\n * myCorgeResolve: corgeResolve,\n *\n * // inject service by name\n * // When a string is found, desugar creating a resolve that injects the named service\n * myGraultResolve: \"SomeService\"\n * }\n *\n * or:\n *\n * [\n * new Resolvable(\"myFooResolve\", function() { return \"myFooData\" }),\n * new Resolvable(\"myBarResolve\", function(dep) { return dep.fetchSomethingAsPromise() }, [ \"DependencyName\" ]),\n * { provide: \"myBazResolve\", useFactory: function(dep) { dep.fetchSomethingAsPromise() }, deps: [ \"DependencyName\" ] }\n * ]\n */\nexport function resolvablesBuilder(state: StateObject): Resolvable[] {\n interface Tuple { token: any, val: any, deps: any[], policy: ResolvePolicy }\n \n /** convert resolve: {} and resolvePolicy: {} objects to an array of tuples */\n const objects2Tuples = (resolveObj: Obj, resolvePolicies: { [key: string]: ResolvePolicy }) =>\n Object.keys(resolveObj || {}).map(token => ({token, val: resolveObj[token], deps: undefined, policy: resolvePolicies[token]}));\n\n /** fetch DI annotations from a function or ng1-style array */\n const annotate = (fn: Function) => {\n let $injector = services.$injector;\n // ng1 doesn't have an $injector until runtime.\n // If the $injector doesn't exist, use \"deferred\" literal as a\n // marker indicating they should be annotated when runtime starts\n return fn['$inject'] || ($injector && $injector.annotate(fn, $injector.strictDi)) || \"deferred\";\n };\n\n /** true if the object has both `token` and `resolveFn`, and is probably a [[ResolveLiteral]] */\n const isResolveLiteral = (obj: any) => !!(obj.token && obj.resolveFn);\n\n /** true if the object looks like a provide literal, or a ng2 Provider */\n const isLikeNg2Provider = (obj: any) => !!((obj.provide || obj.token) && (obj.useValue || obj.useFactory || obj.useExisting || obj.useClass));\n\n /** true if the object looks like a tuple from obj2Tuples */\n const isTupleFromObj = (obj: any) => !!(obj && obj.val && (isString(obj.val) || isArray(obj.val) || isFunction(obj.val)));\n\n /** extracts the token from a Provider or provide literal */\n const token = (p: any) => p.provide || p.token;\n\n /** Given a literal resolve or provider object, returns a Resolvable */\n const literal2Resolvable = pattern([\n [prop('resolveFn'), p => new Resolvable(token(p), p.resolveFn, p.deps, p.policy)],\n [prop('useFactory'), p => new Resolvable(token(p), p.useFactory, (p.deps || p.dependencies), p.policy)],\n [prop('useClass'), p => new Resolvable(token(p), () => new (p.useClass)(), [], p.policy)],\n [prop('useValue'), p => new Resolvable(token(p), () => p.useValue, [], p.policy, p.useValue)],\n [prop('useExisting'), p => new Resolvable(token(p), identity, [p.useExisting], p.policy)],\n ]);\n\n const tuple2Resolvable = pattern([\n [pipe(prop(\"val\"), isString), (tuple: Tuple) => new Resolvable(tuple.token, identity, [ tuple.val ], tuple.policy)],\n [pipe(prop(\"val\"), isArray), (tuple: Tuple) => new Resolvable(tuple.token, tail( tuple.val), tuple.val.slice(0, -1), tuple.policy)],\n [pipe(prop(\"val\"), isFunction), (tuple: Tuple) => new Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy)],\n ]);\n\n const item2Resolvable = <(obj: any) => Resolvable> pattern([\n [is(Resolvable), (r: Resolvable) => r],\n [isResolveLiteral, literal2Resolvable],\n [isLikeNg2Provider, literal2Resolvable],\n [isTupleFromObj, tuple2Resolvable],\n [val(true), (obj: any) => { throw new Error(\"Invalid resolve value: \" + stringify(obj)) }]\n ]);\n\n // If resolveBlock is already an array, use it as-is.\n // Otherwise, assume it's an object and convert to an Array of tuples\n let decl = state.resolve;\n let items: any[] = isArray(decl) ? decl : objects2Tuples(decl, state.resolvePolicy || {});\n return items.map(item2Resolvable);\n}\n\n/**\n * @internalapi A internal global service\n *\n * StateBuilder is a factory for the internal [[StateObject]] objects.\n *\n * When you register a state with the [[StateRegistry]], you register a plain old javascript object which\n * conforms to the [[StateDeclaration]] interface. This factory takes that object and builds the corresponding\n * [[StateObject]] object, which has an API and is used internally.\n *\n * Custom properties or API may be added to the internal [[StateObject]] object by registering a decorator function\n * using the [[builder]] method.\n */\nexport class StateBuilder {\n /** An object that contains all the BuilderFunctions registered, key'd by the name of the State property they build */\n private builders: Builders;\n\n constructor(private matcher: StateMatcher, urlMatcherFactory: UrlMatcherFactory) {\n let self = this;\n\n const root = () => matcher.find(\"\");\n const isRoot = (state: StateObject) => state.name === \"\";\n\n function parentBuilder(state: StateObject) {\n if (isRoot(state)) return null;\n return matcher.find(self.parentName(state)) || root();\n }\n\n this.builders = {\n name: [ nameBuilder ],\n self: [ selfBuilder ],\n parent: [ parentBuilder ],\n data: [ dataBuilder ],\n // Build a URLMatcher if necessary, either via a relative or absolute URL\n url: [ getUrlBuilder(urlMatcherFactory, root) ],\n // Keep track of the closest ancestor state that has a URL (i.e. is navigable)\n navigable: [ getNavigableBuilder(isRoot) ],\n params: [ getParamsBuilder(urlMatcherFactory.paramFactory) ],\n // Each framework-specific ui-router implementation should define its own `views` builder\n // e.g., src/ng1/statebuilders/views.ts\n views: [],\n // Keep a full path from the root down to this state as this is needed for state activation.\n path: [ pathBuilder ],\n // Speed up $state.includes() as it's used a lot\n includes: [ includesBuilder ],\n resolvables: [ resolvablesBuilder ]\n };\n }\n\n /**\n * Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`).\n * More than one BuilderFunction can be registered for a given property.\n *\n * The BuilderFunction(s) will be used to define the property on any subsequently built [[StateObject]] objects.\n *\n * @param name The name of the State property being registered for.\n * @param fn The BuilderFunction which will be used to build the State property\n * @returns a function which deregisters the BuilderFunction\n */\n builder(name: string, fn: BuilderFunction): (BuilderFunction|BuilderFunction[]|Function) {\n let builders = this.builders;\n let array = builders[name] || [];\n // Backwards compat: if only one builder exists, return it, else return whole arary.\n if (isString(name) && !isDefined(fn)) return array.length > 1 ? array : array[0];\n if (!isString(name) || !isFunction(fn)) return;\n\n builders[name] = array;\n builders[name].push(fn);\n return () => builders[name].splice(builders[name].indexOf(fn, 1)) && null;\n }\n\n /**\n * Builds all of the properties on an essentially blank State object, returning a State object which has all its\n * properties and API built.\n *\n * @param state an uninitialized State object\n * @returns the built State object\n */\n build(state: StateObject): StateObject {\n let {matcher, builders} = this;\n let parent = this.parentName(state);\n\n if (parent && !matcher.find(parent, undefined, false)) {\n return null;\n }\n\n for (let key in builders) {\n if (!builders.hasOwnProperty(key)) continue;\n let chain = builders[key].reduce((parentFn: BuilderFunction, step: BuilderFunction) => (_state) => step(_state, parentFn), noop);\n state[key] = chain(state);\n }\n return state;\n }\n\n parentName(state: StateObject) {\n // name = 'foo.bar.baz.**'\n let name = state.name || \"\";\n // segments = ['foo', 'bar', 'baz', '.**']\n let segments = name.split('.');\n // segments = ['foo', 'bar', 'baz']\n let lastSegment = segments.pop();\n // segments = ['foo', 'bar'] (ignore .** segment for future states)\n if (lastSegment === '**') segments.pop();\n\n if (segments.length) {\n if (state.parent) {\n throw new Error(`States that specify the 'parent:' property should not have a '.' in their name (${name})`);\n }\n\n // 'foo.bar'\n return segments.join(\".\");\n }\n\n if (!state.parent) return \"\";\n return isString(state.parent) ? state.parent : state.parent.name;\n }\n\n name(state: StateObject) {\n let name = state.name;\n if (name.indexOf('.') !== -1 || !state.parent) return name;\n\n let parentName = isString(state.parent) ? state.parent : state.parent.name;\n return parentName ? parentName + \".\" + name : name;\n }\n}\n","/** @module state */ /** for typedoc */\nimport {isString} from \"../common/predicates\";\nimport {StateOrName} from \"./interface\";\nimport {StateObject} from \"./stateObject\";\nimport {values} from \"../common/common\";\n\nexport class StateMatcher {\n constructor (private _states: { [key: string]: StateObject }) { }\n \n isRelative(stateName: string) {\n stateName = stateName || \"\";\n return stateName.indexOf(\".\") === 0 || stateName.indexOf(\"^\") === 0;\n }\n\n\n find(stateOrName: StateOrName, base?: StateOrName, matchGlob = true): StateObject {\n if (!stateOrName && stateOrName !== \"\") return undefined;\n let isStr = isString(stateOrName);\n let name: string = isStr ? stateOrName : (stateOrName).name;\n\n if (this.isRelative(name)) name = this.resolvePath(name, base);\n let state = this._states[name];\n\n if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {\n return state;\n } else if (isStr && matchGlob) {\n let _states = values(this._states);\n let matches = _states.filter(state =>\n state.__stateObjectCache.nameGlob &&\n state.__stateObjectCache.nameGlob.matches(name)\n );\n\n if (matches.length > 1) {\n console.log(`stateMatcher.find: Found multiple matches for ${name} using glob: `, matches.map(match => match.name));\n }\n return matches[0];\n }\n return undefined;\n }\n\n resolvePath(name: string, base: StateOrName) {\n if (!base) throw new Error(`No reference point given for path '${name}'`);\n \n let baseState: StateObject = this.find(base);\n\n let splitName = name.split(\".\"), i = 0, pathLength = splitName.length, current = baseState;\n\n for (; i < pathLength; i++) {\n if (splitName[i] === \"\" && i === 0) {\n current = baseState;\n continue;\n }\n if (splitName[i] === \"^\") {\n if (!current.parent) throw new Error(`Path '${name}' not valid for state '${baseState.name}'`);\n current = current.parent;\n continue;\n }\n break;\n }\n let relName = splitName.slice(i).join(\".\");\n return current.name + (current.name && relName ? \".\" : \"\") + relName;\n }\n}\n","/** @module state */ /** for typedoc */\nimport { inArray } from \"../common/common\";\nimport { isString } from \"../common/predicates\";\nimport { StateDeclaration, _StateDeclaration } from \"./interface\";\nimport { StateObject } from \"./stateObject\";\nimport { StateBuilder } from \"./stateBuilder\";\nimport { StateRegistryListener, StateRegistry } from \"./stateRegistry\";\nimport { Disposable } from \"../interface\";\nimport { UrlRouter } from \"../url/urlRouter\";\nimport { prop } from \"../common/hof\";\nimport { StateMatcher } from \"./stateMatcher\";\n\n/** @internalapi */\nexport class StateQueueManager implements Disposable {\n queue: StateObject[];\n matcher: StateMatcher;\n\n constructor(\n private $registry: StateRegistry,\n private $urlRouter: UrlRouter,\n public states: { [key: string]: StateObject; },\n public builder: StateBuilder,\n public listeners: StateRegistryListener[]) {\n this.queue = [];\n this.matcher = $registry.matcher;\n }\n\n /** @internalapi */\n dispose() {\n this.queue = [];\n }\n\n register(stateDecl: _StateDeclaration) {\n let queue = this.queue;\n let state = StateObject.create(stateDecl);\n let name = state.name;\n\n if (!isString(name)) throw new Error(\"State must have a valid name\");\n if (this.states.hasOwnProperty(name) || inArray(queue.map(prop('name')), name))\n throw new Error(`State '${name}' is already defined`);\n\n queue.push(state);\n this.flush();\n\n return state;\n }\n\n flush() {\n let {queue, states, builder} = this;\n let registered: StateObject[] = [], // states that got registered\n orphans: StateObject[] = [], // states that don't yet have a parent registered\n previousQueueLength = {}; // keep track of how long the queue when an orphan was first encountered\n const getState = (name) =>\n this.states.hasOwnProperty(name) && this.states[name];\n\n while (queue.length > 0) {\n let state: StateObject = queue.shift();\n let name = state.name;\n let result: StateObject = builder.build(state);\n let orphanIdx: number = orphans.indexOf(state);\n\n if (result) {\n let existingState = getState(name);\n if (existingState && existingState.name === name) {\n throw new Error(`State '${name}' is already defined`);\n }\n\n let existingFutureState = getState(name + \".**\");\n if (existingFutureState) {\n // Remove future state of the same name\n this.$registry.deregister(existingFutureState);\n }\n\n states[name] = state;\n this.attachRoute(state);\n if (orphanIdx >= 0) orphans.splice(orphanIdx, 1);\n registered.push(state);\n continue;\n }\n\n let prev = previousQueueLength[name];\n previousQueueLength[name] = queue.length;\n if (orphanIdx >= 0 && prev === queue.length) {\n // Wait until two consecutive iterations where no additional states were dequeued successfully.\n // throw new Error(`Cannot register orphaned state '${name}'`);\n queue.push(state);\n return states;\n } else if (orphanIdx < 0) {\n orphans.push(state);\n }\n\n queue.push(state);\n }\n\n if (registered.length) {\n this.listeners.forEach(listener => listener(\"registered\", registered.map(s => s.self)));\n }\n\n return states;\n }\n\n attachRoute(state: StateObject) {\n if (state.abstract || !state.url) return;\n\n this.$urlRouter.rule(this.$urlRouter.urlRuleFactory.create(state));\n }\n}\n","/**\n * @coreapi\n * @module state\n */ /** for typedoc */\n\nimport { StateObject } from \"./stateObject\";\nimport { StateMatcher } from \"./stateMatcher\";\nimport { StateBuilder } from \"./stateBuilder\";\nimport { StateQueueManager } from \"./stateQueueManager\";\nimport { StateDeclaration, _StateDeclaration } from \"./interface\";\nimport { BuilderFunction } from \"./stateBuilder\";\nimport { StateOrName } from \"./interface\";\nimport { removeFrom } from \"../common/common\";\nimport { UIRouter } from \"../router\";\nimport { propEq } from \"../common/hof\";\n\n/**\n * The signature for the callback function provided to [[StateRegistry.onStatesChanged]].\n *\n * This callback receives two parameters:\n *\n * @param event a string; either \"registered\" or \"deregistered\"\n * @param states the list of [[StateDeclaration]]s that were registered (or deregistered).\n */\nexport type StateRegistryListener = (event: \"registered\"|\"deregistered\", states: StateDeclaration[]) => void;\n\nexport class StateRegistry {\n private _root: StateObject;\n private states: { [key: string]: StateObject } = {};\n\n matcher: StateMatcher;\n private builder: StateBuilder;\n stateQueue: StateQueueManager;\n\n listeners: StateRegistryListener[] = [];\n\n /** @internalapi */\n constructor(private _router: UIRouter) {\n this.matcher = new StateMatcher(this.states);\n this.builder = new StateBuilder(this.matcher, _router.urlMatcherFactory);\n this.stateQueue = new StateQueueManager(this, _router.urlRouter, this.states, this.builder, this.listeners);\n this._registerRoot();\n }\n\n /** @internalapi */\n private _registerRoot() {\n let rootStateDef: StateDeclaration = {\n name: '',\n url: '^',\n views: null,\n params: {\n '#': { value: null, type: 'hash', dynamic: true }\n },\n abstract: true\n };\n\n let _root = this._root = this.stateQueue.register(rootStateDef);\n _root.navigable = null;\n }\n\n /** @internalapi */\n dispose() {\n this.stateQueue.dispose();\n this.listeners = [];\n this.get().forEach(state => this.get(state) && this.deregister(state));\n }\n\n /**\n * Listen for a State Registry events\n *\n * Adds a callback that is invoked when states are registered or deregistered with the StateRegistry.\n *\n * #### Example:\n * ```js\n * let allStates = registry.get();\n *\n * // Later, invoke deregisterFn() to remove the listener\n * let deregisterFn = registry.onStatesChanged((event, states) => {\n * switch(event) {\n * case: 'registered':\n * states.forEach(state => allStates.push(state));\n * break;\n * case: 'deregistered':\n * states.forEach(state => {\n * let idx = allStates.indexOf(state);\n * if (idx !== -1) allStates.splice(idx, 1);\n * });\n * break;\n * }\n * });\n * ```\n *\n * @param listener a callback function invoked when the registered states changes.\n * The function receives two parameters, `event` and `state`.\n * See [[StateRegistryListener]]\n * @return a function that deregisters the listener\n */\n onStatesChanged(listener: StateRegistryListener): () => void {\n this.listeners.push(listener);\n return function deregisterListener() {\n removeFrom(this.listeners)(listener);\n }.bind(this);\n }\n\n /**\n * Gets the implicit root state\n *\n * Gets the root of the state tree.\n * The root state is implicitly created by UI-Router.\n * Note: this returns the internal [[StateObject]] representation, not a [[StateDeclaration]]\n *\n * @return the root [[StateObject]]\n */\n root() {\n return this._root;\n }\n\n /**\n * Adds a state to the registry\n *\n * Registers a [[StateDeclaration]] or queues it for registration.\n *\n * Note: a state will be queued if the state's parent isn't yet registered.\n *\n * @param stateDefinition the definition of the state to register.\n * @returns the internal [[StateObject]] object.\n * If the state was successfully registered, then the object is fully built (See: [[StateBuilder]]).\n * If the state was only queued, then the object is not fully built.\n */\n register(stateDefinition: _StateDeclaration): StateObject {\n return this.stateQueue.register(stateDefinition);\n }\n\n /** @hidden */\n private _deregisterTree(state: StateObject) {\n let all = this.get().map(s => s.$$state());\n const getChildren = (states: StateObject[]) => {\n let children = all.filter(s => states.indexOf(s.parent) !== -1);\n return children.length === 0 ? children : children.concat(getChildren(children));\n };\n\n let children = getChildren([state]);\n let deregistered: StateObject[] = [state].concat(children).reverse();\n\n deregistered.forEach(state => {\n let $ur = this._router.urlRouter;\n // Remove URL rule\n $ur.rules().filter(propEq(\"state\", state)).forEach($ur.removeRule.bind($ur));\n // Remove state from registry\n delete this.states[state.name];\n });\n\n return deregistered;\n }\n\n /**\n * Removes a state from the registry\n *\n * This removes a state from the registry.\n * If the state has children, they are are also removed from the registry.\n *\n * @param stateOrName the state's name or object representation\n * @returns {StateObject[]} a list of removed states\n */\n deregister(stateOrName: StateOrName) {\n let _state = this.get(stateOrName);\n if (!_state) throw new Error(\"Can't deregister state; not found: \" + stateOrName);\n let deregisteredStates = this._deregisterTree(_state.$$state());\n\n this.listeners.forEach(listener => listener(\"deregistered\", deregisteredStates.map(s => s.self)));\n return deregisteredStates;\n }\n\n /**\n * Gets all registered states\n *\n * Calling this method with no arguments will return a list of all the states that are currently registered.\n * Note: this does not return states that are *queued* but not yet registered.\n *\n * @return a list of [[StateDeclaration]]s\n */\n get(): StateDeclaration[];\n\n /**\n * Gets a registered state\n *\n * Given a state or a name, finds and returns the [[StateDeclaration]] from the registry.\n * Note: this does not return states that are *queued* but not yet registered.\n *\n * @param stateOrName either the name of a state, or a state object.\n * @return a registered [[StateDeclaration]] that matched the `stateOrName`, or null if the state isn't registered.\n */\n get(stateOrName: StateOrName, base?: StateOrName): StateDeclaration;\n get(stateOrName?: StateOrName, base?: StateOrName): any {\n if (arguments.length === 0) \n return Object.keys(this.states).map(name => this.states[name].self);\n let found = this.matcher.find(stateOrName, base);\n return found && found.self || null;\n }\n\n decorator(name: string, func: BuilderFunction) {\n return this.builder.builder(name, func);\n }\n}","/**\n * @coreapi\n * @module url\n */\n/** for typedoc */\nimport {\n map, defaults, inherit, identity, unnest, tail, find, Obj, pairs, allTrueR, unnestR, arrayTuples\n} from \"../common/common\";\nimport { prop, propEq } from \"../common/hof\";\nimport { isArray, isString, isDefined } from \"../common/predicates\";\nimport { Param, DefType } from \"../params/param\";\nimport { ParamTypes } from \"../params/paramTypes\";\nimport { RawParams } from \"../params/interface\";\nimport { ParamFactory } from \"./interface\";\nimport { joinNeighborsR, splitOnDelim } from \"../common/strings\";\n\n/** @hidden */\nfunction quoteRegExp(string: any, param?: any) {\n let surroundPattern = ['', ''], result = string.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, \"\\\\$&\");\n if (!param) return result;\n\n switch (param.squash) {\n case false:\n surroundPattern = ['(', ')' + (param.isOptional ? '?' : '')]; break;\n case true:\n result = result.replace(/\\/$/, '');\n surroundPattern = ['(?:\\/(', ')|\\/)?'];\n break;\n default:\n surroundPattern = [`(${param.squash}|`, ')?']; break;\n }\n return result + surroundPattern[0] + param.type.pattern.source + surroundPattern[1];\n}\n\n/** @hidden */\nconst memoizeTo = (obj: Obj, prop: string, fn: Function) =>\n obj[prop] = obj[prop] || fn();\n\n/** @hidden */\nconst splitOnSlash = splitOnDelim('/');\n\n/** @hidden */\ninterface UrlMatcherCache {\n segments?: any[];\n weights?: number[];\n path?: UrlMatcher[];\n parent?: UrlMatcher;\n pattern?: RegExp;\n}\n\n/**\n * Matches URLs against patterns.\n *\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL.\n *\n * A URL pattern consists of a path pattern, optionally followed by '?' and a list of search (query)\n * parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by [[UrlMatcher.exec]].\n *\n * - *Path parameters* are defined using curly brace placeholders (`/somepath/{param}`)\n * or colon placeholders (`/somePath/:param`).\n *\n * - *A parameter RegExp* may be defined for a param after a colon\n * (`/somePath/{param:[a-zA-Z0-9]+}`) in a curly brace placeholder.\n * The regexp must match for the url to be matched.\n * Should the regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Note: a RegExp parameter will encode its value using either [[ParamTypes.path]] or [[ParamTypes.query]].\n *\n * - *Custom parameter types* may also be specified after a colon (`/somePath/{param:int}`) in curly brace parameters.\n * See [[UrlMatcherFactory.type]] for more information.\n *\n * - *Catch-all parameters* are defined using an asterisk placeholder (`/somepath/*catchallparam`).\n * A catch-all * parameter value will contain the remainder of the URL.\n *\n * ---\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters).\n * A path parameter matches any number of characters other than '/'. For catch-all\n * placeholders the path parameter matches any number of characters.\n *\n * Examples:\n *\n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n * trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n * '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n * parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n * path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n * * `'/calendar/{start:date}'` - Matches \"/calendar/2014-11-12\" (because the pattern defined\n * in the built-in `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start\n *\n */\nexport class UrlMatcher {\n /** @hidden */\n static nameValidator: RegExp = /^\\w+([-.]+\\w+)*(?:\\[\\])?$/;\n\n /** @hidden */\n private _cache: UrlMatcherCache = { path: [this] };\n /** @hidden */\n private _children: UrlMatcher[] = [];\n /** @hidden */\n private _params: Param[] = [];\n /** @hidden */\n private _segments: string[] = [];\n /** @hidden */\n private _compiled: string[] = [];\n\n /** The pattern that was passed into the constructor */\n public pattern: string;\n\n /**\n * @param pattern The pattern to compile into a matcher.\n * @param paramTypes The [[ParamTypes]] registry\n * @param config A configuration object\n * - `caseInsensitive` - `true` if URL matching should be case insensitive, otherwise `false`, the default value (for backward compatibility) is `false`.\n * - `strict` - `false` if matching against a URL with a trailing slash should be treated as equivalent to a URL without a trailing slash, the default value is `true`.\n */\n constructor(pattern: string, paramTypes: ParamTypes, paramFactory: ParamFactory, public config?: any) {\n this.pattern = pattern;\n this.config = defaults(this.config, {\n params: {},\n strict: true,\n caseInsensitive: false,\n paramMap: identity\n });\n\n // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n // '*' name\n // ':' name\n // '{' name '}'\n // '{' name ':' regexp '}'\n // The regular expression is somewhat complicated due to the need to allow curly braces\n // inside the regular expression. The placeholder regexp breaks down as follows:\n // ([:*])([\\w\\[\\]]+) - classic placeholder ($1 / $2) (search version has - for snake-case)\n // \\{([\\w\\[\\]]+)(?:\\:\\s*( ... ))?\\} - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case\n // (?: ... | ... | ... )+ - the regexp consists of any number of atoms, an atom being either\n // [^{}\\\\]+ - anything other than curly braces or backslash\n // \\\\. - a backslash escape\n // \\{(?:[^{}\\\\]+|\\\\.)*\\} - a matched set of curly braces containing other atoms\n let placeholder = /([:*])([\\w\\[\\]]+)|\\{([\\w\\[\\]]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n searchPlaceholder = /([:]?)([\\w\\[\\].-]+)|\\{([\\w\\[\\].-]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n last = 0, m: RegExpExecArray, patterns: any[][] = [];\n\n const checkParamErrors = (id: string) => {\n if (!UrlMatcher.nameValidator.test(id)) throw new Error(`Invalid parameter name '${id}' in pattern '${pattern}'`);\n if (find(this._params, propEq('id', id))) throw new Error(`Duplicate parameter name '${id}' in pattern '${pattern}'`);\n };\n\n // Split into static segments separated by path parameter placeholders.\n // The number of segments is always 1 more than the number of parameters.\n const matchDetails = (m: RegExpExecArray, isSearch: boolean) => {\n // IE[78] returns '' for unmatched groups instead of null\n let id = m[2] || m[3];\n let regexp = isSearch ? m[4] : m[4] || (m[1] === '*' ? '[\\\\s\\\\S]*' : null);\n\n const makeRegexpType = (regexp) => inherit(paramTypes.type(isSearch ? \"query\" : \"path\"), {\n pattern: new RegExp(regexp, this.config.caseInsensitive ? 'i' : undefined)\n });\n\n return {\n id,\n regexp,\n cfg: this.config.params[id],\n segment: pattern.substring(last, m.index),\n type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp)\n };\n };\n\n let p: any, segment: string;\n\n while ((m = placeholder.exec(pattern))) {\n p = matchDetails(m, false);\n if (p.segment.indexOf('?') >= 0) break; // we're into the search part\n\n checkParamErrors(p.id);\n this._params.push(paramFactory.fromPath(p.id, p.type, this.config.paramMap(p.cfg, false)));\n this._segments.push(p.segment);\n patterns.push([p.segment, tail(this._params)]);\n last = placeholder.lastIndex;\n }\n segment = pattern.substring(last);\n\n // Find any search parameter names and remove them from the last segment\n let i = segment.indexOf('?');\n\n if (i >= 0) {\n let search = segment.substring(i);\n segment = segment.substring(0, i);\n\n if (search.length > 0) {\n last = 0;\n\n while ((m = searchPlaceholder.exec(search))) {\n p = matchDetails(m, true);\n checkParamErrors(p.id);\n this._params.push(paramFactory.fromSearch(p.id, p.type, this.config.paramMap(p.cfg, true)));\n last = placeholder.lastIndex;\n // check if ?&\n }\n }\n }\n\n this._segments.push(segment);\n this._compiled = patterns.map(pattern => quoteRegExp.apply(null, pattern)).concat(quoteRegExp(segment));\n }\n\n /**\n * Creates a new concatenated UrlMatcher\n *\n * Builds a new UrlMatcher by appending another UrlMatcher to this one.\n *\n * @param url A `UrlMatcher` instance to append as a child of the current `UrlMatcher`.\n */\n append(url: UrlMatcher): UrlMatcher {\n this._children.push(url);\n url._cache = {\n path: this._cache.path.concat(url),\n parent: this,\n pattern: null,\n };\n return url;\n }\n\n /** @hidden */\n isRoot(): boolean {\n return this._cache.path[0] === this;\n }\n\n /** Returns the input pattern string */\n toString(): string {\n return this.pattern;\n }\n\n /**\n * Tests the specified url/path against this matcher.\n *\n * Tests if the given url matches this matcher's pattern, and returns an object containing the captured\n * parameter values. Returns null if the path does not match.\n *\n * The returned object contains the values\n * of any search parameters that are mentioned in the pattern, but their value may be null if\n * they are not present in `search`. This means that search parameters are always treated\n * as optional.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', {\n * x: '1', q: 'hello'\n * });\n * // returns { id: 'bob', q: 'hello', r: null }\n * ```\n *\n * @param path The URL path to match, e.g. `$location.path()`.\n * @param search URL search parameters, e.g. `$location.search()`.\n * @param hash URL hash e.g. `$location.hash()`.\n * @param options\n *\n * @returns The captured parameter values.\n */\n exec(path: string, search: any = {}, hash?: string, options: any = {}): RawParams {\n let match = memoizeTo(this._cache, 'pattern', () => {\n return new RegExp([\n '^',\n unnest(this._cache.path.map(prop('_compiled'))).join(''),\n this.config.strict === false ? '\\/?' : '',\n '$'\n ].join(''), this.config.caseInsensitive ? 'i' : undefined);\n }).exec(path);\n\n if (!match) return null;\n\n //options = defaults(options, { isolate: false });\n\n let allParams: Param[] = this.parameters(),\n pathParams: Param[] = allParams.filter(param => !param.isSearch()),\n searchParams: Param[] = allParams.filter(param => param.isSearch()),\n nPathSegments = this._cache.path.map(urlm => urlm._segments.length - 1).reduce((a, x) => a + x),\n values: RawParams = {};\n\n if (nPathSegments !== match.length - 1)\n throw new Error(`Unbalanced capture group in route '${this.pattern}'`);\n\n function decodePathArray(string: string) {\n const reverseString = (str: string) => str.split(\"\").reverse().join(\"\");\n const unquoteDashes = (str: string) => str.replace(/\\\\-/g, \"-\");\n\n let split = reverseString(string).split(/-(?!\\\\)/);\n let allReversed = map(split, reverseString);\n return map(allReversed, unquoteDashes).reverse();\n }\n\n for (let i = 0; i < nPathSegments; i++) {\n let param: Param = pathParams[i];\n let value: (any|any[]) = match[i + 1];\n\n // if the param value matches a pre-replace pair, replace the value before decoding.\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n if (value && param.array === true) value = decodePathArray(value);\n if (isDefined(value)) value = param.type.decode(value);\n values[param.id] = param.value(value);\n }\n searchParams.forEach(param => {\n let value = search[param.id];\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n if (isDefined(value)) value = param.type.decode(value);\n values[param.id] = param.value(value);\n });\n\n if (hash) values[\"#\"] = hash;\n\n return values;\n }\n\n /**\n * @hidden\n * Returns all the [[Param]] objects of all path and search parameters of this pattern in order of appearance.\n *\n * @returns {Array.} An array of [[Param]] objects. Must be treated as read-only. If the\n * pattern has no parameters, an empty array is returned.\n */\n parameters(opts: any = {}): Param[] {\n if (opts.inherit === false) return this._params;\n return unnest(this._cache.path.map(matcher => matcher._params));\n }\n\n /**\n * @hidden\n * Returns a single parameter from this UrlMatcher by id\n *\n * @param id\n * @param opts\n * @returns {T|Param|any|boolean|UrlMatcher|null}\n */\n parameter(id: string, opts: any = {}): Param {\n const findParam = () => {\n for (let param of this._params) {\n if (param.id === id) return param;\n }\n };\n\n let parent = this._cache.parent;\n return findParam() || (opts.inherit !== false && parent && parent.parameter(id, opts)) || null;\n }\n\n /**\n * Validates the input parameter values against this UrlMatcher\n *\n * Checks an object hash of parameters to validate their correctness according to the parameter\n * types of this `UrlMatcher`.\n *\n * @param params The object hash of parameters to validate.\n * @returns Returns `true` if `params` validates, otherwise `false`.\n */\n validates(params: RawParams): boolean {\n const validParamVal = (param: Param, val: any) =>\n !param || param.validates(val);\n\n params = params || {};\n\n // I'm not sure why this checks only the param keys passed in, and not all the params known to the matcher\n let paramSchema = this.parameters().filter(paramDef => params.hasOwnProperty(paramDef.id));\n return paramSchema.map(paramDef => validParamVal(paramDef, params[paramDef.id])).reduce(allTrueR, true);\n }\n\n /**\n * Given a set of parameter values, creates a URL from this UrlMatcher.\n *\n * Creates a URL that matches this pattern by substituting the specified values\n * for the path and search parameters.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n * // returns '/user/bob?q=yes'\n * ```\n *\n * @param values the values to substitute for the parameters in this pattern.\n * @returns the formatted URL (path and optionally search part).\n */\n format(values: RawParams = {}) {\n // Build the full path of UrlMatchers (including all parent UrlMatchers)\n let urlMatchers = this._cache.path;\n\n // Extract all the static segments and Params (processed as ParamDetails)\n // into an ordered array\n let pathSegmentsAndParams: Array = urlMatchers.map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .map(x => isString(x) ? x : getDetails(x));\n\n // Extract the query params into a separate array\n let queryParams: Array = urlMatchers.map(UrlMatcher.queryParams)\n .reduce(unnestR, [])\n .map(getDetails);\n\n const isInvalid = (param: ParamDetails) => param.isValid === false;\n if (pathSegmentsAndParams.concat(queryParams).filter(isInvalid).length) {\n return null;\n }\n\n /**\n * Given a Param, applies the parameter value, then returns detailed information about it\n */\n function getDetails(param: Param): ParamDetails {\n // Normalize to typed value\n let value = param.value(values[param.id]);\n let isValid = param.validates(value);\n let isDefaultValue = param.isDefaultValue(value);\n // Check if we're in squash mode for the parameter\n let squash = isDefaultValue ? param.squash : false;\n // Allow the Parameter's Type to encode the value\n let encoded = param.type.encode(value);\n\n return { param, value, isValid, isDefaultValue, squash, encoded };\n }\n\n // Build up the path-portion from the list of static segments and parameters\n let pathString = pathSegmentsAndParams.reduce((acc: string, x: string|ParamDetails) => {\n // The element is a static segment (a raw string); just append it\n if (isString(x)) return acc + x;\n\n // Otherwise, it's a ParamDetails.\n let { squash, encoded, param } = x;\n\n // If squash is === true, try to remove a slash from the path\n if (squash === true) return (acc.match(/\\/$/)) ? acc.slice(0, -1) : acc;\n // If squash is a string, use the string for the param value\n if (isString(squash)) return acc + squash;\n if (squash !== false) return acc; // ?\n if (encoded == null) return acc;\n // If this parameter value is an array, encode the value using encodeDashes\n if (isArray(encoded)) return acc + map( encoded, UrlMatcher.encodeDashes).join(\"-\");\n // If the parameter type is \"raw\", then do not encodeURIComponent\n if (param.raw) return acc + encoded;\n // Encode the value\n return acc + encodeURIComponent( encoded);\n }, \"\");\n\n // Build the query string by applying parameter values (array or regular)\n // then mapping to key=value, then flattening and joining using \"&\"\n let queryString = queryParams.map((paramDetails: ParamDetails) => {\n let { param, squash, encoded, isDefaultValue } = paramDetails;\n if (encoded == null || (isDefaultValue && squash !== false)) return;\n if (!isArray(encoded)) encoded = [ encoded];\n if (encoded.length === 0) return;\n if (!param.raw) encoded = map( encoded, encodeURIComponent);\n\n return ( encoded).map(val => `${param.id}=${val}`);\n }).filter(identity).reduce(unnestR, []).join(\"&\");\n\n // Concat the pathstring with the queryString (if exists) and the hashString (if exists)\n return pathString + (queryString ? `?${queryString}` : \"\") + (values[\"#\"] ? \"#\" + values[\"#\"] : \"\");\n }\n\n /** @hidden */\n static encodeDashes(str: string) { // Replace dashes with encoded \"\\-\"\n return encodeURIComponent(str).replace(/-/g, c => `%5C%${c.charCodeAt(0).toString(16).toUpperCase()}`);\n }\n\n /** @hidden Given a matcher, return an array with the matcher's path segments and path params, in order */\n static pathSegmentsAndParams(matcher: UrlMatcher) {\n let staticSegments = matcher._segments;\n let pathParams = matcher._params.filter(p => p.location === DefType.PATH);\n return arrayTuples(staticSegments, pathParams.concat(undefined))\n .reduce(unnestR, [])\n .filter(x => x !== \"\" && isDefined(x));\n }\n\n /** @hidden Given a matcher, return an array with the matcher's query params */\n static queryParams(matcher: UrlMatcher): Param[] {\n return matcher._params.filter(p => p.location === DefType.SEARCH);\n }\n\n /**\n * Compare two UrlMatchers\n *\n * This comparison function converts a UrlMatcher into static and dynamic path segments.\n * Each static path segment is a static string between a path separator (slash character).\n * Each dynamic segment is a path parameter.\n *\n * The comparison function sorts static segments before dynamic ones.\n */\n static compare(a: UrlMatcher, b: UrlMatcher): number {\n /**\n * Turn a UrlMatcher and all its parent matchers into an array\n * of slash literals '/', string literals, and Param objects\n *\n * This example matcher matches strings like \"/foo/:param/tail\":\n * var matcher = $umf.compile(\"/foo\").append($umf.compile(\"/:param\")).append($umf.compile(\"/\")).append($umf.compile(\"tail\"));\n * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ]\n *\n * Caches the result as `matcher._cache.segments`\n */\n const segments = (matcher: UrlMatcher) =>\n matcher._cache.segments = matcher._cache.segments ||\n matcher._cache.path.map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .reduce(joinNeighborsR, [])\n .map(x => isString(x) ? splitOnSlash(x) : x)\n .reduce(unnestR, []);\n\n /**\n * Gets the sort weight for each segment of a UrlMatcher\n *\n * Caches the result as `matcher._cache.weights`\n */\n const weights = (matcher: UrlMatcher) =>\n matcher._cache.weights = matcher._cache.weights ||\n segments(matcher).map(segment => {\n // Sort slashes first, then static strings, the Params\n if (segment === '/') return 1;\n if (isString(segment)) return 2;\n if (segment instanceof Param) return 3;\n });\n\n /**\n * Pads shorter array in-place (mutates)\n */\n const padArrays = (l: any[], r: any[], padVal: any) => {\n const len = Math.max(l.length, r.length);\n while (l.length < len) l.push(padVal);\n while (r.length < len) r.push(padVal);\n };\n\n const weightsA = weights(a), weightsB = weights(b);\n padArrays(weightsA, weightsB, 0);\n let cmp, i, pairs = arrayTuples(weightsA, weightsB);\n\n for (i = 0; i < pairs.length; i++) {\n cmp = pairs[i][0] - pairs[i][1];\n if (cmp !== 0) return cmp;\n }\n\n return 0;\n }\n}\n\n/** @hidden */\ninterface ParamDetails {\n param: Param;\n value: any;\n isValid: boolean;\n isDefaultValue: boolean;\n squash: (boolean|string);\n encoded: (string|string[]);\n}\n","/**\n * @internalapi\n * @module url\n */ /** for typedoc */\nimport { forEach, extend } from \"../common/common\";\nimport { isObject, isDefined, isFunction, isString } from \"../common/predicates\";\nimport { UrlMatcher } from \"./urlMatcher\";\nimport { Param, DefType } from \"../params/param\";\nimport { ParamTypes } from \"../params/paramTypes\";\nimport { ParamTypeDefinition } from \"../params/interface\";\nimport { Disposable } from \"../interface\";\nimport { ParamType } from \"../params/paramType\";\nimport { ParamFactory, UrlMatcherConfig } from \"./interface\";\n\n/**\n * Factory for [[UrlMatcher]] instances.\n *\n * The factory is available to ng1 services as\n * `$urlMatcherFactor` or ng1 providers as `$urlMatcherFactoryProvider`.\n */\nexport class UrlMatcherFactory implements Disposable, UrlMatcherConfig {\n /** @hidden */ paramTypes = new ParamTypes();\n /** @hidden */ _isCaseInsensitive: boolean = false;\n /** @hidden */ _isStrictMode: boolean = true;\n /** @hidden */ _defaultSquashPolicy: (boolean|string) = false;\n\n constructor() {\n extend(this, { UrlMatcher, Param });\n }\n\n /** @inheritdoc */\n caseInsensitive(value?: boolean): boolean {\n return this._isCaseInsensitive = isDefined(value) ? value : this._isCaseInsensitive;\n }\n\n /** @inheritdoc */\n strictMode(value?: boolean): boolean {\n return this._isStrictMode = isDefined(value) ? value : this._isStrictMode;\n }\n\n /** @inheritdoc */\n defaultSquashPolicy(value?: (boolean|string)) {\n if (isDefined(value) && value !== true && value !== false && !isString(value))\n throw new Error(`Invalid squash policy: ${value}. Valid policies: false, true, arbitrary-string`);\n return this._defaultSquashPolicy = isDefined(value) ? value : this._defaultSquashPolicy;\n }\n\n /** @hidden */\n private _getConfig = (config) =>\n extend({ strict: this._isStrictMode, caseInsensitive: this._isCaseInsensitive }, config);\n\n /**\n * Creates a [[UrlMatcher]] for the specified pattern.\n *\n * @param pattern The URL pattern.\n * @param config The config object hash.\n * @returns The UrlMatcher.\n */\n compile(pattern: string, config?: { [key: string]: any }) {\n return new UrlMatcher(pattern, this.paramTypes, this.paramFactory, this._getConfig(config));\n }\n\n /**\n * Returns true if the specified object is a [[UrlMatcher]], or false otherwise.\n *\n * @param object The object to perform the type check against.\n * @returns `true` if the object matches the `UrlMatcher` interface, by\n * implementing all the same methods.\n */\n isMatcher(object: any): boolean {\n // TODO: typeof?\n if (!isObject(object)) return false;\n let result = true;\n\n forEach(UrlMatcher.prototype, (val, name) => {\n if (isFunction(val)) result = result && (isDefined(object[name]) && isFunction(object[name]));\n });\n return result;\n };\n\n /**\n * Creates and registers a custom [[ParamType]] object\n *\n * A [[ParamType]] can be used to generate URLs with typed parameters.\n *\n * @param name The type name.\n * @param definition The type definition. See [[ParamTypeDefinition]] for information on the values accepted.\n * @param definitionFn A function that is injected before the app runtime starts.\n * The result of this function should be a [[ParamTypeDefinition]].\n * The result is merged into the existing `definition`.\n * See [[ParamType]] for information on the values accepted.\n *\n * @returns - if a type was registered: the [[UrlMatcherFactory]]\n * - if only the `name` parameter was specified: the currently registered [[ParamType]] object, or undefined\n *\n * Note: Register custom types *before using them* in a state definition.\n *\n * See [[ParamTypeDefinition]] for examples\n */\n type(name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {\n let type = this.paramTypes.type(name, definition, definitionFn);\n return !isDefined(definition) ? type : this;\n };\n\n /** @hidden */\n $get() {\n this.paramTypes.enqueue = false;\n this.paramTypes._flushTypeQueue();\n return this;\n };\n\n /** @internalapi Creates a new [[Param]] for a given location (DefType) */\n paramFactory: ParamFactory = {\n /** Creates a new [[Param]] from a CONFIG block */\n fromConfig: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.CONFIG, this),\n\n /** Creates a new [[Param]] from a url PATH */\n fromPath: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.PATH, this),\n\n /** Creates a new [[Param]] from a url SEARCH */\n fromSearch: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.SEARCH, this),\n };\n\n /** @internalapi */\n dispose() {\n this.paramTypes.dispose();\n }\n}\n","/**\n * @coreapi\n * @module url\n */ /** */\nimport { UrlMatcher } from \"./urlMatcher\";\nimport { isString, isDefined, isFunction, isState } from \"../common/predicates\";\nimport { UIRouter } from \"../router\";\nimport { identity, extend } from \"../common/common\";\nimport { is, pattern } from \"../common/hof\";\nimport { StateObject } from \"../state/stateObject\";\nimport { RawParams } from \"../params/interface\";\nimport {\n UrlRule, UrlRuleMatchFn, UrlRuleHandlerFn, UrlRuleType, UrlParts, MatcherUrlRule, StateRule, RegExpRule\n} from \"./interface\";\n\n/**\n * Creates a [[UrlRule]]\n *\n * Creates a [[UrlRule]] from a:\n *\n * - `string`\n * - [[UrlMatcher]]\n * - `RegExp`\n * - [[StateObject]]\n * @internalapi\n */\nexport class UrlRuleFactory {\n constructor(public router: UIRouter) { }\n\n compile(str: string) {\n return this.router.urlMatcherFactory.compile(str);\n }\n\n static isUrlRule = obj =>\n obj && ['type', 'match', 'handler'].every(key => isDefined(obj[key]));\n\n create(what: string|UrlMatcher|StateObject|RegExp|UrlRuleMatchFn, handler?: string|UrlRuleHandlerFn): UrlRule {\n const makeRule = pattern([\n [isString, (_what: string) => makeRule(this.compile(_what))],\n [is(UrlMatcher), (_what: UrlMatcher) => this.fromUrlMatcher(_what, handler)],\n [isState, (_what: StateObject) => this.fromState(_what, this.router)],\n [is(RegExp), (_what: RegExp) => this.fromRegExp(_what, handler)],\n [isFunction, (_what: UrlRuleMatchFn) => new BaseUrlRule(_what, handler as UrlRuleHandlerFn)],\n ]);\n\n let rule = makeRule(what);\n if (!rule) throw new Error(\"invalid 'what' in when()\");\n return rule;\n }\n\n /**\n * A UrlRule which matches based on a UrlMatcher\n *\n * The `handler` may be either a `string`, a [[UrlRuleHandlerFn]] or another [[UrlMatcher]]\n *\n * ## Handler as a function\n *\n * If `handler` is a function, the function is invoked with:\n *\n * - matched parameter values ([[RawParams]] from [[UrlMatcher.exec]])\n * - url: the current Url ([[UrlParts]])\n * - router: the router object ([[UIRouter]])\n *\n * #### Example:\n * ```js\n * var urlMatcher = $umf.compile(\"/foo/:fooId/:barId\");\n * var rule = factory.fromUrlMatcher(urlMatcher, match => \"/home/\" + match.fooId + \"/\" + match.barId);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match); // '/home/123/456'\n * ```\n *\n * ## Handler as UrlMatcher\n *\n * If `handler` is a UrlMatcher, the handler matcher is used to create the new url.\n * The `handler` UrlMatcher is formatted using the matched param from the first matcher.\n * The url is replaced with the result.\n *\n * #### Example:\n * ```js\n * var urlMatcher = $umf.compile(\"/foo/:fooId/:barId\");\n * var handler = $umf.compile(\"/home/:fooId/:barId\");\n * var rule = factory.fromUrlMatcher(urlMatcher, handler);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match); // '/home/123/456'\n * ```\n */\n fromUrlMatcher(urlMatcher: UrlMatcher, handler: string|UrlMatcher|UrlRuleHandlerFn): MatcherUrlRule {\n let _handler: UrlRuleHandlerFn = handler as any;\n if (isString(handler)) handler = this.router.urlMatcherFactory.compile(handler);\n if (is(UrlMatcher)(handler)) _handler = (match: RawParams) => (handler as UrlMatcher).format(match);\n\n function match(url: UrlParts) {\n let match = urlMatcher.exec(url.path, url.search, url.hash);\n return urlMatcher.validates(match) && match;\n }\n\n // Prioritize URLs, lowest to highest:\n // - Some optional URL parameters, but none matched\n // - No optional parameters in URL\n // - Some optional parameters, some matched\n // - Some optional parameters, all matched\n function matchPriority(params: RawParams): number {\n let optional = urlMatcher.parameters().filter(param => param.isOptional);\n if (!optional.length) return 0.000001;\n let matched = optional.filter(param => params[param.id]);\n return matched.length / optional.length;\n }\n\n let details = { urlMatcher, matchPriority, type: \"URLMATCHER\" };\n return extend(new BaseUrlRule(match, _handler), details) as MatcherUrlRule;\n }\n\n\n /**\n * A UrlRule which matches a state by its url\n *\n * #### Example:\n * ```js\n * var rule = factory.fromState($state.get('foo'), router);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match);\n * // Starts a transition to 'foo' with params: { fooId: '123', barId: '456' }\n * ```\n */\n fromState(state: StateObject, router: UIRouter): StateRule {\n /**\n * Handles match by transitioning to matched state\n *\n * First checks if the router should start a new transition.\n * A new transition is not required if the current state's URL\n * and the new URL are already identical\n */\n const handler = (match: RawParams) => {\n let $state = router.stateService;\n let globals = router.globals;\n if ($state.href(state, match) !== $state.href(globals.current, globals.params)) {\n $state.transitionTo(state, match, { inherit: true, source: \"url\" });\n }\n };\n\n let details = { state, type: \"STATE\" };\n return extend(this.fromUrlMatcher(state.url, handler), details) as StateRule;\n }\n\n /**\n * A UrlRule which matches based on a regular expression\n *\n * The `handler` may be either a [[UrlRuleHandlerFn]] or a string.\n *\n * ## Handler as a function\n *\n * If `handler` is a function, the function is invoked with:\n *\n * - regexp match array (from `regexp`)\n * - url: the current Url ([[UrlParts]])\n * - router: the router object ([[UIRouter]])\n *\n * #### Example:\n * ```js\n * var rule = factory.fromRegExp(/^\\/foo\\/(bar|baz)$/, match => \"/home/\" + match[1])\n * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ]\n * var result = rule.handler(match); // '/home/bar'\n * ```\n *\n * ## Handler as string\n *\n * If `handler` is a string, the url is *replaced by the string* when the Rule is invoked.\n * The string is first interpolated using `string.replace()` style pattern.\n *\n * #### Example:\n * ```js\n * var rule = factory.fromRegExp(/^\\/foo\\/(bar|baz)$/, \"/home/$1\")\n * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ]\n * var result = rule.handler(match); // '/home/bar'\n * ```\n */\n fromRegExp(regexp: RegExp, handler: string|UrlRuleHandlerFn): RegExpRule {\n if (regexp.global || regexp.sticky) throw new Error(\"Rule RegExp must not be global or sticky\");\n\n /**\n * If handler is a string, the url will be replaced by the string.\n * If the string has any String.replace() style variables in it (like `$2`),\n * they will be replaced by the captures from [[match]]\n */\n const redirectUrlTo = (match: RegExpExecArray) =>\n // Interpolates matched values into $1 $2, etc using a String.replace()-style pattern\n (handler as string).replace(/\\$(\\$|\\d{1,2})/, (m, what) =>\n match[what === '$' ? 0 : Number(what)]);\n\n const _handler = isString(handler) ? redirectUrlTo : handler;\n\n const match = (url: UrlParts): RegExpExecArray =>\n regexp.exec(url.path);\n\n let details = { regexp, type: \"REGEXP\" };\n return extend(new BaseUrlRule(match, _handler), details) as RegExpRule\n }\n}\n\n/**\n * A base rule which calls `match`\n *\n * The value from the `match` function is passed through to the `handler`.\n * @internalapi\n */\nexport class BaseUrlRule implements UrlRule {\n $id: number;\n priority: number;\n type: UrlRuleType = \"RAW\";\n handler: UrlRuleHandlerFn;\n matchPriority = (match) => 0 - this.$id;\n\n constructor(public match: UrlRuleMatchFn, handler?: UrlRuleHandlerFn) {\n this.handler = handler || identity;\n }\n}","/**\n * @internalapi\n * @module url\n */\n/** for typedoc */\nimport { createProxyFunctions, extend, removeFrom } from '../common/common';\nimport { isDefined, isFunction, isString } from '../common/predicates';\nimport { UrlMatcher } from './urlMatcher';\nimport { RawParams } from '../params/interface';\nimport { Disposable } from '../interface';\nimport { UIRouter } from '../router';\nimport { is, pattern, val } from '../common/hof';\nimport { UrlRuleFactory } from './urlRule';\nimport { TargetState } from '../state/targetState';\nimport { MatcherUrlRule, MatchResult, UrlParts, UrlRule, UrlRuleHandlerFn, UrlRuleMatchFn, UrlRulesApi, UrlSyncApi, } from './interface';\nimport { TargetStateDef } from '../state/interface';\n\n/** @hidden */\nfunction appendBasePath(url: string, isHtml5: boolean, absolute: boolean, baseHref: string): string {\n if (baseHref === '/') return url;\n if (isHtml5) return baseHref.slice(0, -1) + url;\n if (absolute) return baseHref.slice(1) + url;\n return url;\n}\n\n/** @hidden */\nconst prioritySort = (a: UrlRule, b: UrlRule) =>\n (b.priority || 0) - (a.priority || 0);\n\n/** @hidden */\nconst typeSort = (a: UrlRule, b: UrlRule) => {\n const weights = { \"STATE\": 4, \"URLMATCHER\": 4, \"REGEXP\": 3, \"RAW\": 2, \"OTHER\": 1 };\n return (weights[a.type] || 0) - (weights[b.type] || 0);\n};\n\n/** @hidden */\nconst urlMatcherSort = (a: MatcherUrlRule, b: MatcherUrlRule) =>\n !a.urlMatcher || !b.urlMatcher ? 0 : UrlMatcher.compare(a.urlMatcher, b.urlMatcher);\n\n/** @hidden */\nconst idSort = (a: UrlRule, b: UrlRule) => {\n // Identically sorted STATE and URLMATCHER best rule will be chosen by `matchPriority` after each rule matches the URL\n const useMatchPriority = { STATE: true, URLMATCHER: true };\n const equal = useMatchPriority[a.type] && useMatchPriority[b.type];\n return equal ? 0 : (a.$id || 0) - (b.$id || 0);\n};\n\n/**\n * Default rule priority sorting function.\n *\n * Sorts rules by:\n *\n * - Explicit priority (set rule priority using [[UrlRulesApi.when]])\n * - Rule type (STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1)\n * - `UrlMatcher` specificity ([[UrlMatcher.compare]]): works for STATE and URLMATCHER types to pick the most specific rule.\n * - Rule registration order (for rule types other than STATE and URLMATCHER)\n * - Equally sorted State and UrlMatcher rules will each match the URL.\n * Then, the *best* match is chosen based on how many parameter values were matched.\n *\n * @coreapi\n */\nlet defaultRuleSortFn: (a: UrlRule, b: UrlRule) => number;\ndefaultRuleSortFn = (a, b) => {\n let cmp = prioritySort(a, b);\n if (cmp !== 0) return cmp;\n\n cmp = typeSort(a, b);\n if (cmp !== 0) return cmp;\n\n cmp = urlMatcherSort(a as MatcherUrlRule, b as MatcherUrlRule);\n if (cmp !== 0) return cmp;\n\n return idSort(a, b);\n};\n\n/**\n * Updates URL and responds to URL changes\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class updates the URL when the state changes.\n * It also responds to changes in the URL.\n */\nexport class UrlRouter implements UrlRulesApi, UrlSyncApi, Disposable {\n /** used to create [[UrlRule]] objects for common cases */\n public urlRuleFactory: UrlRuleFactory;\n\n /** @hidden */ private _router: UIRouter;\n /** @hidden */ private location: string;\n /** @hidden */ private _sortFn = defaultRuleSortFn;\n /** @hidden */ private _stopFn: Function;\n /** @hidden */ _rules: UrlRule[] = [];\n /** @hidden */ private _otherwiseFn: UrlRule;\n /** @hidden */ interceptDeferred = false;\n /** @hidden */ private _id = 0;\n /** @hidden */ private _sorted = false;\n\n /** @hidden */\n constructor(router: UIRouter) {\n this._router = router;\n this.urlRuleFactory = new UrlRuleFactory(router);\n createProxyFunctions(val(UrlRouter.prototype), this, val(this));\n }\n\n /** @internalapi */\n dispose() {\n this.listen(false);\n this._rules = [];\n delete this._otherwiseFn;\n }\n\n /** @inheritdoc */\n sort(compareFn?: (a: UrlRule, b: UrlRule) => number) {\n this._rules = this.stableSort(this._rules, this._sortFn = compareFn || this._sortFn);\n this._sorted = true;\n }\n\n private ensureSorted() {\n this._sorted || this.sort();\n }\n\n private stableSort(arr, compareFn) {\n const arrOfWrapper = arr.map((elem, idx) => ({ elem, idx }));\n\n arrOfWrapper.sort((wrapperA, wrapperB) => {\n const cmpDiff = compareFn(wrapperA.elem, wrapperB.elem);\n return cmpDiff === 0\n ? wrapperA.idx - wrapperB.idx\n : cmpDiff;\n });\n\n return arrOfWrapper.map(wrapper => wrapper.elem);\n }\n\n /**\n * Given a URL, check all rules and return the best [[MatchResult]]\n * @param url\n * @returns {MatchResult}\n */\n match(url: UrlParts): MatchResult {\n this.ensureSorted();\n\n url = extend({path: '', search: {}, hash: '' }, url);\n let rules = this.rules();\n if (this._otherwiseFn) rules.push(this._otherwiseFn);\n\n // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined\n\n let checkRule = (rule: UrlRule): MatchResult => {\n let match = rule.match(url, this._router);\n return match && { match, rule, weight: rule.matchPriority(match) };\n };\n\n // The rules are pre-sorted.\n // - Find the first matching rule.\n // - Find any other matching rule that sorted *exactly the same*, according to `.sort()`.\n // - Choose the rule with the highest match weight.\n let best: MatchResult;\n for (let i = 0; i < rules.length; i++) {\n // Stop when there is a 'best' rule and the next rule sorts differently than it.\n if (best && this._sortFn(rules[i], best.rule) !== 0) break;\n\n let current = checkRule(rules[i]);\n // Pick the best MatchResult\n best = (!best || current && current.weight > best.weight) ? current : best;\n }\n\n return best;\n }\n\n /** @inheritdoc */\n sync(evt?) {\n if (evt && evt.defaultPrevented) return;\n\n let router = this._router,\n $url = router.urlService,\n $state = router.stateService;\n\n let url: UrlParts = {\n path: $url.path(), search: $url.search(), hash: $url.hash(),\n };\n\n let best = this.match(url);\n\n let applyResult = pattern([\n [isString, (newurl: string) => $url.url(newurl, true)],\n [TargetState.isDef, (def: TargetStateDef) => $state.go(def.state, def.params, def.options)],\n [is(TargetState), (target: TargetState) => $state.go(target.state(), target.params(), target.options())],\n ]);\n\n applyResult(best && best.rule.handler(best.match, url, router));\n }\n\n /** @inheritdoc */\n listen(enabled?: boolean): Function {\n if (enabled === false) {\n this._stopFn && this._stopFn();\n delete this._stopFn;\n } else {\n return this._stopFn = this._stopFn || this._router.urlService.onChange(evt => this.sync(evt));\n }\n }\n\n /**\n * Internal API.\n * @internalapi\n */\n update(read?: boolean) {\n let $url = this._router.locationService;\n if (read) {\n this.location = $url.path();\n return;\n }\n if ($url.path() === this.location) return;\n\n $url.url(this.location, true);\n }\n\n /**\n * Internal API.\n *\n * Pushes a new location to the browser history.\n *\n * @internalapi\n * @param urlMatcher\n * @param params\n * @param options\n */\n push(urlMatcher: UrlMatcher, params?: RawParams, options?: { replace?: (string|boolean) }) {\n let replace = options && !!options.replace;\n this._router.urlService.url(urlMatcher.format(params || {}), replace);\n }\n\n /**\n * Builds and returns a URL with interpolated parameters\n *\n * #### Example:\n * ```js\n * matcher = $umf.compile(\"/about/:person\");\n * params = { person: \"bob\" };\n * $bob = $urlRouter.href(matcher, params);\n * // $bob == \"/about/bob\";\n * ```\n *\n * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate.\n * @param params An object of parameter values to fill the matcher's required parameters.\n * @param options Options object. The options are:\n *\n * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n *\n * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`\n */\n href(urlMatcher: UrlMatcher, params?: any, options?: { absolute: boolean }): string {\n let url = urlMatcher.format(params);\n if (url == null) return null;\n\n options = options || { absolute: false };\n\n let cfg = this._router.urlService.config;\n let isHtml5 = cfg.html5Mode();\n if (!isHtml5 && url !== null) {\n url = \"#\" + cfg.hashPrefix() + url;\n }\n url = appendBasePath(url, isHtml5, options.absolute, cfg.baseHref());\n\n if (!options.absolute || !url) {\n return url;\n }\n\n let slash = (!isHtml5 && url ? '/' : ''), port = cfg.port();\n port = (port === 80 || port === 443 ? '' : ':' + port);\n\n return [cfg.protocol(), '://', cfg.host(), port, slash, url].join('');\n }\n\n\n /**\n * Manually adds a URL Rule.\n *\n * Usually, a url rule is added using [[StateDeclaration.url]] or [[when]].\n * This api can be used directly for more control (to register a [[BaseUrlRule]], for example).\n * Rules can be created using [[UrlRouter.urlRuleFactory]], or create manually as simple objects.\n *\n * A rule should have a `match` function which returns truthy if the rule matched.\n * It should also have a `handler` function which is invoked if the rule is the best match.\n *\n * @return a function that deregisters the rule\n */\n rule(rule: UrlRule): Function {\n if (!UrlRuleFactory.isUrlRule(rule)) throw new Error(\"invalid rule\");\n rule.$id = this._id++;\n rule.priority = rule.priority || 0;\n\n this._rules.push(rule);\n this._sorted = false;\n\n return () => this.removeRule(rule);\n }\n\n /** @inheritdoc */\n removeRule(rule): void {\n removeFrom(this._rules, rule);\n }\n\n /** @inheritdoc */\n rules(): UrlRule[] {\n this.ensureSorted();\n return this._rules.slice();\n }\n\n /** @inheritdoc */\n otherwise(handler: string|UrlRuleHandlerFn|TargetState|TargetStateDef) {\n let handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n this._otherwiseFn = this.urlRuleFactory.create(val(true), handlerFn);\n this._sorted = false;\n };\n\n /** @inheritdoc */\n initial(handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef) {\n let handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n let matchFn: UrlRuleMatchFn = (urlParts, router) =>\n router.globals.transitionHistory.size() === 0 && !!/^\\/?$/.exec(urlParts.path);\n\n this.rule(this.urlRuleFactory.create(matchFn, handlerFn));\n };\n\n /** @inheritdoc */\n when(matcher: (RegExp|UrlMatcher|string), handler: string|UrlRuleHandlerFn, options?: { priority: number }): UrlRule {\n let rule = this.urlRuleFactory.create(matcher, handler);\n if (isDefined(options && options.priority)) rule.priority = options.priority;\n this.rule(rule);\n return rule;\n };\n\n /** @inheritdoc */\n deferIntercept(defer?: boolean) {\n if (defer === undefined) defer = true;\n this.interceptDeferred = defer;\n };\n}\n\nfunction getHandlerFn(handler: string|UrlRuleHandlerFn|TargetState|TargetStateDef): UrlRuleHandlerFn {\n if (!isFunction(handler) && !isString(handler) && !is(TargetState)(handler) && !TargetState.isDef(handler)) {\n throw new Error(\"'handler' must be a string, function, TargetState, or have a state: 'newtarget' property\");\n }\n return isFunction(handler) ? handler as UrlRuleHandlerFn : val(handler);\n}\n","/**\n * @coreapi\n * @module view\n */ /** for typedoc */\nimport {equals, applyPairs, removeFrom, TypedMap} from \"../common/common\";\nimport {curry, prop} from \"../common/hof\";\nimport {isString, isArray} from \"../common/predicates\";\nimport {trace} from \"../common/trace\";\nimport {PathNode} from \"../path/pathNode\";\n\nimport {ActiveUIView, ViewContext, ViewConfig} from \"./interface\";\nimport {_ViewDeclaration} from \"../state/interface\";\n\nexport type ViewConfigFactory = (path: PathNode[], decl: _ViewDeclaration) => ViewConfig|ViewConfig[];\n\nexport interface ViewServicePluginAPI {\n _rootViewContext(context?: ViewContext): ViewContext;\n _viewConfigFactory(viewType: string, factory: ViewConfigFactory);\n _registeredUIViews(): ActiveUIView[];\n _activeViewConfigs(): ViewConfig[];\n}\n\n/**\n * The View service\n *\n * This service pairs existing `ui-view` components (which live in the DOM)\n * with view configs (from the state declaration objects: [[StateDeclaration.views]]).\n *\n * - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]].\n * The views from exited states are deactivated via [[deactivateViewConfig]].\n * (See: the [[registerActivateViews]] Transition Hook)\n *\n * - As `ui-view` components pop in and out of existence, they register themselves using [[registerUIView]].\n *\n * - When the [[sync]] function is called, the registered `ui-view`(s) ([[ActiveUIView]])\n * are configured with the matching [[ViewConfig]](s)\n *\n */\nexport class ViewService {\n private _uiViews: ActiveUIView[] = [];\n private _viewConfigs: ViewConfig[] = [];\n private _rootContext: ViewContext;\n private _viewConfigFactories: { [key: string]: ViewConfigFactory } = {};\n\n constructor() { }\n\n public _pluginapi: ViewServicePluginAPI = {\n _rootViewContext: this._rootViewContext.bind(this),\n _viewConfigFactory: this._viewConfigFactory.bind(this),\n _registeredUIViews: () => this._uiViews,\n _activeViewConfigs: () => this._viewConfigs,\n };\n\n private _rootViewContext(context?: ViewContext): ViewContext {\n return this._rootContext = context || this._rootContext;\n };\n\n private _viewConfigFactory(viewType: string, factory: ViewConfigFactory) {\n this._viewConfigFactories[viewType] = factory;\n }\n\n createViewConfig(path: PathNode[], decl: _ViewDeclaration): ViewConfig[] {\n let cfgFactory = this._viewConfigFactories[decl.$type];\n if (!cfgFactory) throw new Error(\"ViewService: No view config factory registered for type \" + decl.$type);\n let cfgs = cfgFactory(path, decl);\n return isArray(cfgs) ? cfgs : [cfgs];\n }\n \n /**\n * Deactivates a ViewConfig.\n *\n * This function deactivates a `ViewConfig`.\n * After calling [[sync]], it will un-pair from any `ui-view` with which it is currently paired.\n *\n * @param viewConfig The ViewConfig view to deregister.\n */\n deactivateViewConfig(viewConfig: ViewConfig) {\n trace.traceViewServiceEvent(\"<- Removing\", viewConfig);\n removeFrom(this._viewConfigs, viewConfig);\n }\n\n activateViewConfig(viewConfig: ViewConfig) {\n trace.traceViewServiceEvent(\"-> Registering\", viewConfig);\n this._viewConfigs.push(viewConfig);\n }\n\n /**\n * Given a ui-view and a ViewConfig, determines if they \"match\".\n *\n * A ui-view has a fully qualified name (fqn) and a context object. The fqn is built from its overall location in\n * the DOM, describing its nesting relationship to any parent ui-view tags it is nested inside of.\n *\n * A ViewConfig has a target ui-view name and a context anchor. The ui-view name can be a simple name, or\n * can be a segmented ui-view path, describing a portion of a ui-view fqn.\n *\n * In order for a ui-view to match ViewConfig, ui-view's $type must match the ViewConfig's $type\n *\n * If the ViewConfig's target ui-view name is a simple name (no dots), then a ui-view matches if:\n * - the ui-view's name matches the ViewConfig's target name\n * - the ui-view's context matches the ViewConfig's anchor\n *\n * If the ViewConfig's target ui-view name is a segmented name (with dots), then a ui-view matches if:\n * - There exists a parent ui-view where:\n * - the parent ui-view's name matches the first segment (index 0) of the ViewConfig's target name\n * - the parent ui-view's context matches the ViewConfig's anchor\n * - And the remaining segments (index 1..n) of the ViewConfig's target name match the tail of the ui-view's fqn\n *\n * Example:\n *\n * DOM:\n * \n * \n * \n * \n * \n * \n * \n * \n *\n * uiViews: [\n * { fqn: \"$default\", creationContext: { name: \"\" } },\n * { fqn: \"$default.foo\", creationContext: { name: \"A\" } },\n * { fqn: \"$default.foo.$default\", creationContext: { name: \"A.B\" } }\n * { fqn: \"$default.foo.$default.bar\", creationContext: { name: \"A.B.C\" } }\n * ]\n *\n * These four view configs all match the ui-view with the fqn: \"$default.foo.$default.bar\":\n *\n * - ViewConfig1: { uiViewName: \"bar\", uiViewContextAnchor: \"A.B.C\" }\n * - ViewConfig2: { uiViewName: \"$default.bar\", uiViewContextAnchor: \"A.B\" }\n * - ViewConfig3: { uiViewName: \"foo.$default.bar\", uiViewContextAnchor: \"A\" }\n * - ViewConfig4: { uiViewName: \"$default.foo.$default.bar\", uiViewContextAnchor: \"\" }\n *\n * Using ViewConfig3 as an example, it matches the ui-view with fqn \"$default.foo.$default.bar\" because:\n * - The ViewConfig's segmented target name is: [ \"foo\", \"$default\", \"bar\" ]\n * - There exists a parent ui-view (which has fqn: \"$default.foo\") where:\n * - the parent ui-view's name \"foo\" matches the first segment \"foo\" of the ViewConfig's target name\n * - the parent ui-view's context \"A\" matches the ViewConfig's anchor context \"A\"\n * - And the remaining segments [ \"$default\", \"bar\" ].join(\".\"_ of the ViewConfig's target name match\n * the tail of the ui-view's fqn \"default.bar\"\n *\n * @internalapi\n */\n static matches = (uiViewsByFqn: TypedMap, uiView: ActiveUIView) => (viewConfig: ViewConfig) => {\n // Don't supply an ng1 ui-view with an ng2 ViewConfig, etc\n if (uiView.$type !== viewConfig.viewDecl.$type) return false;\n\n // Split names apart from both viewConfig and uiView into segments\n let vc = viewConfig.viewDecl;\n let vcSegments = vc.$uiViewName.split(\".\");\n let uivSegments = uiView.fqn.split(\".\");\n\n // Check if the tails of the segment arrays match. ex, these arrays' tails match:\n // vc: [\"foo\", \"bar\"], uiv fqn: [\"$default\", \"foo\", \"bar\"]\n if (!equals(vcSegments, uivSegments.slice(0 - vcSegments.length)))\n return false;\n\n // Now check if the fqn ending at the first segment of the viewConfig matches the context:\n // [\"$default\", \"foo\"].join(\".\") == \"$default.foo\", does the ui-view $default.foo context match?\n let negOffset = (1 - vcSegments.length) || undefined;\n let fqnToFirstSegment = uivSegments.slice(0, negOffset).join(\".\");\n let uiViewContext = uiViewsByFqn[fqnToFirstSegment].creationContext;\n return vc.$uiViewContextAnchor === (uiViewContext && uiViewContext.name);\n }\n\n sync() {\n let uiViewsByFqn: TypedMap =\n this._uiViews.map(uiv => [uiv.fqn, uiv]).reduce(applyPairs, {});\n\n // Return a weighted depth value for a uiView.\n // The depth is the nesting depth of ui-views (based on FQN; times 10,000)\n // plus the depth of the state that is populating the uiView\n function uiViewDepth(uiView: ActiveUIView) {\n const stateDepth = (context: ViewContext) =>\n context && context.parent ? stateDepth(context.parent) + 1 : 1;\n return (uiView.fqn.split(\".\").length * 10000) + stateDepth(uiView.creationContext);\n }\n\n // Return the ViewConfig's context's depth in the context tree.\n function viewConfigDepth(config: ViewConfig) {\n let context: ViewContext = config.viewDecl.$context, count = 0;\n while (++count && context.parent) context = context.parent;\n return count;\n }\n\n // Given a depth function, returns a compare function which can return either ascending or descending order\n const depthCompare = curry((depthFn, posNeg, left, right) => posNeg * (depthFn(left) - depthFn(right)));\n\n const matchingConfigPair = (uiView: ActiveUIView) => {\n let matchingConfigs = this._viewConfigs.filter(ViewService.matches(uiViewsByFqn, uiView));\n if (matchingConfigs.length > 1) {\n // This is OK. Child states can target a ui-view that the parent state also targets (the child wins)\n // Sort by depth and return the match from the deepest child\n // console.log(`Multiple matching view configs for ${uiView.fqn}`, matchingConfigs);\n matchingConfigs.sort(depthCompare(viewConfigDepth, -1)); // descending\n }\n return [uiView, matchingConfigs[0]];\n };\n\n const configureUIView = ([uiView, viewConfig]) => {\n // If a parent ui-view is reconfigured, it could destroy child ui-views.\n // Before configuring a child ui-view, make sure it's still in the active uiViews array.\n if (this._uiViews.indexOf(uiView) !== -1)\n uiView.configUpdated(viewConfig);\n };\n\n // Sort views by FQN and state depth. Process uiviews nearest the root first.\n const pairs = this._uiViews.sort(depthCompare(uiViewDepth, 1)).map(matchingConfigPair);\n\n trace.traceViewSync(pairs);\n\n pairs.forEach(configureUIView);\n };\n\n /**\n * Registers a `ui-view` component\n *\n * When a `ui-view` component is created, it uses this method to register itself.\n * After registration the [[sync]] method is used to ensure all `ui-view` are configured with the proper [[ViewConfig]].\n *\n * Note: the `ui-view` component uses the `ViewConfig` to determine what view should be loaded inside the `ui-view`,\n * and what the view's state context is.\n *\n * Note: There is no corresponding `deregisterUIView`.\n * A `ui-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself.\n *\n * @param uiView The metadata for a UIView\n * @return a de-registration function used when the view is destroyed.\n */\n registerUIView(uiView: ActiveUIView) {\n trace.traceViewServiceUIViewEvent(\"-> Registering\", uiView);\n let uiViews = this._uiViews;\n const fqnAndTypeMatches = (uiv: ActiveUIView) => uiv.fqn === uiView.fqn && uiv.$type === uiView.$type;\n if (uiViews.filter(fqnAndTypeMatches).length)\n trace.traceViewServiceUIViewEvent(\"!!!! duplicate uiView named:\", uiView);\n\n uiViews.push(uiView);\n this.sync();\n\n return () => {\n let idx = uiViews.indexOf(uiView);\n if (idx === -1) {\n trace.traceViewServiceUIViewEvent(\"Tried removing non-registered uiView\", uiView);\n return;\n }\n trace.traceViewServiceUIViewEvent(\"<- Deregistering\", uiView);\n removeFrom(uiViews)(uiView);\n };\n };\n\n /**\n * Returns the list of views currently available on the page, by fully-qualified name.\n *\n * @return {Array} Returns an array of fully-qualified view names.\n */\n available() {\n return this._uiViews.map(prop(\"fqn\"));\n }\n\n /**\n * Returns the list of views on the page containing loaded content.\n *\n * @return {Array} Returns an array of fully-qualified view names.\n */\n active() {\n return this._uiViews.filter(prop(\"$config\")).map(prop(\"name\"));\n }\n\n /**\n * Normalizes a view's name from a state.views configuration block.\n *\n * This should be used by a framework implementation to calculate the values for\n * [[_ViewDeclaration.$uiViewName]] and [[_ViewDeclaration.$uiViewContextAnchor]].\n *\n * @param context the context object (state declaration) that the view belongs to\n * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]]\n *\n * @returns the normalized uiViewName and uiViewContextAnchor that the view targets\n */\n static normalizeUIViewTarget(context: ViewContext, rawViewName = \"\") {\n // TODO: Validate incoming view name with a regexp to allow:\n // ex: \"view.name@foo.bar\" , \"^.^.view.name\" , \"view.name@^.^\" , \"\" ,\n // \"@\" , \"$default@^\" , \"!$default.$default\" , \"!foo.bar\"\n let viewAtContext: string[] = rawViewName.split(\"@\");\n let uiViewName = viewAtContext[0] || \"$default\"; // default to unnamed view\n let uiViewContextAnchor = isString(viewAtContext[1]) ? viewAtContext[1] : \"^\"; // default to parent context\n\n // Handle relative view-name sugar syntax.\n // Matches rawViewName \"^.^.^.foo.bar\" into array: [\"^.^.^.foo.bar\", \"^.^.^\", \"foo.bar\"],\n let relativeViewNameSugar = /^(\\^(?:\\.\\^)*)\\.(.*$)/.exec(uiViewName);\n if (relativeViewNameSugar) {\n // Clobbers existing contextAnchor (rawViewName validation will fix this)\n uiViewContextAnchor = relativeViewNameSugar[1]; // set anchor to \"^.^.^\"\n uiViewName = relativeViewNameSugar[2]; // set view-name to \"foo.bar\"\n }\n\n if (uiViewName.charAt(0) === '!') {\n uiViewName = uiViewName.substr(1);\n uiViewContextAnchor = \"\"; // target absolutely from root\n }\n\n // handle parent relative targeting \"^.^.^\"\n let relativeMatch = /^(\\^(?:\\.\\^)*)$/;\n if (relativeMatch.exec(uiViewContextAnchor)) {\n let anchor = uiViewContextAnchor.split(\".\").reduce(((anchor, x) => anchor.parent), context);\n uiViewContextAnchor = anchor.name;\n } else if (uiViewContextAnchor === '.') {\n uiViewContextAnchor = context.name;\n }\n\n return {uiViewName, uiViewContextAnchor};\n }\n}","/**\n * @coreapi\n * @module core\n */ /** */\nimport {StateParams} from \"./params/stateParams\";\nimport {StateDeclaration} from \"./state/interface\";\nimport {StateObject} from \"./state/stateObject\";\nimport {Transition} from \"./transition/transition\";\nimport {Queue} from \"./common/queue\";\nimport {TransitionService} from \"./transition/transitionService\";\nimport {copy} from \"./common/common\";\nimport { Disposable } from './interface';\n\n/**\n * Global router state\n *\n * This is where we hold the global mutable state such as current state, current\n * params, current transition, etc.\n */\nexport class UIRouterGlobals implements Disposable {\n /**\n * Current parameter values\n *\n * The parameter values from the latest successful transition\n */\n params: StateParams = new StateParams();\n\n /**\n * Current state\n *\n * The to-state from the latest successful transition\n */\n current: StateDeclaration;\n\n /**\n * Current state (internal object)\n *\n * The to-state from the latest successful transition\n * @internalapi\n */\n $current: StateObject;\n\n /**\n * The current started/running transition.\n * This transition has reached at least the onStart phase, but is not yet complete\n */\n transition: Transition;\n\n /** @internalapi */\n lastStartedTransitionId: number = -1;\n\n /** @internalapi */\n transitionHistory = new Queue([], 1);\n\n /** @internalapi */\n successfulTransitions = new Queue([], 1);\n\n dispose() {\n this.transitionHistory.clear();\n this.successfulTransitions.clear();\n this.transition = null;\n }\n}\n","/**\n * @coreapi\n * @module url\n */ /** */\n\nimport { UIRouter } from \"../router\";\nimport { LocationServices, notImplemented, LocationConfig } from \"../common/coreservices\";\nimport { noop, createProxyFunctions } from \"../common/common\";\nimport { UrlConfigApi, UrlSyncApi, UrlRulesApi, UrlParts, MatchResult } from \"./interface\";\n\n/** @hidden */\nconst makeStub = (keys: string[]): any =>\n keys.reduce((acc, key) => (acc[key] = notImplemented(key), acc), { dispose: noop });\n\n/** @hidden */ const locationServicesFns = [\"url\", \"path\", \"search\", \"hash\", \"onChange\"];\n/** @hidden */ const locationConfigFns = [\"port\", \"protocol\", \"host\", \"baseHref\", \"html5Mode\", \"hashPrefix\"];\n/** @hidden */ const umfFns = [\"type\", \"caseInsensitive\", \"strictMode\", \"defaultSquashPolicy\"];\n/** @hidden */ const rulesFns = [\"sort\", \"when\", \"initial\", \"otherwise\", \"rules\", \"rule\", \"removeRule\"];\n/** @hidden */ const syncFns = [\"deferIntercept\", \"listen\", \"sync\", \"match\"];\n\n/**\n * API for URL management\n */\nexport class UrlService implements LocationServices, UrlSyncApi {\n /** @hidden */\n static locationServiceStub: LocationServices = makeStub(locationServicesFns);\n /** @hidden */\n static locationConfigStub: LocationConfig = makeStub(locationConfigFns);\n\n /** @inheritdoc */\n url(): string;\n /** @inheritdoc */\n url(newurl: string, replace?: boolean, state?): void;\n url(newurl?, replace?, state?): any { return };\n /** @inheritdoc */\n path(): string { return };\n /** @inheritdoc */\n search(): { [key: string]: any } { return };\n /** @inheritdoc */\n hash(): string { return };\n /** @inheritdoc */\n onChange(callback: Function): Function { return };\n\n\n /**\n * Returns the current URL parts\n *\n * This method returns the current URL components as a [[UrlParts]] object.\n *\n * @returns the current url parts\n */\n parts(): UrlParts {\n return { path: this.path(), search: this.search(), hash: this.hash() }\n }\n\n dispose() { }\n\n /** @inheritdoc */\n sync(evt?) { return }\n /** @inheritdoc */\n listen(enabled?: boolean): Function { return };\n /** @inheritdoc */\n deferIntercept(defer?: boolean) { return }\n /** @inheritdoc */\n match(urlParts: UrlParts): MatchResult { return }\n\n /**\n * A nested API for managing URL rules and rewrites\n *\n * See: [[UrlRulesApi]] for details\n */\n rules: UrlRulesApi;\n\n /**\n * A nested API to configure the URL and retrieve URL information\n *\n * See: [[UrlConfigApi]] for details\n */\n config: UrlConfigApi;\n\n /** @hidden */\n private router: UIRouter;\n\n /** @hidden */\n constructor(router: UIRouter, lateBind = true) {\n this.router = router;\n this.rules = {} as any;\n this.config = {} as any;\n\n // proxy function calls from UrlService to the LocationService/LocationConfig\n const locationServices = () => router.locationService;\n createProxyFunctions(locationServices, this, locationServices, locationServicesFns, lateBind);\n\n const locationConfig = () => router.locationConfig;\n createProxyFunctions(locationConfig, this.config, locationConfig, locationConfigFns, lateBind);\n\n const umf = () => router.urlMatcherFactory;\n createProxyFunctions(umf, this.config, umf, umfFns);\n\n const urlRouter = () => router.urlRouter;\n createProxyFunctions(urlRouter, this.rules, urlRouter, rulesFns);\n createProxyFunctions(urlRouter, this, urlRouter, syncFns);\n }\n}\n","/**\n * @coreapi\n * @module core\n */ /** */\nimport { UrlMatcherFactory } from \"./url/urlMatcherFactory\";\nimport { UrlRouter } from \"./url/urlRouter\";\nimport { TransitionService } from \"./transition/transitionService\";\nimport { ViewService } from \"./view/view\";\nimport { StateRegistry } from \"./state/stateRegistry\";\nimport { StateService } from \"./state/stateService\";\nimport { UIRouterGlobals } from \"./globals\";\nimport { UIRouterPlugin, Disposable } from \"./interface\";\nimport { values, removeFrom } from \"./common/common\";\nimport { isFunction } from \"./common/predicates\";\nimport { UrlService } from \"./url/urlService\";\nimport { LocationServices, LocationConfig } from \"./common/coreservices\";\nimport { Trace, trace } from \"./common/trace\";\n\n/** @hidden */\nlet _routerInstance = 0;\n\n/**\n * The master class used to instantiate an instance of UI-Router.\n *\n * UI-Router (for each specific framework) will create an instance of this class during bootstrap.\n * This class instantiates and wires the UI-Router services together.\n *\n * After a new instance of the UIRouter class is created, it should be configured for your app.\n * For instance, app states should be registered with the [[UIRouter.stateRegistry]].\n *\n * ---\n *\n * Normally the framework code will bootstrap UI-Router.\n * If you are bootstrapping UIRouter manually, tell it to monitor the URL by calling\n * [[UrlService.listen]] then [[UrlService.sync]].\n */\nexport class UIRouter {\n /** @hidden */ $id = _routerInstance++;\n /** @hidden */ _disposed = false;\n /** @hidden */ private _disposables: Disposable[] = [];\n\n /** Provides trace information to the console */\n trace: Trace = trace;\n\n /** Provides services related to ui-view synchronization */\n viewService = new ViewService();\n\n /** Provides services related to Transitions */\n transitionService: TransitionService = new TransitionService(this);\n\n /** Global router state */\n globals: UIRouterGlobals = new UIRouterGlobals();\n\n /**\n * Deprecated for public use. Use [[urlService]] instead.\n * @deprecated Use [[urlService]] instead\n */\n urlMatcherFactory: UrlMatcherFactory = new UrlMatcherFactory();\n\n /**\n * Deprecated for public use. Use [[urlService]] instead.\n * @deprecated Use [[urlService]] instead\n */\n urlRouter: UrlRouter = new UrlRouter(this);\n\n /** Provides a registry for states, and related registration services */\n stateRegistry: StateRegistry = new StateRegistry(this);\n\n /** Provides services related to states */\n stateService = new StateService(this);\n\n /** Provides services related to the URL */\n urlService: UrlService = new UrlService(this);\n\n\n /** Registers an object to be notified when the router is disposed */\n disposable(disposable: Disposable) {\n this._disposables.push(disposable);\n }\n\n /**\n * Disposes this router instance\n *\n * When called, clears resources retained by the router by calling `dispose(this)` on all\n * registered [[disposable]] objects.\n *\n * Or, if a `disposable` object is provided, calls `dispose(this)` on that object only.\n *\n * @param disposable (optional) the disposable to dispose\n */\n dispose(disposable?: any): void {\n if (disposable && isFunction(disposable.dispose)) {\n disposable.dispose(this);\n return undefined;\n }\n\n this._disposed = true;\n this._disposables.slice().forEach(d => {\n try {\n typeof d.dispose === 'function' && d.dispose(this);\n removeFrom(this._disposables, d);\n } catch (ignored) {}\n });\n }\n\n /**\n * Creates a new `UIRouter` object\n *\n * @param locationService a [[LocationServices]] implementation\n * @param locationConfig a [[LocationConfig]] implementation\n * @internalapi\n */\n constructor(\n public locationService: LocationServices = UrlService.locationServiceStub,\n public locationConfig: LocationConfig = UrlService.locationConfigStub\n ) {\n\n this.viewService._pluginapi._rootViewContext(this.stateRegistry.root());\n this.globals.$current = this.stateRegistry.root();\n this.globals.current = this.globals.$current.self;\n\n this.disposable(this.globals);\n this.disposable(this.stateService);\n this.disposable(this.stateRegistry);\n this.disposable(this.transitionService);\n this.disposable(this.urlRouter);\n this.disposable(locationService);\n this.disposable(locationConfig);\n }\n\n /** @hidden */\n private _plugins: { [key: string]: UIRouterPlugin } = {};\n\n /** Add plugin (as ES6 class) */\n plugin(plugin: { new(router: UIRouter, options?: any): T }, options?: any): T;\n /** Add plugin (as javascript constructor function) */\n plugin(plugin: { (router: UIRouter, options?: any): void }, options?: any): T;\n /** Add plugin (as javascript factory function) */\n plugin(plugin: PluginFactory, options?: any): T;\n /**\n * Adds a plugin to UI-Router\n *\n * This method adds a UI-Router Plugin.\n * A plugin can enhance or change UI-Router behavior using any public API.\n *\n * #### Example:\n * ```js\n * import { MyCoolPlugin } from \"ui-router-cool-plugin\";\n *\n * var plugin = router.addPlugin(MyCoolPlugin);\n * ```\n *\n * ### Plugin authoring\n *\n * A plugin is simply a class (or constructor function) which accepts a [[UIRouter]] instance and (optionally) an options object.\n *\n * The plugin can implement its functionality using any of the public APIs of [[UIRouter]].\n * For example, it may configure router options or add a Transition Hook.\n *\n * The plugin can then be published as a separate module.\n *\n * #### Example:\n * ```js\n * export class MyAuthPlugin implements UIRouterPlugin {\n * constructor(router: UIRouter, options: any) {\n * this.name = \"MyAuthPlugin\";\n * let $transitions = router.transitionService;\n * let $state = router.stateService;\n *\n * let authCriteria = {\n * to: (state) => state.data && state.data.requiresAuth\n * };\n *\n * function authHook(transition: Transition) {\n * let authService = transition.injector().get('AuthService');\n * if (!authService.isAuthenticated()) {\n * return $state.target('login');\n * }\n * }\n *\n * $transitions.onStart(authCriteria, authHook);\n * }\n * }\n * ```\n *\n * @param plugin one of:\n * - a plugin class which implements [[UIRouterPlugin]]\n * - a constructor function for a [[UIRouterPlugin]] which accepts a [[UIRouter]] instance\n * - a factory function which accepts a [[UIRouter]] instance and returns a [[UIRouterPlugin]] instance\n * @param options options to pass to the plugin class/factory\n * @returns the registered plugin instance\n */\n plugin(plugin: any, options: any = {}): T {\n let pluginInstance = new plugin(this, options);\n if (!pluginInstance.name) throw new Error(\"Required property `name` missing on plugin: \" + pluginInstance);\n this._disposables.push(pluginInstance);\n return this._plugins[pluginInstance.name] = pluginInstance;\n }\n\n /**\n * Returns registered plugins\n *\n * Returns the registered plugin of the given `pluginName`.\n * If no `pluginName` is given, returns all registered plugins\n *\n * @param pluginName (optional) the name of the plugin to get\n * @return the named plugin (undefined if not found), or all plugins (if `pluginName` is omitted)\n */\n getPlugin(pluginName: string): UIRouterPlugin;\n getPlugin(): UIRouterPlugin[];\n getPlugin(pluginName?: string): UIRouterPlugin|UIRouterPlugin[] {\n return pluginName ? this._plugins[pluginName] : values(this._plugins);\n }\n}\n\n/** @internalapi */\nexport type PluginFactory = (router: UIRouter, options?: any) => T;\n","/** @module hooks */ /** */\nimport { Transition } from \"../transition/transition\";\nimport { UIRouter } from \"../router\";\nimport { TransitionService } from \"../transition/transitionService\";\n\nfunction addCoreResolvables(trans: Transition) {\n trans.addResolvable({ token: UIRouter, deps: [], resolveFn: () => trans.router, data: trans.router }, \"\");\n trans.addResolvable({ token: Transition, deps: [], resolveFn: () => trans, data: trans }, \"\");\n trans.addResolvable({ token: '$transition$', deps: [], resolveFn: () => trans, data: trans }, \"\");\n trans.addResolvable({ token: '$stateParams', deps: [], resolveFn: () => trans.params(), data: trans.params() }, \"\");\n\n trans.entering().forEach(state => {\n trans.addResolvable({ token: '$state$', deps: [], resolveFn: () => state, data: state }, state);\n });\n}\n\nexport const registerAddCoreResolvables = (transitionService: TransitionService) =>\n transitionService.onCreate({}, addCoreResolvables);\n","/** @module hooks */ /** */\nimport {isString, isFunction} from \"../common/predicates\"\nimport {Transition} from \"../transition/transition\";\nimport {services} from \"../common/coreservices\";\nimport {TargetState} from \"../state/targetState\";\nimport {TransitionService} from \"../transition/transitionService\";\nimport {TransitionHookFn} from \"../transition/interface\";\n\n/**\n * A [[TransitionHookFn]] that redirects to a different state or params\n *\n * Registered using `transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectHook);`\n * \n * See [[StateDeclaration.redirectTo]]\n */\nconst redirectToHook: TransitionHookFn = (trans: Transition) => {\n let redirect = trans.to().redirectTo;\n if (!redirect) return;\n\n let $state = trans.router.stateService;\n\n function handleResult(result: any) {\n if (!result) return;\n if (result instanceof TargetState) return result;\n if (isString(result)) return $state.target( result, trans.params(), trans.options());\n if (result['state'] || result['params'])\n return $state.target(result['state'] || trans.to(), result['params'] || trans.params(), trans.options());\n }\n\n if (isFunction(redirect)) {\n return services.$q.when(redirect(trans)).then(handleResult);\n }\n return handleResult(redirect);\n};\n\nexport const registerRedirectToHook = (transitionService: TransitionService) =>\n transitionService.onStart({to: (state) => !!state.redirectTo}, redirectToHook);\n","/** @module hooks */\n/** for typedoc */\nimport { TransitionStateHookFn } from '../transition/interface';\nimport { Transition } from '../transition/transition';\nimport { TransitionService } from '../transition/transitionService';\nimport { StateDeclaration } from '../state/interface';\nimport { StateObject } from '../state/stateObject';\n\n/**\n * A factory which creates an onEnter, onExit or onRetain transition hook function\n *\n * The returned function invokes the (for instance) state.onEnter hook when the\n * state is being entered.\n *\n * @hidden\n */\nfunction makeEnterExitRetainHook(hookName: string): TransitionStateHookFn {\n return (transition: Transition, state: StateDeclaration) => {\n let _state: StateObject = state.$$state();\n let hookFn: TransitionStateHookFn = _state[hookName];\n return hookFn(transition, state);\n }\n}\n\n/**\n * The [[TransitionStateHookFn]] for onExit\n *\n * When the state is being exited, the state's .onExit function is invoked.\n *\n * Registered using `transitionService.onExit({ exiting: (state) => !!state.onExit }, onExitHook);`\n *\n * See: [[IHookRegistry.onExit]]\n */\nconst onExitHook: TransitionStateHookFn = makeEnterExitRetainHook('onExit');\nexport const registerOnExitHook = (transitionService: TransitionService) =>\n transitionService.onExit({exiting: state => !!state.onExit}, onExitHook);\n\n/**\n * The [[TransitionStateHookFn]] for onRetain\n *\n * When the state was already entered, and is not being exited or re-entered, the state's .onRetain function is invoked.\n *\n * Registered using `transitionService.onRetain({ retained: (state) => !!state.onRetain }, onRetainHook);`\n *\n * See: [[IHookRegistry.onRetain]]\n */\nconst onRetainHook: TransitionStateHookFn = makeEnterExitRetainHook('onRetain');\nexport const registerOnRetainHook = (transitionService: TransitionService) =>\n transitionService.onRetain({retained: state => !!state.onRetain}, onRetainHook);\n\n/**\n * The [[TransitionStateHookFn]] for onEnter\n *\n * When the state is being entered, the state's .onEnter function is invoked.\n *\n * Registered using `transitionService.onEnter({ entering: (state) => !!state.onEnter }, onEnterHook);`\n *\n * See: [[IHookRegistry.onEnter]]\n */\nconst onEnterHook: TransitionStateHookFn = makeEnterExitRetainHook('onEnter');\nexport const registerOnEnterHook = (transitionService: TransitionService) =>\n transitionService.onEnter({entering: state => !!state.onEnter}, onEnterHook);\n\n","/** @module hooks */\n/** for typedoc */\nimport { noop } from '../common/common';\nimport { Transition } from '../transition/transition';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { TransitionStateHookFn, TransitionHookFn } from '../transition/interface';\nimport { TransitionService } from '../transition/transitionService';\nimport { val } from '../common/hof';\nimport { StateDeclaration } from '../state/interface';\n\n/**\n * A [[TransitionHookFn]] which resolves all EAGER Resolvables in the To Path\n *\n * Registered using `transitionService.onStart({}, eagerResolvePath);`\n *\n * When a Transition starts, this hook resolves all the EAGER Resolvables, which the transition then waits for.\n *\n * See [[StateDeclaration.resolve]]\n */\nconst eagerResolvePath: TransitionHookFn = (trans: Transition) =>\n new ResolveContext(trans.treeChanges().to)\n .resolvePath(\"EAGER\", trans)\n .then(noop);\n\nexport const registerEagerResolvePath = (transitionService: TransitionService) =>\n transitionService.onStart({}, eagerResolvePath, {priority: 1000});\n\n/**\n * A [[TransitionHookFn]] which resolves all LAZY Resolvables for the state (and all its ancestors) in the To Path\n *\n * Registered using `transitionService.onEnter({ entering: () => true }, lazyResolveState);`\n *\n * When a State is being entered, this hook resolves all the Resolvables for this state, which the transition then waits for.\n *\n * See [[StateDeclaration.resolve]]\n */\nconst lazyResolveState: TransitionStateHookFn = (trans: Transition, state: StateDeclaration) =>\n new ResolveContext(trans.treeChanges().to)\n .subContext(state.$$state())\n .resolvePath(\"LAZY\", trans)\n .then(noop);\n\nexport const registerLazyResolveState = (transitionService: TransitionService) =>\n transitionService.onEnter({ entering: val(true) }, lazyResolveState, {priority: 1000});\n\n","/** @module hooks */ /** for typedoc */\nimport {noop} from \"../common/common\";\nimport {services} from \"../common/coreservices\";\nimport {Transition} from \"../transition/transition\";\nimport {ViewService} from \"../view/view\";\nimport {ViewConfig} from \"../view/interface\";\nimport {TransitionHookFn} from \"../transition/interface\";\nimport {TransitionService} from \"../transition/transitionService\";\n\n\n/**\n * A [[TransitionHookFn]] which waits for the views to load\n *\n * Registered using `transitionService.onStart({}, loadEnteringViews);`\n *\n * Allows the views to do async work in [[ViewConfig.load]] before the transition continues.\n * In angular 1, this includes loading the templates.\n */\nconst loadEnteringViews: TransitionHookFn = (transition: Transition) => {\n let $q = services.$q;\n let enteringViews = transition.views(\"entering\");\n if (!enteringViews.length) return;\n return $q.all(enteringViews.map(view => $q.when(view.load()))).then(noop);\n};\n\nexport const registerLoadEnteringViews = (transitionService: TransitionService) =>\n transitionService.onFinish({}, loadEnteringViews);\n\n/**\n * A [[TransitionHookFn]] which activates the new views when a transition is successful.\n *\n * Registered using `transitionService.onSuccess({}, activateViews);`\n *\n * After a transition is complete, this hook deactivates the old views from the previous state,\n * and activates the new views from the destination state.\n *\n * See [[ViewService]]\n */\nconst activateViews: TransitionHookFn = (transition: Transition) => {\n let enteringViews = transition.views(\"entering\");\n let exitingViews = transition.views(\"exiting\");\n if (!enteringViews.length && !exitingViews.length) return;\n\n let $view: ViewService = transition.router.viewService;\n\n exitingViews.forEach((vc: ViewConfig) => $view.deactivateViewConfig(vc));\n enteringViews.forEach((vc: ViewConfig) => $view.activateViewConfig(vc));\n\n $view.sync();\n};\n\nexport const registerActivateViews = (transitionService: TransitionService) =>\n transitionService.onSuccess({}, activateViews);\n","/** @module hooks */\n/** for typedoc */\nimport { Transition } from '../transition/transition';\nimport { copy } from '../common/common';\nimport { TransitionService } from '../transition/transitionService';\n\n/**\n * A [[TransitionHookFn]] which updates global UI-Router state\n *\n * Registered using `transitionService.onBefore({}, updateGlobalState);`\n *\n * Before a [[Transition]] starts, updates the global value of \"the current transition\" ([[Globals.transition]]).\n * After a successful [[Transition]], updates the global values of \"the current state\"\n * ([[Globals.current]] and [[Globals.$current]]) and \"the current param values\" ([[Globals.params]]).\n *\n * See also the deprecated properties:\n * [[StateService.transition]], [[StateService.current]], [[StateService.params]]\n */\nconst updateGlobalState = (trans: Transition) => {\n let globals = trans.router.globals;\n\n const transitionSuccessful = () => {\n globals.successfulTransitions.enqueue(trans);\n globals.$current = trans.$to();\n globals.current = globals.$current.self;\n\n copy(trans.params(), globals.params);\n };\n\n const clearCurrentTransition = () => {\n // Do not clear globals.transition if a different transition has started in the meantime\n if (globals.transition === trans) globals.transition = null;\n };\n\n trans.onSuccess({}, transitionSuccessful, { priority: 10000 });\n trans.promise.then(clearCurrentTransition, clearCurrentTransition);\n};\n\nexport const registerUpdateGlobalState = (transitionService: TransitionService) =>\n transitionService.onCreate({}, updateGlobalState);\n","/** @module hooks */ /** */\nimport {UrlRouter} from \"../url/urlRouter\";\nimport {StateService} from \"../state/stateService\";\nimport {Transition} from \"../transition/transition\";\nimport {TransitionHookFn} from \"../transition/interface\";\nimport {TransitionService} from \"../transition/transitionService\";\n\n/** \n * A [[TransitionHookFn]] which updates the URL after a successful transition\n * \n * Registered using `transitionService.onSuccess({}, updateUrl);`\n */\nconst updateUrl: TransitionHookFn = (transition: Transition) => {\n let options = transition.options();\n let $state: StateService = transition.router.stateService;\n let $urlRouter: UrlRouter = transition.router.urlRouter;\n\n // Dont update the url in these situations:\n // The transition was triggered by a URL sync (options.source === 'url')\n // The user doesn't want the url to update (options.location === false)\n // The destination state, and all parents have no navigable url\n if (options.source !== 'url' && options.location && $state.$current.navigable) {\n var urlOptions = {replace: options.location === 'replace'};\n $urlRouter.push($state.$current.navigable.url, $state.params, urlOptions);\n }\n\n $urlRouter.update(true);\n};\n\nexport const registerUpdateUrl = (transitionService: TransitionService) =>\n transitionService.onSuccess({}, updateUrl, {priority: 9999});\n","/** @module hooks */ /** */\nimport {Transition} from \"../transition/transition\";\nimport {TransitionService} from \"../transition/transitionService\";\nimport {TransitionHookFn} from \"../transition/interface\";\nimport {StateDeclaration, LazyLoadResult} from \"../state/interface\";\nimport {services} from \"../common/coreservices\";\nimport { StateRule } from \"../url/interface\";\n\n/**\n * A [[TransitionHookFn]] that performs lazy loading\n *\n * When entering a state \"abc\" which has a `lazyLoad` function defined:\n * - Invoke the `lazyLoad` function (unless it is already in process)\n * - Flag the hook function as \"in process\"\n * - The function should return a promise (that resolves when lazy loading is complete)\n * - Wait for the promise to settle\n * - If the promise resolves to a [[LazyLoadResult]], then register those states\n * - Flag the hook function as \"not in process\"\n * - If the hook was successful\n * - Remove the `lazyLoad` function from the state declaration\n * - If all the hooks were successful\n * - Retry the transition (by returning a TargetState)\n *\n * ```\n * .state('abc', {\n * component: 'fooComponent',\n * lazyLoad: () => System.import('./fooComponent')\n * });\n * ```\n *\n * See [[StateDeclaration.lazyLoad]]\n */\nconst lazyLoadHook: TransitionHookFn = (transition: Transition) => {\n let router = transition.router;\n\n function retryTransition() {\n if (transition.originalTransition().options().source !== 'url') {\n // The original transition was not triggered via url sync\n // The lazy state should be loaded now, so re-try the original transition\n let orig = transition.targetState();\n return router.stateService.target(orig.identifier(), orig.params(), orig.options());\n }\n\n // The original transition was triggered via url sync\n // Run the URL rules and find the best match\n let $url = router.urlService;\n let result = $url.match($url.parts());\n let rule = result && result.rule;\n\n // If the best match is a state, redirect the transition (instead\n // of calling sync() which supersedes the current transition)\n if (rule && rule.type === \"STATE\") {\n let state = (rule as StateRule).state;\n let params = result.match;\n return router.stateService.target(state, params, transition.options());\n }\n\n // No matching state found, so let .sync() choose the best non-state match/otherwise\n router.urlService.sync();\n }\n\n let promises = transition.entering()\n .filter(state => !!state.$$state().lazyLoad)\n .map(state => lazyLoadState(transition, state));\n\n return services.$q.all(promises).then(retryTransition);\n};\n\nexport const registerLazyLoadHook = (transitionService: TransitionService) =>\n transitionService.onBefore({ entering: (state) => !!state.lazyLoad }, lazyLoadHook);\n\n\n/**\n * Invokes a state's lazy load function\n *\n * @param transition a Transition context\n * @param state the state to lazy load\n * @returns A promise for the lazy load result\n */\nexport function lazyLoadState(transition: Transition, state: StateDeclaration): Promise {\n let lazyLoadFn = state.$$state().lazyLoad;\n\n // Store/get the lazy load promise on/from the hookfn so it doesn't get re-invoked\n let promise = lazyLoadFn['_promise'];\n if (!promise) {\n const success = (result) => {\n delete state.lazyLoad;\n delete state.$$state().lazyLoad;\n delete lazyLoadFn['_promise'];\n return result;\n };\n\n const error = (err) => {\n delete lazyLoadFn['_promise'];\n return services.$q.reject(err);\n };\n\n promise = lazyLoadFn['_promise'] =\n services.$q.when(lazyLoadFn(transition, state))\n .then(updateStateRegistry)\n .then(success, error);\n }\n\n /** Register any lazy loaded state definitions */\n function updateStateRegistry(result: LazyLoadResult) {\n if (result && Array.isArray(result.states)) {\n result.states.forEach(state => transition.router.stateRegistry.register(state));\n }\n return result;\n }\n\n return promise;\n}\n","/** @module transition */ /** */\nimport { TransitionHookPhase, PathType } from \"./interface\";\nimport { GetErrorHandler, GetResultHandler, TransitionHook } from \"./transitionHook\";\n/**\n * This class defines a type of hook, such as `onBefore` or `onEnter`.\n * Plugins can define custom hook types, such as sticky states does for `onInactive`.\n *\n * @interalapi\n */\nexport class TransitionEventType {\n\n constructor(public name: string,\n public hookPhase: TransitionHookPhase,\n public hookOrder: number,\n public criteriaMatchPath: PathType,\n public reverseSort: boolean = false,\n public getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,\n public getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,\n public synchronous: boolean = false,\n ) { }\n}\n","/** @module hooks */ /** */\n\nimport { trace } from '../common/trace';\nimport { Rejection } from '../transition/rejectFactory';\nimport { TransitionService } from '../transition/transitionService';\nimport { Transition } from '../transition/transition';\n\n/**\n * A [[TransitionHookFn]] that skips a transition if it should be ignored\n *\n * This hook is invoked at the end of the onBefore phase.\n *\n * If the transition should be ignored (because no parameter or states changed)\n * then the transition is ignored and not processed.\n */\nfunction ignoredHook(trans: Transition) {\n const ignoredReason = trans._ignoredReason();\n if (!ignoredReason) return;\n\n trace.traceTransitionIgnored(trans);\n\n const pending = trans.router.globals.transition;\n\n // The user clicked a link going back to the *current state* ('A')\n // However, there is also a pending transition in flight (to 'B')\n // Abort the transition to 'B' because the user now wants to be back at 'A'.\n if (ignoredReason === 'SameAsCurrent' && pending) {\n pending.abort();\n }\n\n return Rejection.ignored().toPromise();\n}\n\nexport const registerIgnoredTransitionHook = (transitionService: TransitionService) =>\n transitionService.onBefore({}, ignoredHook, { priority: -9999 });\n","/** @module hooks */ /** */\n\nimport { TransitionService } from '../transition/transitionService';\nimport { Transition } from '../transition/transition';\n\n/**\n * A [[TransitionHookFn]] that rejects the Transition if it is invalid\n *\n * This hook is invoked at the end of the onBefore phase.\n * If the transition is invalid (for example, param values do not validate)\n * then the transition is rejected.\n */\nfunction invalidTransitionHook(trans: Transition) {\n if (!trans.valid()) {\n throw new Error(trans.error());\n }\n}\n\nexport const registerInvalidTransitionHook = (transitionService: TransitionService) =>\n transitionService.onBefore({}, invalidTransitionHook, { priority: -10000 });\n","/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport {\n IHookRegistry, TransitionOptions, TransitionHookScope, TransitionHookPhase, TransitionCreateHookFn, HookMatchCriteria,\n HookRegOptions, PathTypes, PathType, RegisteredHooks, TransitionHookFn, TransitionStateHookFn\n} from \"./interface\";\nimport { Transition } from \"./transition\";\nimport { makeEvent, RegisteredHook } from \"./hookRegistry\";\nimport { TargetState } from \"../state/targetState\";\nimport { PathNode } from \"../path/pathNode\";\nimport { ViewService } from \"../view/view\";\nimport { UIRouter } from \"../router\";\nimport { registerAddCoreResolvables } from \"../hooks/coreResolvables\";\nimport { registerRedirectToHook } from \"../hooks/redirectTo\";\nimport { registerOnExitHook, registerOnRetainHook, registerOnEnterHook } from \"../hooks/onEnterExitRetain\";\nimport { registerEagerResolvePath, registerLazyResolveState } from \"../hooks/resolve\";\nimport { registerLoadEnteringViews, registerActivateViews } from \"../hooks/views\";\nimport { registerUpdateGlobalState } from \"../hooks/updateGlobals\";\nimport { registerUpdateUrl } from \"../hooks/url\";\nimport { registerLazyLoadHook } from \"../hooks/lazyLoad\";\nimport { TransitionEventType } from \"./transitionEventType\";\nimport { TransitionHook, GetResultHandler, GetErrorHandler } from \"./transitionHook\";\nimport { isDefined } from \"../common/predicates\";\nimport { removeFrom, values, createProxyFunctions } from \"../common/common\";\nimport { Disposable } from \"../interface\"; // has or is using\nimport { val } from \"../common/hof\";\nimport { registerIgnoredTransitionHook } from '../hooks/ignoredTransition';\nimport { registerInvalidTransitionHook } from '../hooks/invalidTransition';\n\n/**\n * The default [[Transition]] options.\n *\n * Include this object when applying custom defaults:\n * let reloadOpts = { reload: true, notify: true }\n * let options = defaults(theirOpts, customDefaults, defaultOptions);\n */\nexport let defaultTransOpts: TransitionOptions = {\n location : true,\n relative : null,\n inherit : false,\n notify : true,\n reload : false,\n custom : {},\n current : () => null,\n source : \"unknown\"\n};\n\n\n/**\n * Plugin API for Transition Service\n * @internalapi\n */\nexport interface TransitionServicePluginAPI {\n /**\n * Adds a Path to be used as a criterion against a TreeChanges path\n *\n * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.\n * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`\n * Each state in the exiting path is checked against the criteria and returned as part of the match.\n *\n * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.\n * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`\n * Only the tail of the `to` path is checked against the criteria and returned as part of the match.\n */\n _definePathType(name: string, hookScope: TransitionHookScope);\n\n /**\n * Gets a Path definition used as a criterion against a TreeChanges path\n */\n _getPathTypes(): PathTypes;\n\n /**\n * Defines a transition hook type and returns a transition hook registration\n * function (which can then be used to register hooks of this type).\n */\n _defineEvent(name: string,\n hookPhase: TransitionHookPhase,\n hookOrder: number,\n criteriaMatchPath: PathType,\n reverseSort?: boolean,\n getResultHandler?: GetResultHandler,\n getErrorHandler?: GetErrorHandler,\n rejectIfSuperseded?: boolean);\n\n /**\n * Returns the known event types, such as `onBefore`\n * If a phase argument is provided, returns only events for the given phase.\n */\n _getEvents(phase?: TransitionHookPhase): TransitionEventType[];\n\n /** Returns the hooks registered for the given hook name */\n getHooks(hookName: string): RegisteredHook[];\n}\n\n/**\n * This class provides services related to Transitions.\n *\n * - Most importantly, it allows global Transition Hooks to be registered.\n * - It allows the default transition error handler to be set.\n * - It also has a factory function for creating new [[Transition]] objects, (used internally by the [[StateService]]).\n *\n * At bootstrap, [[UIRouter]] creates a single instance (singleton) of this class.\n */\nexport class TransitionService implements IHookRegistry, Disposable {\n /** @hidden */\n _transitionCount = 0;\n\n /**\n * Registers a [[TransitionHookFn]], called *while a transition is being constructed*.\n *\n * Registers a transition lifecycle hook, which is invoked during transition construction.\n *\n * This low level hook should only be used by plugins.\n * This can be a useful time for plugins to add resolves or mutate the transition as needed.\n * The Sticky States plugin uses this hook to modify the treechanges.\n *\n * ### Lifecycle\n *\n * `onCreate` hooks are invoked *while a transition is being constructed*.\n *\n * ### Return value\n *\n * The hook's return value is ignored\n *\n * @internalapi\n * @param criteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be invoked.\n * @param options the registration options\n * @returns a function which deregisters the hook.\n */\n onCreate(criteria: HookMatchCriteria, callback: TransitionCreateHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return }\n\n /** @hidden */\n public $view: ViewService;\n\n /** @hidden The transition hook types, such as `onEnter`, `onStart`, etc */\n private _eventTypes: TransitionEventType[] = [];\n /** @hidden The registered transition hooks */\n _registeredHooks = { } as RegisteredHooks;\n /** @hidden The paths on a criteria object */\n private _criteriaPaths = { } as PathTypes;\n /** @hidden */\n private _router: UIRouter;\n\n /** @internalapi */\n _pluginapi: TransitionServicePluginAPI;\n\n /**\n * This object has hook de-registration functions for the built-in hooks.\n * This can be used by third parties libraries that wish to customize the behaviors\n *\n * @hidden\n */\n _deregisterHookFns: {\n addCoreResolves: Function;\n ignored: Function;\n invalid: Function;\n redirectTo: Function;\n onExit: Function;\n onRetain: Function;\n onEnter: Function;\n eagerResolve: Function;\n lazyResolve: Function;\n loadViews: Function;\n activateViews: Function;\n updateGlobals: Function;\n updateUrl: Function;\n lazyLoad: Function;\n };\n\n /** @hidden */\n constructor(_router: UIRouter) {\n this._router = _router;\n this.$view = _router.viewService;\n this._deregisterHookFns = {};\n this._pluginapi = createProxyFunctions(val(this), {}, val(this), [\n '_definePathType',\n '_defineEvent',\n '_getPathTypes',\n '_getEvents',\n 'getHooks',\n ]);\n\n this._defineCorePaths();\n this._defineCoreEvents();\n this._registerCoreTransitionHooks();\n }\n\n /**\n * dispose\n * @internalapi\n */\n dispose(router: UIRouter) {\n values(this._registeredHooks).forEach((hooksArray: RegisteredHook[]) => hooksArray.forEach(hook => {\n hook._deregistered = true;\n removeFrom(hooksArray, hook);\n }));\n }\n\n /**\n * Creates a new [[Transition]] object\n *\n * This is a factory function for creating new Transition objects.\n * It is used internally by the [[StateService]] and should generally not be called by application code.\n *\n * @param fromPath the path to the current state (the from state)\n * @param targetState the target state (destination)\n * @returns a Transition\n */\n create(fromPath: PathNode[], targetState: TargetState): Transition {\n return new Transition(fromPath, targetState, this._router);\n }\n\n /** @hidden */\n private _defineCoreEvents() {\n const Phase = TransitionHookPhase;\n const TH = TransitionHook;\n const paths = this._criteriaPaths;\n const NORMAL_SORT = false, REVERSE_SORT = true;\n const ASYNCHRONOUS = false, SYNCHRONOUS = true;\n\n this._defineEvent(\"onCreate\", Phase.CREATE, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.THROW_ERROR, SYNCHRONOUS);\n\n this._defineEvent(\"onBefore\", Phase.BEFORE, 0, paths.to);\n\n this._defineEvent(\"onStart\", Phase.RUN, 0, paths.to);\n this._defineEvent(\"onExit\", Phase.RUN, 100, paths.exiting, REVERSE_SORT);\n this._defineEvent(\"onRetain\", Phase.RUN, 200, paths.retained);\n this._defineEvent(\"onEnter\", Phase.RUN, 300, paths.entering);\n this._defineEvent(\"onFinish\", Phase.RUN, 400, paths.to);\n\n this._defineEvent(\"onSuccess\", Phase.SUCCESS, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS);\n this._defineEvent(\"onError\", Phase.ERROR, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS);\n }\n\n /** @hidden */\n private _defineCorePaths() {\n const { STATE, TRANSITION } = TransitionHookScope;\n\n this._definePathType(\"to\", TRANSITION);\n this._definePathType(\"from\", TRANSITION);\n this._definePathType(\"exiting\", STATE);\n this._definePathType(\"retained\", STATE);\n this._definePathType(\"entering\", STATE);\n }\n\n /** @hidden */\n _defineEvent(name: string,\n hookPhase: TransitionHookPhase,\n hookOrder: number,\n criteriaMatchPath: PathType,\n reverseSort: boolean = false,\n getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,\n getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,\n synchronous: boolean = false)\n {\n let eventType = new TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous);\n\n this._eventTypes.push(eventType);\n makeEvent(this, this, eventType);\n };\n\n /** @hidden */\n private _getEvents(phase?: TransitionHookPhase): TransitionEventType[] {\n let transitionHookTypes = isDefined(phase) ?\n this._eventTypes.filter(type => type.hookPhase === phase) :\n this._eventTypes.slice();\n\n return transitionHookTypes.sort((l, r) => {\n let cmpByPhase = l.hookPhase - r.hookPhase;\n return cmpByPhase === 0 ? l.hookOrder - r.hookOrder : cmpByPhase;\n })\n }\n\n /**\n * Adds a Path to be used as a criterion against a TreeChanges path\n *\n * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.\n * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`\n * Each state in the exiting path is checked against the criteria and returned as part of the match.\n *\n * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.\n * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`\n * Only the tail of the `to` path is checked against the criteria and returned as part of the match.\n *\n * @hidden\n */\n private _definePathType(name: string, hookScope: TransitionHookScope) {\n this._criteriaPaths[name] = { name, scope: hookScope };\n }\n\n /** * @hidden */\n private _getPathTypes(): PathTypes {\n return this._criteriaPaths;\n }\n\n /** @hidden */\n public getHooks(hookName: string): RegisteredHook[] {\n return this._registeredHooks[hookName];\n }\n\n /** @hidden */\n private _registerCoreTransitionHooks() {\n let fns = this._deregisterHookFns;\n\n fns.addCoreResolves = registerAddCoreResolvables(this);\n fns.ignored = registerIgnoredTransitionHook(this);\n fns.invalid = registerInvalidTransitionHook(this);\n\n // Wire up redirectTo hook\n fns.redirectTo = registerRedirectToHook(this);\n \n // Wire up onExit/Retain/Enter state hooks\n fns.onExit = registerOnExitHook(this);\n fns.onRetain = registerOnRetainHook(this);\n fns.onEnter = registerOnEnterHook(this);\n\n // Wire up Resolve hooks\n fns.eagerResolve = registerEagerResolvePath(this);\n fns.lazyResolve = registerLazyResolveState(this);\n \n // Wire up the View management hooks\n fns.loadViews = registerLoadEnteringViews(this);\n fns.activateViews = registerActivateViews(this);\n\n // Updates global state after a transition\n fns.updateGlobals = registerUpdateGlobalState(this);\n\n // After globals.current is updated at priority: 10000\n fns.updateUrl = registerUpdateUrl(this);\n\n // Lazy load state trees\n fns.lazyLoad = registerLazyLoadHook(this);\n }\n}\n","/**\n * @coreapi\n * @module state\n */\n/** */\nimport { createProxyFunctions, defaults, extend, inArray, noop, removeFrom, silenceUncaughtInPromise, silentRejection } from '../common/common';\nimport { isDefined, isObject, isString } from '../common/predicates';\nimport { Queue } from '../common/queue';\nimport { services } from '../common/coreservices';\n\nimport { PathUtils } from '../path/pathFactory';\nimport { PathNode } from '../path/pathNode';\n\nimport { HookResult, TransitionOptions } from '../transition/interface';\nimport { defaultTransOpts } from '../transition/transitionService';\nimport { Rejection, RejectType } from '../transition/rejectFactory';\nimport { Transition } from '../transition/transition';\n\nimport { HrefOptions, LazyLoadResult, StateDeclaration, StateOrName, TransitionPromise } from './interface';\nimport { StateObject } from './stateObject';\nimport { TargetState } from './targetState';\n\nimport { ParamsOrArray, RawParams } from '../params/interface';\nimport { Param } from '../params/param';\nimport { Glob } from '../common/glob';\nimport { UIRouter } from '../router';\nimport { UIInjector } from '../interface';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { lazyLoadState } from '../hooks/lazyLoad';\nimport { not, val } from '../common/hof';\nimport { StateParams } from '../params/stateParams';\n\nexport type OnInvalidCallback =\n (toState?: TargetState, fromState?: TargetState, injector?: UIInjector) => HookResult;\n\n/**\n * Provides state related service functions\n *\n * This class provides services related to ui-router states.\n * An instance of this class is located on the global [[UIRouter]] object.\n */\nexport class StateService {\n /** @internalapi */\n invalidCallbacks: OnInvalidCallback[] = [];\n\n /**\n * The [[Transition]] currently in progress (or null)\n *\n * This is a passthrough through to [[UIRouterGlobals.transition]]\n */\n get transition() { return this.router.globals.transition; }\n /**\n * The latest successful state parameters\n *\n * This is a passthrough through to [[UIRouterGlobals.params]]\n */\n get params(): StateParams { return this.router.globals.params; }\n /**\n * The current [[StateDeclaration]]\n *\n * This is a passthrough through to [[UIRouterGlobals.current]]\n */\n get current() { return this.router.globals.current; }\n /**\n * The current [[StateObject]]\n *\n * This is a passthrough through to [[UIRouterGlobals.$current]]\n */\n get $current() { return this.router.globals.$current; }\n\n /** @internalapi */\n constructor(private router: UIRouter) {\n let getters = ['current', '$current', 'params', 'transition'];\n let boundFns = Object.keys(StateService.prototype).filter(not(inArray(getters)));\n createProxyFunctions(val(StateService.prototype), this, val(this), boundFns);\n }\n\n /** @internalapi */\n dispose() {\n this.defaultErrorHandler(noop);\n this.invalidCallbacks = [];\n }\n\n /**\n * Handler for when [[transitionTo]] is called with an invalid state.\n *\n * Invokes the [[onInvalid]] callbacks, in natural order.\n * Each callback's return value is checked in sequence until one of them returns an instance of TargetState.\n * The results of the callbacks are wrapped in $q.when(), so the callbacks may return promises.\n *\n * If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned.\n *\n * @internalapi\n */\n private _handleInvalidTargetState(fromPath: PathNode[], toState: TargetState) {\n let fromState = PathUtils.makeTargetState(fromPath);\n let globals = this.router.globals;\n const latestThing = () => globals.transitionHistory.peekTail();\n let latest = latestThing();\n let callbackQueue = new Queue(this.invalidCallbacks.slice());\n let injector = new ResolveContext(fromPath).injector();\n\n const checkForRedirect = (result: HookResult) => {\n if (!(result instanceof TargetState)) {\n return;\n }\n\n let target = result;\n // Recreate the TargetState, in case the state is now defined.\n target = this.target(target.identifier(), target.params(), target.options());\n\n if (!target.valid()) {\n return Rejection.invalid(target.error()).toPromise();\n }\n\n if (latestThing() !== latest) {\n return Rejection.superseded().toPromise();\n }\n\n return this.transitionTo(target.identifier(), target.params(), target.options());\n };\n\n function invokeNextCallback() {\n let nextCallback = callbackQueue.dequeue();\n if (nextCallback === undefined) return Rejection.invalid(toState.error()).toPromise();\n\n let callbackResult = services.$q.when(nextCallback(toState, fromState, injector));\n return callbackResult.then(checkForRedirect).then(result => result || invokeNextCallback());\n }\n\n return invokeNextCallback();\n }\n\n /**\n * Registers an Invalid State handler\n *\n * Registers a [[OnInvalidCallback]] function to be invoked when [[StateService.transitionTo]]\n * has been called with an invalid state reference parameter\n *\n * Example:\n * ```js\n * stateService.onInvalid(function(to, from, injector) {\n * if (to.name() === 'foo') {\n * let lazyLoader = injector.get('LazyLoadService');\n * return lazyLoader.load('foo')\n * .then(() => stateService.target('foo'));\n * }\n * });\n * ```\n *\n * @param {function} callback invoked when the toState is invalid\n * This function receives the (invalid) toState, the fromState, and an injector.\n * The function may optionally return a [[TargetState]] or a Promise for a TargetState.\n * If one is returned, it is treated as a redirect.\n *\n * @returns a function which deregisters the callback\n */\n onInvalid(callback: OnInvalidCallback): Function {\n this.invalidCallbacks.push(callback);\n return function deregisterListener() {\n removeFrom(this.invalidCallbacks)(callback);\n }.bind(this);\n }\n\n\n /**\n * Reloads the current state\n *\n * A method that force reloads the current state, or a partial state hierarchy.\n * All resolves are re-resolved, and components reinstantiated.\n *\n * #### Example:\n * ```js\n * let app angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.reload = function(){\n * $state.reload();\n * }\n * });\n * ```\n *\n * Note: `reload()` is just an alias for:\n *\n * ```js\n * $state.transitionTo($state.current, $state.params, {\n * reload: true, inherit: false\n * });\n * ```\n *\n * @param reloadState A state name or a state object.\n * If present, this state and all its children will be reloaded, but ancestors will not reload.\n *\n * #### Example:\n * ```js\n * //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item'\n * //and current state is 'contacts.detail.item'\n * let app angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.reload = function(){\n * //will reload 'contact.detail' and nested 'contact.detail.item' states\n * $state.reload('contact.detail');\n * }\n * });\n * ```\n *\n * @returns A promise representing the state of the new transition. See [[StateService.go]]\n */\n reload(reloadState?: StateOrName): Promise {\n return this.transitionTo(this.current, this.params, {\n reload: isDefined(reloadState) ? reloadState : true,\n inherit: false,\n notify: false,\n });\n };\n\n /**\n * Transition to a different state and/or parameters\n *\n * Convenience method for transitioning to a new state.\n *\n * `$state.go` calls `$state.transitionTo` internally but automatically sets options to\n * `{ location: true, inherit: true, relative: router.globals.$current, notify: true }`.\n * This allows you to use either an absolute or relative `to` argument (because of `relative: router.globals.$current`).\n * It also allows you to specify * only the parameters you'd like to update, while letting unspecified parameters\n * inherit from the current parameter values (because of `inherit: true`).\n *\n * #### Example:\n * ```js\n * let app = angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.changeState = function () {\n * $state.go('contact.detail');\n * };\n * });\n * ```\n *\n * @param to Absolute state name, state object, or relative state path (relative to current state).\n *\n * Some examples:\n *\n * - `$state.go('contact.detail')` - will go to the `contact.detail` state\n * - `$state.go('^')` - will go to the parent state\n * - `$state.go('^.sibling')` - if current state is `home.child`, will go to the `home.sibling` state\n * - `$state.go('.child.grandchild')` - if current state is home, will go to the `home.child.grandchild` state\n *\n * @param params A map of the parameters that will be sent to the state, will populate $stateParams.\n *\n * Any parameters that are not specified will be inherited from current parameter values (because of `inherit: true`).\n * This allows, for example, going to a sibling state that shares parameters defined by a parent state.\n *\n * @param options Transition options\n *\n * @returns {promise} A promise representing the state of the new transition.\n */\n go(to: StateOrName, params?: RawParams, options?: TransitionOptions): TransitionPromise {\n let defautGoOpts = { relative: this.$current, inherit: true };\n let transOpts = defaults(options, defautGoOpts, defaultTransOpts);\n return this.transitionTo(to, params, transOpts);\n };\n\n /**\n * Creates a [[TargetState]]\n *\n * This is a factory method for creating a TargetState\n *\n * This may be returned from a Transition Hook to redirect a transition, for example.\n */\n target(identifier: StateOrName, params?: ParamsOrArray, options: TransitionOptions = {}): TargetState {\n // If we're reloading, find the state object to reload from\n if (isObject(options.reload) && !(options.reload).name)\n throw new Error('Invalid reload state object');\n let reg = this.router.stateRegistry;\n options.reloadState = options.reload === true ? reg.root() : reg.matcher.find( options.reload, options.relative);\n\n if (options.reload && !options.reloadState)\n throw new Error(`No such reload state '${(isString(options.reload) ? options.reload : (options.reload).name)}'`);\n\n let stateDefinition = reg.matcher.find(identifier, options.relative);\n return new TargetState(identifier, stateDefinition, params, options);\n };\n\n private getCurrentPath(): PathNode[] {\n let globals = this.router.globals;\n let latestSuccess: Transition = globals.successfulTransitions.peekTail();\n const rootPath = () => [ new PathNode(this.router.stateRegistry.root()) ];\n return latestSuccess ? latestSuccess.treeChanges().to : rootPath();\n }\n\n /**\n * Low-level method for transitioning to a new state.\n *\n * The [[go]] method (which uses `transitionTo` internally) is recommended in most situations.\n *\n * #### Example:\n * ```js\n * let app = angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.changeState = function () {\n * $state.transitionTo('contact.detail');\n * };\n * });\n * ```\n *\n * @param to State name or state object.\n * @param toParams A map of the parameters that will be sent to the state,\n * will populate $stateParams.\n * @param options Transition options\n *\n * @returns A promise representing the state of the new transition. See [[go]]\n */\n transitionTo(to: StateOrName, toParams: RawParams = {}, options: TransitionOptions = {}): TransitionPromise {\n let router = this.router;\n let globals = router.globals;\n options = defaults(options, defaultTransOpts);\n const getCurrent = () =>\n globals.transition;\n options = extend(options, { current: getCurrent });\n\n let ref: TargetState = this.target(to, toParams, options);\n let currentPath = this.getCurrentPath();\n\n if (!ref.exists())\n return this._handleInvalidTargetState(currentPath, ref);\n\n if (!ref.valid())\n return silentRejection(ref.error());\n\n /**\n * Special handling for Ignored, Aborted, and Redirected transitions\n *\n * The semantics for the transition.run() promise and the StateService.transitionTo()\n * promise differ. For instance, the run() promise may be rejected because it was\n * IGNORED, but the transitionTo() promise is resolved because from the user perspective\n * no error occurred. Likewise, the transition.run() promise may be rejected because of\n * a Redirect, but the transitionTo() promise is chained to the new Transition's promise.\n */\n const rejectedTransitionHandler = (transition: Transition) => (error: any): Promise => {\n if (error instanceof Rejection) {\n const isLatest = router.globals.lastStartedTransitionId === transition.$id;\n\n if (error.type === RejectType.IGNORED) {\n isLatest && router.urlRouter.update();\n // Consider ignored `Transition.run()` as a successful `transitionTo`\n return services.$q.when(globals.current);\n }\n\n const detail: any = error.detail;\n if (error.type === RejectType.SUPERSEDED && error.redirected && detail instanceof TargetState) {\n // If `Transition.run()` was redirected, allow the `transitionTo()` promise to resolve successfully\n // by returning the promise for the new (redirect) `Transition.run()`.\n let redirect: Transition = transition.redirect(detail);\n return redirect.run().catch(rejectedTransitionHandler(redirect));\n }\n\n if (error.type === RejectType.ABORTED) {\n isLatest && router.urlRouter.update();\n return services.$q.reject(error);\n }\n }\n\n let errorHandler = this.defaultErrorHandler();\n errorHandler(error);\n\n return services.$q.reject(error);\n };\n\n let transition = this.router.transitionService.create(currentPath, ref);\n let transitionToPromise = transition.run().catch(rejectedTransitionHandler(transition));\n silenceUncaughtInPromise(transitionToPromise); // issue #2676\n\n // Return a promise for the transition, which also has the transition object on it.\n return extend(transitionToPromise, { transition });\n };\n\n /**\n * Checks if the current state *is* the provided state\n *\n * Similar to [[includes]] but only checks for the full state name.\n * If params is supplied then it will be tested for strict equality against the current\n * active params object, so all params must match with none missing and no extras.\n *\n * #### Example:\n * ```js\n * $state.$current.name = 'contacts.details.item';\n *\n * // absolute name\n * $state.is('contact.details.item'); // returns true\n * $state.is(contactDetailItemStateObject); // returns true\n * ```\n *\n * // relative name (. and ^), typically from a template\n * // E.g. from the 'contacts.details' template\n * ```html\n *
Item
\n * ```\n *\n * @param stateOrName The state name (absolute or relative) or state object you'd like to check.\n * @param params A param object, e.g. `{sectionId: section.id}`, that you'd like\n * to test against the current active state.\n * @param options An options object. The options are:\n * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will\n * test relative to `options.relative` state (or name).\n *\n * @returns Returns true if it is the state.\n */\n is(stateOrName: StateOrName, params?: RawParams, options?: { relative?: StateOrName }): boolean {\n options = defaults(options, { relative: this.$current });\n let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);\n if (!isDefined(state)) return undefined;\n if (this.$current !== state) return false;\n if (!params) return true;\n\n let schema: Param[] = state.parameters({ inherit: true, matchingKeys: params });\n return Param.equals(schema, Param.values(schema, params), this.params);\n };\n\n /**\n * Checks if the current state *includes* the provided state\n *\n * A method to determine if the current active state is equal to or is the child of the\n * state stateName. If any params are passed then they will be tested for a match as well.\n * Not all the parameters need to be passed, just the ones you'd like to test for equality.\n *\n * #### Example when `$state.$current.name === 'contacts.details.item'`\n * ```js\n * // Using partial names\n * $state.includes(\"contacts\"); // returns true\n * $state.includes(\"contacts.details\"); // returns true\n * $state.includes(\"contacts.details.item\"); // returns true\n * $state.includes(\"contacts.list\"); // returns false\n * $state.includes(\"about\"); // returns false\n * ```\n *\n * #### Glob Examples when `* $state.$current.name === 'contacts.details.item.url'`:\n * ```js\n * $state.includes(\"*.details.*.*\"); // returns true\n * $state.includes(\"*.details.**\"); // returns true\n * $state.includes(\"**.item.**\"); // returns true\n * $state.includes(\"*.details.item.url\"); // returns true\n * $state.includes(\"*.details.*.url\"); // returns true\n * $state.includes(\"*.details.*\"); // returns false\n * $state.includes(\"item.**\"); // returns false\n * ```\n *\n * @param stateOrName A partial name, relative name, glob pattern,\n * or state object to be searched for within the current state name.\n * @param params A param object, e.g. `{sectionId: section.id}`,\n * that you'd like to test against the current active state.\n * @param options An options object. The options are:\n * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will\n * test relative to `options.relative` state (or name).\n *\n * @returns {boolean} Returns true if it does include the state\n */\n includes(stateOrName: StateOrName, params?: RawParams, options?: TransitionOptions): boolean {\n options = defaults(options, { relative: this.$current });\n let glob = isString(stateOrName) && Glob.fromString( stateOrName);\n\n if (glob) {\n if (!glob.matches(this.$current.name)) return false;\n stateOrName = this.$current.name;\n }\n let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative), include = this.$current.includes;\n\n if (!isDefined(state)) return undefined;\n if (!isDefined(include[state.name])) return false;\n if (!params) return true;\n\n let schema: Param[] = state.parameters({ inherit: true, matchingKeys: params });\n return Param.equals(schema, Param.values(schema, params), this.params);\n };\n\n\n /**\n * Generates a URL for a state and parameters\n *\n * Returns the url for the given state populated with the given params.\n *\n * #### Example:\n * ```js\n * expect($state.href(\"about.person\", { person: \"bob\" })).toEqual(\"/about/bob\");\n * ```\n *\n * @param stateOrName The state name or state object you'd like to generate a url from.\n * @param params An object of parameter values to fill the state's required parameters.\n * @param options Options object. The options are:\n *\n * @returns {string} compiled state url\n */\n href(stateOrName: StateOrName, params: RawParams, options?: HrefOptions): string {\n let defaultHrefOpts = {\n lossy: true,\n inherit: true,\n absolute: false,\n relative: this.$current,\n };\n options = defaults(options, defaultHrefOpts);\n params = params || {};\n\n let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);\n\n if (!isDefined(state)) return null;\n if (options.inherit) params = this.params.$inherit(params, this.$current, state);\n\n let nav = (state && options.lossy) ? state.navigable : state;\n\n if (!nav || nav.url === undefined || nav.url === null) {\n return null;\n }\n return this.router.urlRouter.href(nav.url, params, {\n absolute: options.absolute,\n });\n };\n\n /** @hidden */\n private _defaultErrorHandler: ((_error: any) => void) = function $defaultErrorHandler($error$) {\n if ($error$ instanceof Error && $error$.stack) {\n console.error($error$);\n console.error($error$.stack);\n } else if ($error$ instanceof Rejection) {\n console.error($error$.toString());\n if ($error$.detail && $error$.detail.stack)\n console.error($error$.detail.stack);\n } else {\n console.error($error$);\n }\n };\n\n /**\n * Sets or gets the default [[transitionTo]] error handler.\n *\n * The error handler is called when a [[Transition]] is rejected or when any error occurred during the Transition.\n * This includes errors caused by resolves and transition hooks.\n *\n * Note:\n * This handler does not receive certain Transition rejections.\n * Redirected and Ignored Transitions are not considered to be errors by [[StateService.transitionTo]].\n *\n * The built-in default error handler logs the error to the console.\n *\n * You can provide your own custom handler.\n *\n * #### Example:\n * ```js\n * stateService.defaultErrorHandler(function() {\n * // Do not log transitionTo errors\n * });\n * ```\n *\n * @param handler a global error handler function\n * @returns the current global error handler\n */\n defaultErrorHandler(handler?: (error: any) => void): (error: any) => void {\n return this._defaultErrorHandler = handler || this._defaultErrorHandler;\n }\n\n /**\n * Gets a registered [[StateDeclaration]] object\n *\n * Returns the state declaration object for any specific state, or for all registered states.\n *\n * @param stateOrName (absolute or relative) If provided, will only get the declaration object for the requested state.\n * If not provided, returns an array of ALL states.\n * @param base When `stateOrName` is a relative state reference (such as `.bar.baz`), the state will be retrieved relative to this state.\n *\n * @returns a [[StateDeclaration]] object (or array of all registered [[StateDeclaration]] objects.)\n */\n get(stateOrName: StateOrName, base: StateOrName): StateDeclaration;\n get(stateOrName: StateOrName): StateDeclaration;\n get(): StateDeclaration[];\n get(stateOrName?: StateOrName, base?: StateOrName): any {\n let reg = this.router.stateRegistry;\n if (arguments.length === 0) return reg.get();\n return reg.get(stateOrName, base || this.$current);\n }\n\n /**\n * Lazy loads a state\n *\n * Explicitly runs a state's [[StateDeclaration.lazyLoad]] function.\n *\n * @param stateOrName the state that should be lazy loaded\n * @param transition the optional Transition context to use (if the lazyLoad function requires an injector, etc)\n * Note: If no transition is provided, a noop transition is created using the from the current state to the current state.\n * This noop transition is not actually run.\n *\n * @returns a promise to lazy load\n */\n lazyLoad(stateOrName: StateOrName, transition?: Transition): Promise {\n let state: StateDeclaration = this.get(stateOrName);\n if (!state || !state.lazyLoad) throw new Error(\"Can not lazy load \" + stateOrName);\n\n let currentPath = this.getCurrentPath();\n let target = PathUtils.makeTargetState(currentPath);\n transition = transition || this.router.transitionService.create(currentPath, target);\n\n return lazyLoadState(transition, state);\n }\n}\n","/**\n * # Transition subsystem\n *\n * This module contains APIs related to a Transition.\n *\n * See:\n * - [[TransitionService]]\n * - [[Transition]]\n * - [[HookFn]], [[TransitionHookFn]], [[TransitionStateHookFn]], [[HookMatchCriteria]], [[HookResult]]\n *\n * @coreapi\n * @preferred\n * @module transition\n */ /** for typedoc */\nexport * from \"./interface\";\nexport * from \"./hookBuilder\";\nexport * from \"./hookRegistry\";\nexport * from \"./rejectFactory\";\nexport * from \"./transition\";\nexport * from \"./transitionHook\";\nexport * from \"./transitionEventType\";\nexport * from \"./transitionService\";\n\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { isArray, isObject, $QLike } from \"../common/index\";\n\n/**\n * An angular1-like promise api\n *\n * This object implements four methods similar to the\n * [angular 1 promise api](https://docs.angularjs.org/api/ng/service/$q)\n *\n * UI-Router evolved from an angular 1 library to a framework agnostic library.\n * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.\n *\n * This API provides native ES6 promise support wrapped as a $q-like API.\n * Internally, UI-Router uses this $q object to perform promise operations.\n * The `angular-ui-router` (ui-router for angular 1) uses the $q API provided by angular.\n *\n * $q-like promise api\n */\nexport const $q = {\n /** Normalizes a value as a promise */\n when: (val) => new Promise((resolve, reject) => resolve(val)),\n\n /** Normalizes a value as a promise rejection */\n reject: (val) => new Promise((resolve, reject) => { reject(val); }),\n\n /** @returns a deferred object, which has `resolve` and `reject` functions */\n defer: () => {\n let deferred: any = {};\n deferred.promise = new Promise((resolve, reject) => {\n deferred.resolve = resolve;\n deferred.reject = reject;\n });\n return deferred;\n },\n\n /** Like Promise.all(), but also supports object key/promise notation like $q */\n all: (promises: { [key: string]: Promise } | Promise[]) => {\n if (isArray(promises)) {\n return Promise.all(promises);\n }\n\n if (isObject(promises)) {\n // Convert promises map to promises array.\n // When each promise resolves, map it to a tuple { key: key, val: val }\n let chain = Object.keys(promises)\n .map(key => promises[key].then(val => ({key, val})));\n\n // Then wait for all promises to resolve, and convert them back to an object\n return $q.all(chain).then(values =>\n values.reduce((acc, tuple) => { acc[tuple.key] = tuple.val; return acc; }, {}));\n }\n }\n} as $QLike;","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport {\n extend, assertPredicate, isFunction, isArray, isInjectable, $InjectorLike, IInjectable\n} from \"../common/index\";\n\n// globally available injectables\nlet globals = {};\nlet STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg;\nlet ARGUMENT_NAMES = /([^\\s,]+)/g;\n\n/**\n * A basic angular1-like injector api\n *\n * This object implements four methods similar to the\n * [angular 1 dependency injector](https://docs.angularjs.org/api/auto/service/$injector)\n *\n * UI-Router evolved from an angular 1 library to a framework agnostic library.\n * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.\n *\n * This object provides a naive implementation of a globally scoped dependency injection system.\n * It supports the following DI approaches:\n *\n * ### Function parameter names\n *\n * A function's `.toString()` is called, and the parameter names are parsed.\n * This only works when the parameter names aren't \"mangled\" by a minifier such as UglifyJS.\n *\n * ```js\n * function injectedFunction(FooService, BarService) {\n * // FooService and BarService are injected\n * }\n * ```\n *\n * ### Function annotation\n *\n * A function may be annotated with an array of dependency names as the `$inject` property.\n *\n * ```js\n * injectedFunction.$inject = [ 'FooService', 'BarService' ];\n * function injectedFunction(fs, bs) {\n * // FooService and BarService are injected as fs and bs parameters\n * }\n * ```\n *\n * ### Array notation\n *\n * An array provides the names of the dependencies to inject (as strings).\n * The function is the last element of the array.\n *\n * ```js\n * [ 'FooService', 'BarService', function (fs, bs) {\n * // FooService and BarService are injected as fs and bs parameters\n * }]\n * ```\n *\n * @type {$InjectorLike}\n */\nexport const $injector = {\n /** Gets an object from DI based on a string token */\n get: name => globals[name],\n\n /** Returns true if an object named `name` exists in global DI */\n has: (name) => $injector.get(name) != null,\n\n /**\n * Injects a function\n *\n * @param fn the function to inject\n * @param context the function's `this` binding\n * @param locals An object with additional DI tokens and values, such as `{ someToken: { foo: 1 } }`\n */\n invoke: (fn: IInjectable, context?, locals?) => {\n let all = extend({}, globals, locals || {});\n let params = $injector.annotate(fn);\n let ensureExist = assertPredicate((key: string) => all.hasOwnProperty(key), key => `DI can't find injectable: '${key}'`);\n let args = params.filter(ensureExist).map(x => all[x]);\n if (isFunction(fn)) return fn.apply(context, args);\n else return (fn as any[]).slice(-1)[0].apply(context, args);\n },\n\n /**\n * Returns a function's dependencies\n *\n * Analyzes a function (or array) and returns an array of DI tokens that the function requires.\n * @return an array of `string`s\n */\n annotate: (fn: IInjectable): any[] => {\n if (!isInjectable(fn)) throw new Error(`Not an injectable function: ${fn}`);\n if (fn && (fn as any).$inject) return (fn as any).$inject;\n if (isArray(fn)) return fn.slice(0, -1);\n let fnStr = fn.toString().replace(STRIP_COMMENTS, '');\n let result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES);\n return result || [];\n }\n} as $InjectorLike;","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { isArray } from \"../common/index\";\nimport { LocationServices, LocationConfig } from \"../common/coreservices\";\nimport { UIRouter } from \"../router\";\nimport { identity, unnestR, removeFrom, deregAll, extend } from \"../common/common\";\nimport { LocationLike, HistoryLike } from \"./interface\";\nimport { isDefined } from \"../common/predicates\";\nimport { Disposable } from \"../interface\";\n\nconst beforeAfterSubstr = (char: string) => (str: string): string[] => {\n if (!str) return [\"\", \"\"];\n let idx = str.indexOf(char);\n if (idx === -1) return [str, \"\"];\n return [str.substr(0, idx), str.substr(idx + 1)];\n};\n\nexport const splitHash = beforeAfterSubstr(\"#\");\nexport const splitQuery = beforeAfterSubstr(\"?\");\nexport const splitEqual = beforeAfterSubstr(\"=\");\nexport const trimHashVal = (str) => str ? str.replace(/^#/, \"\") : \"\";\n\nexport const keyValsToObjectR = (accum, [key, val]) => {\n if (!accum.hasOwnProperty(key)) {\n accum[key] = val;\n } else if (isArray(accum[key])) {\n accum[key].push(val);\n } else {\n accum[key] = [accum[key], val]\n }\n return accum;\n};\n\nexport const getParams = (queryString: string): any =>\n queryString.split(\"&\").filter(identity).map(splitEqual).reduce(keyValsToObjectR, {});\n\nexport function parseUrl(url: string) {\n const orEmptyString = x => x || \"\";\n let [beforehash, hash] = splitHash(url).map(orEmptyString);\n let [path, search] = splitQuery(beforehash).map(orEmptyString);\n\n return { path, search, hash, url };\n}\n\nexport const buildUrl = (loc: LocationServices) => {\n let path = loc.path();\n let searchObject = loc.search();\n let hash = loc.hash();\n\n let search = Object.keys(searchObject).map(key => {\n let param = searchObject[key];\n let vals = isArray(param) ? param : [param];\n return vals.map(val => key + \"=\" + val);\n }).reduce(unnestR, []).join(\"&\");\n\n return path + (search ? \"?\" + search : \"\") + (hash ? \"#\" + hash : \"\");\n};\n\nexport function locationPluginFactory(\n name: string,\n isHtml5: boolean,\n serviceClass: { new(router?: UIRouter): LocationServices },\n configurationClass: { new(router?: UIRouter, isHtml5?: boolean): LocationConfig }\n) {\n return function(router: UIRouter) {\n let service = router.locationService = new serviceClass(router);\n let configuration = router.locationConfig = new configurationClass(router, isHtml5);\n\n function dispose(router: UIRouter) {\n router.dispose(service);\n router.dispose(configuration);\n }\n\n return { name, service, configuration, dispose };\n };\n}\n\n","/**\n * @internalapi\n * @module vanilla\n */ /** */\n\nimport { LocationServices } from \"../common/coreservices\";\nimport { Disposable } from \"../interface\";\nimport { UIRouter } from \"../router\";\nimport { LocationLike, HistoryLike } from \"./interface\";\nimport { parseUrl, getParams, buildUrl } from \"./utils\";\nimport { isDefined } from \"../common/predicates\";\nimport { extend, deregAll, removeFrom } from \"../common/common\";\n/** A base `LocationServices` */\nexport abstract class BaseLocationServices implements LocationServices, Disposable {\n constructor(router: UIRouter, public fireAfterUpdate: boolean) {\n this._location = window && window.location;\n this._history = window && window.history;\n }\n\n _listener = evt => this._listeners.forEach(cb => cb(evt));\n\n private _listeners: Function[] = [];\n _location: LocationLike;\n _history: HistoryLike;\n\n /**\n * This should return the current internal URL representation.\n *\n * The internal URL includes only the portion that UI-Router matches.\n * It does not include:\n * - protocol\n * - server\n * - port\n * - base href or hash\n */\n abstract _get(): string;\n\n /**\n * This should set the current URL.\n *\n * The `url` param should include only the portion that UI-Router matches on.\n * It should not include:\n * - protocol\n * - server\n * - port\n * - base href or hash\n *\n * However, after this function completes, the browser URL should reflect the entire (fully qualified)\n * HREF including those data.\n */\n abstract _set(state: any, title: string, url: string, replace: boolean);\n\n hash = () => parseUrl(this._get()).hash;\n path = () => parseUrl(this._get()).path;\n search = () => getParams(parseUrl(this._get()).search);\n\n url(url?: string, replace: boolean = true): string {\n if (isDefined(url) && url !== this._get()) {\n this._set(null, null, url, replace);\n\n if (this.fireAfterUpdate) {\n let evt = extend(new Event(\"locationchange\"), { url });\n this._listeners.forEach(cb => cb(evt));\n }\n }\n\n return buildUrl(this);\n }\n\n onChange(cb: EventListener) {\n this._listeners.push(cb);\n return () => removeFrom(this._listeners, cb);\n }\n\n dispose(router: UIRouter) {\n deregAll(this._listeners);\n }\n}\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { trimHashVal } from \"./utils\";\nimport { UIRouter } from \"../router\";\nimport { BaseLocationServices } from \"./baseLocationService\";\n\n/** A `LocationServices` that uses the browser hash \"#\" to get/set the current location */\nexport class HashLocationService extends BaseLocationServices {\n constructor(router: UIRouter) {\n super(router, false);\n window.addEventListener('hashchange', this._listener, false);\n }\n\n _get() {\n return trimHashVal(this._location.hash);\n }\n _set(state: any, title: string, url: string, replace: boolean) {\n this._location.hash = url;\n }\n\n dispose (router: UIRouter) {\n super.dispose(router);\n window.removeEventListener('hashchange', this._listener);\n }\n}\n\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { BaseLocationServices } from \"./baseLocationService\";\nimport { UIRouter } from \"../router\";\n\n/** A `LocationServices` that gets/sets the current location from an in-memory object */\nexport class MemoryLocationService extends BaseLocationServices {\n _url: string;\n\n constructor(router: UIRouter) {\n super(router, true);\n }\n\n _get() {\n return this._url;\n }\n\n _set(state: any, title: string, url: string, replace: boolean) {\n this._url = url;\n }\n}\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { LocationConfig } from \"../common/coreservices\";\nimport { splitQuery, splitHash } from \"./utils\";\nimport { UIRouter } from \"../router\";\nimport { BaseLocationServices } from \"./baseLocationService\";\n\n/**\n * A `LocationServices` that gets/sets the current location using the browser's `location` and `history` apis\n *\n * Uses `history.pushState` and `history.replaceState`\n */\nexport class PushStateLocationService extends BaseLocationServices {\n _config: LocationConfig;\n\n constructor(router: UIRouter) {\n super(router, true);\n this._config = router.urlService.config;\n window.addEventListener(\"popstate\", this._listener, false);\n };\n\n _get() {\n let { pathname, hash, search } = this._location;\n search = splitQuery(search)[1]; // strip ? if found\n hash = splitHash(hash)[1]; // strip # if found\n return pathname + (search ? \"?\" + search : \"\") + (hash ? \"$\" + search : \"\");\n }\n\n _set(state: any, title: string, url: string, replace: boolean) {\n let { _config, _history } = this;\n let fullUrl = _config.baseHref() + url;\n\n if (replace) {\n _history.replaceState(state, title, fullUrl);\n } else {\n _history.pushState(state, title, fullUrl);\n }\n }\n\n dispose(router: UIRouter) {\n super.dispose(router);\n window.removeEventListener(\"popstate\", this._listener);\n }\n}\n\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { LocationConfig } from \"../common/coreservices\";\nimport { isDefined } from \"../common/predicates\";\nimport { noop } from \"../common/common\";\n\n/** A `LocationConfig` mock that gets/sets all config from an in-memory object */\nexport class MemoryLocationConfig implements LocationConfig {\n _baseHref = '';\n _port = 80;\n _protocol = \"http\";\n _host = \"localhost\";\n _hashPrefix = \"\";\n\n port = () => this._port;\n protocol = () => this._protocol;\n host = () => this._host;\n baseHref = () => this._baseHref;\n html5Mode = () => false;\n hashPrefix = (newval?) => isDefined(newval) ? this._hashPrefix = newval : this._hashPrefix;\n dispose = noop;\n}","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { isDefined } from \"../common/predicates\";\nimport { LocationConfig } from \"../common/coreservices\";\n\n/** A `LocationConfig` that delegates to the browser's `location` object */\nexport class BrowserLocationConfig implements LocationConfig {\n private _baseHref = undefined;\n private _hashPrefix = \"\";\n\n constructor(router?, private _isHtml5 = false) { }\n\n port(): number {\n if (location.port) {\n return Number(location.port);\n }\n\n return this.protocol() === 'https' ? 443 : 80;\n }\n\n protocol(): string {\n return location.protocol.replace(/:/g, '');\n }\n\n host(): string {\n return location.hostname;\n }\n\n html5Mode(): boolean {\n return this._isHtml5;\n }\n\n hashPrefix(): string;\n hashPrefix(newprefix?: string): string {\n return isDefined(newprefix) ? this._hashPrefix = newprefix : this._hashPrefix;\n };\n\n baseHref(href?: string): string {\n return isDefined(href) ? this._baseHref = href : this._baseHref || this.applyDocumentBaseHref();\n }\n\n applyDocumentBaseHref() {\n let baseTags = document.getElementsByTagName(\"base\");\n return this._baseHref = baseTags.length ? baseTags[0].href.substr(location.origin.length) : \"\";\n }\n\n dispose() {}\n}\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { BrowserLocationConfig } from \"./browserLocationConfig\";\nimport { HashLocationService } from \"./hashLocationService\";\nimport { locationPluginFactory } from \"./utils\";\nimport { LocationPlugin, ServicesPlugin } from \"./interface\";\nimport { UIRouter } from \"../router\";\nimport { PushStateLocationService } from \"./pushStateLocationService\";\nimport { MemoryLocationService } from \"./memoryLocationService\";\nimport { MemoryLocationConfig } from \"./memoryLocationConfig\";\nimport { $injector } from \"./injector\";\nimport { $q } from \"./q\";\nimport { services } from \"../common/coreservices\";\n\nexport function servicesPlugin(router: UIRouter): ServicesPlugin {\n services.$injector = $injector;\n services.$q = $q;\n\n return { name: \"vanilla.services\", $q, $injector, dispose: () => null };\n}\n\n/** A `UIRouterPlugin` uses the browser hash to get/set the current location */\nexport const hashLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory('vanilla.hashBangLocation', false, HashLocationService, BrowserLocationConfig);\n\n/** A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis */\nexport const pushStateLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory(\"vanilla.pushStateLocation\", true, PushStateLocationService, BrowserLocationConfig);\n\n/** A `UIRouterPlugin` that gets/sets the current location from an in-memory object */\nexport const memoryLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory(\"vanilla.memoryLocation\", false, MemoryLocationService, MemoryLocationConfig);\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nexport * from \"./vanilla/index\";\n","/**\n * # Core classes and interfaces\n *\n * The classes and interfaces that are core to ui-router and do not belong\n * to a more specific subsystem (such as resolve).\n *\n * @coreapi\n * @preferred\n * @module core\n */ /** for typedoc */\n\n// Need to import or export at least one concrete something\nimport {noop} from \"./common/common\";\nimport {UIRouter} from \"./router\";\n\n/**\n * An interface for getting values from dependency injection.\n *\n * This is primarily used to get resolve values for a given token.\n * An instance of the `UIInjector` can be retrieved from the current transition using [[Transition.injector]].\n *\n * ---\n *\n * If no resolve is found for a token, then it will delegate to the native injector.\n * The native injector may be Angular 1 `$injector`, Angular 2 `Injector`, or a simple polyfill.\n *\n * In Angular 2, the native injector might be the root Injector,\n * or it might be a lazy loaded `NgModule` injector scoped to a lazy load state tree.\n */\nexport interface UIInjector {\n /**\n * Gets a value from the injector.\n *\n * For a given token, returns the value from the injector that matches the token.\n * If the token is for a resolve that has not yet been fetched, this throws an error.\n *\n * #### Example:\n * ```js\n * var myResolve = injector.get('myResolve');\n * ```\n *\n * #### ng1 Example:\n * ```js\n * // Fetch StateService\n * injector.get('$state').go('home');\n * ```\n *\n * #### ng2 Example:\n * ```js\n * import {StateService} from \"ui-router-ng2\";\n * // Fetch StateService\n * injector.get(StateService).go('home');\n * ```\n *\n * #### Typescript Example:\n * ```js\n * var stringArray = injector.get('myStringArray');\n * ```\n *\n * ### `NOWAIT` policy\n *\n * When using [[ResolvePolicy.async]] === `NOWAIT`, the value returned from `get()` is a promise for the result.\n * The promise is not automatically unwrapped.\n *\n * @param token the key for the value to get. May be a string, a class, or any arbitrary object.\n * @return the Dependency Injection value that matches the token\n */\n get(token: any): any;\n /** Gets a value as type `T` (generics parameter) */\n get(token: any): T;\n\n /**\n * Asynchronously gets a value from the injector\n *\n * For a given token, returns a promise for the value from the injector that matches the token.\n * If the token is for a resolve that has not yet been fetched, this triggers the resolve to load.\n *\n * #### Example:\n * ```js\n * return injector.getAsync('myResolve').then(value => {\n * if (value === 'declined') return false;\n * });\n * ```\n *\n * @param token the key for the value to get. May be a string or arbitrary object.\n * @return a Promise for the Dependency Injection value that matches the token\n */\n getAsync(token: any): Promise;\n /** Asynchronously gets a value as type `T` (generics parameter) */\n getAsync(token: any): Promise;\n\n /**\n * Gets a value from the native injector\n *\n * Returns a value from the native injector, bypassing anything in the [[ResolveContext]].\n *\n * Example:\n * ```js\n * let someThing = injector.getNative(SomeToken);\n * ```\n *\n * @param token the key for the value to get. May be a string or arbitrary object.\n * @return the Dependency Injection value that matches the token\n */\n getNative(token: any): any;\n getNative(token: any): T;\n}\n\n/** @internalapi */\nexport interface UIRouterPlugin extends Disposable {\n name: string;\n}\n\n/** @internalapi */\nexport abstract class UIRouterPluginBase implements UIRouterPlugin, Disposable {\n abstract name: string;\n dispose(router: UIRouter) { }\n}\n\n/** @internalapi */\nexport interface Disposable {\n /** Instructs the Disposable to clean up any resources */\n dispose(router?: UIRouter);\n}","/**\n * @coreapi\n * @module common\n */ /** */\n\nexport * from \"./common/index\";\nexport * from \"./params/index\";\nexport * from \"./path/index\";\nexport * from \"./resolve/index\";\nexport * from \"./state/index\";\nexport * from \"./transition/index\";\nexport * from \"./url/index\";\nexport * from \"./view/index\";\nexport * from \"./globals\";\n\nexport * from \"./router\";\nexport * from \"./vanilla\";\nexport * from \"./interface\";\n","/** @module ng1 */ /** */\nimport { ng as angular } from \"../angular\";\nimport {\n StateObject, pick, forEach, tail, extend,\n isArray, isInjectable, isDefined, isString, services, trace,\n ViewConfig, ViewService, ViewConfigFactory, PathNode, ResolveContext, Resolvable, IInjectable\n} from \"@uirouter/core\";\nimport { Ng1ViewDeclaration } from \"../interface\";\nimport { TemplateFactory } from \"../templateFactory\";\nimport IInjectorService = angular.auto.IInjectorService;\n\nexport function getNg1ViewConfigFactory(): ViewConfigFactory {\n let templateFactory: TemplateFactory = null;\n return (path, view) => {\n templateFactory = templateFactory || services.$injector.get(\"$templateFactory\");\n return [new Ng1ViewConfig(path, view, templateFactory)];\n };\n}\n\nconst hasAnyKey = (keys, obj) =>\n keys.reduce((acc, key) => acc || isDefined(obj[key]), false);\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `views`.\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * handles the `views` property with logic specific to @uirouter/angularjs (ng1).\n *\n * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object\n * and applies the state-level configuration to a view named `$default`.\n */\nexport function ng1ViewsBuilder(state: StateObject) {\n // Do not process root state\n if (!state.parent) return {};\n\n let tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'],\n ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'],\n compKeys = ['component', 'bindings', 'componentProvider'],\n nonCompKeys = tplKeys.concat(ctrlKeys),\n allViewKeys = compKeys.concat(nonCompKeys);\n\n // Do not allow a state to have both state-level props and also a `views: {}` property.\n // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state.\n // However, the `$default` approach should not be mixed with a separate `views: ` block.\n if (isDefined(state.views) && hasAnyKey(allViewKeys, state)) {\n throw new Error(`State '${state.name}' has a 'views' object. ` +\n `It cannot also have \"view properties\" at the state level. ` +\n `Move the following properties into a view (in the 'views' object): ` +\n ` ${allViewKeys.filter(key => isDefined(state[key])).join(\", \")}`);\n }\n\n let views: { [key: string]: Ng1ViewDeclaration } = {},\n viewsObject = state.views || { \"$default\": pick(state, allViewKeys) };\n\n forEach(viewsObject, function (config: Ng1ViewDeclaration, name: string) {\n // Account for views: { \"\": { template... } }\n name = name || \"$default\";\n // Account for views: { header: \"headerComponent\" }\n if (isString(config)) config = { component: config };\n\n // Make a shallow copy of the config object\n config = extend({}, config);\n\n // Do not allow a view to mix props for component-style view with props for template/controller-style view\n if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {\n throw new Error(`Cannot combine: ${compKeys.join(\"|\")} with: ${nonCompKeys.join(\"|\")} in stateview: '${name}@${state.name}'`);\n }\n\n config.resolveAs = config.resolveAs || '$resolve';\n config.$type = \"ng1\";\n config.$context = state;\n config.$name = name;\n\n let normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name);\n config.$uiViewName = normalized.uiViewName;\n config.$uiViewContextAnchor = normalized.uiViewContextAnchor;\n\n views[name] = config;\n });\n return views;\n}\n\nlet id = 0;\nexport class Ng1ViewConfig implements ViewConfig {\n $id = id++;\n loaded: boolean = false;\n controller: Function; // actually IInjectable|string\n template: string;\n component: string;\n locals: any; // TODO: delete me\n\n constructor(public path: PathNode[], public viewDecl: Ng1ViewDeclaration, public factory: TemplateFactory) { }\n\n load() {\n let $q = services.$q;\n let context = new ResolveContext(this.path);\n let params = this.path.reduce((acc, node) => extend(acc, node.paramValues), {});\n\n let promises: any = {\n template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)),\n controller: $q.when(this.getController(context))\n };\n\n return $q.all(promises).then((results) => {\n trace.traceViewServiceEvent(\"Loaded\", this);\n this.controller = results.controller;\n extend(this, results.template); // Either { template: \"tpl\" } or { component: \"cmpName\" }\n return this;\n });\n }\n\n getTemplate = (uiView, context: ResolveContext) =>\n this.component ? this.factory.makeComponentTemplate(uiView, context, this.component, this.viewDecl.bindings) : this.template;\n\n /**\n * Gets the controller for a view configuration.\n *\n * @returns {Function|Promise.} Returns a controller, or a promise that resolves to a controller.\n */\n getController(context: ResolveContext): (IInjectable|string|Promise) {\n let provider = this.viewDecl.controllerProvider;\n if (!isInjectable(provider)) return this.viewDecl.controller;\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n }\n}\n","/** @module view */\n/** for typedoc */\nimport { ng as angular } from \"./angular\";\nimport { IAugmentedJQuery } from \"angular\";\nimport {\n isArray, isDefined, isFunction, isObject, services, Obj, IInjectable, tail, kebobString, unnestR, ResolveContext,\n Resolvable, RawParams\n} from \"@uirouter/core\";\nimport { Ng1ViewDeclaration, TemplateFactoryProvider } from \"./interface\";\n\n/**\n * Service which manages loading of templates from a ViewConfig.\n */\nexport class TemplateFactory implements TemplateFactoryProvider {\n /** @hidden */ private _useHttp = angular.version.minor < 3;\n /** @hidden */ private $templateRequest;\n /** @hidden */ private $templateCache;\n /** @hidden */ private $http;\n\n /** @hidden */ $get = ['$http', '$templateCache', '$injector', ($http, $templateCache, $injector) => {\n this.$templateRequest = $injector.has && $injector.has('$templateRequest') && $injector.get('$templateRequest');\n this.$http = $http;\n this.$templateCache = $templateCache;\n return this;\n }];\n\n /** @hidden */\n useHttpService(value: boolean) {\n this._useHttp = value;\n };\n\n /**\n * Creates a template from a configuration object.\n *\n * @param config Configuration object for which to load a template.\n * The following properties are search in the specified order, and the first one\n * that is defined is used to create the template:\n *\n * @param params Parameters to pass to the template function.\n * @param context The resolve context associated with the template's view\n *\n * @return {string|object} The template html as a string, or a promise for\n * that string,or `null` if no template is configured.\n */\n fromConfig(config: Ng1ViewDeclaration, params: any, context: ResolveContext): Promise<{ template?: string, component?: string }> {\n const defaultTemplate = \"\";\n\n const asTemplate = (result) => services.$q.when(result).then(str => ({ template: str }));\n const asComponent = (result) => services.$q.when(result).then(str => ({ component: str }));\n\n return (\n isDefined(config.template) ? asTemplate(this.fromString(config.template, params)) :\n isDefined(config.templateUrl) ? asTemplate(this.fromUrl(config.templateUrl, params)) :\n isDefined(config.templateProvider) ? asTemplate(this.fromProvider(config.templateProvider, params, context)) :\n isDefined(config.component) ? asComponent(config.component) :\n isDefined(config.componentProvider) ? asComponent(this.fromComponentProvider(config.componentProvider, params, context)) :\n asTemplate(defaultTemplate)\n );\n };\n\n /**\n * Creates a template from a string or a function returning a string.\n *\n * @param template html template as a string or function that returns an html template as a string.\n * @param params Parameters to pass to the template function.\n *\n * @return {string|object} The template html as a string, or a promise for that\n * string.\n */\n fromString(template: (string | Function), params?: RawParams) {\n return isFunction(template) ? ( template)(params) : template;\n };\n\n /**\n * Loads a template from the a URL via `$http` and `$templateCache`.\n *\n * @param {string|Function} url url of the template to load, or a function\n * that returns a url.\n * @param {Object} params Parameters to pass to the url function.\n * @return {string|Promise.} The template html as a string, or a promise\n * for that string.\n */\n fromUrl(url: (string | Function), params: any) {\n if (isFunction(url)) url = ( url)(params);\n if (url == null) return null;\n\n if (this._useHttp) {\n return this.$http.get(url, { cache: this.$templateCache, headers: { Accept: 'text/html' } })\n .then(function (response) {\n return response.data;\n });\n }\n\n return this.$templateRequest(url);\n };\n\n /**\n * Creates a template by invoking an injectable provider function.\n *\n * @param provider Function to invoke via `locals`\n * @param {Function} injectFn a function used to invoke the template provider\n * @return {string|Promise.} The template html as a string, or a promise\n * for that string.\n */\n fromProvider(provider: IInjectable, params: any, context: ResolveContext) {\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n };\n\n /**\n * Creates a component's template by invoking an injectable provider function.\n *\n * @param provider Function to invoke via `locals`\n * @param {Function} injectFn a function used to invoke the template provider\n * @return {string} The template html as a string: \"\".\n */\n fromComponentProvider(provider: IInjectable, params: any, context: ResolveContext) {\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n };\n\n /**\n * Creates a template from a component's name\n *\n * This implements route-to-component.\n * It works by retrieving the component (directive) metadata from the injector.\n * It analyses the component's bindings, then constructs a template that instantiates the component.\n * The template wires input and output bindings to resolves or from the parent component.\n *\n * @param uiView {object} The parent ui-view (for binding outputs to callbacks)\n * @param context The ResolveContext (for binding outputs to callbacks returned from resolves)\n * @param component {string} Component's name in camel case.\n * @param bindings An object defining the component's bindings: {foo: '<'}\n * @return {string} The template as a string: \"\".\n */\n makeComponentTemplate(uiView: IAugmentedJQuery, context: ResolveContext, component: string, bindings?: any) {\n bindings = bindings || {};\n\n // Bind once prefix\n const prefix = angular.version.minor >= 3 ? \"::\" : \"\";\n // Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-`\n const kebob = (camelCase: string) => {\n const kebobed = kebobString(camelCase);\n return /^(x|data)-/.exec(kebobed) ? `x-${kebobed}` : kebobed;\n };\n\n\n const attributeTpl = (input: BindingTuple) => {\n let { name, type } = input;\n let attrName = kebob(name);\n // If the ui-view has an attribute which matches a binding on the routed component\n // then pass that attribute through to the routed component template.\n // Prefer ui-view wired mappings to resolve data, unless the resolve was explicitly bound using `bindings:`\n if (uiView.attr(attrName) && !bindings[name])\n return `${attrName}='${uiView.attr(attrName)}'`;\n\n let resolveName = bindings[name] || name;\n // Pre-evaluate the expression for \"@\" bindings by enclosing in {{ }}\n // some-attr=\"{{ ::$resolve.someResolveName }}\"\n if (type === '@')\n return `${attrName}='{{${prefix}$resolve.${resolveName}}}'`;\n\n // Wire \"&\" callbacks to resolves that return a callback function\n // Get the result of the resolve (should be a function) and annotate it to get its arguments.\n // some-attr=\"$resolve.someResolveResultName(foo, bar)\"\n if (type === '&') {\n let res = context.getResolvable(resolveName);\n let fn = res && res.data;\n let args = fn && services.$injector.annotate(fn) || [];\n // account for array style injection, i.e., ['foo', function(foo) {}]\n let arrayIdxStr = isArray(fn) ? `[${fn.length - 1}]` : '';\n return `${attrName}='$resolve.${resolveName}${arrayIdxStr}(${args.join(\",\")})'`;\n }\n\n // some-attr=\"::$resolve.someResolveName\"\n return `${attrName}='${prefix}$resolve.${resolveName}'`;\n };\n\n let attrs = getComponentBindings(component).map(attributeTpl).join(\" \");\n let kebobName = kebob(component);\n return `<${kebobName} ${attrs}>`;\n };\n}\n\n// Gets all the directive(s)' inputs ('@', '=', and '<') and outputs ('&')\nfunction getComponentBindings(name: string) {\n let cmpDefs = services.$injector.get(name + \"Directive\"); // could be multiple\n if (!cmpDefs || !cmpDefs.length) throw new Error(`Unable to find component named '${name}'`);\n return cmpDefs.map(getBindings).reduce(unnestR, []);\n}\n\n// Given a directive definition, find its object input attributes\n// Use different properties, depending on the type of directive (component, bindToController, normal)\nconst getBindings = (def: any) => {\n if (isObject(def.bindToController)) return scopeBindings(def.bindToController);\n return scopeBindings(def.scope);\n};\n\ninterface BindingTuple {\n name: string;\n type: string;\n}\n\n// for ng 1.2 style, process the scope: { input: \"=foo\" }\n// for ng 1.3 through ng 1.5, process the component's bindToController: { input: \"=foo\" } object\nconst scopeBindings = (bindingsObj: Obj) => Object.keys(bindingsObj || {})\n // [ 'input', [ '=foo', '=', 'foo' ] ]\n .map(key => [key, /^([=<@&])[?]?(.*)/.exec(bindingsObj[key])])\n // skip malformed values\n .filter(tuple => isDefined(tuple) && isArray(tuple[1]))\n // { name: ('foo' || 'input'), type: '=' }\n .map(tuple => ({ name: tuple[1][2] || tuple[0], type: tuple[1][1] } as BindingTuple));\n\n","/** @module ng1 */ /** for typedoc */\nimport {\n val, isObject, createProxyFunctions, BuilderFunction, StateRegistry, StateService, OnInvalidCallback\n} from \"@uirouter/core\";\nimport { Ng1StateDeclaration } from \"./interface\";\n\n/**\n * The Angular 1 `StateProvider`\n *\n * The `$stateProvider` works similar to Angular's v1 router, but it focuses purely\n * on state.\n *\n * A state corresponds to a \"place\" in the application in terms of the overall UI and\n * navigation. A state describes (via the controller / template / view properties) what\n * the UI looks like and does at that place.\n *\n * States often have things in common, and the primary way of factoring out these\n * commonalities in this model is via the state hierarchy, i.e. parent/child states aka\n * nested states.\n *\n * The `$stateProvider` provides interfaces to declare these states for your app.\n */\nexport class StateProvider {\n constructor(private stateRegistry: StateRegistry, private stateService: StateService) {\n createProxyFunctions(val(StateProvider.prototype), this, val(this));\n }\n\n /**\n * Decorates states when they are registered\n *\n * Allows you to extend (carefully) or override (at your own peril) the\n * `stateBuilder` object used internally by [[StateRegistry]].\n * This can be used to add custom functionality to ui-router,\n * for example inferring templateUrl based on the state name.\n *\n * When passing only a name, it returns the current (original or decorated) builder\n * function that matches `name`.\n *\n * The builder functions that can be decorated are listed below. Though not all\n * necessarily have a good use case for decoration, that is up to you to decide.\n *\n * In addition, users can attach custom decorators, which will generate new\n * properties within the state's internal definition. There is currently no clear\n * use-case for this beyond accessing internal states (i.e. $state.$current),\n * however, expect this to become increasingly relevant as we introduce additional\n * meta-programming features.\n *\n * **Warning**: Decorators should not be interdependent because the order of\n * execution of the builder functions in non-deterministic. Builder functions\n * should only be dependent on the state definition object and super function.\n *\n *\n * Existing builder functions and current return values:\n *\n * - **parent** `{object}` - returns the parent state object.\n * - **data** `{object}` - returns state data, including any inherited data that is not\n * overridden by own values (if any).\n * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}\n * or `null`.\n * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is\n * navigable).\n * - **params** `{object}` - returns an array of state params that are ensured to\n * be a super-set of parent's params.\n * - **views** `{object}` - returns a views object where each key is an absolute view\n * name (i.e. \"viewName@stateName\") and each value is the config object\n * (template, controller) for the view. Even when you don't use the views object\n * explicitly on a state config, one is still created for you internally.\n * So by decorating this builder function you have access to decorating template\n * and controller properties.\n * - **ownParams** `{object}` - returns an array of params that belong to the state,\n * not including any params defined by ancestor states.\n * - **path** `{string}` - returns the full path from the root down to this state.\n * Needed for state activation.\n * - **includes** `{object}` - returns an object that includes every state that\n * would pass a `$state.includes()` test.\n *\n * #### Example:\n * Override the internal 'views' builder with a function that takes the state\n * definition, and a reference to the internal function being overridden:\n * ```js\n * $stateProvider.decorator('views', function (state, parent) {\n * let result = {},\n * views = parent(state);\n *\n * angular.forEach(views, function (config, name) {\n * let autoName = (state.name + '.' + name).replace('.', '/');\n * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';\n * result[name] = config;\n * });\n * return result;\n * });\n *\n * $stateProvider.state('home', {\n * views: {\n * 'contact.list': { controller: 'ListController' },\n * 'contact.item': { controller: 'ItemController' }\n * }\n * });\n * ```\n *\n *\n * ```js\n * // Auto-populates list and item views with /partials/home/contact/list.html,\n * // and /partials/home/contact/item.html, respectively.\n * $state.go('home');\n * ```\n *\n * @param {string} name The name of the builder function to decorate.\n * @param {object} func A function that is responsible for decorating the original\n * builder function. The function receives two parameters:\n *\n * - `{object}` - state - The state config object.\n * - `{object}` - super - The original builder function.\n *\n * @return {object} $stateProvider - $stateProvider instance\n */\n decorator(name: string, func: BuilderFunction) {\n return this.stateRegistry.decorator(name, func) || this;\n }\n\n /**\n * Registers a state\n *\n * ### This is a passthrough to [[StateRegistry.register]].\n *\n * Registers a state configuration under a given state name.\n * The stateConfig object has the following acceptable properties.\n *\n * \n *\n * - **`template`** - {string|function=} - html template as a string or a function that returns\n * an html template as a string which should be used by the uiView directives. This property\n * takes precedence over templateUrl.\n *\n * If `template` is a function, it will be called with the following parameters:\n *\n * - {array.<object>} - state parameters extracted from the current $location.path() by\n * applying the current state\n *\n * \n *\n * - **`templateUrl`** - {string|function=} - path or function that returns a path to an html\n * template that should be used by uiView.\n *\n * If `templateUrl` is a function, it will be called with the following parameters:\n *\n * - {array.<object>} - state parameters extracted from the current $location.path() by\n * applying the current state\n *\n * \n *\n * - **`templateProvider`** - {function=} - Provider function that returns HTML content\n * string.\n *\n * \n *\n * - **`controller`** - {string|function=} - Controller fn that should be associated with newly\n * related scope or the name of a registered controller if passed as a string.\n *\n * \n *\n * - **`controllerProvider`** - {function=} - Injectable provider function that returns\n * the actual controller or string.\n *\n * \n *\n * - **`controllerAs`** – {string=} – A controller alias name. If present the controller will be\n * published to scope under the controllerAs name.\n *\n * \n *\n * - **`resolve`** - {object.<string, function>=} - An optional map of dependencies which\n * should be injected into the controller. If any of these dependencies are promises,\n * the router will wait for them all to be resolved or one to be rejected before the\n * controller is instantiated. If all the promises are resolved successfully, the values\n * of the resolved promises are injected and $stateChangeSuccess event is fired. If any\n * of the promises are rejected the $stateChangeError event is fired. The map object is:\n *\n * - key - {string}: name of dependency to be injected into controller\n * - factory - {string|function}: If string then it is alias for service. Otherwise if function,\n * it is injected and return value it treated as dependency. If result is a promise, it is\n * resolved before its value is injected into controller.\n *\n * \n *\n * - **`url`** - {string=} - A url with optional parameters. When a state is navigated or\n * transitioned to, the `$stateParams` service will be populated with any\n * parameters that were passed.\n *\n * \n *\n * - **`params`** - {object=} - An array of parameter names or regular expressions. Only\n * use this within a state if you are not using url. Otherwise you can specify your\n * parameters within the url. When a state is navigated or transitioned to, the\n * $stateParams service will be populated with any parameters that were passed.\n *\n * \n *\n * - **`views`** - {object=} - Use the views property to set up multiple views or to target views\n * manually/explicitly.\n *\n * \n *\n * - **`abstract`** - {boolean=} - An abstract state will never be directly activated,\n * but can provide inherited properties to its common children states.\n *\n * \n *\n * - **`onEnter`** - {object=} - Callback function for when a state is entered. Good way\n * to trigger an action or dispatch an event, such as opening a dialog.\n * If minifying your scripts, make sure to use the `['injection1', 'injection2', function(injection1, injection2){}]` syntax.\n *\n * \n *\n * - **`onExit`** - {object=} - Callback function for when a state is exited. Good way to\n * trigger an action or dispatch an event, such as opening a dialog.\n * If minifying your scripts, make sure to use the `['injection1', 'injection2', function(injection1, injection2){}]` syntax.\n *\n * \n *\n * - **`reloadOnSearch = true`** - {boolean=} - If `false`, will not retrigger the same state\n * just because a search/query parameter has changed (via $location.search() or $location.hash()).\n * Useful for when you'd like to modify $location.search() without triggering a reload.\n *\n * \n *\n * - **`data`** - {object=} - Arbitrary data object, useful for custom configuration.\n *\n * #### Example:\n * Some state name examples\n * ```js\n * // stateName can be a single top-level name (must be unique).\n * $stateProvider.state(\"home\", {});\n *\n * // Or it can be a nested state name. This state is a child of the\n * // above \"home\" state.\n * $stateProvider.state(\"home.newest\", {});\n *\n * // Nest states as deeply as needed.\n * $stateProvider.state(\"home.newest.abc.xyz.inception\", {});\n *\n * // state() returns $stateProvider, so you can chain state declarations.\n * $stateProvider\n * .state(\"home\", {})\n * .state(\"about\", {})\n * .state(\"contacts\", {});\n * ```\n *\n * @param {string} name A unique state name, e.g. \"home\", \"about\", \"contacts\".\n * To create a parent/child state use a dot, e.g. \"about.sales\", \"home.newest\".\n * @param {object} definition State configuration object.\n */\n state(name: string, definition: Ng1StateDeclaration): StateProvider;\n state(definition: Ng1StateDeclaration): StateProvider;\n state(name: any, definition?: any) {\n if (isObject(name)) {\n definition = name;\n } else {\n definition.name = name;\n }\n this.stateRegistry.register(definition);\n return this;\n }\n\n /**\n * Registers an invalid state handler\n *\n * This is a passthrough to [[StateService.onInvalid]] for ng1.\n */\n\n onInvalid(callback: OnInvalidCallback): Function {\n return this.stateService.onInvalid(callback);\n }\n}\n","/** @module ng1 */ /** */\nimport {\n StateObject, TransitionStateHookFn, HookResult, Transition, services, ResolveContext, extend, BuilderFunction\n} from \"@uirouter/core\";\nimport { getLocals } from \"../services\";\nimport { Ng1StateDeclaration } from '../interface';\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`,\n * `onRetain` callback hooks on a [[Ng1StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * ensures that those hooks are injectable for @uirouter/angularjs (ng1).\n */\nexport const getStateHookBuilder = (hookName: \"onEnter\"|\"onExit\"|\"onRetain\") =>\nfunction stateHookBuilder(state: StateObject, parentFn: BuilderFunction): TransitionStateHookFn {\n let hook = state[hookName];\n let pathname = hookName === 'onExit' ? 'from' : 'to';\n\n function decoratedNg1Hook(trans: Transition, state: Ng1StateDeclaration): HookResult {\n let resolveContext = new ResolveContext(trans.treeChanges(pathname));\n let locals = extend(getLocals(resolveContext), { $state$: state, $transition$: trans });\n return services.$injector.invoke(hook, this, locals);\n }\n\n return hook ? decoratedNg1Hook : undefined;\n};\n","/**\n * @internalapi\n * @module ng1\n */ /** */\nimport { LocationConfig, LocationServices, UIRouter, ParamType } from \"@uirouter/core\";\nimport { val, createProxyFunctions, removeFrom, isObject } from \"@uirouter/core\";\nimport { ILocationService, ILocationProvider } from \"angular\";\n\n/**\n * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service\n */\nexport class Ng1LocationServices implements LocationConfig, LocationServices {\n private $locationProvider: ILocationProvider;\n private $location: ILocationService;\n private $sniffer;\n\n path;\n search;\n hash;\n hashPrefix;\n port;\n protocol;\n host;\n baseHref;\n\n // .onChange() registry\n private _urlListeners: Function[] = [];\n\n dispose() { }\n\n constructor($locationProvider: ILocationProvider) {\n this.$locationProvider = $locationProvider;\n let _lp = val($locationProvider);\n createProxyFunctions(_lp, this, _lp, ['hashPrefix']);\n }\n\n onChange(callback: Function) {\n this._urlListeners.push(callback);\n return () => removeFrom(this._urlListeners)(callback);\n }\n\n html5Mode() {\n let html5Mode: any = this.$locationProvider.html5Mode();\n html5Mode = isObject(html5Mode) ? html5Mode.enabled : html5Mode;\n return html5Mode && this.$sniffer.history;\n }\n\n url(newUrl?: string, replace = false, state?) {\n if (newUrl) this.$location.url(newUrl);\n if (replace) this.$location.replace();\n if (state) this.$location.state(state);\n return this.$location.url();\n }\n\n _runtimeServices($rootScope, $location: ILocationService, $sniffer, $browser) {\n this.$location = $location;\n this.$sniffer = $sniffer;\n\n // Bind $locationChangeSuccess to the listeners registered in LocationService.onChange\n $rootScope.$on(\"$locationChangeSuccess\", evt => this._urlListeners.forEach(fn => fn(evt)));\n let _loc = val($location);\n let _browser = val($browser);\n\n // Bind these LocationService functions to $location\n createProxyFunctions(_loc, this, _loc, [\"replace\", \"path\", \"search\", \"hash\"]);\n // Bind these LocationConfig functions to $location\n createProxyFunctions(_loc, this, _loc, ['port', 'protocol', 'host']);\n // Bind these LocationConfig functions to $browser\n createProxyFunctions(_browser, this, _browser, ['baseHref']);\n }\n\n /**\n * Applys ng1-specific path parameter encoding\n *\n * The Angular 1 `$location` service is a bit weird.\n * It doesn't allow slashes to be encoded/decoded bi-directionally.\n *\n * See the writeup at https://github.com/angular-ui/ui-router/issues/2598\n *\n * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F\n *\n * @param router\n */\n static monkeyPatchPathParameterType(router: UIRouter) {\n let pathType: ParamType = router.urlMatcherFactory.type('path');\n\n pathType.encode = (val: any) =>\n val != null ? val.toString().replace(/(~|\\/)/g, m => ({ '~': '~~', '/': '~2F' }[m])) : val;\n\n pathType.decode = (val: string) =>\n val != null ? val.toString().replace(/(~~|~2F)/g, m => ({ '~~': '~', '~2F': '/' }[m])) : val;\n\n }\n}\n","/** @module url */ /** */\nimport {\n UIRouter, UrlRouter, LocationServices, $InjectorLike, BaseUrlRule, UrlRuleHandlerFn, UrlMatcher,\n IInjectable\n} from \"@uirouter/core\";\nimport { services, isString, isFunction, isArray, identity } from \"@uirouter/core\";\n\nexport interface RawNg1RuleFunction {\n ($injector: $InjectorLike, $location: LocationServices): string|void;\n}\n\n/**\n * Manages rules for client-side URL\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class manages the router rules for what to do when the URL changes.\n *\n * This provider remains for backwards compatibility.\n *\n * @deprecated\n */\nexport class UrlRouterProvider {\n /** @hidden */ _router: UIRouter;\n /** @hidden */ _urlRouter: UrlRouter;\n\n /** @hidden */\n constructor(router: UIRouter) {\n this._router = router;\n this._urlRouter = router.urlRouter;\n }\n\n /** @hidden */\n $get() {\n let urlRouter = this._urlRouter;\n urlRouter.update(true);\n if (!urlRouter.interceptDeferred) urlRouter.listen();\n return urlRouter;\n }\n\n /**\n * Registers a url handler function.\n *\n * Registers a low level url handler (a `rule`).\n * A rule detects specific URL patterns and returns a redirect, or performs some action.\n *\n * If a rule returns a string, the URL is replaced with the string, and all rules are fired again.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // Here's an example of how you might allow case insensitive urls\n * $urlRouterProvider.rule(function ($injector, $location) {\n * var path = $location.path(),\n * normalized = path.toLowerCase();\n *\n * if (path !== normalized) {\n * return normalized;\n * }\n * });\n * });\n * ```\n *\n * @param ruleFn\n * Handler function that takes `$injector` and `$location` services as arguments.\n * You can use them to detect a url and return a different url as a string.\n *\n * @return [[UrlRouterProvider]] (`this`)\n */\n rule(ruleFn: RawNg1RuleFunction): UrlRouterProvider {\n if (!isFunction(ruleFn)) throw new Error(\"'rule' must be a function\");\n\n const match = () =>\n ruleFn(services.$injector, this._router.locationService);\n\n let rule = new BaseUrlRule(match, identity);\n this._urlRouter.rule(rule);\n return this;\n };\n\n /**\n * Defines the path or behavior to use when no url can be matched.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // if the path doesn't match any of the urls you configured\n * // otherwise will take care of routing the user to the\n * // specified url\n * $urlRouterProvider.otherwise('/index');\n *\n * // Example of using function rule as param\n * $urlRouterProvider.otherwise(function ($injector, $location) {\n * return '/a/valid/url';\n * });\n * });\n * ```\n *\n * @param rule\n * The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`.\n * The function version is passed two params: `$injector` and `$location` services, and should return a url string.\n *\n * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n */\n otherwise(rule: string | RawNg1RuleFunction): UrlRouterProvider {\n let urlRouter = this._urlRouter;\n\n if (isString(rule)) {\n urlRouter.otherwise(rule);\n } else if (isFunction(rule)) {\n urlRouter.otherwise(() => rule(services.$injector, this._router.locationService));\n } else {\n throw new Error(\"'rule' must be a string or function\");\n }\n\n return this;\n };\n\n /**\n * Registers a handler for a given url matching.\n *\n * If the handler is a string, it is\n * treated as a redirect, and is interpolated according to the syntax of match\n * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).\n *\n * If the handler is a function, it is injectable.\n * It gets invoked if `$location` matches.\n * You have the option of inject the match object as `$match`.\n *\n * The handler can return\n *\n * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n * will continue trying to find another one that matches.\n * - **string** which is treated as a redirect and passed to `$location.url()`\n * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n * if ($state.$current.navigable !== state ||\n * !equalForKeys($match, $stateParams) {\n * $state.transitionTo(state, $match, false);\n * }\n * });\n * });\n * ```\n *\n * @param what A pattern string to match, compiled as a [[UrlMatcher]].\n * @param handler The path (or function that returns a path) that you want to redirect your user to.\n * @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]]\n *\n * Note: the handler may also invoke arbitrary code, such as `$state.go()`\n */\n when(what: (RegExp|UrlMatcher|string), handler: string|IInjectable) {\n if (isArray(handler) || isFunction(handler)) {\n handler = UrlRouterProvider.injectableHandler(this._router, handler);\n }\n\n this._urlRouter.when(what, handler as any);\n return this;\n };\n\n static injectableHandler(router: UIRouter, handler): UrlRuleHandlerFn {\n return match =>\n services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params });\n }\n\n /**\n * Disables monitoring of the URL.\n *\n * Call this method before UI-Router has bootstrapped.\n * It will stop UI-Router from performing the initial url sync.\n *\n * This can be useful to perform some asynchronous initialization before the router starts.\n * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // Prevent $urlRouter from automatically intercepting URL changes;\n * $urlRouterProvider.deferIntercept();\n * })\n *\n * app.run(function (MyService, $urlRouter, $http) {\n * $http.get(\"/stuff\").then(function(resp) {\n * MyService.doStuff(resp.data);\n * $urlRouter.listen();\n * $urlRouter.sync();\n * });\n * });\n * ```\n *\n * @param defer Indicates whether to defer location change interception.\n * Passing no parameter is equivalent to `true`.\n */\n deferIntercept(defer?: boolean) {\n this._urlRouter.deferIntercept(defer);\n };\n}\n","/**\n * # Angular 1 types\n *\n * UI-Router core provides various Typescript types which you can use for code completion and validating parameter values, etc.\n * The customizations to the core types for Angular UI-Router are documented here.\n *\n * The optional [[$resolve]] service is also documented here.\n *\n * @module ng1\n * @preferred\n */\n/** for typedoc */\nimport { ng as angular } from \"./angular\";\nimport {\n IRootScopeService, IQService, ILocationService, ILocationProvider, IHttpService, ITemplateCacheService\n} from \"angular\";\nimport {\n services, applyPairs, isString, trace, extend, UIRouter, StateService, UrlRouter, UrlMatcherFactory, ResolveContext,\n unnestR, TypedMap\n} from \"@uirouter/core\";\nimport { ng1ViewsBuilder, getNg1ViewConfigFactory } from \"./statebuilders/views\";\nimport { TemplateFactory } from \"./templateFactory\";\nimport { StateProvider } from \"./stateProvider\";\nimport { getStateHookBuilder } from \"./statebuilders/onEnterExitRetain\";\nimport { Ng1LocationServices } from \"./locationServices\";\nimport { UrlRouterProvider } from \"./urlRouterProvider\";\nimport IInjectorService = angular.auto.IInjectorService; // tslint:disable-line\n\nangular.module(\"ui.router.angular1\", []);\nlet mod_init = angular.module('ui.router.init', []);\nlet mod_util = angular.module('ui.router.util', ['ng', 'ui.router.init']);\nlet mod_rtr = angular.module('ui.router.router', ['ui.router.util']);\nlet mod_state = angular.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']);\nlet mod_main = angular.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']);\nlet mod_cmpt = angular.module('ui.router.compat', ['ui.router']); // tslint:disable-line\n\ndeclare module '@uirouter/core/lib/router' {\n interface UIRouter {\n /** @hidden */\n stateProvider: StateProvider;\n /** @hidden */\n urlRouterProvider: UrlRouterProvider;\n }\n}\n\nlet router: UIRouter = null;\n\n$uiRouter.$inject = ['$locationProvider'];\n/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */\nfunction $uiRouter($locationProvider: ILocationProvider) {\n\n // Create a new instance of the Router when the $uiRouterProvider is initialized\n router = this.router = new UIRouter();\n router.stateProvider = new StateProvider(router.stateRegistry, router.stateService);\n\n // Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties\n router.stateRegistry.decorator(\"views\", ng1ViewsBuilder);\n router.stateRegistry.decorator(\"onExit\", getStateHookBuilder(\"onExit\"));\n router.stateRegistry.decorator(\"onRetain\", getStateHookBuilder(\"onRetain\"));\n router.stateRegistry.decorator(\"onEnter\", getStateHookBuilder(\"onEnter\"));\n\n router.viewService._pluginapi._viewConfigFactory('ng1', getNg1ViewConfigFactory());\n\n let ng1LocationService = router.locationService = router.locationConfig = new Ng1LocationServices($locationProvider);\n\n Ng1LocationServices.monkeyPatchPathParameterType(router);\n\n // backwards compat: also expose router instance as $uiRouterProvider.router\n router['router'] = router;\n router['$get'] = $get;\n $get.$inject = ['$location', '$browser', '$sniffer', '$rootScope', '$http', '$templateCache'];\n function $get($location: ILocationService, $browser: any, $sniffer: any, $rootScope: ng.IScope, $http: IHttpService, $templateCache: ITemplateCacheService) {\n ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser);\n delete router['router'];\n delete router['$get'];\n return router;\n }\n return router;\n}\n\nconst getProviderFor = (serviceName) => [ '$uiRouterProvider', ($urp) => {\n let service = $urp.router[serviceName];\n service[\"$get\"] = () => service;\n return service;\n}];\n\n// This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime)\nrunBlock.$inject = ['$injector', '$q', '$uiRouter'];\nfunction runBlock($injector: IInjectorService, $q: IQService, $uiRouter: UIRouter) {\n services.$injector = $injector;\n services.$q = $q;\n\n // The $injector is now available.\n // Find any resolvables that had dependency annotation deferred\n $uiRouter.stateRegistry.get()\n .map(x => x.$$state().resolvables)\n .reduce(unnestR, [])\n .filter(x => x.deps === \"deferred\")\n .forEach(resolvable => resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi));\n}\n\n// $urlRouter service and $urlRouterProvider\nconst getUrlRouterProvider = (uiRouter: UIRouter) =>\n uiRouter.urlRouterProvider = new UrlRouterProvider(uiRouter);\n\n// $state service and $stateProvider\n// $urlRouter service and $urlRouterProvider\nconst getStateProvider = () =>\n extend(router.stateProvider, { $get: () => router.stateService });\n\nwatchDigests.$inject = ['$rootScope'];\nexport function watchDigests($rootScope: IRootScopeService) {\n $rootScope.$watch(function() { trace.approximateDigests++; });\n}\n\nmod_init .provider(\"$uiRouter\", $uiRouter);\nmod_rtr .provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]);\nmod_util .provider('$urlService', getProviderFor('urlService'));\nmod_util .provider('$urlMatcherFactory', ['$uiRouterProvider', () => router.urlMatcherFactory]);\nmod_util .provider('$templateFactory', () => new TemplateFactory());\nmod_state.provider('$stateRegistry', getProviderFor('stateRegistry'));\nmod_state.provider('$uiRouterGlobals', getProviderFor('globals'));\nmod_state.provider('$transitions', getProviderFor('transitionService'));\nmod_state.provider('$state', ['$uiRouterProvider', getStateProvider]);\n\nmod_state.factory ('$stateParams', ['$uiRouter', ($uiRouter: UIRouter) => $uiRouter.globals.params]);\nmod_main .factory ('$view', () => router.viewService);\nmod_main .service (\"$trace\", () => trace);\n\nmod_main .run (watchDigests);\nmod_util .run (['$urlMatcherFactory', function ($urlMatcherFactory: UrlMatcherFactory) { }]);\nmod_state.run (['$state', function ($state: StateService) { }]);\nmod_rtr .run (['$urlRouter', function ($urlRouter: UrlRouter) { }]);\nmod_init .run (runBlock);\n\n/** @hidden TODO: find a place to move this */\nexport const getLocals = (ctx: ResolveContext): TypedMap => {\n let tokens = ctx.getTokens().filter(isString);\n\n let tuples = tokens .map(key => {\n let resolvable = ctx.getResolvable(key);\n let waitPolicy = ctx.getPolicy(resolvable).async;\n return [ key, waitPolicy === 'NOWAIT' ? resolvable.promise : resolvable.data ];\n });\n\n return tuples.reduce(applyPairs, {});\n};\n\n","/**\n * # Angular 1 injectable services\n *\n * This is a list of the objects which can be injected using angular's injector.\n *\n * There are three different kind of injectable objects:\n *\n * ## **Provider** objects\n * #### injectable into a `.config()` block during configtime\n *\n * - [[$uiRouterProvider]]: The UI-Router instance\n * - [[$stateProvider]]: State registration\n * - [[$transitionsProvider]]: Transition hooks\n * - [[$urlServiceProvider]]: All URL related public APIs\n *\n * - [[$uiViewScrollProvider]]: Disable ui-router view scrolling\n * - [[$urlRouterProvider]]: (deprecated) Url matching rules\n * - [[$urlMatcherFactoryProvider]]: (deprecated) Url parsing config\n *\n * ## **Service** objects\n * #### injectable globally during runtime\n *\n * - [[$uiRouter]]: The UI-Router instance\n * - [[$trace]]: Enable transition trace/debug\n * - [[$transitions]]: Transition hooks\n * - [[$state]]: Imperative state related APIs\n * - [[$stateRegistry]]: State registration\n * - [[$urlService]]: All URL related public APIs\n * - [[$uiRouterGlobals]]: Global variables\n * - [[$uiViewScroll]]: Scroll an element into view\n *\n * - [[$stateParams]]: (deprecated) Global state param values\n * - [[$urlRouter]]: (deprecated) URL synchronization\n * - [[$urlMatcherFactory]]: (deprecated) URL parsing config\n *\n * ## **Per-Transition** objects\n *\n * - These kind of objects are injectable into:\n * - Resolves ([[Ng1StateDeclaration.resolve]]),\n * - Transition Hooks ([[TransitionService.onStart]], etc),\n * - Routed Controllers ([[Ng1ViewDeclaration.controller]])\n *\n * #### Different instances are injected based on the [[Transition]]\n *\n * - [[$transition$]]: The current Transition object\n * - [[$stateParams]]: State param values for pending Transition (deprecated)\n * - Any resolve data defined using [[Ng1StateDeclaration.resolve]]\n *\n * @ng1api\n * @preferred\n * @module injectables\n */ /** */\n\nimport { StateProvider } from \"./stateProvider\";\nimport {\n StateService, TransitionService, Transition, UrlRouter, UrlMatcherFactory,\n StateParams, StateRegistry, UIRouterGlobals, UIRouter, Trace, UrlService\n} from \"@uirouter/core\";\nimport { UIViewScrollProvider } from \"./viewScroll\";\nimport { UrlRouterProvider } from \"./urlRouterProvider\";\n\n/**\n * The current (or pending) State Parameters\n *\n * An injectable global **Service Object** which holds the state parameters for the latest **SUCCESSFUL** transition.\n *\n * The values are not updated until *after* a `Transition` successfully completes.\n *\n * **Also:** an injectable **Per-Transition Object** object which holds the pending state parameters for the pending `Transition` currently running.\n *\n * ### Deprecation warning:\n *\n * The value injected for `$stateParams` is different depending on where it is injected.\n *\n * - When injected into an angular service, the object injected is the global **Service Object** with the parameter values for the latest successful `Transition`.\n * - When injected into transition hooks, resolves, or view controllers, the object is the **Per-Transition Object** with the parameter values for the running `Transition`.\n *\n * Because of these confusing details, this service is deprecated.\n *\n * ### Instead of using the global `$stateParams` service object,\n * inject [[$uiRouterGlobals]] and use [[UIRouterGlobals.params]]\n *\n * ```js\n * MyService.$inject = ['$uiRouterGlobals'];\n * function MyService($uiRouterGlobals) {\n * return {\n * paramValues: function () {\n * return $uiRouterGlobals.params;\n * }\n * }\n * }\n * ```\n *\n * ### Instead of using the per-transition `$stateParams` object,\n * inject the current `Transition` (as [[$transition$]]) and use [[Transition.params]]\n *\n * ```js\n * MyController.$inject = ['$transition$'];\n * function MyController($transition$) {\n * var username = $transition$.params().username;\n * // .. do something with username\n * }\n * ```\n *\n * ---\n *\n * This object can be injected into other services.\n *\n * #### Deprecated Example:\n * ```js\n * SomeService.$inject = ['$http', '$stateParams'];\n * function SomeService($http, $stateParams) {\n * return {\n * getUser: function() {\n * return $http.get('/api/users/' + $stateParams.username);\n * }\n * }\n * };\n * angular.service('SomeService', SomeService);\n * ```\n * @deprecated\n */\nvar $stateParams: StateParams;\n\n/**\n * Global UI-Router variables\n *\n * The router global state as a **Service Object** (injectable during runtime).\n *\n * This object contains globals such as the current state and current parameter values.\n */\nvar $uiRouterGlobals: UIRouterGlobals;\n\n/**\n * The UI-Router instance\n *\n * The [[UIRouter]] singleton (the router instance) as a **Service Object** (injectable during runtime).\n *\n * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap.\n * It has references to the other UI-Router services\n *\n * #### Note: This object is also exposed as [[$uiRouterProvider]] for injection during angular config time.\n */\nlet $uiRouter: UIRouter ;\n\n/**\n * The UI-Router instance\n *\n * The [[UIRouter]] singleton (the router instance) as a **Provider Object** (injectable during config phase).\n *\n * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap.\n * It has references to the other UI-Router services\n *\n * #### Note: This object is also exposed as [[$uiRouter]] for injection during runtime.\n */\nvar $uiRouterProvider: UIRouter;\n\n/**\n * Transition debug/tracing\n *\n * The [[Trace]] singleton as a **Service Object** (injectable during runtime).\n *\n * Enables or disables Transition tracing which can help to debug issues.\n */\nvar $trace: Trace;\n\n/**\n * The Transition Service\n *\n * The [[TransitionService]] singleton as a **Service Object** (injectable during runtime).\n *\n * This angular service exposes the [[TransitionService]] singleton, which is primarily\n * used to register global transition hooks.\n *\n * #### Note: This object is also exposed as [[$transitionsProvider]] for injection during the config phase.\n */\nvar $transitions: TransitionService;\n\n/**\n * The Transition Service\n *\n * The [[TransitionService]] singleton as a **Provider Object** (injectable during config phase)\n *\n * This angular service exposes the [[TransitionService]] singleton, which is primarily\n * used to register global transition hooks.\n *\n * #### Note: This object is also exposed as [[$transitions]] for injection during runtime.\n */\nvar $transitionsProvider: TransitionService;\n\n/**\n * The current [[Transition]] object\n *\n * The current [[Transition]] object as a **Per-Transition Object** (injectable into Resolve, Hooks, Controllers)\n *\n * This object returns information about the current transition, including:\n *\n * - To/from states\n * - To/from parameters\n * - Transition options\n * - States being entered, exited, and retained\n * - Resolve data\n * - A Promise for the transition\n * - Any transition failure information\n * - An injector for both Service and Per-Transition Objects\n */\nvar $transition$: Transition;\n\n/**\n * The State Service\n *\n * The [[StateService]] singleton as a **Service Object** (injectable during runtime).\n *\n * This service used to manage and query information on registered states.\n * It exposes state related APIs including:\n *\n * - Start a [[Transition]]\n * - Imperatively lazy load states\n * - Check if a state is currently active\n * - Look up states by name\n * - Build URLs for a state+parameters\n * - Configure the global Transition error handler\n *\n * This angular service exposes the [[StateService]] singleton.\n */\nvar $state: StateService;\n\n/**\n * The State Registry\n *\n * The [[StateRegistry]] singleton as a **Service Object** (injectable during runtime).\n *\n * This service is used to register/deregister states.\n * It has state registration related APIs including:\n *\n * - Register/deregister states\n * - Listen for state registration/deregistration\n * - Get states by name\n * - Add state decorators (to customize the state creation process)\n *\n * #### Note: This object is also exposed as [[$stateRegistryProvider]] for injection during the config phase.\n */\nvar $stateRegistry: StateRegistry;\n\n/**\n * The State Registry\n *\n * The [[StateRegistry]] singleton as a **Provider Object** (injectable during config time).\n *\n * This service is used to register/deregister states.\n * It has state registration related APIs including:\n *\n * - Register/deregister states\n * - Listen for state registration/deregistration\n * - Get states by name\n * - Add state decorators (to customize the state creation process)\n *\n * #### Note: This object is also exposed as [[$stateRegistry]] for injection during runtime.\n */\nvar $stateRegistryProvider: StateRegistry;\n\n/**\n * The View Scroll provider\n *\n * The [[UIViewScrollProvider]] as a **Provider Object** (injectable during config time).\n *\n * This angular service exposes the [[UIViewScrollProvider]] singleton and is\n * used to disable UI-Router's scroll behavior.\n */\nvar $uiViewScrollProvider: UIViewScrollProvider;\n\n/**\n * The View Scroll function\n *\n * The View Scroll function as a **Service Object** (injectable during runtime).\n *\n * This is a function that scrolls an element into view.\n * The element is scrolled after a `$timeout` so the DOM has time to refresh.\n *\n * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor,\n * this can be enabled by calling [[UIViewScrollProvider.useAnchorScroll]].\n *\n * Note: this function is used by the [[directives.uiView]] when the `autoscroll` expression evaluates to true.\n */\nvar $uiViewScroll: ($element: JQuery) => void;\n\n/**\n * The StateProvider\n *\n * An angular1-only [[StateProvider]] as a **Provider Object** (injectable during config time).\n *\n * This angular service exposes the [[StateProvider]] singleton.\n *\n * The `StateProvider` is primarily used to register states or add custom state decorators.\n *\n * ##### Note: This provider is a ng1 vestige.\n * It is a passthrough to [[$stateRegistry]] and [[$state]].\n */\nvar $stateProvider: StateProvider;\n\n/**\n * The URL Service Provider\n *\n * The [[UrlService]] singleton as a **Provider Object** (injectable during the angular config phase).\n *\n * A service used to configure and interact with the URL.\n * It has URL related APIs including:\n *\n * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]])\n * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]])\n * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]])\n * - delay initial URL synchronization [[UrlService.deferIntercept]].\n * - get or set the current url: [[UrlService.url]]\n *\n * ##### Note: This service can also be injected during runtime as [[$urlService]].\n */\nvar $urlServiceProvider: UrlService;\n\n/**\n * The URL Service\n *\n * The [[UrlService]] singleton as a **Service Object** (injectable during runtime).\n *\n * Note: This service can also be injected during the config phase as [[$urlServiceProvider]].\n *\n * Used to configure the URL.\n * It has URL related APIs including:\n *\n * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]])\n * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]])\n * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]])\n * - delay initial URL synchronization [[UrlService.deferIntercept]].\n * - get or set the current url: [[UrlService.url]]\n *\n * ##### Note: This service can also be injected during the config phase as [[$urlServiceProvider]].\n */\nvar $urlService: UrlService;\n\n/**\n * The URL Router Provider\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlServiceProvider]] instead.\n *\n * The [[UrlRouter]] singleton as a **Provider Object** (injectable during config time).\n *\n * #### Note: This object is also exposed as [[$urlRouter]] for injection during runtime.\n *\n * @deprecated\n */\nvar $urlRouterProvider: UrlRouterProvider;\n\n/**\n * The Url Router\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.\n *\n * The [[UrlRouter]] singleton as a **Service Object** (injectable during runtime).\n *\n * #### Note: This object is also exposed as [[$urlRouterProvider]] for injection during angular config time.\n *\n * @deprecated\n */\nvar $urlRouter: UrlRouter;\n\n/**\n * The URL Matcher Factory\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.\n *\n * The [[UrlMatcherFactory]] singleton as a **Service Object** (injectable during runtime).\n *\n * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects.\n *\n * #### Note: This object is also exposed as [[$urlMatcherFactoryProvider]] for injection during angular config time.\n *\n * @deprecated\n */\nvar $urlMatcherFactory: UrlMatcherFactory;\n\n/**\n * The URL Matcher Factory\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.\n *\n * The [[UrlMatcherFactory]] singleton as a **Provider Object** (injectable during config time).\n *\n * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects.\n *\n * #### Note: This object is also exposed as [[$urlMatcherFactory]] for injection during runtime.\n *\n * @deprecated\n */\nvar $urlMatcherFactoryProvider: UrlMatcherFactory;\n\n\n\n","/**\n * # Angular 1 Directives\n *\n * These are the directives included in UI-Router for Angular 1.\n * These directives are used in templates to create viewports and link/navigate to states.\n *\n * @ng1api\n * @preferred\n * @module directives\n */ /** for typedoc */\nimport { ng as angular } from \"../angular\";\nimport { IAugmentedJQuery, ITimeoutService, IScope, IInterpolateService } from \"angular\";\n\nimport {\n Obj, extend, forEach, tail, isString, isObject, isArray, parse, noop, unnestR, identity, uniqR, inArray, removeFrom,\n RawParams, PathNode, StateOrName, StateService, StateDeclaration, UIRouter\n} from \"@uirouter/core\";\nimport { UIViewData } from \"./viewDirective\";\n\n/** @hidden Used for typedoc */\nexport interface ng1_directive {}\n\n/** @hidden */\nfunction parseStateRef(ref: string) {\n let paramsOnly = ref.match(/^\\s*({[^}]*})\\s*$/), parsed;\n if (paramsOnly) ref = '(' + paramsOnly[1] + ')';\n\n parsed = ref.replace(/\\n/g, \" \").match(/^\\s*([^(]*?)\\s*(\\((.*)\\))?\\s*$/);\n if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n return { state: parsed[1] || null, paramExpr: parsed[3] || null };\n}\n\n/** @hidden */\nfunction stateContext(el: IAugmentedJQuery) {\n let $uiView: UIViewData = (el.parent() as IAugmentedJQuery).inheritedData('$uiView');\n let path: PathNode[] = parse('$cfg.path')($uiView);\n return path ? tail(path).state.name : undefined;\n}\n\n/** @hidden */\nfunction processedDef($state: StateService, $element: IAugmentedJQuery, def: Def): Def {\n let uiState = def.uiState || $state.current.name;\n let uiStateOpts = extend(defaultOpts($element, $state), def.uiStateOpts || {});\n let href = $state.href(uiState, def.uiStateParams, uiStateOpts);\n return { uiState, uiStateParams: def.uiStateParams, uiStateOpts, href };\n}\n\n/** @hidden */\ninterface TypeInfo {\n attr: string;\n isAnchor: boolean;\n clickable: boolean;\n}\n\n/** @hidden */\nfunction getTypeInfo(el: IAugmentedJQuery): TypeInfo {\n // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.\n var isSvg = Object.prototype.toString.call(el.prop('href')) === '[object SVGAnimatedString]';\n var isForm = el[0].nodeName === \"FORM\";\n\n return {\n attr: isForm ? \"action\" : (isSvg ? 'xlink:href' : 'href'),\n isAnchor: el.prop(\"tagName\").toUpperCase() === \"A\",\n clickable: !isForm\n };\n}\n\n/** @hidden */\nfunction clickHook(el: IAugmentedJQuery, $state: StateService, $timeout: ITimeoutService, type: TypeInfo, getDef: () => Def) {\n return function (e: JQueryMouseEventObject) {\n var button = e.which || e.button, target = getDef();\n\n if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || el.attr('target'))) {\n // HACK: This is to allow ng-clicks to be processed before the transition is initiated:\n var transition = $timeout(function () {\n $state.go(target.uiState, target.uiStateParams, target.uiStateOpts);\n });\n e.preventDefault();\n\n // if the state has no URL, ignore one preventDefault from the directive.\n var ignorePreventDefaultCount = type.isAnchor && !target.href ? 1 : 0;\n\n e.preventDefault = function () {\n if (ignorePreventDefaultCount-- <= 0) $timeout.cancel(transition);\n };\n }\n };\n}\n\n/** @hidden */\nfunction defaultOpts(el: IAugmentedJQuery, $state: StateService) {\n return {\n relative: stateContext(el) || $state.$current,\n inherit: true,\n source: \"sref\"\n };\n}\n\n/** @hidden */\nfunction bindEvents(element: IAugmentedJQuery, scope: IScope, hookFn: (e: JQueryMouseEventObject) => void, uiStateOpts: any): void {\n let events;\n\n if (uiStateOpts) {\n events = uiStateOpts.events;\n }\n\n if (!isArray(events)) {\n events = ['click'];\n }\n\n let on = element.on ? 'on' : 'bind';\n for (let event of events) {\n element[on](event, hookFn);\n }\n\n scope.$on('$destroy', function() {\n let off = element.off ? 'off' : 'unbind';\n for (let event of events) {\n element[off](event, hookFn);\n }\n });\n}\n\n/**\n * `ui-sref`: A directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of the `ui-sref` is the name of the state to link to.\n *\n * #### Example:\n * This will activate the `home` state when the link is clicked.\n * ```html\n * Home\n * ```\n *\n * ### Relative Links\n * You can also use relative state paths within `ui-sref`, just like a relative path passed to `$state.go()` ([[StateService.go]]).\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create a relative `ui-sref` which always targets the same destination.\n *\n * #### Example:\n * Both these links are relative to the parent state, even when a child state is currently active.\n * ```html\n * child 1 state\n * child 2 state\n * ```\n *\n * This link activates the parent state.\n * ```html\n * Return\n * ```\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]] method).\n *\n * #### Example:\n * Assuming the `users` state has a url of `/users/`\n * ```html\n * Users\n * ```\n *\n * ### Parameter Values\n * In addition to the state name, a `ui-sref` can include parameter values which are applied when activating the state.\n * Param values can be provided in the `ui-sref` value after the state name, enclosed by parentheses.\n * The content inside the parentheses is an expression, evaluated to the parameter values.\n *\n * #### Example:\n * This example renders a list of links to users.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n *
  • \n * {{ user.displayName }}\n *
  • \n * ```\n *\n * Note:\n * The parameter values expression is `$watch`ed for updates.\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-sref-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n *\n * #### Example:\n * ```html\n * Home\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-sref-opts` attribute.\n *\n * #### Example:\n * ```html\n * \n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Examples\n * If you have the following template:\n *\n * ```html\n * Home\n * About\n * Next page\n *\n * \n * ```\n *\n * Then (assuming the current state is `contacts`) the rendered html including hrefs would be:\n *\n * ```html\n * Home\n * About\n * Next page\n *\n *
      \n *
    • \n * Joe\n *
    • \n *
    • \n * Alice\n *
    • \n *
    • \n * Bob\n *
    • \n *
    \n *\n * Home\n * ```\n *\n * ### Notes\n *\n * - You can use `ui-sref` to change **only the parameter values** by omitting the state name and parentheses.\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * English\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n *\n * - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons).\n * If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive.\n */\nlet uiSref: ng1_directive;\nuiSref = ['$uiRouter', '$timeout',\n function $StateRefDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n let $state = $uiRouter.stateService;\n\n return {\n restrict: 'A',\n require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n link: function (scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n let type = getTypeInfo(element);\n let active = uiSrefActive[1] || uiSrefActive[0];\n let unlinkInfoFn: Function = null;\n let hookFn;\n\n let rawDef = {} as Def;\n let getDef = () => processedDef($state, element, rawDef);\n\n let ref = parseStateRef(attrs.uiSref);\n rawDef.uiState = ref.state;\n rawDef.uiStateOpts = attrs.uiSrefOpts ? scope.$eval(attrs.uiSrefOpts) : {};\n\n function update() {\n let def = getDef();\n if (unlinkInfoFn) unlinkInfoFn();\n if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n if (def.href != null) attrs.$set(type.attr, def.href);\n }\n\n if (ref.paramExpr) {\n scope.$watch(ref.paramExpr, function (val) {\n rawDef.uiStateParams = extend({}, val);\n update();\n }, true);\n rawDef.uiStateParams = extend({}, scope.$eval(ref.paramExpr));\n }\n\n update();\n\n scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update));\n scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update));\n\n if (!type.clickable) return;\n hookFn = clickHook(element, $state, $timeout, type, getDef);\n bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n }\n };\n }];\n\n/**\n * `ui-state`: A fully dynamic directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * **This directive is very similar to [[uiSref]], but it `$observe`s and `$watch`es/evaluates all its inputs.**\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of `ui-state` is an expression which is `$watch`ed and evaluated as the state to link to.\n * **This is in contrast with `ui-sref`, which takes a state name as a string literal.**\n *\n * #### Example:\n * Create a list of links.\n * ```html\n *
  • \n * {{ link.displayName }}\n *
  • \n * ```\n *\n * ### Relative Links\n * If the expression evaluates to a relative path, it is processed like [[uiSref]].\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create relative `ui-state` which always targets the same destination.\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]] method).\n *\n * ### Parameter Values\n * In addition to the state name expression, a `ui-state` can include parameter values which are applied when activating the state.\n * Param values should be provided using the `ui-state-params` attribute.\n * The `ui-state-params` attribute value is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * This example renders a list of links with param values.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n *
  • \n * {{ link.displayName }}\n *
  • \n * ```\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-state-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n * The value of the `ui-state-opts` is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * ```html\n * Home\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-state-opts` attribute.\n *\n * #### Example:\n * ```html\n * \n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Notes\n *\n * - You can use `ui-params` to change **only the parameter values** by omitting the state name and supplying only `ui-state-params`.\n * However, it might be simpler to use [[uiSref]] parameter-only links.\n *\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * English\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n * ```\n */\nlet uiState: ng1_directive;\nuiState = ['$uiRouter', '$timeout',\n function $StateRefDynamicDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n let $state = $uiRouter.stateService;\n\n return {\n restrict: 'A',\n require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n link: function (scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n let type = getTypeInfo(element);\n let active = uiSrefActive[1] || uiSrefActive[0];\n let unlinkInfoFn: Function = null;\n let hookFn;\n\n let rawDef = {} as Def;\n let getDef = () => processedDef($state, element, rawDef);\n\n let inputAttrs = ['uiState', 'uiStateParams', 'uiStateOpts'];\n let watchDeregFns = inputAttrs.reduce((acc, attr) => (acc[attr] = noop, acc), {});\n\n function update() {\n let def = getDef();\n if (unlinkInfoFn) unlinkInfoFn();\n if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n if (def.href != null) attrs.$set(type.attr, def.href);\n }\n\n inputAttrs.forEach((field) => {\n rawDef[field] = attrs[field] ? scope.$eval(attrs[field]) : null;\n\n attrs.$observe(field, (expr) => {\n watchDeregFns[field]();\n watchDeregFns[field] = scope.$watch(expr, (newval) => {\n rawDef[field] = newval;\n update();\n }, true);\n })\n });\n\n update();\n\n scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update));\n scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update));\n\n if (!type.clickable) return;\n hookFn = clickHook(element, $state, $timeout, type, getDef);\n bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n }\n };\n }];\n\n\n/**\n * `ui-sref-active` and `ui-sref-active-eq`: A directive that adds a CSS class when a `ui-sref` is active\n *\n * A directive working alongside [[uiSref]] and [[uiState]] to add classes to an element when the\n * related directive's state is active (and remove them when it is inactive).\n *\n * The primary use-case is to highlight the active link in navigation menus,\n * distinguishing it from the inactive menu items.\n *\n * ### Linking to a `ui-sref` or `ui-state`\n * `ui-sref-active` can live on the same element as `ui-sref`/`ui-state`, or it can be on a parent element.\n * If a `ui-sref-active` is a parent to more than one `ui-sref`/`ui-state`, it will apply the CSS class when **any of the links are active**.\n *\n * ### Matching\n *\n * The `ui-sref-active` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state **or any child state is active**.\n * This is a \"fuzzy match\" which uses [[StateService.includes]].\n *\n * The `ui-sref-active-eq` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state is directly active (not when child states are active).\n * This is an \"exact match\" which uses [[StateService.is]].\n *\n * ### Parameter values\n * If the `ui-sref`/`ui-state` includes parameter values, the current parameter values must match the link's values for the link to be highlighted.\n * This allows a list of links to the same state with different parameters to be rendered, and the correct one highlighted.\n *\n * #### Example:\n * ```html\n *
  • \n * {{ user.lastName }}\n *
  • \n * ```\n *\n * ### Examples\n *\n * Given the following template:\n * #### Example:\n * ```html\n * \n * ```\n *\n * When the app state is `app.user` (or any child state),\n * and contains the state parameter \"user\" with value \"bilbobaggins\",\n * the resulting HTML will appear as (note the 'active' class):\n *\n * ```html\n * \n * ```\n *\n * ### Glob mode\n *\n * It is possible to pass `ui-sref-active` an expression that evaluates to an object.\n * The objects keys represent active class names and values represent the respective state names/globs.\n * `ui-sref-active` will match if the current active state **includes** any of\n * the specified state names/globs, even the abstract ones.\n *\n * #### Example:\n * Given the following template, with \"admin\" being an abstract state:\n * ```html\n *
    \n * Roles\n *
    \n * ```\n *\n * When the current state is \"admin.roles\" the \"active\" class will be applied to both the
    and elements.\n * It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`.\n *\n * ### Notes:\n *\n * - The class name is interpolated **once** during the directives link time (any further changes to the\n * interpolated value are ignored).\n *\n * - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'`\n */\nlet uiSrefActive: ng1_directive;\nuiSrefActive = ['$state', '$stateParams', '$interpolate', '$uiRouter',\n function $StateRefActiveDirective($state: StateService, $stateParams: Obj, $interpolate: IInterpolateService, $uiRouter: UIRouter) {\n return {\n restrict: \"A\",\n controller: ['$scope', '$element', '$attrs',\n function ($scope: IScope, $element: IAugmentedJQuery, $attrs: any) {\n let states: StateData[] = [],\n activeEqClass: string,\n uiSrefActive: any;\n\n // There probably isn't much point in $observing this\n // uiSrefActive and uiSrefActiveEq share the same directive object with some\n // slight difference in logic routing\n activeEqClass = $interpolate($attrs.uiSrefActiveEq || '', false)($scope);\n\n try {\n uiSrefActive = $scope.$eval($attrs.uiSrefActive);\n } catch (e) {\n // Do nothing. uiSrefActive is not a valid expression.\n // Fall back to using $interpolate below\n }\n uiSrefActive = uiSrefActive || $interpolate($attrs.uiSrefActive || '', false)($scope);\n if (isObject(uiSrefActive)) {\n forEach(uiSrefActive, function (stateOrName: StateOrName, activeClass: string) {\n if (isString(stateOrName)) {\n let ref = parseStateRef(stateOrName);\n addState(ref.state, $scope.$eval(ref.paramExpr), activeClass);\n }\n });\n }\n\n // Allow uiSref to communicate with uiSrefActive[Equals]\n this.$$addStateInfo = function (newState: string, newParams: Obj) {\n // we already got an explicit state provided by ui-sref-active, so we\n // shadow the one that comes from ui-sref\n if (isObject(uiSrefActive) && states.length > 0) {\n return;\n }\n let deregister = addState(newState, newParams, uiSrefActive);\n update();\n return deregister;\n };\n\n function updateAfterTransition(trans) {\n trans.promise.then(update, noop);\n }\n\n $scope.$on('$stateChangeSuccess', update);\n $scope.$on('$destroy', $uiRouter.transitionService.onStart({}, updateAfterTransition));\n if ($uiRouter.globals.transition) {\n updateAfterTransition($uiRouter.globals.transition);\n }\n\n function addState(stateName: string, stateParams: Obj, activeClass: string) {\n var state = $state.get(stateName, stateContext($element));\n\n var stateInfo = {\n state: state || { name: stateName },\n params: stateParams,\n activeClass: activeClass\n };\n\n states.push(stateInfo);\n\n return function removeState() {\n removeFrom(states)(stateInfo);\n }\n }\n\n // Update route state\n function update() {\n const splitClasses = str =>\n str.split(/\\s/).filter(identity);\n const getClasses = (stateList: StateData[]) =>\n stateList.map(x => x.activeClass).map(splitClasses).reduce(unnestR, []);\n\n let allClasses = getClasses(states).concat(splitClasses(activeEqClass)).reduce(uniqR, []);\n let fuzzyClasses = getClasses(states.filter(x => $state.includes(x.state.name, x.params)));\n let exactlyMatchesAny = !!states.filter(x => $state.is(x.state.name, x.params)).length;\n let exactClasses = exactlyMatchesAny ? splitClasses(activeEqClass) : [];\n\n let addClasses = fuzzyClasses.concat(exactClasses).reduce(uniqR, []);\n let removeClasses = allClasses.filter(cls => !inArray(addClasses, cls));\n\n $scope.$evalAsync(() => {\n addClasses.forEach(className => $element.addClass(className));\n removeClasses.forEach(className => $element.removeClass(className));\n });\n }\n\n update();\n }]\n };\n }];\n\n/** @hidden */\ninterface Def { uiState: string; href: string; uiStateParams: Obj; uiStateOpts: any; }\n/** @hidden */\ninterface StateData { state: StateDeclaration; params: RawParams; activeClass: string; }\n\nangular.module('ui.router.state')\n .directive('uiSref', uiSref)\n .directive('uiSrefActive', uiSrefActive)\n .directive('uiSrefActiveEq', uiSrefActive)\n .directive('uiState', uiState);\n","/** @module ng1 */ /** for typedoc */\n\nimport { ng as angular } from \"./angular\";\nimport { Obj, StateService, StateOrName } from \"@uirouter/core\";\n\n/**\n * `isState` Filter: truthy if the current state is the parameter\n *\n * Translates to [[StateService.is]] `$state.is(\"stateName\")`.\n *\n * #### Example:\n * ```html\n *
    show if state is 'stateName'
    \n * ```\n */\n$IsStateFilter.$inject = ['$state'];\nexport function $IsStateFilter($state: StateService) {\n var isFilter: any = function(state: StateOrName, params: Obj, options?: { relative?: StateOrName }) {\n return $state.is(state, params, options);\n };\n isFilter.$stateful = true;\n return isFilter;\n}\n\n/**\n * `includedByState` Filter: truthy if the current state includes the parameter\n *\n * Translates to [[StateService.includes]]` $state.is(\"fullOrPartialStateName\")`.\n *\n * #### Example:\n * ```html\n *
    show if state includes 'fullOrPartialStateName'
    \n * ```\n */\n$IncludedByStateFilter.$inject = ['$state'];\nexport function $IncludedByStateFilter($state: StateService) {\n var includesFilter: any = function(state: StateOrName, params: Obj, options: { relative?: StateOrName }) {\n return $state.includes(state, params, options);\n };\n includesFilter.$stateful = true;\n return includesFilter;\n}\n\nangular.module('ui.router.state')\n .filter('isState', $IsStateFilter)\n .filter('includedByState', $IncludedByStateFilter);\n","/** \n * @ng1api \n * @module directives \n */ /** for typedoc */\nimport { ng as angular } from \"../angular\";\nimport {\n IInterpolateService, IScope, ITranscludeFunction, IAugmentedJQuery,\n ICompileService, IControllerService, ITimeoutService, noop\n} from \"angular\";\n\nimport {\n extend, unnestR, filter, tail, isDefined, isFunction, isString, trace, parse,\n ActiveUIView, TransitionService, ResolveContext, Transition, PathNode, StateDeclaration,\n Param, kebobString, HookRegOptions, ViewService, $QLike, Obj, TypedMap\n} from \"@uirouter/core\";\nimport {Ng1ViewConfig} from \"../statebuilders/views\";\nimport {Ng1Controller, Ng1StateDeclaration} from \"../interface\";\nimport {getLocals} from \"../services\";\nimport { ng1_directive } from \"./stateDirectives\";\n\n/** @hidden */\nexport type UIViewData = {\n $cfg: Ng1ViewConfig;\n $uiView: ActiveUIView;\n}\n\n/** @hidden */\nexport type UIViewAnimData = {\n $animEnter: Promise;\n $animLeave: Promise;\n $$animLeave: { resolve: () => any; } // \"deferred\"\n}\n\n/**\n * `ui-view`: A viewport directive which is filled in by a view from the active state.\n *\n * ### Attributes\n *\n * - `name`: (Optional) A view name.\n * The name should be unique amongst the other views in the same state.\n * You can have views of the same name that live in different states.\n * The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]).\n *\n * - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated.\n * Uses [[$uiViewScroll]] to do the scrolling.\n *\n * - `onload`: Expression to evaluate whenever the view updates.\n *\n * #### Example:\n * A view can be unnamed or named.\n * ```html\n * \n *
    \n *\n * \n *
    \n *\n * \n * \n * ```\n *\n * You can only have one unnamed view within any template (or root html). If you are only using a\n * single view and it is unnamed then you can populate it like so:\n *\n * ```html\n *
    \n * $stateProvider.state(\"home\", {\n * template: \"

    HELLO!

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

    HELLO!

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

    HELLO!

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

    HELLO!

    \"\n * },\n * \"chart\": {\n * template: \"\"\n * },\n * \"data\": {\n * template: \"\"\n * }\n * }\n * })\n * ```\n *\n * #### Examples for `autoscroll`:\n * ```html\n * \n * \n *\n * \n * \n * \n * \n * ```\n *\n * Resolve data:\n *\n * The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this\n * can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template.\n *\n * Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the\n * controller is instantiated. The `$onInit()` hook can be used to perform initialization code which\n * depends on `$resolve` data.\n *\n * #### Example:\n * ```js\n * $stateProvider.state('home', {\n * template: '',\n * resolve: {\n * user: function(UserService) { return UserService.fetchUser(); }\n * }\n * });\n * ```\n */\nexport let uiView: ng1_directive;\nuiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q',\nfunction $ViewDirective($view: ViewService, $animate: any, $uiViewScroll: any, $interpolate: IInterpolateService, $q: $QLike) {\n\n function getRenderer(attrs: Obj, scope: IScope) {\n return {\n enter: function(element: JQuery, target: any, cb: Function) {\n if (angular.version.minor > 2) {\n $animate.enter(element, null, target).then(cb);\n } else {\n $animate.enter(element, null, target, cb);\n }\n },\n leave: function(element: JQuery, cb: Function) {\n if (angular.version.minor > 2) {\n $animate.leave(element).then(cb);\n } else {\n $animate.leave(element, cb);\n }\n }\n };\n }\n\n function configsEqual(config1: Ng1ViewConfig, config2: Ng1ViewConfig) {\n return config1 === config2;\n }\n\n let rootData = {\n $cfg: { viewDecl: { $context: $view._pluginapi._rootViewContext() } },\n $uiView: { }\n };\n\n let directive = {\n count: 0,\n restrict: 'ECA',\n terminal: true,\n priority: 400,\n transclude: 'element',\n compile: function (tElement: JQuery, tAttrs: Obj, $transclude: ITranscludeFunction) {\n\n return function (scope: IScope, $element: IAugmentedJQuery, attrs: Obj) {\n let previousEl: JQuery, currentEl: JQuery,\n currentScope: IScope, unregister: Function,\n onloadExp = attrs['onload'] || '',\n autoScrollExp = attrs['autoscroll'],\n renderer = getRenderer(attrs, scope),\n viewConfig = undefined as Ng1ViewConfig,\n inherited = $element.inheritedData('$uiView') || rootData,\n name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default';\n\n let activeUIView: ActiveUIView = {\n $type: 'ng1',\n id: directive.count++, // Global sequential ID for ui-view tags added to DOM\n name: name, // ui-view name (
    \n fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + \".\" + name : name, // fully qualified name, describes location in DOM\n config: null, // The ViewConfig loaded (from a state.views definition)\n configUpdated: configUpdatedCallback, // Called when the matching ViewConfig changes\n get creationContext() { // The context in which this ui-view \"tag\" was created\n let fromParentTagConfig = parse('$cfg.viewDecl.$context')(inherited);\n // Allow \n // See https://github.com/angular-ui/ui-router/issues/3355\n let fromParentTag = parse('$uiView.creationContext')(inherited);\n return fromParentTagConfig || fromParentTag;\n }\n };\n\n trace.traceUIViewEvent(\"Linking\", activeUIView);\n\n function configUpdatedCallback(config?: Ng1ViewConfig) {\n if (config && !(config instanceof Ng1ViewConfig)) return;\n if (configsEqual(viewConfig, config)) return;\n trace.traceUIViewConfigUpdated(activeUIView, config && config.viewDecl && config.viewDecl.$context);\n\n viewConfig = config;\n updateView(config);\n }\n\n $element.data('$uiView', { $uiView: activeUIView });\n\n updateView();\n\n unregister = $view.registerUIView(activeUIView);\n scope.$on(\"$destroy\", function() {\n trace.traceUIViewEvent(\"Destroying/Unregistering\", activeUIView);\n unregister();\n });\n\n function cleanupLastView() {\n if (previousEl) {\n trace.traceUIViewEvent(\"Removing (previous) el\", previousEl.data('$uiView'));\n previousEl.remove();\n previousEl = null;\n }\n\n if (currentScope) {\n trace.traceUIViewEvent(\"Destroying scope\", activeUIView);\n currentScope.$destroy();\n currentScope = null;\n }\n\n if (currentEl) {\n let _viewData = currentEl.data('$uiViewAnim');\n trace.traceUIViewEvent(\"Animate out\", _viewData);\n renderer.leave(currentEl, function() {\n _viewData.$$animLeave.resolve();\n previousEl = null;\n });\n\n previousEl = currentEl;\n currentEl = null;\n }\n }\n\n function updateView(config?: Ng1ViewConfig) {\n let newScope = scope.$new();\n let animEnter = $q.defer(), animLeave = $q.defer();\n\n let $uiViewData: UIViewData = {\n $cfg: config,\n $uiView: activeUIView,\n };\n\n let $uiViewAnim: UIViewAnimData = {\n $animEnter: animEnter.promise,\n $animLeave: animLeave.promise,\n $$animLeave: animLeave\n };\n\n /**\n * @ngdoc event\n * @name ui.router.state.directive:ui-view#$viewContentLoading\n * @eventOf ui.router.state.directive:ui-view\n * @eventType emits on ui-view directive scope\n * @description\n *\n * Fired once the view **begins loading**, *before* the DOM is rendered.\n *\n * @param {Object} event Event object.\n * @param {string} viewName Name of the view.\n */\n newScope.$emit('$viewContentLoading', name);\n\n let cloned = $transclude(newScope, function(clone) {\n clone.data('$uiViewAnim', $uiViewAnim);\n clone.data('$uiView', $uiViewData);\n renderer.enter(clone, $element, function onUIViewEnter() {\n animEnter.resolve();\n if (currentScope) currentScope.$emit('$viewContentAnimationEnded');\n\n if (isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {\n $uiViewScroll(clone);\n }\n });\n\n cleanupLastView();\n });\n\n currentEl = cloned;\n currentScope = newScope;\n /**\n * @ngdoc event\n * @name ui.router.state.directive:ui-view#$viewContentLoaded\n * @eventOf ui.router.state.directive:ui-view\n * @eventType emits on ui-view directive scope\n * @description *\n * Fired once the view is **loaded**, *after* the DOM is rendered.\n *\n * @param {Object} event Event object.\n */\n currentScope.$emit('$viewContentLoaded', config || viewConfig);\n currentScope.$eval(onloadExp);\n }\n };\n }\n };\n\n return directive;\n}];\n\n$ViewDirectiveFill.$inject = ['$compile', '$controller', '$transitions', '$view', '$q', '$timeout'];\n/** @hidden */\nfunction $ViewDirectiveFill($compile: angular.ICompileService,\n $controller: angular.IControllerService,\n $transitions: TransitionService,\n $view: ViewService,\n $q: angular.IQService,\n $timeout: ITimeoutService) {\n const getControllerAs = parse('viewDecl.controllerAs');\n const getResolveAs = parse('viewDecl.resolveAs');\n\n return {\n restrict: 'ECA',\n priority: -400,\n compile: function (tElement: JQuery) {\n let initial = tElement.html();\n tElement.empty();\n\n return function (scope: IScope, $element: JQuery) {\n let data: UIViewData = $element.data('$uiView');\n if (!data) {\n $element.html(initial);\n $compile($element.contents())(scope);\n return;\n }\n\n let cfg: Ng1ViewConfig = data.$cfg || { viewDecl: {}, getTemplate: noop };\n let resolveCtx: ResolveContext = cfg.path && new ResolveContext(cfg.path);\n $element.html(cfg.getTemplate($element, resolveCtx) || initial);\n trace.traceUIViewFill(data.$uiView, $element.html());\n\n let link = $compile($element.contents());\n let controller = cfg.controller;\n let controllerAs: string = getControllerAs(cfg);\n let resolveAs: string = getResolveAs(cfg);\n let locals = resolveCtx && getLocals(resolveCtx);\n\n scope[resolveAs] = locals;\n\n if (controller) {\n let controllerInstance = $controller(controller, extend({}, locals, { $scope: scope, $element: $element }));\n if (controllerAs) {\n scope[controllerAs] = controllerInstance;\n scope[controllerAs][resolveAs] = locals;\n }\n\n // TODO: Use $view service as a central point for registering component-level hooks\n // Then, when a component is created, tell the $view service, so it can invoke hooks\n // $view.componentLoaded(controllerInstance, { $scope: scope, $element: $element });\n // scope.$on('$destroy', () => $view.componentUnloaded(controllerInstance, { $scope: scope, $element: $element }));\n\n $element.data('$ngControllerController', controllerInstance);\n $element.children().data('$ngControllerController', controllerInstance);\n\n registerControllerCallbacks($q, $transitions, controllerInstance, scope, cfg);\n }\n\n // Wait for the component to appear in the DOM\n if (isString(cfg.viewDecl.component)) {\n let cmp = cfg.viewDecl.component;\n let kebobName = kebobString(cmp);\n let tagRegexp = new RegExp(`^(x-|data-)?${kebobName}$`, \"i\");\n\n let getComponentController = () => {\n let directiveEl = [].slice.call($element[0].children)\n .filter((el: Element) => el && el.tagName && tagRegexp.exec(el.tagName)) ;\n \n return directiveEl && angular.element(directiveEl).data(`$${cmp}Controller`);\n };\n\n let deregisterWatch = scope.$watch(getComponentController, function(ctrlInstance) {\n if (!ctrlInstance) return;\n registerControllerCallbacks($q, $transitions, ctrlInstance, scope, cfg);\n deregisterWatch();\n });\n }\n\n link(scope);\n };\n }\n };\n}\n\n/** @hidden */\nlet hasComponentImpl = typeof (angular as any).module('ui.router')['component'] === 'function';\n/** @hidden incrementing id */\nlet _uiCanExitId = 0;\n\n/** @hidden TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */\nfunction registerControllerCallbacks($q: angular.IQService,\n $transitions: TransitionService,\n controllerInstance: Ng1Controller,\n $scope: IScope,\n cfg: Ng1ViewConfig) {\n // Call $onInit() ASAP\n if (isFunction(controllerInstance.$onInit) && !(cfg.viewDecl.component && hasComponentImpl)) {\n controllerInstance.$onInit();\n }\n\n let viewState: Ng1StateDeclaration = tail(cfg.path).state.self;\n\n let hookOptions: HookRegOptions = { bind: controllerInstance };\n // Add component-level hook for onParamsChange\n if (isFunction(controllerInstance.uiOnParamsChanged)) {\n let resolveContext: ResolveContext = new ResolveContext(cfg.path);\n let viewCreationTrans = resolveContext.getResolvable('$transition$').data;\n\n // Fire callback on any successful transition\n const paramsUpdated = ($transition$: Transition) => {\n // Exit early if the $transition$ is the same as the view was created within.\n // Exit early if the $transition$ will exit the state the view is for.\n if ($transition$ === viewCreationTrans || $transition$.exiting().indexOf(viewState as StateDeclaration) !== -1) return;\n\n let toParams = $transition$.params(\"to\") as TypedMap;\n let fromParams = $transition$.params>(\"from\") as TypedMap;\n let toSchema: Param[] = $transition$.treeChanges().to.map((node: PathNode) => node.paramSchema).reduce(unnestR, []);\n let fromSchema: Param[] = $transition$.treeChanges().from.map((node: PathNode) => node.paramSchema).reduce(unnestR, []);\n\n // Find the to params that have different values than the from params\n let changedToParams = toSchema.filter((param: Param) => {\n let idx = fromSchema.indexOf(param);\n return idx === -1 || !fromSchema[idx].type.equals(toParams[param.id], fromParams[param.id]);\n });\n\n // Only trigger callback if a to param has changed or is new\n if (changedToParams.length) {\n let changedKeys: string[] = changedToParams.map(x => x.id);\n // Filter the params to only changed/new to params. `$transition$.params()` may be used to get all params.\n let newValues = filter(toParams, (val, key) => changedKeys.indexOf(key) !== -1);\n controllerInstance.uiOnParamsChanged(newValues, $transition$);\n }\n };\n $scope.$on('$destroy', $transitions.onSuccess({}, paramsUpdated, hookOptions));\n }\n\n // Add component-level hook for uiCanExit\n if (isFunction(controllerInstance.uiCanExit)) {\n let id = _uiCanExitId++;\n let cacheProp = '_uiCanExitIds';\n\n // Returns true if a redirect transition already answered truthy\n const prevTruthyAnswer = (trans: Transition) =>\n !!trans && (trans[cacheProp] && trans[cacheProp][id] === true || prevTruthyAnswer(trans.redirectedFrom()));\n\n // If a user answered yes, but the transition was later redirected, don't also ask for the new redirect transition\n const wrappedHook = (trans: Transition) => {\n let promise, ids = trans[cacheProp] = trans[cacheProp] || {};\n if (!prevTruthyAnswer(trans)) {\n promise = $q.when(controllerInstance.uiCanExit(trans));\n promise.then(val => ids[id] = (val !== false));\n }\n return promise;\n };\n\n let criteria = {exiting: viewState.name};\n $scope.$on('$destroy', $transitions.onBefore(criteria, wrappedHook, hookOptions));\n }\n}\n\nangular.module('ui.router.state').directive('uiView', uiView);\nangular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);\n","/** @module ng1 */ /** */\nimport { ng as angular } from \"./angular\";\nimport { IServiceProviderFactory } from \"angular\";\nimport IAnchorScrollService = angular.IAnchorScrollService;\nimport ITimeoutService = angular.ITimeoutService;\n\nexport interface UIViewScrollProvider {\n /**\n * Uses standard anchorScroll behavior\n *\n * Reverts [[$uiViewScroll]] back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)\n * service for scrolling based on the url anchor.\n */\n useAnchorScroll(): void;\n}\n\n\n/** @hidden */\nfunction $ViewScrollProvider() {\n\n var useAnchorScroll = false;\n\n this.useAnchorScroll = function () {\n useAnchorScroll = true;\n };\n\n this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll: IAnchorScrollService, $timeout: ITimeoutService): Function {\n if (useAnchorScroll) {\n return $anchorScroll;\n }\n\n return function ($element: JQuery) {\n return $timeout(function () {\n $element[0].scrollIntoView();\n }, 0, false);\n };\n }];\n}\n\nangular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);\n","/**\n * Main entry point for angular 1.x build\n * @module ng1\n */ /** */\n\nexport * from \"./interface\";\nexport * from \"./services\";\nexport * from \"./statebuilders/views\";\nexport * from \"./stateProvider\";\nexport * from \"./urlRouterProvider\";\n\nimport \"./injectables\";\nimport \"./directives/stateDirectives\";\nimport \"./stateFilters\";\nimport \"./directives/viewDirective\";\nimport \"./viewScroll\";\n\nexport default \"ui.router\";\n\nimport * as core from \"@uirouter/core\";\nexport { core };\nexport * from \"@uirouter/core\";\n\n"],"names":["ng_from_import.module","val","angular","RejectType","Category","TransitionHookPhase","TransitionHookScope","noop","DefType","inherit","values","all","prop","pattern","pairs","beforeAfterSubstr","parseUrl","__extends","id","$q","$injector"],"mappings":";;;;;;;;;;;;;;;;AAMA,IAAI,cAAc,GAAG,OAAO,CAAC;AAE7B,AAAO,IAAM,EAAE,GAAG,CAAC,cAAc,IAAIA,qBAAqB,IAAI,cAAc,GAAG,cAAc,CAAC;;ACR9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,eAAsB,EAAY;IAChC,IAAI,YAAY,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,IAAI,gBAAgB,GAAG,EAAE,CAAC,MAAM,CAAC;IAEjC,iBAAiB,IAAW;QAC1B,IAAI,IAAI,CAAC,MAAM,IAAI,gBAAgB;YACjC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC9B,OAAO;YACL,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,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CAAC,CAAC;KACzF;CACF;AAEDC,EAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAQ,MAAM,CAAC,CAAC;AACpEA,EAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAQ,kBAAkB,CAAC,CAAC;;ACjfhF;AACA,AAgBA;AACA;IAEE,IAAI,eAAe,GAAG,KAAK,CAAC;IAE5B,IAAI,CAAC,eAAe,GAAG;QACrB,eAAe,GAAG,IAAI,CAAC;KACxB,CAAC;IAEF,IAAI,CAAC,IAAI,GAAG,CAAC,eAAe,EAAE,UAAU,EAAE,UAAU,aAAmC,EAAE,QAAyB;YAChH,IAAI,eAAe,EAAE;gBACnB,OAAO,aAAa,CAAC;aACtB;YAED,OAAO,UAAU,QAAgB;gBAC/B,OAAO,QAAQ,CAAC;oBACd,QAAQ,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC;iBAC9B,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;aACd,CAAC;SACH,CAAC,CAAC;CACJ;AAEDA,EAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,eAAe,EAA4B,mBAAmB,CAAC,CAAC;;ACvC3G;;;;AAMA,AACA,AACA,AACA,AAEA,AACA,AACA,AACA,AACA,AAEA,YAAe,WAAW,CAAC,AAE3B,AACA,AACA,AAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"angular-ui-router.js","sources":["@uirouter/angularjs/angular.ts","@uirouter/core/lib-esm/common/@uirouter/core/common/hof.ts","@uirouter/core/lib-esm/common/@uirouter/core/common/glob.ts","@uirouter/core/lib-esm/state/@uirouter/core/state/stateObject.ts","@uirouter/core/lib-esm/common/@uirouter/core/common/predicates.ts","@uirouter/core/lib-esm/common/@uirouter/core/common/coreservices.ts","@uirouter/core/lib-esm/common/@uirouter/core/common/common.ts","@uirouter/core/lib-esm/common/@uirouter/core/common/queue.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/rejectFactory.ts","@uirouter/core/lib-esm/common/@uirouter/core/common/trace.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/interface.ts","@uirouter/core/lib-esm/state/@uirouter/core/state/targetState.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/transitionHook.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/hookRegistry.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/hookBuilder.ts","@uirouter/core/lib-esm/params/@uirouter/core/params/paramType.ts","@uirouter/core/lib-esm/params/@uirouter/core/params/param.ts","@uirouter/core/lib-esm/path/@uirouter/core/path/pathNode.ts","@uirouter/core/lib-esm/path/@uirouter/core/path/pathFactory.ts","@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/resolvable.ts","@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/interface.ts","@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/resolveContext.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/transition.ts","@uirouter/core/lib-esm/common/@uirouter/core/common/strings.ts","@uirouter/core/lib-esm/common/@uirouter/core/common/index.ts","@uirouter/core/lib-esm/params/@uirouter/core/params/paramTypes.ts","@uirouter/core/lib-esm/params/@uirouter/core/params/stateParams.ts","@uirouter/core/lib-esm/path/@uirouter/core/path/index.ts","@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/index.ts","@uirouter/core/lib-esm/state/@uirouter/core/state/stateBuilder.ts","@uirouter/core/lib-esm/state/@uirouter/core/state/stateMatcher.ts","@uirouter/core/lib-esm/state/@uirouter/core/state/stateQueueManager.ts","@uirouter/core/lib-esm/state/@uirouter/core/state/stateRegistry.ts","@uirouter/core/lib-esm/url/@uirouter/core/url/urlMatcher.ts","@uirouter/core/lib-esm/url/@uirouter/core/url/urlMatcherFactory.ts","@uirouter/core/lib-esm/url/@uirouter/core/url/urlRule.ts","@uirouter/core/lib-esm/url/@uirouter/core/url/urlRouter.ts","@uirouter/core/lib-esm/view/@uirouter/core/view/view.ts","@uirouter/core/lib-esm/@uirouter/core/globals.ts","@uirouter/core/lib-esm/url/@uirouter/core/url/urlService.ts","@uirouter/core/lib-esm/@uirouter/core/router.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/coreResolvables.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/redirectTo.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/onEnterExitRetain.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/resolve.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/views.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/updateGlobals.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/url.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/lazyLoad.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/transitionEventType.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/ignoredTransition.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/invalidTransition.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/transitionService.ts","@uirouter/core/lib-esm/state/@uirouter/core/state/stateService.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/index.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/q.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/injector.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/utils.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/baseLocationService.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/hashLocationService.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/memoryLocationService.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/pushStateLocationService.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/memoryLocationConfig.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/browserLocationConfig.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/plugins.ts","@uirouter/core/lib-esm/@uirouter/core/vanilla.ts","@uirouter/core/lib-esm/@uirouter/core/interface.ts","@uirouter/core/lib-esm/@uirouter/core/index.ts","@uirouter/angularjs/statebuilders/views.ts","@uirouter/angularjs/templateFactory.ts","@uirouter/angularjs/stateProvider.ts","@uirouter/angularjs/statebuilders/onEnterExitRetain.ts","@uirouter/angularjs/locationServices.ts","@uirouter/angularjs/urlRouterProvider.ts","@uirouter/angularjs/services.ts","@uirouter/angularjs/injectables.ts","@uirouter/angularjs/directives/stateDirectives.ts","@uirouter/angularjs/stateFilters.ts","@uirouter/angularjs/directives/viewDirective.ts","@uirouter/angularjs/viewScroll.ts","@uirouter/angularjs/index.ts"],"sourcesContent":["/**\n * @hidden\n * @module ng1\n */ /** */\ndeclare var angular;\nimport * as ng_from_import from \"angular\";\nlet ng_from_global = angular;\n\nexport const ng = (ng_from_import && ng_from_import.module) ? ng_from_import : ng_from_global;\n","/**\n * Higher order functions\n *\n * These utility functions are exported, but are subject to change without notice.\n *\n * @module common_hof\n */ /** */\n\nimport {Predicate} from \"./common\";\n/**\n * Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function.\n *\n * Given a function with N parameters, returns a new function that supports partial application.\n * The new function accepts anywhere from 1 to N parameters. When that function is called with M parameters,\n * where M is less than N, it returns a new function that accepts the remaining parameters. It continues to\n * accept more parameters until all N parameters have been supplied.\n *\n *\n * This contrived example uses a partially applied function as an predicate, which returns true\n * if an object is found in both arrays.\n * @example\n * ```\n * // returns true if an object is in both of the two arrays\n * function inBoth(array1, array2, object) {\n * return array1.indexOf(object) !== -1 &&\n * array2.indexOf(object) !== 1;\n * }\n * let obj1, obj2, obj3, obj4, obj5, obj6, obj7\n * let foos = [obj1, obj3]\n * let bars = [obj3, obj4, obj5]\n *\n * // A curried \"copy\" of inBoth\n * let curriedInBoth = curry(inBoth);\n * // Partially apply both the array1 and array2\n * let inFoosAndBars = curriedInBoth(foos, bars);\n *\n * // Supply the final argument; since all arguments are\n * // supplied, the original inBoth function is then called.\n * let obj1InBoth = inFoosAndBars(obj1); // false\n *\n * // Use the inFoosAndBars as a predicate.\n * // Filter, on each iteration, supplies the final argument\n * let allObjs = [ obj1, obj2, obj3, obj4, obj5, obj6, obj7 ];\n * let foundInBoth = allObjs.filter(inFoosAndBars); // [ obj3 ]\n *\n * ```\n *\n * Stolen from: http://stackoverflow.com/questions/4394747/javascript-curry-function\n *\n * @param fn\n * @returns {*|function(): (*|any)}\n */\nexport function curry(fn: Function): Function {\n let initial_args = [].slice.apply(arguments, [1]);\n let func_args_length = fn.length;\n\n function curried(args: any[]) {\n if (args.length >= func_args_length)\n return fn.apply(null, args);\n return function () {\n return curried(args.concat([].slice.apply(arguments)));\n };\n }\n return curried(initial_args);\n}\n\n\n\n/**\n * Given a varargs list of functions, returns a function that composes the argument functions, right-to-left\n * given: f(x), g(x), h(x)\n * let composed = compose(f,g,h)\n * then, composed is: f(g(h(x)))\n */\nexport function compose() {\n let args = arguments;\n let start = args.length - 1;\n return function() {\n let i = start, result = args[start].apply(this, arguments);\n while (i--) result = args[i].call(this, result);\n return result;\n };\n}\n\n/**\n * Given a varargs list of functions, returns a function that is composes the argument functions, left-to-right\n * given: f(x), g(x), h(x)\n * let piped = pipe(f,g,h);\n * then, piped is: h(g(f(x)))\n */\nexport function pipe(...funcs: Function[]): (obj: any) => any {\n return compose.apply(null, [].slice.call(arguments).reverse());\n}\n\n/**\n * Given a property name, returns a function that returns that property from an object\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = prop(\"name\");\n * getName(obj) === \"blarg\"\n */\nexport const prop = (name: string) =>\n (obj: any) => obj && obj[name];\n\n/**\n * Given a property name and a value, returns a function that returns a boolean based on whether\n * the passed object has a property that matches the value\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = propEq(\"name\", \"blarg\");\n * getName(obj) === true\n */\nexport const propEq = curry((name: string, val: any, obj: any) => obj && obj[name] === val);\n\n/**\n * Given a dotted property name, returns a function that returns a nested property from an object, or undefined\n * let obj = { id: 1, nestedObj: { foo: 1, name: \"blarg\" }, };\n * let getName = prop(\"nestedObj.name\");\n * getName(obj) === \"blarg\"\n * let propNotFound = prop(\"this.property.doesnt.exist\");\n * propNotFound(obj) === undefined\n */\nexport const parse = (name: string) =>\n pipe.apply(null, name.split(\".\").map(prop));\n\n/**\n * Given a function that returns a truthy or falsey value, returns a\n * function that returns the opposite (falsey or truthy) value given the same inputs\n */\nexport const not: (fn: Predicate) => Predicate = (fn: Predicate) =>\n (...args: any[]) => !fn.apply(null, args);\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if both functions return truthy for the given arguments\n */\nexport function and(fn1: Predicate, fn2: Predicate): Predicate {\n return (...args: any[]) => fn1.apply(null, args) && fn2.apply(null, args);\n}\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if at least one of the functions returns truthy for the given arguments\n */\nexport function or(fn1: Predicate, fn2: Predicate): Predicate {\n return (...args: any[]) => fn1.apply(null, args) || fn2.apply(null, args);\n}\n\n/**\n * Check if all the elements of an array match a predicate function\n *\n * @param fn1 a predicate function `fn1`\n * @returns a function which takes an array and returns true if `fn1` is true for all elements of the array\n */\nexport const all = (fn1: Predicate) =>\n (arr: any[]) => arr.reduce((b, x) => b && !!fn1(x), true) as boolean;\nexport const any = (fn1: Predicate) =>\n (arr: any[]) => arr.reduce((b, x) => b || !!fn1(x), false) as boolean;\n\n/** Given a class, returns a Predicate function that returns true if the object is of that class */\nexport const is = (ctor: { new(...args): T }) =>\n (obj: any): obj is T =>\n (obj != null && obj.constructor === ctor || obj instanceof ctor);\n\n/** Given a value, returns a Predicate function that returns true if another value is === equal to the original value */\nexport const eq: (comp: any) => Predicate = (val: any) => (other: any) =>\n val === other;\n\n/** Given a value, returns a function which returns the value */\nexport const val = (v: T) => () => v;\n\n\n\nexport function invoke(fnName: string): Function;\nexport function invoke(fnName: string, args: any[]): Function;\nexport function invoke(fnName: string, args?: any[]): Function {\n return (obj: any) =>\n obj[fnName].apply(obj, args);\n}\n\n/**\n * Sorta like Pattern Matching (a functional programming conditional construct)\n *\n * See http://c2.com/cgi/wiki?PatternMatching\n *\n * This is a conditional construct which allows a series of predicates and output functions\n * to be checked and then applied. Each predicate receives the input. If the predicate\n * returns truthy, then its matching output function (mapping function) is provided with\n * the input and, then the result is returned.\n *\n * Each combination (2-tuple) of predicate + output function should be placed in an array\n * of size 2: [ predicate, mapFn ]\n *\n * These 2-tuples should be put in an outer array.\n *\n * @example\n * ```\n *\n * // Here's a 2-tuple where the first element is the isString predicate\n * // and the second element is a function that returns a description of the input\n * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];\n *\n * // Second tuple: predicate \"isNumber\", mapfn returns a description\n * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];\n *\n * let third = [ (input) => input === null, (input) => `Oh, null...` ];\n *\n * let fourth = [ (input) => input === undefined, (input) => `notdefined` ];\n *\n * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);\n *\n * console.log(descriptionOf(undefined)); // 'notdefined'\n * console.log(descriptionOf(55)); // '(55) That's a number!'\n * console.log(descriptionOf(\"foo\")); // 'Here's your string foo'\n * ```\n *\n * @param struct A 2D array. Each element of the array should be an array, a 2-tuple,\n * with a Predicate and a mapping/output function\n * @returns {function(any): *}\n */\nexport function pattern(struct: Function[][]): Function {\n return function(x: any) {\n for (var i = 0; i < struct.length; i++) {\n if (struct[i][0](x)) return struct[i][1](x);\n }\n };\n}\n\n","/**\n * @coreapi\n * @module core\n */\n/** \n * Matches state names using glob-like pattern strings.\n *\n * Globs can be used in specific APIs including:\n *\n * - [[StateService.is]]\n * - [[StateService.includes]]\n * - The first argument to Hook Registration functions like [[TransitionService.onStart]]\n * - [[HookMatchCriteria]] and [[HookMatchCriterion]]\n *\n * A `Glob` string is a pattern which matches state names.\n * Nested state names are split into segments (separated by a dot) when processing.\n * The state named `foo.bar.baz` is split into three segments ['foo', 'bar', 'baz']\n *\n * Globs work according to the following rules:\n *\n * ### Exact match:\n *\n * The glob `'A.B'` matches the state named exactly `'A.B'`.\n *\n * | Glob |Matches states named|Does not match state named|\n * |:------------|:--------------------|:---------------------|\n * | `'A'` | `'A'` | `'B'` , `'A.C'` |\n * | `'A.B'` | `'A.B'` | `'A'` , `'A.B.C'` |\n * | `'foo'` | `'foo'` | `'FOO'` , `'foo.bar'`|\n *\n * ### Single star (`*`)\n *\n * A single star (`*`) is a wildcard that matches exactly one segment.\n *\n * | Glob |Matches states named |Does not match state named |\n * |:------------|:---------------------|:--------------------------|\n * | `'*'` | `'A'` , `'Z'` | `'A.B'` , `'Z.Y.X'` |\n * | `'A.*'` | `'A.B'` , `'A.C'` | `'A'` , `'A.B.C'` |\n * | `'A.*.*'` | `'A.B.C'` , `'A.X.Y'`| `'A'`, `'A.B'` , `'Z.Y.X'`|\n *\n * ### Double star (`**`)\n *\n * A double star (`'**'`) is a wildcard that matches *zero or more segments*\n *\n * | Glob |Matches states named |Does not match state named |\n * |:------------|:----------------------------------------------|:----------------------------------|\n * | `'**'` | `'A'` , `'A.B'`, `'Z.Y.X'` | (matches all states) |\n * | `'A.**'` | `'A'` , `'A.B'` , `'A.C.X'` | `'Z.Y.X'` |\n * | `'**.X'` | `'X'` , `'A.X'` , `'Z.Y.X'` | `'A'` , `'A.login.Z'` |\n * | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` |\n *\n */\nexport class Glob {\n text: string;\n glob: Array;\n regexp: RegExp;\n\n constructor(text: string) {\n this.text = text;\n this.glob = text.split('.');\n\n let regexpString = this.text.split('.')\n .map(seg => {\n if (seg === '**') return '(?:|(?:\\\\.[^.]*)*)';\n if (seg === '*') return '\\\\.[^.]*';\n return '\\\\.' + seg;\n }).join('');\n\n this.regexp = new RegExp(\"^\" + regexpString + \"$\");\n }\n\n matches(name: string) {\n return this.regexp.test('.' + name);\n }\n\n /** Returns true if the string has glob-like characters in it */\n static is(text: string) {\n return !!/[!,*]+/.exec(text);\n }\n\n /** Returns a glob from the string, or null if the string isn't Glob-like */\n static fromString(text: string) {\n return Glob.is(text) ? new Glob(text) : null;\n }\n}\n","/**\n * @coreapi\n * @module state\n */\n/** for typedoc */\nimport { StateDeclaration, _ViewDeclaration, _StateDeclaration, LazyLoadResult } from \"./interface\";\nimport { defaults, values, find, inherit } from \"../common/common\";\nimport { propEq } from \"../common/hof\";\nimport { Param } from \"../params/param\";\nimport { UrlMatcher } from \"../url/urlMatcher\";\nimport { Resolvable } from \"../resolve/resolvable\";\nimport { TransitionStateHookFn } from \"../transition/interface\";\nimport { TargetState } from \"./targetState\";\nimport { Transition } from \"../transition/transition\";\nimport { Glob } from \"../common/glob\";\nimport { isObject, isFunction } from \"../common/predicates\";\n\n/**\n * Internal representation of a UI-Router state.\n *\n * Instances of this class are created when a [[StateDeclaration]] is registered with the [[StateRegistry]].\n *\n * A registered [[StateDeclaration]] is augmented with a getter ([[StateDeclaration.$$state]]) which returns the corresponding [[StateObject]] object.\n *\n * This class prototypally inherits from the corresponding [[StateDeclaration]].\n * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]].\n */\nexport class StateObject {\n /** The parent [[StateObject]] */\n public parent: StateObject;\n\n /** The name used to register the state */\n public name: string;\n\n /** Prototypally inherits from [[StateDeclaration.abstract]] */\n public abstract: boolean;\n\n /** Prototypally inherits from [[StateDeclaration.resolve]] */\n public resolve: ({ [key: string]: (string|any[]|Function) }|any[]);\n\n /** A list of [[Resolvable]] objects. The internal representation of [[resolve]]. */\n public resolvables: Resolvable[];\n\n /** Prototypally inherits from [[StateDeclaration.resolvePolicy]] */\n public resolvePolicy: any;\n\n /** A compiled URLMatcher which detects when the state's URL is matched */\n public url: UrlMatcher;\n\n /** The parameters for the state, built from the URL and [[StateDeclaration.params]] */\n public params: { [key: string]: Param };\n\n /**\n * The views for the state.\n * Note: `@uirouter/core` does not register a builder for views.\n * The framework specific code should register a `views` builder.\n */\n public views: { [key: string]: _ViewDeclaration; };\n\n /**\n * The original [[StateDeclaration]] used to build this [[StateObject]].\n * Note: `this` object also prototypally inherits from the `self` declaration object.\n */\n public self: StateDeclaration;\n\n /** The nearest parent [[StateObject]] which has a URL */\n public navigable: StateObject;\n\n /** The parent [[StateObject]] objects from this state up to the root */\n public path: StateObject[];\n\n /**\n * Prototypally inherits from [[StateDeclaration.data]]\n * Note: This is the only field on the [[StateDeclaration]] which is mutated.\n * The definition object's `data` field is replaced with a new object\n * which prototypally inherits from the parent state definition's `data` field.\n */\n public data: any;\n\n /** \n * An object containing the parent States' names as keys and \n * true as their values.\n */\n public includes: { [name: string]: boolean };\n\n /** Prototypally inherits from [[StateDeclaration.onExit]] */\n public onExit: TransitionStateHookFn;\n /** Prototypally inherits from [[StateDeclaration.onRetain]] */\n public onRetain: TransitionStateHookFn;\n /** Prototypally inherits from [[StateDeclaration.onEnter]] */\n public onEnter: TransitionStateHookFn;\n\n /** Prototypally inherits from [[StateDeclaration.lazyLoad]] */\n public lazyLoad: (transition: Transition, state: StateDeclaration) => Promise;\n\n /** Prototypally inherits from [[StateDeclaration.redirectTo]] */\n redirectTo: (\n string |\n (($transition$: Transition) => TargetState) |\n { state: (string|StateDeclaration), params: { [key: string]: any }}\n );\n\n /** @hidden */\n __stateObjectCache: {\n /** Might be null */\n nameGlob?: Glob\n };\n\n\n /** @deprecated use State.create() */\n constructor(config?: StateDeclaration) {\n return StateObject.create(config || {});\n }\n\n /**\n * Create a state object to put the private/internal implementation details onto.\n * The object's prototype chain looks like:\n * (Internal State Object) -> (Copy of State.prototype) -> (State Declaration object) -> (State Declaration's prototype...)\n *\n * @param stateDecl the user-supplied State Declaration\n * @returns {StateObject} an internal State object\n */\n static create(stateDecl: _StateDeclaration): StateObject {\n stateDecl = StateObject.isStateClass(stateDecl) ? new stateDecl() : stateDecl;\n\n let state = inherit(inherit(stateDecl, StateObject.prototype)) as StateObject;\n stateDecl.$$state = () => state;\n state.self = stateDecl;\n state.__stateObjectCache = {\n nameGlob: Glob.fromString(state.name) // might return null\n };\n return state;\n }\n\n /** Predicate which returns true if the object is an class with @State() decorator */\n static isStateClass = (stateDecl: _StateDeclaration): stateDecl is ({ new (): StateDeclaration }) =>\n isFunction(stateDecl) && stateDecl['__uiRouterState'] === true;\n\n /** Predicate which returns true if the object is an internal [[StateObject]] object */\n static isState = (obj: any): obj is StateObject =>\n isObject(obj['__stateObjectCache']);\n\n /**\n * Returns true if the provided parameter is the same state.\n *\n * Compares the identity of the state against the passed value, which is either an object\n * reference to the actual `State` instance, the original definition object passed to\n * `$stateProvider.state()`, or the fully-qualified name.\n *\n * @param ref Can be one of (a) a `State` instance, (b) an object that was passed\n * into `$stateProvider.state()`, (c) the fully-qualified name of a state as a string.\n * @returns Returns `true` if `ref` matches the current `State` instance.\n */\n is(ref: StateObject|StateDeclaration|string): boolean {\n return this === ref || this.self === ref || this.fqn() === ref;\n }\n\n /**\n * @deprecated this does not properly handle dot notation\n * @returns Returns a dot-separated name of the state.\n */\n fqn(): string {\n if (!this.parent || !(this.parent instanceof this.constructor)) return this.name;\n let name = this.parent.fqn();\n return name ? name + \".\" + this.name : this.name;\n }\n\n /**\n * Returns the root node of this state's tree.\n *\n * @returns The root of this state's tree.\n */\n root(): StateObject {\n return this.parent && this.parent.root() || this;\n }\n\n /**\n * Gets the state's `Param` objects\n *\n * Gets the list of [[Param]] objects owned by the state.\n * If `opts.inherit` is true, it also includes the ancestor states' [[Param]] objects.\n * If `opts.matchingKeys` exists, returns only `Param`s whose `id` is a key on the `matchingKeys` object\n *\n * @param opts options\n */\n parameters(opts?: { inherit?: boolean, matchingKeys?: any }): Param[] {\n opts = defaults(opts, { inherit: true, matchingKeys: null });\n let inherited = opts.inherit && this.parent && this.parent.parameters() || [];\n return inherited.concat(values(this.params))\n .filter(param => !opts.matchingKeys || opts.matchingKeys.hasOwnProperty(param.id));\n }\n\n /**\n * Returns a single [[Param]] that is owned by the state\n *\n * If `opts.inherit` is true, it also searches the ancestor states` [[Param]]s.\n * @param id the name of the [[Param]] to return\n * @param opts options\n */\n parameter(id: string, opts: { inherit?: boolean } = {}): Param {\n return (\n this.url && this.url.parameter(id, opts) ||\n find(values(this.params), propEq('id', id)) ||\n opts.inherit && this.parent && this.parent.parameter(id)\n );\n }\n\n toString() {\n return this.fqn();\n }\n}\n","/** Predicates\n *\n * These predicates return true/false based on the input.\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_predicates\n */\n/** */\nimport { and, not, pipe, prop, or } from \"./hof\";\nimport { Predicate } from \"./common\"; // has or is using\nimport { StateObject } from \"../state/stateObject\";\n\nconst toStr = Object.prototype.toString;\nconst tis = (t: string) => (x: any) => typeof(x) === t;\nexport const isUndefined = tis('undefined');\nexport const isDefined = not(isUndefined);\nexport const isNull = (o: any) => o === null;\nexport const isNullOrUndefined = or(isNull, isUndefined);\nexport const isFunction: (x: any) => x is Function = tis('function');\nexport const isNumber: (x: any) => x is number = tis('number');\nexport const isString = <(x: any) => x is string> tis('string');\nexport const isObject = (x: any) => x !== null && typeof x === 'object';\nexport const isArray = Array.isArray;\nexport const isDate: (x: any) => x is Date = ((x: any) => toStr.call(x) === '[object Date]');\nexport const isRegExp: (x: any) => x is RegExp = ((x: any) => toStr.call(x) === '[object RegExp]');\nexport const isState: (x: any) => x is StateObject = StateObject.isState;\n\n/**\n * Predicate which checks if a value is injectable\n *\n * A value is \"injectable\" if it is a function, or if it is an ng1 array-notation-style array\n * where all the elements in the array are Strings, except the last one, which is a Function\n */\nexport function isInjectable(val: any) {\n if (isArray(val) && val.length) {\n let head = val.slice(0, -1), tail = val.slice(-1);\n return !(head.filter(not(isString)).length || tail.filter(not(isFunction)).length);\n }\n return isFunction(val);\n}\n\n/**\n * Predicate which checks if a value looks like a Promise\n *\n * It is probably a Promise if it's an object, and it has a `then` property which is a Function\n */\nexport const isPromise = <(x: any) => x is Promise> and(isObject, pipe(prop('then'), isFunction));\n\n","/**\n * This module is a stub for core services such as Dependency Injection or Browser Location.\n * Core services may be implemented by a specific framework, such as ng1 or ng2, or be pure javascript.\n *\n * @module common\n */\n/** for typedoc */\nimport {IInjectable, Obj} from \"./common\";\nimport { Disposable } from \"../interface\";\nimport { UrlParts } from \"../url/interface\";\n\nexport let notImplemented = (fnname: string) => () => {\n throw new Error(`${fnname}(): No coreservices implementation for UI-Router is loaded.`);\n};\n\nlet services: CoreServices = {\n $q: undefined,\n $injector: undefined,\n};\n\nexport interface $QLikeDeferred {\n resolve: (val?: any) => void;\n reject: (reason?: any) => void;\n promise: Promise;\n}\n\nexport interface $QLike {\n when(value?: T | PromiseLike): Promise;\n reject(reason: any): Promise;\n defer(): $QLikeDeferred;\n all(promises: { [key: string]: Promise }): Promise;\n all(promises: Promise[]): Promise;\n}\n\nexport interface $InjectorLike {\n get(token: any): any;\n get(token: any): T;\n has(token: any): boolean;\n invoke(fn: IInjectable, context?: any, locals?: Obj): any;\n annotate(fn: IInjectable, strictDi?: boolean): any[];\n strictDi?: boolean;\n}\n\nexport interface CoreServices {\n $q: $QLike;\n $injector: $InjectorLike;\n}\n\nexport interface LocationServices extends Disposable {\n /**\n * Gets the current url string\n *\n * The URL is normalized using the internal [[path]]/[[search]]/[[hash]] values.\n *\n * For example, the URL may be stored in the hash ([[HashLocationServices]]) or\n * have a base HREF prepended ([[PushStateLocationServices]]).\n *\n * The raw URL in the browser might be:\n *\n * ```\n * http://mysite.com/somepath/index.html#/internal/path/123?param1=foo#anchor\n * ```\n *\n * or\n *\n * ```\n * http://mysite.com/basepath/internal/path/123?param1=foo#anchor\n * ```\n *\n * then this method returns:\n *\n * ```\n * /internal/path/123?param1=foo#anchor\n * ```\n *\n *\n * #### Example:\n * ```js\n * locationServices.url(); // \"/some/path?query=value#anchor\"\n * ```\n *\n * @returns the current value of the url, as a string.\n */\n url(): string;\n\n /**\n * Updates the url, or gets the current url\n *\n * Updates the url, changing it to the value in `newurl`\n *\n * #### Example:\n * ```js\n * locationServices.url(\"/some/path?query=value#anchor\", true);\n * ```\n *\n * @param newurl The new value for the URL.\n * This url should reflect only the new internal [[path]], [[search]], and [[hash]] values.\n * It should not include the protocol, site, port, or base path of an absolute HREF.\n * @param replace When true, replaces the current history entry (instead of appending it) with this new url\n * @param state The history's state object, i.e., pushState (if the LocationServices implementation supports it)\n * @return the url (after potentially being processed)\n */\n url(newurl: string, replace?: boolean, state?: any): string;\n\n /**\n * Gets the path part of the current url\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`\n *\n * @return the path portion of the url\n */\n path(): string;\n\n /**\n * Gets the search part of the current url as an object\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`\n *\n * @return the search (querystring) portion of the url, as an object\n */\n search(): { [key: string]: any };\n\n /**\n * Gets the hash part of the current url\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `anchor`\n *\n * @return the hash (anchor) portion of the url\n */\n hash(): string;\n\n /**\n * Registers a url change handler\n *\n * #### Example:\n * ```js\n * let deregisterFn = locationServices.onChange((evt) => console.log(\"url change\", evt));\n * ```\n *\n * @param callback a function that will be called when the url is changing\n * @return a function that de-registers the callback\n */\n onChange(callback: Function): Function;\n}\n\n/**\n * This service returns the location configuration\n *\n * This service returns information about the location configuration.\n * This service is primarily used when building URLs (e.g., for `hrefs`)\n */\nexport interface LocationConfig extends Disposable {\n /**\n * Gets the port, e.g., `80`\n *\n * @return the port number\n */\n port(): number;\n /**\n * Gets the protocol, e.g., `http`\n *\n * @return the protocol\n */\n protocol(): string;\n /**\n * Gets the host, e.g., `localhost`\n *\n * @return the protocol\n */\n host(): string;\n /**\n * Gets the base Href, e.g., `http://localhost/approot/`\n *\n * @return the application's base href\n */\n baseHref(): string;\n /**\n * Returns true when running in pushstate mode\n *\n * @return true when running in pushstate mode\n */\n html5Mode(): boolean;\n /**\n * Gets the hashPrefix (when not running in pushstate mode)\n *\n * If the current url is `http://localhost/app#!/uirouter/path/#anchor`, it returns `!` which is the prefix for the \"hashbang\" portion.\n *\n * @return the hash prefix\n */\n hashPrefix(): string;\n /**\n * Sets the hashPrefix (when not running in pushstate mode)\n *\n * @return the new hash prefix\n */\n hashPrefix(newprefix: string): string;\n}\n\nexport {services};\n","/**\n * Random utility functions used in the UI-Router code\n *\n * These functions are exported, but are subject to change without notice.\n *\n * @preferred\n * @module common\n */\n/** for typedoc */\nimport { isFunction, isString, isArray, isRegExp, isDate } from \"./predicates\";\nimport { all, any, prop, curry, not } from \"./hof\";\nimport { services } from \"./coreservices\";\nimport { StateObject } from \"../state/stateObject\";\n\nlet w: any = typeof window === 'undefined' ? {} : window;\nlet angular = w.angular || {};\nexport const fromJson = angular.fromJson || JSON.parse.bind(JSON);\nexport const toJson = angular.toJson || JSON.stringify.bind(JSON);\nexport const forEach = angular.forEach || _forEach;\nexport const extend = Object.assign || _extend;\nexport const equals = angular.equals || _equals;\nexport function identity(x: any) { return x; }\nexport function noop(): any {}\n\nexport type Mapper = (x: X, key?: (string|number)) => T;\nexport interface TypedMap { [key: string]: T; }\nexport type Predicate = (x?: X) => boolean;\n/**\n * An ng1-style injectable\n *\n * This could be a (non-minified) function such as:\n * ```js\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an explicitly annotated function (minify safe)\n * ```js\n * injectableFunction.$inject = [ 'SomeDependency' ];\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an array style annotated function (minify safe)\n * ```js\n * ['SomeDependency', function injectableFunction(SomeDependency) {\n *\n * }];\n * ```\n *\n * @publicapi\n */\nexport type IInjectable = (Function|any[]);\n\nexport interface Obj extends Object {\n [key: string]: any;\n}\n\n/**\n * Builds proxy functions on the `to` object which pass through to the `from` object.\n *\n * For each key in `fnNames`, creates a proxy function on the `to` object.\n * The proxy function calls the real function on the `from` object.\n *\n *\n * #### Example:\n * This example creates an new class instance whose functions are prebound to the new'd object.\n * ```js\n * class Foo {\n * constructor(data) {\n * // Binds all functions from Foo.prototype to 'this',\n * // then copies them to 'this'\n * bindFunctions(Foo.prototype, this, this);\n * this.data = data;\n * }\n *\n * log() {\n * console.log(this.data);\n * }\n * }\n *\n * let myFoo = new Foo([1,2,3]);\n * var logit = myFoo.log;\n * logit(); // logs [1, 2, 3] from the myFoo 'this' instance\n * ```\n *\n * #### Example:\n * This example creates a bound version of a service function, and copies it to another object\n * ```\n *\n * var SomeService = {\n * this.data = [3, 4, 5];\n * this.log = function() {\n * console.log(this.data);\n * }\n * }\n *\n * // Constructor fn\n * function OtherThing() {\n * // Binds all functions from SomeService to SomeService,\n * // then copies them to 'this'\n * bindFunctions(SomeService, this, SomeService);\n * }\n *\n * let myOtherThing = new OtherThing();\n * myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this'\n * ```\n *\n * @param source A function that returns the source object which contains the original functions to be bound\n * @param target A function that returns the target object which will receive the bound functions\n * @param bind A function that returns the object which the functions will be bound to\n * @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object)\n * @param latebind If true, the binding of the function is delayed until the first time it's invoked\n */\nexport function createProxyFunctions(source: Function, target: Obj, bind: Function, fnNames?: string[], latebind = false): Obj {\n const bindFunction = (fnName) =>\n source()[fnName].bind(bind());\n\n const makeLateRebindFn = fnName => function lateRebindFunction() {\n target[fnName] = bindFunction(fnName);\n return target[fnName].apply(null, arguments);\n };\n\n fnNames = fnNames || Object.keys(source());\n\n return fnNames.reduce((acc, name) => {\n acc[name] = latebind ? makeLateRebindFn(name) : bindFunction(name);\n return acc;\n }, target);\n}\n\n\n/**\n * prototypal inheritance helper.\n * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it\n */\nexport const inherit = (parent: Obj, extra?: Obj) =>\n extend(Object.create(parent), extra);\n\n/** Given an array, returns true if the object is found in the array, (using indexOf) */\nexport const inArray: typeof _inArray = curry(_inArray) as any;\nexport function _inArray(array: any[], obj: any): boolean;\nexport function _inArray(array: any[]): (obj: any) => boolean;\nexport function _inArray(array, obj?): any {\n return array.indexOf(obj) !== -1;\n}\n\n/**\n * Given an array, and an item, if the item is found in the array, it removes it (in-place).\n * The same array is returned\n */\nexport const removeFrom: typeof _removeFrom = curry(_removeFrom) as any;\nexport function _removeFrom(array: T[], obj: T): T[];\nexport function _removeFrom(array: T[]): (obj: T) => T[];\nexport function _removeFrom(array, obj?) {\n let idx = array.indexOf(obj);\n if (idx >= 0) array.splice(idx, 1);\n return array;\n}\n\n/** pushes a values to an array and returns the value */\nexport const pushTo: typeof _pushTo = curry(_pushTo) as any;\nexport function _pushTo(arr: T[], val: T): T ;\nexport function _pushTo(arr: T[]): (val: T) => T ;\nexport function _pushTo(arr, val?): any {\n return (arr.push(val), val);\n}\n\n/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */\nexport const deregAll = (functions: Function[]) =>\n functions.slice().forEach(fn => {\n typeof fn === 'function' && fn();\n removeFrom(functions, fn);\n });\n/**\n * Applies a set of defaults to an options object. The options object is filtered\n * to only those properties of the objects in the defaultsList.\n * Earlier objects in the defaultsList take precedence when applying defaults.\n */\nexport function defaults(opts, ...defaultsList: Obj[]) {\n let _defaultsList = defaultsList.concat({}).reverse();\n let defaultVals = extend.apply(null, _defaultsList);\n return extend({}, defaultVals, pick(opts || {}, Object.keys(defaultVals)));\n}\n\n/** Reduce function that merges each element of the list into a single object, using extend */\nexport const mergeR = (memo: Obj, item: Obj) => extend(memo, item);\n\n/**\n * Finds the common ancestor path between two states.\n *\n * @param {Object} first The first state.\n * @param {Object} second The second state.\n * @return {Array} Returns an array of state names in descending order, not including the root.\n */\nexport function ancestors(first: StateObject, second: StateObject) {\n let path: StateObject[] = [];\n\n for (let n in first.path) {\n if (first.path[n] !== second.path[n]) break;\n path.push(first.path[n]);\n }\n return path;\n}\n\n/**\n * Return a copy of the object only containing the whitelisted properties.\n *\n * #### Example:\n * ```\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the whitelisted property names\n */\nexport function pick(obj: Obj, propNames: string[]): Obj {\n let objCopy = {};\n for (let prop in obj) {\n if (propNames.indexOf(prop) !== -1) {\n objCopy[prop] = obj[prop];\n }\n }\n return objCopy;\n}\n\n/**\n * Return a copy of the object omitting the blacklisted properties.\n *\n * @example\n * ```\n *\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = omit(foo, ['a', 'b']); // { c: 3 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the blacklisted property names\n */\nexport function omit(obj: Obj, propNames: string[]): Obj {\n return Object.keys(obj)\n .filter(not(inArray(propNames)))\n .reduce((acc, key) => (acc[key] = obj[key], acc), {});\n}\n\n\n/** Given an array of objects, maps each element to a named property of the element. */\nexport function pluck(collection: Obj[], propName: string): T[];\n/** Given an object, maps each property of the object to a named property of the property. */\nexport function pluck(collection: { [key: string]: any }, propName: string): { [key: string]: any };\n/**\n * Maps an array, or object to a property (by name)\n */\nexport function pluck(collection: any, propName: string): any {\n return map(collection, > prop(propName));\n}\n\n\n/** Given an array of objects, returns a new array containing only the elements which passed the callback predicate */\nexport function filter(collection: T[], callback: (t: T, key?: number) => boolean): T[];\n/** Given an object, returns a new object with only those properties that passed the callback predicate */\nexport function filter(collection: TypedMap, callback: (t: T, key?: string) => boolean): TypedMap;\n/** Filters an Array or an Object's properties based on a predicate */\nexport function filter(collection: any, callback: Function): T {\n let arr = isArray(collection), result: any = arr ? [] : {};\n let accept = arr ? x => result.push(x) : (x, key) => result[key] = x;\n forEach(collection, function(item, i) {\n if (callback(item, i)) accept(item, i);\n });\n return result;\n}\n\n\n/** Given an object, return the first property of that object which passed the callback predicate */\nexport function find(collection: TypedMap, callback: Predicate): T;\n/** Given an array of objects, returns the first object which passed the callback predicate */\nexport function find(collection: T[], callback: Predicate): T;\n/** Finds an object from an array, or a property of an object, that matches a predicate */\nexport function find(collection: any, callback: any) {\n let result;\n\n forEach(collection, function(item, i) {\n if (result) return;\n if (callback(item, i)) result = item;\n });\n\n return result;\n}\n\n/** Given an object, returns a new object, where each property is transformed by the callback function */\nexport let mapObj: (collection: { [key: string]: T }, callback: Mapper) => { [key: string]: U } = map;\n/** Given an array, returns a new array, where each element is transformed by the callback function */\nexport function map(collection: T[], callback: Mapper): U[];\nexport function map(collection: { [key: string]: T }, callback: Mapper): { [key: string]: U };\n/** Maps an array or object properties using a callback function */\nexport function map(collection: any, callback: any): any {\n let result = isArray(collection) ? [] : {};\n forEach(collection, (item, i) => result[i] = callback(item, i));\n return result;\n}\n\n/**\n * Given an object, return its enumerable property values\n *\n * @example\n * ```\n *\n * let foo = { a: 1, b: 2, c: 3 }\n * let vals = values(foo); // [ 1, 2, 3 ]\n * ```\n */\nexport const values: ( (obj: TypedMap) => T[]) = (obj: Obj) =>\n Object.keys(obj).map(key => obj[key]);\n\n/**\n * Reduce function that returns true if all of the values are truthy.\n *\n * @example\n * ```\n *\n * let vals = [ 1, true, {}, \"hello world\"];\n * vals.reduce(allTrueR, true); // true\n *\n * vals.push(0);\n * vals.reduce(allTrueR, true); // false\n * ```\n */\nexport const allTrueR = (memo: boolean, elem: any) => memo && elem;\n\n/**\n * Reduce function that returns true if any of the values are truthy.\n *\n * * @example\n * ```\n *\n * let vals = [ 0, null, undefined ];\n * vals.reduce(anyTrueR, true); // false\n *\n * vals.push(\"hello world\");\n * vals.reduce(anyTrueR, true); // true\n * ```\n */\nexport const anyTrueR = (memo: boolean, elem: any) => memo || elem;\n\n/**\n * Reduce function which un-nests a single level of arrays\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnestR = (memo: any[], elem: any[]) => memo.concat(elem);\n\n/**\n * Reduce function which recursively un-nests all arrays\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flattenR = (memo: any[], elem: any) =>\n isArray(elem) ? memo.concat(elem.reduce(flattenR, [])) : pushR(memo, elem);\n\n/**\n * Reduce function that pushes an object to an array, then returns the array.\n * Mostly just for [[flattenR]] and [[uniqR]]\n */\nexport function pushR(arr: any[], obj: any) {\n arr.push(obj);\n return arr;\n}\n\n/** Reduce function that filters out duplicates */\nexport const uniqR = (acc: T[], token: T): T[] =>\n inArray(acc, token) ? acc : pushR(acc, token);\n\n/**\n * Return a new array with a single level of arrays unnested.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * unnest(input) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnest = (arr: any[]) => arr.reduce(unnestR, []);\n/**\n * Return a completely flattened version of an array.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * flatten(input) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flatten = (arr: any[]) => arr.reduce(flattenR, []);\n\n/**\n * Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass.\n * @example\n * ```\n *\n * let isNumber = (obj) => typeof(obj) === 'number';\n * let allNumbers = [ 1, 2, 3, 4, 5 ];\n * allNumbers.filter(assertPredicate(isNumber)); //OK\n *\n * let oneString = [ 1, 2, 3, 4, \"5\" ];\n * oneString.filter(assertPredicate(isNumber, \"Not all numbers\")); // throws Error(\"\"Not all numbers\"\");\n * ```\n */\nexport const assertPredicate: (predicate: Predicate, errMsg: (string|Function)) => Predicate = assertFn;\n/**\n * Given a .map function, builds a .map function which throws an error if any mapped elements do not pass a truthyness test.\n * @example\n * ```\n *\n * var data = { foo: 1, bar: 2 };\n *\n * let keys = [ 'foo', 'bar' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // values is [1, 2]\n *\n * let keys = [ 'foo', 'bar', 'baz' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // throws Error(\"Key not found\")\n * ```\n */\nexport const assertMap: (mapFn: (t: T) => U, errMsg: (string|Function)) => (t: T) => U = assertFn;\nexport function assertFn(predicateOrMap: Function, errMsg: (string|Function) = \"assert failure\"): any {\n return (obj) => {\n let result = predicateOrMap(obj);\n if (!result) {\n throw new Error(isFunction(errMsg) ? ( errMsg)(obj) : errMsg);\n }\n return result;\n };\n}\n\n/**\n * Like _.pairs: Given an object, returns an array of key/value pairs\n *\n * @example\n * ```\n *\n * pairs({ foo: \"FOO\", bar: \"BAR }) // [ [ \"foo\", \"FOO\" ], [ \"bar\": \"BAR\" ] ]\n * ```\n */\nexport const pairs = (obj: Obj) =>\n Object.keys(obj).map(key => [ key, obj[key]] );\n\n/**\n * Given two or more parallel arrays, returns an array of tuples where\n * each tuple is composed of [ a[i], b[i], ... z[i] ]\n *\n * @example\n * ```\n *\n * let foo = [ 0, 2, 4, 6 ];\n * let bar = [ 1, 3, 5, 7 ];\n * let baz = [ 10, 30, 50, 70 ];\n * arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ]\n * arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ]\n * ```\n */\nexport function arrayTuples(...args: any[]): any[] {\n if (args.length === 0) return [];\n let maxArrayLen = args.reduce((min, arr) => Math.min(arr.length, min), 9007199254740991); // aka 2^53 − 1 aka Number.MAX_SAFE_INTEGER\n\n let i, result = [];\n\n for (i = 0; i < maxArrayLen; i++) {\n // This is a hot function\n // Unroll when there are 1-4 arguments\n switch (args.length) {\n case 1: result.push([args[0][i]]); break;\n case 2: result.push([args[0][i], args[1][i]]); break;\n case 3: result.push([args[0][i], args[1][i], args[2][i]]); break;\n case 4: result.push([args[0][i], args[1][i], args[2][i], args[3][i]]); break;\n default:\n result.push(args.map(array => array[i])); break;\n }\n }\n\n return result;\n}\n\n/**\n * Reduce function which builds an object from an array of [key, value] pairs.\n *\n * Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration.\n *\n * Each keyValueTuple should be an array with values [ key: string, value: any ]\n *\n * @example\n * ```\n *\n * var pairs = [ [\"fookey\", \"fooval\"], [\"barkey\", \"barval\"] ]\n *\n * var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n *\n * // Or, more simply:\n * var pairsToObj = pairs.reduce(applyPairs, {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n * ```\n */\nexport function applyPairs(memo: TypedMap, keyValTuple: any[]) {\n let key: string, value: any;\n if (isArray(keyValTuple)) [key, value] = keyValTuple;\n if (!isString(key)) throw new Error(\"invalid parameters to applyPairs\");\n memo[key] = value;\n return memo;\n}\n\n/** Get the last element of an array */\nexport function tail(arr: T[]): T {\n return arr.length && arr[arr.length - 1] || undefined;\n}\n\n/**\n * shallow copy from src to dest\n */\nexport function copy(src: Obj, dest?: Obj) {\n if (dest) Object.keys(dest).forEach(key => delete dest[key]);\n if (!dest) dest = {};\n return extend(dest, src);\n}\n\n/** Naive forEach implementation works with Objects or Arrays */\nfunction _forEach(obj: (any[]|any), cb: (el, idx?) => void, _this: Obj) {\n if (isArray(obj)) return obj.forEach(cb, _this);\n Object.keys(obj).forEach(key => cb(obj[key], key));\n}\n\n/** Like Object.assign() */\nexport function _extend(toObj: Obj, ...fromObjs: Obj[]): any;\nexport function _extend(toObj: Obj): any {\n for (let i = 1; i < arguments.length; i++) {\n let obj = arguments[i];\n if (!obj) continue;\n let keys = Object.keys(obj);\n\n for (let j = 0; j < keys.length; j++) {\n toObj[keys[j]] = obj[keys[j]];\n }\n }\n\n return toObj;\n}\n\nfunction _equals(o1: any, o2: any): boolean {\n if (o1 === o2) return true;\n if (o1 === null || o2 === null) return false;\n if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN\n let t1 = typeof o1, t2 = typeof o2;\n if (t1 !== t2 || t1 !== 'object') return false;\n\n const tup = [o1, o2];\n if (all(isArray)(tup)) return _arraysEq(o1, o2);\n if (all(isDate)(tup)) return o1.getTime() === o2.getTime();\n if (all(isRegExp)(tup)) return o1.toString() === o2.toString();\n if (all(isFunction)(tup)) return true; // meh\n\n let predicates = [isFunction, isArray, isDate, isRegExp];\n if (predicates.map(any).reduce((b, fn) => b || !!fn(tup), false)) return false;\n\n let key: string, keys: { [i: string]: boolean } = {};\n for (key in o1) {\n if (!_equals(o1[key], o2[key])) return false;\n keys[key] = true;\n }\n for (key in o2) {\n if (!keys[key]) return false;\n }\n\n return true;\n}\n\nfunction _arraysEq(a1: any[], a2: any[]) {\n if (a1.length !== a2.length) return false;\n return arrayTuples(a1, a2).reduce((b, t) => b && _equals(t[0], t[1]), true);\n}\n\n// issue #2676\nexport const silenceUncaughtInPromise = (promise: Promise) =>\n promise.catch(e => 0) && promise;\nexport const silentRejection = (error: any) =>\n silenceUncaughtInPromise(services.$q.reject(error));\n","/**\n * @module common\n */ /** for typedoc */\n\nexport class Queue {\n constructor(private _items: T[] = [], private _limit: number = null) { }\n\n enqueue(item: T) {\n let items = this._items;\n items.push(item);\n if (this._limit && items.length > this._limit) items.shift();\n return item;\n }\n\n dequeue(): T {\n if (this.size())\n return this._items.splice(0, 1)[0];\n }\n\n clear(): Array {\n let current = this._items;\n this._items = [];\n return current;\n }\n\n size(): number {\n return this._items.length;\n }\n\n remove(item: T) {\n let idx = this._items.indexOf(item);\n return idx > -1 && this._items.splice(idx, 1)[0];\n }\n\n peekTail(): T {\n return this._items[this._items.length - 1];\n }\n\n peekHead(): T {\n if (this.size())\n return this._items[0];\n }\n}\n","/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\n\"use strict\";\nimport {extend, silentRejection} from \"../common/common\";\nimport {stringify} from \"../common/strings\";\nimport { is } from '../common/hof';\n\nexport enum RejectType {\n SUPERSEDED = 2, ABORTED = 3, INVALID = 4, IGNORED = 5, ERROR = 6\n}\n\n/** @hidden */ let id = 0;\n\nexport class Rejection {\n $id = id++;\n type: number;\n message: string;\n detail: any;\n redirected: boolean;\n\n constructor(type: number, message?: string, detail?: any) {\n this.type = type;\n this.message = message;\n this.detail = detail;\n }\n\n toString() {\n const detailString = (d: any) => \n d && d.toString !== Object.prototype.toString ? d.toString() : stringify(d);\n let detail = detailString(this.detail);\n let { $id, type, message } = this;\n return `Transition Rejection($id: ${$id} type: ${type}, message: ${message}, detail: ${detail})`;\n }\n\n toPromise(): Promise {\n return extend(silentRejection(this), { _transitionRejection: this });\n }\n\n /** Returns true if the obj is a rejected promise created from the `asPromise` factory */\n static isRejectionPromise(obj: any): boolean {\n return obj && (typeof obj.then === 'function') && is(Rejection)(obj._transitionRejection);\n }\n\n /** Returns a Rejection due to transition superseded */\n static superseded(detail?: any, options?: any): Rejection {\n let message = \"The transition has been superseded by a different transition\";\n let rejection = new Rejection(RejectType.SUPERSEDED, message, detail);\n if (options && options.redirected) {\n rejection.redirected = true;\n }\n return rejection;\n }\n\n /** Returns a Rejection due to redirected transition */\n static redirected(detail?: any): Rejection {\n return Rejection.superseded(detail, { redirected: true });\n }\n\n /** Returns a Rejection due to invalid transition */\n static invalid(detail?: any): Rejection {\n let message = \"This transition is invalid\";\n return new Rejection(RejectType.INVALID, message, detail);\n }\n\n /** Returns a Rejection due to ignored transition */\n static ignored(detail?: any): Rejection {\n let message = \"The transition was ignored\";\n return new Rejection(RejectType.IGNORED, message, detail);\n }\n\n /** Returns a Rejection due to aborted transition */\n static aborted(detail?: any): Rejection {\n let message = \"The transition has been aborted\";\n return new Rejection(RejectType.ABORTED, message, detail);\n }\n\n /** Returns a Rejection due to aborted transition */\n static errored(detail?: any): Rejection {\n let message = \"The transition errored\";\n return new Rejection(RejectType.ERROR, message, detail);\n }\n \n /**\n * Returns a Rejection\n *\n * Normalizes a value as a Rejection.\n * If the value is already a Rejection, returns it.\n * Otherwise, wraps and returns the value as a Rejection (Rejection type: ERROR).\n *\n * @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection.\n */\n static normalize(detail?: Rejection | Error | any): Rejection {\n return is(Rejection)(detail) ? detail : Rejection.errored(detail);\n }\n}\n","/**\n * # Transition tracing (debug)\n *\n * Enable transition tracing to print transition information to the console,\n * in order to help debug your application.\n * Tracing logs detailed information about each Transition to your console.\n *\n * To enable tracing, import the [[Trace]] singleton and enable one or more categories.\n *\n * ### ES6\n * ```js\n * import {trace} from \"ui-router-ng2\"; // or \"angular-ui-router\"\n * trace.enable(1, 5); // TRANSITION and VIEWCONFIG\n * ```\n *\n * ### CJS\n * ```js\n * let trace = require(\"angular-ui-router\").trace; // or \"ui-router-ng2\"\n * trace.enable(\"TRANSITION\", \"VIEWCONFIG\");\n * ```\n *\n * ### Globals\n * ```js\n * let trace = window[\"angular-ui-router\"].trace; // or \"ui-router-ng2\"\n * trace.enable(); // Trace everything (very verbose)\n * ```\n *\n * ### Angular 1:\n * ```js\n * app.run($trace => $trace.enable());\n * ```\n *\n * @coreapi\n * @module trace\n */ /** for typedoc */\nimport {parse} from \"../common/hof\";\nimport {isFunction, isNumber} from \"../common/predicates\";\nimport {Transition} from \"../transition/transition\";\nimport {ActiveUIView, ViewConfig, ViewContext} from \"../view/interface\";\nimport {stringify, functionToString, maxLength, padString} from \"./strings\";\nimport {Resolvable} from \"../resolve/resolvable\";\nimport {PathNode} from \"../path/pathNode\";\nimport {PolicyWhen} from \"../resolve/interface\";\nimport {TransitionHook} from \"../transition/transitionHook\";\nimport {HookResult} from \"../transition/interface\";\nimport {StateObject} from \"../state/stateObject\";\n\n/** @hidden */\nfunction uiViewString (uiview: ActiveUIView) {\n if (!uiview) return 'ui-view (defunct)';\n const state = uiview.creationContext ? uiview.creationContext.name || '(root)' : '(none)';\n return `[ui-view#${uiview.id} ${uiview.$type}:${uiview.fqn} (${uiview.name}@${state})]`;\n}\n\n/** @hidden */\nconst viewConfigString = (viewConfig: ViewConfig) => {\n let view = viewConfig.viewDecl;\n const state = view.$context.name || '(root)';\n return `[View#${viewConfig.$id} from '${state}' state]: target ui-view: '${view.$uiViewName}@${view.$uiViewContextAnchor}'`;\n};\n\n/** @hidden */\nfunction normalizedCat(input: Category|string): string {\n return isNumber(input) ? Category[input] : Category[Category[input]];\n}\n\n/** @hidden */\nconst consoletable = isFunction(console.table) ? console.table.bind(console) : console.log.bind(console);\n\n/**\n * Trace categories Enum\n *\n * Enable or disable a category using [[Trace.enable]] or [[Trace.disable]]\n *\n * `trace.enable(Category.TRANSITION)`\n *\n * These can also be provided using a matching string, or position ordinal\n *\n * `trace.enable(\"TRANSITION\")`\n *\n * `trace.enable(1)`\n */\nexport enum Category {\n RESOLVE, TRANSITION, HOOK, UIVIEW, VIEWCONFIG,\n}\n\n/** @hidden */ const _tid = parse(\"$id\");\n/** @hidden */ const _rid = parse(\"router.$id\");\n/** @hidden */ const transLbl = (trans) => `Transition #${_tid(trans)}-${_rid(trans)}`;\n\n/**\n * Prints UI-Router Transition trace information to the console.\n */\nexport class Trace {\n /** @hidden */\n approximateDigests: number;\n\n /** @hidden */\n constructor() {\n this.approximateDigests = 0;\n }\n\n /** @hidden */\n private _enabled: { [key: string]: boolean } = {};\n\n /** @hidden */\n private _set(enabled: boolean, categories: Category[]) {\n if (!categories.length) {\n categories = Object.keys(Category)\n .map(k => parseInt(k, 10))\n .filter(k => !isNaN(k))\n .map(key => Category[key]);\n }\n categories.map(normalizedCat).forEach(category => this._enabled[category] = enabled);\n }\n\n /**\n * Enables a trace [[Category]]\n *\n * ```js\n * trace.enable(\"TRANSITION\");\n * ```\n *\n * @param categories categories to enable. If `categories` is omitted, all categories are enabled.\n * Also takes strings (category name) or ordinal (category position)\n */\n enable(...categories: (Category|string|number)[]);\n enable(...categories: any[]) { this._set(true, categories); }\n /**\n * Disables a trace [[Category]]\n *\n * ```js\n * trace.disable(\"VIEWCONFIG\");\n * ```\n *\n * @param categories categories to disable. If `categories` is omitted, all categories are disabled.\n * Also takes strings (category name) or ordinal (category position)\n */\n disable(...categories: (Category|string|number)[]);\n disable(...categories: any[]) { this._set(false, categories); }\n\n /**\n * Retrieves the enabled stateus of a [[Category]]\n *\n * ```js\n * trace.enabled(\"VIEWCONFIG\"); // true or false\n * ```\n *\n * @returns boolean true if the category is enabled\n */\n enabled(category: (Category|string|number)): boolean {\n return !!this._enabled[normalizedCat(category)];\n }\n\n /** @internalapi called by ui-router code */\n traceTransitionStart(trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: Started -> ${stringify(trans)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceTransitionIgnored(trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: Ignored <> ${stringify(trans)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceHookInvocation(step: TransitionHook, trans: Transition, options: any) {\n if (!this.enabled(Category.HOOK)) return;\n let event = parse(\"traceData.hookType\")(options) || \"internal\",\n context = parse(\"traceData.context.state.name\")(options) || parse(\"traceData.context\")(options) || \"unknown\",\n name = functionToString((step as any).registeredHook.callback);\n console.log(`${transLbl(trans)}: Hook -> ${event} context: ${context}, ${maxLength(200, name)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceHookResult(hookResult: HookResult, trans: Transition, transitionOptions: any) {\n if (!this.enabled(Category.HOOK)) return;\n console.log(`${transLbl(trans)}: <- Hook returned: ${maxLength(200, stringify(hookResult))}`);\n }\n\n /** @internalapi called by ui-router code */\n traceResolvePath(path: PathNode[], when: PolicyWhen, trans?: Transition) {\n if (!this.enabled(Category.RESOLVE)) return;\n console.log(`${transLbl(trans)}: Resolving ${path} (${when})`);\n }\n\n /** @internalapi called by ui-router code */\n traceResolvableResolved(resolvable: Resolvable, trans?: Transition) {\n if (!this.enabled(Category.RESOLVE)) return;\n console.log(`${transLbl(trans)}: <- Resolved ${resolvable} to: ${maxLength(200, stringify(resolvable.data))}`);\n }\n\n /** @internalapi called by ui-router code */\n traceError(reason: any, trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: <- Rejected ${stringify(trans)}, reason: ${reason}`);\n }\n\n /** @internalapi called by ui-router code */\n traceSuccess(finalState: StateObject, trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: <- Success ${stringify(trans)}, final state: ${finalState.name}`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewEvent(event: string, viewData: ActiveUIView, extra = \"\") {\n if (!this.enabled(Category.UIVIEW)) return;\n console.log(`ui-view: ${padString(30, event)} ${uiViewString(viewData)}${extra}`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewConfigUpdated(viewData: ActiveUIView, context: ViewContext) {\n if (!this.enabled(Category.UIVIEW)) return;\n this.traceUIViewEvent(\"Updating\", viewData, ` with ViewConfig from context='${context}'`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewFill(viewData: ActiveUIView, html: string) {\n if (!this.enabled(Category.UIVIEW)) return;\n this.traceUIViewEvent(\"Fill\", viewData, ` with: ${maxLength(200, html)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceViewSync(pairs: any[]) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n const mapping = pairs.map(([ uiViewData, config ]) => {\n const uiView = `${uiViewData.$type}:${uiViewData.fqn}`;\n const view = config && `${config.viewDecl.$context.name}: ${config.viewDecl.$name} (${config.viewDecl.$type})`;\n\n return { 'ui-view fqn': uiView, 'state: view name': view };\n }).sort((a, b) => a['ui-view fqn'].localeCompare(b['ui-view fqn']));\n\n consoletable(mapping);\n }\n\n /** @internalapi called by ui-router code */\n traceViewServiceEvent(event: string, viewConfig: ViewConfig) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n console.log(`VIEWCONFIG: ${event} ${viewConfigString(viewConfig)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceViewServiceUIViewEvent(event: string, viewData: ActiveUIView) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n console.log(`VIEWCONFIG: ${event} ${uiViewString(viewData)}`);\n }\n}\n\n/**\n * The [[Trace]] singleton\n *\n * #### Example:\n * ```js\n * import {trace} from \"angular-ui-router\";\n * trace.enable(1, 5);\n * ```\n */\nlet trace = new Trace();\nexport {trace};\n","/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\nimport {StateDeclaration} from \"../state/interface\";\nimport {Predicate} from \"../common/common\";\n\nimport {Transition} from \"./transition\";\nimport {StateObject} from \"../state/stateObject\";\nimport {PathNode} from \"../path/pathNode\";\nimport {TargetState} from \"../state/targetState\";\nimport {RegisteredHook} from \"./hookRegistry\";\n\n/**\n * The TransitionOptions object can be used to change the behavior of a transition.\n *\n * It is passed as the third argument to [[StateService.go]], [[StateService.transitionTo]].\n * It can also be used with a `uiSref`.\n */\nexport interface TransitionOptions {\n /**\n * This option changes how the Transition interacts with the browser's location bar (URL).\n *\n * - If `true`, it will update the url in the location bar.\n * - If `false`, it will not update the url in the location bar.\n * - If it is the string `\"replace\"`, it will update the url and also replace the last history record.\n *\n * @default `true`\n */\n location ?: (boolean|string);\n\n /**\n * When transitioning to relative path (e.g '`^`'), this option defines which state to be relative from.\n * @default `$state.current`\n */\n relative ?: (string|StateDeclaration|StateObject);\n\n /**\n * This option sets whether or not the transition's parameter values should be inherited from\n * the current parameter values.\n *\n * - If `true`, it will inherit parameter values from the current parameter values.\n * - If `false`, only the parameters which are provided to `transitionTo` will be used.\n *\n * @default `false`\n */\n inherit ?: boolean;\n\n /**\n * @deprecated\n */\n notify ?: boolean;\n\n /**\n * This option may be used to force states which are currently active to reload.\n *\n * During a normal transition, a state is \"retained\" if:\n * - It was previously active\n * - The state's parameter values have not changed\n * - All the parent states' parameter values have not changed\n *\n * Forcing a reload of a state will cause it to be exited and entered, which will:\n * - Refetch that state's resolve data\n * - Exit the state (onExit hook)\n * - Re-enter the state (onEnter hook)\n * - Re-render the views (controllers and templates)\n *\n * - When `true`, the destination state (and all parent states) will be reloaded.\n * - When it is a string and is the name of a state, or when it is a State object,\n * that state and any children states will be reloaded.\n *\n * @default `false`\n */\n reload ?: (boolean|string|StateDeclaration|StateObject);\n /**\n * You can define your own Transition Options inside this property and use them, e.g., from a Transition Hook\n */\n custom ?: any;\n /** @internalapi */\n reloadState ?: (StateObject);\n /** @internalapi\n * If this transition is a redirect, this property should be the original Transition (which was redirected to this one)\n */\n redirectedFrom?: Transition;\n /** @internalapi */\n current ?: () => Transition;\n /** @internalapi */\n source ?: \"sref\" | \"url\" | \"redirect\" | \"otherwise\" | \"unknown\";\n}\n\n/** @internalapi */\nexport interface TransitionHookOptions {\n current ?: () => Transition; //path?\n transition ?: Transition;\n hookType ?: string;\n target ?: any;\n traceData ?: any;\n bind ?: any;\n stateHook ?: boolean;\n}\n\n/**\n * TreeChanges encapsulates the various Paths that are involved in a Transition.\n *\n * Get a TreeChanges object using [[Transition.treeChanges]]\n *\n * A UI-Router Transition is from one Path in a State Tree to another Path. For a given Transition,\n * this object stores the \"to\" and \"from\" paths, as well as subsets of those: the \"retained\",\n * \"exiting\" and \"entering\" paths.\n *\n * Each path in TreeChanges is an array of [[PathNode]] objects. Each PathNode in the array corresponds to a portion\n * of a nested state.\n *\n * For example, if you had a nested state named `foo.bar.baz`, it would have three\n * portions, `foo, bar, baz`. If you transitioned **to** `foo.bar.baz` and inspected the [[TreeChanges.to]]\n * Path, you would find a node in the array for each portion: `foo`, `bar`, and `baz`.\n *\n * ---\n *\n * @todo show visual state tree\n */\nexport interface TreeChanges {\n /** @nodoc */\n [key: string]: PathNode[];\n\n /** The path of nodes in the state tree that the transition is coming *from* */\n from: PathNode[];\n\n /** The path of nodes in the state tree that the transition is going *to* */\n to: PathNode[];\n\n /**\n * The path of active nodes that the transition is retaining.\n *\n * These nodes are neither exited, nor entered.\n * Before and after the transition is successful, these nodes are active.\n */\n retained: PathNode[];\n\n /**\n * The path of previously active nodes that the transition is exiting.\n *\n * After the Transition is successful, these nodes are no longer active.\n *\n * Note that a state that is being reloaded (due to parameter values changing, or `reload: true`) may be in both the\n * `exiting` and `entering` paths.\n */\n exiting: PathNode[];\n\n /**\n * The path of nodes that the transition is entering.\n *\n * After the Transition is successful, these nodes will be active.\n * Because they are entering, they have their resolves fetched, `onEnter` hooks run, and their views\n * (component(s) or controller(s)+template(s)) refreshed.\n *\n * Note that a state that is reloaded (due to parameter values changing, or `reload: true`) may be in both the\n * `exiting` and `entering` paths.\n */\n entering: PathNode[];\n}\n\nexport type IHookRegistration = (matchCriteria: HookMatchCriteria, callback: HookFn, options?: HookRegOptions) => Function;\n\n/**\n * The signature for Transition Hooks.\n *\n * Transition hooks are callback functions that hook into the lifecycle of transitions.\n * As a transition runs, it reaches certain lifecycle events.\n * As each event occurs, the hooks which are registered for the event are called (in priority order).\n *\n * A transition hook may alter a Transition by returning a [[HookResult]].\n *\n * #### See:\n *\n * - [[IHookRegistry.onBefore]]\n * - [[IHookRegistry.onStart]]\n * - [[IHookRegistry.onFinish]]\n * - [[IHookRegistry.onSuccess]]\n * - [[IHookRegistry.onError]]\n *\n * @param transition the current [[Transition]]\n * @param injector (for ng1 or ng2 only) the injector service\n *\n * @returns a [[HookResult]] which may alter the transition\n *\n */\nexport interface TransitionHookFn {\n (transition: Transition) : HookResult;\n}\n\n/**\n * The signature for Transition State Hooks.\n *\n * A function which hooks into a lifecycle event for a specific state.\n *\n * Transition State Hooks are callback functions that hook into the lifecycle events of specific states during a transition.\n * As a transition runs, it may exit some states, retain (keep) states, and enter states.\n * As each lifecycle event occurs, the hooks which are registered for the event and that state are called (in priority order).\n *\n * #### See:\n *\n * - [[IHookRegistry.onExit]]\n * - [[IHookRegistry.onRetain]]\n * - [[IHookRegistry.onEnter]]\n *\n * @param transition the current [[Transition]]\n * @param state the [[StateObject]] that the hook is bound to\n * @param injector (for ng1 or ng2 only) the injector service\n *\n * @returns a [[HookResult]] which may alter the transition\n */\nexport interface TransitionStateHookFn {\n (transition: Transition, state: StateDeclaration) : HookResult;\n}\n\n/**\n * The signature for Transition onCreate Hooks.\n *\n * Transition onCreate Hooks are callbacks that allow customization or preprocessing of\n * a Transition before it is returned from [[TransitionService.create]]\n *\n * @param transition the [[Transition]] that was just created\n * @return a [[Transition]] which will then be returned from [[TransitionService.create]]\n */\nexport interface TransitionCreateHookFn {\n (transition: Transition): void;\n}\n\nexport type HookFn = (TransitionHookFn|TransitionStateHookFn|TransitionCreateHookFn);\n\n/**\n * The return value of a [[TransitionHookFn]] or [[TransitionStateHookFn]]\n *\n * When returned from a [[TransitionHookFn]] or [[TransitionStateHookFn]], these values alter the running [[Transition]]:\n *\n * - `false`: the transition will be cancelled.\n * - [[TargetState]]: the transition will be redirected to the new target state (see: [[StateService.target]])\n * - `Promise`: the transition will wait for the promise to resolve or reject\n * - If the promise is rejected (or resolves to `false`), the transition will be cancelled\n * - If the promise resolves to a [[TargetState]], the transition will be redirected\n * - If the promise resolves to anything else, the transition will resume\n * - Anything else: the transition will resume\n */\nexport type HookResult = (boolean | TargetState | void | Promise);\n\n/**\n * These options may be provided when registering a Transition Hook (such as `onStart`)\n */\nexport interface HookRegOptions {\n /**\n * Sets the priority of the registered hook\n *\n * Hooks of the same type (onBefore, onStart, etc) are invoked in priority order. A hook with a higher priority\n * is invoked before a hook with a lower priority.\n *\n * The default hook priority is 0\n */\n priority?: number;\n\n /**\n * Specifies what `this` is bound to during hook invocation.\n */\n bind?: any;\n}\n\n/**\n * This interface specifies the api for registering Transition Hooks. Both the\n * [[TransitionService]] and also the [[Transition]] object itself implement this interface.\n * Note: the Transition object only allows hooks to be registered before the Transition is started.\n */\nexport interface IHookRegistry {\n /**\n * Registers a [[TransitionHookFn]], called *before a transition starts*.\n *\n * Registers a transition lifecycle hook, which is invoked before a transition even begins.\n * This hook can be useful to implement logic which prevents a transition from even starting, such\n * as authentication, redirection\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onBefore` hooks are invoked *before a Transition starts*.\n * No resolves have been fetched yet.\n * Each `onBefore` hook is invoked synchronously, in the same call stack as [[StateService.transitionTo]].\n * The registered `onBefore` hooks are invoked in priority order.\n *\n * Note: during the `onBefore` phase, additional hooks can be added to the specific [[Transition]] instance.\n * These \"on-the-fly\" hooks only affect the currently running transition..\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * If any hook modifies the transition *synchronously* (by throwing, returning `false`, or returning\n * a [[TargetState]]), the remainder of the hooks are skipped.\n * If a hook returns a promise, the remainder of the `onBefore` hooks are still invoked synchronously.\n * All promises are resolved, and processed asynchronously before the `onStart` phase of the Transition.\n *\n * ### Examples\n *\n * #### Default Substate\n *\n * This example redirects any transition from 'home' to 'home.dashboard'. This is commonly referred to as a\n * \"default substate\".\n *\n * @example\n * ```js\n * // ng2\n * transitionService.onBefore({ to: 'home' }, (trans: Transition) =>\n * trans.router.stateService.target(\"home.dashboard\"));\n * ```\n *\n * #### Data Driven Default Substate\n *\n * This example provides data-driven default substate functionality. It matches on a transition to any state\n * which has `defaultSubstate: \"some.sub.state\"` defined. See: [[Transition.to]] which returns the \"to state\"\n * definition.\n *\n * @example\n * ```js\n * // ng1\n * // state declaration\n * {\n * name: 'home',\n * template: '
    ',\n * defaultSubstate: 'home.dashboard'\n * }\n *\n * var criteria = {\n * to: function(state) {\n * return state.defaultSubstate != null;\n * }\n * }\n *\n * $transitions.onBefore(criteria, function(trans: Transition) {\n * var substate = trans.to().defaultSubstate;\n * return trans.router.stateService.target(substate);\n * });\n * ```\n *\n *\n * #### Require authentication\n *\n * This example cancels a transition to a state which requires authentication, if the user is not currently authenticated.\n *\n * This example assumes a state tree where all states which require authentication are children of a parent `'requireauth'` state.\n * This example assumes `MyAuthService` synchronously returns a boolean from `isAuthenticated()`.\n *\n * #### Example:\n * ```js\n * // ng1\n * $transitions.onBefore( { to: 'requireauth.**' }, function(trans) {\n * var myAuthService = trans.injector().get('MyAuthService');\n * // If isAuthenticated returns false, the transition is cancelled.\n * return myAuthService.isAuthenticated();\n * });\n * ```\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be invoked.\n * @returns a function which deregisters the hook.\n */\n onBefore(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called when a transition starts.\n *\n * Registers a transition lifecycle hook, which is invoked as a transition starts running.\n * This hook can be useful to perform some asynchronous action before completing a transition.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onStart` hooks are invoked asynchronously when the Transition starts running.\n * This happens after the `onBefore` phase is complete.\n * At this point, the Transition has not yet exited nor entered any states.\n * The registered `onStart` hooks are invoked in priority order.\n *\n * Note: A built-in `onStart` hook with high priority is used to fetch any eager resolve data.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Example\n *\n * #### Login during transition\n *\n * This example intercepts any transition to a state which requires authentication, when the user is\n * not currently authenticated. It allows the user to authenticate asynchronously, then resumes the\n * transition. If the user did not authenticate successfully, it redirects to the \"guest\" state, which\n * does not require authentication.\n *\n * This example assumes:\n * - a state tree where all states which require authentication are children of a parent `'auth'` state.\n * - `MyAuthService.isAuthenticated()` synchronously returns a boolean.\n * - `MyAuthService.authenticate()` presents a login dialog, and returns a promise which is resolved\n * or rejected, whether or not the login attempt was successful.\n *\n * #### Example:\n * ```js\n * // ng1\n * $transitions.onStart( { to: 'auth.**' }, function(trans) {\n * var $state = trans.router.stateService;\n * var MyAuthService = trans.injector().get('MyAuthService');\n *\n * // If the user is not authenticated\n * if (!MyAuthService.isAuthenticated()) {\n *\n * // Then return a promise for a successful login.\n * // The transition will wait for this promise to settle\n *\n * return MyAuthService.authenticate().catch(function() {\n *\n * // If the authenticate() method failed for whatever reason,\n * // redirect to a 'guest' state which doesn't require auth.\n * return $state.target(\"guest\");\n * });\n * }\n * });\n * ```\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onStart(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is entered.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being entered.\n *\n * Since this hook is run only when the specific state is being *entered*, it can be useful for\n * performing tasks when entering a submodule/feature area such as initializing a stateful service, \n * or for guarding access to a submodule/feature area.\n *\n * See [[TransitionStateHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onEnter` hooks generally specify `{ entering: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onEnter` hooks are invoked when the Transition is entering a state.\n * States are entered after the `onRetain` phase is complete.\n * If more than one state is being entered, the parent state is entered first.\n * The registered `onEnter` hooks for a state are invoked in priority order.\n *\n * Note: A built-in `onEnter` hook with high priority is used to fetch lazy resolve data for states being entered.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onEnter` hooks using the [[TransitionService]], you may define an `onEnter` hook\n * directly on a state declaration (see: [[StateDeclaration.onEnter]]).\n * \n *\n * ### Examples\n *\n * #### Audit Log\n *\n * This example uses a service to log that a user has entered the admin section of an app.\n * This assumes that there are substates of the \"admin\" state, such as \"admin.users\", \"admin.pages\", etc.\n * @example\n * ```\n *\n * $transitions.onEnter({ entering: 'admin' }, function(transition, state) {\n * var AuditService = trans.injector().get('AuditService');\n * AuditService.log(\"Entered \" + state.name + \" module while transitioning to \" + transition.to().name);\n * }\n * ```\n *\n * #### Audit Log (inside a state declaration)\n *\n * The `onEnter` inside this state declaration is syntactic sugar for the previous Audit Log example.\n * ```\n * {\n * name: 'admin',\n * component: 'admin',\n * onEnter: function($transition$, $state$) {\n * var AuditService = $transition$.injector().get('AuditService');\n * AuditService.log(\"Entered \" + state.name + \" module while transitioning to \" + transition.to().name);\n * }\n * }\n * ```\n *\n * Note: A state declaration's `onEnter` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onEnter(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is retained/kept.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) for\n * a specific state that was previously active will remain active (is not being entered nor exited).\n * \n * This hook is invoked when a state is \"retained\" or \"kept\".\n * It means the transition is coming *from* a substate of the retained state *to* a substate of the retained state.\n * This hook can be used to perform actions when the user moves from one substate to another, such as between steps in a wizard.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onRetain` hooks generally specify `{ retained: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onRetain` hooks are invoked after any `onExit` hooks have been fired.\n * If more than one state is retained, the child states' `onRetain` hooks are invoked first.\n * The registered `onRetain` hooks for a state are invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onRetain` hooks using the [[TransitionService]], you may define an `onRetain` hook\n * directly on a state declaration (see: [[StateDeclaration.onRetain]]).\n *\n * Note: A state declaration's `onRetain` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onRetain(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is exited.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being exited.\n *\n * Since this hook is run only when the specific state is being *exited*, it can be useful for\n * performing tasks when leaving a submodule/feature area such as cleaning up a stateful service, \n * or for preventing the user from leaving a state or submodule until some criteria is satisfied.\n *\n * See [[TransitionStateHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onExit` hooks generally specify `{ exiting: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onExit` hooks are invoked when the Transition is exiting a state.\n * States are exited after any `onStart` phase is complete.\n * If more than one state is being exited, the child states are exited first.\n * The registered `onExit` hooks for a state are invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onExit` hooks using the [[TransitionService]], you may define an `onExit` hook\n * directly on a state declaration (see: [[StateDeclaration.onExit]]).\n *\n * Note: A state declaration's `onExit` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onExit(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called *just before a transition finishes*.\n *\n * Registers a transition lifecycle hook, which is invoked just before a transition finishes.\n * This hook is a last chance to cancel or redirect a transition.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onFinish` hooks are invoked after the `onEnter` phase is complete.\n * These hooks are invoked just before the transition is \"committed\".\n * Each hook is invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onFinish(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called after a successful transition completed.\n *\n * Registers a transition lifecycle hook, which is invoked after a transition successfully completes.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onSuccess` hooks are chained off the Transition's promise (see [[Transition.promise]]).\n * If the Transition is successful and its promise is resolved, then the `onSuccess` hooks are invoked.\n * Since these hooks are run after the transition is over, their return value is ignored.\n * The `onSuccess` hooks are invoked in priority order.\n *\n * ### Return value\n *\n * Since the Transition is already completed, the hook's return value is ignored\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onSuccess(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called after a transition has errored.\n *\n * Registers a transition lifecycle hook, which is invoked after a transition has been rejected for any reason.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * The `onError` hooks are chained off the Transition's promise (see [[Transition.promise]]).\n * If a Transition fails, its promise is rejected and the `onError` hooks are invoked.\n * The `onError` hooks are invoked in priority order.\n *\n * Since these hooks are run after the transition is over, their return value is ignored.\n *\n * A transition \"errors\" if it was started, but failed to complete (for any reason).\n * A *non-exhaustive list* of reasons a transition can error:\n *\n * - A transition was cancelled because a new transition started while it was still running (`Transition superseded`)\n * - A transition was cancelled by a Transition Hook returning false\n * - A transition was redirected by a Transition Hook returning a [[TargetState]]\n * - A Transition Hook or resolve function threw an error\n * - A Transition Hook returned a rejected promise\n * - A resolve function returned a rejected promise\n *\n * To check the failure reason, inspect the return value of [[Transition.error]].\n * \n * Note: `onError` should be used for targeted error handling, or error recovery.\n * For simple catch-all error reporting, use [[StateService.defaultErrorHandler]].\n *\n * ### Return value\n *\n * Since the Transition is already completed, the hook's return value is ignored\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onError(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Returns all the registered hooks of a given `hookName` type\n *\n * #### Example:\n * ```\n * $transitions.getHooks(\"onEnter\")\n * ```\n */\n getHooks(hookName: string): RegisteredHook[];\n\n /** @hidden place to store the hooks */\n _registeredHooks: { [key: string]: RegisteredHook[] };\n}\n\n/** A predicate type which tests if a [[StateDeclaration]] passes some test. Returns a boolean. */\nexport type IStateMatch = Predicate\n\n/**\n * This object is used to configure whether or not a Transition Hook is invoked for a particular transition,\n * based on the Transition's \"to state\" and \"from state\".\n *\n * Each property (`to`, `from`, `exiting`, `retained`, and `entering`) can be a state [[Glob]] string,\n * a boolean, or a function that takes a state and returns a boolean (see [[HookMatchCriterion]])\n *\n * All properties are optional. If any property is omitted, it is replaced with the value `true`, and always matches.\n * To match any transition, use an empty criteria object `{}`.\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from the `parent` state and going to the `parent.child` state.\n * var match = {\n * to: 'parent',\n * from: 'parent.child'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any substate of `parent` and going directly to the `parent` state.\n * var match = {\n * to: 'parent',\n * from: 'parent.**'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any state and going to any substate of `mymodule`\n * var match = {\n * to: 'mymodule.**'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any state and going to any state that has `data.authRequired`\n * // set to a truthy value.\n * var match = {\n * to: function(state) {\n * return state.data != null && state.data.authRequired === true;\n * }\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition that is exiting `parent.child`\n * var match = {\n * exiting: 'parent.child'\n * }\n * ```\n */\nexport interface HookMatchCriteria {\n [key: string]: HookMatchCriterion | undefined;\n\n /** A [[HookMatchCriterion]] to match the destination state */\n to?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match the original (from) state */\n from?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be exiting */\n exiting?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be retained */\n retained?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be entering */\n entering?: HookMatchCriterion;\n}\n\nexport interface IMatchingNodes {\n [key: string]: PathNode[];\n\n to: PathNode[];\n from: PathNode[];\n exiting: PathNode[];\n retained: PathNode[];\n entering: PathNode[];\n}\n\n/** @hidden */\nexport interface RegisteredHooks {\n [key: string]: RegisteredHook[];\n}\n\n/** @hidden */\nexport interface PathTypes {\n [key: string]: PathType;\n\n to: PathType;\n from: PathType;\n exiting: PathType;\n retained: PathType;\n entering: PathType;\n}\n\n/** @hidden */\nexport interface PathType {\n name: string;\n scope: TransitionHookScope;\n}\n\n/**\n * Hook Criterion used to match a transition.\n *\n * A [[Glob]] string that matches the name of a state.\n *\n * Or, a function with the signature `function(state) { return matches; }`\n * which should return a boolean to indicate if a state matches.\n *\n * Or, `true` to always match\n */\nexport type HookMatchCriterion = (string|IStateMatch|boolean)\n\nexport enum TransitionHookPhase { CREATE, BEFORE, RUN, SUCCESS, ERROR }\nexport enum TransitionHookScope { TRANSITION, STATE }\n","/**\n * @coreapi\n * @module state\n */ /** for typedoc */\n\nimport { StateDeclaration, StateOrName, TargetStateDef } from \"./interface\";\nimport { TransitionOptions } from \"../transition/interface\";\nimport { StateObject } from \"./stateObject\";\nimport { isString } from \"../common/predicates\";\nimport { stringify } from '../common/strings';\nimport { extend } from '../common';\nimport { StateRegistry } from './stateRegistry';\nimport { RawParams } from '../params';\n\n/**\n * Encapsulate the target (destination) state/params/options of a [[Transition]].\n *\n * This class is frequently used to redirect a transition to a new destination.\n *\n * See:\n *\n * - [[HookResult]]\n * - [[TransitionHookFn]]\n * - [[TransitionService.onStart]]\n *\n * To create a `TargetState`, use [[StateService.target]].\n *\n * ---\n *\n * This class wraps:\n *\n * 1) an identifier for a state\n * 2) a set of parameters\n * 3) and transition options\n * 4) the registered state object (the [[StateDeclaration]])\n *\n * Many UI-Router APIs such as [[StateService.go]] take a [[StateOrName]] argument which can\n * either be a *state object* (a [[StateDeclaration]] or [[StateObject]]) or a *state name* (a string).\n * The `TargetState` class normalizes those options.\n *\n * A `TargetState` may be valid (the state being targeted exists in the registry)\n * or invalid (the state being targeted is not registered).\n */\nexport class TargetState {\n private _definition: StateObject;\n private _params: RawParams;\n private _options: TransitionOptions;\n\n /**\n * The TargetState constructor\n *\n * Note: Do not construct a `TargetState` manually.\n * To create a `TargetState`, use the [[StateService.target]] factory method.\n *\n * @param _stateRegistry The StateRegistry to use to look up the _definition\n * @param _identifier An identifier for a state.\n * Either a fully-qualified state name, or the object used to define the state.\n * @param _params Parameters for the target state\n * @param _options Transition options.\n *\n * @internalapi\n */\n constructor(\n private _stateRegistry: StateRegistry,\n private _identifier: StateOrName,\n _params?: RawParams,\n _options?: TransitionOptions,\n ) {\n this._identifier = _identifier;\n this._params = extend({}, _params || {});\n this._options = extend({}, _options || {});\n this._definition = _stateRegistry.matcher.find(_identifier, this._options.relative);\n }\n\n /** The name of the state this object targets */\n name(): string {\n return this._definition && this._definition.name || this._identifier;\n }\n\n /** The identifier used when creating this TargetState */\n identifier(): StateOrName {\n return this._identifier;\n }\n\n /** The target parameter values */\n params(): RawParams {\n return this._params;\n }\n\n /** The internal state object (if it was found) */\n $state(): StateObject {\n return this._definition;\n }\n\n /** The internal state declaration (if it was found) */\n state(): StateDeclaration {\n return this._definition && this._definition.self;\n }\n\n /** The target options */\n options() {\n return this._options;\n }\n\n /** True if the target state was found */\n exists(): boolean {\n return !!(this._definition && this._definition.self);\n }\n\n /** True if the object is valid */\n valid(): boolean {\n return !this.error();\n }\n\n /** If the object is invalid, returns the reason why */\n error(): string {\n let base = this.options().relative;\n if (!this._definition && !!base) {\n let stateName = base.name ? base.name : base;\n return `Could not resolve '${this.name()}' from state '${stateName}'`;\n }\n if (!this._definition)\n return `No such state '${this.name()}'`;\n if (!this._definition.self)\n return `State '${this.name()}' has an invalid definition`;\n }\n\n toString() {\n return `'${this.name()}'${stringify(this.params())}`;\n }\n\n /** Returns true if the object has a state property that might be a state or state name */\n static isDef = (obj): obj is TargetStateDef =>\n obj && obj.state && (isString(obj.state) || isString(obj.state.name));\n\n /**\n * Returns a copy of this TargetState which targets a different state.\n * The new TargetState has the same parameter values and transition options.\n *\n * @param state The new state that should be targeted\n */\n withState(state: StateOrName): TargetState {\n return new TargetState(this._stateRegistry, state, this._params, this._options);\n }\n\n /**\n * Returns a copy of this TargetState, using the specified parameter values.\n *\n * @param params the new parameter values to use\n * @param replace When false (default) the new parameter values will be merged with the current values.\n * When true the parameter values will be used instead of the current values.\n */\n withParams(params: RawParams, replace = false): TargetState {\n const newParams: RawParams = replace ? params : extend({}, this._params, params);\n return new TargetState(this._stateRegistry, this._identifier, newParams, this._options);\n }\n\n /**\n * Returns a copy of this TargetState, using the specified Transition Options.\n *\n * @param options the new options to use\n * @param replace When false (default) the new options will be merged with the current options.\n * When true the options will be used instead of the current options.\n */\n withOptions(options: TransitionOptions, replace = false): TargetState {\n const newOpts = replace ? options : extend({}, this._options, options);\n return new TargetState(this._stateRegistry, this._identifier, this._params, newOpts);\n }\n}\n","/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport { TransitionHookOptions, HookResult, TransitionHookPhase } from './interface';\nimport { defaults, noop, silentRejection } from '../common/common';\nimport { fnToString, maxLength } from '../common/strings';\nimport { isPromise } from '../common/predicates';\nimport { is, parse } from '../common/hof';\nimport { trace } from '../common/trace';\nimport { services } from '../common/coreservices';\nimport { Rejection } from './rejectFactory';\nimport { TargetState } from '../state/targetState';\nimport { Transition } from './transition';\nimport { TransitionEventType } from './transitionEventType';\nimport { RegisteredHook } from './hookRegistry';\nimport { StateDeclaration } from '../state/interface';\n\nlet defaultOptions: TransitionHookOptions = {\n current: noop,\n transition: null,\n traceData: {},\n bind: null,\n};\n\nexport type GetResultHandler = (hook: TransitionHook) => ResultHandler;\nexport type GetErrorHandler = (hook: TransitionHook) => ErrorHandler;\n\nexport type ResultHandler = (result: HookResult) => Promise;\nexport type ErrorHandler = (error: any) => Promise;\n\n/** @hidden */\nexport class TransitionHook {\n type: TransitionEventType;\n constructor(private transition: Transition,\n private stateContext: StateDeclaration,\n private registeredHook: RegisteredHook,\n private options: TransitionHookOptions) {\n this.options = defaults(options, defaultOptions);\n this.type = registeredHook.eventType;\n }\n\n /**\n * These GetResultHandler(s) are used by [[invokeHook]] below\n * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]])\n */\n static HANDLE_RESULT: GetResultHandler = (hook: TransitionHook) => (result: HookResult) =>\n hook.handleHookResult(result);\n\n /**\n * If the result is a promise rejection, log it.\n * Otherwise, ignore the result.\n */\n static LOG_REJECTED_RESULT: GetResultHandler = (hook: TransitionHook) => (result: HookResult) => {\n isPromise(result) && result.catch(err =>\n hook.logError(Rejection.normalize(err)));\n return undefined;\n }\n\n /**\n * These GetErrorHandler(s) are used by [[invokeHook]] below\n * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]])\n */\n static LOG_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) =>\n hook.logError(error);\n\n static REJECT_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) =>\n silentRejection(error);\n\n static THROW_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) => {\n throw error;\n }\n\n private isSuperseded = () =>\n this.type.hookPhase === TransitionHookPhase.RUN && !this.options.transition.isActive();\n\n logError(err): any {\n this.transition.router.stateService.defaultErrorHandler()(err);\n }\n\n invokeHook(): Promise | void {\n let hook = this.registeredHook;\n if (hook._deregistered) return;\n\n let notCurrent = this.getNotCurrentRejection();\n if (notCurrent) return notCurrent;\n\n let options = this.options;\n trace.traceHookInvocation(this, this.transition, options);\n\n const invokeCallback = () =>\n hook.callback.call(options.bind, this.transition, this.stateContext);\n\n const normalizeErr = err =>\n Rejection.normalize(err).toPromise();\n\n const handleError = err =>\n hook.eventType.getErrorHandler(this)(err);\n\n const handleResult = result =>\n hook.eventType.getResultHandler(this)(result);\n\n try {\n let result = invokeCallback();\n\n if (!this.type.synchronous && isPromise(result)) {\n return result.catch(normalizeErr)\n .then(handleResult, handleError);\n } else {\n return handleResult(result);\n }\n } catch (err) {\n // If callback throws (synchronously)\n return handleError(Rejection.normalize(err));\n }\n }\n\n /**\n * This method handles the return value of a Transition Hook.\n *\n * A hook can return false (cancel), a TargetState (redirect),\n * or a promise (which may later resolve to false or a redirect)\n *\n * This also handles \"transition superseded\" -- when a new transition\n * was started while the hook was still running\n */\n handleHookResult(result: HookResult): Promise {\n let notCurrent = this.getNotCurrentRejection();\n if (notCurrent) return notCurrent;\n\n // Hook returned a promise\n if (isPromise(result)) {\n // Wait for the promise, then reprocess with the resulting value\n return result.then(val => this.handleHookResult(val));\n }\n\n trace.traceHookResult(result, this.transition, this.options);\n\n // Hook returned false\n if (result === false) {\n // Abort this Transition\n return Rejection.aborted(\"Hook aborted transition\").toPromise();\n }\n\n const isTargetState = is(TargetState);\n // hook returned a TargetState\n if (isTargetState(result)) {\n // Halt the current Transition and redirect (a new Transition) to the TargetState.\n return Rejection.redirected(result).toPromise();\n }\n }\n\n\n /**\n * Return a Rejection promise if the transition is no longer current due\n * to a stopped router (disposed), or a new transition has started and superseded this one.\n */\n private getNotCurrentRejection() {\n let router = this.transition.router;\n\n // The router is stopped\n if (router._disposed) {\n return Rejection.aborted(`UIRouter instance #${router.$id} has been stopped (disposed)`).toPromise();\n }\n\n if (this.transition._aborted) {\n return Rejection.aborted().toPromise();\n }\n\n // This transition is no longer current.\n // Another transition started while this hook was still running.\n if (this.isSuperseded()) {\n // Abort this transition\n return Rejection.superseded(this.options.current()).toPromise();\n }\n }\n\n toString() {\n let { options, registeredHook } = this;\n let event = parse(\"traceData.hookType\")(options) || \"internal\",\n context = parse(\"traceData.context.state.name\")(options) || parse(\"traceData.context\")(options) || \"unknown\",\n name = fnToString(registeredHook.callback);\n return `${event} context: ${context}, ${maxLength(200, name)}`;\n }\n\n /**\n * Chains together an array of TransitionHooks.\n *\n * Given a list of [[TransitionHook]] objects, chains them together.\n * Each hook is invoked after the previous one completes.\n *\n * #### Example:\n * ```js\n * var hooks: TransitionHook[] = getHooks();\n * let promise: Promise = TransitionHook.chain(hooks);\n *\n * promise.then(handleSuccess, handleError);\n * ```\n *\n * @param hooks the list of hooks to chain together\n * @param waitFor if provided, the chain is `.then()`'ed off this promise\n * @returns a `Promise` for sequentially invoking the hooks (in order)\n */\n static chain(hooks: TransitionHook[], waitFor?: Promise): Promise {\n // Chain the next hook off the previous\n const createHookChainR = (prev: Promise, nextHook: TransitionHook) =>\n prev.then(() => nextHook.invokeHook());\n return hooks.reduce(createHookChainR, waitFor || services.$q.when());\n }\n\n\n /**\n * Invokes all the provided TransitionHooks, in order.\n * Each hook's return value is checked.\n * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned.\n * If no hook returns a promise, then all hooks are processed synchronously.\n *\n * @param hooks the list of TransitionHooks to invoke\n * @param doneCallback a callback that is invoked after all the hooks have successfully completed\n *\n * @returns a promise for the async result, or the result of the callback\n */\n static invokeHooks(hooks: TransitionHook[], doneCallback: (result?: HookResult) => T): Promise | T {\n for (let idx = 0; idx < hooks.length; idx++) {\n let hookResult = hooks[idx].invokeHook();\n\n if (isPromise(hookResult)) {\n let remainingHooks = hooks.slice(idx + 1);\n\n return TransitionHook.chain(remainingHooks, hookResult)\n .then(doneCallback);\n }\n }\n\n return doneCallback();\n }\n\n /**\n * Run all TransitionHooks, ignoring their return value.\n */\n static runAllHooks(hooks: TransitionHook[]): void {\n hooks.forEach(hook => hook.invokeHook());\n }\n\n}","/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\nimport { extend, removeFrom, tail, values, identity, map } from \"../common/common\";\nimport {isString, isFunction} from \"../common/predicates\";\nimport {PathNode} from \"../path/pathNode\";\nimport {\n TransitionStateHookFn, TransitionHookFn, TransitionHookPhase, TransitionHookScope, IHookRegistry, PathType\n} from \"./interface\"; // has or is using\n\nimport {\n HookRegOptions, HookMatchCriteria, TreeChanges,\n HookMatchCriterion, IMatchingNodes, HookFn\n} from \"./interface\";\nimport {Glob} from \"../common/glob\";\nimport {StateObject} from \"../state/stateObject\";\nimport {TransitionEventType} from \"./transitionEventType\";\nimport { TransitionService } from \"./transitionService\";\n\n/**\n * Determines if the given state matches the matchCriteria\n *\n * @hidden\n *\n * @param state a State Object to test against\n * @param criterion\n * - If a string, matchState uses the string as a glob-matcher against the state name\n * - If an array (of strings), matchState uses each string in the array as a glob-matchers against the state name\n * and returns a positive match if any of the globs match.\n * - If a function, matchState calls the function with the state and returns true if the function's result is truthy.\n * @returns {boolean}\n */\nexport function matchState(state: StateObject, criterion: HookMatchCriterion) {\n let toMatch = isString(criterion) ? [criterion] : criterion;\n\n function matchGlobs(_state: StateObject) {\n let globStrings = toMatch;\n for (let i = 0; i < globStrings.length; i++) {\n let glob = new Glob(globStrings[i]);\n\n if ((glob && glob.matches(_state.name)) || (!glob && globStrings[i] === _state.name)) {\n return true;\n }\n }\n return false;\n }\n\n let matchFn = (isFunction(toMatch) ? toMatch : matchGlobs);\n return !!matchFn(state);\n}\n\n/**\n * @internalapi\n * The registration data for a registered transition hook\n */\nexport class RegisteredHook {\n priority: number;\n bind: any;\n _deregistered: boolean;\n\n constructor(public tranSvc: TransitionService,\n public eventType: TransitionEventType,\n public callback: HookFn,\n public matchCriteria: HookMatchCriteria,\n options: HookRegOptions = {} as any) {\n this.priority = options.priority || 0;\n this.bind = options.bind || null;\n this._deregistered = false;\n }\n\n /**\n * Gets the matching [[PathNode]]s\n *\n * Given an array of [[PathNode]]s, and a [[HookMatchCriterion]], returns an array containing\n * the [[PathNode]]s that the criteria matches, or `null` if there were no matching nodes.\n *\n * Returning `null` is significant to distinguish between the default\n * \"match-all criterion value\" of `true` compared to a `() => true` function,\n * when the nodes is an empty array.\n *\n * This is useful to allow a transition match criteria of `entering: true`\n * to still match a transition, even when `entering === []`. Contrast that\n * with `entering: (state) => true` which only matches when a state is actually\n * being entered.\n */\n private _matchingNodes(nodes: PathNode[], criterion: HookMatchCriterion): PathNode[] {\n if (criterion === true) return nodes;\n let matching = nodes.filter(node => matchState(node.state, criterion));\n return matching.length ? matching : null;\n }\n\n /**\n * Gets the default match criteria (all `true`)\n *\n * Returns an object which has all the criteria match paths as keys and `true` as values, i.e.:\n *\n * ```js\n * {\n * to: true,\n * from: true,\n * entering: true,\n * exiting: true,\n * retained: true,\n * }\n */\n private _getDefaultMatchCriteria(): HookMatchCriteria {\n return map(this.tranSvc._pluginapi._getPathTypes(), () => true);\n }\n\n /**\n * Gets matching nodes as [[IMatchingNodes]]\n *\n * Create a IMatchingNodes object from the TransitionHookTypes that is roughly equivalent to:\n *\n * ```js\n * let matches: IMatchingNodes = {\n * to: _matchingNodes([tail(treeChanges.to)], mc.to),\n * from: _matchingNodes([tail(treeChanges.from)], mc.from),\n * exiting: _matchingNodes(treeChanges.exiting, mc.exiting),\n * retained: _matchingNodes(treeChanges.retained, mc.retained),\n * entering: _matchingNodes(treeChanges.entering, mc.entering),\n * };\n * ```\n */\n private _getMatchingNodes(treeChanges: TreeChanges): IMatchingNodes {\n let criteria = extend(this._getDefaultMatchCriteria(), this.matchCriteria);\n let paths: PathType[] = values(this.tranSvc._pluginapi._getPathTypes());\n\n return paths.reduce((mn: IMatchingNodes, pathtype: PathType) => {\n // STATE scope criteria matches against every node in the path.\n // TRANSITION scope criteria matches against only the last node in the path\n let isStateHook = pathtype.scope === TransitionHookScope.STATE;\n let path = treeChanges[pathtype.name] || [];\n let nodes: PathNode[] = isStateHook ? path : [tail(path)];\n\n mn[pathtype.name] = this._matchingNodes(nodes, criteria[pathtype.name]);\n return mn;\n }, {} as IMatchingNodes);\n }\n\n /**\n * Determines if this hook's [[matchCriteria]] match the given [[TreeChanges]]\n *\n * @returns an IMatchingNodes object, or null. If an IMatchingNodes object is returned, its values\n * are the matching [[PathNode]]s for each [[HookMatchCriterion]] (to, from, exiting, retained, entering)\n */\n matches(treeChanges: TreeChanges): IMatchingNodes {\n let matches = this._getMatchingNodes(treeChanges);\n\n // Check if all the criteria matched the TreeChanges object\n let allMatched = values(matches).every(identity);\n return allMatched ? matches : null;\n }\n}\n\n/** @hidden Return a registration function of the requested type. */\nexport function makeEvent(registry: IHookRegistry, transitionService: TransitionService, eventType: TransitionEventType) {\n // Create the object which holds the registered transition hooks.\n let _registeredHooks = registry._registeredHooks = (registry._registeredHooks || {});\n let hooks = _registeredHooks[eventType.name] = [];\n\n // Create hook registration function on the IHookRegistry for the event\n registry[eventType.name] = hookRegistrationFn;\n\n function hookRegistrationFn(matchObject, callback, options = {}) {\n let registeredHook = new RegisteredHook(transitionService, eventType, callback, matchObject, options);\n hooks.push(registeredHook);\n\n return function deregisterEventHook() {\n registeredHook._deregistered = true;\n removeFrom(hooks)(registeredHook);\n };\n }\n\n return hookRegistrationFn;\n}","/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\n\nimport {extend, tail, assertPredicate, unnestR, identity} from \"../common/common\";\nimport {isArray} from \"../common/predicates\";\n\nimport {\n TransitionOptions, TransitionHookOptions, IHookRegistry, TreeChanges, IMatchingNodes,\n TransitionHookPhase, TransitionHookScope\n} from \"./interface\";\n\nimport {Transition} from \"./transition\";\nimport {TransitionHook} from \"./transitionHook\";\nimport {StateObject} from \"../state/stateObject\";\nimport {PathNode} from \"../path/pathNode\";\nimport {TransitionService} from \"./transitionService\";\nimport {TransitionEventType} from \"./transitionEventType\";\nimport {RegisteredHook} from \"./hookRegistry\";\n\n/**\n * This class returns applicable TransitionHooks for a specific Transition instance.\n *\n * Hooks ([[RegisteredHook]]) may be registered globally, e.g., $transitions.onEnter(...), or locally, e.g.\n * myTransition.onEnter(...). The HookBuilder finds matching RegisteredHooks (where the match criteria is\n * determined by the type of hook)\n *\n * The HookBuilder also converts RegisteredHooks objects to TransitionHook objects, which are used to run a Transition.\n *\n * The HookBuilder constructor is given the $transitions service and a Transition instance. Thus, a HookBuilder\n * instance may only be used for one specific Transition object. (side note: the _treeChanges accessor is private\n * in the Transition class, so we must also provide the Transition's _treeChanges)\n *\n */\nexport class HookBuilder {\n constructor(private transition: Transition) { }\n\n buildHooksForPhase(phase: TransitionHookPhase): TransitionHook[] {\n let $transitions = this.transition.router.transitionService;\n return $transitions._pluginapi._getEvents(phase)\n .map(type => this.buildHooks(type))\n .reduce(unnestR, [])\n .filter(identity);\n }\n\n /**\n * Returns an array of newly built TransitionHook objects.\n *\n * - Finds all RegisteredHooks registered for the given `hookType` which matched the transition's [[TreeChanges]].\n * - Finds [[PathNode]] (or `PathNode[]`) to use as the TransitionHook context(s)\n * - For each of the [[PathNode]]s, creates a TransitionHook\n *\n * @param hookType the type of the hook registration function, e.g., 'onEnter', 'onFinish'.\n */\n buildHooks(hookType: TransitionEventType): TransitionHook[] {\n let transition = this.transition;\n let treeChanges = transition.treeChanges();\n\n // Find all the matching registered hooks for a given hook type\n let matchingHooks = this.getMatchingHooks(hookType, treeChanges);\n if (!matchingHooks) return [];\n\n let baseHookOptions = {\n transition: transition,\n current: transition.options().current\n };\n\n const makeTransitionHooks = (hook: RegisteredHook) => {\n // Fetch the Nodes that caused this hook to match.\n let matches: IMatchingNodes = hook.matches(treeChanges);\n // Select the PathNode[] that will be used as TransitionHook context objects\n let matchingNodes: PathNode[] = matches[hookType.criteriaMatchPath.name];\n\n // Return an array of HookTuples\n return matchingNodes.map(node => {\n let _options = extend({\n bind: hook.bind,\n traceData: { hookType: hookType.name, context: node }\n }, baseHookOptions);\n\n let state = hookType.criteriaMatchPath.scope === TransitionHookScope.STATE ? node.state.self : null;\n let transitionHook = new TransitionHook(transition, state, hook, _options);\n return { hook, node, transitionHook };\n });\n };\n\n return matchingHooks.map(makeTransitionHooks)\n .reduce(unnestR, [])\n .sort(tupleSort(hookType.reverseSort))\n .map(tuple => tuple.transitionHook);\n }\n\n /**\n * Finds all RegisteredHooks from:\n * - The Transition object instance hook registry\n * - The TransitionService ($transitions) global hook registry\n *\n * which matched:\n * - the eventType\n * - the matchCriteria (to, from, exiting, retained, entering)\n *\n * @returns an array of matched [[RegisteredHook]]s\n */\n public getMatchingHooks(hookType: TransitionEventType, treeChanges: TreeChanges): RegisteredHook[] {\n let isCreate = hookType.hookPhase === TransitionHookPhase.CREATE;\n\n // Instance and Global hook registries\n let $transitions = this.transition.router.transitionService;\n let registries = isCreate ? [ $transitions ] : [ this.transition, $transitions ];\n\n return registries.map((reg: IHookRegistry) => reg.getHooks(hookType.name)) // Get named hooks from registries\n .filter(assertPredicate(isArray, `broken event named: ${hookType.name}`)) // Sanity check\n .reduce(unnestR, []) // Un-nest RegisteredHook[][] to RegisteredHook[] array\n .filter(hook => hook.matches(treeChanges)); // Only those satisfying matchCriteria\n }\n}\n\ninterface HookTuple { hook: RegisteredHook, node: PathNode, transitionHook: TransitionHook }\n\n/**\n * A factory for a sort function for HookTuples.\n *\n * The sort function first compares the PathNode depth (how deep in the state tree a node is), then compares\n * the EventHook priority.\n *\n * @param reverseDepthSort a boolean, when true, reverses the sort order for the node depth\n * @returns a tuple sort function\n */\nfunction tupleSort(reverseDepthSort = false) {\n return function nodeDepthThenPriority(l: HookTuple, r: HookTuple): number {\n let factor = reverseDepthSort ? -1 : 1;\n let depthDelta = (l.node.state.path.length - r.node.state.path.length) * factor;\n return depthDelta !== 0 ? depthDelta : r.hook.priority - l.hook.priority;\n }\n}","/**\n * @coreapi\n * @module params\n */\n/** */\nimport {extend, filter, map} from \"../common/common\";\nimport {isArray, isDefined} from \"../common/predicates\";\nimport {ParamTypeDefinition} from \"./interface\";\n\n/**\n * An internal class which implements [[ParamTypeDefinition]].\n *\n * A [[ParamTypeDefinition]] is a plain javascript object used to register custom parameter types.\n * When a param type definition is registered, an instance of this class is created internally.\n *\n * This class has naive implementations for all the [[ParamTypeDefinition]] methods.\n *\n * Used by [[UrlMatcher]] when matching or formatting URLs, or comparing and validating parameter values.\n *\n * #### Example:\n * ```js\n * var paramTypeDef = {\n * decode: function(val) { return parseInt(val, 10); },\n * encode: function(val) { return val && val.toString(); },\n * equals: function(a, b) { return this.is(a) && a === b; },\n * is: function(val) { return angular.isNumber(val) && isFinite(val) && val % 1 === 0; },\n * pattern: /\\d+/\n * }\n *\n * var paramType = new ParamType(paramTypeDef);\n * ```\n * @internalapi\n */\nexport class ParamType implements ParamTypeDefinition {\n /** @inheritdoc */\n pattern: RegExp = /.*/;\n /** The name/id of the parameter type */\n name: string;\n /** @inheritdoc */\n raw: boolean;\n /** @inheritdoc */\n dynamic: boolean;\n /** @inheritdoc */\n inherit = true;\n\n /**\n * @param def A configuration object which contains the custom type definition. The object's\n * properties will override the default methods and/or pattern in `ParamType`'s public interface.\n * @returns a new ParamType object\n */\n constructor(def: ParamTypeDefinition) {\n extend(this, def);\n }\n\n\n // consider these four methods to be \"abstract methods\" that should be overridden\n /** @inheritdoc */\n is(val: any, key?: string): boolean { return true; }\n /** @inheritdoc */\n encode(val: any, key?: string): (string|string[]) { return val; }\n /** @inheritdoc */\n decode(val: string, key?: string): any { return val; }\n /** @inheritdoc */\n equals(a: any, b: any): boolean { return a == b; }\n\n\n $subPattern() {\n let sub = this.pattern.toString();\n return sub.substr(1, sub.length - 2);\n }\n\n toString() {\n return `{ParamType:${this.name}}`;\n }\n\n /** Given an encoded string, or a decoded object, returns a decoded object */\n $normalize(val: any) {\n return this.is(val) ? val : this.decode(val);\n }\n\n /**\n * Wraps an existing custom ParamType as an array of ParamType, depending on 'mode'.\n * e.g.:\n * - urlmatcher pattern \"/path?{queryParam[]:int}\"\n * - url: \"/path?queryParam=1&queryParam=2\n * - $stateParams.queryParam will be [1, 2]\n * if `mode` is \"auto\", then\n * - url: \"/path?queryParam=1 will create $stateParams.queryParam: 1\n * - url: \"/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2]\n */\n $asArray(mode: (boolean|\"auto\"), isSearch: boolean) {\n if (!mode) return this;\n if (mode === \"auto\" && !isSearch) throw new Error(\"'auto' array mode is for query parameters only\");\n return new ( ArrayType)(this, mode);\n }\n}\n\n/**\n * Wraps up a `ParamType` object to handle array values.\n * @internalapi\n */\nfunction ArrayType(type: ParamType, mode: (boolean|\"auto\")) {\n // Wrap non-array value as array\n function arrayWrap(val: any): any[] {\n return isArray(val) ? val : (isDefined(val) ? [ val ] : []);\n }\n\n // Unwrap array value for \"auto\" mode. Return undefined for empty array.\n function arrayUnwrap(val: any) {\n switch (val.length) {\n case 0: return undefined;\n case 1: return mode === \"auto\" ? val[0] : val;\n default: return val;\n }\n }\n\n // Wraps type (.is/.encode/.decode) functions to operate on each value of an array\n function arrayHandler(callback: (x: any) => any, allTruthyMode?: boolean) {\n return function handleArray(val: any) {\n if (isArray(val) && val.length === 0) return val;\n let arr = arrayWrap(val);\n let result = map(arr, callback);\n return (allTruthyMode === true) ? filter(result, x => !x).length === 0 : arrayUnwrap(result);\n };\n }\n\n // Wraps type (.equals) functions to operate on each value of an array\n function arrayEqualsHandler(callback: (l: any, r: any) => boolean) {\n return function handleArray(val1: any, val2: any) {\n let left = arrayWrap(val1), right = arrayWrap(val2);\n if (left.length !== right.length) return false;\n for (let i = 0; i < left.length; i++) {\n if (!callback(left[i], right[i])) return false;\n }\n return true;\n };\n }\n\n ['encode', 'decode', 'equals', '$normalize'].forEach(name => {\n var paramTypeFn = type[name].bind(type);\n var wrapperFn: Function = name === 'equals' ? arrayEqualsHandler : arrayHandler;\n this[name] = wrapperFn(paramTypeFn);\n });\n\n extend(this, {\n dynamic: type.dynamic,\n name: type.name,\n pattern: type.pattern,\n inherit: type.inherit,\n is: arrayHandler(type.is.bind(type), true),\n $arrayMode: mode\n });\n}\n","/**\n * @coreapi\n * @module params\n */ /** for typedoc */\nimport { extend, filter, map, allTrueR } from \"../common/common\";\nimport { prop } from \"../common/hof\";\nimport { isInjectable, isDefined, isString, isArray, isUndefined } from \"../common/predicates\";\nimport { RawParams, ParamDeclaration } from \"../params/interface\";\nimport { services } from \"../common/coreservices\";\nimport { ParamType } from \"./paramType\";\nimport { ParamTypes } from \"./paramTypes\";\nimport { UrlMatcherFactory } from \"../url/urlMatcherFactory\";\n\n/** @hidden */ let hasOwn = Object.prototype.hasOwnProperty;\n/** @hidden */ let isShorthand = (cfg: ParamDeclaration) =>\n [\"value\", \"type\", \"squash\", \"array\", \"dynamic\"].filter(hasOwn.bind(cfg || {})).length === 0;\n\n/** @internalapi */\nexport enum DefType {\n PATH,\n SEARCH,\n CONFIG,\n}\n\n/** @hidden */\nfunction unwrapShorthand(cfg: ParamDeclaration): ParamDeclaration {\n cfg = isShorthand(cfg) && { value: cfg } as any || cfg;\n\n getStaticDefaultValue['__cacheable'] = true;\n function getStaticDefaultValue() {\n return cfg.value;\n }\n\n return extend(cfg, {\n $$fn: isInjectable(cfg.value) ? cfg.value : getStaticDefaultValue,\n });\n}\n\n/** @hidden */\nfunction getType(cfg: ParamDeclaration, urlType: ParamType, location: DefType, id: string, paramTypes: ParamTypes) {\n if (cfg.type && urlType && urlType.name !== 'string') throw new Error(`Param '${id}' has two type configurations.`);\n if (cfg.type && urlType && urlType.name === 'string' && paramTypes.type(cfg.type as string)) return paramTypes.type(cfg.type as string);\n if (urlType) return urlType;\n if (!cfg.type) {\n let type = location === DefType.CONFIG ? \"any\" :\n location === DefType.PATH ? \"path\" :\n location === DefType.SEARCH ? \"query\" : \"string\";\n return paramTypes.type(type);\n }\n return cfg.type instanceof ParamType ? cfg.type : paramTypes.type(cfg.type as string);\n}\n\n/**\n * @internalapi\n * returns false, true, or the squash value to indicate the \"default parameter url squash policy\".\n */\nfunction getSquashPolicy(config: ParamDeclaration, isOptional: boolean, defaultPolicy: (boolean|string)) {\n let squash = config.squash;\n if (!isOptional || squash === false) return false;\n if (!isDefined(squash) || squash == null) return defaultPolicy;\n if (squash === true || isString(squash)) return squash;\n throw new Error(`Invalid squash policy: '${squash}'. Valid policies: false, true, or arbitrary string`);\n}\n\n/** @internalapi */\nfunction getReplace(config: ParamDeclaration, arrayMode: boolean, isOptional: boolean, squash: (string|boolean)) {\n let replace: any, configuredKeys: string[], defaultPolicy = [\n {from: \"\", to: (isOptional || arrayMode ? undefined : \"\")},\n {from: null, to: (isOptional || arrayMode ? undefined : \"\")},\n ];\n replace = isArray(config.replace) ? config.replace : [];\n if (isString(squash)) replace.push({ from: squash, to: undefined });\n configuredKeys = map(replace, prop(\"from\"));\n return filter(defaultPolicy, item => configuredKeys.indexOf(item.from) === -1).concat(replace);\n}\n\n\n/** @internalapi */\nexport class Param {\n id: string;\n type: ParamType;\n location: DefType;\n isOptional: boolean;\n dynamic: boolean;\n raw: boolean;\n squash: (boolean|string);\n replace: [{ to: any, from: any }];\n inherit: boolean;\n array: boolean;\n config: any;\n /** Cache the default value if it is a static value */\n _defaultValueCache: {\n defaultValue: any,\n };\n\n constructor(id: string, type: ParamType, config: ParamDeclaration, location: DefType, urlMatcherFactory: UrlMatcherFactory) {\n config = unwrapShorthand(config);\n type = getType(config, type, location, id, urlMatcherFactory.paramTypes);\n let arrayMode = getArrayMode();\n type = arrayMode ? type.$asArray(arrayMode, location === DefType.SEARCH) : type;\n let isOptional = config.value !== undefined || location === DefType.SEARCH;\n let dynamic = isDefined(config.dynamic) ? !!config.dynamic : !!type.dynamic;\n let raw = isDefined(config.raw) ? !!config.raw : !!type.raw;\n let squash = getSquashPolicy(config, isOptional, urlMatcherFactory.defaultSquashPolicy());\n let replace = getReplace(config, arrayMode, isOptional, squash);\n let inherit = isDefined(config.inherit) ? !!config.inherit : !!type.inherit;\n\n // array config: param name (param[]) overrides default settings. explicit config overrides param name.\n function getArrayMode() {\n let arrayDefaults = { array: (location === DefType.SEARCH ? \"auto\" : false) };\n let arrayParamNomenclature = id.match(/\\[\\]$/) ? { array: true } : {};\n return extend(arrayDefaults, arrayParamNomenclature, config).array;\n }\n\n extend(this, {id, type, location, isOptional, dynamic, raw, squash, replace, inherit, array: arrayMode, config });\n }\n\n isDefaultValue(value: any): boolean {\n return this.isOptional && this.type.equals(this.value(), value);\n }\n\n /**\n * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the\n * default value, which may be the result of an injectable function.\n */\n value(value?: any): any {\n /**\n * [Internal] Get the default value of a parameter, which may be an injectable function.\n */\n const getDefaultValue = () => {\n if (this._defaultValueCache) return this._defaultValueCache.defaultValue;\n\n if (!services.$injector) throw new Error(\"Injectable functions cannot be called at configuration time\");\n\n let defaultValue = services.$injector.invoke(this.config.$$fn);\n\n if (defaultValue !== null && defaultValue !== undefined && !this.type.is(defaultValue))\n throw new Error(`Default value (${defaultValue}) for parameter '${this.id}' is not an instance of ParamType (${this.type.name})`);\n\n if (this.config.$$fn['__cacheable']) {\n this._defaultValueCache = { defaultValue };\n }\n\n return defaultValue;\n };\n\n const replaceSpecialValues = (val: any) => {\n for (let tuple of this.replace) {\n if (tuple.from === val) return tuple.to;\n }\n return val;\n };\n\n value = replaceSpecialValues(value);\n\n return isUndefined(value) ? getDefaultValue() : this.type.$normalize(value);\n }\n\n isSearch(): boolean {\n return this.location === DefType.SEARCH;\n }\n\n validates(value: any): boolean {\n // There was no parameter value, but the param is optional\n if ((isUndefined(value) || value === null) && this.isOptional) return true;\n\n // The value was not of the correct ParamType, and could not be decoded to the correct ParamType\n const normalized = this.type.$normalize(value);\n if (!this.type.is(normalized)) return false;\n\n // The value was of the correct type, but when encoded, did not match the ParamType's regexp\n const encoded = this.type.encode(normalized);\n return !(isString(encoded) && !this.type.pattern.exec( encoded));\n }\n\n toString() {\n return `{Param:${this.id} ${this.type} squash: '${this.squash}' optional: ${this.isOptional}}`;\n }\n\n static values(params: Param[], values: RawParams = {}): RawParams {\n const paramValues = {} as RawParams;\n for (let param of params) {\n paramValues[param.id] = param.value(values[param.id]);\n }\n return paramValues;\n }\n\n /**\n * Finds [[Param]] objects which have different param values\n *\n * Filters a list of [[Param]] objects to only those whose parameter values differ in two param value objects\n *\n * @param params: The list of Param objects to filter\n * @param values1: The first set of parameter values\n * @param values2: the second set of parameter values\n *\n * @returns any Param objects whose values were different between values1 and values2\n */\n static changed(params: Param[], values1: RawParams = {}, values2: RawParams = {}): Param[] {\n return params.filter(param => !param.type.equals(values1[param.id], values2[param.id]));\n }\n\n /**\n * Checks if two param value objects are equal (for a set of [[Param]] objects)\n *\n * @param params The list of [[Param]] objects to check\n * @param values1 The first set of param values\n * @param values2 The second set of param values\n *\n * @returns true if the param values in values1 and values2 are equal\n */\n static equals(params: Param[], values1 = {}, values2 = {}): boolean {\n return Param.changed(params, values1, values2).length === 0;\n }\n\n /** Returns true if a the parameter values are valid, according to the Param definitions */\n static validates(params: Param[], values: RawParams = {}): boolean {\n return params.map(param => param.validates(values[param.id])).reduce(allTrueR, true);\n }\n}","/** @module path */ /** for typedoc */\nimport {extend, applyPairs, find, allTrueR, pairs, arrayTuples} from \"../common/common\";\nimport {propEq} from \"../common/hof\";\nimport {StateObject} from \"../state/stateObject\";\nimport {RawParams} from \"../params/interface\";\nimport {Param} from \"../params/param\";\nimport {Resolvable} from \"../resolve/resolvable\";\nimport {ViewConfig} from \"../view/interface\";\n\n/**\n * @internalapi\n *\n * A node in a [[TreeChanges]] path\n *\n * For a [[TreeChanges]] path, this class holds the stateful information for a single node in the path.\n * Each PathNode corresponds to a state being entered, exited, or retained.\n * The stateful information includes parameter values and resolve data.\n */\nexport class PathNode {\n /** The state being entered, exited, or retained */\n public state: StateObject;\n /** The parameters declared on the state */\n public paramSchema: Param[];\n /** The parameter values that belong to the state */\n public paramValues: { [key: string]: any };\n /** The individual (stateful) resolvable objects that belong to the state */\n public resolvables: Resolvable[];\n /** The state's declared view configuration objects */\n public views: ViewConfig[];\n\n /** Creates a copy of a PathNode */\n constructor(node: PathNode);\n /** Creates a new (empty) PathNode for a State */\n constructor(state: StateObject);\n constructor(stateOrNode: any) {\n if (stateOrNode instanceof PathNode) {\n let node: PathNode = stateOrNode;\n this.state = node.state;\n this.paramSchema = node.paramSchema.slice();\n this.paramValues = extend({}, node.paramValues);\n this.resolvables = node.resolvables.slice();\n this.views = node.views && node.views.slice();\n } else {\n let state: StateObject = stateOrNode;\n this.state = state;\n this.paramSchema = state.parameters({ inherit: false });\n this.paramValues = {};\n this.resolvables = state.resolvables.map(res => res.clone());\n }\n }\n\n /** Sets [[paramValues]] for the node, from the values of an object hash */\n applyRawParams(params: RawParams): PathNode {\n const getParamVal = (paramDef: Param) => [ paramDef.id, paramDef.value(params[paramDef.id]) ];\n this.paramValues = this.paramSchema.reduce((memo, pDef) => applyPairs(memo, getParamVal(pDef)), {});\n return this;\n }\n\n /** Gets a specific [[Param]] metadata that belongs to the node */\n parameter(name: string): Param {\n return find(this.paramSchema, propEq(\"id\", name));\n }\n\n /**\n * @returns true if the state and parameter values for another PathNode are\n * equal to the state and param values for this PathNode\n */\n equals(node: PathNode, paramsFn?: GetParamsFn): boolean {\n const diff = this.diff(node, paramsFn);\n return diff && diff.length === 0;\n }\n\n /**\n * Finds Params with different parameter values on another PathNode.\n *\n * Given another node (of the same state), finds the parameter values which differ.\n * Returns the [[Param]] (schema objects) whose parameter values differ.\n *\n * Given another node for a different state, returns `false`\n *\n * @param node The node to compare to\n * @param paramsFn A function that returns which parameters should be compared.\n * @returns The [[Param]]s which differ, or null if the two nodes are for different states\n */\n diff(node: PathNode, paramsFn?: GetParamsFn): Param[] | false {\n if (this.state !== node.state) return false;\n\n const params: Param[] = paramsFn ? paramsFn(this) : this.paramSchema;\n return Param.changed(params, this.paramValues, node.paramValues);\n }\n\n /** Returns a clone of the PathNode */\n static clone(node: PathNode) {\n return new PathNode(node);\n }\n}\n\n/** @hidden */\nexport type GetParamsFn = (pathNode: PathNode) => Param[];","/** @module path */ /** for typedoc */\n\nimport {\n extend, find, pick, omit, tail, mergeR, values, unnestR, Predicate, inArray, arrayTuples,\n} from \"../common/common\";\nimport {prop, propEq, not} from \"../common/hof\";\n\nimport {RawParams} from \"../params/interface\";\nimport {TreeChanges} from \"../transition/interface\";\nimport {ViewConfig} from \"../view/interface\";\nimport {_ViewDeclaration} from \"../state/interface\";\n\nimport {StateObject} from \"../state/stateObject\";\nimport {TargetState} from \"../state/targetState\";\nimport {GetParamsFn, PathNode} from \"./pathNode\";\nimport {ViewService} from \"../view/view\";\nimport { Param } from '../params/param';\nimport { StateRegistry } from '../state';\n\n/**\n * This class contains functions which convert TargetStates, Nodes and paths from one type to another.\n */\nexport class PathUtils {\n\n constructor() { }\n\n /** Given a PathNode[], create an TargetState */\n static makeTargetState(registry: StateRegistry, path: PathNode[]): TargetState {\n let state = tail(path).state;\n return new TargetState(registry, state, path.map(prop(\"paramValues\")).reduce(mergeR, {}), {});\n }\n\n static buildPath(targetState: TargetState) {\n let toParams = targetState.params();\n return targetState.$state().path.map(state => new PathNode(state).applyRawParams(toParams));\n }\n\n /** Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[] */\n static buildToPath(fromPath: PathNode[], targetState: TargetState): PathNode[] {\n let toPath: PathNode[] = PathUtils.buildPath(targetState);\n if (targetState.options().inherit) {\n return PathUtils.inheritParams(fromPath, toPath, Object.keys(targetState.params()));\n }\n return toPath;\n }\n\n /**\n * Creates ViewConfig objects and adds to nodes.\n *\n * On each [[PathNode]], creates ViewConfig objects from the views: property of the node's state\n */\n static applyViewConfigs($view: ViewService, path: PathNode[], states: StateObject[]) {\n // Only apply the viewConfigs to the nodes for the given states\n path.filter(node => inArray(states, node.state)).forEach(node => {\n let viewDecls: _ViewDeclaration[] = values(node.state.views || {});\n let subPath = PathUtils.subPath(path, n => n === node);\n let viewConfigs: ViewConfig[][] = viewDecls.map(view => $view.createViewConfig(subPath, view));\n node.views = viewConfigs.reduce(unnestR, []);\n });\n }\n\n /**\n * Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath\n *\n * For a parameter in a node to be inherited from the from path:\n * - The toPath's node must have a matching node in the fromPath (by state).\n * - The parameter name must not be found in the toKeys parameter array.\n *\n * Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some\n * caller, for instance, $state.transitionTo(..., toParams). If a key was found in toParams,\n * it is not inherited from the fromPath.\n */\n static inheritParams(fromPath: PathNode[], toPath: PathNode[], toKeys: string[] = []): PathNode[] {\n function nodeParamVals(path: PathNode[], state: StateObject): RawParams {\n let node: PathNode = find(path, propEq('state', state));\n return extend({}, node && node.paramValues);\n }\n\n let noInherit = fromPath.map(node => node.paramSchema)\n .reduce(unnestR, [])\n .filter(param => !param.inherit)\n .map(prop('id'));\n\n /**\n * Given an [[PathNode]] \"toNode\", return a new [[PathNode]] with param values inherited from the\n * matching node in fromPath. Only inherit keys that aren't found in \"toKeys\" from the node in \"fromPath\"\"\n */\n function makeInheritedParamsNode(toNode: PathNode): PathNode {\n // All param values for the node (may include default key/vals, when key was not found in toParams)\n let toParamVals = extend({}, toNode && toNode.paramValues);\n // limited to only those keys found in toParams\n let incomingParamVals = pick(toParamVals, toKeys);\n toParamVals = omit(toParamVals, toKeys);\n let fromParamVals = omit(nodeParamVals(fromPath, toNode.state) || {}, noInherit);\n // extend toParamVals with any fromParamVals, then override any of those those with incomingParamVals\n let ownParamVals: RawParams = extend(toParamVals, fromParamVals, incomingParamVals);\n return new PathNode(toNode.state).applyRawParams(ownParamVals);\n }\n\n // The param keys specified by the incoming toParams\n return toPath.map(makeInheritedParamsNode);\n }\n\n static nonDynamicParams = (node: PathNode): Param[] =>\n node.state.parameters({ inherit: false })\n .filter(param => !param.dynamic);\n\n /**\n * Computes the tree changes (entering, exiting) between a fromPath and toPath.\n */\n static treeChanges(fromPath: PathNode[], toPath: PathNode[], reloadState: StateObject): TreeChanges {\n let keep = 0, max = Math.min(fromPath.length, toPath.length);\n\n const nodesMatch = (node1: PathNode, node2: PathNode) =>\n node1.equals(node2, PathUtils.nonDynamicParams);\n\n while (keep < max && fromPath[keep].state !== reloadState && nodesMatch(fromPath[keep], toPath[keep])) {\n keep++;\n }\n\n /** Given a retained node, return a new node which uses the to node's param values */\n function applyToParams(retainedNode: PathNode, idx: number): PathNode {\n let cloned = PathNode.clone(retainedNode);\n cloned.paramValues = toPath[idx].paramValues;\n return cloned;\n }\n\n let from: PathNode[], retained: PathNode[], exiting: PathNode[], entering: PathNode[], to: PathNode[];\n\n from = fromPath;\n retained = from.slice(0, keep);\n exiting = from.slice(keep);\n\n // Create a new retained path (with shallow copies of nodes) which have the params of the toPath mapped\n let retainedWithToParams = retained.map(applyToParams);\n entering = toPath.slice(keep);\n to = (retainedWithToParams).concat(entering);\n\n return { from, to, retained, exiting, entering };\n }\n\n /**\n * Returns a new path which is: the subpath of the first path which matches the second path.\n *\n * The new path starts from root and contains any nodes that match the nodes in the second path.\n * It stops before the first non-matching node.\n *\n * Nodes are compared using their state property and their parameter values.\n * If a `paramsFn` is provided, only the [[Param]] returned by the function will be considered when comparing nodes.\n *\n * @param pathA the first path\n * @param pathB the second path\n * @param paramsFn a function which returns the parameters to consider when comparing\n *\n * @returns an array of PathNodes from the first path which match the nodes in the second path\n */\n static matching(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): PathNode[] {\n let done = false;\n let tuples: PathNode[][] = arrayTuples(pathA, pathB);\n return tuples.reduce((matching, [nodeA, nodeB]) => {\n done = done || !nodeA.equals(nodeB, paramsFn);\n return done ? matching : matching.concat(nodeA);\n }, []);\n }\n\n /**\n * Returns true if two paths are identical.\n *\n * @param pathA\n * @param pathB\n * @param paramsFn a function which returns the parameters to consider when comparing\n * @returns true if the the states and parameter values for both paths are identical\n */\n static equals(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): boolean {\n return pathA.length === pathB.length &&\n PathUtils.matching(pathA, pathB, paramsFn).length === pathA.length;\n }\n\n /**\n * Return a subpath of a path, which stops at the first matching node\n *\n * Given an array of nodes, returns a subset of the array starting from the first node,\n * stopping when the first node matches the predicate.\n *\n * @param path a path of [[PathNode]]s\n * @param predicate a [[Predicate]] fn that matches [[PathNode]]s\n * @returns a subpath up to the matching node, or undefined if no match is found\n */\n static subPath(path: PathNode[], predicate: Predicate): PathNode[] {\n let node = find(path, predicate);\n let elementIdx = path.indexOf(node);\n return elementIdx === -1 ? undefined : path.slice(0, elementIdx + 1);\n }\n\n /** Gets the raw parameter values from a path */\n static paramValues = (path: PathNode[]) =>\n path.reduce((acc, node) => extend(acc, node.paramValues), {});\n}\n","/**\n * @coreapi\n * @module resolve\n */ /** for typedoc */\nimport {extend, equals, inArray, identity} from \"../common/common\";\nimport {services} from \"../common/coreservices\";\nimport {trace} from \"../common/trace\";\nimport {ResolvePolicy, ResolvableLiteral, resolvePolicies} from \"./interface\";\n\nimport {ResolveContext} from \"./resolveContext\";\nimport {stringify} from \"../common/strings\";\nimport {isFunction, isObject} from \"../common/predicates\";\nimport {Transition} from \"../transition/transition\";\nimport {StateObject} from \"../state/stateObject\";\nimport {PathNode} from \"../path/pathNode\";\nimport { isNullOrUndefined } from '../common';\n\n\n// TODO: explicitly make this user configurable\nexport let defaultResolvePolicy: ResolvePolicy = {\n when: \"LAZY\",\n async: \"WAIT\"\n};\n\n/**\n * The basic building block for the resolve system.\n *\n * Resolvables encapsulate a state's resolve's resolveFn, the resolveFn's declared dependencies, the wrapped (.promise),\n * and the unwrapped-when-complete (.data) result of the resolveFn.\n *\n * Resolvable.get() either retrieves the Resolvable's existing promise, or else invokes resolve() (which invokes the\n * resolveFn) and returns the resulting promise.\n *\n * Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first\n * parameter to those fns.\n */\nexport class Resolvable implements ResolvableLiteral {\n token: any;\n policy: ResolvePolicy;\n resolveFn: Function;\n deps: any[];\n\n data: any;\n resolved: boolean = false;\n promise: Promise = undefined;\n\n /** This constructor creates a Resolvable copy */\n constructor(resolvable: Resolvable)\n\n /** This constructor creates a new Resolvable from the plain old [[ResolvableLiteral]] javascript object */\n constructor(resolvable: ResolvableLiteral)\n\n /**\n * This constructor creates a new `Resolvable`\n *\n * #### Example:\n * ```js\n * var resolvable1 = new Resolvable('mytoken', http => http.get('foo.json').toPromise(), [Http]);\n *\n * var resolvable2 = new Resolvable(UserService, dep => new UserService(dep.data), [SomeDependency]);\n *\n * var resolvable1Clone = new Resolvable(resolvable1);\n * ```\n *\n * @param token The new resolvable's injection token, such as `\"userList\"` (a string) or `UserService` (a class).\n * When this token is used during injection, the resolved value will be injected.\n * @param resolveFn The function that returns the resolved value, or a promise for the resolved value\n * @param deps An array of dependencies, which will be injected into the `resolveFn`\n * @param policy the [[ResolvePolicy]] defines when and how the Resolvable is processed\n * @param data Pre-resolved data. If the resolve value is already known, it may be provided here.\n */\n constructor(token: any, resolveFn: Function, deps?: any[], policy?: ResolvePolicy, data?: any)\n constructor(arg1: any, resolveFn?: Function, deps?: any[], policy?: ResolvePolicy, data?: any) {\n if (arg1 instanceof Resolvable) {\n extend(this, arg1);\n } else if (isFunction(resolveFn)) {\n if (isNullOrUndefined(arg1)) throw new Error(\"new Resolvable(): token argument is required\");\n if (!isFunction(resolveFn)) throw new Error(\"new Resolvable(): resolveFn argument must be a function\");\n\n this.token = arg1;\n this.policy = policy;\n this.resolveFn = resolveFn;\n this.deps = deps || [];\n\n this.data = data;\n this.resolved = data !== undefined;\n this.promise = this.resolved ? services.$q.when(this.data) : undefined;\n } else if (isObject(arg1) && arg1.token && isFunction(arg1.resolveFn)) {\n let literal = arg1;\n return new Resolvable(literal.token, literal.resolveFn, literal.deps, literal.policy, literal.data);\n }\n }\n\n getPolicy(state: StateObject): ResolvePolicy {\n let thisPolicy = this.policy || {};\n let statePolicy = state && state.resolvePolicy || {};\n return {\n when: thisPolicy.when || statePolicy.when || defaultResolvePolicy.when,\n async: thisPolicy.async || statePolicy.async || defaultResolvePolicy.async,\n };\n }\n\n /**\n * Asynchronously resolve this Resolvable's data\n *\n * Given a ResolveContext that this Resolvable is found in:\n * Wait for this Resolvable's dependencies, then invoke this Resolvable's function\n * and update the Resolvable's state\n */\n resolve(resolveContext: ResolveContext, trans?: Transition) {\n let $q = services.$q;\n\n // Gets all dependencies from ResolveContext and wait for them to be resolved\n const getResolvableDependencies = () =>\n $q.all(resolveContext.getDependencies(this).map(resolvable =>\n resolvable.get(resolveContext, trans))) as Promise;\n\n // Invokes the resolve function passing the resolved dependencies as arguments\n const invokeResolveFn = (resolvedDeps: any[]) =>\n this.resolveFn.apply(null, resolvedDeps);\n\n /**\n * For RXWAIT policy:\n *\n * Given an observable returned from a resolve function:\n * - enables .cache() mode (this allows multicast subscribers)\n * - then calls toPromise() (this triggers subscribe() and thus fetches)\n * - Waits for the promise, then return the cached observable (not the first emitted value).\n */\n const waitForRx = (observable$: any) => {\n let cached = observable$.cache(1);\n return cached.take(1).toPromise().then(() => cached);\n };\n\n // If the resolve policy is RXWAIT, wait for the observable to emit something. otherwise pass through.\n let node: PathNode = resolveContext.findNode(this);\n let state: StateObject = node && node.state;\n let maybeWaitForRx = this.getPolicy(state).async === \"RXWAIT\" ? waitForRx : identity;\n\n // After the final value has been resolved, update the state of the Resolvable\n const applyResolvedValue = (resolvedValue: any) => {\n this.data = resolvedValue;\n this.resolved = true;\n trace.traceResolvableResolved(this, trans);\n return this.data;\n };\n\n // Sets the promise property first, then getsResolvableDependencies in the context of the promise chain. Always waits one tick.\n return this.promise = $q.when()\n .then(getResolvableDependencies)\n .then(invokeResolveFn)\n .then(maybeWaitForRx)\n .then(applyResolvedValue);\n }\n\n /**\n * Gets a promise for this Resolvable's data.\n *\n * Fetches the data and returns a promise.\n * Returns the existing promise if it has already been fetched once.\n */\n get(resolveContext: ResolveContext, trans?: Transition): Promise {\n return this.promise || this.resolve(resolveContext, trans);\n }\n\n toString() {\n return `Resolvable(token: ${stringify(this.token)}, requires: [${this.deps.map(stringify)}])`;\n }\n\n clone(): Resolvable {\n return new Resolvable(this);\n }\n \n static fromData = (token: any, data: any) => \n new Resolvable(token, () => data, null, null, data);\n}\n","/**\n * # The Resolve subsystem\n *\n * This subsystem is an asynchronous, hierarchical Dependency Injection system.\n *\n * Typically, resolve is configured on a state using a [[StateDeclaration.resolve]] declaration.\n *\n * @coreapi\n * @module resolve\n */ /** for typedoc */\nimport {Resolvable} from \"./resolvable\";\n\n/**\n * An interface which is similar to an Angular 2 `Provider`\n */\nexport interface ProviderLike {\n provide: any,\n useClass?: any,\n useFactory?: Function,\n useValue?: any,\n useExisting?: any,\n deps?: any[]\n}\n\n/**\n * A plain object used to describe a [[Resolvable]]\n *\n * These objects may be used in the [[StateDeclaration.resolve]] array to declare\n * async data that the state or substates require.\n *\n * #### Example:\n * ```js\n *\n * var state = {\n * name: 'main',\n * resolve: [\n * { token: 'myData', deps: [MyDataApi], resolveFn: (myDataApi) => myDataApi.getData() },\n * ],\n * }\n * ```\n */\nexport interface ResolvableLiteral {\n /**\n * A Dependency Injection token\n *\n * This Resolvable's DI token.\n * The Resolvable will be injectable elsewhere using the token.\n */\n token: any;\n\n /**\n * A function which fetches the Resolvable's data\n *\n * A function which returns one of:\n *\n * - The resolved value (synchronously)\n * - A promise for the resolved value\n * - An Observable of the resolved value(s)\n *\n * This function will be provided the dependencies listed in [[deps]] as its arguments.\n * The resolve system will asynchronously fetch the dependencies before invoking this function.\n */\n resolveFn: Function;\n\n /**\n * Defines the Resolve Policy\n *\n * A policy that defines when to invoke the resolve,\n * and whether to wait for async and unwrap the data\n */\n policy?: ResolvePolicy;\n\n /**\n * The Dependency Injection tokens\n *\n * This is an array of Dependency Injection tokens for the dependencies of the [[resolveFn]].\n *\n * The DI tokens are references to other `Resolvables`, or to other\n * services from the native DI system.\n */\n deps?: any[];\n\n /** Pre-resolved data. */\n data?: any\n}\n\n/**\n * Defines how a resolve is processed during a transition\n *\n * This object is the [[StateDeclaration.resolvePolicy]] property.\n *\n * #### Example:\n * ```js\n * // Fetched when the resolve's state is being entered.\n * // Wait for the promise to resolve.\n * var policy1 = { when: \"LAZY\", async: \"WAIT\" }\n *\n * // Fetched when the Transition is starting.\n * // Do not wait for the returned promise to resolve.\n * // Inject the raw promise/value\n * var policy2 = { when: \"EAGER\", async: \"NOWAIT\" }\n * ```\n *\n * The policy for a given Resolvable is merged from three sources (highest priority first):\n *\n * - 1) Individual resolve definition\n * - 2) State definition\n * - 3) Global default\n *\n * #### Example:\n * ```js\n * // Wait for an Observable to emit one item.\n * // Since `wait` is not specified, it uses the `wait`\n * // policy defined on the state, or the global default\n * // if no `wait` policy is defined on the state\n * var myResolvablePolicy = { async: \"RXWAIT\" }\n * ```\n */\nexport interface ResolvePolicy {\n /**\n * Defines when a Resolvable is resolved (fetched) during a transition\n *\n * - `LAZY` (default)\n * - Resolved as the resolve's state is being entered\n * - `EAGER`\n * - Resolved as the transition is starting\n *\n * #### Example:\n * Resolves for `main` and `main.home` are fetched when each state is entered.\n * All of `main` resolves are processed before fetching `main.home` resolves.\n * ```js\n * var state = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { when: 'LAZY' }, // default\n * }\n *\n * var state = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { when: 'LAZY' }, // default\n * }\n * ```\n *\n * #### Example:\n * Resolves for `main` and `main.home` are fetched at the same time when the transition starts.\n * This happens earlier in the lifecycle than when states are entered.\n * All of the `main` and `main.home` resolves are fetched as soon as possible.\n * ```js\n * var mainState = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { when: 'EAGER' },\n * }\n *\n * var homeState = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { when: 'EAGER' },\n * }\n * ```\n */\n when?: PolicyWhen;\n\n /**\n * Determines the unwrapping behavior of asynchronous resolve values.\n *\n * - `WAIT` (default)\n * - If a promise is returned from the resolveFn, wait for the promise before proceeding\n * - The unwrapped value from the promise\n * - `NOWAIT`\n * - If a promise is returned from the resolve, do not wait for the promise.\n * - Any other value returned is wrapped in a promise.\n * - The promise will not be unwrapped.\n * - The promise itself will be provided when the resolve is injected or bound elsewhere.\n * - `RXWAIT`\n * - When an Observable is returned from the resolveFn, wait until the Observable emits at least one item.\n * - The Observable item will not be unwrapped.\n * - The Observable stream itself will be provided when the resolve is injected or bound elsewhere.\n *\n * #### Example:\n * The `Transition` will not wait for the resolve promise(s) from `main` to settle before continuing.\n * Resolves for `main` will be provided to components wrapped in a `Promise`.\n *\n * The `Transition` will wait for the `main.home` resolve promises.\n * Resolved values will be unwrapped before being provided to components.\n * ```js\n * var mainState = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { async: 'NOWAIT' },\n * }\n * var homeState = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { async: 'WAIT' }, // default\n * }\n * ```\n */\n async?: PolicyAsync;\n}\n\nexport type PolicyWhen = \"LAZY\" | \"EAGER\" ;\nexport type PolicyAsync = \"WAIT\" | \"NOWAIT\" | \"RXWAIT\" ;\n\n/** @internalapi */\nexport let resolvePolicies = {\n when: {\n LAZY: \"LAZY\",\n EAGER: \"EAGER\"\n },\n async: {\n WAIT: \"WAIT\",\n NOWAIT: \"NOWAIT\",\n RXWAIT: \"RXWAIT\"\n }\n};\n","/** @module resolve */\n/** for typedoc */\nimport { find, tail, uniqR, unnestR, inArray } from \"../common/common\";\nimport { propEq, not } from \"../common/hof\";\nimport { trace } from \"../common/trace\";\nimport { services, $InjectorLike } from \"../common/coreservices\";\nimport { resolvePolicies, PolicyWhen, ResolvePolicy } from \"./interface\";\nimport { PathNode } from \"../path/pathNode\";\nimport { Resolvable } from \"./resolvable\";\nimport { StateObject } from \"../state/stateObject\";\nimport { PathUtils } from \"../path/pathFactory\";\nimport { stringify } from \"../common/strings\";\nimport { Transition } from \"../transition/transition\";\nimport { UIInjector } from \"../interface\";\nimport { isUndefined } from '../common';\n\nconst whens = resolvePolicies.when;\nconst ALL_WHENS = [whens.EAGER, whens.LAZY];\nconst EAGER_WHENS = [whens.EAGER];\n\nexport const NATIVE_INJECTOR_TOKEN: string = \"Native Injector\";\n\n/**\n * Encapsulates Dependency Injection for a path of nodes\n *\n * UI-Router states are organized as a tree.\n * A nested state has a path of ancestors to the root of the tree.\n * When a state is being activated, each element in the path is wrapped as a [[PathNode]].\n * A `PathNode` is a stateful object that holds things like parameters and resolvables for the state being activated.\n *\n * The ResolveContext closes over the [[PathNode]]s, and provides DI for the last node in the path.\n */\nexport class ResolveContext {\n _injector: UIInjector;\n\n constructor(private _path: PathNode[]) { }\n\n /** Gets all the tokens found in the resolve context, de-duplicated */\n getTokens(): any[] {\n return this._path.reduce((acc, node) => acc.concat(node.resolvables.map(r => r.token)), []).reduce(uniqR, []);\n }\n\n /**\n * Gets the Resolvable that matches the token\n *\n * Gets the last Resolvable that matches the token in this context, or undefined.\n * Throws an error if it doesn't exist in the ResolveContext\n */\n getResolvable(token: any): Resolvable {\n let matching = this._path.map(node => node.resolvables)\n .reduce(unnestR, [])\n .filter((r: Resolvable) => r.token === token);\n return tail(matching);\n }\n\n /** Returns the [[ResolvePolicy]] for the given [[Resolvable]] */\n getPolicy(resolvable: Resolvable): ResolvePolicy {\n let node = this.findNode(resolvable);\n return resolvable.getPolicy(node.state);\n }\n\n /**\n * Returns a ResolveContext that includes a portion of this one\n *\n * Given a state, this method creates a new ResolveContext from this one.\n * The new context starts at the first node (root) and stops at the node for the `state` parameter.\n *\n * #### Why\n *\n * When a transition is created, the nodes in the \"To Path\" are injected from a ResolveContext.\n * A ResolveContext closes over a path of [[PathNode]]s and processes the resolvables.\n * The \"To State\" can inject values from its own resolvables, as well as those from all its ancestor state's (node's).\n * This method is used to create a narrower context when injecting ancestor nodes.\n *\n * @example\n * `let ABCD = new ResolveContext([A, B, C, D]);`\n *\n * Given a path `[A, B, C, D]`, where `A`, `B`, `C` and `D` are nodes for states `a`, `b`, `c`, `d`:\n * When injecting `D`, `D` should have access to all resolvables from `A`, `B`, `C`, `D`.\n * However, `B` should only be able to access resolvables from `A`, `B`.\n *\n * When resolving for the `B` node, first take the full \"To Path\" Context `[A,B,C,D]` and limit to the subpath `[A,B]`.\n * `let AB = ABCD.subcontext(a)`\n */\n subContext(state: StateObject): ResolveContext {\n return new ResolveContext(PathUtils.subPath(this._path, node => node.state === state));\n }\n\n /**\n * Adds Resolvables to the node that matches the state\n *\n * This adds a [[Resolvable]] (generally one created on the fly; not declared on a [[StateDeclaration.resolve]] block).\n * The resolvable is added to the node matching the `state` parameter.\n *\n * These new resolvables are not automatically fetched.\n * The calling code should either fetch them, fetch something that depends on them,\n * or rely on [[resolvePath]] being called when some state is being entered.\n *\n * Note: each resolvable's [[ResolvePolicy]] is merged with the state's policy, and the global default.\n *\n * @param newResolvables the new Resolvables\n * @param state Used to find the node to put the resolvable on\n */\n addResolvables(newResolvables: Resolvable[], state: StateObject) {\n let node = find(this._path, propEq('state', state));\n let keys = newResolvables.map(r => r.token);\n node.resolvables = node.resolvables.filter(r => keys.indexOf(r.token) === -1).concat(newResolvables);\n }\n\n /**\n * Returns a promise for an array of resolved path Element promises\n *\n * @param when\n * @param trans\n * @returns {Promise|any}\n */\n resolvePath(when: PolicyWhen = \"LAZY\", trans?: Transition): Promise<{ token: any, value: any }[]> {\n // This option determines which 'when' policy Resolvables we are about to fetch.\n let whenOption: string = inArray(ALL_WHENS, when) ? when : \"LAZY\";\n // If the caller specified EAGER, only the EAGER Resolvables are fetched.\n // if the caller specified LAZY, both EAGER and LAZY Resolvables are fetched.`\n let matchedWhens = whenOption === resolvePolicies.when.EAGER ? EAGER_WHENS : ALL_WHENS;\n\n // get the subpath to the state argument, if provided\n trace.traceResolvePath(this._path, when, trans);\n\n const matchesPolicy = (acceptedVals: string[], whenOrAsync: \"when\"|\"async\") =>\n (resolvable: Resolvable) =>\n inArray(acceptedVals, this.getPolicy(resolvable)[whenOrAsync]);\n\n // Trigger all the (matching) Resolvables in the path\n // Reduce all the \"WAIT\" Resolvables into an array\n let promises: Promise[] = this._path.reduce((acc, node) => {\n let nodeResolvables = node.resolvables.filter(matchesPolicy(matchedWhens, 'when'));\n let nowait = nodeResolvables.filter(matchesPolicy(['NOWAIT'], 'async'));\n let wait = nodeResolvables.filter(not(matchesPolicy(['NOWAIT'], 'async')));\n\n // For the matching Resolvables, start their async fetch process.\n let subContext = this.subContext(node.state);\n let getResult = (r: Resolvable) => r.get(subContext, trans)\n // Return a tuple that includes the Resolvable's token\n .then(value => ({ token: r.token, value: value }));\n nowait.forEach(getResult);\n return acc.concat(wait.map(getResult));\n }, []);\n\n // Wait for all the \"WAIT\" resolvables\n return services.$q.all(promises);\n }\n\n injector(): UIInjector {\n return this._injector || (this._injector = new UIInjectorImpl(this));\n }\n\n findNode(resolvable: Resolvable): PathNode {\n return find(this._path, (node: PathNode) => inArray(node.resolvables, resolvable));\n }\n\n /**\n * Gets the async dependencies of a Resolvable\n *\n * Given a Resolvable, returns its dependencies as a Resolvable[]\n */\n getDependencies(resolvable: Resolvable): Resolvable[] {\n let node = this.findNode(resolvable);\n // Find which other resolvables are \"visible\" to the `resolvable` argument\n // subpath stopping at resolvable's node, or the whole path (if the resolvable isn't in the path)\n let subPath: PathNode[] = PathUtils.subPath(this._path, x => x === node) || this._path;\n let availableResolvables: Resolvable[] = subPath\n .reduce((acc, _node) => acc.concat(_node.resolvables), []) //all of subpath's resolvables\n .filter(res => res !== resolvable); // filter out the `resolvable` argument\n\n const getDependency = (token: any) => {\n let matching = availableResolvables.filter(r => r.token === token);\n if (matching.length) return tail(matching);\n\n let fromInjector = this.injector().getNative(token);\n if (isUndefined(fromInjector)) {\n throw new Error(\"Could not find Dependency Injection token: \" + stringify(token));\n }\n\n return new Resolvable(token, () => fromInjector, [], fromInjector);\n };\n\n return resolvable.deps.map(getDependency);\n }\n}\n\nclass UIInjectorImpl implements UIInjector {\n native: $InjectorLike;\n\n constructor(public context: ResolveContext) {\n this.native = this.get(NATIVE_INJECTOR_TOKEN) || services.$injector;\n }\n\n get(token: any) {\n let resolvable = this.context.getResolvable(token);\n if (resolvable) {\n if (this.context.getPolicy(resolvable).async === 'NOWAIT') {\n return resolvable.get(this.context);\n }\n\n if (!resolvable.resolved) {\n throw new Error(\"Resolvable async .get() not complete:\" + stringify(resolvable.token))\n }\n return resolvable.data;\n }\n\n return this.getNative(token);\n }\n\n getAsync(token: any) {\n let resolvable = this.context.getResolvable(token);\n if (resolvable) return resolvable.get(this.context);\n return services.$q.when(this.native.get(token));\n }\n\n getNative(token: any) {\n return this.native && this.native.get(token);\n }\n}\n","/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport { trace } from '../common/trace';\nimport { services } from '../common/coreservices';\nimport { stringify } from '../common/strings';\nimport { map, find, extend, mergeR, tail, omit, arrayTuples, unnestR, identity, anyTrueR } from '../common/common';\nimport {isObject, isUndefined} from '../common/predicates';\nimport { prop, propEq, val, not, is } from '../common/hof';\nimport { StateDeclaration, StateOrName } from '../state/interface';\nimport {\n TransitionOptions, TreeChanges, IHookRegistry, TransitionHookPhase, RegisteredHooks, HookRegOptions,\n HookMatchCriteria, TransitionStateHookFn, TransitionHookFn,\n} from './interface'; // has or is using\nimport { TransitionHook } from './transitionHook';\nimport { matchState, makeEvent, RegisteredHook } from './hookRegistry';\nimport { HookBuilder } from './hookBuilder';\nimport { PathNode } from '../path/pathNode';\nimport { PathUtils } from '../path/pathFactory';\nimport { StateObject } from '../state/stateObject';\nimport { TargetState } from '../state/targetState';\nimport { Param } from '../params/param';\nimport { Resolvable } from '../resolve/resolvable';\nimport { ViewConfig } from '../view/interface';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { UIRouter } from '../router';\nimport { UIInjector } from '../interface';\nimport { RawParams } from '../params/interface';\nimport { ResolvableLiteral } from '../resolve/interface';\n\n/** @hidden */\nconst stateSelf: (_state: StateObject) => StateDeclaration = prop(\"self\");\n\n/**\n * Represents a transition between two states.\n *\n * When navigating to a state, we are transitioning **from** the current state **to** the new state.\n *\n * This object contains all contextual information about the to/from states, parameters, resolves.\n * It has information about all states being entered and exited as a result of the transition.\n */\nexport class Transition implements IHookRegistry {\n\n /** @hidden */\n static diToken = Transition;\n\n /**\n * A unique identifier for the transition.\n *\n * This is an auto incrementing integer, starting from `0`.\n */\n $id: number;\n\n /**\n * A reference to the [[UIRouter]] instance\n *\n * This reference can be used to access the router services, such as the [[StateService]]\n */\n router: UIRouter;\n\n /** @hidden */\n private _deferred = services.$q.defer();\n /**\n * This promise is resolved or rejected based on the outcome of the Transition.\n *\n * When the transition is successful, the promise is resolved\n * When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error\n */\n promise: Promise = this._deferred.promise;\n /**\n * A boolean which indicates if the transition was successful\n *\n * After a successful transition, this value is set to true.\n * After an unsuccessful transition, this value is set to false.\n *\n * The value will be undefined if the transition is not complete\n */\n success: boolean;\n /** @hidden */\n _aborted: boolean;\n /** @hidden */\n private _error: any;\n\n /** @hidden Holds the hook registration functions such as those passed to Transition.onStart() */\n _registeredHooks: RegisteredHooks = { };\n\n /** @hidden */\n private _options: TransitionOptions;\n /** @hidden */\n private _treeChanges: TreeChanges;\n /** @hidden */\n private _targetState: TargetState;\n /** @hidden */\n private _hookBuilder = new HookBuilder(this);\n\n\n /** @hidden */\n onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n\n /** @hidden\n * Creates the transition-level hook registration functions\n * (which can then be used to register hooks)\n */\n private createTransitionHookRegFns() {\n this.router.transitionService._pluginapi._getEvents()\n .filter(type => type.hookPhase !== TransitionHookPhase.CREATE)\n .forEach(type => makeEvent(this, this.router.transitionService, type));\n }\n\n /** @internalapi */\n getHooks(hookName: string): RegisteredHook[] {\n return this._registeredHooks[hookName];\n }\n\n /**\n * Creates a new Transition object.\n *\n * If the target state is not valid, an error is thrown.\n *\n * @internalapi\n *\n * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`\n * encapsulates the \"from state\".\n * @param targetState The target state and parameters being transitioned to (also, the transition options)\n * @param router The [[UIRouter]] instance\n */\n constructor(fromPath: PathNode[], targetState: TargetState, router: UIRouter) {\n this.router = router;\n this._targetState = targetState;\n\n if (!targetState.valid()) {\n throw new Error(targetState.error());\n }\n\n // current() is assumed to come from targetState.options, but provide a naive implementation otherwise.\n this._options = extend({ current: val(this) }, targetState.options());\n this.$id = router.transitionService._transitionCount++;\n let toPath = PathUtils.buildToPath(fromPath, targetState);\n this._treeChanges = PathUtils.treeChanges(fromPath, toPath, this._options.reloadState);\n this.createTransitionHookRegFns();\n\n let onCreateHooks = this._hookBuilder.buildHooksForPhase(TransitionHookPhase.CREATE);\n TransitionHook.invokeHooks(onCreateHooks, () => null);\n\n this.applyViewConfigs(router);\n }\n\n private applyViewConfigs(router: UIRouter) {\n let enteringStates = this._treeChanges.entering.map(node => node.state);\n PathUtils.applyViewConfigs(router.transitionService.$view, this._treeChanges.to, enteringStates);\n }\n\n /**\n * @internalapi\n *\n * @returns the internal from [State] object\n */\n $from() {\n return tail(this._treeChanges.from).state;\n }\n\n /**\n * @internalapi\n *\n * @returns the internal to [State] object\n */\n $to() {\n return tail(this._treeChanges.to).state;\n }\n\n /**\n * Returns the \"from state\"\n *\n * Returns the state that the transition is coming *from*.\n *\n * @returns The state declaration object for the Transition's (\"from state\").\n */\n from(): StateDeclaration {\n return this.$from().self;\n }\n\n /**\n * Returns the \"to state\"\n *\n * Returns the state that the transition is going *to*.\n *\n * @returns The state declaration object for the Transition's target state (\"to state\").\n */\n to(): StateDeclaration {\n return this.$to().self;\n }\n\n /**\n * Gets the Target State\n *\n * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object.\n *\n * @returns the [[TargetState]] of this Transition\n */\n targetState() {\n return this._targetState;\n }\n\n /**\n * Determines whether two transitions are equivalent.\n * @deprecated\n */\n is(compare: (Transition|{to?: any, from?: any})): boolean {\n if (compare instanceof Transition) {\n // TODO: Also compare parameters\n return this.is({ to: compare.$to().name, from: compare.$from().name });\n }\n return !(\n (compare.to && !matchState(this.$to(), compare.to)) ||\n (compare.from && !matchState(this.$from(), compare.from))\n );\n }\n\n /**\n * Gets transition parameter values\n *\n * Returns the parameter values for a transition as key/value pairs.\n * This object is immutable.\n *\n * By default, returns the new parameter values (for the \"to state\").\n * To return the previous parameter values, supply `'from'` as the `pathname` argument.\n *\n * @param pathname the name of the treeChanges path to get parameter values for:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n *\n * @returns transition parameter values for the desired path.\n */\n params(pathname?: string): any;\n params(pathname?: string): T;\n params(pathname: string = \"to\") {\n return Object.freeze(this._treeChanges[pathname].map(prop(\"paramValues\")).reduce(mergeR, {}));\n }\n\n\n /**\n * Creates a [[UIInjector]] Dependency Injector\n *\n * Returns a Dependency Injector for the Transition's target state (to state).\n * The injector provides resolve values which the target state has access to.\n *\n * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2).\n *\n * #### Example:\n * ```js\n * .onEnter({ entering: 'myState' }, trans => {\n * var myResolveValue = trans.injector().get('myResolve');\n * // Inject a global service from the global/native injector (if it exists)\n * var MyService = trans.injector().get('MyService');\n * })\n * ```\n *\n * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched.\n * You can use [[UIInjector.getAsync]] to get a promise for the data.\n * #### Example:\n * ```js\n * .onBefore({}, trans => {\n * return trans.injector().getAsync('myResolve').then(myResolveValue =>\n * return myResolveValue !== 'ABORT';\n * });\n * });\n * ```\n *\n * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to.\n * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`.\n * #### Example:\n * ```js\n * .onEnter({ to: 'foo.bar' }, trans => {\n * // returns result of `foo` state's `data` resolve\n * // even though `foo.bar` also has a `data` resolve\n * var fooData = trans.injector('foo').get('data');\n * });\n * ```\n *\n * If you need resolve data from the exiting states, pass `'from'` as `pathName`.\n * The resolve data from the `from` path will be returned.\n * #### Example:\n * ```js\n * .onExit({ exiting: 'foo.bar' }, trans => {\n * // Gets the resolve value of `data` from the exiting state.\n * var fooData = trans.injector(null, 'foo.bar').get('data');\n * });\n * ```\n *\n *\n * @param state Limits the resolves provided to only the resolves the provided state has access to.\n * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states.\n *\n * @returns a [[UIInjector]]\n */\n injector(state?: StateOrName, pathName = \"to\"): UIInjector {\n let path: PathNode[] = this._treeChanges[pathName];\n if (state) path = PathUtils.subPath(path, node => node.state === state || node.state.name === state);\n return new ResolveContext(path).injector();\n }\n\n /**\n * Gets all available resolve tokens (keys)\n *\n * This method can be used in conjunction with [[injector]] to inspect the resolve values\n * available to the Transition.\n *\n * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states\n * in the Transition's [[TreeChanges.to]] path.\n *\n * #### Example:\n * This example logs all resolve values\n * ```js\n * let tokens = trans.getResolveTokens();\n * tokens.forEach(token => console.log(token + \" = \" + trans.injector().get(token)));\n * ```\n *\n * #### Example:\n * This example creates promises for each resolve value.\n * This triggers fetches of resolves (if any have not yet been fetched).\n * When all promises have all settled, it logs the resolve values.\n * ```js\n * let tokens = trans.getResolveTokens();\n * let promise = tokens.map(token => trans.injector().getAsync(token));\n * Promise.all(promises).then(values => console.log(\"Resolved values: \" + values));\n * ```\n *\n * Note: Angular 1 users whould use `$q.all()`\n *\n * @param pathname resolve context's path name (e.g., `to` or `from`)\n *\n * @returns an array of resolve tokens (keys)\n */\n getResolveTokens(pathname: string = \"to\"): any[] {\n return new ResolveContext(this._treeChanges[pathname]).getTokens();\n }\n\n /**\n * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition.\n *\n * #### Example:\n * ```js\n * transitionService.onBefore({}, transition => {\n * transition.addResolvable({\n * token: 'myResolve',\n * deps: ['MyService'],\n * resolveFn: myService => myService.getData()\n * });\n * });\n * ```\n *\n * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]])\n * @param state the state in the \"to path\" which should receive the new resolve (otherwise, the root state)\n */\n addResolvable(resolvable: Resolvable|ResolvableLiteral, state: StateOrName = \"\"): void {\n resolvable = is(Resolvable)(resolvable) ? resolvable : new Resolvable(resolvable);\n\n let stateName: string = (typeof state === \"string\") ? state : state.name;\n let topath = this._treeChanges.to;\n let targetNode = find(topath, node => node.state.name === stateName);\n let resolveContext: ResolveContext = new ResolveContext(topath);\n resolveContext.addResolvables([resolvable as Resolvable], targetNode.state);\n }\n\n /**\n * Gets the transition from which this transition was redirected.\n *\n * If the current transition is a redirect, this method returns the transition that was redirected.\n *\n * #### Example:\n * ```js\n * let transitionA = $state.go('A').transition\n * transitionA.onStart({}, () => $state.target('B'));\n * $transitions.onSuccess({ to: 'B' }, (trans) => {\n * trans.to().name === 'B'; // true\n * trans.redirectedFrom() === transitionA; // true\n * });\n * ```\n *\n * @returns The previous Transition, or null if this Transition is not the result of a redirection\n */\n redirectedFrom(): Transition {\n return this._options.redirectedFrom || null;\n }\n\n /**\n * Gets the original transition in a redirect chain\n *\n * A transition might belong to a long chain of multiple redirects.\n * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain.\n *\n * #### Example:\n * ```js\n * // states\n * registry.register({ name: 'A', redirectTo: 'B' });\n * registry.register({ name: 'B', redirectTo: 'C' });\n * registry.register({ name: 'C', redirectTo: 'D' });\n * registry.register({ name: 'D' });\n *\n * let transitionA = $state.go('A').transition\n *\n * $transitions.onSuccess({ to: 'D' }, (trans) => {\n * trans.to().name === 'D'; // true\n * trans.redirectedFrom().to().name === 'C'; // true\n * trans.originalTransition() === transitionA; // true\n * trans.originalTransition().to().name === 'A'; // true\n * });\n * ```\n *\n * @returns The original Transition that started a redirect chain\n */\n originalTransition(): Transition {\n let rf = this.redirectedFrom();\n return (rf && rf.originalTransition()) || this;\n }\n\n /**\n * Get the transition options\n *\n * @returns the options for this Transition.\n */\n options(): TransitionOptions {\n return this._options;\n }\n\n /**\n * Gets the states being entered.\n *\n * @returns an array of states that will be entered during this transition.\n */\n entering(): StateDeclaration[] {\n return map(this._treeChanges.entering, prop('state')).map(stateSelf);\n }\n\n /**\n * Gets the states being exited.\n *\n * @returns an array of states that will be exited during this transition.\n */\n exiting(): StateDeclaration[] {\n return map(this._treeChanges.exiting, prop('state')).map(stateSelf).reverse();\n }\n\n /**\n * Gets the states being retained.\n *\n * @returns an array of states that are already entered from a previous Transition, that will not be\n * exited during this Transition\n */\n retained(): StateDeclaration[] {\n return map(this._treeChanges.retained, prop('state')).map(stateSelf);\n }\n\n /**\n * Get the [[ViewConfig]]s associated with this Transition\n *\n * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects.\n * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., \"to\" or \"entering\").\n *\n * @param pathname the name of the path to fetch views for:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n * @param state If provided, only returns the `ViewConfig`s for a single state in the path\n *\n * @returns a list of ViewConfig objects for the given path.\n */\n views(pathname: string = \"entering\", state?: StateObject): ViewConfig[] {\n let path = this._treeChanges[pathname];\n path = !state ? path : path.filter(propEq('state', state));\n return path.map(prop(\"views\")).filter(identity).reduce(unnestR, []);\n }\n\n /**\n * Return the transition's tree changes\n *\n * A transition goes from one state/parameters to another state/parameters.\n * During a transition, states are entered and/or exited.\n *\n * This function returns various branches (paths) which represent the changes to the\n * active state tree that are caused by the transition.\n *\n * @param pathname The name of the tree changes path to get:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n */\n treeChanges(pathname: string): PathNode[];\n treeChanges(): TreeChanges;\n treeChanges(pathname?: string) {\n return pathname ? this._treeChanges[pathname] : this._treeChanges;\n }\n\n /**\n * Creates a new transition that is a redirection of the current one.\n *\n * This transition can be returned from a [[TransitionService]] hook to\n * redirect a transition to a new state and/or set of parameters.\n *\n * @internalapi\n *\n * @returns Returns a new [[Transition]] instance.\n */\n redirect(targetState: TargetState): Transition {\n let redirects = 1, trans: Transition = this;\n while ((trans = trans.redirectedFrom()) != null) {\n if (++redirects > 20) throw new Error(`Too many consecutive Transition redirects (20+)`);\n }\n\n let redirectOpts: TransitionOptions = { redirectedFrom: this, source: \"redirect\" };\n // If the original transition was caused by URL sync, then use { location: 'replace' }\n // on the new transition (unless the target state explicitly specifies location: false).\n // This causes the original url to be replaced with the url for the redirect target\n // so the original url disappears from the browser history.\n if (this.options().source === 'url' && targetState.options().location !== false) {\n redirectOpts.location = 'replace';\n }\n\n let newOptions = extend({}, this.options(), targetState.options(), redirectOpts);\n targetState = targetState.withOptions(newOptions, true);\n\n let newTransition = this.router.transitionService.create(this._treeChanges.from, targetState);\n let originalEnteringNodes = this._treeChanges.entering;\n let redirectEnteringNodes = newTransition._treeChanges.entering;\n\n // --- Re-use resolve data from original transition ---\n // When redirecting from a parent state to a child state where the parent parameter values haven't changed\n // (because of the redirect), the resolves fetched by the original transition are still valid in the\n // redirected transition.\n //\n // This allows you to define a redirect on a parent state which depends on an async resolve value.\n // You can wait for the resolve, then redirect to a child state based on the result.\n // The redirected transition does not have to re-fetch the resolve.\n // ---------------------------------------------------------\n\n const nodeIsReloading = (reloadState: StateObject) => (node: PathNode) => {\n return reloadState && node.state.includes[reloadState.name];\n };\n\n // Find any \"entering\" nodes in the redirect path that match the original path and aren't being reloaded\n let matchingEnteringNodes: PathNode[] = PathUtils.matching(redirectEnteringNodes, originalEnteringNodes, PathUtils.nonDynamicParams)\n .filter(not(nodeIsReloading(targetState.options().reloadState)));\n\n // Use the existing (possibly pre-resolved) resolvables for the matching entering nodes.\n matchingEnteringNodes.forEach((node, idx) => {\n node.resolvables = originalEnteringNodes[idx].resolvables;\n });\n\n return newTransition;\n }\n\n /** @hidden If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */\n private _changedParams(): Param[] {\n let tc = this._treeChanges;\n\n /** Return undefined if it's not a \"dynamic\" transition, for the following reasons */\n // If user explicitly wants a reload\n if (this._options.reload) return undefined;\n // If any states are exiting or entering\n if (tc.exiting.length || tc.entering.length) return undefined;\n // If to/from path lengths differ\n if (tc.to.length !== tc.from.length) return undefined;\n // If the to/from paths are different\n let pathsDiffer: boolean = arrayTuples(tc.to, tc.from)\n .map(tuple => tuple[0].state !== tuple[1].state)\n .reduce(anyTrueR, false);\n if (pathsDiffer) return undefined;\n\n // Find any parameter values that differ\n let nodeSchemas: Param[][] = tc.to.map((node: PathNode) => node.paramSchema);\n let [toValues, fromValues] = [tc.to, tc.from].map(path => path.map(x => x.paramValues));\n let tuples = arrayTuples(nodeSchemas, toValues, fromValues);\n\n return tuples.map(([schema, toVals, fromVals]) => Param.changed(schema, toVals, fromVals)).reduce(unnestR, []);\n }\n\n /**\n * Returns true if the transition is dynamic.\n *\n * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed.\n *\n * @returns true if the Transition is dynamic\n */\n dynamic(): boolean {\n let changes = this._changedParams();\n return !changes ? false : changes.map(x => x.dynamic).reduce(anyTrueR, false);\n }\n\n /**\n * Returns true if the transition is ignored.\n *\n * A transition is ignored if no states are entered nor exited, and no parameter values have changed.\n *\n * @returns true if the Transition is ignored.\n */\n ignored(): boolean {\n return !!this._ignoredReason();\n }\n\n /** @hidden */\n _ignoredReason(): \"SameAsCurrent\"|\"SameAsPending\"|undefined {\n const pending = this.router.globals.transition;\n const reloadState = this._options.reloadState;\n\n const same = (pathA, pathB) => {\n if (pathA.length !== pathB.length) return false;\n const matching = PathUtils.matching(pathA, pathB);\n return pathA.length === matching.filter(node => !reloadState || !node.state.includes[reloadState.name]).length;\n };\n\n let newTC = this.treeChanges();\n let pendTC = pending && pending.treeChanges();\n\n if (pendTC && same(pendTC.to, newTC.to) && same(pendTC.exiting, newTC.exiting)) return \"SameAsPending\";\n if (newTC.exiting.length === 0 && newTC.entering.length === 0 && same(newTC.from, newTC.to)) return \"SameAsCurrent\";\n }\n\n /**\n * Runs the transition\n *\n * This method is generally called from the [[StateService.transitionTo]]\n *\n * @internalapi\n *\n * @returns a promise for a successful transition.\n */\n run(): Promise {\n let runAllHooks = TransitionHook.runAllHooks;\n\n // Gets transition hooks array for the given phase\n const getHooksFor = (phase: TransitionHookPhase) =>\n this._hookBuilder.buildHooksForPhase(phase);\n\n // When the chain is complete, then resolve or reject the deferred\n const transitionSuccess = () => {\n trace.traceSuccess(this.$to(), this);\n this.success = true;\n this._deferred.resolve(this.to());\n runAllHooks(getHooksFor(TransitionHookPhase.SUCCESS));\n };\n\n const transitionError = (reason: any) => {\n trace.traceError(reason, this);\n this.success = false;\n this._deferred.reject(reason);\n this._error = reason;\n runAllHooks(getHooksFor(TransitionHookPhase.ERROR));\n };\n\n const runTransition = () => {\n // Wait to build the RUN hook chain until the BEFORE hooks are done\n // This allows a BEFORE hook to dynamically add additional RUN hooks via the Transition object.\n let allRunHooks = getHooksFor(TransitionHookPhase.RUN);\n let done = () => services.$q.when(undefined);\n return TransitionHook.invokeHooks(allRunHooks, done);\n };\n\n const startTransition = () => {\n let globals = this.router.globals;\n\n globals.lastStartedTransitionId = this.$id;\n globals.transition = this;\n globals.transitionHistory.enqueue(this);\n\n trace.traceTransitionStart(this);\n\n return services.$q.when(undefined);\n };\n\n let allBeforeHooks = getHooksFor(TransitionHookPhase.BEFORE);\n TransitionHook.invokeHooks(allBeforeHooks, startTransition)\n .then(runTransition)\n .then(transitionSuccess, transitionError);\n\n return this.promise;\n }\n\n /** Checks if this transition is currently active/running. */\n isActive = () =>\n this.router.globals.transition === this;\n\n /**\n * Checks if the Transition is valid\n *\n * @returns true if the Transition is valid\n */\n valid() {\n return !this.error() || this.success !== undefined;\n }\n\n /**\n * Aborts this transition\n *\n * Imperative API to abort a Transition.\n * This only applies to Transitions that are not yet complete.\n */\n abort() {\n // Do not set flag if the transition is already complete\n if (isUndefined(this.success)) {\n this._aborted = true;\n }\n }\n\n /**\n * The Transition error reason.\n *\n * If the transition is invalid (and could not be run), returns the reason the transition is invalid.\n * If the transition was valid and ran, but was not successful, returns the reason the transition failed.\n *\n * @returns an error message explaining why the transition is invalid, or the reason the transition failed.\n */\n error() {\n let state: StateObject = this.$to();\n\n if (state.self.abstract)\n return `Cannot transition to abstract state '${state.name}'`;\n\n const paramDefs = state.parameters(), values = this.params();\n const invalidParams = paramDefs.filter(param => !param.validates(values[param.id]));\n if (invalidParams.length) {\n return `Param values not valid for state '${state.name}'. Invalid params: [ ${invalidParams.map(param => param.id).join(', ')} ]`;\n }\n\n if (this.success === false)\n return this._error;\n }\n\n /**\n * A string representation of the Transition\n *\n * @returns A string representation of the Transition\n */\n toString () {\n let fromStateOrName = this.from();\n let toStateOrName = this.to();\n\n const avoidEmptyHash = (params: RawParams) =>\n (params[\"#\"] !== null && params[\"#\"] !== undefined) ? params : omit(params, [\"#\"]);\n\n // (X) means the to state is invalid.\n let id = this.$id,\n from = isObject(fromStateOrName) ? fromStateOrName.name : fromStateOrName,\n fromParams = stringify(avoidEmptyHash(this._treeChanges.from.map(prop('paramValues')).reduce(mergeR, {}))),\n toValid = this.valid() ? \"\" : \"(X) \",\n to = isObject(toStateOrName) ? toStateOrName.name : toStateOrName,\n toParams = stringify(avoidEmptyHash(this.params()));\n\n return `Transition#${id}( '${from}'${fromParams} -> ${toValid}'${to}'${toParams} )`;\n }\n}\n","/**\n * Functions that manipulate strings\n *\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_strings\n */ /** */\n\nimport { isString, isArray, isDefined, isNull, isPromise, isInjectable, isObject } from \"./predicates\";\nimport { Rejection } from \"../transition/rejectFactory\";\nimport { IInjectable, identity, Obj, tail, pushR } from \"./common\";\nimport { pattern, is, not, val, invoke } from \"./hof\";\nimport { Transition } from \"../transition/transition\";\nimport { Resolvable } from \"../resolve/resolvable\";\n\n/**\n * Returns a string shortened to a maximum length\n *\n * If the string is already less than the `max` length, return the string.\n * Else return the string, shortened to `max - 3` and append three dots (\"...\").\n *\n * @param max the maximum length of the string to return\n * @param str the input string\n */\nexport function maxLength(max: number, str: string) {\n if (str.length <= max) return str;\n return str.substr(0, max - 3) + \"...\";\n}\n\n/**\n * Returns a string, with spaces added to the end, up to a desired str length\n *\n * If the string is already longer than the desired length, return the string.\n * Else returns the string, with extra spaces on the end, such that it reaches `length` characters.\n *\n * @param length the desired length of the string to return\n * @param str the input string\n */\nexport function padString(length: number, str: string) {\n while (str.length < length) str += \" \";\n return str;\n}\n\nexport function kebobString(camelCase: string) {\n return camelCase\n .replace(/^([A-Z])/, $1 => $1.toLowerCase()) // replace first char\n .replace(/([A-Z])/g, $1 => \"-\" + $1.toLowerCase()); // replace rest\n}\n\nfunction _toJson(obj: Obj) {\n return JSON.stringify(obj);\n}\n\nfunction _fromJson(json: string) {\n return isString(json) ? JSON.parse(json) : json;\n}\n\n\nfunction promiseToString(p: Promise) {\n return `Promise(${JSON.stringify(p)})`;\n}\n\nexport function functionToString(fn: Function) {\n let fnStr = fnToString(fn);\n let namedFunctionMatch = fnStr.match(/^(function [^ ]+\\([^)]*\\))/);\n let toStr = namedFunctionMatch ? namedFunctionMatch[1] : fnStr;\n\n let fnName = fn['name'] || \"\";\n if (fnName && toStr.match(/function \\(/)) {\n return 'function ' + fnName + toStr.substr(9);\n }\n return toStr;\n}\n\nexport function fnToString(fn: IInjectable) {\n let _fn = isArray(fn) ? fn.slice(-1)[0] : fn;\n return _fn && _fn.toString() || \"undefined\";\n}\n\nlet stringifyPatternFn: (val: any) => string = null;\nlet stringifyPattern = function(value: any) {\n let isRejection = Rejection.isRejectionPromise;\n\n stringifyPatternFn = stringifyPatternFn || pattern([\n [not(isDefined), val(\"undefined\")],\n [isNull, val(\"null\")],\n [isPromise, val(\"[Promise]\")],\n [isRejection, (x: any) => x._transitionRejection.toString()],\n [is(Rejection), invoke(\"toString\")],\n [is(Transition), invoke(\"toString\")],\n [is(Resolvable), invoke(\"toString\")],\n [isInjectable, functionToString],\n [val(true), identity]\n ]);\n\n return stringifyPatternFn(value);\n};\n\nexport function stringify(o: any) {\n var seen: any[] = [];\n\n function format(val: any) {\n if (isObject(val)) {\n if (seen.indexOf(val) !== -1) return '[circular ref]';\n seen.push(val);\n }\n return stringifyPattern(val);\n }\n\n return JSON.stringify(o, (key, val) => format(val)).replace(/\\\\\"/g, '\"');\n}\n\n/** Returns a function that splits a string on a character or substring */\nexport const beforeAfterSubstr = (char: string) => (str: string): string[] => {\n if (!str) return [\"\", \"\"];\n let idx = str.indexOf(char);\n if (idx === -1) return [str, \"\"];\n return [str.substr(0, idx), str.substr(idx + 1)];\n};\n\nexport const hostRegex = new RegExp('^(?:[a-z]+:)?//[^/]+/');\nexport const stripFile = (str: string) => str.replace(/\\/[^/]*$/, '');\nexport const splitHash = beforeAfterSubstr(\"#\");\nexport const splitQuery = beforeAfterSubstr(\"?\");\nexport const splitEqual = beforeAfterSubstr(\"=\");\nexport const trimHashVal = (str: string) => str ? str.replace(/^#/, \"\") : \"\";\n\n/**\n * Splits on a delimiter, but returns the delimiters in the array\n *\n * #### Example:\n * ```js\n * var splitOnSlashes = splitOnDelim('/');\n * splitOnSlashes(\"/foo\"); // [\"/\", \"foo\"]\n * splitOnSlashes(\"/foo/\"); // [\"/\", \"foo\", \"/\"]\n * ```\n */\nexport function splitOnDelim(delim: string) {\n let re = new RegExp(\"(\" + delim + \")\", \"g\");\n return (str: string) =>\n str.split(re).filter(identity);\n};\n\n\n/**\n * Reduce fn that joins neighboring strings\n *\n * Given an array of strings, returns a new array\n * where all neighboring strings have been joined.\n *\n * #### Example:\n * ```js\n * let arr = [\"foo\", \"bar\", 1, \"baz\", \"\", \"qux\" ];\n * arr.reduce(joinNeighborsR, []) // [\"foobar\", 1, \"bazqux\" ]\n * ```\n */\nexport function joinNeighborsR(acc: any[], x: any) {\n if (isString(tail(acc)) && isString(x))\n return acc.slice(0, -1).concat(tail(acc)+ x);\n return pushR(acc, x);\n};\n\n","/** @module common */ /** for typedoc */\nexport * from \"./common\";\nexport * from \"./coreservices\";\nexport * from \"./glob\";\nexport * from \"./hof\";\nexport * from \"./predicates\";\nexport * from \"./queue\";\nexport * from \"./strings\";\nexport * from \"./trace\";\n","/**\n * @coreapi\n * @module params\n */\n/** */\nimport { fromJson, toJson, identity, equals, inherit, map, extend, pick } from \"../common/common\";\nimport { isDefined, isNullOrUndefined } from \"../common/predicates\";\nimport { is } from \"../common/hof\";\nimport { services } from \"../common/coreservices\";\nimport { ParamType } from \"./paramType\";\nimport { ParamTypeDefinition } from \"./interface\";\n\n/**\n * A registry for parameter types.\n *\n * This registry manages the built-in (and custom) parameter types.\n *\n * The built-in parameter types are:\n *\n * - [[string]]\n * - [[path]]\n * - [[query]]\n * - [[hash]]\n * - [[int]]\n * - [[bool]]\n * - [[date]]\n * - [[json]]\n * - [[any]]\n */\nexport class ParamTypes {\n /** @hidden */\n types: any;\n /** @hidden */\n enqueue: boolean = true;\n /** @hidden */\n typeQueue: any[] = [];\n\n /**\n * Built-in parameter type: `string`\n *\n * This parameter type coerces values to strings.\n * It matches anything (`new RegExp(\".*\")`) in the URL\n */\n static string: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `path`\n *\n * This parameter type is the default type for path parameters.\n * A path parameter is any parameter declared in the path portion of a url\n *\n * - `/foo/:param1/:param2`: two path parameters\n *\n * This parameter type behaves exactly like the [[string]] type with one exception.\n * When matching parameter values in the URL, the `path` type does not match forward slashes `/`.\n *\n * #### Angular 1 note:\n * In ng1, this type is overridden with one that pre-encodes slashes as `~2F` instead of `%2F`.\n * For more details about this angular 1 behavior, see: https://github.com/angular-ui/ui-router/issues/2598\n */\n static path: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `query`\n *\n * This parameter type is the default type for query/search parameters.\n * It behaves the same as the [[string]] parameter type.\n *\n * A query parameter is any parameter declared in the query/search portion of a url\n *\n * - `/bar?param2`: a query parameter\n */\n static query: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `hash`\n *\n * This parameter type is used for the `#` parameter (the hash)\n * It behaves the same as the [[string]] parameter type.\n * @coreapi\n */\n static hash: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `int`\n *\n * This parameter type serializes javascript integers (`number`s which represent an integer) to the URL.\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'user',\n * url: '/user/{id:int}'\n * });\n * ```\n * ```js\n * $state.go('user', { id: 1298547 });\n * ```\n *\n * The URL will serialize to: `/user/1298547`.\n *\n * When the parameter value is read, it will be the `number` `1298547`, not the string `\"1298547\"`.\n */\n static int: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `bool`\n *\n * This parameter type serializes `true`/`false` as `1`/`0`\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'inbox',\n * url: '/inbox?{unread:bool}'\n * });\n * ```\n * ```js\n * $state.go('inbox', { unread: true });\n * ```\n *\n * The URL will serialize to: `/inbox?unread=1`.\n *\n * Conversely, if the url is `/inbox?unread=0`, the value of the `unread` parameter will be a `false`.\n */\n static bool: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `date`\n *\n * This parameter type can be used to serialize Javascript dates as parameter values.\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'search',\n * url: '/search?{start:date}'\n * });\n * ```\n * ```js\n * $state.go('search', { start: new Date(2000, 0, 1) });\n * ```\n *\n * The URL will serialize to: `/search?start=2000-01-01`.\n *\n * Conversely, if the url is `/search?start=2016-12-25`, the value of the `start` parameter will be a `Date` object where:\n *\n * - `date.getFullYear() === 2016`\n * - `date.getMonth() === 11` (month is 0-based)\n * - `date.getDate() === 25`\n */\n static date: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `json`\n *\n * This parameter type can be used to serialize javascript objects into the URL using JSON serialization.\n *\n * #### Example:\n * This example serializes an plain javascript object to the URL\n * ```js\n * .state({\n * name: 'map',\n * url: '/map/{coords:json}'\n * });\n * ```\n * ```js\n * $state.go('map', { coords: { x: 10399.2, y: 49071 });\n * ```\n *\n * The URL will serialize to: `/map/%7B%22x%22%3A10399.2%2C%22y%22%3A49071%7D`\n */\n static json: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `any`\n *\n * This parameter type is used by default for url-less parameters (parameters that do not appear in the URL).\n * This type does not encode or decode.\n * It is compared using a deep `equals` comparison.\n *\n * #### Example:\n * This example defines a non-url parameter on a [[StateDeclaration]].\n * ```js\n * .state({\n * name: 'new',\n * url: '/new',\n * params: {\n * inrepyto: null\n * }\n * });\n * ```\n * ```js\n * $state.go('new', { inreplyto: currentMessage });\n * ```\n */\n static any: ParamTypeDefinition;\n\n\n /** @internalapi */\n private defaultTypes: any = pick(ParamTypes.prototype, [\"hash\", \"string\", \"query\", \"path\", \"int\", \"bool\", \"date\", \"json\", \"any\"]);\n\n /** @internalapi */\n constructor() {\n // Register default types. Store them in the prototype of this.types.\n const makeType = (definition: ParamTypeDefinition, name: string) =>\n new ParamType(extend({ name }, definition));\n this.types = inherit(map(this.defaultTypes, makeType), {});\n }\n\n /** @internalapi */\n dispose() {\n this.types = {};\n }\n\n /**\n * Registers a parameter type\n *\n * End users should call [[UrlMatcherFactory.type]], which delegates to this method.\n */\n type(name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {\n if (!isDefined(definition)) return this.types[name];\n if (this.types.hasOwnProperty(name)) throw new Error(`A type named '${name}' has already been defined.`);\n\n this.types[name] = new ParamType(extend({ name }, definition));\n\n if (definitionFn) {\n this.typeQueue.push({ name, def: definitionFn });\n if (!this.enqueue) this._flushTypeQueue();\n }\n\n return this;\n }\n\n /** @internalapi */\n _flushTypeQueue() {\n while (this.typeQueue.length) {\n let type = this.typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n extend(this.types[type.name], services.$injector.invoke(type.def));\n }\n }\n}\n\n/** @hidden */\nfunction initDefaultTypes() {\n\n const makeDefaultType = (def) => {\n const valToString = (val: any) =>\n val != null ? val.toString() : val;\n\n const defaultTypeBase = {\n encode: valToString,\n decode: valToString,\n is: is(String),\n pattern: /.*/,\n equals: (a: any, b: any) => a == b, // allow coersion for null/undefined/\"\"\n };\n\n return extend({}, defaultTypeBase, def) as ParamTypeDefinition;\n };\n\n // Default Parameter Type Definitions\n extend(ParamTypes.prototype, {\n string: makeDefaultType({}),\n\n path: makeDefaultType({\n pattern: /[^/]*/,\n }),\n\n query: makeDefaultType({}),\n\n hash: makeDefaultType({\n inherit: false,\n }),\n\n int: makeDefaultType({\n decode: (val: string) => parseInt(val, 10),\n is: function(val: any) {\n return !isNullOrUndefined(val) && this.decode(val.toString()) === val;\n },\n pattern: /-?\\d+/,\n }),\n\n bool: makeDefaultType({\n encode: (val: any) => val && 1 || 0,\n decode: (val: string) => parseInt(val, 10) !== 0,\n is: is(Boolean),\n pattern: /0|1/,\n }),\n\n date: makeDefaultType({\n encode: function(val: any) {\n return !this.is(val) ? undefined : [\n val.getFullYear(),\n ('0' + (val.getMonth() + 1)).slice(-2),\n ('0' + val.getDate()).slice(-2),\n ].join(\"-\");\n },\n decode: function(val: string) {\n if (this.is(val)) return val as Date;\n let match = this.capture.exec(val);\n return match ? new Date(match[1], match[2] - 1, match[3]) : undefined;\n },\n is: (val: any) => val instanceof Date && !isNaN(val.valueOf()),\n equals(l: any, r: any) {\n return ['getFullYear', 'getMonth', 'getDate']\n .reduce((acc, fn) => acc && l[fn]() === r[fn](), true);\n },\n pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,\n capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/,\n }),\n\n json: makeDefaultType({\n encode: toJson,\n decode: fromJson,\n is: is(Object),\n equals: equals,\n pattern: /[^/]*/,\n }),\n\n // does not encode/decode\n any: makeDefaultType({\n encode: identity,\n decode: identity,\n is: () => true,\n equals: equals,\n }),\n });\n}\n\ninitDefaultTypes();\n\n","/**\n * @coreapi\n * @module params\n */\n/** */\nimport {extend, ancestors, Obj} from \"../common/common\";\nimport {StateObject} from \"../state/stateObject\";\n\n/** @internalapi */\nexport class StateParams {\n [key: string]: any;\n\n constructor(params: Obj = {}) {\n extend(this, params);\n }\n\n /**\n * Merges a set of parameters with all parameters inherited between the common parents of the\n * current state and a given destination state.\n *\n * @param {Object} newParams The set of parameters which will be composited with inherited params.\n * @param {Object} $current Internal definition of object representing the current state.\n * @param {Object} $to Internal definition of object representing state to transition to.\n */\n $inherit(newParams: Obj, $current: StateObject, $to: StateObject) {\n let parents = ancestors($current, $to),\n parentParams: string[],\n inherited: Obj = {},\n inheritList: string[] = [];\n\n for (let i in parents) {\n if (!parents[i] || !parents[i].params) continue;\n parentParams = Object.keys(parents[i].params);\n if (!parentParams.length) continue;\n\n for (let j in parentParams) {\n if (inheritList.indexOf(parentParams[j]) >= 0) continue;\n inheritList.push(parentParams[j]);\n inherited[parentParams[j]] = this[parentParams[j]];\n }\n }\n return extend({}, inherited, newParams);\n };\n}\n\n","/** @module path */ /** for typedoc */\nexport * from \"./pathNode\";\nexport * from \"./pathFactory\";","/** @module resolve */ /** for typedoc */\nexport * from \"./interface\";\nexport * from \"./resolvable\";\nexport * from \"./resolveContext\";\n","/** @module state */ /** for typedoc */\nimport {Obj, omit, noop, extend, inherit, values, applyPairs, tail, mapObj, identity} from \"../common/common\";\nimport {isDefined, isFunction, isString, isArray} from \"../common/predicates\";\nimport {stringify} from \"../common/strings\";\nimport {prop, pattern, is, pipe, val} from \"../common/hof\";\nimport {StateDeclaration} from \"./interface\";\n\nimport {StateObject} from \"./stateObject\";\nimport {StateMatcher} from \"./stateMatcher\";\nimport {Param} from \"../params/param\";\nimport {UrlMatcherFactory} from \"../url/urlMatcherFactory\";\nimport {UrlMatcher} from \"../url/urlMatcher\";\nimport {Resolvable} from \"../resolve/resolvable\";\nimport {services} from \"../common/coreservices\";\nimport {ResolvePolicy} from \"../resolve/interface\";\nimport { ParamFactory } from \"../url/interface\";\n\nconst parseUrl = (url: string): any => {\n if (!isString(url)) return false;\n let root = url.charAt(0) === '^';\n return { val: root ? url.substring(1) : url, root };\n};\n\nexport type BuilderFunction = (state: StateObject, parent?: BuilderFunction) => any;\n\ninterface Builders {\n [key: string]: BuilderFunction[];\n\n name: BuilderFunction[];\n parent: BuilderFunction[];\n data: BuilderFunction[];\n url: BuilderFunction[];\n navigable: BuilderFunction[];\n params: BuilderFunction[];\n views: BuilderFunction[];\n path: BuilderFunction[];\n includes: BuilderFunction[];\n resolvables: BuilderFunction[];\n}\n\n\nfunction nameBuilder(state: StateObject) {\n return state.name;\n}\n\nfunction selfBuilder(state: StateObject) {\n state.self.$$state = () => state;\n return state.self;\n}\n\nfunction dataBuilder(state: StateObject) {\n if (state.parent && state.parent.data) {\n state.data = state.self.data = inherit(state.parent.data, state.data);\n }\n return state.data;\n}\n\nconst getUrlBuilder = ($urlMatcherFactoryProvider: UrlMatcherFactory, root: () => StateObject) =>\nfunction urlBuilder(state: StateObject) {\n let stateDec: StateDeclaration = state;\n\n // For future states, i.e., states whose name ends with `.**`,\n // match anything that starts with the url prefix\n if (stateDec && stateDec.url && stateDec.name && stateDec.name.match(/\\.\\*\\*$/)) {\n stateDec.url += \"{remainder:any}\"; // match any path (.*)\n }\n\n const parsed = parseUrl(stateDec.url), parent = state.parent;\n const url = !parsed ? stateDec.url : $urlMatcherFactoryProvider.compile(parsed.val, {\n params: state.params || {},\n paramMap: function (paramConfig: any, isSearch: boolean) {\n if (stateDec.reloadOnSearch === false && isSearch) paramConfig = extend(paramConfig || {}, {dynamic: true});\n return paramConfig;\n }\n });\n\n if (!url) return null;\n if (!$urlMatcherFactoryProvider.isMatcher(url)) throw new Error(`Invalid url '${url}' in state '${state}'`);\n return (parsed && parsed.root) ? url : ((parent && parent.navigable) || root()).url.append( url);\n};\n\nconst getNavigableBuilder = (isRoot: (state: StateObject) => boolean) =>\nfunction navigableBuilder(state: StateObject) {\n return !isRoot(state) && state.url ? state : (state.parent ? state.parent.navigable : null);\n};\n\nconst getParamsBuilder = (paramFactory: ParamFactory) =>\nfunction paramsBuilder(state: StateObject): { [key: string]: Param } {\n const makeConfigParam = (config: any, id: string) => paramFactory.fromConfig(id, null, config);\n let urlParams: Param[] = (state.url && state.url.parameters({inherit: false})) || [];\n let nonUrlParams: Param[] = values(mapObj(omit(state.params || {}, urlParams.map(prop('id'))), makeConfigParam));\n return urlParams.concat(nonUrlParams).map(p => [p.id, p]).reduce(applyPairs, {});\n};\n\nfunction pathBuilder(state: StateObject) {\n return state.parent ? state.parent.path.concat(state) : /*root*/ [state];\n}\n\nfunction includesBuilder(state: StateObject) {\n let includes = state.parent ? extend({}, state.parent.includes) : {};\n includes[state.name] = true;\n return includes;\n}\n\n/**\n * This is a [[StateBuilder.builder]] function for the `resolve:` block on a [[StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * validates the `resolve` property and converts it to a [[Resolvable]] array.\n *\n * resolve: input value can be:\n *\n * {\n * // analyzed but not injected\n * myFooResolve: function() { return \"myFooData\"; },\n *\n * // function.toString() parsed, \"DependencyName\" dep as string (not min-safe)\n * myBarResolve: function(DependencyName) { return DependencyName.fetchSomethingAsPromise() },\n *\n * // Array split; \"DependencyName\" dep as string\n * myBazResolve: [ \"DependencyName\", function(dep) { return dep.fetchSomethingAsPromise() },\n *\n * // Array split; DependencyType dep as token (compared using ===)\n * myQuxResolve: [ DependencyType, function(dep) { return dep.fetchSometingAsPromise() },\n *\n * // val.$inject used as deps\n * // where:\n * // corgeResolve.$inject = [\"DependencyName\"];\n * // function corgeResolve(dep) { dep.fetchSometingAsPromise() }\n * // then \"DependencyName\" dep as string\n * myCorgeResolve: corgeResolve,\n *\n * // inject service by name\n * // When a string is found, desugar creating a resolve that injects the named service\n * myGraultResolve: \"SomeService\"\n * }\n *\n * or:\n *\n * [\n * new Resolvable(\"myFooResolve\", function() { return \"myFooData\" }),\n * new Resolvable(\"myBarResolve\", function(dep) { return dep.fetchSomethingAsPromise() }, [ \"DependencyName\" ]),\n * { provide: \"myBazResolve\", useFactory: function(dep) { dep.fetchSomethingAsPromise() }, deps: [ \"DependencyName\" ] }\n * ]\n */\nexport function resolvablesBuilder(state: StateObject): Resolvable[] {\n interface Tuple { token: any, val: any, deps: any[], policy: ResolvePolicy }\n \n /** convert resolve: {} and resolvePolicy: {} objects to an array of tuples */\n const objects2Tuples = (resolveObj: Obj, resolvePolicies: { [key: string]: ResolvePolicy }) =>\n Object.keys(resolveObj || {}).map(token => ({token, val: resolveObj[token], deps: undefined, policy: resolvePolicies[token]}));\n\n /** fetch DI annotations from a function or ng1-style array */\n const annotate = (fn: Function) => {\n let $injector = services.$injector;\n // ng1 doesn't have an $injector until runtime.\n // If the $injector doesn't exist, use \"deferred\" literal as a\n // marker indicating they should be annotated when runtime starts\n return fn['$inject'] || ($injector && $injector.annotate(fn, $injector.strictDi)) || \"deferred\";\n };\n\n /** true if the object has both `token` and `resolveFn`, and is probably a [[ResolveLiteral]] */\n const isResolveLiteral = (obj: any) => !!(obj.token && obj.resolveFn);\n\n /** true if the object looks like a provide literal, or a ng2 Provider */\n const isLikeNg2Provider = (obj: any) => !!((obj.provide || obj.token) && (obj.useValue || obj.useFactory || obj.useExisting || obj.useClass));\n\n /** true if the object looks like a tuple from obj2Tuples */\n const isTupleFromObj = (obj: any) => !!(obj && obj.val && (isString(obj.val) || isArray(obj.val) || isFunction(obj.val)));\n\n /** extracts the token from a Provider or provide literal */\n const token = (p: any) => p.provide || p.token;\n\n /** Given a literal resolve or provider object, returns a Resolvable */\n const literal2Resolvable = pattern([\n [prop('resolveFn'), p => new Resolvable(token(p), p.resolveFn, p.deps, p.policy)],\n [prop('useFactory'), p => new Resolvable(token(p), p.useFactory, (p.deps || p.dependencies), p.policy)],\n [prop('useClass'), p => new Resolvable(token(p), () => new (p.useClass)(), [], p.policy)],\n [prop('useValue'), p => new Resolvable(token(p), () => p.useValue, [], p.policy, p.useValue)],\n [prop('useExisting'), p => new Resolvable(token(p), identity, [p.useExisting], p.policy)],\n ]);\n\n const tuple2Resolvable = pattern([\n [pipe(prop(\"val\"), isString), (tuple: Tuple) => new Resolvable(tuple.token, identity, [ tuple.val ], tuple.policy)],\n [pipe(prop(\"val\"), isArray), (tuple: Tuple) => new Resolvable(tuple.token, tail( tuple.val), tuple.val.slice(0, -1), tuple.policy)],\n [pipe(prop(\"val\"), isFunction), (tuple: Tuple) => new Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy)],\n ]);\n\n const item2Resolvable = <(obj: any) => Resolvable> pattern([\n [is(Resolvable), (r: Resolvable) => r],\n [isResolveLiteral, literal2Resolvable],\n [isLikeNg2Provider, literal2Resolvable],\n [isTupleFromObj, tuple2Resolvable],\n [val(true), (obj: any) => { throw new Error(\"Invalid resolve value: \" + stringify(obj)) }]\n ]);\n\n // If resolveBlock is already an array, use it as-is.\n // Otherwise, assume it's an object and convert to an Array of tuples\n let decl = state.resolve;\n let items: any[] = isArray(decl) ? decl : objects2Tuples(decl, state.resolvePolicy || {});\n return items.map(item2Resolvable);\n}\n\n/**\n * @internalapi A internal global service\n *\n * StateBuilder is a factory for the internal [[StateObject]] objects.\n *\n * When you register a state with the [[StateRegistry]], you register a plain old javascript object which\n * conforms to the [[StateDeclaration]] interface. This factory takes that object and builds the corresponding\n * [[StateObject]] object, which has an API and is used internally.\n *\n * Custom properties or API may be added to the internal [[StateObject]] object by registering a decorator function\n * using the [[builder]] method.\n */\nexport class StateBuilder {\n /** An object that contains all the BuilderFunctions registered, key'd by the name of the State property they build */\n private builders: Builders;\n\n constructor(private matcher: StateMatcher, urlMatcherFactory: UrlMatcherFactory) {\n let self = this;\n\n const root = () => matcher.find(\"\");\n const isRoot = (state: StateObject) => state.name === \"\";\n\n function parentBuilder(state: StateObject) {\n if (isRoot(state)) return null;\n return matcher.find(self.parentName(state)) || root();\n }\n\n this.builders = {\n name: [ nameBuilder ],\n self: [ selfBuilder ],\n parent: [ parentBuilder ],\n data: [ dataBuilder ],\n // Build a URLMatcher if necessary, either via a relative or absolute URL\n url: [ getUrlBuilder(urlMatcherFactory, root) ],\n // Keep track of the closest ancestor state that has a URL (i.e. is navigable)\n navigable: [ getNavigableBuilder(isRoot) ],\n params: [ getParamsBuilder(urlMatcherFactory.paramFactory) ],\n // Each framework-specific ui-router implementation should define its own `views` builder\n // e.g., src/ng1/statebuilders/views.ts\n views: [],\n // Keep a full path from the root down to this state as this is needed for state activation.\n path: [ pathBuilder ],\n // Speed up $state.includes() as it's used a lot\n includes: [ includesBuilder ],\n resolvables: [ resolvablesBuilder ]\n };\n }\n\n /**\n * Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`).\n * More than one BuilderFunction can be registered for a given property.\n *\n * The BuilderFunction(s) will be used to define the property on any subsequently built [[StateObject]] objects.\n *\n * @param name The name of the State property being registered for.\n * @param fn The BuilderFunction which will be used to build the State property\n * @returns a function which deregisters the BuilderFunction\n */\n builder(name: string, fn: BuilderFunction): (BuilderFunction|BuilderFunction[]|Function) {\n let builders = this.builders;\n let array = builders[name] || [];\n // Backwards compat: if only one builder exists, return it, else return whole arary.\n if (isString(name) && !isDefined(fn)) return array.length > 1 ? array : array[0];\n if (!isString(name) || !isFunction(fn)) return;\n\n builders[name] = array;\n builders[name].push(fn);\n return () => builders[name].splice(builders[name].indexOf(fn, 1)) && null;\n }\n\n /**\n * Builds all of the properties on an essentially blank State object, returning a State object which has all its\n * properties and API built.\n *\n * @param state an uninitialized State object\n * @returns the built State object\n */\n build(state: StateObject): StateObject {\n let {matcher, builders} = this;\n let parent = this.parentName(state);\n\n if (parent && !matcher.find(parent, undefined, false)) {\n return null;\n }\n\n for (let key in builders) {\n if (!builders.hasOwnProperty(key)) continue;\n let chain = builders[key].reduce((parentFn: BuilderFunction, step: BuilderFunction) => (_state) => step(_state, parentFn), noop);\n state[key] = chain(state);\n }\n return state;\n }\n\n parentName(state: StateObject) {\n // name = 'foo.bar.baz.**'\n let name = state.name || \"\";\n // segments = ['foo', 'bar', 'baz', '.**']\n let segments = name.split('.');\n // segments = ['foo', 'bar', 'baz']\n let lastSegment = segments.pop();\n // segments = ['foo', 'bar'] (ignore .** segment for future states)\n if (lastSegment === '**') segments.pop();\n\n if (segments.length) {\n if (state.parent) {\n throw new Error(`States that specify the 'parent:' property should not have a '.' in their name (${name})`);\n }\n\n // 'foo.bar'\n return segments.join(\".\");\n }\n\n if (!state.parent) return \"\";\n return isString(state.parent) ? state.parent : state.parent.name;\n }\n\n name(state: StateObject) {\n let name = state.name;\n if (name.indexOf('.') !== -1 || !state.parent) return name;\n\n let parentName = isString(state.parent) ? state.parent : state.parent.name;\n return parentName ? parentName + \".\" + name : name;\n }\n}\n","/** @module state */ /** for typedoc */\nimport {isString} from \"../common/predicates\";\nimport {StateOrName} from \"./interface\";\nimport {StateObject} from \"./stateObject\";\nimport {values} from \"../common/common\";\n\nexport class StateMatcher {\n constructor (private _states: { [key: string]: StateObject }) { }\n \n isRelative(stateName: string) {\n stateName = stateName || \"\";\n return stateName.indexOf(\".\") === 0 || stateName.indexOf(\"^\") === 0;\n }\n\n\n find(stateOrName: StateOrName, base?: StateOrName, matchGlob = true): StateObject {\n if (!stateOrName && stateOrName !== \"\") return undefined;\n let isStr = isString(stateOrName);\n let name: string = isStr ? stateOrName : (stateOrName).name;\n\n if (this.isRelative(name)) name = this.resolvePath(name, base);\n let state = this._states[name];\n\n if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {\n return state;\n } else if (isStr && matchGlob) {\n let _states = values(this._states);\n let matches = _states.filter(state =>\n state.__stateObjectCache.nameGlob &&\n state.__stateObjectCache.nameGlob.matches(name)\n );\n\n if (matches.length > 1) {\n console.log(`stateMatcher.find: Found multiple matches for ${name} using glob: `, matches.map(match => match.name));\n }\n return matches[0];\n }\n return undefined;\n }\n\n resolvePath(name: string, base: StateOrName) {\n if (!base) throw new Error(`No reference point given for path '${name}'`);\n \n let baseState: StateObject = this.find(base);\n\n let splitName = name.split(\".\"), i = 0, pathLength = splitName.length, current = baseState;\n\n for (; i < pathLength; i++) {\n if (splitName[i] === \"\" && i === 0) {\n current = baseState;\n continue;\n }\n if (splitName[i] === \"^\") {\n if (!current.parent) throw new Error(`Path '${name}' not valid for state '${baseState.name}'`);\n current = current.parent;\n continue;\n }\n break;\n }\n let relName = splitName.slice(i).join(\".\");\n return current.name + (current.name && relName ? \".\" : \"\") + relName;\n }\n}\n","/** @module state */ /** for typedoc */\nimport { inArray } from \"../common/common\";\nimport { isString } from \"../common/predicates\";\nimport { StateDeclaration, _StateDeclaration } from \"./interface\";\nimport { StateObject } from \"./stateObject\";\nimport { StateBuilder } from \"./stateBuilder\";\nimport { StateRegistryListener, StateRegistry } from \"./stateRegistry\";\nimport { Disposable } from \"../interface\";\nimport { UrlRouter } from \"../url/urlRouter\";\nimport { prop } from \"../common/hof\";\nimport { StateMatcher } from \"./stateMatcher\";\n\n/** @internalapi */\nexport class StateQueueManager implements Disposable {\n queue: StateObject[];\n matcher: StateMatcher;\n\n constructor(\n private $registry: StateRegistry,\n private $urlRouter: UrlRouter,\n public states: { [key: string]: StateObject; },\n public builder: StateBuilder,\n public listeners: StateRegistryListener[]) {\n this.queue = [];\n this.matcher = $registry.matcher;\n }\n\n /** @internalapi */\n dispose() {\n this.queue = [];\n }\n\n register(stateDecl: _StateDeclaration) {\n let queue = this.queue;\n let state = StateObject.create(stateDecl);\n let name = state.name;\n\n if (!isString(name)) throw new Error(\"State must have a valid name\");\n if (this.states.hasOwnProperty(name) || inArray(queue.map(prop('name')), name))\n throw new Error(`State '${name}' is already defined`);\n\n queue.push(state);\n this.flush();\n\n return state;\n }\n\n flush() {\n let {queue, states, builder} = this;\n let registered: StateObject[] = [], // states that got registered\n orphans: StateObject[] = [], // states that don't yet have a parent registered\n previousQueueLength = {}; // keep track of how long the queue when an orphan was first encountered\n const getState = (name) =>\n this.states.hasOwnProperty(name) && this.states[name];\n\n while (queue.length > 0) {\n let state: StateObject = queue.shift();\n let name = state.name;\n let result: StateObject = builder.build(state);\n let orphanIdx: number = orphans.indexOf(state);\n\n if (result) {\n let existingState = getState(name);\n if (existingState && existingState.name === name) {\n throw new Error(`State '${name}' is already defined`);\n }\n\n let existingFutureState = getState(name + \".**\");\n if (existingFutureState) {\n // Remove future state of the same name\n this.$registry.deregister(existingFutureState);\n }\n\n states[name] = state;\n this.attachRoute(state);\n if (orphanIdx >= 0) orphans.splice(orphanIdx, 1);\n registered.push(state);\n continue;\n }\n\n let prev = previousQueueLength[name];\n previousQueueLength[name] = queue.length;\n if (orphanIdx >= 0 && prev === queue.length) {\n // Wait until two consecutive iterations where no additional states were dequeued successfully.\n // throw new Error(`Cannot register orphaned state '${name}'`);\n queue.push(state);\n return states;\n } else if (orphanIdx < 0) {\n orphans.push(state);\n }\n\n queue.push(state);\n }\n\n if (registered.length) {\n this.listeners.forEach(listener => listener(\"registered\", registered.map(s => s.self)));\n }\n\n return states;\n }\n\n attachRoute(state: StateObject) {\n if (state.abstract || !state.url) return;\n\n this.$urlRouter.rule(this.$urlRouter.urlRuleFactory.create(state));\n }\n}\n","/**\n * @coreapi\n * @module state\n */ /** for typedoc */\n\nimport { StateObject } from \"./stateObject\";\nimport { StateMatcher } from \"./stateMatcher\";\nimport { StateBuilder } from \"./stateBuilder\";\nimport { StateQueueManager } from \"./stateQueueManager\";\nimport { StateDeclaration, _StateDeclaration } from \"./interface\";\nimport { BuilderFunction } from \"./stateBuilder\";\nimport { StateOrName } from \"./interface\";\nimport { removeFrom } from \"../common/common\";\nimport { UIRouter } from \"../router\";\nimport { propEq } from \"../common/hof\";\n\n/**\n * The signature for the callback function provided to [[StateRegistry.onStatesChanged]].\n *\n * This callback receives two parameters:\n *\n * @param event a string; either \"registered\" or \"deregistered\"\n * @param states the list of [[StateDeclaration]]s that were registered (or deregistered).\n */\nexport type StateRegistryListener = (event: \"registered\"|\"deregistered\", states: StateDeclaration[]) => void;\n\nexport class StateRegistry {\n private _root: StateObject;\n private states: { [key: string]: StateObject } = {};\n\n matcher: StateMatcher;\n private builder: StateBuilder;\n stateQueue: StateQueueManager;\n\n listeners: StateRegistryListener[] = [];\n\n /** @internalapi */\n constructor(private _router: UIRouter) {\n this.matcher = new StateMatcher(this.states);\n this.builder = new StateBuilder(this.matcher, _router.urlMatcherFactory);\n this.stateQueue = new StateQueueManager(this, _router.urlRouter, this.states, this.builder, this.listeners);\n this._registerRoot();\n }\n\n /** @internalapi */\n private _registerRoot() {\n let rootStateDef: StateDeclaration = {\n name: '',\n url: '^',\n views: null,\n params: {\n '#': { value: null, type: 'hash', dynamic: true }\n },\n abstract: true\n };\n\n let _root = this._root = this.stateQueue.register(rootStateDef);\n _root.navigable = null;\n }\n\n /** @internalapi */\n dispose() {\n this.stateQueue.dispose();\n this.listeners = [];\n this.get().forEach(state => this.get(state) && this.deregister(state));\n }\n\n /**\n * Listen for a State Registry events\n *\n * Adds a callback that is invoked when states are registered or deregistered with the StateRegistry.\n *\n * #### Example:\n * ```js\n * let allStates = registry.get();\n *\n * // Later, invoke deregisterFn() to remove the listener\n * let deregisterFn = registry.onStatesChanged((event, states) => {\n * switch(event) {\n * case: 'registered':\n * states.forEach(state => allStates.push(state));\n * break;\n * case: 'deregistered':\n * states.forEach(state => {\n * let idx = allStates.indexOf(state);\n * if (idx !== -1) allStates.splice(idx, 1);\n * });\n * break;\n * }\n * });\n * ```\n *\n * @param listener a callback function invoked when the registered states changes.\n * The function receives two parameters, `event` and `state`.\n * See [[StateRegistryListener]]\n * @return a function that deregisters the listener\n */\n onStatesChanged(listener: StateRegistryListener): () => void {\n this.listeners.push(listener);\n return function deregisterListener() {\n removeFrom(this.listeners)(listener);\n }.bind(this);\n }\n\n /**\n * Gets the implicit root state\n *\n * Gets the root of the state tree.\n * The root state is implicitly created by UI-Router.\n * Note: this returns the internal [[StateObject]] representation, not a [[StateDeclaration]]\n *\n * @return the root [[StateObject]]\n */\n root() {\n return this._root;\n }\n\n /**\n * Adds a state to the registry\n *\n * Registers a [[StateDeclaration]] or queues it for registration.\n *\n * Note: a state will be queued if the state's parent isn't yet registered.\n *\n * @param stateDefinition the definition of the state to register.\n * @returns the internal [[StateObject]] object.\n * If the state was successfully registered, then the object is fully built (See: [[StateBuilder]]).\n * If the state was only queued, then the object is not fully built.\n */\n register(stateDefinition: _StateDeclaration): StateObject {\n return this.stateQueue.register(stateDefinition);\n }\n\n /** @hidden */\n private _deregisterTree(state: StateObject) {\n let all = this.get().map(s => s.$$state());\n const getChildren = (states: StateObject[]) => {\n let children = all.filter(s => states.indexOf(s.parent) !== -1);\n return children.length === 0 ? children : children.concat(getChildren(children));\n };\n\n let children = getChildren([state]);\n let deregistered: StateObject[] = [state].concat(children).reverse();\n\n deregistered.forEach(state => {\n let $ur = this._router.urlRouter;\n // Remove URL rule\n $ur.rules().filter(propEq(\"state\", state)).forEach($ur.removeRule.bind($ur));\n // Remove state from registry\n delete this.states[state.name];\n });\n\n return deregistered;\n }\n\n /**\n * Removes a state from the registry\n *\n * This removes a state from the registry.\n * If the state has children, they are are also removed from the registry.\n *\n * @param stateOrName the state's name or object representation\n * @returns {StateObject[]} a list of removed states\n */\n deregister(stateOrName: StateOrName) {\n let _state = this.get(stateOrName);\n if (!_state) throw new Error(\"Can't deregister state; not found: \" + stateOrName);\n let deregisteredStates = this._deregisterTree(_state.$$state());\n\n this.listeners.forEach(listener => listener(\"deregistered\", deregisteredStates.map(s => s.self)));\n return deregisteredStates;\n }\n\n /**\n * Gets all registered states\n *\n * Calling this method with no arguments will return a list of all the states that are currently registered.\n * Note: this does not return states that are *queued* but not yet registered.\n *\n * @return a list of [[StateDeclaration]]s\n */\n get(): StateDeclaration[];\n\n /**\n * Gets a registered state\n *\n * Given a state or a name, finds and returns the [[StateDeclaration]] from the registry.\n * Note: this does not return states that are *queued* but not yet registered.\n *\n * @param stateOrName either the name of a state, or a state object.\n * @param base the base state to use when stateOrName is relative.\n * @return a registered [[StateDeclaration]] that matched the `stateOrName`, or null if the state isn't registered.\n */\n get(stateOrName: StateOrName, base?: StateOrName): StateDeclaration;\n get(stateOrName?: StateOrName, base?: StateOrName): any {\n if (arguments.length === 0)\n return Object.keys(this.states).map(name => this.states[name].self);\n let found = this.matcher.find(stateOrName, base);\n return found && found.self || null;\n }\n\n decorator(name: string, func: BuilderFunction) {\n return this.builder.builder(name, func);\n }\n}\n","/**\n * @coreapi\n * @module url\n */\n/** for typedoc */\nimport {\n map, defaults, inherit, identity, unnest, tail, find, Obj, pairs, allTrueR, unnestR, arrayTuples\n} from \"../common/common\";\nimport { prop, propEq } from \"../common/hof\";\nimport { isArray, isString, isDefined } from \"../common/predicates\";\nimport { Param, DefType } from \"../params/param\";\nimport { ParamTypes } from \"../params/paramTypes\";\nimport { RawParams } from \"../params/interface\";\nimport { ParamFactory } from \"./interface\";\nimport { joinNeighborsR, splitOnDelim } from \"../common/strings\";\n\n/** @hidden */\nfunction quoteRegExp(string: any, param?: any) {\n let surroundPattern = ['', ''], result = string.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, \"\\\\$&\");\n if (!param) return result;\n\n switch (param.squash) {\n case false:\n surroundPattern = ['(', ')' + (param.isOptional ? '?' : '')]; break;\n case true:\n result = result.replace(/\\/$/, '');\n surroundPattern = ['(?:\\/(', ')|\\/)?'];\n break;\n default:\n surroundPattern = [`(${param.squash}|`, ')?']; break;\n }\n return result + surroundPattern[0] + param.type.pattern.source + surroundPattern[1];\n}\n\n/** @hidden */\nconst memoizeTo = (obj: Obj, prop: string, fn: Function) =>\n obj[prop] = obj[prop] || fn();\n\n/** @hidden */\nconst splitOnSlash = splitOnDelim('/');\n\n/** @hidden */\ninterface UrlMatcherCache {\n segments?: any[];\n weights?: number[];\n path?: UrlMatcher[];\n parent?: UrlMatcher;\n pattern?: RegExp;\n}\n\n/**\n * Matches URLs against patterns.\n *\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL.\n *\n * A URL pattern consists of a path pattern, optionally followed by '?' and a list of search (query)\n * parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by [[UrlMatcher.exec]].\n *\n * - *Path parameters* are defined using curly brace placeholders (`/somepath/{param}`)\n * or colon placeholders (`/somePath/:param`).\n *\n * - *A parameter RegExp* may be defined for a param after a colon\n * (`/somePath/{param:[a-zA-Z0-9]+}`) in a curly brace placeholder.\n * The regexp must match for the url to be matched.\n * Should the regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Note: a RegExp parameter will encode its value using either [[ParamTypes.path]] or [[ParamTypes.query]].\n *\n * - *Custom parameter types* may also be specified after a colon (`/somePath/{param:int}`) in curly brace parameters.\n * See [[UrlMatcherFactory.type]] for more information.\n *\n * - *Catch-all parameters* are defined using an asterisk placeholder (`/somepath/*catchallparam`).\n * A catch-all * parameter value will contain the remainder of the URL.\n *\n * ---\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters).\n * A path parameter matches any number of characters other than '/'. For catch-all\n * placeholders the path parameter matches any number of characters.\n *\n * Examples:\n *\n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n * trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n * '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n * parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n * path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n * * `'/calendar/{start:date}'` - Matches \"/calendar/2014-11-12\" (because the pattern defined\n * in the built-in `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start\n *\n */\nexport class UrlMatcher {\n /** @hidden */\n static nameValidator: RegExp = /^\\w+([-.]+\\w+)*(?:\\[\\])?$/;\n\n /** @hidden */\n private _cache: UrlMatcherCache = { path: [this] };\n /** @hidden */\n private _children: UrlMatcher[] = [];\n /** @hidden */\n private _params: Param[] = [];\n /** @hidden */\n private _segments: string[] = [];\n /** @hidden */\n private _compiled: string[] = [];\n\n /** The pattern that was passed into the constructor */\n public pattern: string;\n\n /**\n * @param pattern The pattern to compile into a matcher.\n * @param paramTypes The [[ParamTypes]] registry\n * @param config A configuration object\n * - `caseInsensitive` - `true` if URL matching should be case insensitive, otherwise `false`, the default value (for backward compatibility) is `false`.\n * - `strict` - `false` if matching against a URL with a trailing slash should be treated as equivalent to a URL without a trailing slash, the default value is `true`.\n */\n constructor(pattern: string, paramTypes: ParamTypes, paramFactory: ParamFactory, public config?: any) {\n this.pattern = pattern;\n this.config = defaults(this.config, {\n params: {},\n strict: true,\n caseInsensitive: false,\n paramMap: identity\n });\n\n // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n // '*' name\n // ':' name\n // '{' name '}'\n // '{' name ':' regexp '}'\n // The regular expression is somewhat complicated due to the need to allow curly braces\n // inside the regular expression. The placeholder regexp breaks down as follows:\n // ([:*])([\\w\\[\\]]+) - classic placeholder ($1 / $2) (search version has - for snake-case)\n // \\{([\\w\\[\\]]+)(?:\\:\\s*( ... ))?\\} - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case\n // (?: ... | ... | ... )+ - the regexp consists of any number of atoms, an atom being either\n // [^{}\\\\]+ - anything other than curly braces or backslash\n // \\\\. - a backslash escape\n // \\{(?:[^{}\\\\]+|\\\\.)*\\} - a matched set of curly braces containing other atoms\n let placeholder = /([:*])([\\w\\[\\]]+)|\\{([\\w\\[\\]]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n searchPlaceholder = /([:]?)([\\w\\[\\].-]+)|\\{([\\w\\[\\].-]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n last = 0, m: RegExpExecArray, patterns: any[][] = [];\n\n const checkParamErrors = (id: string) => {\n if (!UrlMatcher.nameValidator.test(id)) throw new Error(`Invalid parameter name '${id}' in pattern '${pattern}'`);\n if (find(this._params, propEq('id', id))) throw new Error(`Duplicate parameter name '${id}' in pattern '${pattern}'`);\n };\n\n // Split into static segments separated by path parameter placeholders.\n // The number of segments is always 1 more than the number of parameters.\n const matchDetails = (m: RegExpExecArray, isSearch: boolean) => {\n // IE[78] returns '' for unmatched groups instead of null\n let id = m[2] || m[3];\n let regexp = isSearch ? m[4] : m[4] || (m[1] === '*' ? '[\\\\s\\\\S]*' : null);\n\n const makeRegexpType = (regexp) => inherit(paramTypes.type(isSearch ? \"query\" : \"path\"), {\n pattern: new RegExp(regexp, this.config.caseInsensitive ? 'i' : undefined)\n });\n\n return {\n id,\n regexp,\n cfg: this.config.params[id],\n segment: pattern.substring(last, m.index),\n type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp)\n };\n };\n\n let p: any, segment: string;\n\n while ((m = placeholder.exec(pattern))) {\n p = matchDetails(m, false);\n if (p.segment.indexOf('?') >= 0) break; // we're into the search part\n\n checkParamErrors(p.id);\n this._params.push(paramFactory.fromPath(p.id, p.type, this.config.paramMap(p.cfg, false)));\n this._segments.push(p.segment);\n patterns.push([p.segment, tail(this._params)]);\n last = placeholder.lastIndex;\n }\n segment = pattern.substring(last);\n\n // Find any search parameter names and remove them from the last segment\n let i = segment.indexOf('?');\n\n if (i >= 0) {\n let search = segment.substring(i);\n segment = segment.substring(0, i);\n\n if (search.length > 0) {\n last = 0;\n\n while ((m = searchPlaceholder.exec(search))) {\n p = matchDetails(m, true);\n checkParamErrors(p.id);\n this._params.push(paramFactory.fromSearch(p.id, p.type, this.config.paramMap(p.cfg, true)));\n last = placeholder.lastIndex;\n // check if ?&\n }\n }\n }\n\n this._segments.push(segment);\n this._compiled = patterns.map(pattern => quoteRegExp.apply(null, pattern)).concat(quoteRegExp(segment));\n }\n\n /**\n * Creates a new concatenated UrlMatcher\n *\n * Builds a new UrlMatcher by appending another UrlMatcher to this one.\n *\n * @param url A `UrlMatcher` instance to append as a child of the current `UrlMatcher`.\n */\n append(url: UrlMatcher): UrlMatcher {\n this._children.push(url);\n url._cache = {\n path: this._cache.path.concat(url),\n parent: this,\n pattern: null,\n };\n return url;\n }\n\n /** @hidden */\n isRoot(): boolean {\n return this._cache.path[0] === this;\n }\n\n /** Returns the input pattern string */\n toString(): string {\n return this.pattern;\n }\n\n /**\n * Tests the specified url/path against this matcher.\n *\n * Tests if the given url matches this matcher's pattern, and returns an object containing the captured\n * parameter values. Returns null if the path does not match.\n *\n * The returned object contains the values\n * of any search parameters that are mentioned in the pattern, but their value may be null if\n * they are not present in `search`. This means that search parameters are always treated\n * as optional.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', {\n * x: '1', q: 'hello'\n * });\n * // returns { id: 'bob', q: 'hello', r: null }\n * ```\n *\n * @param path The URL path to match, e.g. `$location.path()`.\n * @param search URL search parameters, e.g. `$location.search()`.\n * @param hash URL hash e.g. `$location.hash()`.\n * @param options\n *\n * @returns The captured parameter values.\n */\n exec(path: string, search: any = {}, hash?: string, options: any = {}): RawParams {\n let match = memoizeTo(this._cache, 'pattern', () => {\n return new RegExp([\n '^',\n unnest(this._cache.path.map(prop('_compiled'))).join(''),\n this.config.strict === false ? '\\/?' : '',\n '$'\n ].join(''), this.config.caseInsensitive ? 'i' : undefined);\n }).exec(path);\n\n if (!match) return null;\n\n //options = defaults(options, { isolate: false });\n\n let allParams: Param[] = this.parameters(),\n pathParams: Param[] = allParams.filter(param => !param.isSearch()),\n searchParams: Param[] = allParams.filter(param => param.isSearch()),\n nPathSegments = this._cache.path.map(urlm => urlm._segments.length - 1).reduce((a, x) => a + x),\n values: RawParams = {};\n\n if (nPathSegments !== match.length - 1)\n throw new Error(`Unbalanced capture group in route '${this.pattern}'`);\n\n function decodePathArray(string: string) {\n const reverseString = (str: string) => str.split(\"\").reverse().join(\"\");\n const unquoteDashes = (str: string) => str.replace(/\\\\-/g, \"-\");\n\n let split = reverseString(string).split(/-(?!\\\\)/);\n let allReversed = map(split, reverseString);\n return map(allReversed, unquoteDashes).reverse();\n }\n\n for (let i = 0; i < nPathSegments; i++) {\n let param: Param = pathParams[i];\n let value: (any|any[]) = match[i + 1];\n\n // if the param value matches a pre-replace pair, replace the value before decoding.\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n if (value && param.array === true) value = decodePathArray(value);\n if (isDefined(value)) value = param.type.decode(value);\n values[param.id] = param.value(value);\n }\n searchParams.forEach(param => {\n let value = search[param.id];\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n if (isDefined(value)) value = param.type.decode(value);\n values[param.id] = param.value(value);\n });\n\n if (hash) values[\"#\"] = hash;\n\n return values;\n }\n\n /**\n * @hidden\n * Returns all the [[Param]] objects of all path and search parameters of this pattern in order of appearance.\n *\n * @returns {Array.} An array of [[Param]] objects. Must be treated as read-only. If the\n * pattern has no parameters, an empty array is returned.\n */\n parameters(opts: any = {}): Param[] {\n if (opts.inherit === false) return this._params;\n return unnest(this._cache.path.map(matcher => matcher._params));\n }\n\n /**\n * @hidden\n * Returns a single parameter from this UrlMatcher by id\n *\n * @param id\n * @param opts\n * @returns {T|Param|any|boolean|UrlMatcher|null}\n */\n parameter(id: string, opts: any = {}): Param {\n const findParam = () => {\n for (let param of this._params) {\n if (param.id === id) return param;\n }\n };\n\n let parent = this._cache.parent;\n return findParam() || (opts.inherit !== false && parent && parent.parameter(id, opts)) || null;\n }\n\n /**\n * Validates the input parameter values against this UrlMatcher\n *\n * Checks an object hash of parameters to validate their correctness according to the parameter\n * types of this `UrlMatcher`.\n *\n * @param params The object hash of parameters to validate.\n * @returns Returns `true` if `params` validates, otherwise `false`.\n */\n validates(params: RawParams): boolean {\n const validParamVal = (param: Param, val: any) =>\n !param || param.validates(val);\n\n params = params || {};\n\n // I'm not sure why this checks only the param keys passed in, and not all the params known to the matcher\n let paramSchema = this.parameters().filter(paramDef => params.hasOwnProperty(paramDef.id));\n return paramSchema.map(paramDef => validParamVal(paramDef, params[paramDef.id])).reduce(allTrueR, true);\n }\n\n /**\n * Given a set of parameter values, creates a URL from this UrlMatcher.\n *\n * Creates a URL that matches this pattern by substituting the specified values\n * for the path and search parameters.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n * // returns '/user/bob?q=yes'\n * ```\n *\n * @param values the values to substitute for the parameters in this pattern.\n * @returns the formatted URL (path and optionally search part).\n */\n format(values: RawParams = {}) {\n // Build the full path of UrlMatchers (including all parent UrlMatchers)\n let urlMatchers = this._cache.path;\n\n // Extract all the static segments and Params (processed as ParamDetails)\n // into an ordered array\n let pathSegmentsAndParams: Array = urlMatchers.map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .map(x => isString(x) ? x : getDetails(x));\n\n // Extract the query params into a separate array\n let queryParams: Array = urlMatchers.map(UrlMatcher.queryParams)\n .reduce(unnestR, [])\n .map(getDetails);\n\n const isInvalid = (param: ParamDetails) => param.isValid === false;\n if (pathSegmentsAndParams.concat(queryParams).filter(isInvalid).length) {\n return null;\n }\n\n /**\n * Given a Param, applies the parameter value, then returns detailed information about it\n */\n function getDetails(param: Param): ParamDetails {\n // Normalize to typed value\n let value = param.value(values[param.id]);\n let isValid = param.validates(value);\n let isDefaultValue = param.isDefaultValue(value);\n // Check if we're in squash mode for the parameter\n let squash = isDefaultValue ? param.squash : false;\n // Allow the Parameter's Type to encode the value\n let encoded = param.type.encode(value);\n\n return { param, value, isValid, isDefaultValue, squash, encoded };\n }\n\n // Build up the path-portion from the list of static segments and parameters\n let pathString = pathSegmentsAndParams.reduce((acc: string, x: string|ParamDetails) => {\n // The element is a static segment (a raw string); just append it\n if (isString(x)) return acc + x;\n\n // Otherwise, it's a ParamDetails.\n let { squash, encoded, param } = x;\n\n // If squash is === true, try to remove a slash from the path\n if (squash === true) return (acc.match(/\\/$/)) ? acc.slice(0, -1) : acc;\n // If squash is a string, use the string for the param value\n if (isString(squash)) return acc + squash;\n if (squash !== false) return acc; // ?\n if (encoded == null) return acc;\n // If this parameter value is an array, encode the value using encodeDashes\n if (isArray(encoded)) return acc + map( encoded, UrlMatcher.encodeDashes).join(\"-\");\n // If the parameter type is \"raw\", then do not encodeURIComponent\n if (param.raw) return acc + encoded;\n // Encode the value\n return acc + encodeURIComponent( encoded);\n }, \"\");\n\n // Build the query string by applying parameter values (array or regular)\n // then mapping to key=value, then flattening and joining using \"&\"\n let queryString = queryParams.map((paramDetails: ParamDetails) => {\n let { param, squash, encoded, isDefaultValue } = paramDetails;\n if (encoded == null || (isDefaultValue && squash !== false)) return;\n if (!isArray(encoded)) encoded = [ encoded];\n if (encoded.length === 0) return;\n if (!param.raw) encoded = map( encoded, encodeURIComponent);\n\n return ( encoded).map(val => `${param.id}=${val}`);\n }).filter(identity).reduce(unnestR, []).join(\"&\");\n\n // Concat the pathstring with the queryString (if exists) and the hashString (if exists)\n return pathString + (queryString ? `?${queryString}` : \"\") + (values[\"#\"] ? \"#\" + values[\"#\"] : \"\");\n }\n\n /** @hidden */\n static encodeDashes(str: string) { // Replace dashes with encoded \"\\-\"\n return encodeURIComponent(str).replace(/-/g, c => `%5C%${c.charCodeAt(0).toString(16).toUpperCase()}`);\n }\n\n /** @hidden Given a matcher, return an array with the matcher's path segments and path params, in order */\n static pathSegmentsAndParams(matcher: UrlMatcher) {\n let staticSegments = matcher._segments;\n let pathParams = matcher._params.filter(p => p.location === DefType.PATH);\n return arrayTuples(staticSegments, pathParams.concat(undefined))\n .reduce(unnestR, [])\n .filter(x => x !== \"\" && isDefined(x));\n }\n\n /** @hidden Given a matcher, return an array with the matcher's query params */\n static queryParams(matcher: UrlMatcher): Param[] {\n return matcher._params.filter(p => p.location === DefType.SEARCH);\n }\n\n /**\n * Compare two UrlMatchers\n *\n * This comparison function converts a UrlMatcher into static and dynamic path segments.\n * Each static path segment is a static string between a path separator (slash character).\n * Each dynamic segment is a path parameter.\n *\n * The comparison function sorts static segments before dynamic ones.\n */\n static compare(a: UrlMatcher, b: UrlMatcher): number {\n /**\n * Turn a UrlMatcher and all its parent matchers into an array\n * of slash literals '/', string literals, and Param objects\n *\n * This example matcher matches strings like \"/foo/:param/tail\":\n * var matcher = $umf.compile(\"/foo\").append($umf.compile(\"/:param\")).append($umf.compile(\"/\")).append($umf.compile(\"tail\"));\n * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ]\n *\n * Caches the result as `matcher._cache.segments`\n */\n const segments = (matcher: UrlMatcher) =>\n matcher._cache.segments = matcher._cache.segments ||\n matcher._cache.path.map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .reduce(joinNeighborsR, [])\n .map(x => isString(x) ? splitOnSlash(x) : x)\n .reduce(unnestR, []);\n\n /**\n * Gets the sort weight for each segment of a UrlMatcher\n *\n * Caches the result as `matcher._cache.weights`\n */\n const weights = (matcher: UrlMatcher) =>\n matcher._cache.weights = matcher._cache.weights ||\n segments(matcher).map(segment => {\n // Sort slashes first, then static strings, the Params\n if (segment === '/') return 1;\n if (isString(segment)) return 2;\n if (segment instanceof Param) return 3;\n });\n\n /**\n * Pads shorter array in-place (mutates)\n */\n const padArrays = (l: any[], r: any[], padVal: any) => {\n const len = Math.max(l.length, r.length);\n while (l.length < len) l.push(padVal);\n while (r.length < len) r.push(padVal);\n };\n\n const weightsA = weights(a), weightsB = weights(b);\n padArrays(weightsA, weightsB, 0);\n let cmp, i, pairs = arrayTuples(weightsA, weightsB);\n\n for (i = 0; i < pairs.length; i++) {\n cmp = pairs[i][0] - pairs[i][1];\n if (cmp !== 0) return cmp;\n }\n\n return 0;\n }\n}\n\n/** @hidden */\ninterface ParamDetails {\n param: Param;\n value: any;\n isValid: boolean;\n isDefaultValue: boolean;\n squash: (boolean|string);\n encoded: (string|string[]);\n}\n","/**\n * @internalapi\n * @module url\n */ /** for typedoc */\nimport { forEach, extend } from \"../common/common\";\nimport { isObject, isDefined, isFunction, isString } from \"../common/predicates\";\nimport { UrlMatcher } from \"./urlMatcher\";\nimport { Param, DefType } from \"../params/param\";\nimport { ParamTypes } from \"../params/paramTypes\";\nimport { ParamTypeDefinition } from \"../params/interface\";\nimport { Disposable } from \"../interface\";\nimport { ParamType } from \"../params/paramType\";\nimport { ParamFactory, UrlMatcherConfig } from \"./interface\";\n\n/**\n * Factory for [[UrlMatcher]] instances.\n *\n * The factory is available to ng1 services as\n * `$urlMatcherFactory` or ng1 providers as `$urlMatcherFactoryProvider`.\n */\nexport class UrlMatcherFactory implements Disposable, UrlMatcherConfig {\n /** @hidden */ paramTypes = new ParamTypes();\n /** @hidden */ _isCaseInsensitive: boolean = false;\n /** @hidden */ _isStrictMode: boolean = true;\n /** @hidden */ _defaultSquashPolicy: (boolean|string) = false;\n\n constructor() {\n extend(this, { UrlMatcher, Param });\n }\n\n /** @inheritdoc */\n caseInsensitive(value?: boolean): boolean {\n return this._isCaseInsensitive = isDefined(value) ? value : this._isCaseInsensitive;\n }\n\n /** @inheritdoc */\n strictMode(value?: boolean): boolean {\n return this._isStrictMode = isDefined(value) ? value : this._isStrictMode;\n }\n\n /** @inheritdoc */\n defaultSquashPolicy(value?: (boolean|string)) {\n if (isDefined(value) && value !== true && value !== false && !isString(value))\n throw new Error(`Invalid squash policy: ${value}. Valid policies: false, true, arbitrary-string`);\n return this._defaultSquashPolicy = isDefined(value) ? value : this._defaultSquashPolicy;\n }\n\n /** @hidden */\n private _getConfig = (config) =>\n extend({ strict: this._isStrictMode, caseInsensitive: this._isCaseInsensitive }, config);\n\n /**\n * Creates a [[UrlMatcher]] for the specified pattern.\n *\n * @param pattern The URL pattern.\n * @param config The config object hash.\n * @returns The UrlMatcher.\n */\n compile(pattern: string, config?: { [key: string]: any }) {\n return new UrlMatcher(pattern, this.paramTypes, this.paramFactory, this._getConfig(config));\n }\n\n /**\n * Returns true if the specified object is a [[UrlMatcher]], or false otherwise.\n *\n * @param object The object to perform the type check against.\n * @returns `true` if the object matches the `UrlMatcher` interface, by\n * implementing all the same methods.\n */\n isMatcher(object: any): boolean {\n // TODO: typeof?\n if (!isObject(object)) return false;\n let result = true;\n\n forEach(UrlMatcher.prototype, (val, name) => {\n if (isFunction(val)) result = result && (isDefined(object[name]) && isFunction(object[name]));\n });\n return result;\n };\n\n /**\n * Creates and registers a custom [[ParamType]] object\n *\n * A [[ParamType]] can be used to generate URLs with typed parameters.\n *\n * @param name The type name.\n * @param definition The type definition. See [[ParamTypeDefinition]] for information on the values accepted.\n * @param definitionFn A function that is injected before the app runtime starts.\n * The result of this function should be a [[ParamTypeDefinition]].\n * The result is merged into the existing `definition`.\n * See [[ParamType]] for information on the values accepted.\n *\n * @returns - if a type was registered: the [[UrlMatcherFactory]]\n * - if only the `name` parameter was specified: the currently registered [[ParamType]] object, or undefined\n *\n * Note: Register custom types *before using them* in a state definition.\n *\n * See [[ParamTypeDefinition]] for examples\n */\n type(name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {\n let type = this.paramTypes.type(name, definition, definitionFn);\n return !isDefined(definition) ? type : this;\n };\n\n /** @hidden */\n $get() {\n this.paramTypes.enqueue = false;\n this.paramTypes._flushTypeQueue();\n return this;\n };\n\n /** @internalapi Creates a new [[Param]] for a given location (DefType) */\n paramFactory: ParamFactory = {\n /** Creates a new [[Param]] from a CONFIG block */\n fromConfig: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.CONFIG, this),\n\n /** Creates a new [[Param]] from a url PATH */\n fromPath: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.PATH, this),\n\n /** Creates a new [[Param]] from a url SEARCH */\n fromSearch: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.SEARCH, this),\n };\n\n /** @internalapi */\n dispose() {\n this.paramTypes.dispose();\n }\n}\n","/**\n * @coreapi\n * @module url\n */ /** */\nimport { UrlMatcher } from \"./urlMatcher\";\nimport { isString, isDefined, isFunction, isState } from \"../common/predicates\";\nimport { UIRouter } from \"../router\";\nimport { identity, extend } from \"../common/common\";\nimport { is, pattern } from \"../common/hof\";\nimport { StateObject } from \"../state/stateObject\";\nimport { RawParams } from \"../params/interface\";\nimport {\n UrlRule, UrlRuleMatchFn, UrlRuleHandlerFn, UrlRuleType, UrlParts, MatcherUrlRule, StateRule, RegExpRule\n} from \"./interface\";\n\n/**\n * Creates a [[UrlRule]]\n *\n * Creates a [[UrlRule]] from a:\n *\n * - `string`\n * - [[UrlMatcher]]\n * - `RegExp`\n * - [[StateObject]]\n * @internalapi\n */\nexport class UrlRuleFactory {\n constructor(public router: UIRouter) { }\n\n compile(str: string) {\n return this.router.urlMatcherFactory.compile(str);\n }\n\n static isUrlRule = obj =>\n obj && ['type', 'match', 'handler'].every(key => isDefined(obj[key]));\n\n create(what: string|UrlMatcher|StateObject|RegExp|UrlRuleMatchFn, handler?: string|UrlRuleHandlerFn): UrlRule {\n const makeRule = pattern([\n [isString, (_what: string) => makeRule(this.compile(_what))],\n [is(UrlMatcher), (_what: UrlMatcher) => this.fromUrlMatcher(_what, handler)],\n [isState, (_what: StateObject) => this.fromState(_what, this.router)],\n [is(RegExp), (_what: RegExp) => this.fromRegExp(_what, handler)],\n [isFunction, (_what: UrlRuleMatchFn) => new BaseUrlRule(_what, handler as UrlRuleHandlerFn)],\n ]);\n\n let rule = makeRule(what);\n if (!rule) throw new Error(\"invalid 'what' in when()\");\n return rule;\n }\n\n /**\n * A UrlRule which matches based on a UrlMatcher\n *\n * The `handler` may be either a `string`, a [[UrlRuleHandlerFn]] or another [[UrlMatcher]]\n *\n * ## Handler as a function\n *\n * If `handler` is a function, the function is invoked with:\n *\n * - matched parameter values ([[RawParams]] from [[UrlMatcher.exec]])\n * - url: the current Url ([[UrlParts]])\n * - router: the router object ([[UIRouter]])\n *\n * #### Example:\n * ```js\n * var urlMatcher = $umf.compile(\"/foo/:fooId/:barId\");\n * var rule = factory.fromUrlMatcher(urlMatcher, match => \"/home/\" + match.fooId + \"/\" + match.barId);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match); // '/home/123/456'\n * ```\n *\n * ## Handler as UrlMatcher\n *\n * If `handler` is a UrlMatcher, the handler matcher is used to create the new url.\n * The `handler` UrlMatcher is formatted using the matched param from the first matcher.\n * The url is replaced with the result.\n *\n * #### Example:\n * ```js\n * var urlMatcher = $umf.compile(\"/foo/:fooId/:barId\");\n * var handler = $umf.compile(\"/home/:fooId/:barId\");\n * var rule = factory.fromUrlMatcher(urlMatcher, handler);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match); // '/home/123/456'\n * ```\n */\n fromUrlMatcher(urlMatcher: UrlMatcher, handler: string|UrlMatcher|UrlRuleHandlerFn): MatcherUrlRule {\n let _handler: UrlRuleHandlerFn = handler as any;\n if (isString(handler)) handler = this.router.urlMatcherFactory.compile(handler);\n if (is(UrlMatcher)(handler)) _handler = (match: RawParams) => (handler as UrlMatcher).format(match);\n\n function match(url: UrlParts) {\n let match = urlMatcher.exec(url.path, url.search, url.hash);\n return urlMatcher.validates(match) && match;\n }\n\n // Prioritize URLs, lowest to highest:\n // - Some optional URL parameters, but none matched\n // - No optional parameters in URL\n // - Some optional parameters, some matched\n // - Some optional parameters, all matched\n function matchPriority(params: RawParams): number {\n let optional = urlMatcher.parameters().filter(param => param.isOptional);\n if (!optional.length) return 0.000001;\n let matched = optional.filter(param => params[param.id]);\n return matched.length / optional.length;\n }\n\n let details = { urlMatcher, matchPriority, type: \"URLMATCHER\" };\n return extend(new BaseUrlRule(match, _handler), details) as MatcherUrlRule;\n }\n\n\n /**\n * A UrlRule which matches a state by its url\n *\n * #### Example:\n * ```js\n * var rule = factory.fromState($state.get('foo'), router);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match);\n * // Starts a transition to 'foo' with params: { fooId: '123', barId: '456' }\n * ```\n */\n fromState(state: StateObject, router: UIRouter): StateRule {\n /**\n * Handles match by transitioning to matched state\n *\n * First checks if the router should start a new transition.\n * A new transition is not required if the current state's URL\n * and the new URL are already identical\n */\n const handler = (match: RawParams) => {\n let $state = router.stateService;\n let globals = router.globals;\n if ($state.href(state, match) !== $state.href(globals.current, globals.params)) {\n $state.transitionTo(state, match, { inherit: true, source: \"url\" });\n }\n };\n\n let details = { state, type: \"STATE\" };\n return extend(this.fromUrlMatcher(state.url, handler), details) as StateRule;\n }\n\n /**\n * A UrlRule which matches based on a regular expression\n *\n * The `handler` may be either a [[UrlRuleHandlerFn]] or a string.\n *\n * ## Handler as a function\n *\n * If `handler` is a function, the function is invoked with:\n *\n * - regexp match array (from `regexp`)\n * - url: the current Url ([[UrlParts]])\n * - router: the router object ([[UIRouter]])\n *\n * #### Example:\n * ```js\n * var rule = factory.fromRegExp(/^\\/foo\\/(bar|baz)$/, match => \"/home/\" + match[1])\n * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ]\n * var result = rule.handler(match); // '/home/bar'\n * ```\n *\n * ## Handler as string\n *\n * If `handler` is a string, the url is *replaced by the string* when the Rule is invoked.\n * The string is first interpolated using `string.replace()` style pattern.\n *\n * #### Example:\n * ```js\n * var rule = factory.fromRegExp(/^\\/foo\\/(bar|baz)$/, \"/home/$1\")\n * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ]\n * var result = rule.handler(match); // '/home/bar'\n * ```\n */\n fromRegExp(regexp: RegExp, handler: string|UrlRuleHandlerFn): RegExpRule {\n if (regexp.global || regexp.sticky) throw new Error(\"Rule RegExp must not be global or sticky\");\n\n /**\n * If handler is a string, the url will be replaced by the string.\n * If the string has any String.replace() style variables in it (like `$2`),\n * they will be replaced by the captures from [[match]]\n */\n const redirectUrlTo = (match: RegExpExecArray) =>\n // Interpolates matched values into $1 $2, etc using a String.replace()-style pattern\n (handler as string).replace(/\\$(\\$|\\d{1,2})/, (m, what) =>\n match[what === '$' ? 0 : Number(what)]);\n\n const _handler = isString(handler) ? redirectUrlTo : handler;\n\n const match = (url: UrlParts): RegExpExecArray =>\n regexp.exec(url.path);\n\n let details = { regexp, type: \"REGEXP\" };\n return extend(new BaseUrlRule(match, _handler), details) as RegExpRule\n }\n}\n\n/**\n * A base rule which calls `match`\n *\n * The value from the `match` function is passed through to the `handler`.\n * @internalapi\n */\nexport class BaseUrlRule implements UrlRule {\n $id: number;\n priority: number;\n type: UrlRuleType = \"RAW\";\n handler: UrlRuleHandlerFn;\n matchPriority = (match) => 0 - this.$id;\n\n constructor(public match: UrlRuleMatchFn, handler?: UrlRuleHandlerFn) {\n this.handler = handler || identity;\n }\n}","/**\n * @internalapi\n * @module url\n */\n/** for typedoc */\nimport { createProxyFunctions, extend, removeFrom } from '../common/common';\nimport { isDefined, isFunction, isString } from '../common/predicates';\nimport { UrlMatcher } from './urlMatcher';\nimport { RawParams } from '../params/interface';\nimport { Disposable } from '../interface';\nimport { UIRouter } from '../router';\nimport { is, pattern, val } from '../common/hof';\nimport { UrlRuleFactory } from './urlRule';\nimport { TargetState } from '../state/targetState';\nimport { MatcherUrlRule, MatchResult, UrlParts, UrlRule, UrlRuleHandlerFn, UrlRuleMatchFn, UrlRulesApi, UrlSyncApi, } from './interface';\nimport { TargetStateDef } from '../state/interface';\nimport { stripFile } from '../common';\n\n/** @hidden */\nfunction appendBasePath(url: string, isHtml5: boolean, absolute: boolean, baseHref: string): string {\n if (baseHref === '/') return url;\n if (isHtml5) return stripFile(baseHref) + url;\n if (absolute) return baseHref.slice(1) + url;\n return url;\n}\n\n/** @hidden */\nconst prioritySort = (a: UrlRule, b: UrlRule) =>\n (b.priority || 0) - (a.priority || 0);\n\n/** @hidden */\nconst typeSort = (a: UrlRule, b: UrlRule) => {\n const weights = { \"STATE\": 4, \"URLMATCHER\": 4, \"REGEXP\": 3, \"RAW\": 2, \"OTHER\": 1 };\n return (weights[a.type] || 0) - (weights[b.type] || 0);\n};\n\n/** @hidden */\nconst urlMatcherSort = (a: MatcherUrlRule, b: MatcherUrlRule) =>\n !a.urlMatcher || !b.urlMatcher ? 0 : UrlMatcher.compare(a.urlMatcher, b.urlMatcher);\n\n/** @hidden */\nconst idSort = (a: UrlRule, b: UrlRule) => {\n // Identically sorted STATE and URLMATCHER best rule will be chosen by `matchPriority` after each rule matches the URL\n const useMatchPriority = { STATE: true, URLMATCHER: true };\n const equal = useMatchPriority[a.type] && useMatchPriority[b.type];\n return equal ? 0 : (a.$id || 0) - (b.$id || 0);\n};\n\n/**\n * Default rule priority sorting function.\n *\n * Sorts rules by:\n *\n * - Explicit priority (set rule priority using [[UrlRulesApi.when]])\n * - Rule type (STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1)\n * - `UrlMatcher` specificity ([[UrlMatcher.compare]]): works for STATE and URLMATCHER types to pick the most specific rule.\n * - Rule registration order (for rule types other than STATE and URLMATCHER)\n * - Equally sorted State and UrlMatcher rules will each match the URL.\n * Then, the *best* match is chosen based on how many parameter values were matched.\n *\n * @coreapi\n */\nlet defaultRuleSortFn: (a: UrlRule, b: UrlRule) => number;\ndefaultRuleSortFn = (a, b) => {\n let cmp = prioritySort(a, b);\n if (cmp !== 0) return cmp;\n\n cmp = typeSort(a, b);\n if (cmp !== 0) return cmp;\n\n cmp = urlMatcherSort(a as MatcherUrlRule, b as MatcherUrlRule);\n if (cmp !== 0) return cmp;\n\n return idSort(a, b);\n};\n\n/**\n * Updates URL and responds to URL changes\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class updates the URL when the state changes.\n * It also responds to changes in the URL.\n */\nexport class UrlRouter implements UrlRulesApi, UrlSyncApi, Disposable {\n /** used to create [[UrlRule]] objects for common cases */\n public urlRuleFactory: UrlRuleFactory;\n\n /** @hidden */ private _router: UIRouter;\n /** @hidden */ private location: string;\n /** @hidden */ private _sortFn = defaultRuleSortFn;\n /** @hidden */ private _stopFn: Function;\n /** @hidden */ _rules: UrlRule[] = [];\n /** @hidden */ private _otherwiseFn: UrlRule;\n /** @hidden */ interceptDeferred = false;\n /** @hidden */ private _id = 0;\n /** @hidden */ private _sorted = false;\n\n /** @hidden */\n constructor(router: UIRouter) {\n this._router = router;\n this.urlRuleFactory = new UrlRuleFactory(router);\n createProxyFunctions(val(UrlRouter.prototype), this, val(this));\n }\n\n /** @internalapi */\n dispose() {\n this.listen(false);\n this._rules = [];\n delete this._otherwiseFn;\n }\n\n /** @inheritdoc */\n sort(compareFn?: (a: UrlRule, b: UrlRule) => number) {\n this._rules = this.stableSort(this._rules, this._sortFn = compareFn || this._sortFn);\n this._sorted = true;\n }\n\n private ensureSorted() {\n this._sorted || this.sort();\n }\n\n private stableSort(arr, compareFn) {\n const arrOfWrapper = arr.map((elem, idx) => ({ elem, idx }));\n\n arrOfWrapper.sort((wrapperA, wrapperB) => {\n const cmpDiff = compareFn(wrapperA.elem, wrapperB.elem);\n return cmpDiff === 0\n ? wrapperA.idx - wrapperB.idx\n : cmpDiff;\n });\n\n return arrOfWrapper.map(wrapper => wrapper.elem);\n }\n\n /**\n * Given a URL, check all rules and return the best [[MatchResult]]\n * @param url\n * @returns {MatchResult}\n */\n match(url: UrlParts): MatchResult {\n this.ensureSorted();\n\n url = extend({path: '', search: {}, hash: '' }, url);\n let rules = this.rules();\n if (this._otherwiseFn) rules.push(this._otherwiseFn);\n\n // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined\n\n let checkRule = (rule: UrlRule): MatchResult => {\n let match = rule.match(url, this._router);\n return match && { match, rule, weight: rule.matchPriority(match) };\n };\n\n // The rules are pre-sorted.\n // - Find the first matching rule.\n // - Find any other matching rule that sorted *exactly the same*, according to `.sort()`.\n // - Choose the rule with the highest match weight.\n let best: MatchResult;\n for (let i = 0; i < rules.length; i++) {\n // Stop when there is a 'best' rule and the next rule sorts differently than it.\n if (best && this._sortFn(rules[i], best.rule) !== 0) break;\n\n let current = checkRule(rules[i]);\n // Pick the best MatchResult\n best = (!best || current && current.weight > best.weight) ? current : best;\n }\n\n return best;\n }\n\n /** @inheritdoc */\n sync(evt?) {\n if (evt && evt.defaultPrevented) return;\n\n let router = this._router,\n $url = router.urlService,\n $state = router.stateService;\n\n let url: UrlParts = {\n path: $url.path(), search: $url.search(), hash: $url.hash(),\n };\n\n let best = this.match(url);\n\n let applyResult = pattern([\n [isString, (newurl: string) => $url.url(newurl, true)],\n [TargetState.isDef, (def: TargetStateDef) => $state.go(def.state, def.params, def.options)],\n [is(TargetState), (target: TargetState) => $state.go(target.state(), target.params(), target.options())],\n ]);\n\n applyResult(best && best.rule.handler(best.match, url, router));\n }\n\n /** @inheritdoc */\n listen(enabled?: boolean): Function {\n if (enabled === false) {\n this._stopFn && this._stopFn();\n delete this._stopFn;\n } else {\n return this._stopFn = this._stopFn || this._router.urlService.onChange(evt => this.sync(evt));\n }\n }\n\n /**\n * Internal API.\n * @internalapi\n */\n update(read?: boolean) {\n let $url = this._router.locationService;\n if (read) {\n this.location = $url.path();\n return;\n }\n if ($url.path() === this.location) return;\n\n $url.url(this.location, true);\n }\n\n /**\n * Internal API.\n *\n * Pushes a new location to the browser history.\n *\n * @internalapi\n * @param urlMatcher\n * @param params\n * @param options\n */\n push(urlMatcher: UrlMatcher, params?: RawParams, options?: { replace?: (string|boolean) }) {\n let replace = options && !!options.replace;\n this._router.urlService.url(urlMatcher.format(params || {}), replace);\n }\n\n /**\n * Builds and returns a URL with interpolated parameters\n *\n * #### Example:\n * ```js\n * matcher = $umf.compile(\"/about/:person\");\n * params = { person: \"bob\" };\n * $bob = $urlRouter.href(matcher, params);\n * // $bob == \"/about/bob\";\n * ```\n *\n * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate.\n * @param params An object of parameter values to fill the matcher's required parameters.\n * @param options Options object. The options are:\n *\n * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n *\n * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`\n */\n href(urlMatcher: UrlMatcher, params?: any, options?: { absolute: boolean }): string {\n let url = urlMatcher.format(params);\n if (url == null) return null;\n\n options = options || { absolute: false };\n\n let cfg = this._router.urlService.config;\n let isHtml5 = cfg.html5Mode();\n if (!isHtml5 && url !== null) {\n url = \"#\" + cfg.hashPrefix() + url;\n }\n url = appendBasePath(url, isHtml5, options.absolute, cfg.baseHref());\n\n if (!options.absolute || !url) {\n return url;\n }\n\n let slash = (!isHtml5 && url ? '/' : ''), port = cfg.port();\n port = (port === 80 || port === 443 ? '' : ':' + port);\n\n return [cfg.protocol(), '://', cfg.host(), port, slash, url].join('');\n }\n\n\n /**\n * Manually adds a URL Rule.\n *\n * Usually, a url rule is added using [[StateDeclaration.url]] or [[when]].\n * This api can be used directly for more control (to register a [[BaseUrlRule]], for example).\n * Rules can be created using [[UrlRouter.urlRuleFactory]], or create manually as simple objects.\n *\n * A rule should have a `match` function which returns truthy if the rule matched.\n * It should also have a `handler` function which is invoked if the rule is the best match.\n *\n * @return a function that deregisters the rule\n */\n rule(rule: UrlRule): Function {\n if (!UrlRuleFactory.isUrlRule(rule)) throw new Error(\"invalid rule\");\n rule.$id = this._id++;\n rule.priority = rule.priority || 0;\n\n this._rules.push(rule);\n this._sorted = false;\n\n return () => this.removeRule(rule);\n }\n\n /** @inheritdoc */\n removeRule(rule): void {\n removeFrom(this._rules, rule);\n }\n\n /** @inheritdoc */\n rules(): UrlRule[] {\n this.ensureSorted();\n return this._rules.slice();\n }\n\n /** @inheritdoc */\n otherwise(handler: string|UrlRuleHandlerFn|TargetState|TargetStateDef) {\n let handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n this._otherwiseFn = this.urlRuleFactory.create(val(true), handlerFn);\n this._sorted = false;\n };\n\n /** @inheritdoc */\n initial(handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef) {\n let handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n let matchFn: UrlRuleMatchFn = (urlParts, router) =>\n router.globals.transitionHistory.size() === 0 && !!/^\\/?$/.exec(urlParts.path);\n\n this.rule(this.urlRuleFactory.create(matchFn, handlerFn));\n };\n\n /** @inheritdoc */\n when(matcher: (RegExp|UrlMatcher|string), handler: string|UrlRuleHandlerFn, options?: { priority: number }): UrlRule {\n let rule = this.urlRuleFactory.create(matcher, handler);\n if (isDefined(options && options.priority)) rule.priority = options.priority;\n this.rule(rule);\n return rule;\n };\n\n /** @inheritdoc */\n deferIntercept(defer?: boolean) {\n if (defer === undefined) defer = true;\n this.interceptDeferred = defer;\n };\n}\n\nfunction getHandlerFn(handler: string|UrlRuleHandlerFn|TargetState|TargetStateDef): UrlRuleHandlerFn {\n if (!isFunction(handler) && !isString(handler) && !is(TargetState)(handler) && !TargetState.isDef(handler)) {\n throw new Error(\"'handler' must be a string, function, TargetState, or have a state: 'newtarget' property\");\n }\n return isFunction(handler) ? handler as UrlRuleHandlerFn : val(handler);\n}\n","/**\n * @coreapi\n * @module view\n */ /** for typedoc */\nimport {equals, applyPairs, removeFrom, TypedMap} from \"../common/common\";\nimport {curry, prop} from \"../common/hof\";\nimport {isString, isArray} from \"../common/predicates\";\nimport {trace} from \"../common/trace\";\nimport {PathNode} from \"../path/pathNode\";\n\nimport {ActiveUIView, ViewContext, ViewConfig} from \"./interface\";\nimport {_ViewDeclaration} from \"../state/interface\";\n\nexport type ViewConfigFactory = (path: PathNode[], decl: _ViewDeclaration) => ViewConfig|ViewConfig[];\n\nexport interface ViewServicePluginAPI {\n _rootViewContext(context?: ViewContext): ViewContext;\n _viewConfigFactory(viewType: string, factory: ViewConfigFactory);\n _registeredUIViews(): ActiveUIView[];\n _activeViewConfigs(): ViewConfig[];\n}\n\n/**\n * The View service\n *\n * This service pairs existing `ui-view` components (which live in the DOM)\n * with view configs (from the state declaration objects: [[StateDeclaration.views]]).\n *\n * - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]].\n * The views from exited states are deactivated via [[deactivateViewConfig]].\n * (See: the [[registerActivateViews]] Transition Hook)\n *\n * - As `ui-view` components pop in and out of existence, they register themselves using [[registerUIView]].\n *\n * - When the [[sync]] function is called, the registered `ui-view`(s) ([[ActiveUIView]])\n * are configured with the matching [[ViewConfig]](s)\n *\n */\nexport class ViewService {\n private _uiViews: ActiveUIView[] = [];\n private _viewConfigs: ViewConfig[] = [];\n private _rootContext: ViewContext;\n private _viewConfigFactories: { [key: string]: ViewConfigFactory } = {};\n\n constructor() { }\n\n public _pluginapi: ViewServicePluginAPI = {\n _rootViewContext: this._rootViewContext.bind(this),\n _viewConfigFactory: this._viewConfigFactory.bind(this),\n _registeredUIViews: () => this._uiViews,\n _activeViewConfigs: () => this._viewConfigs,\n };\n\n private _rootViewContext(context?: ViewContext): ViewContext {\n return this._rootContext = context || this._rootContext;\n };\n\n private _viewConfigFactory(viewType: string, factory: ViewConfigFactory) {\n this._viewConfigFactories[viewType] = factory;\n }\n\n createViewConfig(path: PathNode[], decl: _ViewDeclaration): ViewConfig[] {\n let cfgFactory = this._viewConfigFactories[decl.$type];\n if (!cfgFactory) throw new Error(\"ViewService: No view config factory registered for type \" + decl.$type);\n let cfgs = cfgFactory(path, decl);\n return isArray(cfgs) ? cfgs : [cfgs];\n }\n \n /**\n * Deactivates a ViewConfig.\n *\n * This function deactivates a `ViewConfig`.\n * After calling [[sync]], it will un-pair from any `ui-view` with which it is currently paired.\n *\n * @param viewConfig The ViewConfig view to deregister.\n */\n deactivateViewConfig(viewConfig: ViewConfig) {\n trace.traceViewServiceEvent(\"<- Removing\", viewConfig);\n removeFrom(this._viewConfigs, viewConfig);\n }\n\n activateViewConfig(viewConfig: ViewConfig) {\n trace.traceViewServiceEvent(\"-> Registering\", viewConfig);\n this._viewConfigs.push(viewConfig);\n }\n\n /**\n * Given a ui-view and a ViewConfig, determines if they \"match\".\n *\n * A ui-view has a fully qualified name (fqn) and a context object. The fqn is built from its overall location in\n * the DOM, describing its nesting relationship to any parent ui-view tags it is nested inside of.\n *\n * A ViewConfig has a target ui-view name and a context anchor. The ui-view name can be a simple name, or\n * can be a segmented ui-view path, describing a portion of a ui-view fqn.\n *\n * In order for a ui-view to match ViewConfig, ui-view's $type must match the ViewConfig's $type\n *\n * If the ViewConfig's target ui-view name is a simple name (no dots), then a ui-view matches if:\n * - the ui-view's name matches the ViewConfig's target name\n * - the ui-view's context matches the ViewConfig's anchor\n *\n * If the ViewConfig's target ui-view name is a segmented name (with dots), then a ui-view matches if:\n * - There exists a parent ui-view where:\n * - the parent ui-view's name matches the first segment (index 0) of the ViewConfig's target name\n * - the parent ui-view's context matches the ViewConfig's anchor\n * - And the remaining segments (index 1..n) of the ViewConfig's target name match the tail of the ui-view's fqn\n *\n * Example:\n *\n * DOM:\n * \n * \n * \n * \n * \n * \n * \n * \n *\n * uiViews: [\n * { fqn: \"$default\", creationContext: { name: \"\" } },\n * { fqn: \"$default.foo\", creationContext: { name: \"A\" } },\n * { fqn: \"$default.foo.$default\", creationContext: { name: \"A.B\" } }\n * { fqn: \"$default.foo.$default.bar\", creationContext: { name: \"A.B.C\" } }\n * ]\n *\n * These four view configs all match the ui-view with the fqn: \"$default.foo.$default.bar\":\n *\n * - ViewConfig1: { uiViewName: \"bar\", uiViewContextAnchor: \"A.B.C\" }\n * - ViewConfig2: { uiViewName: \"$default.bar\", uiViewContextAnchor: \"A.B\" }\n * - ViewConfig3: { uiViewName: \"foo.$default.bar\", uiViewContextAnchor: \"A\" }\n * - ViewConfig4: { uiViewName: \"$default.foo.$default.bar\", uiViewContextAnchor: \"\" }\n *\n * Using ViewConfig3 as an example, it matches the ui-view with fqn \"$default.foo.$default.bar\" because:\n * - The ViewConfig's segmented target name is: [ \"foo\", \"$default\", \"bar\" ]\n * - There exists a parent ui-view (which has fqn: \"$default.foo\") where:\n * - the parent ui-view's name \"foo\" matches the first segment \"foo\" of the ViewConfig's target name\n * - the parent ui-view's context \"A\" matches the ViewConfig's anchor context \"A\"\n * - And the remaining segments [ \"$default\", \"bar\" ].join(\".\"_ of the ViewConfig's target name match\n * the tail of the ui-view's fqn \"default.bar\"\n *\n * @internalapi\n */\n static matches = (uiViewsByFqn: TypedMap, uiView: ActiveUIView) => (viewConfig: ViewConfig) => {\n // Don't supply an ng1 ui-view with an ng2 ViewConfig, etc\n if (uiView.$type !== viewConfig.viewDecl.$type) return false;\n\n // Split names apart from both viewConfig and uiView into segments\n let vc = viewConfig.viewDecl;\n let vcSegments = vc.$uiViewName.split(\".\");\n let uivSegments = uiView.fqn.split(\".\");\n\n // Check if the tails of the segment arrays match. ex, these arrays' tails match:\n // vc: [\"foo\", \"bar\"], uiv fqn: [\"$default\", \"foo\", \"bar\"]\n if (!equals(vcSegments, uivSegments.slice(0 - vcSegments.length)))\n return false;\n\n // Now check if the fqn ending at the first segment of the viewConfig matches the context:\n // [\"$default\", \"foo\"].join(\".\") == \"$default.foo\", does the ui-view $default.foo context match?\n let negOffset = (1 - vcSegments.length) || undefined;\n let fqnToFirstSegment = uivSegments.slice(0, negOffset).join(\".\");\n let uiViewContext = uiViewsByFqn[fqnToFirstSegment].creationContext;\n return vc.$uiViewContextAnchor === (uiViewContext && uiViewContext.name);\n }\n\n sync() {\n let uiViewsByFqn: TypedMap =\n this._uiViews.map(uiv => [uiv.fqn, uiv]).reduce(applyPairs, {});\n\n // Return a weighted depth value for a uiView.\n // The depth is the nesting depth of ui-views (based on FQN; times 10,000)\n // plus the depth of the state that is populating the uiView\n function uiViewDepth(uiView: ActiveUIView) {\n const stateDepth = (context: ViewContext) =>\n context && context.parent ? stateDepth(context.parent) + 1 : 1;\n return (uiView.fqn.split(\".\").length * 10000) + stateDepth(uiView.creationContext);\n }\n\n // Return the ViewConfig's context's depth in the context tree.\n function viewConfigDepth(config: ViewConfig) {\n let context: ViewContext = config.viewDecl.$context, count = 0;\n while (++count && context.parent) context = context.parent;\n return count;\n }\n\n // Given a depth function, returns a compare function which can return either ascending or descending order\n const depthCompare = curry((depthFn, posNeg, left, right) => posNeg * (depthFn(left) - depthFn(right)));\n\n const matchingConfigPair = (uiView: ActiveUIView) => {\n let matchingConfigs = this._viewConfigs.filter(ViewService.matches(uiViewsByFqn, uiView));\n if (matchingConfigs.length > 1) {\n // This is OK. Child states can target a ui-view that the parent state also targets (the child wins)\n // Sort by depth and return the match from the deepest child\n // console.log(`Multiple matching view configs for ${uiView.fqn}`, matchingConfigs);\n matchingConfigs.sort(depthCompare(viewConfigDepth, -1)); // descending\n }\n return [uiView, matchingConfigs[0]];\n };\n\n const configureUIView = ([uiView, viewConfig]) => {\n // If a parent ui-view is reconfigured, it could destroy child ui-views.\n // Before configuring a child ui-view, make sure it's still in the active uiViews array.\n if (this._uiViews.indexOf(uiView) !== -1)\n uiView.configUpdated(viewConfig);\n };\n\n // Sort views by FQN and state depth. Process uiviews nearest the root first.\n const pairs = this._uiViews.sort(depthCompare(uiViewDepth, 1)).map(matchingConfigPair);\n\n trace.traceViewSync(pairs);\n\n pairs.forEach(configureUIView);\n };\n\n /**\n * Registers a `ui-view` component\n *\n * When a `ui-view` component is created, it uses this method to register itself.\n * After registration the [[sync]] method is used to ensure all `ui-view` are configured with the proper [[ViewConfig]].\n *\n * Note: the `ui-view` component uses the `ViewConfig` to determine what view should be loaded inside the `ui-view`,\n * and what the view's state context is.\n *\n * Note: There is no corresponding `deregisterUIView`.\n * A `ui-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself.\n *\n * @param uiView The metadata for a UIView\n * @return a de-registration function used when the view is destroyed.\n */\n registerUIView(uiView: ActiveUIView) {\n trace.traceViewServiceUIViewEvent(\"-> Registering\", uiView);\n let uiViews = this._uiViews;\n const fqnAndTypeMatches = (uiv: ActiveUIView) => uiv.fqn === uiView.fqn && uiv.$type === uiView.$type;\n if (uiViews.filter(fqnAndTypeMatches).length)\n trace.traceViewServiceUIViewEvent(\"!!!! duplicate uiView named:\", uiView);\n\n uiViews.push(uiView);\n this.sync();\n\n return () => {\n let idx = uiViews.indexOf(uiView);\n if (idx === -1) {\n trace.traceViewServiceUIViewEvent(\"Tried removing non-registered uiView\", uiView);\n return;\n }\n trace.traceViewServiceUIViewEvent(\"<- Deregistering\", uiView);\n removeFrom(uiViews)(uiView);\n };\n };\n\n /**\n * Returns the list of views currently available on the page, by fully-qualified name.\n *\n * @return {Array} Returns an array of fully-qualified view names.\n */\n available() {\n return this._uiViews.map(prop(\"fqn\"));\n }\n\n /**\n * Returns the list of views on the page containing loaded content.\n *\n * @return {Array} Returns an array of fully-qualified view names.\n */\n active() {\n return this._uiViews.filter(prop(\"$config\")).map(prop(\"name\"));\n }\n\n /**\n * Normalizes a view's name from a state.views configuration block.\n *\n * This should be used by a framework implementation to calculate the values for\n * [[_ViewDeclaration.$uiViewName]] and [[_ViewDeclaration.$uiViewContextAnchor]].\n *\n * @param context the context object (state declaration) that the view belongs to\n * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]]\n *\n * @returns the normalized uiViewName and uiViewContextAnchor that the view targets\n */\n static normalizeUIViewTarget(context: ViewContext, rawViewName = \"\") {\n // TODO: Validate incoming view name with a regexp to allow:\n // ex: \"view.name@foo.bar\" , \"^.^.view.name\" , \"view.name@^.^\" , \"\" ,\n // \"@\" , \"$default@^\" , \"!$default.$default\" , \"!foo.bar\"\n let viewAtContext: string[] = rawViewName.split(\"@\");\n let uiViewName = viewAtContext[0] || \"$default\"; // default to unnamed view\n let uiViewContextAnchor = isString(viewAtContext[1]) ? viewAtContext[1] : \"^\"; // default to parent context\n\n // Handle relative view-name sugar syntax.\n // Matches rawViewName \"^.^.^.foo.bar\" into array: [\"^.^.^.foo.bar\", \"^.^.^\", \"foo.bar\"],\n let relativeViewNameSugar = /^(\\^(?:\\.\\^)*)\\.(.*$)/.exec(uiViewName);\n if (relativeViewNameSugar) {\n // Clobbers existing contextAnchor (rawViewName validation will fix this)\n uiViewContextAnchor = relativeViewNameSugar[1]; // set anchor to \"^.^.^\"\n uiViewName = relativeViewNameSugar[2]; // set view-name to \"foo.bar\"\n }\n\n if (uiViewName.charAt(0) === '!') {\n uiViewName = uiViewName.substr(1);\n uiViewContextAnchor = \"\"; // target absolutely from root\n }\n\n // handle parent relative targeting \"^.^.^\"\n let relativeMatch = /^(\\^(?:\\.\\^)*)$/;\n if (relativeMatch.exec(uiViewContextAnchor)) {\n let anchor = uiViewContextAnchor.split(\".\").reduce(((anchor, x) => anchor.parent), context);\n uiViewContextAnchor = anchor.name;\n } else if (uiViewContextAnchor === '.') {\n uiViewContextAnchor = context.name;\n }\n\n return {uiViewName, uiViewContextAnchor};\n }\n}","/**\n * @coreapi\n * @module core\n */ /** */\nimport {StateParams} from \"./params/stateParams\";\nimport {StateDeclaration} from \"./state/interface\";\nimport {StateObject} from \"./state/stateObject\";\nimport {Transition} from \"./transition/transition\";\nimport {Queue} from \"./common/queue\";\nimport { Disposable } from './interface';\n\n/**\n * Global router state\n *\n * This is where we hold the global mutable state such as current state, current\n * params, current transition, etc.\n */\nexport class UIRouterGlobals implements Disposable {\n /**\n * Current parameter values\n *\n * The parameter values from the latest successful transition\n */\n params: StateParams = new StateParams();\n\n /**\n * Current state\n *\n * The to-state from the latest successful transition\n */\n current: StateDeclaration;\n\n /**\n * Current state (internal object)\n *\n * The to-state from the latest successful transition\n * @internalapi\n */\n $current: StateObject;\n\n /**\n * The current started/running transition.\n * This transition has reached at least the onStart phase, but is not yet complete\n */\n transition: Transition;\n\n /** @internalapi */\n lastStartedTransitionId: number = -1;\n\n /** @internalapi */\n transitionHistory = new Queue([], 1);\n\n /** @internalapi */\n successfulTransitions = new Queue([], 1);\n\n dispose() {\n this.transitionHistory.clear();\n this.successfulTransitions.clear();\n this.transition = null;\n }\n}\n","/**\n * @coreapi\n * @module url\n */ /** */\n\nimport { UIRouter } from \"../router\";\nimport { LocationServices, notImplemented, LocationConfig } from \"../common/coreservices\";\nimport { noop, createProxyFunctions } from \"../common/common\";\nimport { UrlConfigApi, UrlSyncApi, UrlRulesApi, UrlParts, MatchResult } from \"./interface\";\n\n/** @hidden */\nconst makeStub = (keys: string[]): any =>\n keys.reduce((acc, key) => (acc[key] = notImplemented(key), acc), { dispose: noop });\n\n/** @hidden */ const locationServicesFns = [\"url\", \"path\", \"search\", \"hash\", \"onChange\"];\n/** @hidden */ const locationConfigFns = [\"port\", \"protocol\", \"host\", \"baseHref\", \"html5Mode\", \"hashPrefix\"];\n/** @hidden */ const umfFns = [\"type\", \"caseInsensitive\", \"strictMode\", \"defaultSquashPolicy\"];\n/** @hidden */ const rulesFns = [\"sort\", \"when\", \"initial\", \"otherwise\", \"rules\", \"rule\", \"removeRule\"];\n/** @hidden */ const syncFns = [\"deferIntercept\", \"listen\", \"sync\", \"match\"];\n\n/**\n * API for URL management\n */\nexport class UrlService implements LocationServices, UrlSyncApi {\n /** @hidden */\n static locationServiceStub: LocationServices = makeStub(locationServicesFns);\n /** @hidden */\n static locationConfigStub: LocationConfig = makeStub(locationConfigFns);\n\n /** @inheritdoc */\n url(): string;\n /** @inheritdoc */\n url(newurl: string, replace?: boolean, state?): void;\n url(newurl?, replace?, state?): any { return };\n /** @inheritdoc */\n path(): string { return };\n /** @inheritdoc */\n search(): { [key: string]: any } { return };\n /** @inheritdoc */\n hash(): string { return };\n /** @inheritdoc */\n onChange(callback: Function): Function { return };\n\n\n /**\n * Returns the current URL parts\n *\n * This method returns the current URL components as a [[UrlParts]] object.\n *\n * @returns the current url parts\n */\n parts(): UrlParts {\n return { path: this.path(), search: this.search(), hash: this.hash() }\n }\n\n dispose() { }\n\n /** @inheritdoc */\n sync(evt?) { return }\n /** @inheritdoc */\n listen(enabled?: boolean): Function { return };\n /** @inheritdoc */\n deferIntercept(defer?: boolean) { return }\n /** @inheritdoc */\n match(urlParts: UrlParts): MatchResult { return }\n\n /**\n * A nested API for managing URL rules and rewrites\n *\n * See: [[UrlRulesApi]] for details\n */\n rules: UrlRulesApi;\n\n /**\n * A nested API to configure the URL and retrieve URL information\n *\n * See: [[UrlConfigApi]] for details\n */\n config: UrlConfigApi;\n\n /** @hidden */\n private router: UIRouter;\n\n /** @hidden */\n constructor(router: UIRouter, lateBind = true) {\n this.router = router;\n this.rules = {} as any;\n this.config = {} as any;\n\n // proxy function calls from UrlService to the LocationService/LocationConfig\n const locationServices = () => router.locationService;\n createProxyFunctions(locationServices, this, locationServices, locationServicesFns, lateBind);\n\n const locationConfig = () => router.locationConfig;\n createProxyFunctions(locationConfig, this.config, locationConfig, locationConfigFns, lateBind);\n\n const umf = () => router.urlMatcherFactory;\n createProxyFunctions(umf, this.config, umf, umfFns);\n\n const urlRouter = () => router.urlRouter;\n createProxyFunctions(urlRouter, this.rules, urlRouter, rulesFns);\n createProxyFunctions(urlRouter, this, urlRouter, syncFns);\n }\n}\n","/**\n * @coreapi\n * @module core\n */ /** */\nimport { UrlMatcherFactory } from \"./url/urlMatcherFactory\";\nimport { UrlRouter } from \"./url/urlRouter\";\nimport { TransitionService } from \"./transition/transitionService\";\nimport { ViewService } from \"./view/view\";\nimport { StateRegistry } from \"./state/stateRegistry\";\nimport { StateService } from \"./state/stateService\";\nimport { UIRouterGlobals } from \"./globals\";\nimport { UIRouterPlugin, Disposable } from \"./interface\";\nimport { values, removeFrom } from \"./common/common\";\nimport { isFunction } from \"./common/predicates\";\nimport { UrlService } from \"./url/urlService\";\nimport { LocationServices, LocationConfig } from \"./common/coreservices\";\nimport { Trace, trace } from \"./common/trace\";\n\n/** @hidden */\nlet _routerInstance = 0;\n\n/**\n * The master class used to instantiate an instance of UI-Router.\n *\n * UI-Router (for each specific framework) will create an instance of this class during bootstrap.\n * This class instantiates and wires the UI-Router services together.\n *\n * After a new instance of the UIRouter class is created, it should be configured for your app.\n * For instance, app states should be registered with the [[UIRouter.stateRegistry]].\n *\n * ---\n *\n * Normally the framework code will bootstrap UI-Router.\n * If you are bootstrapping UIRouter manually, tell it to monitor the URL by calling\n * [[UrlService.listen]] then [[UrlService.sync]].\n */\nexport class UIRouter {\n /** @hidden */ $id = _routerInstance++;\n /** @hidden */ _disposed = false;\n /** @hidden */ private _disposables: Disposable[] = [];\n\n /** Provides trace information to the console */\n trace: Trace = trace;\n\n /** Provides services related to ui-view synchronization */\n viewService = new ViewService();\n\n /** Provides services related to Transitions */\n transitionService: TransitionService = new TransitionService(this);\n\n /** Global router state */\n globals: UIRouterGlobals = new UIRouterGlobals();\n\n /**\n * Deprecated for public use. Use [[urlService]] instead.\n * @deprecated Use [[urlService]] instead\n */\n urlMatcherFactory: UrlMatcherFactory = new UrlMatcherFactory();\n\n /**\n * Deprecated for public use. Use [[urlService]] instead.\n * @deprecated Use [[urlService]] instead\n */\n urlRouter: UrlRouter = new UrlRouter(this);\n\n /** Provides a registry for states, and related registration services */\n stateRegistry: StateRegistry = new StateRegistry(this);\n\n /** Provides services related to states */\n stateService = new StateService(this);\n\n /** Provides services related to the URL */\n urlService: UrlService = new UrlService(this);\n\n\n /** Registers an object to be notified when the router is disposed */\n disposable(disposable: Disposable) {\n this._disposables.push(disposable);\n }\n\n /**\n * Disposes this router instance\n *\n * When called, clears resources retained by the router by calling `dispose(this)` on all\n * registered [[disposable]] objects.\n *\n * Or, if a `disposable` object is provided, calls `dispose(this)` on that object only.\n *\n * @param disposable (optional) the disposable to dispose\n */\n dispose(disposable?: any): void {\n if (disposable && isFunction(disposable.dispose)) {\n disposable.dispose(this);\n return undefined;\n }\n\n this._disposed = true;\n this._disposables.slice().forEach(d => {\n try {\n typeof d.dispose === 'function' && d.dispose(this);\n removeFrom(this._disposables, d);\n } catch (ignored) {}\n });\n }\n\n /**\n * Creates a new `UIRouter` object\n *\n * @param locationService a [[LocationServices]] implementation\n * @param locationConfig a [[LocationConfig]] implementation\n * @internalapi\n */\n constructor(\n public locationService: LocationServices = UrlService.locationServiceStub,\n public locationConfig: LocationConfig = UrlService.locationConfigStub\n ) {\n\n this.viewService._pluginapi._rootViewContext(this.stateRegistry.root());\n this.globals.$current = this.stateRegistry.root();\n this.globals.current = this.globals.$current.self;\n\n this.disposable(this.globals);\n this.disposable(this.stateService);\n this.disposable(this.stateRegistry);\n this.disposable(this.transitionService);\n this.disposable(this.urlRouter);\n this.disposable(locationService);\n this.disposable(locationConfig);\n }\n\n /** @hidden */\n private _plugins: { [key: string]: UIRouterPlugin } = {};\n\n /** Add plugin (as ES6 class) */\n plugin(plugin: { new(router: UIRouter, options?: any): T }, options?: any): T;\n /** Add plugin (as javascript constructor function) */\n plugin(plugin: { (router: UIRouter, options?: any): void }, options?: any): T;\n /** Add plugin (as javascript factory function) */\n plugin(plugin: PluginFactory, options?: any): T;\n /**\n * Adds a plugin to UI-Router\n *\n * This method adds a UI-Router Plugin.\n * A plugin can enhance or change UI-Router behavior using any public API.\n *\n * #### Example:\n * ```js\n * import { MyCoolPlugin } from \"ui-router-cool-plugin\";\n *\n * var plugin = router.addPlugin(MyCoolPlugin);\n * ```\n *\n * ### Plugin authoring\n *\n * A plugin is simply a class (or constructor function) which accepts a [[UIRouter]] instance and (optionally) an options object.\n *\n * The plugin can implement its functionality using any of the public APIs of [[UIRouter]].\n * For example, it may configure router options or add a Transition Hook.\n *\n * The plugin can then be published as a separate module.\n *\n * #### Example:\n * ```js\n * export class MyAuthPlugin implements UIRouterPlugin {\n * constructor(router: UIRouter, options: any) {\n * this.name = \"MyAuthPlugin\";\n * let $transitions = router.transitionService;\n * let $state = router.stateService;\n *\n * let authCriteria = {\n * to: (state) => state.data && state.data.requiresAuth\n * };\n *\n * function authHook(transition: Transition) {\n * let authService = transition.injector().get('AuthService');\n * if (!authService.isAuthenticated()) {\n * return $state.target('login');\n * }\n * }\n *\n * $transitions.onStart(authCriteria, authHook);\n * }\n * }\n * ```\n *\n * @param plugin one of:\n * - a plugin class which implements [[UIRouterPlugin]]\n * - a constructor function for a [[UIRouterPlugin]] which accepts a [[UIRouter]] instance\n * - a factory function which accepts a [[UIRouter]] instance and returns a [[UIRouterPlugin]] instance\n * @param options options to pass to the plugin class/factory\n * @returns the registered plugin instance\n */\n plugin(plugin: any, options: any = {}): T {\n let pluginInstance = new plugin(this, options);\n if (!pluginInstance.name) throw new Error(\"Required property `name` missing on plugin: \" + pluginInstance);\n this._disposables.push(pluginInstance);\n return this._plugins[pluginInstance.name] = pluginInstance;\n }\n\n /**\n * Returns registered plugins\n *\n * Returns the registered plugin of the given `pluginName`.\n * If no `pluginName` is given, returns all registered plugins\n *\n * @param pluginName (optional) the name of the plugin to get\n * @return the named plugin (undefined if not found), or all plugins (if `pluginName` is omitted)\n */\n getPlugin(pluginName: string): UIRouterPlugin;\n getPlugin(): UIRouterPlugin[];\n getPlugin(pluginName?: string): UIRouterPlugin|UIRouterPlugin[] {\n return pluginName ? this._plugins[pluginName] : values(this._plugins);\n }\n}\n\n/** @internalapi */\nexport type PluginFactory = (router: UIRouter, options?: any) => T;\n","/** @module hooks */ /** */\nimport { Transition } from \"../transition/transition\";\nimport { UIRouter } from \"../router\";\nimport { TransitionService } from \"../transition/transitionService\";\n\nfunction addCoreResolvables(trans: Transition) {\n trans.addResolvable({ token: UIRouter, deps: [], resolveFn: () => trans.router, data: trans.router }, \"\");\n trans.addResolvable({ token: Transition, deps: [], resolveFn: () => trans, data: trans }, \"\");\n trans.addResolvable({ token: '$transition$', deps: [], resolveFn: () => trans, data: trans }, \"\");\n trans.addResolvable({ token: '$stateParams', deps: [], resolveFn: () => trans.params(), data: trans.params() }, \"\");\n\n trans.entering().forEach(state => {\n trans.addResolvable({ token: '$state$', deps: [], resolveFn: () => state, data: state }, state);\n });\n}\n\nexport const registerAddCoreResolvables = (transitionService: TransitionService) =>\n transitionService.onCreate({}, addCoreResolvables);\n","/** @module hooks */ /** */\nimport {isString, isFunction} from \"../common/predicates\"\nimport {Transition} from \"../transition/transition\";\nimport {services} from \"../common/coreservices\";\nimport {TargetState} from \"../state/targetState\";\nimport {TransitionService} from \"../transition/transitionService\";\nimport {TransitionHookFn} from \"../transition/interface\";\n\n/**\n * A [[TransitionHookFn]] that redirects to a different state or params\n *\n * Registered using `transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectHook);`\n * \n * See [[StateDeclaration.redirectTo]]\n */\nconst redirectToHook: TransitionHookFn = (trans: Transition) => {\n let redirect = trans.to().redirectTo;\n if (!redirect) return;\n\n let $state = trans.router.stateService;\n\n function handleResult(result: any) {\n if (!result) return;\n if (result instanceof TargetState) return result;\n if (isString(result)) return $state.target( result, trans.params(), trans.options());\n if (result['state'] || result['params'])\n return $state.target(result['state'] || trans.to(), result['params'] || trans.params(), trans.options());\n }\n\n if (isFunction(redirect)) {\n return services.$q.when(redirect(trans)).then(handleResult);\n }\n return handleResult(redirect);\n};\n\nexport const registerRedirectToHook = (transitionService: TransitionService) =>\n transitionService.onStart({to: (state) => !!state.redirectTo}, redirectToHook);\n","/** @module hooks */\n/** for typedoc */\nimport { TransitionStateHookFn } from '../transition/interface';\nimport { Transition } from '../transition/transition';\nimport { TransitionService } from '../transition/transitionService';\nimport { StateDeclaration } from '../state/interface';\nimport { StateObject } from '../state/stateObject';\n\n/**\n * A factory which creates an onEnter, onExit or onRetain transition hook function\n *\n * The returned function invokes the (for instance) state.onEnter hook when the\n * state is being entered.\n *\n * @hidden\n */\nfunction makeEnterExitRetainHook(hookName: string): TransitionStateHookFn {\n return (transition: Transition, state: StateDeclaration) => {\n let _state: StateObject = state.$$state();\n let hookFn: TransitionStateHookFn = _state[hookName];\n return hookFn(transition, state);\n }\n}\n\n/**\n * The [[TransitionStateHookFn]] for onExit\n *\n * When the state is being exited, the state's .onExit function is invoked.\n *\n * Registered using `transitionService.onExit({ exiting: (state) => !!state.onExit }, onExitHook);`\n *\n * See: [[IHookRegistry.onExit]]\n */\nconst onExitHook: TransitionStateHookFn = makeEnterExitRetainHook('onExit');\nexport const registerOnExitHook = (transitionService: TransitionService) =>\n transitionService.onExit({exiting: state => !!state.onExit}, onExitHook);\n\n/**\n * The [[TransitionStateHookFn]] for onRetain\n *\n * When the state was already entered, and is not being exited or re-entered, the state's .onRetain function is invoked.\n *\n * Registered using `transitionService.onRetain({ retained: (state) => !!state.onRetain }, onRetainHook);`\n *\n * See: [[IHookRegistry.onRetain]]\n */\nconst onRetainHook: TransitionStateHookFn = makeEnterExitRetainHook('onRetain');\nexport const registerOnRetainHook = (transitionService: TransitionService) =>\n transitionService.onRetain({retained: state => !!state.onRetain}, onRetainHook);\n\n/**\n * The [[TransitionStateHookFn]] for onEnter\n *\n * When the state is being entered, the state's .onEnter function is invoked.\n *\n * Registered using `transitionService.onEnter({ entering: (state) => !!state.onEnter }, onEnterHook);`\n *\n * See: [[IHookRegistry.onEnter]]\n */\nconst onEnterHook: TransitionStateHookFn = makeEnterExitRetainHook('onEnter');\nexport const registerOnEnterHook = (transitionService: TransitionService) =>\n transitionService.onEnter({entering: state => !!state.onEnter}, onEnterHook);\n\n","/** @module hooks */\n/** for typedoc */\nimport { noop } from '../common/common';\nimport { Transition } from '../transition/transition';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { TransitionStateHookFn, TransitionHookFn } from '../transition/interface';\nimport { TransitionService } from '../transition/transitionService';\nimport { val } from '../common/hof';\nimport { StateDeclaration } from '../state/interface';\n\n/**\n * A [[TransitionHookFn]] which resolves all EAGER Resolvables in the To Path\n *\n * Registered using `transitionService.onStart({}, eagerResolvePath);`\n *\n * When a Transition starts, this hook resolves all the EAGER Resolvables, which the transition then waits for.\n *\n * See [[StateDeclaration.resolve]]\n */\nconst eagerResolvePath: TransitionHookFn = (trans: Transition) =>\n new ResolveContext(trans.treeChanges().to)\n .resolvePath(\"EAGER\", trans)\n .then(noop);\n\nexport const registerEagerResolvePath = (transitionService: TransitionService) =>\n transitionService.onStart({}, eagerResolvePath, {priority: 1000});\n\n/**\n * A [[TransitionHookFn]] which resolves all LAZY Resolvables for the state (and all its ancestors) in the To Path\n *\n * Registered using `transitionService.onEnter({ entering: () => true }, lazyResolveState);`\n *\n * When a State is being entered, this hook resolves all the Resolvables for this state, which the transition then waits for.\n *\n * See [[StateDeclaration.resolve]]\n */\nconst lazyResolveState: TransitionStateHookFn = (trans: Transition, state: StateDeclaration) =>\n new ResolveContext(trans.treeChanges().to)\n .subContext(state.$$state())\n .resolvePath(\"LAZY\", trans)\n .then(noop);\n\nexport const registerLazyResolveState = (transitionService: TransitionService) =>\n transitionService.onEnter({ entering: val(true) }, lazyResolveState, {priority: 1000});\n\n","/** @module hooks */ /** for typedoc */\nimport {noop} from \"../common/common\";\nimport {services} from \"../common/coreservices\";\nimport {Transition} from \"../transition/transition\";\nimport {ViewService} from \"../view/view\";\nimport {ViewConfig} from \"../view/interface\";\nimport {TransitionHookFn} from \"../transition/interface\";\nimport {TransitionService} from \"../transition/transitionService\";\n\n\n/**\n * A [[TransitionHookFn]] which waits for the views to load\n *\n * Registered using `transitionService.onStart({}, loadEnteringViews);`\n *\n * Allows the views to do async work in [[ViewConfig.load]] before the transition continues.\n * In angular 1, this includes loading the templates.\n */\nconst loadEnteringViews: TransitionHookFn = (transition: Transition) => {\n let $q = services.$q;\n let enteringViews = transition.views(\"entering\");\n if (!enteringViews.length) return;\n return $q.all(enteringViews.map(view => $q.when(view.load()))).then(noop);\n};\n\nexport const registerLoadEnteringViews = (transitionService: TransitionService) =>\n transitionService.onFinish({}, loadEnteringViews);\n\n/**\n * A [[TransitionHookFn]] which activates the new views when a transition is successful.\n *\n * Registered using `transitionService.onSuccess({}, activateViews);`\n *\n * After a transition is complete, this hook deactivates the old views from the previous state,\n * and activates the new views from the destination state.\n *\n * See [[ViewService]]\n */\nconst activateViews: TransitionHookFn = (transition: Transition) => {\n let enteringViews = transition.views(\"entering\");\n let exitingViews = transition.views(\"exiting\");\n if (!enteringViews.length && !exitingViews.length) return;\n\n let $view: ViewService = transition.router.viewService;\n\n exitingViews.forEach((vc: ViewConfig) => $view.deactivateViewConfig(vc));\n enteringViews.forEach((vc: ViewConfig) => $view.activateViewConfig(vc));\n\n $view.sync();\n};\n\nexport const registerActivateViews = (transitionService: TransitionService) =>\n transitionService.onSuccess({}, activateViews);\n","/** @module hooks */\n/** for typedoc */\nimport { Transition } from '../transition/transition';\nimport { copy } from '../common/common';\nimport { TransitionService } from '../transition/transitionService';\n\n/**\n * A [[TransitionHookFn]] which updates global UI-Router state\n *\n * Registered using `transitionService.onBefore({}, updateGlobalState);`\n *\n * Before a [[Transition]] starts, updates the global value of \"the current transition\" ([[Globals.transition]]).\n * After a successful [[Transition]], updates the global values of \"the current state\"\n * ([[Globals.current]] and [[Globals.$current]]) and \"the current param values\" ([[Globals.params]]).\n *\n * See also the deprecated properties:\n * [[StateService.transition]], [[StateService.current]], [[StateService.params]]\n */\nconst updateGlobalState = (trans: Transition) => {\n let globals = trans.router.globals;\n\n const transitionSuccessful = () => {\n globals.successfulTransitions.enqueue(trans);\n globals.$current = trans.$to();\n globals.current = globals.$current.self;\n\n copy(trans.params(), globals.params);\n };\n\n const clearCurrentTransition = () => {\n // Do not clear globals.transition if a different transition has started in the meantime\n if (globals.transition === trans) globals.transition = null;\n };\n\n trans.onSuccess({}, transitionSuccessful, { priority: 10000 });\n trans.promise.then(clearCurrentTransition, clearCurrentTransition);\n};\n\nexport const registerUpdateGlobalState = (transitionService: TransitionService) =>\n transitionService.onCreate({}, updateGlobalState);\n","/** @module hooks */ /** */\nimport {UrlRouter} from \"../url/urlRouter\";\nimport {StateService} from \"../state/stateService\";\nimport {Transition} from \"../transition/transition\";\nimport {TransitionHookFn} from \"../transition/interface\";\nimport {TransitionService} from \"../transition/transitionService\";\n\n/** \n * A [[TransitionHookFn]] which updates the URL after a successful transition\n * \n * Registered using `transitionService.onSuccess({}, updateUrl);`\n */\nconst updateUrl: TransitionHookFn = (transition: Transition) => {\n let options = transition.options();\n let $state: StateService = transition.router.stateService;\n let $urlRouter: UrlRouter = transition.router.urlRouter;\n\n // Dont update the url in these situations:\n // The transition was triggered by a URL sync (options.source === 'url')\n // The user doesn't want the url to update (options.location === false)\n // The destination state, and all parents have no navigable url\n if (options.source !== 'url' && options.location && $state.$current.navigable) {\n var urlOptions = {replace: options.location === 'replace'};\n $urlRouter.push($state.$current.navigable.url, $state.params, urlOptions);\n }\n\n $urlRouter.update(true);\n};\n\nexport const registerUpdateUrl = (transitionService: TransitionService) =>\n transitionService.onSuccess({}, updateUrl, {priority: 9999});\n","/** @module hooks */ /** */\nimport {Transition} from \"../transition/transition\";\nimport {TransitionService} from \"../transition/transitionService\";\nimport {TransitionHookFn} from \"../transition/interface\";\nimport {StateDeclaration, LazyLoadResult} from \"../state/interface\";\nimport {services} from \"../common/coreservices\";\nimport { StateRule } from \"../url/interface\";\n\n/**\n * A [[TransitionHookFn]] that performs lazy loading\n *\n * When entering a state \"abc\" which has a `lazyLoad` function defined:\n * - Invoke the `lazyLoad` function (unless it is already in process)\n * - Flag the hook function as \"in process\"\n * - The function should return a promise (that resolves when lazy loading is complete)\n * - Wait for the promise to settle\n * - If the promise resolves to a [[LazyLoadResult]], then register those states\n * - Flag the hook function as \"not in process\"\n * - If the hook was successful\n * - Remove the `lazyLoad` function from the state declaration\n * - If all the hooks were successful\n * - Retry the transition (by returning a TargetState)\n *\n * ```\n * .state('abc', {\n * component: 'fooComponent',\n * lazyLoad: () => System.import('./fooComponent')\n * });\n * ```\n *\n * See [[StateDeclaration.lazyLoad]]\n */\nconst lazyLoadHook: TransitionHookFn = (transition: Transition) => {\n let router = transition.router;\n\n function retryTransition() {\n if (transition.originalTransition().options().source !== 'url') {\n // The original transition was not triggered via url sync\n // The lazy state should be loaded now, so re-try the original transition\n let orig = transition.targetState();\n return router.stateService.target(orig.identifier(), orig.params(), orig.options());\n }\n\n // The original transition was triggered via url sync\n // Run the URL rules and find the best match\n let $url = router.urlService;\n let result = $url.match($url.parts());\n let rule = result && result.rule;\n\n // If the best match is a state, redirect the transition (instead\n // of calling sync() which supersedes the current transition)\n if (rule && rule.type === \"STATE\") {\n let state = (rule as StateRule).state;\n let params = result.match;\n return router.stateService.target(state, params, transition.options());\n }\n\n // No matching state found, so let .sync() choose the best non-state match/otherwise\n router.urlService.sync();\n }\n\n let promises = transition.entering()\n .filter(state => !!state.$$state().lazyLoad)\n .map(state => lazyLoadState(transition, state));\n\n return services.$q.all(promises).then(retryTransition);\n};\n\nexport const registerLazyLoadHook = (transitionService: TransitionService) =>\n transitionService.onBefore({ entering: (state) => !!state.lazyLoad }, lazyLoadHook);\n\n\n/**\n * Invokes a state's lazy load function\n *\n * @param transition a Transition context\n * @param state the state to lazy load\n * @returns A promise for the lazy load result\n */\nexport function lazyLoadState(transition: Transition, state: StateDeclaration): Promise {\n let lazyLoadFn = state.$$state().lazyLoad;\n\n // Store/get the lazy load promise on/from the hookfn so it doesn't get re-invoked\n let promise = lazyLoadFn['_promise'];\n if (!promise) {\n const success = (result) => {\n delete state.lazyLoad;\n delete state.$$state().lazyLoad;\n delete lazyLoadFn['_promise'];\n return result;\n };\n\n const error = (err) => {\n delete lazyLoadFn['_promise'];\n return services.$q.reject(err);\n };\n\n promise = lazyLoadFn['_promise'] =\n services.$q.when(lazyLoadFn(transition, state))\n .then(updateStateRegistry)\n .then(success, error);\n }\n\n /** Register any lazy loaded state definitions */\n function updateStateRegistry(result: LazyLoadResult) {\n if (result && Array.isArray(result.states)) {\n result.states.forEach(state => transition.router.stateRegistry.register(state));\n }\n return result;\n }\n\n return promise;\n}\n","/** @module transition */ /** */\nimport { TransitionHookPhase, PathType } from \"./interface\";\nimport { GetErrorHandler, GetResultHandler, TransitionHook } from \"./transitionHook\";\n/**\n * This class defines a type of hook, such as `onBefore` or `onEnter`.\n * Plugins can define custom hook types, such as sticky states does for `onInactive`.\n *\n * @interalapi\n */\nexport class TransitionEventType {\n\n constructor(public name: string,\n public hookPhase: TransitionHookPhase,\n public hookOrder: number,\n public criteriaMatchPath: PathType,\n public reverseSort: boolean = false,\n public getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,\n public getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,\n public synchronous: boolean = false,\n ) { }\n}\n","/** @module hooks */ /** */\n\nimport { trace } from '../common/trace';\nimport { Rejection } from '../transition/rejectFactory';\nimport { TransitionService } from '../transition/transitionService';\nimport { Transition } from '../transition/transition';\n\n/**\n * A [[TransitionHookFn]] that skips a transition if it should be ignored\n *\n * This hook is invoked at the end of the onBefore phase.\n *\n * If the transition should be ignored (because no parameter or states changed)\n * then the transition is ignored and not processed.\n */\nfunction ignoredHook(trans: Transition) {\n const ignoredReason = trans._ignoredReason();\n if (!ignoredReason) return;\n\n trace.traceTransitionIgnored(trans);\n\n const pending = trans.router.globals.transition;\n\n // The user clicked a link going back to the *current state* ('A')\n // However, there is also a pending transition in flight (to 'B')\n // Abort the transition to 'B' because the user now wants to be back at 'A'.\n if (ignoredReason === 'SameAsCurrent' && pending) {\n pending.abort();\n }\n\n return Rejection.ignored().toPromise();\n}\n\nexport const registerIgnoredTransitionHook = (transitionService: TransitionService) =>\n transitionService.onBefore({}, ignoredHook, { priority: -9999 });\n","/** @module hooks */ /** */\n\nimport { TransitionService } from '../transition/transitionService';\nimport { Transition } from '../transition/transition';\n\n/**\n * A [[TransitionHookFn]] that rejects the Transition if it is invalid\n *\n * This hook is invoked at the end of the onBefore phase.\n * If the transition is invalid (for example, param values do not validate)\n * then the transition is rejected.\n */\nfunction invalidTransitionHook(trans: Transition) {\n if (!trans.valid()) {\n throw new Error(trans.error());\n }\n}\n\nexport const registerInvalidTransitionHook = (transitionService: TransitionService) =>\n transitionService.onBefore({}, invalidTransitionHook, { priority: -10000 });\n","/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport {\n IHookRegistry, TransitionOptions, TransitionHookScope, TransitionHookPhase, TransitionCreateHookFn, HookMatchCriteria,\n HookRegOptions, PathTypes, PathType, RegisteredHooks, TransitionHookFn, TransitionStateHookFn\n} from \"./interface\";\nimport { Transition } from \"./transition\";\nimport { makeEvent, RegisteredHook } from \"./hookRegistry\";\nimport { TargetState } from \"../state/targetState\";\nimport { PathNode } from \"../path/pathNode\";\nimport { ViewService } from \"../view/view\";\nimport { UIRouter } from \"../router\";\nimport { registerAddCoreResolvables } from \"../hooks/coreResolvables\";\nimport { registerRedirectToHook } from \"../hooks/redirectTo\";\nimport { registerOnExitHook, registerOnRetainHook, registerOnEnterHook } from \"../hooks/onEnterExitRetain\";\nimport { registerEagerResolvePath, registerLazyResolveState } from \"../hooks/resolve\";\nimport { registerLoadEnteringViews, registerActivateViews } from \"../hooks/views\";\nimport { registerUpdateGlobalState } from \"../hooks/updateGlobals\";\nimport { registerUpdateUrl } from \"../hooks/url\";\nimport { registerLazyLoadHook } from \"../hooks/lazyLoad\";\nimport { TransitionEventType } from \"./transitionEventType\";\nimport { TransitionHook, GetResultHandler, GetErrorHandler } from \"./transitionHook\";\nimport { isDefined } from \"../common/predicates\";\nimport { removeFrom, values, createProxyFunctions } from \"../common/common\";\nimport { Disposable } from \"../interface\"; // has or is using\nimport { val } from \"../common/hof\";\nimport { registerIgnoredTransitionHook } from '../hooks/ignoredTransition';\nimport { registerInvalidTransitionHook } from '../hooks/invalidTransition';\n\n/**\n * The default [[Transition]] options.\n *\n * Include this object when applying custom defaults:\n * let reloadOpts = { reload: true, notify: true }\n * let options = defaults(theirOpts, customDefaults, defaultOptions);\n */\nexport let defaultTransOpts: TransitionOptions = {\n location : true,\n relative : null,\n inherit : false,\n notify : true,\n reload : false,\n custom : {},\n current : () => null,\n source : \"unknown\"\n};\n\n\n/**\n * Plugin API for Transition Service\n * @internalapi\n */\nexport interface TransitionServicePluginAPI {\n /**\n * Adds a Path to be used as a criterion against a TreeChanges path\n *\n * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.\n * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`\n * Each state in the exiting path is checked against the criteria and returned as part of the match.\n *\n * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.\n * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`\n * Only the tail of the `to` path is checked against the criteria and returned as part of the match.\n */\n _definePathType(name: string, hookScope: TransitionHookScope);\n\n /**\n * Gets a Path definition used as a criterion against a TreeChanges path\n */\n _getPathTypes(): PathTypes;\n\n /**\n * Defines a transition hook type and returns a transition hook registration\n * function (which can then be used to register hooks of this type).\n */\n _defineEvent(name: string,\n hookPhase: TransitionHookPhase,\n hookOrder: number,\n criteriaMatchPath: PathType,\n reverseSort?: boolean,\n getResultHandler?: GetResultHandler,\n getErrorHandler?: GetErrorHandler,\n rejectIfSuperseded?: boolean);\n\n /**\n * Returns the known event types, such as `onBefore`\n * If a phase argument is provided, returns only events for the given phase.\n */\n _getEvents(phase?: TransitionHookPhase): TransitionEventType[];\n\n /** Returns the hooks registered for the given hook name */\n getHooks(hookName: string): RegisteredHook[];\n}\n\n/**\n * This class provides services related to Transitions.\n *\n * - Most importantly, it allows global Transition Hooks to be registered.\n * - It allows the default transition error handler to be set.\n * - It also has a factory function for creating new [[Transition]] objects, (used internally by the [[StateService]]).\n *\n * At bootstrap, [[UIRouter]] creates a single instance (singleton) of this class.\n */\nexport class TransitionService implements IHookRegistry, Disposable {\n /** @hidden */\n _transitionCount = 0;\n\n /**\n * Registers a [[TransitionHookFn]], called *while a transition is being constructed*.\n *\n * Registers a transition lifecycle hook, which is invoked during transition construction.\n *\n * This low level hook should only be used by plugins.\n * This can be a useful time for plugins to add resolves or mutate the transition as needed.\n * The Sticky States plugin uses this hook to modify the treechanges.\n *\n * ### Lifecycle\n *\n * `onCreate` hooks are invoked *while a transition is being constructed*.\n *\n * ### Return value\n *\n * The hook's return value is ignored\n *\n * @internalapi\n * @param criteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be invoked.\n * @param options the registration options\n * @returns a function which deregisters the hook.\n */\n onCreate(criteria: HookMatchCriteria, callback: TransitionCreateHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return }\n\n /** @hidden */\n public $view: ViewService;\n\n /** @hidden The transition hook types, such as `onEnter`, `onStart`, etc */\n private _eventTypes: TransitionEventType[] = [];\n /** @hidden The registered transition hooks */\n _registeredHooks = { } as RegisteredHooks;\n /** @hidden The paths on a criteria object */\n private _criteriaPaths = { } as PathTypes;\n /** @hidden */\n private _router: UIRouter;\n\n /** @internalapi */\n _pluginapi: TransitionServicePluginAPI;\n\n /**\n * This object has hook de-registration functions for the built-in hooks.\n * This can be used by third parties libraries that wish to customize the behaviors\n *\n * @hidden\n */\n _deregisterHookFns: {\n addCoreResolves: Function;\n ignored: Function;\n invalid: Function;\n redirectTo: Function;\n onExit: Function;\n onRetain: Function;\n onEnter: Function;\n eagerResolve: Function;\n lazyResolve: Function;\n loadViews: Function;\n activateViews: Function;\n updateGlobals: Function;\n updateUrl: Function;\n lazyLoad: Function;\n };\n\n /** @hidden */\n constructor(_router: UIRouter) {\n this._router = _router;\n this.$view = _router.viewService;\n this._deregisterHookFns = {};\n this._pluginapi = createProxyFunctions(val(this), {}, val(this), [\n '_definePathType',\n '_defineEvent',\n '_getPathTypes',\n '_getEvents',\n 'getHooks',\n ]);\n\n this._defineCorePaths();\n this._defineCoreEvents();\n this._registerCoreTransitionHooks();\n }\n\n /**\n * dispose\n * @internalapi\n */\n dispose(router: UIRouter) {\n values(this._registeredHooks).forEach((hooksArray: RegisteredHook[]) => hooksArray.forEach(hook => {\n hook._deregistered = true;\n removeFrom(hooksArray, hook);\n }));\n }\n\n /**\n * Creates a new [[Transition]] object\n *\n * This is a factory function for creating new Transition objects.\n * It is used internally by the [[StateService]] and should generally not be called by application code.\n *\n * @param fromPath the path to the current state (the from state)\n * @param targetState the target state (destination)\n * @returns a Transition\n */\n create(fromPath: PathNode[], targetState: TargetState): Transition {\n return new Transition(fromPath, targetState, this._router);\n }\n\n /** @hidden */\n private _defineCoreEvents() {\n const Phase = TransitionHookPhase;\n const TH = TransitionHook;\n const paths = this._criteriaPaths;\n const NORMAL_SORT = false, REVERSE_SORT = true;\n const ASYNCHRONOUS = false, SYNCHRONOUS = true;\n\n this._defineEvent(\"onCreate\", Phase.CREATE, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.THROW_ERROR, SYNCHRONOUS);\n\n this._defineEvent(\"onBefore\", Phase.BEFORE, 0, paths.to);\n\n this._defineEvent(\"onStart\", Phase.RUN, 0, paths.to);\n this._defineEvent(\"onExit\", Phase.RUN, 100, paths.exiting, REVERSE_SORT);\n this._defineEvent(\"onRetain\", Phase.RUN, 200, paths.retained);\n this._defineEvent(\"onEnter\", Phase.RUN, 300, paths.entering);\n this._defineEvent(\"onFinish\", Phase.RUN, 400, paths.to);\n\n this._defineEvent(\"onSuccess\", Phase.SUCCESS, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS);\n this._defineEvent(\"onError\", Phase.ERROR, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS);\n }\n\n /** @hidden */\n private _defineCorePaths() {\n const { STATE, TRANSITION } = TransitionHookScope;\n\n this._definePathType(\"to\", TRANSITION);\n this._definePathType(\"from\", TRANSITION);\n this._definePathType(\"exiting\", STATE);\n this._definePathType(\"retained\", STATE);\n this._definePathType(\"entering\", STATE);\n }\n\n /** @hidden */\n _defineEvent(name: string,\n hookPhase: TransitionHookPhase,\n hookOrder: number,\n criteriaMatchPath: PathType,\n reverseSort: boolean = false,\n getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,\n getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,\n synchronous: boolean = false)\n {\n let eventType = new TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous);\n\n this._eventTypes.push(eventType);\n makeEvent(this, this, eventType);\n };\n\n /** @hidden */\n private _getEvents(phase?: TransitionHookPhase): TransitionEventType[] {\n let transitionHookTypes = isDefined(phase) ?\n this._eventTypes.filter(type => type.hookPhase === phase) :\n this._eventTypes.slice();\n\n return transitionHookTypes.sort((l, r) => {\n let cmpByPhase = l.hookPhase - r.hookPhase;\n return cmpByPhase === 0 ? l.hookOrder - r.hookOrder : cmpByPhase;\n })\n }\n\n /**\n * Adds a Path to be used as a criterion against a TreeChanges path\n *\n * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.\n * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`\n * Each state in the exiting path is checked against the criteria and returned as part of the match.\n *\n * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.\n * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`\n * Only the tail of the `to` path is checked against the criteria and returned as part of the match.\n *\n * @hidden\n */\n private _definePathType(name: string, hookScope: TransitionHookScope) {\n this._criteriaPaths[name] = { name, scope: hookScope };\n }\n\n /** * @hidden */\n private _getPathTypes(): PathTypes {\n return this._criteriaPaths;\n }\n\n /** @hidden */\n public getHooks(hookName: string): RegisteredHook[] {\n return this._registeredHooks[hookName];\n }\n\n /** @hidden */\n private _registerCoreTransitionHooks() {\n let fns = this._deregisterHookFns;\n\n fns.addCoreResolves = registerAddCoreResolvables(this);\n fns.ignored = registerIgnoredTransitionHook(this);\n fns.invalid = registerInvalidTransitionHook(this);\n\n // Wire up redirectTo hook\n fns.redirectTo = registerRedirectToHook(this);\n \n // Wire up onExit/Retain/Enter state hooks\n fns.onExit = registerOnExitHook(this);\n fns.onRetain = registerOnRetainHook(this);\n fns.onEnter = registerOnEnterHook(this);\n\n // Wire up Resolve hooks\n fns.eagerResolve = registerEagerResolvePath(this);\n fns.lazyResolve = registerLazyResolveState(this);\n \n // Wire up the View management hooks\n fns.loadViews = registerLoadEnteringViews(this);\n fns.activateViews = registerActivateViews(this);\n\n // Updates global state after a transition\n fns.updateGlobals = registerUpdateGlobalState(this);\n\n // After globals.current is updated at priority: 10000\n fns.updateUrl = registerUpdateUrl(this);\n\n // Lazy load state trees\n fns.lazyLoad = registerLazyLoadHook(this);\n }\n}\n","/**\n * @coreapi\n * @module state\n */\n/** */\nimport { createProxyFunctions, defaults, extend, inArray, noop, removeFrom, silenceUncaughtInPromise, silentRejection } from '../common/common';\nimport { isDefined, isObject, isString } from '../common/predicates';\nimport { Queue } from '../common/queue';\nimport { services } from '../common/coreservices';\n\nimport { PathUtils } from '../path/pathFactory';\nimport { PathNode } from '../path/pathNode';\n\nimport { HookResult, TransitionOptions } from '../transition/interface';\nimport { defaultTransOpts } from '../transition/transitionService';\nimport { Rejection, RejectType } from '../transition/rejectFactory';\nimport { Transition } from '../transition/transition';\n\nimport { HrefOptions, LazyLoadResult, StateDeclaration, StateOrName, TransitionPromise } from './interface';\nimport { StateObject } from './stateObject';\nimport { TargetState } from './targetState';\n\nimport { RawParams } from '../params/interface';\nimport { Param } from '../params/param';\nimport { Glob } from '../common/glob';\nimport { UIRouter } from '../router';\nimport { UIInjector } from '../interface';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { lazyLoadState } from '../hooks/lazyLoad';\nimport { not, val } from '../common/hof';\nimport { StateParams } from '../params/stateParams';\n\nexport type OnInvalidCallback =\n (toState?: TargetState, fromState?: TargetState, injector?: UIInjector) => HookResult;\n\n/**\n * Provides state related service functions\n *\n * This class provides services related to ui-router states.\n * An instance of this class is located on the global [[UIRouter]] object.\n */\nexport class StateService {\n /** @internalapi */\n invalidCallbacks: OnInvalidCallback[] = [];\n\n /**\n * The [[Transition]] currently in progress (or null)\n *\n * This is a passthrough through to [[UIRouterGlobals.transition]]\n */\n get transition() { return this.router.globals.transition; }\n /**\n * The latest successful state parameters\n *\n * This is a passthrough through to [[UIRouterGlobals.params]]\n */\n get params(): StateParams { return this.router.globals.params; }\n /**\n * The current [[StateDeclaration]]\n *\n * This is a passthrough through to [[UIRouterGlobals.current]]\n */\n get current() { return this.router.globals.current; }\n /**\n * The current [[StateObject]]\n *\n * This is a passthrough through to [[UIRouterGlobals.$current]]\n */\n get $current() { return this.router.globals.$current; }\n\n /** @internalapi */\n constructor(private router: UIRouter) {\n let getters = ['current', '$current', 'params', 'transition'];\n let boundFns = Object.keys(StateService.prototype).filter(not(inArray(getters)));\n createProxyFunctions(val(StateService.prototype), this, val(this), boundFns);\n }\n\n /** @internalapi */\n dispose() {\n this.defaultErrorHandler(noop);\n this.invalidCallbacks = [];\n }\n\n /**\n * Handler for when [[transitionTo]] is called with an invalid state.\n *\n * Invokes the [[onInvalid]] callbacks, in natural order.\n * Each callback's return value is checked in sequence until one of them returns an instance of TargetState.\n * The results of the callbacks are wrapped in $q.when(), so the callbacks may return promises.\n *\n * If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned.\n *\n * @internalapi\n */\n private _handleInvalidTargetState(fromPath: PathNode[], toState: TargetState) {\n let fromState = PathUtils.makeTargetState(this.router.stateRegistry, fromPath);\n let globals = this.router.globals;\n const latestThing = () => globals.transitionHistory.peekTail();\n let latest = latestThing();\n let callbackQueue = new Queue(this.invalidCallbacks.slice());\n let injector = new ResolveContext(fromPath).injector();\n\n const checkForRedirect = (result: HookResult) => {\n if (!(result instanceof TargetState)) {\n return;\n }\n\n let target = result;\n // Recreate the TargetState, in case the state is now defined.\n target = this.target(target.identifier(), target.params(), target.options());\n\n if (!target.valid()) {\n return Rejection.invalid(target.error()).toPromise();\n }\n\n if (latestThing() !== latest) {\n return Rejection.superseded().toPromise();\n }\n\n return this.transitionTo(target.identifier(), target.params(), target.options());\n };\n\n function invokeNextCallback() {\n let nextCallback = callbackQueue.dequeue();\n if (nextCallback === undefined) return Rejection.invalid(toState.error()).toPromise();\n\n let callbackResult = services.$q.when(nextCallback(toState, fromState, injector));\n return callbackResult.then(checkForRedirect).then(result => result || invokeNextCallback());\n }\n\n return invokeNextCallback();\n }\n\n /**\n * Registers an Invalid State handler\n *\n * Registers a [[OnInvalidCallback]] function to be invoked when [[StateService.transitionTo]]\n * has been called with an invalid state reference parameter\n *\n * Example:\n * ```js\n * stateService.onInvalid(function(to, from, injector) {\n * if (to.name() === 'foo') {\n * let lazyLoader = injector.get('LazyLoadService');\n * return lazyLoader.load('foo')\n * .then(() => stateService.target('foo'));\n * }\n * });\n * ```\n *\n * @param {function} callback invoked when the toState is invalid\n * This function receives the (invalid) toState, the fromState, and an injector.\n * The function may optionally return a [[TargetState]] or a Promise for a TargetState.\n * If one is returned, it is treated as a redirect.\n *\n * @returns a function which deregisters the callback\n */\n onInvalid(callback: OnInvalidCallback): Function {\n this.invalidCallbacks.push(callback);\n return function deregisterListener() {\n removeFrom(this.invalidCallbacks)(callback);\n }.bind(this);\n }\n\n\n /**\n * Reloads the current state\n *\n * A method that force reloads the current state, or a partial state hierarchy.\n * All resolves are re-resolved, and components reinstantiated.\n *\n * #### Example:\n * ```js\n * let app angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.reload = function(){\n * $state.reload();\n * }\n * });\n * ```\n *\n * Note: `reload()` is just an alias for:\n *\n * ```js\n * $state.transitionTo($state.current, $state.params, {\n * reload: true, inherit: false\n * });\n * ```\n *\n * @param reloadState A state name or a state object.\n * If present, this state and all its children will be reloaded, but ancestors will not reload.\n *\n * #### Example:\n * ```js\n * //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item'\n * //and current state is 'contacts.detail.item'\n * let app angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.reload = function(){\n * //will reload 'contact.detail' and nested 'contact.detail.item' states\n * $state.reload('contact.detail');\n * }\n * });\n * ```\n *\n * @returns A promise representing the state of the new transition. See [[StateService.go]]\n */\n reload(reloadState?: StateOrName): Promise {\n return this.transitionTo(this.current, this.params, {\n reload: isDefined(reloadState) ? reloadState : true,\n inherit: false,\n notify: false,\n });\n };\n\n /**\n * Transition to a different state and/or parameters\n *\n * Convenience method for transitioning to a new state.\n *\n * `$state.go` calls `$state.transitionTo` internally but automatically sets options to\n * `{ location: true, inherit: true, relative: router.globals.$current, notify: true }`.\n * This allows you to use either an absolute or relative `to` argument (because of `relative: router.globals.$current`).\n * It also allows you to specify * only the parameters you'd like to update, while letting unspecified parameters\n * inherit from the current parameter values (because of `inherit: true`).\n *\n * #### Example:\n * ```js\n * let app = angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.changeState = function () {\n * $state.go('contact.detail');\n * };\n * });\n * ```\n *\n * @param to Absolute state name, state object, or relative state path (relative to current state).\n *\n * Some examples:\n *\n * - `$state.go('contact.detail')` - will go to the `contact.detail` state\n * - `$state.go('^')` - will go to the parent state\n * - `$state.go('^.sibling')` - if current state is `home.child`, will go to the `home.sibling` state\n * - `$state.go('.child.grandchild')` - if current state is home, will go to the `home.child.grandchild` state\n *\n * @param params A map of the parameters that will be sent to the state, will populate $stateParams.\n *\n * Any parameters that are not specified will be inherited from current parameter values (because of `inherit: true`).\n * This allows, for example, going to a sibling state that shares parameters defined by a parent state.\n *\n * @param options Transition options\n *\n * @returns {promise} A promise representing the state of the new transition.\n */\n go(to: StateOrName, params?: RawParams, options?: TransitionOptions): TransitionPromise {\n let defautGoOpts = { relative: this.$current, inherit: true };\n let transOpts = defaults(options, defautGoOpts, defaultTransOpts);\n return this.transitionTo(to, params, transOpts);\n };\n\n /**\n * Creates a [[TargetState]]\n *\n * This is a factory method for creating a TargetState\n *\n * This may be returned from a Transition Hook to redirect a transition, for example.\n */\n target(identifier: StateOrName, params?: RawParams, options: TransitionOptions = {}): TargetState {\n // If we're reloading, find the state object to reload from\n if (isObject(options.reload) && !(options.reload).name)\n throw new Error('Invalid reload state object');\n let reg = this.router.stateRegistry;\n options.reloadState = options.reload === true ? reg.root() : reg.matcher.find( options.reload, options.relative);\n\n if (options.reload && !options.reloadState)\n throw new Error(`No such reload state '${(isString(options.reload) ? options.reload : (options.reload).name)}'`);\n\n return new TargetState(this.router.stateRegistry, identifier, params, options);\n };\n\n private getCurrentPath(): PathNode[] {\n let globals = this.router.globals;\n let latestSuccess: Transition = globals.successfulTransitions.peekTail();\n const rootPath = () => [ new PathNode(this.router.stateRegistry.root()) ];\n return latestSuccess ? latestSuccess.treeChanges().to : rootPath();\n }\n\n /**\n * Low-level method for transitioning to a new state.\n *\n * The [[go]] method (which uses `transitionTo` internally) is recommended in most situations.\n *\n * #### Example:\n * ```js\n * let app = angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.changeState = function () {\n * $state.transitionTo('contact.detail');\n * };\n * });\n * ```\n *\n * @param to State name or state object.\n * @param toParams A map of the parameters that will be sent to the state,\n * will populate $stateParams.\n * @param options Transition options\n *\n * @returns A promise representing the state of the new transition. See [[go]]\n */\n transitionTo(to: StateOrName, toParams: RawParams = {}, options: TransitionOptions = {}): TransitionPromise {\n let router = this.router;\n let globals = router.globals;\n options = defaults(options, defaultTransOpts);\n const getCurrent = () =>\n globals.transition;\n options = extend(options, { current: getCurrent });\n\n let ref: TargetState = this.target(to, toParams, options);\n let currentPath = this.getCurrentPath();\n\n if (!ref.exists())\n return this._handleInvalidTargetState(currentPath, ref);\n\n if (!ref.valid())\n return silentRejection(ref.error());\n\n /**\n * Special handling for Ignored, Aborted, and Redirected transitions\n *\n * The semantics for the transition.run() promise and the StateService.transitionTo()\n * promise differ. For instance, the run() promise may be rejected because it was\n * IGNORED, but the transitionTo() promise is resolved because from the user perspective\n * no error occurred. Likewise, the transition.run() promise may be rejected because of\n * a Redirect, but the transitionTo() promise is chained to the new Transition's promise.\n */\n const rejectedTransitionHandler = (transition: Transition) => (error: any): Promise => {\n if (error instanceof Rejection) {\n const isLatest = router.globals.lastStartedTransitionId === transition.$id;\n\n if (error.type === RejectType.IGNORED) {\n isLatest && router.urlRouter.update();\n // Consider ignored `Transition.run()` as a successful `transitionTo`\n return services.$q.when(globals.current);\n }\n\n const detail: any = error.detail;\n if (error.type === RejectType.SUPERSEDED && error.redirected && detail instanceof TargetState) {\n // If `Transition.run()` was redirected, allow the `transitionTo()` promise to resolve successfully\n // by returning the promise for the new (redirect) `Transition.run()`.\n let redirect: Transition = transition.redirect(detail);\n return redirect.run().catch(rejectedTransitionHandler(redirect));\n }\n\n if (error.type === RejectType.ABORTED) {\n isLatest && router.urlRouter.update();\n return services.$q.reject(error);\n }\n }\n\n let errorHandler = this.defaultErrorHandler();\n errorHandler(error);\n\n return services.$q.reject(error);\n };\n\n let transition = this.router.transitionService.create(currentPath, ref);\n let transitionToPromise = transition.run().catch(rejectedTransitionHandler(transition));\n silenceUncaughtInPromise(transitionToPromise); // issue #2676\n\n // Return a promise for the transition, which also has the transition object on it.\n return extend(transitionToPromise, { transition });\n };\n\n /**\n * Checks if the current state *is* the provided state\n *\n * Similar to [[includes]] but only checks for the full state name.\n * If params is supplied then it will be tested for strict equality against the current\n * active params object, so all params must match with none missing and no extras.\n *\n * #### Example:\n * ```js\n * $state.$current.name = 'contacts.details.item';\n *\n * // absolute name\n * $state.is('contact.details.item'); // returns true\n * $state.is(contactDetailItemStateObject); // returns true\n * ```\n *\n * // relative name (. and ^), typically from a template\n * // E.g. from the 'contacts.details' template\n * ```html\n *
    Item
    \n * ```\n *\n * @param stateOrName The state name (absolute or relative) or state object you'd like to check.\n * @param params A param object, e.g. `{sectionId: section.id}`, that you'd like\n * to test against the current active state.\n * @param options An options object. The options are:\n * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will\n * test relative to `options.relative` state (or name).\n *\n * @returns Returns true if it is the state.\n */\n is(stateOrName: StateOrName, params?: RawParams, options?: { relative?: StateOrName }): boolean {\n options = defaults(options, { relative: this.$current });\n let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);\n if (!isDefined(state)) return undefined;\n if (this.$current !== state) return false;\n if (!params) return true;\n\n let schema: Param[] = state.parameters({ inherit: true, matchingKeys: params });\n return Param.equals(schema, Param.values(schema, params), this.params);\n };\n\n /**\n * Checks if the current state *includes* the provided state\n *\n * A method to determine if the current active state is equal to or is the child of the\n * state stateName. If any params are passed then they will be tested for a match as well.\n * Not all the parameters need to be passed, just the ones you'd like to test for equality.\n *\n * #### Example when `$state.$current.name === 'contacts.details.item'`\n * ```js\n * // Using partial names\n * $state.includes(\"contacts\"); // returns true\n * $state.includes(\"contacts.details\"); // returns true\n * $state.includes(\"contacts.details.item\"); // returns true\n * $state.includes(\"contacts.list\"); // returns false\n * $state.includes(\"about\"); // returns false\n * ```\n *\n * #### Glob Examples when `* $state.$current.name === 'contacts.details.item.url'`:\n * ```js\n * $state.includes(\"*.details.*.*\"); // returns true\n * $state.includes(\"*.details.**\"); // returns true\n * $state.includes(\"**.item.**\"); // returns true\n * $state.includes(\"*.details.item.url\"); // returns true\n * $state.includes(\"*.details.*.url\"); // returns true\n * $state.includes(\"*.details.*\"); // returns false\n * $state.includes(\"item.**\"); // returns false\n * ```\n *\n * @param stateOrName A partial name, relative name, glob pattern,\n * or state object to be searched for within the current state name.\n * @param params A param object, e.g. `{sectionId: section.id}`,\n * that you'd like to test against the current active state.\n * @param options An options object. The options are:\n * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will\n * test relative to `options.relative` state (or name).\n *\n * @returns {boolean} Returns true if it does include the state\n */\n includes(stateOrName: StateOrName, params?: RawParams, options?: TransitionOptions): boolean {\n options = defaults(options, { relative: this.$current });\n let glob = isString(stateOrName) && Glob.fromString( stateOrName);\n\n if (glob) {\n if (!glob.matches(this.$current.name)) return false;\n stateOrName = this.$current.name;\n }\n let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative), include = this.$current.includes;\n\n if (!isDefined(state)) return undefined;\n if (!isDefined(include[state.name])) return false;\n if (!params) return true;\n\n let schema: Param[] = state.parameters({ inherit: true, matchingKeys: params });\n return Param.equals(schema, Param.values(schema, params), this.params);\n };\n\n\n /**\n * Generates a URL for a state and parameters\n *\n * Returns the url for the given state populated with the given params.\n *\n * #### Example:\n * ```js\n * expect($state.href(\"about.person\", { person: \"bob\" })).toEqual(\"/about/bob\");\n * ```\n *\n * @param stateOrName The state name or state object you'd like to generate a url from.\n * @param params An object of parameter values to fill the state's required parameters.\n * @param options Options object. The options are:\n *\n * @returns {string} compiled state url\n */\n href(stateOrName: StateOrName, params: RawParams, options?: HrefOptions): string {\n let defaultHrefOpts = {\n lossy: true,\n inherit: true,\n absolute: false,\n relative: this.$current,\n };\n options = defaults(options, defaultHrefOpts);\n params = params || {};\n\n let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);\n\n if (!isDefined(state)) return null;\n if (options.inherit) params = this.params.$inherit(params, this.$current, state);\n\n let nav = (state && options.lossy) ? state.navigable : state;\n\n if (!nav || nav.url === undefined || nav.url === null) {\n return null;\n }\n return this.router.urlRouter.href(nav.url, params, {\n absolute: options.absolute,\n });\n };\n\n /** @hidden */\n private _defaultErrorHandler: ((_error: any) => void) = function $defaultErrorHandler($error$) {\n if ($error$ instanceof Error && $error$.stack) {\n console.error($error$);\n console.error($error$.stack);\n } else if ($error$ instanceof Rejection) {\n console.error($error$.toString());\n if ($error$.detail && $error$.detail.stack)\n console.error($error$.detail.stack);\n } else {\n console.error($error$);\n }\n };\n\n /**\n * Sets or gets the default [[transitionTo]] error handler.\n *\n * The error handler is called when a [[Transition]] is rejected or when any error occurred during the Transition.\n * This includes errors caused by resolves and transition hooks.\n *\n * Note:\n * This handler does not receive certain Transition rejections.\n * Redirected and Ignored Transitions are not considered to be errors by [[StateService.transitionTo]].\n *\n * The built-in default error handler logs the error to the console.\n *\n * You can provide your own custom handler.\n *\n * #### Example:\n * ```js\n * stateService.defaultErrorHandler(function() {\n * // Do not log transitionTo errors\n * });\n * ```\n *\n * @param handler a global error handler function\n * @returns the current global error handler\n */\n defaultErrorHandler(handler?: (error: any) => void): (error: any) => void {\n return this._defaultErrorHandler = handler || this._defaultErrorHandler;\n }\n\n /**\n * Gets a registered [[StateDeclaration]] object\n *\n * Returns the state declaration object for any specific state, or for all registered states.\n *\n * @param stateOrName (absolute or relative) If provided, will only get the declaration object for the requested state.\n * If not provided, returns an array of ALL states.\n * @param base When `stateOrName` is a relative state reference (such as `.bar.baz`), the state will be retrieved relative to this state.\n *\n * @returns a [[StateDeclaration]] object (or array of all registered [[StateDeclaration]] objects.)\n */\n get(stateOrName: StateOrName, base: StateOrName): StateDeclaration;\n get(stateOrName: StateOrName): StateDeclaration;\n get(): StateDeclaration[];\n get(stateOrName?: StateOrName, base?: StateOrName): any {\n let reg = this.router.stateRegistry;\n if (arguments.length === 0) return reg.get();\n return reg.get(stateOrName, base || this.$current);\n }\n\n /**\n * Lazy loads a state\n *\n * Explicitly runs a state's [[StateDeclaration.lazyLoad]] function.\n *\n * @param stateOrName the state that should be lazy loaded\n * @param transition the optional Transition context to use (if the lazyLoad function requires an injector, etc)\n * Note: If no transition is provided, a noop transition is created using the from the current state to the current state.\n * This noop transition is not actually run.\n *\n * @returns a promise to lazy load\n */\n lazyLoad(stateOrName: StateOrName, transition?: Transition): Promise {\n let state: StateDeclaration = this.get(stateOrName);\n if (!state || !state.lazyLoad) throw new Error(\"Can not lazy load \" + stateOrName);\n\n let currentPath = this.getCurrentPath();\n let target = PathUtils.makeTargetState(this.router.stateRegistry, currentPath);\n transition = transition || this.router.transitionService.create(currentPath, target);\n\n return lazyLoadState(transition, state);\n }\n}\n","/**\n * # Transition subsystem\n *\n * This module contains APIs related to a Transition.\n *\n * See:\n * - [[TransitionService]]\n * - [[Transition]]\n * - [[HookFn]], [[TransitionHookFn]], [[TransitionStateHookFn]], [[HookMatchCriteria]], [[HookResult]]\n *\n * @coreapi\n * @preferred\n * @module transition\n */ /** for typedoc */\nexport * from \"./interface\";\nexport * from \"./hookBuilder\";\nexport * from \"./hookRegistry\";\nexport * from \"./rejectFactory\";\nexport * from \"./transition\";\nexport * from \"./transitionHook\";\nexport * from \"./transitionEventType\";\nexport * from \"./transitionService\";\n\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { isArray, isObject, $QLike } from \"../common/index\";\n\n/**\n * An angular1-like promise api\n *\n * This object implements four methods similar to the\n * [angular 1 promise api](https://docs.angularjs.org/api/ng/service/$q)\n *\n * UI-Router evolved from an angular 1 library to a framework agnostic library.\n * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.\n *\n * This API provides native ES6 promise support wrapped as a $q-like API.\n * Internally, UI-Router uses this $q object to perform promise operations.\n * The `angular-ui-router` (ui-router for angular 1) uses the $q API provided by angular.\n *\n * $q-like promise api\n */\nexport const $q = {\n /** Normalizes a value as a promise */\n when: (val) => new Promise((resolve, reject) => resolve(val)),\n\n /** Normalizes a value as a promise rejection */\n reject: (val) => new Promise((resolve, reject) => { reject(val); }),\n\n /** @returns a deferred object, which has `resolve` and `reject` functions */\n defer: () => {\n let deferred: any = {};\n deferred.promise = new Promise((resolve, reject) => {\n deferred.resolve = resolve;\n deferred.reject = reject;\n });\n return deferred;\n },\n\n /** Like Promise.all(), but also supports object key/promise notation like $q */\n all: (promises: { [key: string]: Promise } | Promise[]) => {\n if (isArray(promises)) {\n return Promise.all(promises);\n }\n\n if (isObject(promises)) {\n // Convert promises map to promises array.\n // When each promise resolves, map it to a tuple { key: key, val: val }\n let chain = Object.keys(promises)\n .map(key => promises[key].then(val => ({key, val})));\n\n // Then wait for all promises to resolve, and convert them back to an object\n return $q.all(chain).then(values =>\n values.reduce((acc, tuple) => { acc[tuple.key] = tuple.val; return acc; }, {}));\n }\n }\n} as $QLike;","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport {\n extend, assertPredicate, isFunction, isArray, isInjectable, $InjectorLike, IInjectable\n} from \"../common/index\";\n\n// globally available injectables\nlet globals = {};\nlet STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg;\nlet ARGUMENT_NAMES = /([^\\s,]+)/g;\n\n/**\n * A basic angular1-like injector api\n *\n * This object implements four methods similar to the\n * [angular 1 dependency injector](https://docs.angularjs.org/api/auto/service/$injector)\n *\n * UI-Router evolved from an angular 1 library to a framework agnostic library.\n * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.\n *\n * This object provides a naive implementation of a globally scoped dependency injection system.\n * It supports the following DI approaches:\n *\n * ### Function parameter names\n *\n * A function's `.toString()` is called, and the parameter names are parsed.\n * This only works when the parameter names aren't \"mangled\" by a minifier such as UglifyJS.\n *\n * ```js\n * function injectedFunction(FooService, BarService) {\n * // FooService and BarService are injected\n * }\n * ```\n *\n * ### Function annotation\n *\n * A function may be annotated with an array of dependency names as the `$inject` property.\n *\n * ```js\n * injectedFunction.$inject = [ 'FooService', 'BarService' ];\n * function injectedFunction(fs, bs) {\n * // FooService and BarService are injected as fs and bs parameters\n * }\n * ```\n *\n * ### Array notation\n *\n * An array provides the names of the dependencies to inject (as strings).\n * The function is the last element of the array.\n *\n * ```js\n * [ 'FooService', 'BarService', function (fs, bs) {\n * // FooService and BarService are injected as fs and bs parameters\n * }]\n * ```\n *\n * @type {$InjectorLike}\n */\nexport const $injector = {\n /** Gets an object from DI based on a string token */\n get: name => globals[name],\n\n /** Returns true if an object named `name` exists in global DI */\n has: (name) => $injector.get(name) != null,\n\n /**\n * Injects a function\n *\n * @param fn the function to inject\n * @param context the function's `this` binding\n * @param locals An object with additional DI tokens and values, such as `{ someToken: { foo: 1 } }`\n */\n invoke: (fn: IInjectable, context?, locals?) => {\n let all = extend({}, globals, locals || {});\n let params = $injector.annotate(fn);\n let ensureExist = assertPredicate((key: string) => all.hasOwnProperty(key), key => `DI can't find injectable: '${key}'`);\n let args = params.filter(ensureExist).map(x => all[x]);\n if (isFunction(fn)) return fn.apply(context, args);\n else return (fn as any[]).slice(-1)[0].apply(context, args);\n },\n\n /**\n * Returns a function's dependencies\n *\n * Analyzes a function (or array) and returns an array of DI tokens that the function requires.\n * @return an array of `string`s\n */\n annotate: (fn: IInjectable): any[] => {\n if (!isInjectable(fn)) throw new Error(`Not an injectable function: ${fn}`);\n if (fn && (fn as any).$inject) return (fn as any).$inject;\n if (isArray(fn)) return fn.slice(0, -1);\n let fnStr = fn.toString().replace(STRIP_COMMENTS, '');\n let result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES);\n return result || [];\n }\n} as $InjectorLike;","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport {\n LocationConfig, LocationServices, identity, unnestR, isArray, splitEqual, splitHash, splitQuery\n} from \"../common\";\nimport { UIRouter } from \"../router\";\n\nexport const keyValsToObjectR = (accum, [key, val]) => {\n if (!accum.hasOwnProperty(key)) {\n accum[key] = val;\n } else if (isArray(accum[key])) {\n accum[key].push(val);\n } else {\n accum[key] = [accum[key], val]\n }\n return accum;\n};\n\nexport const getParams = (queryString: string): any =>\n queryString.split(\"&\").filter(identity).map(splitEqual).reduce(keyValsToObjectR, {});\n\nexport function parseUrl(url: string) {\n const orEmptyString = x => x || \"\";\n let [beforehash, hash] = splitHash(url).map(orEmptyString);\n let [path, search] = splitQuery(beforehash).map(orEmptyString);\n\n return { path, search, hash, url };\n}\n\nexport const buildUrl = (loc: LocationServices) => {\n let path = loc.path();\n let searchObject = loc.search();\n let hash = loc.hash();\n\n let search = Object.keys(searchObject).map(key => {\n let param = searchObject[key];\n let vals = isArray(param) ? param : [param];\n return vals.map(val => key + \"=\" + val);\n }).reduce(unnestR, []).join(\"&\");\n\n return path + (search ? \"?\" + search : \"\") + (hash ? \"#\" + hash : \"\");\n};\n\nexport function locationPluginFactory(\n name: string,\n isHtml5: boolean,\n serviceClass: { new(router?: UIRouter): LocationServices },\n configurationClass: { new(router?: UIRouter, isHtml5?: boolean): LocationConfig }\n) {\n return function(router: UIRouter) {\n let service = router.locationService = new serviceClass(router);\n let configuration = router.locationConfig = new configurationClass(router, isHtml5);\n\n function dispose(router: UIRouter) {\n router.dispose(service);\n router.dispose(configuration);\n }\n\n return { name, service, configuration, dispose };\n };\n}\n\nexport function getCustomEventCtor(): typeof CustomEvent {\n // CustomEvent Polyfill\n function _CustomEvent(event, params) {\n params = params || { bubbles: false, cancelable: false, detail: undefined };\n let evt = document.createEvent( 'CustomEvent' );\n evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );\n return evt;\n }\n _CustomEvent.prototype = Event.prototype;\n\n try {\n new CustomEvent('foo');\n return CustomEvent;\n } catch (_err) {\n return _CustomEvent as any;\n }\n}\n","/**\n * @internalapi\n * @module vanilla\n */ /** */\n\nimport { LocationServices } from \"../common/coreservices\";\nimport { Disposable } from \"../interface\";\nimport { UIRouter } from \"../router\";\nimport { LocationLike, HistoryLike } from \"./interface\";\nimport { parseUrl, getParams, buildUrl, getCustomEventCtor } from \"./utils\";\nimport { isDefined } from \"../common/predicates\";\nimport { extend, deregAll, removeFrom } from \"../common/common\";\n\nconst Evt: typeof CustomEvent = getCustomEventCtor();\n\n/** A base `LocationServices` */\nexport abstract class BaseLocationServices implements LocationServices, Disposable {\n constructor(router: UIRouter, public fireAfterUpdate: boolean) {\n this._location = self && self.location;\n this._history = self && self.history;\n }\n\n _listener = evt => this._listeners.forEach(cb => cb(evt));\n\n private _listeners: Function[] = [];\n _location: LocationLike;\n _history: HistoryLike;\n\n /**\n * This should return the current internal URL representation.\n *\n * The internal URL includes only the portion that UI-Router matches.\n * It does not include:\n * - protocol\n * - server\n * - port\n * - base href or hash\n */\n abstract _get(): string;\n\n /**\n * This should set the current URL.\n *\n * The `url` param should include only the portion that UI-Router matches on.\n * It should not include:\n * - protocol\n * - server\n * - port\n * - base href or hash\n *\n * However, after this function completes, the browser URL should reflect the entire (fully qualified)\n * HREF including those data.\n */\n abstract _set(state: any, title: string, url: string, replace: boolean);\n\n hash = () => parseUrl(this._get()).hash;\n path = () => parseUrl(this._get()).path;\n search = () => getParams(parseUrl(this._get()).search);\n\n url(url?: string, replace: boolean = true): string {\n if (isDefined(url) && url !== this._get()) {\n this._set(null, null, url, replace);\n\n if (this.fireAfterUpdate) {\n let evt = extend(new Evt(\"locationchange\"), { url });\n this._listeners.forEach(cb => cb(evt));\n }\n }\n\n return buildUrl(this);\n }\n\n onChange(cb: EventListener) {\n this._listeners.push(cb);\n return () => removeFrom(this._listeners, cb);\n }\n\n dispose(router: UIRouter) {\n deregAll(this._listeners);\n }\n}\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { trimHashVal } from \"../common/strings\";\nimport { UIRouter } from \"../router\";\nimport { BaseLocationServices } from \"./baseLocationService\";\n\n/** A `LocationServices` that uses the browser hash \"#\" to get/set the current location */\nexport class HashLocationService extends BaseLocationServices {\n constructor(router: UIRouter) {\n super(router, false);\n self.addEventListener('hashchange', this._listener, false);\n }\n\n _get() {\n return trimHashVal(this._location.hash);\n }\n _set(state: any, title: string, url: string, replace: boolean) {\n this._location.hash = url;\n }\n\n dispose (router: UIRouter) {\n super.dispose(router);\n self.removeEventListener('hashchange', this._listener);\n }\n}\n\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { BaseLocationServices } from \"./baseLocationService\";\nimport { UIRouter } from \"../router\";\n\n/** A `LocationServices` that gets/sets the current location from an in-memory object */\nexport class MemoryLocationService extends BaseLocationServices {\n _url: string;\n\n constructor(router: UIRouter) {\n super(router, true);\n }\n\n _get() {\n return this._url;\n }\n\n _set(state: any, title: string, url: string, replace: boolean) {\n this._url = url;\n }\n}\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { LocationConfig } from \"../common/coreservices\";\nimport { UIRouter } from \"../router\";\nimport { BaseLocationServices } from \"./baseLocationService\";\nimport { splitQuery, splitHash, stripFile } from \"../common/strings\";\n\n/**\n * A `LocationServices` that gets/sets the current location using the browser's `location` and `history` apis\n *\n * Uses `history.pushState` and `history.replaceState`\n */\nexport class PushStateLocationService extends BaseLocationServices {\n _config: LocationConfig;\n\n constructor(router: UIRouter) {\n super(router, true);\n this._config = router.urlService.config;\n self.addEventListener(\"popstate\", this._listener, false);\n };\n\n /**\n * Gets the base prefix without:\n * - trailing slash\n * - trailing filename\n * - protocol and hostname\n *\n * If , this returns '/base'.\n * If , this returns '/base'.\n *\n * See: https://html.spec.whatwg.org/dev/semantics.html#the-base-element\n */\n _getBasePrefix() {\n return stripFile(this._config.baseHref());\n }\n\n _get() {\n let { pathname, hash, search } = this._location;\n search = splitQuery(search)[1]; // strip ? if found\n hash = splitHash(hash)[1]; // strip # if found\n\n const basePrefix = this._getBasePrefix();\n let exactMatch = pathname === this._config.baseHref();\n let startsWith = pathname.startsWith(basePrefix);\n pathname = exactMatch ? '/' : startsWith ? pathname.substring(basePrefix.length) : pathname;\n\n return pathname + (search ? \"?\" + search : \"\") + (hash ? \"#\" + hash : \"\");\n }\n\n _set(state: any, title: string, url: string, replace: boolean) {\n let fullUrl = this._getBasePrefix() + url;\n\n if (replace) {\n this._history.replaceState(state, title, fullUrl);\n } else {\n this._history.pushState(state, title, fullUrl);\n }\n }\n\n dispose(router: UIRouter) {\n super.dispose(router);\n self.removeEventListener(\"popstate\", this._listener);\n }\n}\n\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { LocationConfig } from \"../common/coreservices\";\nimport { isDefined } from \"../common/predicates\";\nimport { noop } from \"../common/common\";\n\n/** A `LocationConfig` mock that gets/sets all config from an in-memory object */\nexport class MemoryLocationConfig implements LocationConfig {\n _baseHref = '';\n _port = 80;\n _protocol = \"http\";\n _host = \"localhost\";\n _hashPrefix = \"\";\n\n port = () => this._port;\n protocol = () => this._protocol;\n host = () => this._host;\n baseHref = () => this._baseHref;\n html5Mode = () => false;\n hashPrefix = (newval?) => isDefined(newval) ? this._hashPrefix = newval : this._hashPrefix;\n dispose = noop;\n}","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { isDefined } from \"../common/predicates\";\nimport { LocationConfig } from \"../common/coreservices\";\n\n/** A `LocationConfig` that delegates to the browser's `location` object */\nexport class BrowserLocationConfig implements LocationConfig {\n private _baseHref = undefined;\n private _hashPrefix = \"\";\n\n constructor(router?, private _isHtml5 = false) { }\n\n port(): number {\n if (location.port) {\n return Number(location.port);\n }\n\n return this.protocol() === 'https' ? 443 : 80;\n }\n\n protocol(): string {\n return location.protocol.replace(/:/g, '');\n }\n\n host(): string {\n return location.hostname;\n }\n\n html5Mode(): boolean {\n return this._isHtml5;\n }\n\n hashPrefix(): string;\n hashPrefix(newprefix?: string): string {\n return isDefined(newprefix) ? this._hashPrefix = newprefix : this._hashPrefix;\n };\n\n baseHref(href?: string): string {\n return isDefined(href) ? this._baseHref = href :\n isDefined(this._baseHref) ? this._baseHref : this.applyDocumentBaseHref();\n }\n\n applyDocumentBaseHref() {\n let baseTag: HTMLBaseElement = document.getElementsByTagName(\"base\")[0];\n return this._baseHref = baseTag ? baseTag.href.substr(location.origin.length) : \"\";\n }\n\n dispose() {}\n}\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { BrowserLocationConfig } from \"./browserLocationConfig\";\nimport { HashLocationService } from \"./hashLocationService\";\nimport { locationPluginFactory } from \"./utils\";\nimport { LocationPlugin, ServicesPlugin } from \"./interface\";\nimport { UIRouter } from \"../router\";\nimport { PushStateLocationService } from \"./pushStateLocationService\";\nimport { MemoryLocationService } from \"./memoryLocationService\";\nimport { MemoryLocationConfig } from \"./memoryLocationConfig\";\nimport { $injector } from \"./injector\";\nimport { $q } from \"./q\";\nimport { services } from \"../common/coreservices\";\n\nexport function servicesPlugin(router: UIRouter): ServicesPlugin {\n services.$injector = $injector;\n services.$q = $q;\n\n return { name: \"vanilla.services\", $q, $injector, dispose: () => null };\n}\n\n/** A `UIRouterPlugin` uses the browser hash to get/set the current location */\nexport const hashLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory('vanilla.hashBangLocation', false, HashLocationService, BrowserLocationConfig);\n\n/** A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis */\nexport const pushStateLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory(\"vanilla.pushStateLocation\", true, PushStateLocationService, BrowserLocationConfig);\n\n/** A `UIRouterPlugin` that gets/sets the current location from an in-memory object */\nexport const memoryLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory(\"vanilla.memoryLocation\", false, MemoryLocationService, MemoryLocationConfig);\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nexport * from \"./vanilla/index\";\n","/**\n * # Core classes and interfaces\n *\n * The classes and interfaces that are core to ui-router and do not belong\n * to a more specific subsystem (such as resolve).\n *\n * @coreapi\n * @preferred\n * @module core\n */ /** for typedoc */\n\n// Need to import or export at least one concrete something\nimport {noop} from \"./common/common\";\nimport {UIRouter} from \"./router\";\n\n/**\n * An interface for getting values from dependency injection.\n *\n * This is primarily used to get resolve values for a given token.\n * An instance of the `UIInjector` can be retrieved from the current transition using [[Transition.injector]].\n *\n * ---\n *\n * If no resolve is found for a token, then it will delegate to the native injector.\n * The native injector may be Angular 1 `$injector`, Angular 2 `Injector`, or a simple polyfill.\n *\n * In Angular 2, the native injector might be the root Injector,\n * or it might be a lazy loaded `NgModule` injector scoped to a lazy load state tree.\n */\nexport interface UIInjector {\n /**\n * Gets a value from the injector.\n *\n * For a given token, returns the value from the injector that matches the token.\n * If the token is for a resolve that has not yet been fetched, this throws an error.\n *\n * #### Example:\n * ```js\n * var myResolve = injector.get('myResolve');\n * ```\n *\n * #### ng1 Example:\n * ```js\n * // Fetch StateService\n * injector.get('$state').go('home');\n * ```\n *\n * #### ng2 Example:\n * ```js\n * import {StateService} from \"ui-router-ng2\";\n * // Fetch StateService\n * injector.get(StateService).go('home');\n * ```\n *\n * #### Typescript Example:\n * ```js\n * var stringArray = injector.get('myStringArray');\n * ```\n *\n * ### `NOWAIT` policy\n *\n * When using [[ResolvePolicy.async]] === `NOWAIT`, the value returned from `get()` is a promise for the result.\n * The promise is not automatically unwrapped.\n *\n * @param token the key for the value to get. May be a string, a class, or any arbitrary object.\n * @return the Dependency Injection value that matches the token\n */\n get(token: any): any;\n /** Gets a value as type `T` (generics parameter) */\n get(token: any): T;\n\n /**\n * Asynchronously gets a value from the injector\n *\n * For a given token, returns a promise for the value from the injector that matches the token.\n * If the token is for a resolve that has not yet been fetched, this triggers the resolve to load.\n *\n * #### Example:\n * ```js\n * return injector.getAsync('myResolve').then(value => {\n * if (value === 'declined') return false;\n * });\n * ```\n *\n * @param token the key for the value to get. May be a string or arbitrary object.\n * @return a Promise for the Dependency Injection value that matches the token\n */\n getAsync(token: any): Promise;\n /** Asynchronously gets a value as type `T` (generics parameter) */\n getAsync(token: any): Promise;\n\n /**\n * Gets a value from the native injector\n *\n * Returns a value from the native injector, bypassing anything in the [[ResolveContext]].\n *\n * Example:\n * ```js\n * let someThing = injector.getNative(SomeToken);\n * ```\n *\n * @param token the key for the value to get. May be a string or arbitrary object.\n * @return the Dependency Injection value that matches the token\n */\n getNative(token: any): any;\n getNative(token: any): T;\n}\n\n/** @internalapi */\nexport interface UIRouterPlugin extends Disposable {\n name: string;\n}\n\n/** @internalapi */\nexport abstract class UIRouterPluginBase implements UIRouterPlugin, Disposable {\n abstract name: string;\n dispose(router: UIRouter) { }\n}\n\n/** @internalapi */\nexport interface Disposable {\n /** Instructs the Disposable to clean up any resources */\n dispose(router?: UIRouter);\n}","/**\n * @coreapi\n * @module common\n */ /** */\n\nexport * from \"./common/index\";\nexport * from \"./params/index\";\nexport * from \"./path/index\";\nexport * from \"./resolve/index\";\nexport * from \"./state/index\";\nexport * from \"./transition/index\";\nexport * from \"./url/index\";\nexport * from \"./view/index\";\nexport * from \"./globals\";\n\nexport * from \"./router\";\nexport * from \"./vanilla\";\nexport * from \"./interface\";\n","/** @module ng1 */ /** */\nimport { ng as angular } from \"../angular\";\nimport {\n StateObject, pick, forEach, tail, extend,\n isArray, isInjectable, isDefined, isString, services, trace,\n ViewConfig, ViewService, ViewConfigFactory, PathNode, ResolveContext, Resolvable, IInjectable\n} from \"@uirouter/core\";\nimport { Ng1ViewDeclaration } from \"../interface\";\nimport { TemplateFactory } from \"../templateFactory\";\nimport IInjectorService = angular.auto.IInjectorService;\n\nexport function getNg1ViewConfigFactory(): ViewConfigFactory {\n let templateFactory: TemplateFactory = null;\n return (path, view) => {\n templateFactory = templateFactory || services.$injector.get(\"$templateFactory\");\n return [new Ng1ViewConfig(path, view, templateFactory)];\n };\n}\n\nconst hasAnyKey = (keys, obj) =>\n keys.reduce((acc, key) => acc || isDefined(obj[key]), false);\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `views`.\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * handles the `views` property with logic specific to @uirouter/angularjs (ng1).\n *\n * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object\n * and applies the state-level configuration to a view named `$default`.\n */\nexport function ng1ViewsBuilder(state: StateObject) {\n // Do not process root state\n if (!state.parent) return {};\n\n let tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'],\n ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'],\n compKeys = ['component', 'bindings', 'componentProvider'],\n nonCompKeys = tplKeys.concat(ctrlKeys),\n allViewKeys = compKeys.concat(nonCompKeys);\n\n // Do not allow a state to have both state-level props and also a `views: {}` property.\n // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state.\n // However, the `$default` approach should not be mixed with a separate `views: ` block.\n if (isDefined(state.views) && hasAnyKey(allViewKeys, state)) {\n throw new Error(`State '${state.name}' has a 'views' object. ` +\n `It cannot also have \"view properties\" at the state level. ` +\n `Move the following properties into a view (in the 'views' object): ` +\n ` ${allViewKeys.filter(key => isDefined(state[key])).join(\", \")}`);\n }\n\n let views: { [key: string]: Ng1ViewDeclaration } = {},\n viewsObject = state.views || { \"$default\": pick(state, allViewKeys) };\n\n forEach(viewsObject, function (config: Ng1ViewDeclaration, name: string) {\n // Account for views: { \"\": { template... } }\n name = name || \"$default\";\n // Account for views: { header: \"headerComponent\" }\n if (isString(config)) config = { component: config };\n\n // Make a shallow copy of the config object\n config = extend({}, config);\n\n // Do not allow a view to mix props for component-style view with props for template/controller-style view\n if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {\n throw new Error(`Cannot combine: ${compKeys.join(\"|\")} with: ${nonCompKeys.join(\"|\")} in stateview: '${name}@${state.name}'`);\n }\n\n config.resolveAs = config.resolveAs || '$resolve';\n config.$type = \"ng1\";\n config.$context = state;\n config.$name = name;\n\n let normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name);\n config.$uiViewName = normalized.uiViewName;\n config.$uiViewContextAnchor = normalized.uiViewContextAnchor;\n\n views[name] = config;\n });\n return views;\n}\n\nlet id = 0;\nexport class Ng1ViewConfig implements ViewConfig {\n $id = id++;\n loaded: boolean = false;\n controller: Function; // actually IInjectable|string\n template: string;\n component: string;\n locals: any; // TODO: delete me\n\n constructor(public path: PathNode[], public viewDecl: Ng1ViewDeclaration, public factory: TemplateFactory) { }\n\n load() {\n let $q = services.$q;\n let context = new ResolveContext(this.path);\n let params = this.path.reduce((acc, node) => extend(acc, node.paramValues), {});\n\n let promises: any = {\n template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)),\n controller: $q.when(this.getController(context))\n };\n\n return $q.all(promises).then((results) => {\n trace.traceViewServiceEvent(\"Loaded\", this);\n this.controller = results.controller;\n extend(this, results.template); // Either { template: \"tpl\" } or { component: \"cmpName\" }\n return this;\n });\n }\n\n getTemplate = (uiView, context: ResolveContext) =>\n this.component ? this.factory.makeComponentTemplate(uiView, context, this.component, this.viewDecl.bindings) : this.template;\n\n /**\n * Gets the controller for a view configuration.\n *\n * @returns {Function|Promise.} Returns a controller, or a promise that resolves to a controller.\n */\n getController(context: ResolveContext): (IInjectable|string|Promise) {\n let provider = this.viewDecl.controllerProvider;\n if (!isInjectable(provider)) return this.viewDecl.controller;\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n }\n}\n","/** @module view */\n/** for typedoc */\nimport { ng as angular } from \"./angular\";\nimport { IAugmentedJQuery } from \"angular\";\nimport {\n isArray, isDefined, isFunction, isObject, services, Obj, IInjectable, tail, kebobString, unnestR, ResolveContext,\n Resolvable, RawParams\n} from \"@uirouter/core\";\nimport { Ng1ViewDeclaration, TemplateFactoryProvider } from \"./interface\";\n\n/**\n * Service which manages loading of templates from a ViewConfig.\n */\nexport class TemplateFactory implements TemplateFactoryProvider {\n /** @hidden */ private _useHttp = angular.version.minor < 3;\n /** @hidden */ private $templateRequest;\n /** @hidden */ private $templateCache;\n /** @hidden */ private $http;\n\n /** @hidden */ $get = ['$http', '$templateCache', '$injector', ($http, $templateCache, $injector) => {\n this.$templateRequest = $injector.has && $injector.has('$templateRequest') && $injector.get('$templateRequest');\n this.$http = $http;\n this.$templateCache = $templateCache;\n return this;\n }];\n\n /** @hidden */\n useHttpService(value: boolean) {\n this._useHttp = value;\n };\n\n /**\n * Creates a template from a configuration object.\n *\n * @param config Configuration object for which to load a template.\n * The following properties are search in the specified order, and the first one\n * that is defined is used to create the template:\n *\n * @param params Parameters to pass to the template function.\n * @param context The resolve context associated with the template's view\n *\n * @return {string|object} The template html as a string, or a promise for\n * that string,or `null` if no template is configured.\n */\n fromConfig(config: Ng1ViewDeclaration, params: any, context: ResolveContext): Promise<{ template?: string, component?: string }> {\n const defaultTemplate = \"\";\n\n const asTemplate = (result) => services.$q.when(result).then(str => ({ template: str }));\n const asComponent = (result) => services.$q.when(result).then(str => ({ component: str }));\n\n return (\n isDefined(config.template) ? asTemplate(this.fromString(config.template, params)) :\n isDefined(config.templateUrl) ? asTemplate(this.fromUrl(config.templateUrl, params)) :\n isDefined(config.templateProvider) ? asTemplate(this.fromProvider(config.templateProvider, params, context)) :\n isDefined(config.component) ? asComponent(config.component) :\n isDefined(config.componentProvider) ? asComponent(this.fromComponentProvider(config.componentProvider, params, context)) :\n asTemplate(defaultTemplate)\n );\n };\n\n /**\n * Creates a template from a string or a function returning a string.\n *\n * @param template html template as a string or function that returns an html template as a string.\n * @param params Parameters to pass to the template function.\n *\n * @return {string|object} The template html as a string, or a promise for that\n * string.\n */\n fromString(template: (string | Function), params?: RawParams) {\n return isFunction(template) ? ( template)(params) : template;\n };\n\n /**\n * Loads a template from the a URL via `$http` and `$templateCache`.\n *\n * @param {string|Function} url url of the template to load, or a function\n * that returns a url.\n * @param {Object} params Parameters to pass to the url function.\n * @return {string|Promise.} The template html as a string, or a promise\n * for that string.\n */\n fromUrl(url: (string | Function), params: any) {\n if (isFunction(url)) url = ( url)(params);\n if (url == null) return null;\n\n if (this._useHttp) {\n return this.$http.get(url, { cache: this.$templateCache, headers: { Accept: 'text/html' } })\n .then(function (response) {\n return response.data;\n });\n }\n\n return this.$templateRequest(url);\n };\n\n /**\n * Creates a template by invoking an injectable provider function.\n *\n * @param provider Function to invoke via `locals`\n * @param {Function} injectFn a function used to invoke the template provider\n * @return {string|Promise.} The template html as a string, or a promise\n * for that string.\n */\n fromProvider(provider: IInjectable, params: any, context: ResolveContext) {\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n };\n\n /**\n * Creates a component's template by invoking an injectable provider function.\n *\n * @param provider Function to invoke via `locals`\n * @param {Function} injectFn a function used to invoke the template provider\n * @return {string} The template html as a string: \"\".\n */\n fromComponentProvider(provider: IInjectable, params: any, context: ResolveContext) {\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n };\n\n /**\n * Creates a template from a component's name\n *\n * This implements route-to-component.\n * It works by retrieving the component (directive) metadata from the injector.\n * It analyses the component's bindings, then constructs a template that instantiates the component.\n * The template wires input and output bindings to resolves or from the parent component.\n *\n * @param uiView {object} The parent ui-view (for binding outputs to callbacks)\n * @param context The ResolveContext (for binding outputs to callbacks returned from resolves)\n * @param component {string} Component's name in camel case.\n * @param bindings An object defining the component's bindings: {foo: '<'}\n * @return {string} The template as a string: \"\".\n */\n makeComponentTemplate(uiView: IAugmentedJQuery, context: ResolveContext, component: string, bindings?: any) {\n bindings = bindings || {};\n\n // Bind once prefix\n const prefix = angular.version.minor >= 3 ? \"::\" : \"\";\n // Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-`\n const kebob = (camelCase: string) => {\n const kebobed = kebobString(camelCase);\n return /^(x|data)-/.exec(kebobed) ? `x-${kebobed}` : kebobed;\n };\n\n\n const attributeTpl = (input: BindingTuple) => {\n let { name, type } = input;\n let attrName = kebob(name);\n // If the ui-view has an attribute which matches a binding on the routed component\n // then pass that attribute through to the routed component template.\n // Prefer ui-view wired mappings to resolve data, unless the resolve was explicitly bound using `bindings:`\n if (uiView.attr(attrName) && !bindings[name])\n return `${attrName}='${uiView.attr(attrName)}'`;\n\n let resolveName = bindings[name] || name;\n // Pre-evaluate the expression for \"@\" bindings by enclosing in {{ }}\n // some-attr=\"{{ ::$resolve.someResolveName }}\"\n if (type === '@')\n return `${attrName}='{{${prefix}$resolve.${resolveName}}}'`;\n\n // Wire \"&\" callbacks to resolves that return a callback function\n // Get the result of the resolve (should be a function) and annotate it to get its arguments.\n // some-attr=\"$resolve.someResolveResultName(foo, bar)\"\n if (type === '&') {\n let res = context.getResolvable(resolveName);\n let fn = res && res.data;\n let args = fn && services.$injector.annotate(fn) || [];\n // account for array style injection, i.e., ['foo', function(foo) {}]\n let arrayIdxStr = isArray(fn) ? `[${fn.length - 1}]` : '';\n return `${attrName}='$resolve.${resolveName}${arrayIdxStr}(${args.join(\",\")})'`;\n }\n\n // some-attr=\"::$resolve.someResolveName\"\n return `${attrName}='${prefix}$resolve.${resolveName}'`;\n };\n\n let attrs = getComponentBindings(component).map(attributeTpl).join(\" \");\n let kebobName = kebob(component);\n return `<${kebobName} ${attrs}>`;\n };\n}\n\n// Gets all the directive(s)' inputs ('@', '=', and '<') and outputs ('&')\nfunction getComponentBindings(name: string) {\n let cmpDefs = services.$injector.get(name + \"Directive\"); // could be multiple\n if (!cmpDefs || !cmpDefs.length) throw new Error(`Unable to find component named '${name}'`);\n return cmpDefs.map(getBindings).reduce(unnestR, []);\n}\n\n// Given a directive definition, find its object input attributes\n// Use different properties, depending on the type of directive (component, bindToController, normal)\nconst getBindings = (def: any) => {\n if (isObject(def.bindToController)) return scopeBindings(def.bindToController);\n return scopeBindings(def.scope);\n};\n\ninterface BindingTuple {\n name: string;\n type: string;\n}\n\n// for ng 1.2 style, process the scope: { input: \"=foo\" }\n// for ng 1.3 through ng 1.5, process the component's bindToController: { input: \"=foo\" } object\nconst scopeBindings = (bindingsObj: Obj) => Object.keys(bindingsObj || {})\n // [ 'input', [ '=foo', '=', 'foo' ] ]\n .map(key => [key, /^([=<@&])[?]?(.*)/.exec(bindingsObj[key])])\n // skip malformed values\n .filter(tuple => isDefined(tuple) && isArray(tuple[1]))\n // { name: ('foo' || 'input'), type: '=' }\n .map(tuple => ({ name: tuple[1][2] || tuple[0], type: tuple[1][1] } as BindingTuple));\n\n","/** @module ng1 */ /** for typedoc */\nimport {\n val, isObject, createProxyFunctions, BuilderFunction, StateRegistry, StateService, OnInvalidCallback\n} from \"@uirouter/core\";\nimport { Ng1StateDeclaration } from \"./interface\";\n\n/**\n * The Angular 1 `StateProvider`\n *\n * The `$stateProvider` works similar to Angular's v1 router, but it focuses purely\n * on state.\n *\n * A state corresponds to a \"place\" in the application in terms of the overall UI and\n * navigation. A state describes (via the controller / template / view properties) what\n * the UI looks like and does at that place.\n *\n * States often have things in common, and the primary way of factoring out these\n * commonalities in this model is via the state hierarchy, i.e. parent/child states aka\n * nested states.\n *\n * The `$stateProvider` provides interfaces to declare these states for your app.\n */\nexport class StateProvider {\n constructor(private stateRegistry: StateRegistry, private stateService: StateService) {\n createProxyFunctions(val(StateProvider.prototype), this, val(this));\n }\n\n /**\n * Decorates states when they are registered\n *\n * Allows you to extend (carefully) or override (at your own peril) the\n * `stateBuilder` object used internally by [[StateRegistry]].\n * This can be used to add custom functionality to ui-router,\n * for example inferring templateUrl based on the state name.\n *\n * When passing only a name, it returns the current (original or decorated) builder\n * function that matches `name`.\n *\n * The builder functions that can be decorated are listed below. Though not all\n * necessarily have a good use case for decoration, that is up to you to decide.\n *\n * In addition, users can attach custom decorators, which will generate new\n * properties within the state's internal definition. There is currently no clear\n * use-case for this beyond accessing internal states (i.e. $state.$current),\n * however, expect this to become increasingly relevant as we introduce additional\n * meta-programming features.\n *\n * **Warning**: Decorators should not be interdependent because the order of\n * execution of the builder functions in non-deterministic. Builder functions\n * should only be dependent on the state definition object and super function.\n *\n *\n * Existing builder functions and current return values:\n *\n * - **parent** `{object}` - returns the parent state object.\n * - **data** `{object}` - returns state data, including any inherited data that is not\n * overridden by own values (if any).\n * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}\n * or `null`.\n * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is\n * navigable).\n * - **params** `{object}` - returns an array of state params that are ensured to\n * be a super-set of parent's params.\n * - **views** `{object}` - returns a views object where each key is an absolute view\n * name (i.e. \"viewName@stateName\") and each value is the config object\n * (template, controller) for the view. Even when you don't use the views object\n * explicitly on a state config, one is still created for you internally.\n * So by decorating this builder function you have access to decorating template\n * and controller properties.\n * - **ownParams** `{object}` - returns an array of params that belong to the state,\n * not including any params defined by ancestor states.\n * - **path** `{string}` - returns the full path from the root down to this state.\n * Needed for state activation.\n * - **includes** `{object}` - returns an object that includes every state that\n * would pass a `$state.includes()` test.\n *\n * #### Example:\n * Override the internal 'views' builder with a function that takes the state\n * definition, and a reference to the internal function being overridden:\n * ```js\n * $stateProvider.decorator('views', function (state, parent) {\n * let result = {},\n * views = parent(state);\n *\n * angular.forEach(views, function (config, name) {\n * let autoName = (state.name + '.' + name).replace('.', '/');\n * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';\n * result[name] = config;\n * });\n * return result;\n * });\n *\n * $stateProvider.state('home', {\n * views: {\n * 'contact.list': { controller: 'ListController' },\n * 'contact.item': { controller: 'ItemController' }\n * }\n * });\n * ```\n *\n *\n * ```js\n * // Auto-populates list and item views with /partials/home/contact/list.html,\n * // and /partials/home/contact/item.html, respectively.\n * $state.go('home');\n * ```\n *\n * @param {string} name The name of the builder function to decorate.\n * @param {object} func A function that is responsible for decorating the original\n * builder function. The function receives two parameters:\n *\n * - `{object}` - state - The state config object.\n * - `{object}` - super - The original builder function.\n *\n * @return {object} $stateProvider - $stateProvider instance\n */\n decorator(name: string, func: BuilderFunction) {\n return this.stateRegistry.decorator(name, func) || this;\n }\n\n /**\n * Registers a state\n *\n * ### This is a passthrough to [[StateRegistry.register]].\n *\n * Registers a state configuration under a given state name.\n * The stateConfig object has the following acceptable properties.\n *\n *
    \n *\n * - **`template`** - {string|function=} - html template as a string or a function that returns\n * an html template as a string which should be used by the uiView directives. This property\n * takes precedence over templateUrl.\n *\n * If `template` is a function, it will be called with the following parameters:\n *\n * - {array.<object>} - state parameters extracted from the current $location.path() by\n * applying the current state\n *\n * \n *\n * - **`templateUrl`** - {string|function=} - path or function that returns a path to an html\n * template that should be used by uiView.\n *\n * If `templateUrl` is a function, it will be called with the following parameters:\n *\n * - {array.<object>} - state parameters extracted from the current $location.path() by\n * applying the current state\n *\n * \n *\n * - **`templateProvider`** - {function=} - Provider function that returns HTML content\n * string.\n *\n * \n *\n * - **`controller`** - {string|function=} - Controller fn that should be associated with newly\n * related scope or the name of a registered controller if passed as a string.\n *\n * \n *\n * - **`controllerProvider`** - {function=} - Injectable provider function that returns\n * the actual controller or string.\n *\n * \n *\n * - **`controllerAs`** – {string=} – A controller alias name. If present the controller will be\n * published to scope under the controllerAs name.\n *\n * \n *\n * - **`resolve`** - {object.<string, function>=} - An optional map of dependencies which\n * should be injected into the controller. If any of these dependencies are promises,\n * the router will wait for them all to be resolved or one to be rejected before the\n * controller is instantiated. If all the promises are resolved successfully, the values\n * of the resolved promises are injected and $stateChangeSuccess event is fired. If any\n * of the promises are rejected the $stateChangeError event is fired. The map object is:\n *\n * - key - {string}: name of dependency to be injected into controller\n * - factory - {string|function}: If string then it is alias for service. Otherwise if function,\n * it is injected and return value it treated as dependency. If result is a promise, it is\n * resolved before its value is injected into controller.\n *\n * \n *\n * - **`url`** - {string=} - A url with optional parameters. When a state is navigated or\n * transitioned to, the `$stateParams` service will be populated with any\n * parameters that were passed.\n *\n * \n *\n * - **`params`** - {object=} - An array of parameter names or regular expressions. Only\n * use this within a state if you are not using url. Otherwise you can specify your\n * parameters within the url. When a state is navigated or transitioned to, the\n * $stateParams service will be populated with any parameters that were passed.\n *\n * \n *\n * - **`views`** - {object=} - Use the views property to set up multiple views or to target views\n * manually/explicitly.\n *\n * \n *\n * - **`abstract`** - {boolean=} - An abstract state will never be directly activated,\n * but can provide inherited properties to its common children states.\n *\n * \n *\n * - **`onEnter`** - {object=} - Callback function for when a state is entered. Good way\n * to trigger an action or dispatch an event, such as opening a dialog.\n * If minifying your scripts, make sure to use the `['injection1', 'injection2', function(injection1, injection2){}]` syntax.\n *\n * \n *\n * - **`onExit`** - {object=} - Callback function for when a state is exited. Good way to\n * trigger an action or dispatch an event, such as opening a dialog.\n * If minifying your scripts, make sure to use the `['injection1', 'injection2', function(injection1, injection2){}]` syntax.\n *\n * \n *\n * - **`reloadOnSearch = true`** - {boolean=} - If `false`, will not retrigger the same state\n * just because a search/query parameter has changed (via $location.search() or $location.hash()).\n * Useful for when you'd like to modify $location.search() without triggering a reload.\n *\n * \n *\n * - **`data`** - {object=} - Arbitrary data object, useful for custom configuration.\n *\n * #### Example:\n * Some state name examples\n * ```js\n * // stateName can be a single top-level name (must be unique).\n * $stateProvider.state(\"home\", {});\n *\n * // Or it can be a nested state name. This state is a child of the\n * // above \"home\" state.\n * $stateProvider.state(\"home.newest\", {});\n *\n * // Nest states as deeply as needed.\n * $stateProvider.state(\"home.newest.abc.xyz.inception\", {});\n *\n * // state() returns $stateProvider, so you can chain state declarations.\n * $stateProvider\n * .state(\"home\", {})\n * .state(\"about\", {})\n * .state(\"contacts\", {});\n * ```\n *\n * @param {string} name A unique state name, e.g. \"home\", \"about\", \"contacts\".\n * To create a parent/child state use a dot, e.g. \"about.sales\", \"home.newest\".\n * @param {object} definition State configuration object.\n */\n state(name: string, definition: Ng1StateDeclaration): StateProvider;\n state(definition: Ng1StateDeclaration): StateProvider;\n state(name: any, definition?: any) {\n if (isObject(name)) {\n definition = name;\n } else {\n definition.name = name;\n }\n this.stateRegistry.register(definition);\n return this;\n }\n\n /**\n * Registers an invalid state handler\n *\n * This is a passthrough to [[StateService.onInvalid]] for ng1.\n */\n\n onInvalid(callback: OnInvalidCallback): Function {\n return this.stateService.onInvalid(callback);\n }\n}\n","/** @module ng1 */ /** */\nimport {\n StateObject, TransitionStateHookFn, HookResult, Transition, services, ResolveContext, extend, BuilderFunction\n} from \"@uirouter/core\";\nimport { getLocals } from \"../services\";\nimport { Ng1StateDeclaration } from '../interface';\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`,\n * `onRetain` callback hooks on a [[Ng1StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * ensures that those hooks are injectable for @uirouter/angularjs (ng1).\n */\nexport const getStateHookBuilder = (hookName: \"onEnter\"|\"onExit\"|\"onRetain\") =>\nfunction stateHookBuilder(state: StateObject, parentFn: BuilderFunction): TransitionStateHookFn {\n let hook = state[hookName];\n let pathname = hookName === 'onExit' ? 'from' : 'to';\n\n function decoratedNg1Hook(trans: Transition, state: Ng1StateDeclaration): HookResult {\n let resolveContext = new ResolveContext(trans.treeChanges(pathname));\n let locals = extend(getLocals(resolveContext), { $state$: state, $transition$: trans });\n return services.$injector.invoke(hook, this, locals);\n }\n\n return hook ? decoratedNg1Hook : undefined;\n};\n","/**\n * @internalapi\n * @module ng1\n */ /** */\nimport { LocationConfig, LocationServices, UIRouter, ParamType } from \"@uirouter/core\";\nimport { val, createProxyFunctions, removeFrom, isObject } from \"@uirouter/core\";\nimport { ILocationService, ILocationProvider } from \"angular\";\n\n/**\n * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service\n */\nexport class Ng1LocationServices implements LocationConfig, LocationServices {\n private $locationProvider: ILocationProvider;\n private $location: ILocationService;\n private $sniffer;\n\n path;\n search;\n hash;\n hashPrefix;\n port;\n protocol;\n host;\n baseHref;\n\n // .onChange() registry\n private _urlListeners: Function[] = [];\n\n dispose() { }\n\n constructor($locationProvider: ILocationProvider) {\n this.$locationProvider = $locationProvider;\n let _lp = val($locationProvider);\n createProxyFunctions(_lp, this, _lp, ['hashPrefix']);\n }\n\n onChange(callback: Function) {\n this._urlListeners.push(callback);\n return () => removeFrom(this._urlListeners)(callback);\n }\n\n html5Mode() {\n let html5Mode: any = this.$locationProvider.html5Mode();\n html5Mode = isObject(html5Mode) ? html5Mode.enabled : html5Mode;\n return html5Mode && this.$sniffer.history;\n }\n\n url(newUrl?: string, replace = false, state?) {\n if (newUrl) this.$location.url(newUrl);\n if (replace) this.$location.replace();\n if (state) this.$location.state(state);\n return this.$location.url();\n }\n\n _runtimeServices($rootScope, $location: ILocationService, $sniffer, $browser) {\n this.$location = $location;\n this.$sniffer = $sniffer;\n\n // Bind $locationChangeSuccess to the listeners registered in LocationService.onChange\n $rootScope.$on(\"$locationChangeSuccess\", evt => this._urlListeners.forEach(fn => fn(evt)));\n let _loc = val($location);\n let _browser = val($browser);\n\n // Bind these LocationService functions to $location\n createProxyFunctions(_loc, this, _loc, [\"replace\", \"path\", \"search\", \"hash\"]);\n // Bind these LocationConfig functions to $location\n createProxyFunctions(_loc, this, _loc, ['port', 'protocol', 'host']);\n // Bind these LocationConfig functions to $browser\n createProxyFunctions(_browser, this, _browser, ['baseHref']);\n }\n\n /**\n * Applys ng1-specific path parameter encoding\n *\n * The Angular 1 `$location` service is a bit weird.\n * It doesn't allow slashes to be encoded/decoded bi-directionally.\n *\n * See the writeup at https://github.com/angular-ui/ui-router/issues/2598\n *\n * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F\n *\n * @param router\n */\n static monkeyPatchPathParameterType(router: UIRouter) {\n let pathType: ParamType = router.urlMatcherFactory.type('path');\n\n pathType.encode = (val: any) =>\n val != null ? val.toString().replace(/(~|\\/)/g, m => ({ '~': '~~', '/': '~2F' }[m])) : val;\n\n pathType.decode = (val: string) =>\n val != null ? val.toString().replace(/(~~|~2F)/g, m => ({ '~~': '~', '~2F': '/' }[m])) : val;\n\n }\n}\n","/** @module url */ /** */\nimport {\n UIRouter, UrlRouter, LocationServices, $InjectorLike, BaseUrlRule, UrlRuleHandlerFn, UrlMatcher,\n IInjectable\n} from \"@uirouter/core\";\nimport { services, isString, isFunction, isArray, identity } from \"@uirouter/core\";\n\nexport interface RawNg1RuleFunction {\n ($injector: $InjectorLike, $location: LocationServices): string|void;\n}\n\n/**\n * Manages rules for client-side URL\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class manages the router rules for what to do when the URL changes.\n *\n * This provider remains for backwards compatibility.\n *\n * @deprecated\n */\nexport class UrlRouterProvider {\n /** @hidden */ _router: UIRouter;\n /** @hidden */ _urlRouter: UrlRouter;\n\n /** @hidden */\n constructor(router: UIRouter) {\n this._router = router;\n this._urlRouter = router.urlRouter;\n }\n\n /** @hidden */\n $get() {\n let urlRouter = this._urlRouter;\n urlRouter.update(true);\n if (!urlRouter.interceptDeferred) urlRouter.listen();\n return urlRouter;\n }\n\n /**\n * Registers a url handler function.\n *\n * Registers a low level url handler (a `rule`).\n * A rule detects specific URL patterns and returns a redirect, or performs some action.\n *\n * If a rule returns a string, the URL is replaced with the string, and all rules are fired again.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // Here's an example of how you might allow case insensitive urls\n * $urlRouterProvider.rule(function ($injector, $location) {\n * var path = $location.path(),\n * normalized = path.toLowerCase();\n *\n * if (path !== normalized) {\n * return normalized;\n * }\n * });\n * });\n * ```\n *\n * @param ruleFn\n * Handler function that takes `$injector` and `$location` services as arguments.\n * You can use them to detect a url and return a different url as a string.\n *\n * @return [[UrlRouterProvider]] (`this`)\n */\n rule(ruleFn: RawNg1RuleFunction): UrlRouterProvider {\n if (!isFunction(ruleFn)) throw new Error(\"'rule' must be a function\");\n\n const match = () =>\n ruleFn(services.$injector, this._router.locationService);\n\n let rule = new BaseUrlRule(match, identity);\n this._urlRouter.rule(rule);\n return this;\n };\n\n /**\n * Defines the path or behavior to use when no url can be matched.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // if the path doesn't match any of the urls you configured\n * // otherwise will take care of routing the user to the\n * // specified url\n * $urlRouterProvider.otherwise('/index');\n *\n * // Example of using function rule as param\n * $urlRouterProvider.otherwise(function ($injector, $location) {\n * return '/a/valid/url';\n * });\n * });\n * ```\n *\n * @param rule\n * The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`.\n * The function version is passed two params: `$injector` and `$location` services, and should return a url string.\n *\n * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n */\n otherwise(rule: string | RawNg1RuleFunction): UrlRouterProvider {\n let urlRouter = this._urlRouter;\n\n if (isString(rule)) {\n urlRouter.otherwise(rule);\n } else if (isFunction(rule)) {\n urlRouter.otherwise(() => rule(services.$injector, this._router.locationService));\n } else {\n throw new Error(\"'rule' must be a string or function\");\n }\n\n return this;\n };\n\n /**\n * Registers a handler for a given url matching.\n *\n * If the handler is a string, it is\n * treated as a redirect, and is interpolated according to the syntax of match\n * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).\n *\n * If the handler is a function, it is injectable.\n * It gets invoked if `$location` matches.\n * You have the option of inject the match object as `$match`.\n *\n * The handler can return\n *\n * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n * will continue trying to find another one that matches.\n * - **string** which is treated as a redirect and passed to `$location.url()`\n * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n * if ($state.$current.navigable !== state ||\n * !equalForKeys($match, $stateParams) {\n * $state.transitionTo(state, $match, false);\n * }\n * });\n * });\n * ```\n *\n * @param what A pattern string to match, compiled as a [[UrlMatcher]].\n * @param handler The path (or function that returns a path) that you want to redirect your user to.\n * @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]]\n *\n * Note: the handler may also invoke arbitrary code, such as `$state.go()`\n */\n when(what: (RegExp|UrlMatcher|string), handler: string|IInjectable) {\n if (isArray(handler) || isFunction(handler)) {\n handler = UrlRouterProvider.injectableHandler(this._router, handler);\n }\n\n this._urlRouter.when(what, handler as any);\n return this;\n };\n\n static injectableHandler(router: UIRouter, handler): UrlRuleHandlerFn {\n return match =>\n services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params });\n }\n\n /**\n * Disables monitoring of the URL.\n *\n * Call this method before UI-Router has bootstrapped.\n * It will stop UI-Router from performing the initial url sync.\n *\n * This can be useful to perform some asynchronous initialization before the router starts.\n * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // Prevent $urlRouter from automatically intercepting URL changes;\n * $urlRouterProvider.deferIntercept();\n * })\n *\n * app.run(function (MyService, $urlRouter, $http) {\n * $http.get(\"/stuff\").then(function(resp) {\n * MyService.doStuff(resp.data);\n * $urlRouter.listen();\n * $urlRouter.sync();\n * });\n * });\n * ```\n *\n * @param defer Indicates whether to defer location change interception.\n * Passing no parameter is equivalent to `true`.\n */\n deferIntercept(defer?: boolean) {\n this._urlRouter.deferIntercept(defer);\n };\n}\n","/**\n * # Angular 1 types\n *\n * UI-Router core provides various Typescript types which you can use for code completion and validating parameter values, etc.\n * The customizations to the core types for Angular UI-Router are documented here.\n *\n * The optional [[$resolve]] service is also documented here.\n *\n * @module ng1\n * @preferred\n */\n/** for typedoc */\nimport { ng as angular } from \"./angular\";\nimport {\n IRootScopeService, IQService, ILocationService, ILocationProvider, IHttpService, ITemplateCacheService\n} from \"angular\";\nimport {\n services, applyPairs, isString, trace, extend, UIRouter, StateService, UrlRouter, UrlMatcherFactory, ResolveContext,\n unnestR, TypedMap\n} from \"@uirouter/core\";\nimport { ng1ViewsBuilder, getNg1ViewConfigFactory } from \"./statebuilders/views\";\nimport { TemplateFactory } from \"./templateFactory\";\nimport { StateProvider } from \"./stateProvider\";\nimport { getStateHookBuilder } from \"./statebuilders/onEnterExitRetain\";\nimport { Ng1LocationServices } from \"./locationServices\";\nimport { UrlRouterProvider } from \"./urlRouterProvider\";\nimport IInjectorService = angular.auto.IInjectorService; // tslint:disable-line\n\nangular.module(\"ui.router.angular1\", []);\nlet mod_init = angular.module('ui.router.init', []);\nlet mod_util = angular.module('ui.router.util', ['ng', 'ui.router.init']);\nlet mod_rtr = angular.module('ui.router.router', ['ui.router.util']);\nlet mod_state = angular.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']);\nlet mod_main = angular.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']);\nlet mod_cmpt = angular.module('ui.router.compat', ['ui.router']); // tslint:disable-line\n\ndeclare module '@uirouter/core/lib/router' {\n interface UIRouter {\n /** @hidden */\n stateProvider: StateProvider;\n /** @hidden */\n urlRouterProvider: UrlRouterProvider;\n }\n}\n\nlet router: UIRouter = null;\n\n$uiRouter.$inject = ['$locationProvider'];\n/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */\nfunction $uiRouter($locationProvider: ILocationProvider) {\n\n // Create a new instance of the Router when the $uiRouterProvider is initialized\n router = this.router = new UIRouter();\n router.stateProvider = new StateProvider(router.stateRegistry, router.stateService);\n\n // Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties\n router.stateRegistry.decorator(\"views\", ng1ViewsBuilder);\n router.stateRegistry.decorator(\"onExit\", getStateHookBuilder(\"onExit\"));\n router.stateRegistry.decorator(\"onRetain\", getStateHookBuilder(\"onRetain\"));\n router.stateRegistry.decorator(\"onEnter\", getStateHookBuilder(\"onEnter\"));\n\n router.viewService._pluginapi._viewConfigFactory('ng1', getNg1ViewConfigFactory());\n\n let ng1LocationService = router.locationService = router.locationConfig = new Ng1LocationServices($locationProvider);\n\n Ng1LocationServices.monkeyPatchPathParameterType(router);\n\n // backwards compat: also expose router instance as $uiRouterProvider.router\n router['router'] = router;\n router['$get'] = $get;\n $get.$inject = ['$location', '$browser', '$sniffer', '$rootScope', '$http', '$templateCache'];\n function $get($location: ILocationService, $browser: any, $sniffer: any, $rootScope: ng.IScope, $http: IHttpService, $templateCache: ITemplateCacheService) {\n ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser);\n delete router['router'];\n delete router['$get'];\n return router;\n }\n return router;\n}\n\nconst getProviderFor = (serviceName) => [ '$uiRouterProvider', ($urp) => {\n let service = $urp.router[serviceName];\n service[\"$get\"] = () => service;\n return service;\n}];\n\n// This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime)\nrunBlock.$inject = ['$injector', '$q', '$uiRouter'];\nfunction runBlock($injector: IInjectorService, $q: IQService, $uiRouter: UIRouter) {\n services.$injector = $injector;\n services.$q = $q;\n\n // The $injector is now available.\n // Find any resolvables that had dependency annotation deferred\n $uiRouter.stateRegistry.get()\n .map(x => x.$$state().resolvables)\n .reduce(unnestR, [])\n .filter(x => x.deps === \"deferred\")\n .forEach(resolvable => resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi));\n}\n\n// $urlRouter service and $urlRouterProvider\nconst getUrlRouterProvider = (uiRouter: UIRouter) =>\n uiRouter.urlRouterProvider = new UrlRouterProvider(uiRouter);\n\n// $state service and $stateProvider\n// $urlRouter service and $urlRouterProvider\nconst getStateProvider = () =>\n extend(router.stateProvider, { $get: () => router.stateService });\n\nwatchDigests.$inject = ['$rootScope'];\nexport function watchDigests($rootScope: IRootScopeService) {\n $rootScope.$watch(function() { trace.approximateDigests++; });\n}\n\nmod_init .provider(\"$uiRouter\", $uiRouter);\nmod_rtr .provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]);\nmod_util .provider('$urlService', getProviderFor('urlService'));\nmod_util .provider('$urlMatcherFactory', ['$uiRouterProvider', () => router.urlMatcherFactory]);\nmod_util .provider('$templateFactory', () => new TemplateFactory());\nmod_state.provider('$stateRegistry', getProviderFor('stateRegistry'));\nmod_state.provider('$uiRouterGlobals', getProviderFor('globals'));\nmod_state.provider('$transitions', getProviderFor('transitionService'));\nmod_state.provider('$state', ['$uiRouterProvider', getStateProvider]);\n\nmod_state.factory ('$stateParams', ['$uiRouter', ($uiRouter: UIRouter) => $uiRouter.globals.params]);\nmod_main .factory ('$view', () => router.viewService);\nmod_main .service (\"$trace\", () => trace);\n\nmod_main .run (watchDigests);\nmod_util .run (['$urlMatcherFactory', function ($urlMatcherFactory: UrlMatcherFactory) { }]);\nmod_state.run (['$state', function ($state: StateService) { }]);\nmod_rtr .run (['$urlRouter', function ($urlRouter: UrlRouter) { }]);\nmod_init .run (runBlock);\n\n/** @hidden TODO: find a place to move this */\nexport const getLocals = (ctx: ResolveContext): TypedMap => {\n let tokens = ctx.getTokens().filter(isString);\n\n let tuples = tokens .map(key => {\n let resolvable = ctx.getResolvable(key);\n let waitPolicy = ctx.getPolicy(resolvable).async;\n return [ key, waitPolicy === 'NOWAIT' ? resolvable.promise : resolvable.data ];\n });\n\n return tuples.reduce(applyPairs, {});\n};\n\n","/**\n * # Angular 1 injectable services\n *\n * This is a list of the objects which can be injected using angular's injector.\n *\n * There are three different kind of injectable objects:\n *\n * ## **Provider** objects\n * #### injectable into a `.config()` block during configtime\n *\n * - [[$uiRouterProvider]]: The UI-Router instance\n * - [[$stateProvider]]: State registration\n * - [[$transitionsProvider]]: Transition hooks\n * - [[$urlServiceProvider]]: All URL related public APIs\n *\n * - [[$uiViewScrollProvider]]: Disable ui-router view scrolling\n * - [[$urlRouterProvider]]: (deprecated) Url matching rules\n * - [[$urlMatcherFactoryProvider]]: (deprecated) Url parsing config\n *\n * ## **Service** objects\n * #### injectable globally during runtime\n *\n * - [[$uiRouter]]: The UI-Router instance\n * - [[$trace]]: Enable transition trace/debug\n * - [[$transitions]]: Transition hooks\n * - [[$state]]: Imperative state related APIs\n * - [[$stateRegistry]]: State registration\n * - [[$urlService]]: All URL related public APIs\n * - [[$uiRouterGlobals]]: Global variables\n * - [[$uiViewScroll]]: Scroll an element into view\n *\n * - [[$stateParams]]: (deprecated) Global state param values\n * - [[$urlRouter]]: (deprecated) URL synchronization\n * - [[$urlMatcherFactory]]: (deprecated) URL parsing config\n *\n * ## **Per-Transition** objects\n *\n * - These kind of objects are injectable into:\n * - Resolves ([[Ng1StateDeclaration.resolve]]),\n * - Transition Hooks ([[TransitionService.onStart]], etc),\n * - Routed Controllers ([[Ng1ViewDeclaration.controller]])\n *\n * #### Different instances are injected based on the [[Transition]]\n *\n * - [[$transition$]]: The current Transition object\n * - [[$stateParams]]: State param values for pending Transition (deprecated)\n * - Any resolve data defined using [[Ng1StateDeclaration.resolve]]\n *\n * @ng1api\n * @preferred\n * @module injectables\n */ /** */\n\nimport { StateProvider } from \"./stateProvider\";\nimport {\n StateService, TransitionService, Transition, UrlRouter, UrlMatcherFactory,\n StateParams, StateRegistry, UIRouterGlobals, UIRouter, Trace, UrlService\n} from \"@uirouter/core\";\nimport { UIViewScrollProvider } from \"./viewScroll\";\nimport { UrlRouterProvider } from \"./urlRouterProvider\";\n\n/**\n * The current (or pending) State Parameters\n *\n * An injectable global **Service Object** which holds the state parameters for the latest **SUCCESSFUL** transition.\n *\n * The values are not updated until *after* a `Transition` successfully completes.\n *\n * **Also:** an injectable **Per-Transition Object** object which holds the pending state parameters for the pending `Transition` currently running.\n *\n * ### Deprecation warning:\n *\n * The value injected for `$stateParams` is different depending on where it is injected.\n *\n * - When injected into an angular service, the object injected is the global **Service Object** with the parameter values for the latest successful `Transition`.\n * - When injected into transition hooks, resolves, or view controllers, the object is the **Per-Transition Object** with the parameter values for the running `Transition`.\n *\n * Because of these confusing details, this service is deprecated.\n *\n * ### Instead of using the global `$stateParams` service object,\n * inject [[$uiRouterGlobals]] and use [[UIRouterGlobals.params]]\n *\n * ```js\n * MyService.$inject = ['$uiRouterGlobals'];\n * function MyService($uiRouterGlobals) {\n * return {\n * paramValues: function () {\n * return $uiRouterGlobals.params;\n * }\n * }\n * }\n * ```\n *\n * ### Instead of using the per-transition `$stateParams` object,\n * inject the current `Transition` (as [[$transition$]]) and use [[Transition.params]]\n *\n * ```js\n * MyController.$inject = ['$transition$'];\n * function MyController($transition$) {\n * var username = $transition$.params().username;\n * // .. do something with username\n * }\n * ```\n *\n * ---\n *\n * This object can be injected into other services.\n *\n * #### Deprecated Example:\n * ```js\n * SomeService.$inject = ['$http', '$stateParams'];\n * function SomeService($http, $stateParams) {\n * return {\n * getUser: function() {\n * return $http.get('/api/users/' + $stateParams.username);\n * }\n * }\n * };\n * angular.service('SomeService', SomeService);\n * ```\n * @deprecated\n */\nvar $stateParams: StateParams;\n\n/**\n * Global UI-Router variables\n *\n * The router global state as a **Service Object** (injectable during runtime).\n *\n * This object contains globals such as the current state and current parameter values.\n */\nvar $uiRouterGlobals: UIRouterGlobals;\n\n/**\n * The UI-Router instance\n *\n * The [[UIRouter]] singleton (the router instance) as a **Service Object** (injectable during runtime).\n *\n * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap.\n * It has references to the other UI-Router services\n *\n * #### Note: This object is also exposed as [[$uiRouterProvider]] for injection during angular config time.\n */\nlet $uiRouter: UIRouter ;\n\n/**\n * The UI-Router instance\n *\n * The [[UIRouter]] singleton (the router instance) as a **Provider Object** (injectable during config phase).\n *\n * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap.\n * It has references to the other UI-Router services\n *\n * #### Note: This object is also exposed as [[$uiRouter]] for injection during runtime.\n */\nvar $uiRouterProvider: UIRouter;\n\n/**\n * Transition debug/tracing\n *\n * The [[Trace]] singleton as a **Service Object** (injectable during runtime).\n *\n * Enables or disables Transition tracing which can help to debug issues.\n */\nvar $trace: Trace;\n\n/**\n * The Transition Service\n *\n * The [[TransitionService]] singleton as a **Service Object** (injectable during runtime).\n *\n * This angular service exposes the [[TransitionService]] singleton, which is primarily\n * used to register global transition hooks.\n *\n * #### Note: This object is also exposed as [[$transitionsProvider]] for injection during the config phase.\n */\nvar $transitions: TransitionService;\n\n/**\n * The Transition Service\n *\n * The [[TransitionService]] singleton as a **Provider Object** (injectable during config phase)\n *\n * This angular service exposes the [[TransitionService]] singleton, which is primarily\n * used to register global transition hooks.\n *\n * #### Note: This object is also exposed as [[$transitions]] for injection during runtime.\n */\nvar $transitionsProvider: TransitionService;\n\n/**\n * The current [[Transition]] object\n *\n * The current [[Transition]] object as a **Per-Transition Object** (injectable into Resolve, Hooks, Controllers)\n *\n * This object returns information about the current transition, including:\n *\n * - To/from states\n * - To/from parameters\n * - Transition options\n * - States being entered, exited, and retained\n * - Resolve data\n * - A Promise for the transition\n * - Any transition failure information\n * - An injector for both Service and Per-Transition Objects\n */\nvar $transition$: Transition;\n\n/**\n * The State Service\n *\n * The [[StateService]] singleton as a **Service Object** (injectable during runtime).\n *\n * This service used to manage and query information on registered states.\n * It exposes state related APIs including:\n *\n * - Start a [[Transition]]\n * - Imperatively lazy load states\n * - Check if a state is currently active\n * - Look up states by name\n * - Build URLs for a state+parameters\n * - Configure the global Transition error handler\n *\n * This angular service exposes the [[StateService]] singleton.\n */\nvar $state: StateService;\n\n/**\n * The State Registry\n *\n * The [[StateRegistry]] singleton as a **Service Object** (injectable during runtime).\n *\n * This service is used to register/deregister states.\n * It has state registration related APIs including:\n *\n * - Register/deregister states\n * - Listen for state registration/deregistration\n * - Get states by name\n * - Add state decorators (to customize the state creation process)\n *\n * #### Note: This object is also exposed as [[$stateRegistryProvider]] for injection during the config phase.\n */\nvar $stateRegistry: StateRegistry;\n\n/**\n * The State Registry\n *\n * The [[StateRegistry]] singleton as a **Provider Object** (injectable during config time).\n *\n * This service is used to register/deregister states.\n * It has state registration related APIs including:\n *\n * - Register/deregister states\n * - Listen for state registration/deregistration\n * - Get states by name\n * - Add state decorators (to customize the state creation process)\n *\n * #### Note: This object is also exposed as [[$stateRegistry]] for injection during runtime.\n */\nvar $stateRegistryProvider: StateRegistry;\n\n/**\n * The View Scroll provider\n *\n * The [[UIViewScrollProvider]] as a **Provider Object** (injectable during config time).\n *\n * This angular service exposes the [[UIViewScrollProvider]] singleton and is\n * used to disable UI-Router's scroll behavior.\n */\nvar $uiViewScrollProvider: UIViewScrollProvider;\n\n/**\n * The View Scroll function\n *\n * The View Scroll function as a **Service Object** (injectable during runtime).\n *\n * This is a function that scrolls an element into view.\n * The element is scrolled after a `$timeout` so the DOM has time to refresh.\n *\n * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor,\n * this can be enabled by calling [[UIViewScrollProvider.useAnchorScroll]].\n *\n * Note: this function is used by the [[directives.uiView]] when the `autoscroll` expression evaluates to true.\n */\nvar $uiViewScroll: ($element: JQuery) => void;\n\n/**\n * The StateProvider\n *\n * An angular1-only [[StateProvider]] as a **Provider Object** (injectable during config time).\n *\n * This angular service exposes the [[StateProvider]] singleton.\n *\n * The `StateProvider` is primarily used to register states or add custom state decorators.\n *\n * ##### Note: This provider is a ng1 vestige.\n * It is a passthrough to [[$stateRegistry]] and [[$state]].\n */\nvar $stateProvider: StateProvider;\n\n/**\n * The URL Service Provider\n *\n * The [[UrlService]] singleton as a **Provider Object** (injectable during the angular config phase).\n *\n * A service used to configure and interact with the URL.\n * It has URL related APIs including:\n *\n * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]])\n * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]])\n * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]])\n * - delay initial URL synchronization [[UrlService.deferIntercept]].\n * - get or set the current url: [[UrlService.url]]\n *\n * ##### Note: This service can also be injected during runtime as [[$urlService]].\n */\nvar $urlServiceProvider: UrlService;\n\n/**\n * The URL Service\n *\n * The [[UrlService]] singleton as a **Service Object** (injectable during runtime).\n *\n * Note: This service can also be injected during the config phase as [[$urlServiceProvider]].\n *\n * Used to configure the URL.\n * It has URL related APIs including:\n *\n * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]])\n * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]])\n * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]])\n * - delay initial URL synchronization [[UrlService.deferIntercept]].\n * - get or set the current url: [[UrlService.url]]\n *\n * ##### Note: This service can also be injected during the config phase as [[$urlServiceProvider]].\n */\nvar $urlService: UrlService;\n\n/**\n * The URL Router Provider\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlServiceProvider]] instead.\n *\n * The [[UrlRouter]] singleton as a **Provider Object** (injectable during config time).\n *\n * #### Note: This object is also exposed as [[$urlRouter]] for injection during runtime.\n *\n * @deprecated\n */\nvar $urlRouterProvider: UrlRouterProvider;\n\n/**\n * The Url Router\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.\n *\n * The [[UrlRouter]] singleton as a **Service Object** (injectable during runtime).\n *\n * #### Note: This object is also exposed as [[$urlRouterProvider]] for injection during angular config time.\n *\n * @deprecated\n */\nvar $urlRouter: UrlRouter;\n\n/**\n * The URL Matcher Factory\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.\n *\n * The [[UrlMatcherFactory]] singleton as a **Service Object** (injectable during runtime).\n *\n * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects.\n *\n * #### Note: This object is also exposed as [[$urlMatcherFactoryProvider]] for injection during angular config time.\n *\n * @deprecated\n */\nvar $urlMatcherFactory: UrlMatcherFactory;\n\n/**\n * The URL Matcher Factory\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.\n *\n * The [[UrlMatcherFactory]] singleton as a **Provider Object** (injectable during config time).\n *\n * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects.\n *\n * #### Note: This object is also exposed as [[$urlMatcherFactory]] for injection during runtime.\n *\n * @deprecated\n */\nvar $urlMatcherFactoryProvider: UrlMatcherFactory;\n\n\n\n","/**\n * # Angular 1 Directives\n *\n * These are the directives included in UI-Router for Angular 1.\n * These directives are used in templates to create viewports and link/navigate to states.\n *\n * @ng1api\n * @preferred\n * @module directives\n */ /** for typedoc */\nimport { ng as angular } from \"../angular\";\nimport { IAugmentedJQuery, ITimeoutService, IScope, IInterpolateService } from \"angular\";\n\nimport {\n Obj, extend, forEach, tail, isString, isObject, isArray, parse, noop, unnestR, identity, uniqR, inArray, removeFrom,\n RawParams, PathNode, StateOrName, StateService, StateDeclaration, UIRouter\n} from \"@uirouter/core\";\nimport { UIViewData } from \"./viewDirective\";\n\n/** @hidden Used for typedoc */\nexport interface ng1_directive {}\n\n/** @hidden */\nfunction parseStateRef(ref: string) {\n let paramsOnly = ref.match(/^\\s*({[^}]*})\\s*$/), parsed;\n if (paramsOnly) ref = '(' + paramsOnly[1] + ')';\n\n parsed = ref.replace(/\\n/g, \" \").match(/^\\s*([^(]*?)\\s*(\\((.*)\\))?\\s*$/);\n if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n return { state: parsed[1] || null, paramExpr: parsed[3] || null };\n}\n\n/** @hidden */\nfunction stateContext(el: IAugmentedJQuery) {\n let $uiView: UIViewData = (el.parent() as IAugmentedJQuery).inheritedData('$uiView');\n let path: PathNode[] = parse('$cfg.path')($uiView);\n return path ? tail(path).state.name : undefined;\n}\n\n/** @hidden */\nfunction processedDef($state: StateService, $element: IAugmentedJQuery, def: Def): Def {\n let uiState = def.uiState || $state.current.name;\n let uiStateOpts = extend(defaultOpts($element, $state), def.uiStateOpts || {});\n let href = $state.href(uiState, def.uiStateParams, uiStateOpts);\n return { uiState, uiStateParams: def.uiStateParams, uiStateOpts, href };\n}\n\n/** @hidden */\ninterface TypeInfo {\n attr: string;\n isAnchor: boolean;\n clickable: boolean;\n}\n\n/** @hidden */\nfunction getTypeInfo(el: IAugmentedJQuery): TypeInfo {\n // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.\n var isSvg = Object.prototype.toString.call(el.prop('href')) === '[object SVGAnimatedString]';\n var isForm = el[0].nodeName === \"FORM\";\n\n return {\n attr: isForm ? \"action\" : (isSvg ? 'xlink:href' : 'href'),\n isAnchor: el.prop(\"tagName\").toUpperCase() === \"A\",\n clickable: !isForm\n };\n}\n\n/** @hidden */\nfunction clickHook(el: IAugmentedJQuery, $state: StateService, $timeout: ITimeoutService, type: TypeInfo, getDef: () => Def) {\n return function (e: JQueryMouseEventObject) {\n var button = e.which || e.button, target = getDef();\n\n if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || el.attr('target'))) {\n // HACK: This is to allow ng-clicks to be processed before the transition is initiated:\n var transition = $timeout(function () {\n $state.go(target.uiState, target.uiStateParams, target.uiStateOpts);\n });\n e.preventDefault();\n\n // if the state has no URL, ignore one preventDefault from the directive.\n var ignorePreventDefaultCount = type.isAnchor && !target.href ? 1 : 0;\n\n e.preventDefault = function () {\n if (ignorePreventDefaultCount-- <= 0) $timeout.cancel(transition);\n };\n }\n };\n}\n\n/** @hidden */\nfunction defaultOpts(el: IAugmentedJQuery, $state: StateService) {\n return {\n relative: stateContext(el) || $state.$current,\n inherit: true,\n source: \"sref\"\n };\n}\n\n/** @hidden */\nfunction bindEvents(element: IAugmentedJQuery, scope: IScope, hookFn: (e: JQueryMouseEventObject) => void, uiStateOpts: any): void {\n let events;\n\n if (uiStateOpts) {\n events = uiStateOpts.events;\n }\n\n if (!isArray(events)) {\n events = ['click'];\n }\n\n let on = element.on ? 'on' : 'bind';\n for (let event of events) {\n element[on](event, hookFn);\n }\n\n scope.$on('$destroy', function() {\n let off = element.off ? 'off' : 'unbind';\n for (let event of events) {\n element[off](event, hookFn);\n }\n });\n}\n\n/**\n * `ui-sref`: A directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of the `ui-sref` is the name of the state to link to.\n *\n * #### Example:\n * This will activate the `home` state when the link is clicked.\n * ```html\n * Home\n * ```\n *\n * ### Relative Links\n * You can also use relative state paths within `ui-sref`, just like a relative path passed to `$state.go()` ([[StateService.go]]).\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create a relative `ui-sref` which always targets the same destination.\n *\n * #### Example:\n * Both these links are relative to the parent state, even when a child state is currently active.\n * ```html\n * child 1 state\n * child 2 state\n * ```\n *\n * This link activates the parent state.\n * ```html\n * Return\n * ```\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]] method).\n *\n * #### Example:\n * Assuming the `users` state has a url of `/users/`\n * ```html\n * Users\n * ```\n *\n * ### Parameter Values\n * In addition to the state name, a `ui-sref` can include parameter values which are applied when activating the state.\n * Param values can be provided in the `ui-sref` value after the state name, enclosed by parentheses.\n * The content inside the parentheses is an expression, evaluated to the parameter values.\n *\n * #### Example:\n * This example renders a list of links to users.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n *
  • \n * {{ user.displayName }}\n *
  • \n * ```\n *\n * Note:\n * The parameter values expression is `$watch`ed for updates.\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-sref-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n *\n * #### Example:\n * ```html\n * Home\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-sref-opts` attribute.\n *\n * #### Example:\n * ```html\n * \n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Examples\n * If you have the following template:\n *\n * ```html\n * Home\n * About\n * Next page\n *\n * \n * ```\n *\n * Then (assuming the current state is `contacts`) the rendered html including hrefs would be:\n *\n * ```html\n * Home\n * About\n * Next page\n *\n *
      \n *
    • \n * Joe\n *
    • \n *
    • \n * Alice\n *
    • \n *
    • \n * Bob\n *
    • \n *
    \n *\n * Home\n * ```\n *\n * ### Notes\n *\n * - You can use `ui-sref` to change **only the parameter values** by omitting the state name and parentheses.\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * English\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n *\n * - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons).\n * If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive.\n */\nlet uiSref: ng1_directive;\nuiSref = ['$uiRouter', '$timeout',\n function $StateRefDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n let $state = $uiRouter.stateService;\n\n return {\n restrict: 'A',\n require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n link: function (scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n let type = getTypeInfo(element);\n let active = uiSrefActive[1] || uiSrefActive[0];\n let unlinkInfoFn: Function = null;\n let hookFn;\n\n let rawDef = {} as Def;\n let getDef = () => processedDef($state, element, rawDef);\n\n let ref = parseStateRef(attrs.uiSref);\n rawDef.uiState = ref.state;\n rawDef.uiStateOpts = attrs.uiSrefOpts ? scope.$eval(attrs.uiSrefOpts) : {};\n\n function update() {\n let def = getDef();\n if (unlinkInfoFn) unlinkInfoFn();\n if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n if (def.href != null) attrs.$set(type.attr, def.href);\n }\n\n if (ref.paramExpr) {\n scope.$watch(ref.paramExpr, function (val) {\n rawDef.uiStateParams = extend({}, val);\n update();\n }, true);\n rawDef.uiStateParams = extend({}, scope.$eval(ref.paramExpr));\n }\n\n update();\n\n scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update));\n scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update));\n\n if (!type.clickable) return;\n hookFn = clickHook(element, $state, $timeout, type, getDef);\n bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n }\n };\n }];\n\n/**\n * `ui-state`: A fully dynamic directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * **This directive is very similar to [[uiSref]], but it `$observe`s and `$watch`es/evaluates all its inputs.**\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of `ui-state` is an expression which is `$watch`ed and evaluated as the state to link to.\n * **This is in contrast with `ui-sref`, which takes a state name as a string literal.**\n *\n * #### Example:\n * Create a list of links.\n * ```html\n *
  • \n * {{ link.displayName }}\n *
  • \n * ```\n *\n * ### Relative Links\n * If the expression evaluates to a relative path, it is processed like [[uiSref]].\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create relative `ui-state` which always targets the same destination.\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]] method).\n *\n * ### Parameter Values\n * In addition to the state name expression, a `ui-state` can include parameter values which are applied when activating the state.\n * Param values should be provided using the `ui-state-params` attribute.\n * The `ui-state-params` attribute value is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * This example renders a list of links with param values.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n *
  • \n * {{ link.displayName }}\n *
  • \n * ```\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-state-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n * The value of the `ui-state-opts` is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * ```html\n * Home\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-state-opts` attribute.\n *\n * #### Example:\n * ```html\n * \n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Notes\n *\n * - You can use `ui-params` to change **only the parameter values** by omitting the state name and supplying only `ui-state-params`.\n * However, it might be simpler to use [[uiSref]] parameter-only links.\n *\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * English\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n * ```\n */\nlet uiState: ng1_directive;\nuiState = ['$uiRouter', '$timeout',\n function $StateRefDynamicDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n let $state = $uiRouter.stateService;\n\n return {\n restrict: 'A',\n require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n link: function (scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n let type = getTypeInfo(element);\n let active = uiSrefActive[1] || uiSrefActive[0];\n let unlinkInfoFn: Function = null;\n let hookFn;\n\n let rawDef = {} as Def;\n let getDef = () => processedDef($state, element, rawDef);\n\n let inputAttrs = ['uiState', 'uiStateParams', 'uiStateOpts'];\n let watchDeregFns = inputAttrs.reduce((acc, attr) => (acc[attr] = noop, acc), {});\n\n function update() {\n let def = getDef();\n if (unlinkInfoFn) unlinkInfoFn();\n if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n if (def.href != null) attrs.$set(type.attr, def.href);\n }\n\n inputAttrs.forEach((field) => {\n rawDef[field] = attrs[field] ? scope.$eval(attrs[field]) : null;\n\n attrs.$observe(field, (expr) => {\n watchDeregFns[field]();\n watchDeregFns[field] = scope.$watch(expr, (newval) => {\n rawDef[field] = newval;\n update();\n }, true);\n })\n });\n\n update();\n\n scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update));\n scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update));\n\n if (!type.clickable) return;\n hookFn = clickHook(element, $state, $timeout, type, getDef);\n bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n }\n };\n }];\n\n\n/**\n * `ui-sref-active` and `ui-sref-active-eq`: A directive that adds a CSS class when a `ui-sref` is active\n *\n * A directive working alongside [[uiSref]] and [[uiState]] to add classes to an element when the\n * related directive's state is active (and remove them when it is inactive).\n *\n * The primary use-case is to highlight the active link in navigation menus,\n * distinguishing it from the inactive menu items.\n *\n * ### Linking to a `ui-sref` or `ui-state`\n * `ui-sref-active` can live on the same element as `ui-sref`/`ui-state`, or it can be on a parent element.\n * If a `ui-sref-active` is a parent to more than one `ui-sref`/`ui-state`, it will apply the CSS class when **any of the links are active**.\n *\n * ### Matching\n *\n * The `ui-sref-active` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state **or any child state is active**.\n * This is a \"fuzzy match\" which uses [[StateService.includes]].\n *\n * The `ui-sref-active-eq` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state is directly active (not when child states are active).\n * This is an \"exact match\" which uses [[StateService.is]].\n *\n * ### Parameter values\n * If the `ui-sref`/`ui-state` includes parameter values, the current parameter values must match the link's values for the link to be highlighted.\n * This allows a list of links to the same state with different parameters to be rendered, and the correct one highlighted.\n *\n * #### Example:\n * ```html\n *
  • \n * {{ user.lastName }}\n *
  • \n * ```\n *\n * ### Examples\n *\n * Given the following template:\n * #### Example:\n * ```html\n * \n * ```\n *\n * When the app state is `app.user` (or any child state),\n * and contains the state parameter \"user\" with value \"bilbobaggins\",\n * the resulting HTML will appear as (note the 'active' class):\n *\n * ```html\n * \n * ```\n *\n * ### Glob mode\n *\n * It is possible to pass `ui-sref-active` an expression that evaluates to an object.\n * The objects keys represent active class names and values represent the respective state names/globs.\n * `ui-sref-active` will match if the current active state **includes** any of\n * the specified state names/globs, even the abstract ones.\n *\n * #### Example:\n * Given the following template, with \"admin\" being an abstract state:\n * ```html\n *
    \n * Roles\n *
    \n * ```\n *\n * When the current state is \"admin.roles\" the \"active\" class will be applied to both the
    and elements.\n * It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`.\n *\n * ### Notes:\n *\n * - The class name is interpolated **once** during the directives link time (any further changes to the\n * interpolated value are ignored).\n *\n * - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'`\n */\nlet uiSrefActive: ng1_directive;\nuiSrefActive = ['$state', '$stateParams', '$interpolate', '$uiRouter',\n function $StateRefActiveDirective($state: StateService, $stateParams: Obj, $interpolate: IInterpolateService, $uiRouter: UIRouter) {\n return {\n restrict: \"A\",\n controller: ['$scope', '$element', '$attrs',\n function ($scope: IScope, $element: IAugmentedJQuery, $attrs: any) {\n let states: StateData[] = [],\n activeEqClass: string,\n uiSrefActive: any;\n\n // There probably isn't much point in $observing this\n // uiSrefActive and uiSrefActiveEq share the same directive object with some\n // slight difference in logic routing\n activeEqClass = $interpolate($attrs.uiSrefActiveEq || '', false)($scope);\n\n try {\n uiSrefActive = $scope.$eval($attrs.uiSrefActive);\n } catch (e) {\n // Do nothing. uiSrefActive is not a valid expression.\n // Fall back to using $interpolate below\n }\n uiSrefActive = uiSrefActive || $interpolate($attrs.uiSrefActive || '', false)($scope);\n if (isObject(uiSrefActive)) {\n forEach(uiSrefActive, function (stateOrName: StateOrName, activeClass: string) {\n if (isString(stateOrName)) {\n let ref = parseStateRef(stateOrName);\n addState(ref.state, $scope.$eval(ref.paramExpr), activeClass);\n }\n });\n }\n\n // Allow uiSref to communicate with uiSrefActive[Equals]\n this.$$addStateInfo = function (newState: string, newParams: Obj) {\n // we already got an explicit state provided by ui-sref-active, so we\n // shadow the one that comes from ui-sref\n if (isObject(uiSrefActive) && states.length > 0) {\n return;\n }\n let deregister = addState(newState, newParams, uiSrefActive);\n update();\n return deregister;\n };\n\n function updateAfterTransition(trans) {\n trans.promise.then(update, noop);\n }\n\n $scope.$on('$stateChangeSuccess', update);\n $scope.$on('$destroy', $uiRouter.transitionService.onStart({}, updateAfterTransition));\n if ($uiRouter.globals.transition) {\n updateAfterTransition($uiRouter.globals.transition);\n }\n\n function addState(stateName: string, stateParams: Obj, activeClass: string) {\n var state = $state.get(stateName, stateContext($element));\n\n var stateInfo = {\n state: state || { name: stateName },\n params: stateParams,\n activeClass: activeClass\n };\n\n states.push(stateInfo);\n\n return function removeState() {\n removeFrom(states)(stateInfo);\n }\n }\n\n // Update route state\n function update() {\n const splitClasses = str =>\n str.split(/\\s/).filter(identity);\n const getClasses = (stateList: StateData[]) =>\n stateList.map(x => x.activeClass).map(splitClasses).reduce(unnestR, []);\n\n let allClasses = getClasses(states).concat(splitClasses(activeEqClass)).reduce(uniqR, []);\n let fuzzyClasses = getClasses(states.filter(x => $state.includes(x.state.name, x.params)));\n let exactlyMatchesAny = !!states.filter(x => $state.is(x.state.name, x.params)).length;\n let exactClasses = exactlyMatchesAny ? splitClasses(activeEqClass) : [];\n\n let addClasses = fuzzyClasses.concat(exactClasses).reduce(uniqR, []);\n let removeClasses = allClasses.filter(cls => !inArray(addClasses, cls));\n\n $scope.$evalAsync(() => {\n addClasses.forEach(className => $element.addClass(className));\n removeClasses.forEach(className => $element.removeClass(className));\n });\n }\n\n update();\n }]\n };\n }];\n\n/** @hidden */\ninterface Def { uiState: string; href: string; uiStateParams: Obj; uiStateOpts: any; }\n/** @hidden */\ninterface StateData { state: StateDeclaration; params: RawParams; activeClass: string; }\n\nangular.module('ui.router.state')\n .directive('uiSref', uiSref)\n .directive('uiSrefActive', uiSrefActive)\n .directive('uiSrefActiveEq', uiSrefActive)\n .directive('uiState', uiState);\n","/** @module ng1 */ /** for typedoc */\n\nimport { ng as angular } from \"./angular\";\nimport { Obj, StateService, StateOrName } from \"@uirouter/core\";\n\n/**\n * `isState` Filter: truthy if the current state is the parameter\n *\n * Translates to [[StateService.is]] `$state.is(\"stateName\")`.\n *\n * #### Example:\n * ```html\n *
    show if state is 'stateName'
    \n * ```\n */\n$IsStateFilter.$inject = ['$state'];\nexport function $IsStateFilter($state: StateService) {\n var isFilter: any = function(state: StateOrName, params: Obj, options?: { relative?: StateOrName }) {\n return $state.is(state, params, options);\n };\n isFilter.$stateful = true;\n return isFilter;\n}\n\n/**\n * `includedByState` Filter: truthy if the current state includes the parameter\n *\n * Translates to [[StateService.includes]]` $state.is(\"fullOrPartialStateName\")`.\n *\n * #### Example:\n * ```html\n *
    show if state includes 'fullOrPartialStateName'
    \n * ```\n */\n$IncludedByStateFilter.$inject = ['$state'];\nexport function $IncludedByStateFilter($state: StateService) {\n var includesFilter: any = function(state: StateOrName, params: Obj, options: { relative?: StateOrName }) {\n return $state.includes(state, params, options);\n };\n includesFilter.$stateful = true;\n return includesFilter;\n}\n\nangular.module('ui.router.state')\n .filter('isState', $IsStateFilter)\n .filter('includedByState', $IncludedByStateFilter);\n","/** \n * @ng1api \n * @module directives \n */ /** for typedoc */\nimport { ng as angular } from \"../angular\";\nimport {\n IInterpolateService, IScope, ITranscludeFunction, IAugmentedJQuery,\n ICompileService, IControllerService, ITimeoutService, noop\n} from \"angular\";\n\nimport {\n extend, unnestR, filter, tail, isDefined, isFunction, isString, trace, parse,\n ActiveUIView, TransitionService, ResolveContext, Transition, PathNode, StateDeclaration,\n Param, kebobString, HookRegOptions, ViewService, $QLike, Obj, TypedMap\n} from \"@uirouter/core\";\nimport {Ng1ViewConfig} from \"../statebuilders/views\";\nimport {Ng1Controller, Ng1StateDeclaration} from \"../interface\";\nimport {getLocals} from \"../services\";\nimport { ng1_directive } from \"./stateDirectives\";\n\n/** @hidden */\nexport type UIViewData = {\n $cfg: Ng1ViewConfig;\n $uiView: ActiveUIView;\n}\n\n/** @hidden */\nexport type UIViewAnimData = {\n $animEnter: Promise;\n $animLeave: Promise;\n $$animLeave: { resolve: () => any; } // \"deferred\"\n}\n\n/**\n * `ui-view`: A viewport directive which is filled in by a view from the active state.\n *\n * ### Attributes\n *\n * - `name`: (Optional) A view name.\n * The name should be unique amongst the other views in the same state.\n * You can have views of the same name that live in different states.\n * The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]).\n *\n * - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated.\n * Uses [[$uiViewScroll]] to do the scrolling.\n *\n * - `onload`: Expression to evaluate whenever the view updates.\n *\n * #### Example:\n * A view can be unnamed or named.\n * ```html\n * \n *
    \n *\n * \n *
    \n *\n * \n * \n * ```\n *\n * You can only have one unnamed view within any template (or root html). If you are only using a\n * single view and it is unnamed then you can populate it like so:\n *\n * ```html\n *
    \n * $stateProvider.state(\"home\", {\n * template: \"

    HELLO!

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

    HELLO!

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

    HELLO!

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

    HELLO!

    \"\n * },\n * \"chart\": {\n * template: \"\"\n * },\n * \"data\": {\n * template: \"\"\n * }\n * }\n * })\n * ```\n *\n * #### Examples for `autoscroll`:\n * ```html\n * \n * \n *\n * \n * \n * \n * \n * ```\n *\n * Resolve data:\n *\n * The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this\n * can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template.\n *\n * Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the\n * controller is instantiated. The `$onInit()` hook can be used to perform initialization code which\n * depends on `$resolve` data.\n *\n * #### Example:\n * ```js\n * $stateProvider.state('home', {\n * template: '',\n * resolve: {\n * user: function(UserService) { return UserService.fetchUser(); }\n * }\n * });\n * ```\n */\nexport let uiView: ng1_directive;\nuiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q',\nfunction $ViewDirective($view: ViewService, $animate: any, $uiViewScroll: any, $interpolate: IInterpolateService, $q: $QLike) {\n\n function getRenderer(attrs: Obj, scope: IScope) {\n return {\n enter: function(element: JQuery, target: any, cb: Function) {\n if (angular.version.minor > 2) {\n $animate.enter(element, null, target).then(cb);\n } else {\n $animate.enter(element, null, target, cb);\n }\n },\n leave: function(element: JQuery, cb: Function) {\n if (angular.version.minor > 2) {\n $animate.leave(element).then(cb);\n } else {\n $animate.leave(element, cb);\n }\n }\n };\n }\n\n function configsEqual(config1: Ng1ViewConfig, config2: Ng1ViewConfig) {\n return config1 === config2;\n }\n\n let rootData = {\n $cfg: { viewDecl: { $context: $view._pluginapi._rootViewContext() } },\n $uiView: { }\n };\n\n let directive = {\n count: 0,\n restrict: 'ECA',\n terminal: true,\n priority: 400,\n transclude: 'element',\n compile: function (tElement: JQuery, tAttrs: Obj, $transclude: ITranscludeFunction) {\n\n return function (scope: IScope, $element: IAugmentedJQuery, attrs: Obj) {\n let previousEl: JQuery, currentEl: JQuery,\n currentScope: IScope, unregister: Function,\n onloadExp = attrs['onload'] || '',\n autoScrollExp = attrs['autoscroll'],\n renderer = getRenderer(attrs, scope),\n viewConfig = undefined as Ng1ViewConfig,\n inherited = $element.inheritedData('$uiView') || rootData,\n name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default';\n\n let activeUIView: ActiveUIView = {\n $type: 'ng1',\n id: directive.count++, // Global sequential ID for ui-view tags added to DOM\n name: name, // ui-view name (
    \n fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + \".\" + name : name, // fully qualified name, describes location in DOM\n config: null, // The ViewConfig loaded (from a state.views definition)\n configUpdated: configUpdatedCallback, // Called when the matching ViewConfig changes\n get creationContext() { // The context in which this ui-view \"tag\" was created\n let fromParentTagConfig = parse('$cfg.viewDecl.$context')(inherited);\n // Allow \n // See https://github.com/angular-ui/ui-router/issues/3355\n let fromParentTag = parse('$uiView.creationContext')(inherited);\n return fromParentTagConfig || fromParentTag;\n }\n };\n\n trace.traceUIViewEvent(\"Linking\", activeUIView);\n\n function configUpdatedCallback(config?: Ng1ViewConfig) {\n if (config && !(config instanceof Ng1ViewConfig)) return;\n if (configsEqual(viewConfig, config)) return;\n trace.traceUIViewConfigUpdated(activeUIView, config && config.viewDecl && config.viewDecl.$context);\n\n viewConfig = config;\n updateView(config);\n }\n\n $element.data('$uiView', { $uiView: activeUIView });\n\n updateView();\n\n unregister = $view.registerUIView(activeUIView);\n scope.$on(\"$destroy\", function() {\n trace.traceUIViewEvent(\"Destroying/Unregistering\", activeUIView);\n unregister();\n });\n\n function cleanupLastView() {\n if (previousEl) {\n trace.traceUIViewEvent(\"Removing (previous) el\", previousEl.data('$uiView'));\n previousEl.remove();\n previousEl = null;\n }\n\n if (currentScope) {\n trace.traceUIViewEvent(\"Destroying scope\", activeUIView);\n currentScope.$destroy();\n currentScope = null;\n }\n\n if (currentEl) {\n let _viewData = currentEl.data('$uiViewAnim');\n trace.traceUIViewEvent(\"Animate out\", _viewData);\n renderer.leave(currentEl, function() {\n _viewData.$$animLeave.resolve();\n previousEl = null;\n });\n\n previousEl = currentEl;\n currentEl = null;\n }\n }\n\n function updateView(config?: Ng1ViewConfig) {\n let newScope = scope.$new();\n let animEnter = $q.defer(), animLeave = $q.defer();\n\n let $uiViewData: UIViewData = {\n $cfg: config,\n $uiView: activeUIView,\n };\n\n let $uiViewAnim: UIViewAnimData = {\n $animEnter: animEnter.promise,\n $animLeave: animLeave.promise,\n $$animLeave: animLeave\n };\n\n /**\n * @ngdoc event\n * @name ui.router.state.directive:ui-view#$viewContentLoading\n * @eventOf ui.router.state.directive:ui-view\n * @eventType emits on ui-view directive scope\n * @description\n *\n * Fired once the view **begins loading**, *before* the DOM is rendered.\n *\n * @param {Object} event Event object.\n * @param {string} viewName Name of the view.\n */\n newScope.$emit('$viewContentLoading', name);\n\n let cloned = $transclude(newScope, function(clone) {\n clone.data('$uiViewAnim', $uiViewAnim);\n clone.data('$uiView', $uiViewData);\n renderer.enter(clone, $element, function onUIViewEnter() {\n animEnter.resolve();\n if (currentScope) currentScope.$emit('$viewContentAnimationEnded');\n\n if (isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {\n $uiViewScroll(clone);\n }\n });\n\n cleanupLastView();\n });\n\n currentEl = cloned;\n currentScope = newScope;\n /**\n * @ngdoc event\n * @name ui.router.state.directive:ui-view#$viewContentLoaded\n * @eventOf ui.router.state.directive:ui-view\n * @eventType emits on ui-view directive scope\n * @description *\n * Fired once the view is **loaded**, *after* the DOM is rendered.\n *\n * @param {Object} event Event object.\n */\n currentScope.$emit('$viewContentLoaded', config || viewConfig);\n currentScope.$eval(onloadExp);\n }\n };\n }\n };\n\n return directive;\n}];\n\n$ViewDirectiveFill.$inject = ['$compile', '$controller', '$transitions', '$view', '$q', '$timeout'];\n/** @hidden */\nfunction $ViewDirectiveFill($compile: angular.ICompileService,\n $controller: angular.IControllerService,\n $transitions: TransitionService,\n $view: ViewService,\n $q: angular.IQService,\n $timeout: ITimeoutService) {\n const getControllerAs = parse('viewDecl.controllerAs');\n const getResolveAs = parse('viewDecl.resolveAs');\n\n return {\n restrict: 'ECA',\n priority: -400,\n compile: function (tElement: JQuery) {\n let initial = tElement.html();\n tElement.empty();\n\n return function (scope: IScope, $element: JQuery) {\n let data: UIViewData = $element.data('$uiView');\n if (!data) {\n $element.html(initial);\n $compile($element.contents())(scope);\n return;\n }\n\n let cfg: Ng1ViewConfig = data.$cfg || { viewDecl: {}, getTemplate: noop };\n let resolveCtx: ResolveContext = cfg.path && new ResolveContext(cfg.path);\n $element.html(cfg.getTemplate($element, resolveCtx) || initial);\n trace.traceUIViewFill(data.$uiView, $element.html());\n\n let link = $compile($element.contents());\n let controller = cfg.controller;\n let controllerAs: string = getControllerAs(cfg);\n let resolveAs: string = getResolveAs(cfg);\n let locals = resolveCtx && getLocals(resolveCtx);\n\n scope[resolveAs] = locals;\n\n if (controller) {\n let controllerInstance = $controller(controller, extend({}, locals, { $scope: scope, $element: $element }));\n if (controllerAs) {\n scope[controllerAs] = controllerInstance;\n scope[controllerAs][resolveAs] = locals;\n }\n\n // TODO: Use $view service as a central point for registering component-level hooks\n // Then, when a component is created, tell the $view service, so it can invoke hooks\n // $view.componentLoaded(controllerInstance, { $scope: scope, $element: $element });\n // scope.$on('$destroy', () => $view.componentUnloaded(controllerInstance, { $scope: scope, $element: $element }));\n\n $element.data('$ngControllerController', controllerInstance);\n $element.children().data('$ngControllerController', controllerInstance);\n\n registerControllerCallbacks($q, $transitions, controllerInstance, scope, cfg);\n }\n\n // Wait for the component to appear in the DOM\n if (isString(cfg.viewDecl.component)) {\n let cmp = cfg.viewDecl.component;\n let kebobName = kebobString(cmp);\n let tagRegexp = new RegExp(`^(x-|data-)?${kebobName}$`, \"i\");\n\n let getComponentController = () => {\n let directiveEl = [].slice.call($element[0].children)\n .filter((el: Element) => el && el.tagName && tagRegexp.exec(el.tagName)) ;\n \n return directiveEl && angular.element(directiveEl).data(`$${cmp}Controller`);\n };\n\n let deregisterWatch = scope.$watch(getComponentController, function(ctrlInstance) {\n if (!ctrlInstance) return;\n registerControllerCallbacks($q, $transitions, ctrlInstance, scope, cfg);\n deregisterWatch();\n });\n }\n\n link(scope);\n };\n }\n };\n}\n\n/** @hidden */\nlet hasComponentImpl = typeof (angular as any).module('ui.router')['component'] === 'function';\n/** @hidden incrementing id */\nlet _uiCanExitId = 0;\n\n/** @hidden TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */\nfunction registerControllerCallbacks($q: angular.IQService,\n $transitions: TransitionService,\n controllerInstance: Ng1Controller,\n $scope: IScope,\n cfg: Ng1ViewConfig) {\n // Call $onInit() ASAP\n if (isFunction(controllerInstance.$onInit) && !(cfg.viewDecl.component && hasComponentImpl)) {\n controllerInstance.$onInit();\n }\n\n let viewState: Ng1StateDeclaration = tail(cfg.path).state.self;\n\n let hookOptions: HookRegOptions = { bind: controllerInstance };\n // Add component-level hook for onParamsChange\n if (isFunction(controllerInstance.uiOnParamsChanged)) {\n let resolveContext: ResolveContext = new ResolveContext(cfg.path);\n let viewCreationTrans = resolveContext.getResolvable('$transition$').data;\n\n // Fire callback on any successful transition\n const paramsUpdated = ($transition$: Transition) => {\n // Exit early if the $transition$ is the same as the view was created within.\n // Exit early if the $transition$ will exit the state the view is for.\n if ($transition$ === viewCreationTrans || $transition$.exiting().indexOf(viewState as StateDeclaration) !== -1) return;\n\n let toParams = $transition$.params(\"to\") as TypedMap;\n let fromParams = $transition$.params>(\"from\") as TypedMap;\n let toSchema: Param[] = $transition$.treeChanges().to.map((node: PathNode) => node.paramSchema).reduce(unnestR, []);\n let fromSchema: Param[] = $transition$.treeChanges().from.map((node: PathNode) => node.paramSchema).reduce(unnestR, []);\n\n // Find the to params that have different values than the from params\n let changedToParams = toSchema.filter((param: Param) => {\n let idx = fromSchema.indexOf(param);\n return idx === -1 || !fromSchema[idx].type.equals(toParams[param.id], fromParams[param.id]);\n });\n\n // Only trigger callback if a to param has changed or is new\n if (changedToParams.length) {\n let changedKeys: string[] = changedToParams.map(x => x.id);\n // Filter the params to only changed/new to params. `$transition$.params()` may be used to get all params.\n let newValues = filter(toParams, (val, key) => changedKeys.indexOf(key) !== -1);\n controllerInstance.uiOnParamsChanged(newValues, $transition$);\n }\n };\n $scope.$on('$destroy', $transitions.onSuccess({}, paramsUpdated, hookOptions));\n }\n\n // Add component-level hook for uiCanExit\n if (isFunction(controllerInstance.uiCanExit)) {\n let id = _uiCanExitId++;\n let cacheProp = '_uiCanExitIds';\n\n // Returns true if a redirect transition already answered truthy\n const prevTruthyAnswer = (trans: Transition) =>\n !!trans && (trans[cacheProp] && trans[cacheProp][id] === true || prevTruthyAnswer(trans.redirectedFrom()));\n\n // If a user answered yes, but the transition was later redirected, don't also ask for the new redirect transition\n const wrappedHook = (trans: Transition) => {\n let promise, ids = trans[cacheProp] = trans[cacheProp] || {};\n if (!prevTruthyAnswer(trans)) {\n promise = $q.when(controllerInstance.uiCanExit(trans));\n promise.then(val => ids[id] = (val !== false));\n }\n return promise;\n };\n\n let criteria = {exiting: viewState.name};\n $scope.$on('$destroy', $transitions.onBefore(criteria, wrappedHook, hookOptions));\n }\n}\n\nangular.module('ui.router.state').directive('uiView', uiView);\nangular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);\n","/** @module ng1 */ /** */\nimport { ng as angular } from \"./angular\";\nimport { IServiceProviderFactory } from \"angular\";\nimport IAnchorScrollService = angular.IAnchorScrollService;\nimport ITimeoutService = angular.ITimeoutService;\n\nexport interface UIViewScrollProvider {\n /**\n * Uses standard anchorScroll behavior\n *\n * Reverts [[$uiViewScroll]] back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)\n * service for scrolling based on the url anchor.\n */\n useAnchorScroll(): void;\n}\n\n\n/** @hidden */\nfunction $ViewScrollProvider() {\n\n var useAnchorScroll = false;\n\n this.useAnchorScroll = function () {\n useAnchorScroll = true;\n };\n\n this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll: IAnchorScrollService, $timeout: ITimeoutService): Function {\n if (useAnchorScroll) {\n return $anchorScroll;\n }\n\n return function ($element: JQuery) {\n return $timeout(function () {\n $element[0].scrollIntoView();\n }, 0, false);\n };\n }];\n}\n\nangular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);\n","/**\n * Main entry point for angular 1.x build\n * @module ng1\n */ /** */\n\nexport * from \"./interface\";\nexport * from \"./services\";\nexport * from \"./statebuilders/views\";\nexport * from \"./stateProvider\";\nexport * from \"./urlRouterProvider\";\n\nimport \"./injectables\";\nimport \"./directives/stateDirectives\";\nimport \"./stateFilters\";\nimport \"./directives/viewDirective\";\nimport \"./viewScroll\";\n\nexport default \"ui.router\";\n\nimport * as core from \"@uirouter/core\";\nexport { core };\nexport * from \"@uirouter/core\";\n\n"],"names":["ng_from_import.module","val","angular","RejectType","Category","TransitionHookPhase","TransitionHookScope","noop","DefType","inherit","values","all","prop","pattern","pairs","parseUrl","__extends","id"],"mappings":";;;;;;;;;;;;;;;;AAMA,IAAI,cAAc,GAAG,OAAO,CAAC;AAE7B,AAAO,IAAM,EAAE,GAAG,CAAC,cAAc,IAAIA,qBAAqB,IAAI,cAAc,GAAG,cAAc;;ACR7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,eAAsB,EAAY;IAChC,IAAI,YAAY,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/UI/WebServerResources/js/vendor/angular-ui-router.min.js b/UI/WebServerResources/js/vendor/angular-ui-router.min.js index d531007fb..625db1f7b 100644 --- a/UI/WebServerResources/js/vendor/angular-ui-router.min.js +++ b/UI/WebServerResources/js/vendor/angular-ui-router.min.js @@ -4,12 +4,9 @@ * This causes it to be incompatible with plugins that depend on @uirouter/core. * We recommend switching to the ui-router-core.js and ui-router-angularjs.js bundles instead. * For more information, see https://ui-router.github.io/blog/uirouter-for-angularjs-umd-bundles - * @version v1.0.6 + * @version v1.0.7 * @link https://ui-router.github.io * @license MIT License, http://www.opensource.org/licenses/MIT */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("angular")):"function"==typeof define&&define.amd?define(["exports","angular"],e):e(t["@uirouter/angularjs"]=t["@uirouter/angularjs"]||{},t.angular)}(this,function(t,e){"use strict";function r(t){function e(r){return r.length>=n?t.apply(null,r):function(){return e(r.concat([].slice.apply(arguments)))}}var r=[].slice.apply(arguments,[1]),n=t.length;return e(r)}function n(){var t=arguments,e=t.length-1;return function(){for(var r=e,n=t[e].apply(this,arguments);r--;)n=t[r].call(this,n);return n}}function i(){for(var t=[],e=0;e=0&&t.splice(r,1),t}function v(t,e){return t.push(e),e}function m(t){for(var e=[],r=1;r1||o.ctrlKey||o.metaKey||o.shiftKey||t.attr("target"))){var s=r(function(){e.go(u.uiState,u.uiStateParams,u.uiStateOpts)});o.preventDefault();var c=n.isAnchor&&!u.href?1:0;o.preventDefault=function(){c--<=0&&r.cancel(s)}}}}function Tt(t,e){return{relative:St(t)||e.$current,inherit:!0,source:"sref"}}function Ct(t,e,r,n){var i;n&&(i=n.events),re(i)||(i=["click"]);for(var o=t.on?"on":"bind",a=0,u=i;athis._limit&&e.shift(),t},t.prototype.dequeue=function(){if(this.size())return this._items.splice(0,1)[0]},t.prototype.clear=function(){var t=this._items;return this._items=[],t},t.prototype.size=function(){return this._items.length},t.prototype.remove=function(t){var e=this._items.indexOf(t);return e>-1&&this._items.splice(e,1)[0]},t.prototype.peekTail=function(){return this._items[this._items.length-1]},t.prototype.peekHead=function(){if(this.size())return this._items[0]},t}();!function(t){t[t.SUPERSEDED=2]="SUPERSEDED",t[t.ABORTED=3]="ABORTED",t[t.INVALID=4]="INVALID",t[t.IGNORED=5]="IGNORED",t[t.ERROR=6]="ERROR"}(t.RejectType||(t.RejectType={}));var De=0,Ne=function(){function e(t,e,r){this.$id=De++,this.type=t,this.message=e,this.detail=r}return e.prototype.toString=function(){var t=function(t){return t&&t.toString!==Object.prototype.toString?t.toString():Q(t)}(this.detail),e=this;return"Transition Rejection($id: "+e.$id+" type: "+e.type+", message: "+e.message+", detail: "+t+")"},e.prototype.toPromise=function(){return ve(He(this),{_transitionRejection:this})},e.isRejectionPromise=function(t){return t&&"function"==typeof t.then&&Ut(e)(t._transitionRejection)},e.superseded=function(r,n){var i=new e(t.RejectType.SUPERSEDED,"The transition has been superseded by a different transition",r);return n&&n.redirected&&(i.redirected=!0),i},e.redirected=function(t){return e.superseded(t,{redirected:!0})},e.invalid=function(r){return new e(t.RejectType.INVALID,"This transition is invalid",r)},e.ignored=function(r){return new e(t.RejectType.IGNORED,"The transition was ignored",r)},e.aborted=function(r){return new e(t.RejectType.ABORTED,"The transition has been aborted",r)},e.errored=function(r){return new e(t.RejectType.ERROR,"The transition errored",r)},e.normalize=function(t){return Ut(e)(t)?t:e.errored(t)},e}(),Fe=function(t){var e=t.viewDecl,r=e.$context.name||"(root)";return"[View#"+t.$id+" from '"+r+"' state]: target ui-view: '"+e.$uiViewName+"@"+e.$uiViewContextAnchor+"'"};!function(t){t[t.RESOLVE=0]="RESOLVE",t[t.TRANSITION=1]="TRANSITION",t[t.HOOK=2]="HOOK",t[t.UIVIEW=3]="UIVIEW",t[t.VIEWCONFIG=4]="VIEWCONFIG"}(t.Category||(t.Category={}));var Ue=qt("$id"),Le=qt("router.$id"),Me=function(t){return"Transition #"+Ue(t)+"-"+Le(t)},Ge=function(){function e(){this._enabled={},this.approximateDigests=0}return e.prototype._set=function(e,r){var n=this;r.length||(r=Object.keys(t.Category).map(function(t){return parseInt(t,10)}).filter(function(t){return!isNaN(t)}).map(function(e){return t.Category[e]})),r.map(A).forEach(function(t){return n._enabled[t]=e})},e.prototype.enable=function(){for(var t=[],e=0;e "+Q(e))},e.prototype.traceTransitionIgnored=function(e){this.enabled(t.Category.TRANSITION)&&console.log(Me(e)+": Ignored <> "+Q(e))},e.prototype.traceHookInvocation=function(e,r,n){if(this.enabled(t.Category.HOOK)){var i=qt("traceData.hookType")(n)||"internal",o=qt("traceData.context.state.name")(n)||qt("traceData.context")(n)||"unknown",a=z(e.registeredHook.callback);console.log(Me(r)+": Hook -> "+i+" context: "+o+", "+G(200,a))}},e.prototype.traceHookResult=function(e,r,n){this.enabled(t.Category.HOOK)&&console.log(Me(r)+": <- Hook returned: "+G(200,Q(e)))},e.prototype.traceResolvePath=function(e,r,n){this.enabled(t.Category.RESOLVE)&&console.log(Me(n)+": Resolving "+e+" ("+r+")")},e.prototype.traceResolvableResolved=function(e,r){this.enabled(t.Category.RESOLVE)&&console.log(Me(r)+": <- Resolved "+e+" to: "+G(200,Q(e.data)))},e.prototype.traceError=function(e,r){this.enabled(t.Category.TRANSITION)&&console.log(Me(r)+": <- Rejected "+Q(r)+", reason: "+e)},e.prototype.traceSuccess=function(e,r){this.enabled(t.Category.TRANSITION)&&console.log(Me(r)+": <- Success "+Q(r)+", final state: "+e.name)},e.prototype.traceUIViewEvent=function(e,r,n){void 0===n&&(n=""),this.enabled(t.Category.UIVIEW)&&console.log("ui-view: "+B(30,e)+" "+V(r)+n)},e.prototype.traceUIViewConfigUpdated=function(e,r){this.enabled(t.Category.UIVIEW)&&this.traceUIViewEvent("Updating",e," with ViewConfig from context='"+r+"'")},e.prototype.traceUIViewFill=function(e,r){this.enabled(t.Category.UIVIEW)&&this.traceUIViewEvent("Fill",e," with: "+G(200,r))},e.prototype.traceViewSync=function(e){if(this.enabled(t.Category.VIEWCONFIG)){var r=e.map(function(t){var e=t[0],r=t[1];return{"ui-view fqn":e.$type+":"+e.fqn,"state: view name":r&&r.viewDecl.$context.name+": "+r.viewDecl.$name+" ("+r.viewDecl.$type+")"}}).sort(function(t,e){return t["ui-view fqn"].localeCompare(e["ui-view fqn"])});console.table(r)}},e.prototype.traceViewServiceEvent=function(e,r){this.enabled(t.Category.VIEWCONFIG)&&console.log("VIEWCONFIG: "+e+" "+Fe(r))},e.prototype.traceViewServiceUIViewEvent=function(e,r){this.enabled(t.Category.VIEWCONFIG)&&console.log("VIEWCONFIG: "+e+" "+V(r))},e}(),Be=new Ge;!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 We=function(){function t(t,e,r,n){void 0===n&&(n={}),this._identifier=t,this._definition=e,this._options=n,this._params=r||{}}return t.prototype.name=function(){return this._definition&&this._definition.name||this._identifier},t.prototype.identifier=function(){return this._identifier},t.prototype.params=function(){return this._params},t.prototype.$state=function(){return this._definition},t.prototype.state=function(){return this._definition&&this._definition.self},t.prototype.options=function(){return this._options},t.prototype.exists=function(){return!(!this._definition||!this._definition.self)},t.prototype.valid=function(){return!this.error()},t.prototype.error=function(){var t=this.options().relative;if(!this._definition&&t){var e=t.name?t.name:t;return"Could not resolve '"+this.name()+"' from state '"+e+"'"}return this._definition?this._definition.self?void 0:"State '"+this.name()+"' has an invalid definition":"No such state '"+this.name()+"'"},t.prototype.toString=function(){return"'"+this.name()+"'"+he(this.params())},t.isDef=function(t){return t&&t.state&&(te(t.state)||te(t.state.name))},t}(),ze={current:l,transition:null,traceData:{},bind:null},Je=function(){function e(e,r,n,i){var o=this;this.transition=e,this.stateContext=r,this.registeredHook=n,this.options=i,this.isSuperseded=function(){return o.type.hookPhase===t.TransitionHookPhase.RUN&&!o.options.transition.isActive()},this.options=m(i,ze),this.type=n.eventType}return e.prototype.logError=function(t){this.transition.router.stateService.defaultErrorHandler()(t)},e.prototype.invokeHook=function(){var t=this,e=this.registeredHook;if(!e._deregistered){var r=this.getNotCurrentRejection();if(r)return r;var n=this.options;Be.traceHookInvocation(this,this.transition,n);var i=function(t){return Ne.normalize(t).toPromise()},o=function(r){return e.eventType.getErrorHandler(t)(r)},a=function(r){return e.eventType.getResultHandler(t)(r)};try{var u=function(){return e.callback.call(n.bind,t.transition,t.stateContext)}();return!this.type.synchronous&&ae(u)?u.catch(i).then(a,o):a(u)}catch(t){return o(Ne.normalize(t))}}},e.prototype.handleHookResult=function(t){var e=this,r=this.getNotCurrentRejection();return r||(ae(t)?t.then(function(t){return e.handleHookResult(t)}):(Be.traceHookResult(t,this.transition,this.options),!1===t?Ne.aborted("Hook aborted transition").toPromise():Ut(We)(t)?Ne.redirected(t).toPromise():void 0))},e.prototype.getNotCurrentRejection=function(){var t=this.transition.router;return t._disposed?Ne.aborted("UIRouter instance #"+t.$id+" has been stopped (disposed)").toPromise():this.transition._aborted?Ne.aborted().toPromise():this.isSuperseded()?Ne.superseded(this.options.current()).toPromise():void 0},e.prototype.toString=function(){var t=this,e=t.options,r=t.registeredHook;return(qt("traceData.hookType")(e)||"internal")+" context: "+(qt("traceData.context.state.name")(e)||qt("traceData.context")(e)||"unknown")+", "+G(200,J(r.callback))},e.chain=function(t,e){var r=function(t,e){return t.then(function(){return e.invokeHook()})};return t.reduce(r,e||se.$q.when())},e.invokeHooks=function(t,r){for(var n=0;n20)throw new Error("Too many consecutive Transition redirects (20+)");var n={redirectedFrom:this,source:"redirect"};"url"===this.options().source&&!1!==t.options().location&&(n.location="replace");var i=ve({},this.options(),t.options(),n);t=new We(t.identifier(),t.$state(),t.params(),i);var o=this.router.transitionService.create(this._treeChanges.from,t),a=this._treeChanges.entering,u=o._treeChanges.entering;return rr.matching(u,a,rr.nonDynamicParams).filter(Dt(function(t){return function(e){return t&&e.state.includes[t.name]}}(t.options().reloadState))).forEach(function(t,e){t.resolvables=a[e].resolvables}),o},e.prototype._changedParams=function(){var t=this._treeChanges;if(!this._options.reload&&!t.exiting.length&&!t.entering.length&&t.to.length===t.from.length){if(!T(t.to,t.from).map(function(t){return t[0].state!==t[1].state}).reduce(Te,!1)){var e=t.to.map(function(t){return t.paramSchema}),r=[t.to,t.from].map(function(t){return t.map(function(t){return t.paramValues})});return T(e,r[0],r[1]).map(function(t){var e=t[0],r=t[1],n=t[2];return tr.changed(e,r,n)}).reduce(Ce,[])}}},e.prototype.dynamic=function(){var t=this._changedParams();return!!t&&t.map(function(t){return t.dynamic}).reduce(Te,!1)},e.prototype.ignored=function(){return!!this._ignoredReason()},e.prototype._ignoredReason=function(){var t=this.router.globals.transition,e=this._options.reloadState,r=function(t,r){if(t.length!==r.length)return!1;var n=rr.matching(t,r);return t.length===n.filter(function(t){return!e||!t.state.includes[e.name]}).length},n=this.treeChanges(),i=t&&t.treeChanges();return i&&r(i.to,n.to)&&r(i.exiting,n.exiting)?"SameAsPending":0===n.exiting.length&&0===n.entering.length&&r(n.from,n.to)?"SameAsCurrent":void 0},e.prototype.run=function(){var e=this,r=Je.runAllHooks,n=function(t){return e._hookBuilder.buildHooksForPhase(t)},i=function(){Be.traceSuccess(e.$to(),e),e.success=!0,e._deferred.resolve(e.to()),r(n(t.TransitionHookPhase.SUCCESS))},o=function(i){Be.traceError(i,e),e.success=!1,e._deferred.reject(i),e._error=i,r(n(t.TransitionHookPhase.ERROR))},a=function(){var e=n(t.TransitionHookPhase.RUN),r=function(){return se.$q.when(void 0)};return Je.invokeHooks(e,r)},u=function(){var t=e.router.globals;return t.lastStartedTransitionId=e.$id,t.transition=e,t.transitionHistory.enqueue(e),Be.traceTransitionStart(e),se.$q.when(void 0)},s=n(t.TransitionHookPhase.BEFORE);return Je.invokeHooks(s,u).then(a).then(i,o),this.promise},e.prototype.valid=function(){return!this.error()||void 0!==this.success},e.prototype.abort=function(){Jt(this.success)&&(this._aborted=!0)},e.prototype.error=function(){var t=this.$to();if(t.self.abstract)return"Cannot transition to abstract state '"+t.name+"'";var e=t.parameters(),r=this.params(),n=e.filter(function(t){return!t.validates(r[t.id])});return n.length?"Param values not valid for state '"+t.name+"'. Invalid params: [ "+n.map(function(t){return t.id}).join(", ")+" ]":!1===this.success?this._error:void 0},e.prototype.toString=function(){var t=this.from(),e=this.to(),r=function(t){return null!==t["#"]&&void 0!==t["#"]?t:w(t,["#"])};return"Transition#"+this.$id+"( '"+(ee(t)?t.name:t)+"'"+he(r(this._treeChanges.from.map(At("paramValues")).reduce(Se,{})))+" -> "+(this.valid()?"":"(X) ")+"'"+(ee(e)?e.name:e)+"'"+he(r(this.params()))+" )"},e.diToken=e,e}(),dr=null,vr=function(t){var e=Ne.isRejectionPromise;return(dr=dr||s([[Dt(Qt),Mt("undefined")],[Kt,Mt("null")],[ae,Mt("[Promise]")],[e,function(t){return t._transitionRejection.toString()}],[Ut(Ne),u("toString")],[Ut(pr),u("toString")],[Ut(ir),u("toString")],[c,z],[Mt(!0),f]]))(t)},mr=function(t){return function(e){if(!e)return["",""];var r=e.indexOf(t);return-1===r?[e,""]:[e.substr(0,r),e.substr(r+1)]}},yr=function(){function t(){this.enqueue=!0,this.typeQueue=[],this.defaultTypes=g(t.prototype,["hash","string","query","path","int","bool","date","json","any"]);var e=function(t,e){return new Ye(ve({name:e},t))};this.types=ye(b(this.defaultTypes,e),{})}return t.prototype.dispose=function(){this.types={}},t.prototype.type=function(t,e,r){if(!Qt(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(ve({name:t},e)),r&&(this.typeQueue.push({name:t,def:r}),this.enqueue||this._flushTypeQueue()),this},t.prototype._flushTypeQueue=function(){for(;this.typeQueue.length;){var t=this.typeQueue.shift();if(t.pattern)throw new Error("You cannot override a type's .pattern at runtime.");ve(this.types[t.name],se.$injector.invoke(t.def))}},t}();!function(){var t=function(t){var e=function(t){return null!=t?t.toString():t},r={encode:e,decode:e,is:Ut(String),pattern:/.*/,equals:function(t,e){return t==e}};return ve({},r,t)};ve(yr.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!Yt(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:Ut(Boolean),pattern:/0|1/}),date:t({encode:function(t){return this.is(t)?[t.getFullYear(),("0"+(t.getMonth()+1)).slice(-2),("0"+t.getDate()).slice(-2)].join("-"):void 0},decode:function(t){if(this.is(t))return t;var e=this.capture.exec(t);return e?new Date(e[1],e[2]-1,e[3]):void 0},is:function(t){return t instanceof Date&&!isNaN(t.valueOf())},equals:function(t,e){return["getFullYear","getMonth","getDate"].reduce(function(r,n){return r&&t[n]()===e[n]()},!0)},pattern:/[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,capture:/([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/}),json:t({encode:he,decode:le,is:Ut(Object),equals:me,pattern:/[^\/]*/}),any:t({encode:f,decode:f,is:function(){return!0},equals:me})})}();var gr,wr=function(){function t(t){void 0===t&&(t={}),ve(this,t)}return t.prototype.$inherit=function(t,e,r){var n,i=y(e,r),o={},a=[];for(var u in i)if(i[u]&&i[u].params&&(n=Object.keys(i[u].params),n.length))for(var s in n)a.indexOf(n[s])>=0||(a.push(n[s]),o[n[s]]=this[n[s]]);return ve({},o,t)},t}(),_r=function(t){if(!te(t))return!1;var e="^"===t.charAt(0);return{val:e?t.substring(1):t,root:e}},$r=function(t,e){return function(r){var n=r;n&&n.url&&n.name&&n.name.match(/\.\*\*$/)&&(n.url+="{remainder:any}");var i=_r(n.url),o=r.parent,a=i?t.compile(i.val,{params:r.params||{},paramMap:function(t,e){return!1===n.reloadOnSearch&&e&&(t=ve(t||{},{dynamic:!0})),t}}):n.url;if(!a)return null;if(!t.isMatcher(a))throw new Error("Invalid url '"+a+"' in state '"+r+"'");return i&&i.root?a:(o&&o.navigable||e()).url.append(a)}},Sr=function(t){return function(e){return!t(e)&&e.url?e:e.parent?e.parent.navigable:null}},br=function(t){return function(e){var r=function(e,r){return t.fromConfig(r,null,e)},n=e.url&&e.url.parameters({inherit:!1})||[],i=Re(be(w(e.params||{},n.map(At("id"))),r));return n.concat(i).map(function(t){return[t.id,t]}).reduce(C,{})}},Rr=function(){function t(t,e){function r(e){return o(e)?null:t.find(n.parentName(e))||i()}this.matcher=t;var n=this,i=function(){return t.find("")},o=function(t){return""===t.name};this.builders={name:[Z],self:[X],parent:[r],data:[tt],url:[$r(e,i)],navigable:[Sr(o)],params:[br(e.paramFactory)],views:[],path:[et],includes:[rt],resolvables:[nt]}}return t.prototype.builder=function(t,e){var r=this.builders,n=r[t]||[];return te(t)&&!Qt(e)?n.length>1?n:n[0]:te(t)&&Zt(e)?(r[t]=n,r[t].push(e),function(){return r[t].splice(r[t].indexOf(e,1))&&null}):void 0},t.prototype.build=function(t){var e=this,r=e.matcher,n=e.builders,i=this.parentName(t);if(i&&!r.find(i,void 0,!1))return null;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o].reduce(function(t,e){return function(r){return e(r,t)}},l);t[o]=a(t)}return t},t.prototype.parentName=function(t){var e=t.name||"",r=e.split(".");if("**"===r.pop()&&r.pop(),r.length){if(t.parent)throw new Error("States that specify the 'parent:' property should not have a '.' in their name ("+e+")");return r.join(".")}return t.parent?te(t.parent)?t.parent:t.parent.name:""},t.prototype.name=function(t){var e=t.name;if(-1!==e.indexOf(".")||!t.parent)return e;var r=te(t.parent)?t.parent:t.parent.name;return r?r+"."+e:e},t}(),Er=function(){function t(t){this._states=t}return t.prototype.isRelative=function(t){return t=t||"",0===t.indexOf(".")||0===t.indexOf("^")},t.prototype.find=function(t,e,r){if(void 0===r&&(r=!0),t||""===t){var n=te(t),i=n?t:t.name;this.isRelative(i)&&(i=this.resolvePath(i,e));var o=this._states[i];if(o&&(n||!(n||o!==t&&o.self!==t)))return o;if(n&&r){var a=Re(this._states),u=a.filter(function(t){return t.__stateObjectCache.nameGlob&&t.__stateObjectCache.nameGlob.matches(i)});return u.length>1&&console.log("stateMatcher.find: Found multiple matches for "+i+" using glob: ",u.map(function(t){return t.name})),u[0]}}},t.prototype.resolvePath=function(t,e){if(!e)throw new Error("No reference point given for path '"+t+"'");for(var r=this.find(e),n=t.split("."),i=0,o=n.length,a=r;i0;){var c=r.shift(),f=c.name,l=i.build(c),h=a.indexOf(c);if(l){var p=s(f);if(p&&p.name===f)throw new Error("State '"+f+"' is already defined");var d=s(f+".**");d&&this.$registry.deregister(d),n[f]=c,this.attachRoute(c),h>=0&&a.splice(h,1),o.push(c)}else{var v=u[f];if(u[f]=r.length,h>=0&&v===r.length)return r.push(c),n;h<0&&a.push(c),r.push(c)}}return o.length&&this.listeners.forEach(function(t){return t("registered",o.map(function(t){return t.self}))}),n},t.prototype.attachRoute=function(t){!t.abstract&&t.url&&this.$urlRouter.rule(this.$urlRouter.urlRuleFactory.create(t))},t}(),Cr=function(){function t(t){this._router=t,this.states={},this.listeners=[],this.matcher=new Er(this.states),this.builder=new Rr(this.matcher,t.urlMatcherFactory),this.stateQueue=new Tr(this,t.urlRouter,this.states,this.builder,this.listeners),this._registerRoot()}return t.prototype._registerRoot=function(){var t={name:"",url:"^",views:null,params:{"#":{value:null,type:"hash",dynamic:!0}},abstract:!0};(this._root=this.stateQueue.register(t)).navigable=null},t.prototype.dispose=function(){var t=this;this.stateQueue.dispose(),this.listeners=[],this.get().forEach(function(e){return t.get(e)&&t.deregister(e)})},t.prototype.onStatesChanged=function(t){return this.listeners.push(t),function(){we(this.listeners)(t)}.bind(this)},t.prototype.root=function(){return this._root},t.prototype.register=function(t){return this.stateQueue.register(t)},t.prototype._deregisterTree=function(t){var e=this,r=this.get().map(function(t){return t.$$state()}),n=function(t){var e=r.filter(function(e){return-1!==t.indexOf(e.parent)});return 0===e.length?e:e.concat(n(e))},i=n([t]),o=[t].concat(i).reverse();return o.forEach(function(t){var r=e._router.urlRouter;r.rules().filter(Ht("state",t)).forEach(r.removeRule.bind(r)),delete e.states[t.name]}),o},t.prototype.deregister=function(t){var e=this.get(t);if(!e)throw new Error("Can't deregister state; not found: "+t);var r=this._deregisterTree(e.$$state());return this.listeners.forEach(function(t){return t("deregistered",r.map(function(t){return t.self}))}),r},t.prototype.get=function(t,e){var r=this;if(0===arguments.length)return Object.keys(this.states).map(function(t){return r.states[t].self});var n=this.matcher.find(t,e);return n&&n.self||null},t.prototype.decorator=function(t,e){return this.builder.builder(t,e)},t}(),Pr=function(t,e,r){return t[e]=t[e]||r()},kr=K("/"),Or=function(){function e(t,r,n,i){var o=this;this.config=i,this._cache={path:[this]},this._children=[],this._params=[],this._segments=[],this._compiled=[],this.pattern=t,this.config=m(this.config,{params:{},strict:!0,caseInsensitive:!1,paramMap:f});for(var a,u,s,c=/([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,l=/([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,h=0,p=[],d=function(r){if(!e.nameValidator.test(r))throw new Error("Invalid parameter name '"+r+"' in pattern '"+t+"'");if(S(o._params,Ht("id",r)))throw new Error("Duplicate parameter name '"+r+"' in pattern '"+t+"'")},v=function(e,n){var i=e[2]||e[3],a=n?e[4]:e[4]||("*"===e[1]?"[\\s\\S]*":null);return{id:i,regexp:a,cfg:o.config.params[i],segment:t.substring(h,e.index),type:a?r.type(a)||function(t){return ye(r.type(n?"query":"path"),{pattern:new RegExp(t,o.config.caseInsensitive?"i":void 0)})}(a):null}};(a=c.exec(t))&&(u=v(a,!1),!(u.segment.indexOf("?")>=0));)d(u.id),this._params.push(n.fromPath(u.id,u.type,this.config.paramMap(u.cfg,!1))),this._segments.push(u.segment),p.push([u.segment,P(this._params)]),h=c.lastIndex;s=t.substring(h);var y=s.indexOf("?");if(y>=0){var g=s.substring(y);if(s=s.substring(0,y),g.length>0)for(h=0;a=l.exec(g);)u=v(a,!0),d(u.id),this._params.push(n.fromSearch(u.id,u.type,this.config.paramMap(u.cfg,!0))),h=c.lastIndex}this._segments.push(s),this._compiled=p.map(function(t){return it.apply(null,t)}).concat(it(s))}return e.prototype.append=function(t){return this._children.push(t),t._cache={path:this._cache.path.concat(t),parent:this,pattern:null},t},e.prototype.isRoot=function(){return this._cache.path[0]===this},e.prototype.toString=function(){return this.pattern},e.prototype.exec=function(t,e,r,n){var i=this;void 0===e&&(e={}),void 0===n&&(n={});var o=Pr(this._cache,"pattern",function(){return new RegExp(["^",Oe(i._cache.path.map(At("_compiled"))).join(""),!1===i.config.strict?"/?":"","$"].join(""),i.config.caseInsensitive?"i":void 0)}).exec(t);if(!o)return null;var a=this.parameters(),u=a.filter(function(t){return!t.isSearch()}),s=a.filter(function(t){return t.isSearch()}),c=this._cache.path.map(function(t){return t._segments.length-1}).reduce(function(t,e){return t+e}),f={};if(c!==o.length-1)throw new Error("Unbalanced capture group in route '"+this.pattern+"'");for(var l=0;ln.weight?o:n}return n},t.prototype.sync=function(t){if(!t||!t.defaultPrevented){var e=this._router,r=e.urlService,n=e.stateService,i={path:r.path(),search:r.search(),hash:r.hash()},o=this.match(i);s([[te,function(t){return r.url(t,!0)}],[We.isDef,function(t){return n.go(t.state,t.params,t.options)}],[Ut(We),function(t){return n.go(t.state(),t.params(),t.options())}]])(o&&o.rule.handler(o.match,i,e))}},t.prototype.listen=function(t){var e=this;if(!1!==t)return this._stopFn=this._stopFn||this._router.urlService.onChange(function(t){return e.sync(t)});this._stopFn&&this._stopFn(),delete this._stopFn},t.prototype.update=function(t){var e=this._router.locationService;if(t)return void(this.location=e.path());e.path()!==this.location&&e.url(this.location,!0)},t.prototype.push=function(t,e,r){var n=r&&!!r.replace;this._router.urlService.url(t.format(e||{}),n)},t.prototype.href=function(t,e,r){var n=t.format(e);if(null==n)return null;r=r||{absolute:!1};var i=this._router.urlService.config,o=i.html5Mode();if(o||null===n||(n="#"+i.hashPrefix()+n),n=ot(n,o,r.absolute,i.baseHref()),!r.absolute||!n)return n;var a=!o&&n?"/":"",u=i.port();return u=80===u||443===u?"":":"+u,[i.protocol(),"://",i.host(),u,a,n].join("")},t.prototype.rule=function(t){var e=this;if(!jr.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){we(this._rules,t)},t.prototype.rules=function(){return this.ensureSorted(),this._rules.slice()},t.prototype.otherwise=function(t){var e=at(t);this._otherwiseFn=this.urlRuleFactory.create(Mt(!0),e),this._sorted=!1},t.prototype.initial=function(t){var e=at(t),r=function(t,e){return 0===e.globals.transitionHistory.size()&&!!/^\/?$/.exec(t.path)};this.rule(this.urlRuleFactory.create(r,e))},t.prototype.when=function(t,e,r){var n=this.urlRuleFactory.create(t,e);return Qt(r&&r.priority)&&(n.priority=r.priority),this.rule(n),n},t.prototype.deferIntercept=function(t){void 0===t&&(t=!0),this.interceptDeferred=t},t}(),Nr=function(){function t(){var t=this;this._uiViews=[],this._viewConfigs=[],this._viewConfigFactories={},this._pluginapi={_rootViewContext:this._rootViewContext.bind(this),_viewConfigFactory:this._viewConfigFactory.bind(this),_registeredUIViews:function(){return t._uiViews},_activeViewConfigs:function(){return t._viewConfigs}}}return t.prototype._rootViewContext=function(t){return this._rootContext=t||this._rootContext},t.prototype._viewConfigFactory=function(t,e){this._viewConfigFactories[t]=e},t.prototype.createViewConfig=function(t,e){var r=this._viewConfigFactories[e.$type];if(!r)throw new Error("ViewService: No view config factory registered for type "+e.$type);var n=r(t,e);return re(n)?n:[n]},t.prototype.deactivateViewConfig=function(t){Be.traceViewServiceEvent("<- Removing",t),we(this._viewConfigs,t)},t.prototype.activateViewConfig=function(t){Be.traceViewServiceEvent("-> Registering",t),this._viewConfigs.push(t)},t.prototype.sync=function(){function e(t){var e=function(t){return t&&t.parent?e(t.parent)+1:1};return 1e4*t.fqn.split(".").length+e(t.creationContext)}function n(t){for(var e=t.viewDecl.$context,r=0;++r&&e.parent;)e=e.parent;return r}var i=this,o=this._uiViews.map(function(t){return[t.fqn,t]}).reduce(C,{}),a=r(function(t,e,r,n){return e*(t(r)-t(n))}),u=function(e){var r=i._viewConfigs.filter(t.matches(o,e));return r.length>1&&r.sort(a(n,-1)),[e,r[0]]},s=function(t){var e=t[0],r=t[1];-1!==i._uiViews.indexOf(e)&&e.configUpdated(r)},c=this._uiViews.sort(a(e,1)).map(u);Be.traceViewSync(c),c.forEach(s)},t.prototype.registerUIView=function(t){Be.traceViewServiceUIViewEvent("-> Registering",t);var e=this._uiViews,r=function(e){return e.fqn===t.fqn&&e.$type===t.$type};return e.filter(r).length&&Be.traceViewServiceUIViewEvent("!!!! duplicate uiView named:",t),e.push(t),this.sync(),function(){if(-1===e.indexOf(t))return void Be.traceViewServiceUIViewEvent("Tried removing non-registered uiView",t);Be.traceViewServiceUIViewEvent("<- Deregistering",t),we(e)(t)}},t.prototype.available=function(){return this._uiViews.map(At("fqn"))},t.prototype.active=function(){return this._uiViews.filter(At("$config")).map(At("name"))},t.normalizeUIViewTarget=function(t,e){void 0===e&&(e="");var r=e.split("@"),n=r[0]||"$default",i=te(r[1])?r[1]:"^",o=/^(\^(?:\.\^)*)\.(.*$)/.exec(n);(o&&(i=o[1],n=o[2]),"!"===n.charAt(0)&&(n=n.substr(1),i=""),/^(\^(?:\.\^)*)$/.exec(i))?i=i.split(".").reduce(function(t,e){return t.parent},t).name:"."===i&&(i=t.name);return{uiViewName:n,uiViewContextAnchor:i}},t.matches=function(t,e){return function(r){if(e.$type!==r.viewDecl.$type)return!1;var n=r.viewDecl,i=n.$uiViewName.split("."),o=e.fqn.split(".");if(!me(i,o.slice(0-i.length)))return!1;var a=1-i.length||void 0,u=o.slice(0,a).join("."),s=t[u].creationContext;return n.$uiViewContextAnchor===(s&&s.name)}},t}(),Fr=function(){function t(){this.params=new wr,this.lastStartedTransitionId=-1,this.transitionHistory=new qe([],1),this.successfulTransitions=new qe([],1)}return t.prototype.dispose=function(){this.transitionHistory.clear(),this.successfulTransitions.clear(),this.transition=null},t}(),Ur=function(t){return t.reduce(function(t,e){return t[e]=ue(e),t},{dispose:l})},Lr=["url","path","search","hash","onChange"],Mr=["port","protocol","host","baseHref","html5Mode","hashPrefix"],Gr=["type","caseInsensitive","strictMode","defaultSquashPolicy"],Br=["sort","when","initial","otherwise","rules","rule","removeRule"],Wr=["deferIntercept","listen","sync","match"],zr=function(){function t(t,e){void 0===e&&(e=!0),this.router=t,this.rules={},this.config={};var r=function(){return t.locationService};h(r,this,r,Lr,e);var n=function(){return t.locationConfig};h(n,this.config,n,Mr,e);var i=function(){return t.urlMatcherFactory};h(i,this.config,i,Gr);var o=function(){return t.urlRouter};h(o,this.rules,o,Br),h(o,this,o,Wr)}return t.prototype.url=function(t,e,r){},t.prototype.path=function(){},t.prototype.search=function(){},t.prototype.hash=function(){},t.prototype.onChange=function(t){},t.prototype.parts=function(){return{path:this.path(),search:this.search(),hash:this.hash()}},t.prototype.dispose=function(){},t.prototype.sync=function(t){},t.prototype.listen=function(t){},t.prototype.deferIntercept=function(t){},t.prototype.match=function(t){},t.locationServiceStub=Ur(Lr),t.locationConfigStub=Ur(Mr),t}(),Jr=0,Qr=function(){function t(t,e){void 0===t&&(t=zr.locationServiceStub),void 0===e&&(e=zr.locationConfigStub),this.locationService=t,this.locationConfig=e,this.$id=Jr++,this._disposed=!1,this._disposables=[],this.trace=Be,this.viewService=new Nr,this.transitionService=new Rn(this),this.globals=new Fr,this.urlMatcherFactory=new xr,this.urlRouter=new Dr(this),this.stateRegistry=new Cr(this),this.stateService=new En(this),this.urlService=new zr(this),this._plugins={},this.viewService._pluginapi._rootViewContext(this.stateRegistry.root()),this.globals.$current=this.stateRegistry.root(),this.globals.current=this.globals.$current.self,this.disposable(this.globals),this.disposable(this.stateService),this.disposable(this.stateRegistry),this.disposable(this.transitionService),this.disposable(this.urlRouter),this.disposable(t),this.disposable(e)}return t.prototype.disposable=function(t){this._disposables.push(t)},t.prototype.dispose=function(t){var e=this;if(t&&Zt(t.dispose))return void t.dispose(this);this._disposed=!0,this._disposables.slice().forEach(function(t){try{"function"==typeof t.dispose&&t.dispose(e),we(e._disposables,t)}catch(t){}})},t.prototype.plugin=function(t,e){void 0===e&&(e={});var r=new t(this,e);if(!r.name)throw new Error("Required property `name` missing on plugin: "+r);return this._disposables.push(r),this._plugins[r.name]=r},t.prototype.getPlugin=function(t){return t?this._plugins[t]:Re(this._plugins)},t}(),Kr=function(t){return t.onCreate({},ut)},Yr=function(t){function e(e){if(e)return e instanceof We?e:te(e)?n.target(e,t.params(),t.options()):e.state||e.params?n.target(e.state||t.to(),e.params||t.params(),t.options()):void 0}var r=t.to().redirectTo;if(r){var n=t.router.stateService;return Zt(r)?se.$q.when(r(t)).then(e):e(r)}},Zr=function(t){return t.onStart({to:function(t){return!!t.redirectTo}},Yr)},Xr=st("onExit"),tn=function(t){return t.onExit({exiting:function(t){return!!t.onExit}},Xr)},en=st("onRetain"),rn=function(t){return t.onRetain({retained:function(t){return!!t.onRetain}},en)},nn=st("onEnter"),on=function(t){return t.onEnter({entering:function(t){return!!t.onEnter}},nn)},an=function(t){return new fr(t.treeChanges().to).resolvePath("EAGER",t).then(l)},un=function(t){return t.onStart({},an,{priority:1e3})},sn=function(t,e){return new fr(t.treeChanges().to).subContext(e.$$state()).resolvePath("LAZY",t).then(l)},cn=function(t){return t.onEnter({entering:Mt(!0)},sn,{priority:1e3})},fn=function(t){var e=se.$q,r=t.views("entering");if(r.length)return e.all(r.map(function(t){return e.when(t.load())})).then(l)},ln=function(t){return t.onFinish({},fn)},hn=function(t){var e=t.views("entering"),r=t.views("exiting");if(e.length||r.length){var n=t.router.viewService;r.forEach(function(t){return n.deactivateViewConfig(t)}),e.forEach(function(t){return n.activateViewConfig(t)}),n.sync()}},pn=function(t){return t.onSuccess({},hn)},dn=function(t){var e=t.router.globals,r=function(){e.successfulTransitions.enqueue(t),e.$current=t.$to(),e.current=e.$current.self,pe(t.params(),e.params)},n=function(){e.transition===t&&(e.transition=null)};t.onSuccess({},r,{priority:1e4}),t.promise.then(n,n)},vn=function(t){return t.onCreate({},dn)},mn=function(t){var e=t.options(),r=t.router.stateService,n=t.router.urlRouter;if("url"!==e.source&&e.location&&r.$current.navigable){var i={replace:"replace"===e.location};n.push(r.$current.navigable.url,r.params,i)}n.update(!0)},yn=function(t){return t.onSuccess({},mn,{priority:9999})},gn=function(t){function e(){if("url"!==t.originalTransition().options().source){var e=t.targetState();return r.stateService.target(e.identifier(),e.params(),e.options())}var n=r.urlService,i=n.match(n.parts()),o=i&&i.rule;if(o&&"STATE"===o.type){var a=o.state,u=i.match;return r.stateService.target(a,u,t.options())}r.urlService.sync()}var r=t.router,n=t.entering().filter(function(t){return!!t.$$state().lazyLoad}).map(function(e){return ct(t,e)});return se.$q.all(n).then(e)},wn=function(t){return t.onBefore({entering:function(t){return!!t.lazyLoad}},gn)},_n=function(){function t(t,e,r,n,i,o,a,u){void 0===i&&(i=!1),void 0===o&&(o=Je.HANDLE_RESULT),void 0===a&&(a=Je.REJECT_ERROR),void 0===u&&(u=!1),this.name=t,this.hookPhase=e,this.hookOrder=r,this.criteriaMatchPath=n,this.reverseSort=i,this.getResultHandler=o,this.getErrorHandler=a,this.synchronous=u}return t}(),$n=function(t){return t.onBefore({},ft,{priority:-9999})},Sn=function(t){return t.onBefore({},lt,{priority:-1e4})},bn={location:!0,relative:null,inherit:!1,notify:!0,reload:!1,custom:{},current:function(){return null},source:"unknown"},Rn=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(Mt(this),{},Mt(this),["_definePathType","_defineEvent","_getPathTypes","_getEvents","getHooks"]),this._defineCorePaths(),this._defineCoreEvents(),this._registerCoreTransitionHooks()}return e.prototype.onCreate=function(t,e,r){},e.prototype.onBefore=function(t,e,r){},e.prototype.onStart=function(t,e,r){},e.prototype.onExit=function(t,e,r){},e.prototype.onRetain=function(t,e,r){},e.prototype.onEnter=function(t,e,r){},e.prototype.onFinish=function(t,e,r){},e.prototype.onSuccess=function(t,e,r){},e.prototype.onError=function(t,e,r){},e.prototype.dispose=function(t){Re(this._registeredHooks).forEach(function(t){return t.forEach(function(e){e._deregistered=!0,we(t,e)})})},e.prototype.create=function(t,e){return new pr(t,e,this._router)},e.prototype._defineCoreEvents=function(){var e=t.TransitionHookPhase,r=Je,n=this._criteriaPaths;this._defineEvent("onCreate",e.CREATE,0,n.to,!1,r.LOG_REJECTED_RESULT,r.THROW_ERROR,!0),this._defineEvent("onBefore",e.BEFORE,0,n.to),this._defineEvent("onStart",e.RUN,0,n.to),this._defineEvent("onExit",e.RUN,100,n.exiting,!0),this._defineEvent("onRetain",e.RUN,200,n.retained),this._defineEvent("onEnter",e.RUN,300,n.entering),this._defineEvent("onFinish",e.RUN,400,n.to),this._defineEvent("onSuccess",e.SUCCESS,0,n.to,!1,r.LOG_REJECTED_RESULT,r.LOG_ERROR,!0),this._defineEvent("onError",e.ERROR,0,n.to,!1,r.LOG_REJECTED_RESULT,r.LOG_ERROR,!0)},e.prototype._defineCorePaths=function(){var e=t.TransitionHookScope.STATE,r=t.TransitionHookScope.TRANSITION;this._definePathType("to",r),this._definePathType("from",r),this._definePathType("exiting",e),this._definePathType("retained",e),this._definePathType("entering",e)},e.prototype._defineEvent=function(t,e,r,n,i,o,a,u){void 0===i&&(i=!1),void 0===o&&(o=Je.HANDLE_RESULT),void 0===a&&(a=Je.REJECT_ERROR),void 0===u&&(u=!1);var s=new _n(t,e,r,n,i,o,a,u);this._eventTypes.push(s),q(this,this,s)},e.prototype._getEvents=function(t){return(Qt(t)?this._eventTypes.filter(function(e){return e.hookPhase===t}):this._eventTypes.slice()).sort(function(t,e){var r=t.hookPhase-e.hookPhase;return 0===r?t.hookOrder-e.hookOrder:r})},e.prototype._definePathType=function(t,e){this._criteriaPaths[t]={name:t,scope:e}},e.prototype._getPathTypes=function(){return this._criteriaPaths},e.prototype.getHooks=function(t){return this._registeredHooks[t]},e.prototype._registerCoreTransitionHooks=function(){var t=this._deregisterHookFns;t.addCoreResolves=Kr(this),t.ignored=$n(this),t.invalid=Sn(this),t.redirectTo=Zr(this),t.onExit=tn(this),t.onRetain=rn(this),t.onEnter=on(this),t.eagerResolve=un(this),t.lazyResolve=cn(this),t.loadViews=ln(this),t.activateViews=pn(this),t.updateGlobals=vn(this),t.updateUrl=yn(this),t.lazyLoad=wn(this)},e}(),En=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 Ne?(console.error(t.toString()),t.detail&&t.detail.stack&&console.error(t.detail.stack)):console.error(t)};var r=["current","$current","params","transition"],n=Object.keys(e.prototype).filter(Dt(ge(r)));h(Mt(e.prototype),this,Mt(this),n)}return Object.defineProperty(e.prototype,"transition",{get:function(){return this.router.globals.transition},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"params",{get:function(){return this.router.globals.params},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"current",{get:function(){return this.router.globals.current},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"$current",{get:function(){return this.router.globals.$current},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.defaultErrorHandler(l),this.invalidCallbacks=[]},e.prototype._handleInvalidTargetState=function(t,e){function r(){var t=s.dequeue();return void 0===t?Ne.invalid(e.error()).toPromise():se.$q.when(t(e,i,c)).then(f).then(function(t){return t||r()})}var n=this,i=rr.makeTargetState(t),o=this.router.globals,a=function(){return o.transitionHistory.peekTail()},u=a(),s=new qe(this.invalidCallbacks.slice()),c=new fr(t).injector(),f=function(t){if(t instanceof We){var e=t;return e=n.target(e.identifier(),e.params(),e.options()),e.valid()?a()!==u?Ne.superseded().toPromise():n.transitionTo(e.identifier(),e.params(),e.options()):Ne.invalid(e.error()).toPromise()}};return r()},e.prototype.onInvalid=function(t){return this.invalidCallbacks.push(t),function(){we(this.invalidCallbacks)(t)}.bind(this)},e.prototype.reload=function(t){return this.transitionTo(this.current,this.params,{reload:!Qt(t)||t,inherit:!1,notify:!1})},e.prototype.go=function(t,e,r){var n={relative:this.$current,inherit:!0},i=m(r,n,bn);return this.transitionTo(t,e,i)},e.prototype.target=function(t,e,r){if(void 0===r&&(r={}),ee(r.reload)&&!r.reload.name)throw new Error("Invalid reload state object");var n=this.router.stateRegistry;if(r.reloadState=!0===r.reload?n.root():n.matcher.find(r.reload,r.relative),r.reload&&!r.reloadState)throw new Error("No such reload state '"+(te(r.reload)?r.reload:r.reload.name)+"'");var i=n.matcher.find(t,r.relative);return new We(t,i,e,r)},e.prototype.getCurrentPath=function(){var t=this,e=this.router.globals,r=e.successfulTransitions.peekTail();return r?r.treeChanges().to:function(){return[new er(t.router.stateRegistry.root())]}()},e.prototype.transitionTo=function(e,r,n){var i=this;void 0===r&&(r={}),void 0===n&&(n={});var o=this.router,a=o.globals;n=m(n,bn),n=ve(n,{current:function(){return a.transition}});var u=this.target(e,r,n),s=this.getCurrentPath();if(!u.exists())return this._handleInvalidTargetState(s,u);if(!u.valid())return He(u.error());var c=function(e){return function(r){if(r instanceof Ne){var n=o.globals.lastStartedTransitionId===e.$id;if(r.type===t.RejectType.IGNORED)return n&&o.urlRouter.update(),se.$q.when(a.current);var u=r.detail;if(r.type===t.RejectType.SUPERSEDED&&r.redirected&&u instanceof We){var s=e.redirect(u);return s.run().catch(c(s))}if(r.type===t.RejectType.ABORTED)return n&&o.urlRouter.update(),se.$q.reject(r)}return i.defaultErrorHandler()(r),se.$q.reject(r)}},f=this.router.transitionService.create(s,u),l=f.run().catch(c(f));return Ae(l),ve(l,{transition:f})},e.prototype.is=function(t,e,r){r=m(r,{relative:this.$current});var n=this.router.stateRegistry.matcher.find(t,r.relative);if(Qt(n)){if(this.$current!==n)return!1;if(!e)return!0;var i=n.parameters({inherit:!0,matchingKeys:e});return tr.equals(i,tr.values(i,e),this.params)}},e.prototype.includes=function(t,e,r){r=m(r,{relative:this.$current});var n=te(t)&&Gt.fromString(t);if(n){if(!n.matches(this.$current.name))return!1;t=this.$current.name}var i=this.router.stateRegistry.matcher.find(t,r.relative),o=this.$current.includes;if(Qt(i)){if(!Qt(o[i.name]))return!1;if(!e)return!0;var a=i.parameters({inherit:!0,matchingKeys:e});return tr.equals(a,tr.values(a,e),this.params)}},e.prototype.href=function(t,e,r){r=m(r,{lossy:!0,inherit:!0,absolute:!1,relative:this.$current}),e=e||{};var n=this.router.stateRegistry.matcher.find(t,r.relative);if(!Qt(n))return null;r.inherit&&(e=this.params.$inherit(e,this.$current,n));var i=n&&r.lossy?n.navigable:n;return i&&void 0!==i.url&&null!==i.url?this.router.urlRouter.href(i.url,e,{absolute:r.absolute}):null},e.prototype.defaultErrorHandler=function(t){return this._defaultErrorHandler=t||this._defaultErrorHandler},e.prototype.get=function(t,e){var r=this.router.stateRegistry;return 0===arguments.length?r.get():r.get(t,e||this.$current)},e.prototype.lazyLoad=function(t,e){var r=this.get(t);if(!r||!r.lazyLoad)throw new Error("Can not lazy load "+t);var n=this.getCurrentPath(),i=rr.makeTargetState(n);return e=e||this.router.transitionService.create(n,i),ct(e,r)},e}(),Tn={when:function(t){return new Promise(function(e,r){return e(t)})},reject:function(t){return new Promise(function(e,r){r(t)})},defer:function(){var t={};return t.promise=new Promise(function(e,r){t.resolve=e,t.reject=r}),t},all:function(t){if(re(t))return Promise.all(t);if(ee(t)){var e=Object.keys(t).map(function(e){return t[e].then(function(t){return{key:e,val:t}})});return Tn.all(e).then(function(t){return t.reduce(function(t,e){return t[e.key]=e.val,t},{})})}}},Cn={},Pn=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,kn=/([^\s,]+)/g,On={get:function(t){return Cn[t]},has:function(t){return null!=On.get(t)},invoke:function(t,e,r){var n=ve({},Cn,r||{}),i=On.annotate(t),o=je(function(t){return n.hasOwnProperty(t)},function(t){return"DI can't find injectable: '"+t+"'"}),a=i.filter(o).map(function(t){return n[t]});return Zt(t)?t.apply(e,a):t.slice(-1)[0].apply(e,a)},annotate:function(t){if(!c(t))throw new Error("Not an injectable function: "+t);if(t&&t.$inject)return t.$inject;if(re(t))return t.slice(0,-1);var e=t.toString().replace(Pn,"");return e.slice(e.indexOf("(")+1,e.indexOf(")")).match(kn)||[]}},xn=function(t){return function(e){if(!e)return["",""];var r=e.indexOf(t);return-1===r?[e,""]:[e.substr(0,r),e.substr(r+1)]}},jn=xn("#"),In=xn("?"),Vn=xn("="),An=function(t){return t?t.replace(/^#/,""):""},Hn=function(t,e){var r=e[0],n=e[1];return t.hasOwnProperty(r)?re(t[r])?t[r].push(n):t[r]=[t[r],n]:t[r]=n,t},qn=function(t){return t.split("&").filter(f).map(Vn).reduce(Hn,{})},Dn=function(t){var e=t.path(),r=t.search(),n=t.hash(),i=Object.keys(r).map(function(t){var e=r[t];return(re(e)?e:[e]).map(function(e){return t+"="+e})}).reduce(Ce,[]).join("&");return e+(i?"?"+i:"")+(n?"#"+n:"")},Nn=function(){function t(t,e){var r=this;this.fireAfterUpdate=e,this._listener=function(t){return r._listeners.forEach(function(e){return e(t)})},this._listeners=[],this.hash=function(){return ht(r._get()).hash},this.path=function(){return ht(r._get()).path},this.search=function(){return qn(ht(r._get()).search)},this._location=window&&window.location,this._history=window&&window.history}return t.prototype.url=function(t,e){if(void 0===e&&(e=!0),Qt(t)&&t!==this._get()&&(this._set(null,null,t,e),this.fireAfterUpdate)){var r=ve(new Event("locationchange"),{url:t});this._listeners.forEach(function(t){return t(r)})}return Dn(this)},t.prototype.onChange=function(t){var e=this;return this._listeners.push(t),function(){return we(e._listeners,t)}},t.prototype.dispose=function(t){$e(this._listeners)},t}(),Fn=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Un=function(t){function e(e){var r=t.call(this,e,!1)||this;return window.addEventListener("hashchange",r._listener,!1),r}return Fn(e,t),e.prototype._get=function(){return An(this._location.hash)},e.prototype._set=function(t,e,r,n){this._location.hash=r},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),window.removeEventListener("hashchange",this._listener)},e}(Nn),Ln=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Mn=function(t){function e(e){return t.call(this,e,!0)||this}return Ln(e,t),e.prototype._get=function(){return this._url},e.prototype._set=function(t,e,r,n){this._url=r},e}(Nn),Gn=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Bn=function(t){function e(e){var r=t.call(this,e,!0)||this;return r._config=e.urlService.config,window.addEventListener("popstate",r._listener,!1),r}return Gn(e,t),e.prototype._get=function(){var t=this._location,e=t.pathname,r=t.hash,n=t.search;return n=In(n)[1],r=jn(r)[1],e+(n?"?"+n:"")+(r?"$"+n:"")},e.prototype._set=function(t,e,r,n){var i=this,o=i._config,a=i._history,u=o.baseHref()+r;n?a.replaceState(t,e,u):a.pushState(t,e,u)},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),window.removeEventListener("popstate",this._listener)},e}(Nn),Wn=function(){function t(){var t=this;this._baseHref="",this._port=80,this._protocol="http",this._host="localhost",this._hashPrefix="",this.port=function(){return t._port},this.protocol=function(){return t._protocol},this.host=function(){return t._host},this.baseHref=function(){return t._baseHref},this.html5Mode=function(){return!1},this.hashPrefix=function(e){return Qt(e)?t._hashPrefix=e:t._hashPrefix},this.dispose=l}return t}(),zn=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 Qt(t)?this._hashPrefix=t:this._hashPrefix},t.prototype.baseHref=function(t){return Qt(t)?this._baseHref=t:this._baseHref||this.applyDocumentBaseHref()},t.prototype.applyDocumentBaseHref=function(){var t=document.getElementsByTagName("base");return this._baseHref=t.length?t[0].href.substr(location.origin.length):""},t.prototype.dispose=function(){},t}(),Jn=pt("vanilla.hashBangLocation",!1,Un,zn),Qn=pt("vanilla.pushStateLocation",!0,Bn,zn),Kn=pt("vanilla.memoryLocation",!1,Mn,Wn),Yn=function(){function t(){}return t.prototype.dispose=function(t){},t}(),Zn=Object.freeze({fromJson:le,toJson:he,copy:pe,forEach:de,extend:ve,equals:me,identity:f,noop:l,createProxyFunctions:h,inherit:ye,inArray:ge,_inArray:p,removeFrom:we,_removeFrom:d,pushTo:_e,_pushTo:v,deregAll:$e,defaults:m,mergeR:Se,ancestors:y,pick:g,omit:w,pluck:_,filter:$,find:S,mapObj:be,map:b,values:Re,allTrueR:Ee,anyTrueR:Te,unnestR:Ce,flattenR:Pe,pushR:R,uniqR:ke,unnest:Oe,flatten:xe,assertPredicate:je,assertMap:Ie,assertFn:E,pairs:Ve,arrayTuples:T,applyPairs:C,tail:P,_extend:x,silenceUncaughtInPromise:Ae,silentRejection:He,notImplemented:ue,services:se,Glob:Gt,curry:r,compose:n,pipe:i,prop:At,propEq:Ht,parse:qt,not:Dt,and:o,or:a,all:Nt,any:Ft,is:Ut,eq:Lt,val:Mt,invoke:u,pattern:s,isUndefined:Jt,isDefined:Qt,isNull:Kt,isNullOrUndefined:Yt,isFunction:Zt,isNumber:Xt,isString:te,isObject:ee,isArray:re,isDate:ne,isRegExp:ie,isState:oe,isInjectable:c,isPromise:ae,Queue:qe,maxLength:G,padString:B,kebobString:W,functionToString:z,fnToString:J,stringify:Q,beforeAfterSubstr:mr,splitOnDelim:K,joinNeighborsR:Y,get Category(){return t.Category},Trace:Ge,trace:Be,get DefType(){return t.DefType},Param:tr,ParamTypes:yr,StateParams:wr,ParamType:Ye,PathNode:er,PathUtils:rr,resolvePolicies:or,defaultResolvePolicy:nr,Resolvable:ir,NATIVE_INJECTOR_TOKEN:cr,ResolveContext:fr,resolvablesBuilder:nt,StateBuilder:Rr,StateObject:Bt,StateMatcher:Er,StateQueueManager:Tr,StateRegistry:Cr,StateService:En,TargetState:We,get TransitionHookPhase(){return t.TransitionHookPhase},get TransitionHookScope(){return t.TransitionHookScope},HookBuilder:Ke,matchState:H,RegisteredHook:Qe,makeEvent:q,get RejectType(){return t.RejectType},Rejection:Ne,Transition:pr,TransitionHook:Je,TransitionEventType:_n,defaultTransOpts:bn,TransitionService:Rn,UrlMatcher:Or,UrlMatcherFactory:xr,UrlRouter:Dr,UrlRuleFactory:jr,BaseUrlRule:Ir,UrlService:zr,ViewService:Nr,UIRouterGlobals:Fr,UIRouter:Qr,$q:Tn,$injector:On,BaseLocationServices:Nn,HashLocationService:Un,MemoryLocationService:Mn,PushStateLocationService:Bn,MemoryLocationConfig:Wn,BrowserLocationConfig:zn,splitHash:jn,splitQuery:In,splitEqual:Vn,trimHashVal:An,keyValsToObjectR:Hn,getParams:qn,parseUrl:ht,buildUrl:Dn,locationPluginFactory:pt,servicesPlugin:dt,hashLocationPlugin:Jn,pushStateLocationPlugin:Qn,memoryLocationPlugin:Kn,UIRouterPluginBase:Yn}),Xn=function(t,e){return t.reduce(function(t,r){return t||Qt(e[r])},!1)},ti=0,ei=function(){function t(t,e,r){var n=this;this.path=t,this.viewDecl=e,this.factory=r,this.$id=ti++,this.loaded=!1,this.getTemplate=function(t,e){return n.component?n.factory.makeComponentTemplate(t,e,n.component,n.viewDecl.bindings):n.template}}return t.prototype.load=function(){var t=this,e=se.$q,r=new fr(this.path),n=this.path.reduce(function(t,e){return ve(t,e.paramValues)},{}),i={ -template:e.when(this.factory.fromConfig(this.viewDecl,n,r)),controller:e.when(this.getController(r))};return e.all(i).then(function(e){return Be.traceViewServiceEvent("Loaded",t),t.controller=e.controller,ve(t,e.template),t})},t.prototype.getController=function(t){var e=this.viewDecl.controllerProvider;if(!c(e))return this.viewDecl.controller;var r=se.$injector.annotate(e),n=re(e)?P(e):e;return new ir("",n,r).get(t)},t}(),ri=function(){function t(){var t=this;this._useHttp=Vt.version.minor<3,this.$get=["$http","$templateCache","$injector",function(e,r,n){return t.$templateRequest=n.has&&n.has("$templateRequest")&&n.get("$templateRequest"),t.$http=e,t.$templateCache=r,t}]}return t.prototype.useHttpService=function(t){this._useHttp=t},t.prototype.fromConfig=function(t,e,r){var n=function(t){return se.$q.when(t).then(function(t){return{template:t}})},i=function(t){return se.$q.when(t).then(function(t){return{component:t}})};return Qt(t.template)?n(this.fromString(t.template,e)):Qt(t.templateUrl)?n(this.fromUrl(t.templateUrl,e)):Qt(t.templateProvider)?n(this.fromProvider(t.templateProvider,e,r)):Qt(t.component)?i(t.component):Qt(t.componentProvider)?i(this.fromComponentProvider(t.componentProvider,e,r)):n("")},t.prototype.fromString=function(t,e){return Zt(t)?t(e):t},t.prototype.fromUrl=function(t,e){return Zt(t)&&(t=t(e)),null==t?null:this._useHttp?this.$http.get(t,{cache:this.$templateCache,headers:{Accept:"text/html"}}).then(function(t){return t.data}):this.$templateRequest(t)},t.prototype.fromProvider=function(t,e,r){var n=se.$injector.annotate(t),i=re(t)?P(t):t;return new ir("",i,n).get(r)},t.prototype.fromComponentProvider=function(t,e,r){var n=se.$injector.annotate(t),i=re(t)?P(t):t;return new ir("",i,n).get(r)},t.prototype.makeComponentTemplate=function(t,e,r,n){n=n||{};var i=Vt.version.minor>=3?"::":"",o=function(t){var e=W(t);return/^(x|data)-/.exec(e)?"x-"+e:e},a=function(r){var a=r.name,u=r.type,s=o(a);if(t.attr(s)&&!n[a])return s+"='"+t.attr(s)+"'";var c=n[a]||a;if("@"===u)return s+"='{{"+i+"$resolve."+c+"}}'";if("&"===u){var f=e.getResolvable(c),l=f&&f.data,h=l&&se.$injector.annotate(l)||[];return s+"='$resolve."+c+(re(l)?"["+(l.length-1)+"]":"")+"("+h.join(",")+")'"}return s+"='"+i+"$resolve."+c+"'"},u=yt(r).map(a).join(" "),s=o(r);return"<"+s+" "+u+">"},t}(),ni=function(t){return ii(ee(t.bindToController)?t.bindToController:t.scope)},ii=function(t){return Object.keys(t||{}).map(function(e){return[e,/^([=<@&])[?]?(.*)/.exec(t[e])]}).filter(function(t){return Qt(t)&&re(t[1])}).map(function(t){return{name:t[1][2]||t[0],type:t[1][1]}})},oi=function(){function t(e,r){this.stateRegistry=e,this.stateService=r,h(Mt(t.prototype),this,Mt(this))}return t.prototype.decorator=function(t,e){return this.stateRegistry.decorator(t,e)||this},t.prototype.state=function(t,e){return ee(t)?e=t:e.name=t,this.stateRegistry.register(e),this},t.prototype.onInvalid=function(t){return this.stateService.onInvalid(t)},t}(),ai=function(t){return function(e,r){function n(t,e){var r=new fr(t.treeChanges(o)),n=ve(wi(r),{$state$:e,$transition$:t});return se.$injector.invoke(i,this,n)}var i=e[t],o="onExit"===t?"from":"to";return i?n:void 0}},ui=function(){function t(t){this._urlListeners=[],this.$locationProvider=t;var e=Mt(t);h(e,this,e,["hashPrefix"])}return t.prototype.dispose=function(){},t.prototype.onChange=function(t){var e=this;return this._urlListeners.push(t),function(){return we(e._urlListeners)(t)}},t.prototype.html5Mode=function(){var t=this.$locationProvider.html5Mode();return(t=ee(t)?t.enabled:t)&&this.$sniffer.history},t.prototype.url=function(t,e,r){return void 0===e&&(e=!1),t&&this.$location.url(t),e&&this.$location.replace(),r&&this.$location.state(r),this.$location.url()},t.prototype._runtimeServices=function(t,e,r,n){var i=this;this.$location=e,this.$sniffer=r,t.$on("$locationChangeSuccess",function(t){return i._urlListeners.forEach(function(e){return e(t)})});var o=Mt(e),a=Mt(n);h(o,this,o,["replace","path","search","hash"]),h(o,this,o,["port","protocol","host"]),h(a,this,a,["baseHref"])},t.monkeyPatchPathParameterType=function(t){var e=t.urlMatcherFactory.type("path");e.encode=function(t){return null!=t?t.toString().replace(/(~|\/)/g,function(t){return{"~":"~~","/":"~2F"}[t]}):t},e.decode=function(t){return null!=t?t.toString().replace(/(~~|~2F)/g,function(t){return{"~~":"~","~2F":"/"}[t]}):t}},t}(),si=function(){function t(t){this._router=t,this._urlRouter=t.urlRouter}return t.prototype.$get=function(){var t=this._urlRouter;return t.update(!0),t.interceptDeferred||t.listen(),t},t.prototype.rule=function(t){var e=this;if(!Zt(t))throw new Error("'rule' must be a function");var r=function(){return t(se.$injector,e._router.locationService)},n=new Ir(r,f);return this._urlRouter.rule(n),this},t.prototype.otherwise=function(t){var e=this,r=this._urlRouter;if(te(t))r.otherwise(t);else{if(!Zt(t))throw new Error("'rule' must be a string or function");r.otherwise(function(){return t(se.$injector,e._router.locationService)})}return this},t.prototype.when=function(e,r){return(re(r)||Zt(r))&&(r=t.injectableHandler(this._router,r)),this._urlRouter.when(e,r),this},t.injectableHandler=function(t,e){return function(r){return se.$injector.invoke(e,null,{$match:r,$stateParams:t.globals.params})}},t.prototype.deferIntercept=function(t){this._urlRouter.deferIntercept(t)},t}();Vt.module("ui.router.angular1",[]);var ci=Vt.module("ui.router.init",[]),fi=Vt.module("ui.router.util",["ng","ui.router.init"]),li=Vt.module("ui.router.router",["ui.router.util"]),hi=Vt.module("ui.router.state",["ui.router.router","ui.router.util","ui.router.angular1"]),pi=Vt.module("ui.router",["ui.router.init","ui.router.state","ui.router.angular1"]),di=(Vt.module("ui.router.compat",["ui.router"]),null);gt.$inject=["$locationProvider"];var vi=function(t){return["$uiRouterProvider",function(e){var r=e.router[t];return r.$get=function(){return r},r}]};wt.$inject=["$injector","$q","$uiRouter"];var mi=function(t){return t.urlRouterProvider=new si(t)},yi=function(){return ve(di.stateProvider,{$get:function(){return di.stateService}})};_t.$inject=["$rootScope"],ci.provider("$uiRouter",gt),li.provider("$urlRouter",["$uiRouterProvider",mi]),fi.provider("$urlService",vi("urlService")),fi.provider("$urlMatcherFactory",["$uiRouterProvider",function(){return di.urlMatcherFactory}]),fi.provider("$templateFactory",function(){return new ri}),hi.provider("$stateRegistry",vi("stateRegistry")),hi.provider("$uiRouterGlobals",vi("globals")),hi.provider("$transitions",vi("transitionService")),hi.provider("$state",["$uiRouterProvider",yi]),hi.factory("$stateParams",["$uiRouter",function(t){return t.globals.params}]),pi.factory("$view",function(){return di.viewService}),pi.service("$trace",function(){return Be}),pi.run(_t),fi.run(["$urlMatcherFactory",function(t){}]),hi.run(["$state",function(t){}]),li.run(["$urlRouter",function(t){}]),ci.run(wt);var gi,wi=function(t){return t.getTokens().filter(te).map(function(e){var r=t.getResolvable(e);return[e,"NOWAIT"===t.getPolicy(r).async?r.promise:r.data]}).reduce(C,{})};gi=["$uiRouter","$timeout",function(t,e){var r=t.stateService;return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(n,i,o,a){function u(){var t=p();l&&l(),f&&(l=f.$$addStateInfo(t.uiState,t.uiStateParams)),null!=t.href&&o.$set(c.attr,t.href)}var s,c=Rt(i),f=a[1]||a[0],l=null,h={},p=function(){return bt(r,i,h)},d=$t(o.uiSref);h.uiState=d.state,h.uiStateOpts=o.uiSrefOpts?n.$eval(o.uiSrefOpts):{},d.paramExpr&&(n.$watch(d.paramExpr,function(t){h.uiStateParams=ve({},t),u()},!0),h.uiStateParams=ve({},n.$eval(d.paramExpr))),u(),n.$on("$destroy",t.stateRegistry.onStatesChanged(u)),n.$on("$destroy",t.transitionService.onSuccess({},u)),c.clickable&&(s=Et(i,r,e,c,p),Ct(i,n,s,h.uiStateOpts))}}}];var _i;_i=["$uiRouter","$timeout",function(t,e){var r=t.stateService;return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(n,i,o,a){function u(){var t=d();h&&h(),f&&(h=f.$$addStateInfo(t.uiState,t.uiStateParams)),null!=t.href&&o.$set(c.attr,t.href)}var s,c=Rt(i),f=a[1]||a[0],h=null,p={},d=function(){return bt(r,i,p)},v=["uiState","uiStateParams","uiStateOpts"],m=v.reduce(function(t,e){return t[e]=l,t},{});v.forEach(function(t){p[t]=o[t]?n.$eval(o[t]):null,o.$observe(t,function(e){m[t](),m[t]=n.$watch(e,function(e){p[t]=e,u()},!0)})}),u(),n.$on("$destroy",t.stateRegistry.onStatesChanged(u)),n.$on("$destroy",t.transitionService.onSuccess({},u)),c.clickable&&(s=Et(i,r,e,c,d),Ct(i,n,s,p.uiStateOpts))}}}];var $i;$i=["$state","$stateParams","$interpolate","$uiRouter",function(t,e,r,n){return{restrict:"A",controller:["$scope","$element","$attrs",function(e,i,o){function a(t){t.promise.then(s,l)}function u(e,r,n){var o=t.get(e,St(i)),a={state:o||{name:e},params:r,activeClass:n};return p.push(a),function(){we(p)(a)}}function s(){var r=function(t){return t.split(/\s/).filter(f)},n=function(t){return t.map(function(t){return t.activeClass}).map(r).reduce(Ce,[])},o=n(p).concat(r(c)).reduce(ke,[]),a=n(p.filter(function(e){return t.includes(e.state.name,e.params)})),u=!!p.filter(function(e){return t.is(e.state.name,e.params)}).length,s=u?r(c):[],l=a.concat(s).reduce(ke,[]),h=o.filter(function(t){return!ge(l,t)});e.$evalAsync(function(){l.forEach(function(t){return i.addClass(t)}),h.forEach(function(t){return i.removeClass(t)})})}var c,h,p=[];c=r(o.uiSrefActiveEq||"",!1)(e);try{h=e.$eval(o.uiSrefActive)}catch(t){}h=h||r(o.uiSrefActive||"",!1)(e),ee(h)&&de(h,function(t,r){if(te(t)){var n=$t(t);u(n.state,e.$eval(n.paramExpr),r)}}),this.$$addStateInfo=function(t,e){if(!(ee(h)&&p.length>0)){var r=u(t,e,h);return s(),r}},e.$on("$stateChangeSuccess",s),e.$on("$destroy",n.transitionService.onStart({},a)),n.globals.transition&&a(n.globals.transition),s()}]}}],Vt.module("ui.router.state").directive("uiSref",gi).directive("uiSrefActive",$i).directive("uiSrefActiveEq",$i).directive("uiState",_i),Pt.$inject=["$state"],kt.$inject=["$state"],Vt.module("ui.router.state").filter("isState",Pt).filter("includedByState",kt);var Si;Si=["$view","$animate","$uiViewScroll","$interpolate","$q",function(t,e,r,n,i){function o(t,r){return{enter:function(t,r,n){Vt.version.minor>2?e.enter(t,null,r).then(n):e.enter(t,null,r,n)},leave:function(t,r){Vt.version.minor>2?e.leave(t).then(r):e.leave(t,r)}}}function a(t,e){return t===e}var u={$cfg:{viewDecl:{$context:t._pluginapi._rootViewContext()}},$uiView:{}},s={count:0,restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(e,c,f){return function(e,c,l){function h(t){(!t||t instanceof ei)&&(a(S,t)||(Be.traceUIViewConfigUpdated(E,t&&t.viewDecl&&t.viewDecl.$context),S=t,d(t)))}function p(){if(v&&(Be.traceUIViewEvent("Removing (previous) el",v.data("$uiView")),v.remove(),v=null),y&&(Be.traceUIViewEvent("Destroying scope",E),y.$destroy(),y=null),m){var t=m.data("$uiViewAnim");Be.traceUIViewEvent("Animate out",t),$.leave(m,function(){t.$$animLeave.resolve(),v=null}),v=m,m=null}}function d(t){var n=e.$new(),o=i.defer(),a=i.defer(),u={$cfg:t,$uiView:E},s={$animEnter:o.promise,$animLeave:a.promise,$$animLeave:a};n.$emit("$viewContentLoading",R);var l=f(n,function(t){t.data("$uiViewAnim",s),t.data("$uiView",u),$.enter(t,c,function(){o.resolve(),y&&y.$emit("$viewContentAnimationEnded"),(Qt(_)&&!_||e.$eval(_))&&r(t)}),p()});m=l,y=n,y.$emit("$viewContentLoaded",t||S),y.$eval(w)}var v,m,y,g,w=l.onload||"",_=l.autoscroll,$=o(l,e),S=void 0,b=c.inheritedData("$uiView")||u,R=n(l.uiView||l.name||"")(e)||"$default",E={$type:"ng1",id:s.count++,name:R,fqn:b.$uiView.fqn?b.$uiView.fqn+"."+R:R,config:null,configUpdated:h,get creationContext(){var t=qt("$cfg.viewDecl.$context")(b),e=qt("$uiView.creationContext")(b);return t||e}};Be.traceUIViewEvent("Linking",E),c.data("$uiView",{$uiView:E}),d(),g=t.registerUIView(E),e.$on("$destroy",function(){Be.traceUIViewEvent("Destroying/Unregistering",E),g()})}}};return s}],Ot.$inject=["$compile","$controller","$transitions","$view","$q","$timeout"];var bi="function"==typeof Vt.module("ui.router").component,Ri=0;Vt.module("ui.router.state").directive("uiView",Si),Vt.module("ui.router.state").directive("uiView",Ot),Vt.module("ui.router.state").provider("$uiViewScroll",jt);t.default="ui.router",t.core=Zn,t.watchDigests=_t,t.getLocals=wi,t.getNg1ViewConfigFactory=vt,t.ng1ViewsBuilder=mt,t.Ng1ViewConfig=ei,t.StateProvider=oi,t.UrlRouterProvider=si,t.fromJson=le,t.toJson=he,t.copy=pe,t.forEach=de,t.extend=ve,t.equals=me,t.identity=f,t.noop=l,t.createProxyFunctions=h,t.inherit=ye,t.inArray=ge,t._inArray=p,t.removeFrom=we,t._removeFrom=d,t.pushTo=_e,t._pushTo=v,t.deregAll=$e,t.defaults=m,t.mergeR=Se,t.ancestors=y,t.pick=g,t.omit=w,t.pluck=_,t.filter=$,t.find=S,t.mapObj=be,t.map=b,t.values=Re,t.allTrueR=Ee,t.anyTrueR=Te,t.unnestR=Ce,t.flattenR=Pe,t.pushR=R,t.uniqR=ke,t.unnest=Oe,t.flatten=xe,t.assertPredicate=je,t.assertMap=Ie,t.assertFn=E,t.pairs=Ve,t.arrayTuples=T,t.applyPairs=C,t.tail=P,t._extend=x,t.silenceUncaughtInPromise=Ae,t.silentRejection=He,t.notImplemented=ue,t.services=se,t.Glob=Gt,t.curry=r,t.compose=n,t.pipe=i,t.prop=At,t.propEq=Ht,t.parse=qt,t.not=Dt,t.and=o,t.or=a,t.all=Nt,t.any=Ft,t.is=Ut,t.eq=Lt,t.val=Mt,t.invoke=u,t.pattern=s,t.isUndefined=Jt,t.isDefined=Qt,t.isNull=Kt,t.isNullOrUndefined=Yt,t.isFunction=Zt,t.isNumber=Xt,t.isString=te,t.isObject=ee,t.isArray=re,t.isDate=ne,t.isRegExp=ie,t.isState=oe,t.isInjectable=c,t.isPromise=ae,t.Queue=qe,t.maxLength=G,t.padString=B,t.kebobString=W,t.functionToString=z,t.fnToString=J,t.stringify=Q,t.beforeAfterSubstr=mr,t.splitOnDelim=K,t.joinNeighborsR=Y,t.Trace=Ge,t.trace=Be,t.Param=tr,t.ParamTypes=yr,t.StateParams=wr,t.ParamType=Ye,t.PathNode=er,t.PathUtils=rr,t.resolvePolicies=or,t.defaultResolvePolicy=nr,t.Resolvable=ir,t.NATIVE_INJECTOR_TOKEN=cr,t.ResolveContext=fr,t.resolvablesBuilder=nt,t.StateBuilder=Rr,t.StateObject=Bt,t.StateMatcher=Er,t.StateQueueManager=Tr,t.StateRegistry=Cr,t.StateService=En,t.TargetState=We,t.HookBuilder=Ke,t.matchState=H,t.RegisteredHook=Qe,t.makeEvent=q,t.Rejection=Ne,t.Transition=pr,t.TransitionHook=Je,t.TransitionEventType=_n,t.defaultTransOpts=bn,t.TransitionService=Rn,t.UrlMatcher=Or,t.UrlMatcherFactory=xr,t.UrlRouter=Dr,t.UrlRuleFactory=jr,t.BaseUrlRule=Ir,t.UrlService=zr,t.ViewService=Nr,t.UIRouterGlobals=Fr,t.UIRouter=Qr,t.$q=Tn,t.$injector=On,t.BaseLocationServices=Nn,t.HashLocationService=Un,t.MemoryLocationService=Mn,t.PushStateLocationService=Bn,t.MemoryLocationConfig=Wn,t.BrowserLocationConfig=zn,t.splitHash=jn,t.splitQuery=In,t.splitEqual=Vn,t.trimHashVal=An,t.keyValsToObjectR=Hn,t.getParams=qn,t.parseUrl=ht,t.buildUrl=Dn,t.locationPluginFactory=pt,t.servicesPlugin=dt,t.hashLocationPlugin=Jn,t.pushStateLocationPlugin=Qn,t.memoryLocationPlugin=Kn,t.UIRouterPluginBase=Yn,Object.defineProperty(t,"__esModule",{value:!0})}); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("angular")):"function"==typeof define&&define.amd?define(["exports","angular"],e):e(t["@uirouter/angularjs"]={},t.angular)}(this,function(t,e){"use strict";function r(t){function e(r){return r.length>=n?t.apply(null,r):function(){return e(r.concat([].slice.apply(arguments)))}}var r=[].slice.apply(arguments,[1]),n=t.length;return e(r)}function n(){var t=arguments,e=t.length-1;return function(){for(var r=e,n=t[e].apply(this,arguments);r--;)n=t[r].call(this,n);return n}}function i(){for(var t=[],e=0;e=0&&t.splice(r,1),t}function v(t,e){return t.push(e),e}function m(t){for(var e=[],r=1;r1||o.ctrlKey||o.metaKey||o.shiftKey||t.attr("target"))){var s=r(function(){e.go(u.uiState,u.uiStateParams,u.uiStateOpts)});o.preventDefault();var c=n.isAnchor&&!u.href?1:0;o.preventDefault=function(){c--<=0&&r.cancel(s)}}}}function Ct(t,e){return{relative:St(t)||e.$current,inherit:!0,source:"sref"}}function Tt(t,e,r,n){var i;n&&(i=n.events),ee(i)||(i=["click"]);for(var o=t.on?"on":"bind",a=0,u=i;athis._limit&&e.shift(),t},t.prototype.dequeue=function(){if(this.size())return this._items.splice(0,1)[0]},t.prototype.clear=function(){var t=this._items;return this._items=[],t},t.prototype.size=function(){return this._items.length},t.prototype.remove=function(t){var e=this._items.indexOf(t);return e>-1&&this._items.splice(e,1)[0]},t.prototype.peekTail=function(){return this._items[this._items.length-1]},t.prototype.peekHead=function(){if(this.size())return this._items[0]},t}();!function(t){t[t.SUPERSEDED=2]="SUPERSEDED",t[t.ABORTED=3]="ABORTED",t[t.INVALID=4]="INVALID",t[t.IGNORED=5]="IGNORED",t[t.ERROR=6]="ERROR"}(t.RejectType||(t.RejectType={}));var Ae=0,He=function(){function e(t,e,r){this.$id=Ae++,this.type=t,this.message=e,this.detail=r}return e.prototype.toString=function(){var t=function(t){return t&&t.toString!==Object.prototype.toString?t.toString():J(t)}(this.detail),e=this;return"Transition Rejection($id: "+e.$id+" type: "+e.type+", message: "+e.message+", detail: "+t+")"},e.prototype.toPromise=function(){return he(je(this),{_transitionRejection:this})},e.isRejectionPromise=function(t){return t&&"function"==typeof t.then&&Nt(e)(t._transitionRejection)},e.superseded=function(r,n){var i=new e(t.RejectType.SUPERSEDED,"The transition has been superseded by a different transition",r);return n&&n.redirected&&(i.redirected=!0),i},e.redirected=function(t){return e.superseded(t,{redirected:!0})},e.invalid=function(r){return new e(t.RejectType.INVALID,"This transition is invalid",r)},e.ignored=function(r){return new e(t.RejectType.IGNORED,"The transition was ignored",r)},e.aborted=function(r){return new e(t.RejectType.ABORTED,"The transition has been aborted",r)},e.errored=function(r){return new e(t.RejectType.ERROR,"The transition errored",r)},e.normalize=function(t){return Nt(e)(t)?t:e.errored(t)},e}(),qe=function(t){var e=t.viewDecl,r=e.$context.name||"(root)";return"[View#"+t.$id+" from '"+r+"' state]: target ui-view: '"+e.$uiViewName+"@"+e.$uiViewContextAnchor+"'"},De=Yt(console.table)?console.table.bind(console):console.log.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 Fe=Ht("$id"),Ne=Ht("router.$id"),Ue=function(t){return"Transition #"+Fe(t)+"-"+Ne(t)},Le=function(){function e(){this._enabled={},this.approximateDigests=0}return e.prototype._set=function(e,r){var n=this;r.length||(r=Object.keys(t.Category).map(function(t){return parseInt(t,10)}).filter(function(t){return!isNaN(t)}).map(function(e){return t.Category[e]})),r.map(V).forEach(function(t){return n._enabled[t]=e})},e.prototype.enable=function(){for(var t=[],e=0;e "+J(e))},e.prototype.traceTransitionIgnored=function(e){this.enabled(t.Category.TRANSITION)&&console.log(Ue(e)+": Ignored <> "+J(e))},e.prototype.traceHookInvocation=function(e,r,n){if(this.enabled(t.Category.HOOK)){var i=Ht("traceData.hookType")(n)||"internal",o=Ht("traceData.context.state.name")(n)||Ht("traceData.context")(n)||"unknown",a=W(e.registeredHook.callback);console.log(Ue(r)+": Hook -> "+i+" context: "+o+", "+M(200,a))}},e.prototype.traceHookResult=function(e,r,n){this.enabled(t.Category.HOOK)&&console.log(Ue(r)+": <- Hook returned: "+M(200,J(e)))},e.prototype.traceResolvePath=function(e,r,n){this.enabled(t.Category.RESOLVE)&&console.log(Ue(n)+": Resolving "+e+" ("+r+")")},e.prototype.traceResolvableResolved=function(e,r){this.enabled(t.Category.RESOLVE)&&console.log(Ue(r)+": <- Resolved "+e+" to: "+M(200,J(e.data)))},e.prototype.traceError=function(e,r){this.enabled(t.Category.TRANSITION)&&console.log(Ue(r)+": <- Rejected "+J(r)+", reason: "+e)},e.prototype.traceSuccess=function(e,r){this.enabled(t.Category.TRANSITION)&&console.log(Ue(r)+": <- Success "+J(r)+", final state: "+e.name)},e.prototype.traceUIViewEvent=function(e,r,n){void 0===n&&(n=""),this.enabled(t.Category.UIVIEW)&&console.log("ui-view: "+B(30,e)+" "+j(r)+n)},e.prototype.traceUIViewConfigUpdated=function(e,r){this.enabled(t.Category.UIVIEW)&&this.traceUIViewEvent("Updating",e," with ViewConfig from context='"+r+"'")},e.prototype.traceUIViewFill=function(e,r){this.enabled(t.Category.UIVIEW)&&this.traceUIViewEvent("Fill",e," with: "+M(200,r))},e.prototype.traceViewSync=function(e){if(this.enabled(t.Category.VIEWCONFIG)){var r=e.map(function(t){var e=t[0],r=t[1];return{"ui-view fqn":e.$type+":"+e.fqn,"state: view name":r&&r.viewDecl.$context.name+": "+r.viewDecl.$name+" ("+r.viewDecl.$type+")"}}).sort(function(t,e){return t["ui-view fqn"].localeCompare(e["ui-view fqn"])});De(r)}},e.prototype.traceViewServiceEvent=function(e,r){this.enabled(t.Category.VIEWCONFIG)&&console.log("VIEWCONFIG: "+e+" "+qe(r))},e.prototype.traceViewServiceUIViewEvent=function(e,r){this.enabled(t.Category.VIEWCONFIG)&&console.log("VIEWCONFIG: "+e+" "+j(r))},e}(),Me=new Le;!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 Be=function(){function t(t,e,r,n){this._stateRegistry=t,this._identifier=e,this._identifier=e,this._params=he({},r||{}),this._options=he({},n||{}),this._definition=t.matcher.find(e,this._options.relative)}return t.prototype.name=function(){return this._definition&&this._definition.name||this._identifier},t.prototype.identifier=function(){return this._identifier},t.prototype.params=function(){return this._params},t.prototype.$state=function(){return this._definition},t.prototype.state=function(){return this._definition&&this._definition.self},t.prototype.options=function(){return this._options},t.prototype.exists=function(){return!(!this._definition||!this._definition.self)},t.prototype.valid=function(){return!this.error()},t.prototype.error=function(){var t=this.options().relative;if(!this._definition&&t){var e=t.name?t.name:t;return"Could not resolve '"+this.name()+"' from state '"+e+"'"}return this._definition?this._definition.self?void 0:"State '"+this.name()+"' has an invalid definition":"No such state '"+this.name()+"'"},t.prototype.toString=function(){return"'"+this.name()+"'"+J(this.params())},t.prototype.withState=function(e){return new t(this._stateRegistry,e,this._params,this._options)},t.prototype.withParams=function(e,r){void 0===r&&(r=!1);var n=r?e:he({},this._params,e);return new t(this._stateRegistry,this._identifier,n,this._options)},t.prototype.withOptions=function(e,r){void 0===r&&(r=!1);var n=r?e:he({},this._options,e);return new t(this._stateRegistry,this._identifier,this._params,n)},t.isDef=function(t){return t&&t.state&&(Xt(t.state)||Xt(t.state.name))},t}(),Ge={current:l,transition:null,traceData:{},bind:null},We=function(){function e(e,r,n,i){var o=this;this.transition=e,this.stateContext=r,this.registeredHook=n,this.options=i,this.isSuperseded=function(){return o.type.hookPhase===t.TransitionHookPhase.RUN&&!o.options.transition.isActive()},this.options=m(i,Ge),this.type=n.eventType}return e.prototype.logError=function(t){this.transition.router.stateService.defaultErrorHandler()(t)},e.prototype.invokeHook=function(){var t=this,e=this.registeredHook;if(!e._deregistered){var r=this.getNotCurrentRejection();if(r)return r;var n=this.options;Me.traceHookInvocation(this,this.transition,n);var i=function(r){return e.eventType.getErrorHandler(t)(r)},o=function(r){return e.eventType.getResultHandler(t)(r)};try{var a=e.callback.call(n.bind,t.transition,t.stateContext);return!this.type.synchronous&&oe(a)?a.catch(function(t){return He.normalize(t).toPromise()}).then(o,i):o(a)}catch(t){return i(He.normalize(t))}}},e.prototype.handleHookResult=function(t){var e=this,r=this.getNotCurrentRejection();return r||(oe(t)?t.then(function(t){return e.handleHookResult(t)}):(Me.traceHookResult(t,this.transition,this.options),!1===t?He.aborted("Hook aborted transition").toPromise():Nt(Be)(t)?He.redirected(t).toPromise():void 0))},e.prototype.getNotCurrentRejection=function(){var t=this.transition.router;return t._disposed?He.aborted("UIRouter instance #"+t.$id+" has been stopped (disposed)").toPromise():this.transition._aborted?He.aborted().toPromise():this.isSuperseded()?He.superseded(this.options.current()).toPromise():void 0},e.prototype.toString=function(){var t=this,e=t.options,r=t.registeredHook;return(Ht("traceData.hookType")(e)||"internal")+" context: "+(Ht("traceData.context.state.name")(e)||Ht("traceData.context")(e)||"unknown")+", "+M(200,z(r.callback))},e.chain=function(t,e){return t.reduce(function(t,e){return t.then(function(){return e.invokeHook()})},e||ue.$q.when())},e.invokeHooks=function(t,r){for(var n=0;n20)throw new Error("Too many consecutive Transition redirects (20+)");var n={redirectedFrom:this,source:"redirect"};"url"===this.options().source&&!1!==t.options().location&&(n.location="replace");var i=he({},this.options(),t.options(),n);t=t.withOptions(i,!0);var o=this.router.transitionService.create(this._treeChanges.from,t),a=this._treeChanges.entering,u=o._treeChanges.entering;return tr.matching(u,a,tr.nonDynamicParams).filter(qt(function(t){return function(e){return t&&e.state.includes[t.name]}}(t.options().reloadState))).forEach(function(t,e){t.resolvables=a[e].resolvables}),o},e.prototype._changedParams=function(){var t=this._treeChanges;if(!(this._options.reload||t.exiting.length||t.entering.length||t.to.length!==t.from.length||C(t.to,t.from).map(function(t){return t[0].state!==t[1].state}).reduce(be,!1))){var e=t.to.map(function(t){return t.paramSchema}),r=[t.to,t.from].map(function(t){return t.map(function(t){return t.paramValues})});return C(e,r[0],r[1]).map(function(t){var e=t[0],r=t[1],n=t[2];return Ze.changed(e,r,n)}).reduce(Re,[])}},e.prototype.dynamic=function(){var t=this._changedParams();return!!t&&t.map(function(t){return t.dynamic}).reduce(be,!1)},e.prototype.ignored=function(){return!!this._ignoredReason()},e.prototype._ignoredReason=function(){var t=this.router.globals.transition,e=this._options.reloadState,r=function(t,r){if(t.length!==r.length)return!1;var n=tr.matching(t,r);return t.length===n.filter(function(t){return!e||!t.state.includes[e.name]}).length},n=this.treeChanges(),i=t&&t.treeChanges();return i&&r(i.to,n.to)&&r(i.exiting,n.exiting)?"SameAsPending":0===n.exiting.length&&0===n.entering.length&&r(n.from,n.to)?"SameAsCurrent":void 0},e.prototype.run=function(){var e=this,r=We.runAllHooks,n=function(t){return e._hookBuilder.buildHooksForPhase(t)},i=n(t.TransitionHookPhase.BEFORE);return We.invokeHooks(i,function(){var t=e.router.globals;return t.lastStartedTransitionId=e.$id,t.transition=e,t.transitionHistory.enqueue(e),Me.traceTransitionStart(e),ue.$q.when(void 0)}).then(function(){var e=n(t.TransitionHookPhase.RUN);return We.invokeHooks(e,function(){return ue.$q.when(void 0)})}).then(function(){Me.traceSuccess(e.$to(),e),e.success=!0,e._deferred.resolve(e.to()),r(n(t.TransitionHookPhase.SUCCESS))},function(i){Me.traceError(i,e),e.success=!1,e._deferred.reject(i),e._error=i,r(n(t.TransitionHookPhase.ERROR))}),this.promise},e.prototype.valid=function(){return!this.error()||void 0!==this.success},e.prototype.abort=function(){zt(this.success)&&(this._aborted=!0)},e.prototype.error=function(){var t=this.$to();if(t.self.abstract)return"Cannot transition to abstract state '"+t.name+"'";var e=t.parameters(),r=this.params(),n=e.filter(function(t){return!t.validates(r[t.id])});return n.length?"Param values not valid for state '"+t.name+"'. Invalid params: [ "+n.map(function(t){return t.id}).join(", ")+" ]":!1===this.success?this._error:void 0},e.prototype.toString=function(){var t=this.from(),e=this.to(),r=function(t){return null!==t["#"]&&void 0!==t["#"]?t:w(t,["#"])};return"Transition#"+this.$id+"( '"+(te(t)?t.name:t)+"'"+J(r(this._treeChanges.from.map(Vt("paramValues")).reduce(we,{})))+" -> "+(this.valid()?"":"(X) ")+"'"+(te(e)?e.name:e)+"'"+J(r(this.params()))+" )"},e.diToken=e,e}(),hr=null,pr=function(t){var e=He.isRejectionPromise;return(hr=hr||s([[qt(Jt),Lt("undefined")],[Qt,Lt("null")],[oe,Lt("[Promise]")],[e,function(t){return t._transitionRejection.toString()}],[Nt(He),u("toString")],[Nt(lr),u("toString")],[Nt(rr),u("toString")],[c,W],[Lt(!0),f]]))(t)},dr=function(t){return function(e){if(!e)return["",""];var r=e.indexOf(t);return-1===r?[e,""]:[e.substr(0,r),e.substr(r+1)]}},vr=new RegExp("^(?:[a-z]+:)?//[^/]+/"),mr=function(t){return t.replace(/\/[^/]*$/,"")},yr=dr("#"),gr=dr("?"),wr=dr("="),_r=function(t){return t?t.replace(/^#/,""):""},$r=function(){function t(){this.enqueue=!0,this.typeQueue=[],this.defaultTypes=g(t.prototype,["hash","string","query","path","int","bool","date","json","any"]);this.types=de(b(this.defaultTypes,function(t,e){return new Qe(he({name:e},t))}),{})}return t.prototype.dispose=function(){this.types={}},t.prototype.type=function(t,e,r){if(!Jt(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 Qe(he({name:t},e)),r&&(this.typeQueue.push({name:t,def:r}),this.enqueue||this._flushTypeQueue()),this},t.prototype._flushTypeQueue=function(){for(;this.typeQueue.length;){var t=this.typeQueue.shift();if(t.pattern)throw new Error("You cannot override a type's .pattern at runtime.");he(this.types[t.name],ue.$injector.invoke(t.def))}},t}();!function(){var t=function(t){var e=function(t){return null!=t?t.toString():t},r={encode:e,decode:e,is:Nt(String),pattern:/.*/,equals:function(t,e){return t==e}};return he({},r,t)};he($r.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!Kt(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:Nt(Boolean),pattern:/0|1/}),date:t({encode:function(t){return this.is(t)?[t.getFullYear(),("0"+(t.getMonth()+1)).slice(-2),("0"+t.getDate()).slice(-2)].join("-"):void 0},decode:function(t){if(this.is(t))return t;var e=this.capture.exec(t);return e?new Date(e[1],e[2]-1,e[3]):void 0},is:function(t){return t instanceof Date&&!isNaN(t.valueOf())},equals:function(t,e){return["getFullYear","getMonth","getDate"].reduce(function(r,n){return r&&t[n]()===e[n]()},!0)},pattern:/[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,capture:/([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/}),json:t({encode:fe,decode:ce,is:Nt(Object),equals:pe,pattern:/[^/]*/}),any:t({encode:f,decode:f,is:function(){return!0},equals:pe})})}();var Sr,br=function(){function t(t){void 0===t&&(t={}),he(this,t)}return t.prototype.$inherit=function(t,e,r){var n,i=y(e,r),o={},a=[];for(var u in i)if(i[u]&&i[u].params&&(n=Object.keys(i[u].params)).length)for(var s in n)a.indexOf(n[s])>=0||(a.push(n[s]),o[n[s]]=this[n[s]]);return he({},o,t)},t}(),Rr=function(t){if(!Xt(t))return!1;var e="^"===t.charAt(0);return{val:e?t.substring(1):t,root:e}},Er=function(t,e){return function(r){var n=r;n&&n.url&&n.name&&n.name.match(/\.\*\*$/)&&(n.url+="{remainder:any}");var i=Rr(n.url),o=r.parent,a=i?t.compile(i.val,{params:r.params||{},paramMap:function(t,e){return!1===n.reloadOnSearch&&e&&(t=he(t||{},{dynamic:!0})),t}}):n.url;if(!a)return null;if(!t.isMatcher(a))throw new Error("Invalid url '"+a+"' in state '"+r+"'");return i&&i.root?a:(o&&o.navigable||e()).url.append(a)}},Cr=function(t){return function(e){return!t(e)&&e.url?e:e.parent?e.parent.navigable:null}},Tr=function(t){return function(e){var r=e.url&&e.url.parameters({inherit:!1})||[],n=$e(_e(w(e.params||{},r.map(Vt("id"))),function(e,r){return t.fromConfig(r,null,e)}));return r.concat(n).map(function(t){return[t.id,t]}).reduce(T,{})}},Pr=function(){function t(t,e){this.matcher=t;var r=this,n=function(){return t.find("")},i=function(t){return""===t.name};this.builders={name:[Y],self:[Z],parent:[function(e){return i(e)?null:t.find(r.parentName(e))||n()}],data:[X],url:[Er(e,n)],navigable:[Cr(i)],params:[Tr(e.paramFactory)],views:[],path:[tt],includes:[et],resolvables:[rt]}}return t.prototype.builder=function(t,e){var r=this.builders,n=r[t]||[];return Xt(t)&&!Jt(e)?n.length>1?n:n[0]:Xt(t)&&Yt(e)?(r[t]=n,r[t].push(e),function(){return r[t].splice(r[t].indexOf(e,1))&&null}):void 0},t.prototype.build=function(t){var e=this,r=e.matcher,n=e.builders,i=this.parentName(t);if(i&&!r.find(i,void 0,!1))return null;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o].reduce(function(t,e){return function(r){return e(r,t)}},l);t[o]=a(t)}return t},t.prototype.parentName=function(t){var e=t.name||"",r=e.split(".");if("**"===r.pop()&&r.pop(),r.length){if(t.parent)throw new Error("States that specify the 'parent:' property should not have a '.' in their name ("+e+")");return r.join(".")}return t.parent?Xt(t.parent)?t.parent:t.parent.name:""},t.prototype.name=function(t){var e=t.name;if(-1!==e.indexOf(".")||!t.parent)return e;var r=Xt(t.parent)?t.parent:t.parent.name;return r?r+"."+e:e},t}(),kr=function(){function t(t){this._states=t}return t.prototype.isRelative=function(t){return 0===(t=t||"").indexOf(".")||0===t.indexOf("^")},t.prototype.find=function(t,e,r){if(void 0===r&&(r=!0),t||""===t){var n=Xt(t),i=n?t:t.name;this.isRelative(i)&&(i=this.resolvePath(i,e));var o=this._states[i];if(o&&(n||!(n||o!==t&&o.self!==t)))return o;if(n&&r){var a=$e(this._states).filter(function(t){return t.__stateObjectCache.nameGlob&&t.__stateObjectCache.nameGlob.matches(i)});return a.length>1&&console.log("stateMatcher.find: Found multiple matches for "+i+" using glob: ",a.map(function(t){return t.name})),a[0]}}},t.prototype.resolvePath=function(t,e){if(!e)throw new Error("No reference point given for path '"+t+"'");for(var r=this.find(e),n=t.split("."),i=0,o=n.length,a=r;i0;){var c=r.shift(),f=c.name,l=i.build(c),h=a.indexOf(c);if(l){var p=s(f);if(p&&p.name===f)throw new Error("State '"+f+"' is already defined");var d=s(f+".**");d&&this.$registry.deregister(d),n[f]=c,this.attachRoute(c),h>=0&&a.splice(h,1),o.push(c)}else{var v=u[f];if(u[f]=r.length,h>=0&&v===r.length)return r.push(c),n;h<0&&a.push(c),r.push(c)}}return o.length&&this.listeners.forEach(function(t){return t("registered",o.map(function(t){return t.self}))}),n},t.prototype.attachRoute=function(t){!t.abstract&&t.url&&this.$urlRouter.rule(this.$urlRouter.urlRuleFactory.create(t))},t}(),xr=function(){function t(t){this._router=t,this.states={},this.listeners=[],this.matcher=new kr(this.states),this.builder=new Pr(this.matcher,t.urlMatcherFactory),this.stateQueue=new Or(this,t.urlRouter,this.states,this.builder,this.listeners),this._registerRoot()}return t.prototype._registerRoot=function(){var t={name:"",url:"^",views:null,params:{"#":{value:null,type:"hash",dynamic:!0}},abstract:!0};(this._root=this.stateQueue.register(t)).navigable=null},t.prototype.dispose=function(){var t=this;this.stateQueue.dispose(),this.listeners=[],this.get().forEach(function(e){return t.get(e)&&t.deregister(e)})},t.prototype.onStatesChanged=function(t){return this.listeners.push(t),function(){me(this.listeners)(t)}.bind(this)},t.prototype.root=function(){return this._root},t.prototype.register=function(t){return this.stateQueue.register(t)},t.prototype._deregisterTree=function(t){var e=this,r=this.get().map(function(t){return t.$$state()}),n=function(t){var e=r.filter(function(e){return-1!==t.indexOf(e.parent)});return 0===e.length?e:e.concat(n(e))},i=n([t]),o=[t].concat(i).reverse();return o.forEach(function(t){var r=e._router.urlRouter;r.rules().filter(At("state",t)).forEach(r.removeRule.bind(r)),delete e.states[t.name]}),o},t.prototype.deregister=function(t){var e=this.get(t);if(!e)throw new Error("Can't deregister state; not found: "+t);var r=this._deregisterTree(e.$$state());return this.listeners.forEach(function(t){return t("deregistered",r.map(function(t){return t.self}))}),r},t.prototype.get=function(t,e){var r=this;if(0===arguments.length)return Object.keys(this.states).map(function(t){return r.states[t].self});var n=this.matcher.find(t,e);return n&&n.self||null},t.prototype.decorator=function(t,e){return this.builder.builder(t,e)},t}(),Ir=function(t,e,r){return t[e]=t[e]||r()},jr=Q("/"),Vr=function(){function e(t,r,n,i){var o=this;this.config=i,this._cache={path:[this]},this._children=[],this._params=[],this._segments=[],this._compiled=[],this.pattern=t,this.config=m(this.config,{params:{},strict:!0,caseInsensitive:!1,paramMap:f});for(var a,u,s,c=/([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,l=/([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,h=0,p=[],d=function(r){if(!e.nameValidator.test(r))throw new Error("Invalid parameter name '"+r+"' in pattern '"+t+"'");if(S(o._params,At("id",r)))throw new Error("Duplicate parameter name '"+r+"' in pattern '"+t+"'")},v=function(e,n){var i=e[2]||e[3],a=n?e[4]:e[4]||("*"===e[1]?"[\\s\\S]*":null);return{id:i,regexp:a,cfg:o.config.params[i],segment:t.substring(h,e.index),type:a?r.type(a)||function(t){return de(r.type(n?"query":"path"),{pattern:new RegExp(t,o.config.caseInsensitive?"i":void 0)})}(a):null}};(a=c.exec(t))&&!((u=v(a,!1)).segment.indexOf("?")>=0);)d(u.id),this._params.push(n.fromPath(u.id,u.type,this.config.paramMap(u.cfg,!1))),this._segments.push(u.segment),p.push([u.segment,P(this._params)]),h=c.lastIndex;var y=(s=t.substring(h)).indexOf("?");if(y>=0){var g=s.substring(y);if(s=s.substring(0,y),g.length>0)for(h=0;a=l.exec(g);)d((u=v(a,!0)).id),this._params.push(n.fromSearch(u.id,u.type,this.config.paramMap(u.cfg,!0))),h=c.lastIndex}this._segments.push(s),this._compiled=p.map(function(t){return nt.apply(null,t)}).concat(nt(s))}return e.prototype.append=function(t){return this._children.push(t),t._cache={path:this._cache.path.concat(t),parent:this,pattern:null},t},e.prototype.isRoot=function(){return this._cache.path[0]===this},e.prototype.toString=function(){return this.pattern},e.prototype.exec=function(t,e,r,n){var i=this;void 0===e&&(e={}),void 0===n&&(n={});var o=Ir(this._cache,"pattern",function(){return new RegExp(["^",Te(i._cache.path.map(Vt("_compiled"))).join(""),!1===i.config.strict?"/?":"","$"].join(""),i.config.caseInsensitive?"i":void 0)}).exec(t);if(!o)return null;var a=this.parameters(),u=a.filter(function(t){return!t.isSearch()}),s=a.filter(function(t){return t.isSearch()}),c=this._cache.path.map(function(t){return t._segments.length-1}).reduce(function(t,e){return t+e}),f={};if(c!==o.length-1)throw new Error("Unbalanced capture group in route '"+this.pattern+"'");for(var l=0;ln.weight?o:n}return n},t.prototype.sync=function(t){if(!t||!t.defaultPrevented){var e=this._router,r=e.urlService,n=e.stateService,i={path:r.path(),search:r.search(),hash:r.hash()},o=this.match(i);s([[Xt,function(t){return r.url(t,!0)}],[Be.isDef,function(t){return n.go(t.state,t.params,t.options)}],[Nt(Be),function(t){return n.go(t.state(),t.params(),t.options())}]])(o&&o.rule.handler(o.match,i,e))}},t.prototype.listen=function(t){var e=this;if(!1!==t)return this._stopFn=this._stopFn||this._router.urlService.onChange(function(t){return e.sync(t)});this._stopFn&&this._stopFn(),delete this._stopFn},t.prototype.update=function(t){var e=this._router.locationService;t?this.location=e.path():e.path()!==this.location&&e.url(this.location,!0)},t.prototype.push=function(t,e,r){var n=r&&!!r.replace;this._router.urlService.url(t.format(e||{}),n)},t.prototype.href=function(t,e,r){var n=t.format(e);if(null==n)return null;r=r||{absolute:!1};var i=this._router.urlService.config,o=i.html5Mode();if(o||null===n||(n="#"+i.hashPrefix()+n),n=it(n,o,r.absolute,i.baseHref()),!r.absolute||!n)return n;var a=!o&&n?"/":"",u=i.port();return u=80===u||443===u?"":":"+u,[i.protocol(),"://",i.host(),u,a,n].join("")},t.prototype.rule=function(t){var e=this;if(!Hr.isUrlRule(t))throw new Error("invalid rule");return t.$id=this._id++,t.priority=t.priority||0,this._rules.push(t),this._sorted=!1,function(){return e.removeRule(t)}},t.prototype.removeRule=function(t){me(this._rules,t)},t.prototype.rules=function(){return this.ensureSorted(),this._rules.slice()},t.prototype.otherwise=function(t){var e=ot(t);this._otherwiseFn=this.urlRuleFactory.create(Lt(!0),e),this._sorted=!1},t.prototype.initial=function(t){var e=ot(t);this.rule(this.urlRuleFactory.create(function(t,e){return 0===e.globals.transitionHistory.size()&&!!/^\/?$/.exec(t.path)},e))},t.prototype.when=function(t,e,r){var n=this.urlRuleFactory.create(t,e);return Jt(r&&r.priority)&&(n.priority=r.priority),this.rule(n),n},t.prototype.deferIntercept=function(t){void 0===t&&(t=!0),this.interceptDeferred=t},t}(),Mr=function(){function t(){var t=this;this._uiViews=[],this._viewConfigs=[],this._viewConfigFactories={},this._pluginapi={_rootViewContext:this._rootViewContext.bind(this),_viewConfigFactory:this._viewConfigFactory.bind(this),_registeredUIViews:function(){return t._uiViews},_activeViewConfigs:function(){return t._viewConfigs}}}return t.prototype._rootViewContext=function(t){return this._rootContext=t||this._rootContext},t.prototype._viewConfigFactory=function(t,e){this._viewConfigFactories[t]=e},t.prototype.createViewConfig=function(t,e){var r=this._viewConfigFactories[e.$type];if(!r)throw new Error("ViewService: No view config factory registered for type "+e.$type);var n=r(t,e);return ee(n)?n:[n]},t.prototype.deactivateViewConfig=function(t){Me.traceViewServiceEvent("<- Removing",t),me(this._viewConfigs,t)},t.prototype.activateViewConfig=function(t){Me.traceViewServiceEvent("-> Registering",t),this._viewConfigs.push(t)},t.prototype.sync=function(){function e(t){for(var e=t.viewDecl.$context,r=0;++r&&e.parent;)e=e.parent;return r}var n=this,i=this._uiViews.map(function(t){return[t.fqn,t]}).reduce(T,{}),o=r(function(t,e,r,n){return e*(t(r)-t(n))}),a=this._uiViews.sort(o(function(t){var e=function(t){return t&&t.parent?e(t.parent)+1:1};return 1e4*t.fqn.split(".").length+e(t.creationContext)},1)).map(function(r){var a=n._viewConfigs.filter(t.matches(i,r));return a.length>1&&a.sort(o(e,-1)),[r,a[0]]});Me.traceViewSync(a),a.forEach(function(t){var e=t[0],r=t[1];-1!==n._uiViews.indexOf(e)&&e.configUpdated(r)})},t.prototype.registerUIView=function(t){Me.traceViewServiceUIViewEvent("-> Registering",t);var e=this._uiViews;return e.filter(function(e){return e.fqn===t.fqn&&e.$type===t.$type}).length&&Me.traceViewServiceUIViewEvent("!!!! duplicate uiView named:",t),e.push(t),this.sync(),function(){-1!==e.indexOf(t)?(Me.traceViewServiceUIViewEvent("<- Deregistering",t),me(e)(t)):Me.traceViewServiceUIViewEvent("Tried removing non-registered uiView",t)}},t.prototype.available=function(){return this._uiViews.map(Vt("fqn"))},t.prototype.active=function(){return this._uiViews.filter(Vt("$config")).map(Vt("name"))},t.normalizeUIViewTarget=function(t,e){void 0===e&&(e="");var r=e.split("@"),n=r[0]||"$default",i=Xt(r[1])?r[1]:"^",o=/^(\^(?:\.\^)*)\.(.*$)/.exec(n);return o&&(i=o[1],n=o[2]),"!"===n.charAt(0)&&(n=n.substr(1),i=""),/^(\^(?:\.\^)*)$/.exec(i)?i=i.split(".").reduce(function(t,e){return t.parent},t).name:"."===i&&(i=t.name),{uiViewName:n,uiViewContextAnchor:i}},t.matches=function(t,e){return function(r){if(e.$type!==r.viewDecl.$type)return!1;var n=r.viewDecl,i=n.$uiViewName.split("."),o=e.fqn.split(".");if(!pe(i,o.slice(0-i.length)))return!1;var a=1-i.length||void 0,u=o.slice(0,a).join("."),s=t[u].creationContext;return n.$uiViewContextAnchor===(s&&s.name)}},t}(),Br=function(){function t(){this.params=new br,this.lastStartedTransitionId=-1,this.transitionHistory=new Ve([],1),this.successfulTransitions=new Ve([],1)}return t.prototype.dispose=function(){this.transitionHistory.clear(),this.successfulTransitions.clear(),this.transition=null},t}(),Gr=function(t){return t.reduce(function(t,e){return t[e]=ae(e),t},{dispose:l})},Wr=["url","path","search","hash","onChange"],zr=["port","protocol","host","baseHref","html5Mode","hashPrefix"],Jr=["type","caseInsensitive","strictMode","defaultSquashPolicy"],Qr=["sort","when","initial","otherwise","rules","rule","removeRule"],Kr=["deferIntercept","listen","sync","match"],Yr=function(){function t(t,e){void 0===e&&(e=!0),this.router=t,this.rules={},this.config={};var r=function(){return t.locationService};h(r,this,r,Wr,e);var n=function(){return t.locationConfig};h(n,this.config,n,zr,e);var i=function(){return t.urlMatcherFactory};h(i,this.config,i,Jr);var o=function(){return t.urlRouter};h(o,this.rules,o,Qr),h(o,this,o,Kr)}return t.prototype.url=function(t,e,r){},t.prototype.path=function(){},t.prototype.search=function(){},t.prototype.hash=function(){},t.prototype.onChange=function(t){},t.prototype.parts=function(){return{path:this.path(),search:this.search(),hash:this.hash()}},t.prototype.dispose=function(){},t.prototype.sync=function(t){},t.prototype.listen=function(t){},t.prototype.deferIntercept=function(t){},t.prototype.match=function(t){},t.locationServiceStub=Gr(Wr),t.locationConfigStub=Gr(zr),t}(),Zr=0,Xr=function(){function t(t,e){void 0===t&&(t=Yr.locationServiceStub),void 0===e&&(e=Yr.locationConfigStub),this.locationService=t,this.locationConfig=e,this.$id=Zr++,this._disposed=!1,this._disposables=[],this.trace=Me,this.viewService=new Mr,this.transitionService=new Pn(this),this.globals=new Br,this.urlMatcherFactory=new Ar,this.urlRouter=new Lr(this),this.stateRegistry=new xr(this),this.stateService=new kn(this),this.urlService=new Yr(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&&Yt(t.dispose)?t.dispose(this):(this._disposed=!0,this._disposables.slice().forEach(function(t){try{"function"==typeof t.dispose&&t.dispose(e),me(e._disposables,t)}catch(t){}}))},t.prototype.plugin=function(t,e){void 0===e&&(e={});var r=new t(this,e);if(!r.name)throw new Error("Required property `name` missing on plugin: "+r);return this._disposables.push(r),this._plugins[r.name]=r},t.prototype.getPlugin=function(t){return t?this._plugins[t]:$e(this._plugins)},t}(),tn=function(t){return t.onCreate({},at)},en=function(t){function e(e){if(e)return e instanceof Be?e:Xt(e)?n.target(e,t.params(),t.options()):e.state||e.params?n.target(e.state||t.to(),e.params||t.params(),t.options()):void 0}var r=t.to().redirectTo;if(r){var n=t.router.stateService;return Yt(r)?ue.$q.when(r(t)).then(e):e(r)}},rn=function(t){return t.onStart({to:function(t){return!!t.redirectTo}},en)},nn=ut("onExit"),on=function(t){return t.onExit({exiting:function(t){return!!t.onExit}},nn)},an=ut("onRetain"),un=function(t){return t.onRetain({retained:function(t){return!!t.onRetain}},an)},sn=ut("onEnter"),cn=function(t){return t.onEnter({entering:function(t){return!!t.onEnter}},sn)},fn=function(t){return new sr(t.treeChanges().to).resolvePath("EAGER",t).then(l)},ln=function(t){return t.onStart({},fn,{priority:1e3})},hn=function(t,e){return new sr(t.treeChanges().to).subContext(e.$$state()).resolvePath("LAZY",t).then(l)},pn=function(t){return t.onEnter({entering:Lt(!0)},hn,{priority:1e3})},dn=function(t){var e=ue.$q,r=t.views("entering");if(r.length)return e.all(r.map(function(t){return e.when(t.load())})).then(l)},vn=function(t){return t.onFinish({},dn)},mn=function(t){var e=t.views("entering"),r=t.views("exiting");if(e.length||r.length){var n=t.router.viewService;r.forEach(function(t){return n.deactivateViewConfig(t)}),e.forEach(function(t){return n.activateViewConfig(t)}),n.sync()}},yn=function(t){return t.onSuccess({},mn)},gn=function(t){var e=t.router.globals,r=function(){e.transition===t&&(e.transition=null)};t.onSuccess({},function(){e.successfulTransitions.enqueue(t),e.$current=t.$to(),e.current=e.$current.self,k(t.params(),e.params)},{priority:1e4}),t.promise.then(r,r)},wn=function(t){return t.onCreate({},gn)},_n=function(t){var e=t.options(),r=t.router.stateService,n=t.router.urlRouter;if("url"!==e.source&&e.location&&r.$current.navigable){var i={replace:"replace"===e.location};n.push(r.$current.navigable.url,r.params,i)}n.update(!0)},$n=function(t){return t.onSuccess({},_n,{priority:9999})},Sn=function(t){var e=t.router,r=t.entering().filter(function(t){return!!t.$$state().lazyLoad}).map(function(e){return st(t,e)});return ue.$q.all(r).then(function(){if("url"!==t.originalTransition().options().source){var r=t.targetState();return e.stateService.target(r.identifier(),r.params(),r.options())}var n=e.urlService,i=n.match(n.parts()),o=i&&i.rule;if(o&&"STATE"===o.type){var a=o.state,u=i.match;return e.stateService.target(a,u,t.options())}e.urlService.sync()})},bn=function(t){return t.onBefore({entering:function(t){return!!t.lazyLoad}},Sn)},Rn=function(){return function(t,e,r,n,i,o,a,u){void 0===i&&(i=!1),void 0===o&&(o=We.HANDLE_RESULT),void 0===a&&(a=We.REJECT_ERROR),void 0===u&&(u=!1),this.name=t,this.hookPhase=e,this.hookOrder=r,this.criteriaMatchPath=n,this.reverseSort=i,this.getResultHandler=o,this.getErrorHandler=a,this.synchronous=u}}(),En=function(t){return t.onBefore({},ct,{priority:-9999})},Cn=function(t){return t.onBefore({},ft,{priority:-1e4})},Tn={location:!0,relative:null,inherit:!1,notify:!0,reload:!1,custom:{},current:function(){return null},source:"unknown"},Pn=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(Lt(this),{},Lt(this),["_definePathType","_defineEvent","_getPathTypes","_getEvents","getHooks"]),this._defineCorePaths(),this._defineCoreEvents(),this._registerCoreTransitionHooks()}return e.prototype.onCreate=function(t,e,r){},e.prototype.onBefore=function(t,e,r){},e.prototype.onStart=function(t,e,r){},e.prototype.onExit=function(t,e,r){},e.prototype.onRetain=function(t,e,r){},e.prototype.onEnter=function(t,e,r){},e.prototype.onFinish=function(t,e,r){},e.prototype.onSuccess=function(t,e,r){},e.prototype.onError=function(t,e,r){},e.prototype.dispose=function(t){$e(this._registeredHooks).forEach(function(t){return t.forEach(function(e){e._deregistered=!0,me(t,e)})})},e.prototype.create=function(t,e){return new lr(t,e,this._router)},e.prototype._defineCoreEvents=function(){var e=t.TransitionHookPhase,r=We,n=this._criteriaPaths;this._defineEvent("onCreate",e.CREATE,0,n.to,!1,r.LOG_REJECTED_RESULT,r.THROW_ERROR,!0),this._defineEvent("onBefore",e.BEFORE,0,n.to),this._defineEvent("onStart",e.RUN,0,n.to),this._defineEvent("onExit",e.RUN,100,n.exiting,!0),this._defineEvent("onRetain",e.RUN,200,n.retained),this._defineEvent("onEnter",e.RUN,300,n.entering),this._defineEvent("onFinish",e.RUN,400,n.to),this._defineEvent("onSuccess",e.SUCCESS,0,n.to,!1,r.LOG_REJECTED_RESULT,r.LOG_ERROR,!0),this._defineEvent("onError",e.ERROR,0,n.to,!1,r.LOG_REJECTED_RESULT,r.LOG_ERROR,!0)},e.prototype._defineCorePaths=function(){var e=t.TransitionHookScope.STATE,r=t.TransitionHookScope.TRANSITION;this._definePathType("to",r),this._definePathType("from",r),this._definePathType("exiting",e),this._definePathType("retained",e),this._definePathType("entering",e)},e.prototype._defineEvent=function(t,e,r,n,i,o,a,u){void 0===i&&(i=!1),void 0===o&&(o=We.HANDLE_RESULT),void 0===a&&(a=We.REJECT_ERROR),void 0===u&&(u=!1);var s=new Rn(t,e,r,n,i,o,a,u);this._eventTypes.push(s),H(this,this,s)},e.prototype._getEvents=function(t){return(Jt(t)?this._eventTypes.filter(function(e){return e.hookPhase===t}):this._eventTypes.slice()).sort(function(t,e){var r=t.hookPhase-e.hookPhase;return 0===r?t.hookOrder-e.hookOrder:r})},e.prototype._definePathType=function(t,e){this._criteriaPaths[t]={name:t,scope:e}},e.prototype._getPathTypes=function(){return this._criteriaPaths},e.prototype.getHooks=function(t){return this._registeredHooks[t]},e.prototype._registerCoreTransitionHooks=function(){var t=this._deregisterHookFns;t.addCoreResolves=tn(this),t.ignored=En(this),t.invalid=Cn(this),t.redirectTo=rn(this),t.onExit=on(this),t.onRetain=un(this),t.onEnter=cn(this),t.eagerResolve=ln(this),t.lazyResolve=pn(this),t.loadViews=vn(this),t.activateViews=yn(this),t.updateGlobals=wn(this),t.updateUrl=$n(this),t.lazyLoad=bn(this)},e}(),kn=function(){function e(t){this.router=t,this.invalidCallbacks=[],this._defaultErrorHandler=function(t){t instanceof Error&&t.stack?(console.error(t),console.error(t.stack)):t instanceof He?(console.error(t.toString()),t.detail&&t.detail.stack&&console.error(t.detail.stack)):console.error(t)};var r=["current","$current","params","transition"],n=Object.keys(e.prototype).filter(qt(ve(r)));h(Lt(e.prototype),this,Lt(this),n)}return Object.defineProperty(e.prototype,"transition",{get:function(){return this.router.globals.transition},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"params",{get:function(){return this.router.globals.params},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"current",{get:function(){return this.router.globals.current},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"$current",{get:function(){return this.router.globals.$current},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.defaultErrorHandler(l),this.invalidCallbacks=[]},e.prototype._handleInvalidTargetState=function(t,e){function r(){var t=s.dequeue();return void 0===t?He.invalid(e.error()).toPromise():ue.$q.when(t(e,i,c)).then(f).then(function(t){return t||r()})}var n=this,i=tr.makeTargetState(this.router.stateRegistry,t),o=this.router.globals,a=function(){return o.transitionHistory.peekTail()},u=a(),s=new Ve(this.invalidCallbacks.slice()),c=new sr(t).injector(),f=function(t){if(t instanceof Be){var e=t;return(e=n.target(e.identifier(),e.params(),e.options())).valid()?a()!==u?He.superseded().toPromise():n.transitionTo(e.identifier(),e.params(),e.options()):He.invalid(e.error()).toPromise()}};return r()},e.prototype.onInvalid=function(t){return this.invalidCallbacks.push(t),function(){me(this.invalidCallbacks)(t)}.bind(this)},e.prototype.reload=function(t){return this.transitionTo(this.current,this.params,{reload:!Jt(t)||t,inherit:!1,notify:!1})},e.prototype.go=function(t,e,r){var n=m(r,{relative:this.$current,inherit:!0},Tn);return this.transitionTo(t,e,n)},e.prototype.target=function(t,e,r){if(void 0===r&&(r={}),te(r.reload)&&!r.reload.name)throw new Error("Invalid reload state object");var n=this.router.stateRegistry;if(r.reloadState=!0===r.reload?n.root():n.matcher.find(r.reload,r.relative),r.reload&&!r.reloadState)throw new Error("No such reload state '"+(Xt(r.reload)?r.reload:r.reload.name)+"'");return new Be(this.router.stateRegistry,t,e,r)},e.prototype.getCurrentPath=function(){var t=this,e=this.router.globals.successfulTransitions.peekTail();return e?e.treeChanges().to:[new Xe(t.router.stateRegistry.root())]},e.prototype.transitionTo=function(e,r,n){var i=this;void 0===r&&(r={}),void 0===n&&(n={});var o=this.router,a=o.globals;n=m(n,Tn);n=he(n,{current:function(){return a.transition}});var u=this.target(e,r,n),s=this.getCurrentPath();if(!u.exists())return this._handleInvalidTargetState(s,u);if(!u.valid())return je(u.error());var c=function(e){return function(r){if(r instanceof He){var n=o.globals.lastStartedTransitionId===e.$id;if(r.type===t.RejectType.IGNORED)return n&&o.urlRouter.update(),ue.$q.when(a.current);var u=r.detail;if(r.type===t.RejectType.SUPERSEDED&&r.redirected&&u instanceof Be){var s=e.redirect(u);return s.run().catch(c(s))}if(r.type===t.RejectType.ABORTED)return n&&o.urlRouter.update(),ue.$q.reject(r)}return i.defaultErrorHandler()(r),ue.$q.reject(r)}},f=this.router.transitionService.create(s,u),l=f.run().catch(c(f));return Ie(l),he(l,{transition:f})},e.prototype.is=function(t,e,r){r=m(r,{relative:this.$current});var n=this.router.stateRegistry.matcher.find(t,r.relative);if(Jt(n)){if(this.$current!==n)return!1;if(!e)return!0;var i=n.parameters({inherit:!0,matchingKeys:e});return Ze.equals(i,Ze.values(i,e),this.params)}},e.prototype.includes=function(t,e,r){r=m(r,{relative:this.$current});var n=Xt(t)&&Mt.fromString(t);if(n){if(!n.matches(this.$current.name))return!1;t=this.$current.name}var i=this.router.stateRegistry.matcher.find(t,r.relative),o=this.$current.includes;if(Jt(i)){if(!Jt(o[i.name]))return!1;if(!e)return!0;var a=i.parameters({inherit:!0,matchingKeys:e});return Ze.equals(a,Ze.values(a,e),this.params)}},e.prototype.href=function(t,e,r){r=m(r,{lossy:!0,inherit:!0,absolute:!1,relative:this.$current}),e=e||{};var n=this.router.stateRegistry.matcher.find(t,r.relative);if(!Jt(n))return null;r.inherit&&(e=this.params.$inherit(e,this.$current,n));var i=n&&r.lossy?n.navigable:n;return i&&void 0!==i.url&&null!==i.url?this.router.urlRouter.href(i.url,e,{absolute:r.absolute}):null},e.prototype.defaultErrorHandler=function(t){return this._defaultErrorHandler=t||this._defaultErrorHandler},e.prototype.get=function(t,e){var r=this.router.stateRegistry;return 0===arguments.length?r.get():r.get(t,e||this.$current)},e.prototype.lazyLoad=function(t,e){var r=this.get(t);if(!r||!r.lazyLoad)throw new Error("Can not lazy load "+t);var n=this.getCurrentPath(),i=tr.makeTargetState(this.router.stateRegistry,n);return e=e||this.router.transitionService.create(n,i),st(e,r)},e}(),On={when:function(t){return new Promise(function(e,r){return e(t)})},reject:function(t){return new Promise(function(e,r){r(t)})},defer:function(){var t={};return t.promise=new Promise(function(e,r){t.resolve=e,t.reject=r}),t},all:function(t){if(ee(t))return Promise.all(t);if(te(t)){var e=Object.keys(t).map(function(e){return t[e].then(function(t){return{key:e,val:t}})});return On.all(e).then(function(t){return t.reduce(function(t,e){return t[e.key]=e.val,t},{})})}}},xn={},In=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,jn=/([^\s,]+)/g,Vn={get:function(t){return xn[t]},has:function(t){return null!=Vn.get(t)},invoke:function(t,e,r){var n=he({},xn,r||{}),i=Vn.annotate(t),o=ke(function(t){return n.hasOwnProperty(t)},function(t){return"DI can't find injectable: '"+t+"'"}),a=i.filter(o).map(function(t){return n[t]});return Yt(t)?t.apply(e,a):t.slice(-1)[0].apply(e,a)},annotate:function(t){if(!c(t))throw new Error("Not an injectable function: "+t);if(t&&t.$inject)return t.$inject;if(ee(t))return t.slice(0,-1);var e=t.toString().replace(In,"");return e.slice(e.indexOf("(")+1,e.indexOf(")")).match(jn)||[]}},An=function(t,e){var r=e[0],n=e[1];return t.hasOwnProperty(r)?ee(t[r])?t[r].push(n):t[r]=[t[r],n]:t[r]=n,t},Hn=function(t){return t.split("&").filter(f).map(wr).reduce(An,{})},qn=function(t){var e=t.path(),r=t.search(),n=t.hash(),i=Object.keys(r).map(function(t){var e=r[t];return(ee(e)?e:[e]).map(function(e){return t+"="+e})}).reduce(Re,[]).join("&");return e+(i?"?"+i:"")+(n?"#"+n:"")},Dn=pt(),Fn=function(){function t(t,e){var r=this;this.fireAfterUpdate=e,this._listener=function(t){return r._listeners.forEach(function(e){return e(t)})},this._listeners=[],this.hash=function(){return lt(r._get()).hash},this.path=function(){return lt(r._get()).path},this.search=function(){return Hn(lt(r._get()).search)},this._location=self&&self.location,this._history=self&&self.history}return t.prototype.url=function(t,e){if(void 0===e&&(e=!0),Jt(t)&&t!==this._get()&&(this._set(null,null,t,e),this.fireAfterUpdate)){var r=he(new Dn("locationchange"),{url:t});this._listeners.forEach(function(t){return t(r)})}return qn(this)},t.prototype.onChange=function(t){var e=this;return this._listeners.push(t),function(){return me(e._listeners,t)}},t.prototype.dispose=function(t){ge(this._listeners)},t}(),Nn=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Un=function(t){function e(e){var r=t.call(this,e,!1)||this;return self.addEventListener("hashchange",r._listener,!1),r}return Nn(e,t),e.prototype._get=function(){return _r(this._location.hash)},e.prototype._set=function(t,e,r,n){this._location.hash=r},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),self.removeEventListener("hashchange",this._listener)},e}(Fn),Ln=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Mn=function(t){function e(e){return t.call(this,e,!0)||this}return Ln(e,t),e.prototype._get=function(){return this._url},e.prototype._set=function(t,e,r,n){this._url=r},e}(Fn),Bn=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Gn=function(t){function e(e){var r=t.call(this,e,!0)||this;return r._config=e.urlService.config,self.addEventListener("popstate",r._listener,!1),r}return Bn(e,t),e.prototype._getBasePrefix=function(){return mr(this._config.baseHref())},e.prototype._get=function(){var t=this._location,e=t.pathname,r=t.hash,n=t.search;n=gr(n)[1],r=yr(r)[1];var i=this._getBasePrefix(),o=e===this._config.baseHref(),a=e.startsWith(i);return(e=o?"/":a?e.substring(i.length):e)+(n?"?"+n:"")+(r?"#"+r:"")},e.prototype._set=function(t,e,r,n){var i=this._getBasePrefix()+r;n?this._history.replaceState(t,e,i):this._history.pushState(t,e,i)},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),self.removeEventListener("popstate",this._listener)},e}(Fn),Wn=function(){return function(){var t=this;this._baseHref="",this._port=80,this._protocol="http",this._host="localhost",this._hashPrefix="",this.port=function(){return t._port},this.protocol=function(){return t._protocol},this.host=function(){return t._host},this.baseHref=function(){return t._baseHref},this.html5Mode=function(){return!1},this.hashPrefix=function(e){return Jt(e)?t._hashPrefix=e:t._hashPrefix},this.dispose=l}}(),zn=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 Jt(t)?this._hashPrefix=t:this._hashPrefix},t.prototype.baseHref=function(t){return Jt(t)?this._baseHref=t:Jt(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):""},t.prototype.dispose=function(){},t}(),Jn=ht("vanilla.hashBangLocation",!1,Un,zn),Qn=ht("vanilla.pushStateLocation",!0,Gn,zn),Kn=ht("vanilla.memoryLocation",!1,Mn,Wn),Yn=function(){function t(){}return t.prototype.dispose=function(t){},t}(),Zn=Object.freeze({fromJson:ce,toJson:fe,forEach:le,extend:he,equals:pe,identity:f,noop:l,createProxyFunctions:h,inherit:de,inArray:ve,_inArray:p,removeFrom:me,_removeFrom:d,pushTo:ye,_pushTo:v,deregAll:ge,defaults:m,mergeR:we,ancestors:y,pick:g,omit:w,pluck:_,filter:$,find:S,mapObj:_e,map:b,values:$e,allTrueR:Se,anyTrueR:be,unnestR:Re,flattenR:Ee,pushR:R,uniqR:Ce,unnest:Te,flatten:Pe,assertPredicate:ke,assertMap:Oe,assertFn:E,pairs:xe,arrayTuples:C,applyPairs:T,tail:P,copy:k,_extend:O,silenceUncaughtInPromise:Ie,silentRejection:je,notImplemented:ae,services:ue,Glob:Mt,curry:r,compose:n,pipe:i,prop:Vt,propEq:At,parse:Ht,not:qt,and:o,or:a,all:Dt,any:Ft,is:Nt,eq:Ut,val:Lt,invoke:u,pattern:s,isUndefined:zt,isDefined:Jt,isNull:Qt,isNullOrUndefined:Kt,isFunction:Yt,isNumber:Zt,isString:Xt,isObject:te,isArray:ee,isDate:re,isRegExp:ne,isState:ie,isInjectable:c,isPromise:oe,Queue:Ve,maxLength:M,padString:B,kebobString:G,functionToString:W,fnToString:z,stringify:J,beforeAfterSubstr:dr,hostRegex:vr,stripFile:mr,splitHash:yr,splitQuery:gr,splitEqual:wr,trimHashVal:_r,splitOnDelim:Q,joinNeighborsR:K,get Category(){return t.Category},Trace:Le,trace:Me,get DefType(){return t.DefType},Param:Ze,ParamTypes:$r,StateParams:br,ParamType:Qe,PathNode:Xe,PathUtils:tr,resolvePolicies:nr,defaultResolvePolicy:er,Resolvable:rr,NATIVE_INJECTOR_TOKEN:ur,ResolveContext:sr,resolvablesBuilder:rt,StateBuilder:Pr,StateObject:Bt,StateMatcher:kr,StateQueueManager:Or,StateRegistry:xr,StateService:kn,TargetState:Be,get TransitionHookPhase(){return t.TransitionHookPhase},get TransitionHookScope(){return t.TransitionHookScope},HookBuilder:Je,matchState:A,RegisteredHook:ze,makeEvent:H,get RejectType(){return t.RejectType},Rejection:He,Transition:lr,TransitionHook:We,TransitionEventType:Rn,defaultTransOpts:Tn,TransitionService:Pn,UrlMatcher:Vr,UrlMatcherFactory:Ar,UrlRouter:Lr,UrlRuleFactory:Hr,BaseUrlRule:qr,UrlService:Yr,ViewService:Mr,UIRouterGlobals:Br,UIRouter:Xr,$q:On,$injector:Vn,BaseLocationServices:Fn,HashLocationService:Un,MemoryLocationService:Mn,PushStateLocationService:Gn,MemoryLocationConfig:Wn,BrowserLocationConfig:zn,keyValsToObjectR:An,getParams:Hn,parseUrl:lt,buildUrl:qn,locationPluginFactory:ht,getCustomEventCtor:pt,servicesPlugin:dt,hashLocationPlugin:Jn,pushStateLocationPlugin:Qn,memoryLocationPlugin:Kn,UIRouterPluginBase:Yn}),Xn=function(t,e){return t.reduce(function(t,r){return t||Jt(e[r])},!1)},ti=0,ei=function(){function t(t,e,r){var n=this;this.path=t,this.viewDecl=e,this.factory=r,this.$id=ti++,this.loaded=!1,this.getTemplate=function(t,e){return n.component?n.factory.makeComponentTemplate(t,e,n.component,n.viewDecl.bindings):n.template}}return t.prototype.load=function(){var t=this,e=ue.$q,r=new sr(this.path),n=this.path.reduce(function(t,e){return he(t,e.paramValues)},{}),i={template:e.when(this.factory.fromConfig(this.viewDecl,n,r)),controller:e.when(this.getController(r))};return e.all(i).then(function(e){return Me.traceViewServiceEvent("Loaded",t),t.controller=e.controller,he(t,e.template),t})},t.prototype.getController=function(t){var e=this.viewDecl.controllerProvider;if(!c(e))return this.viewDecl.controller;var r=ue.$injector.annotate(e),n=ee(e)?P(e):e;return new rr("",n,r).get(t)},t}(),ri=function(){function t(){var t=this;this._useHttp=jt.version.minor<3,this.$get=["$http","$templateCache","$injector",function(e,r,n){return t.$templateRequest=n.has&&n.has("$templateRequest")&&n.get("$templateRequest"),t.$http=e,t.$templateCache=r,t}]}return t.prototype.useHttpService=function(t){this._useHttp=t},t.prototype.fromConfig=function(t,e,r){var n=function(t){return ue.$q.when(t).then(function(t){return{template:t}})},i=function(t){return ue.$q.when(t).then(function(t){return{component:t}})};return Jt(t.template)?n(this.fromString(t.template,e)):Jt(t.templateUrl)?n(this.fromUrl(t.templateUrl,e)):Jt(t.templateProvider)?n(this.fromProvider(t.templateProvider,e,r)):Jt(t.component)?i(t.component):Jt(t.componentProvider)?i(this.fromComponentProvider(t.componentProvider,e,r)):n("")},t.prototype.fromString=function(t,e){return Yt(t)?t(e):t},t.prototype.fromUrl=function(t,e){return Yt(t)&&(t=t(e)),null==t?null:this._useHttp?this.$http.get(t,{cache:this.$templateCache,headers:{Accept:"text/html"}}).then(function(t){return t.data}):this.$templateRequest(t)},t.prototype.fromProvider=function(t,e,r){var n=ue.$injector.annotate(t),i=ee(t)?P(t):t;return new rr("",i,n).get(r)},t.prototype.fromComponentProvider=function(t,e,r){var n=ue.$injector.annotate(t),i=ee(t)?P(t):t;return new rr("",i,n).get(r)},t.prototype.makeComponentTemplate=function(t,e,r,n){n=n||{};var i=jt.version.minor>=3?"::":"",o=function(t){var e=G(t);return/^(x|data)-/.exec(e)?"x-"+e:e},a=yt(r).map(function(r){var a=r.name,u=r.type,s=o(a);if(t.attr(s)&&!n[a])return s+"='"+t.attr(s)+"'";var c=n[a]||a;if("@"===u)return s+"='{{"+i+"$resolve."+c+"}}'";if("&"===u){var f=e.getResolvable(c),l=f&&f.data,h=l&&ue.$injector.annotate(l)||[];return s+"='$resolve."+c+(ee(l)?"["+(l.length-1)+"]":"")+"("+h.join(",")+")'"}return s+"='"+i+"$resolve."+c+"'"}).join(" "),u=o(r);return"<"+u+" "+a+">"},t}(),ni=function(t){return ii(te(t.bindToController)?t.bindToController:t.scope)},ii=function(t){return Object.keys(t||{}).map(function(e){return[e,/^([=<@&])[?]?(.*)/.exec(t[e])]}).filter(function(t){return Jt(t)&&ee(t[1])}).map(function(t){return{name:t[1][2]||t[0],type:t[1][1]}})},oi=function(){function t(e,r){this.stateRegistry=e,this.stateService=r,h(Lt(t.prototype),this,Lt(this))}return t.prototype.decorator=function(t,e){return this.stateRegistry.decorator(t,e)||this},t.prototype.state=function(t,e){return te(t)?e=t:e.name=t,this.stateRegistry.register(e),this},t.prototype.onInvalid=function(t){return this.stateService.onInvalid(t)},t}(),ai=function(t){return function(e,r){var n=e[t],i="onExit"===t?"from":"to";return n?function(t,e){var r=new sr(t.treeChanges(i)),o=he(yi(r),{$state$:e,$transition$:t});return ue.$injector.invoke(n,this,o)}:void 0}},ui=function(){function t(t){this._urlListeners=[],this.$locationProvider=t;var e=Lt(t);h(e,this,e,["hashPrefix"])}return t.prototype.dispose=function(){},t.prototype.onChange=function(t){var e=this;return this._urlListeners.push(t),function(){return me(e._urlListeners)(t)}},t.prototype.html5Mode=function(){var t=this.$locationProvider.html5Mode();return(t=te(t)?t.enabled:t)&&this.$sniffer.history},t.prototype.url=function(t,e,r){return void 0===e&&(e=!1),t&&this.$location.url(t),e&&this.$location.replace(),r&&this.$location.state(r),this.$location.url()},t.prototype._runtimeServices=function(t,e,r,n){var i=this;this.$location=e,this.$sniffer=r,t.$on("$locationChangeSuccess",function(t){return i._urlListeners.forEach(function(e){return e(t)})});var o=Lt(e),a=Lt(n);h(o,this,o,["replace","path","search","hash"]),h(o,this,o,["port","protocol","host"]),h(a,this,a,["baseHref"])},t.monkeyPatchPathParameterType=function(t){var e=t.urlMatcherFactory.type("path");e.encode=function(t){return null!=t?t.toString().replace(/(~|\/)/g,function(t){return{"~":"~~","/":"~2F"}[t]}):t},e.decode=function(t){return null!=t?t.toString().replace(/(~~|~2F)/g,function(t){return{"~~":"~","~2F":"/"}[t]}):t}},t}(),si=function(){function t(t){this._router=t,this._urlRouter=t.urlRouter}return t.prototype.$get=function(){var t=this._urlRouter;return t.update(!0),t.interceptDeferred||t.listen(),t},t.prototype.rule=function(t){var e=this;if(!Yt(t))throw new Error("'rule' must be a function");var r=new qr(function(){return t(ue.$injector,e._router.locationService)},f);return this._urlRouter.rule(r),this},t.prototype.otherwise=function(t){var e=this,r=this._urlRouter;if(Xt(t))r.otherwise(t);else{if(!Yt(t))throw new Error("'rule' must be a string or function");r.otherwise(function(){return t(ue.$injector,e._router.locationService)})}return this},t.prototype.when=function(e,r){return(ee(r)||Yt(r))&&(r=t.injectableHandler(this._router,r)),this._urlRouter.when(e,r),this},t.injectableHandler=function(t,e){return function(r){return ue.$injector.invoke(e,null,{$match:r,$stateParams:t.globals.params})}},t.prototype.deferIntercept=function(t){this._urlRouter.deferIntercept(t)},t}();jt.module("ui.router.angular1",[]);var ci=jt.module("ui.router.init",[]),fi=jt.module("ui.router.util",["ng","ui.router.init"]),li=jt.module("ui.router.router",["ui.router.util"]),hi=jt.module("ui.router.state",["ui.router.router","ui.router.util","ui.router.angular1"]),pi=jt.module("ui.router",["ui.router.init","ui.router.state","ui.router.angular1"]),di=(jt.module("ui.router.compat",["ui.router"]),null);gt.$inject=["$locationProvider"];var vi=function(t){return["$uiRouterProvider",function(e){var r=e.router[t];return r.$get=function(){return r},r}]};wt.$inject=["$injector","$q","$uiRouter"];_t.$inject=["$rootScope"],ci.provider("$uiRouter",gt),li.provider("$urlRouter",["$uiRouterProvider",function(t){return t.urlRouterProvider=new si(t)}]),fi.provider("$urlService",vi("urlService")),fi.provider("$urlMatcherFactory",["$uiRouterProvider",function(){return di.urlMatcherFactory}]),fi.provider("$templateFactory",function(){return new ri}),hi.provider("$stateRegistry",vi("stateRegistry")),hi.provider("$uiRouterGlobals",vi("globals")),hi.provider("$transitions",vi("transitionService")),hi.provider("$state",["$uiRouterProvider",function(){return he(di.stateProvider,{$get:function(){return di.stateService}})}]),hi.factory("$stateParams",["$uiRouter",function(t){return t.globals.params}]),pi.factory("$view",function(){return di.viewService}),pi.service("$trace",function(){return Me}),pi.run(_t),fi.run(["$urlMatcherFactory",function(t){}]),hi.run(["$state",function(t){}]),li.run(["$urlRouter",function(t){}]),ci.run(wt);var mi,yi=function(t){return t.getTokens().filter(Xt).map(function(e){var r=t.getResolvable(e);return[e,"NOWAIT"===t.getPolicy(r).async?r.promise:r.data]}).reduce(T,{})};mi=["$uiRouter","$timeout",function(t,e){var r=t.stateService;return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(n,i,o,a){function u(){var t=p();l&&l(),f&&(l=f.$$addStateInfo(t.uiState,t.uiStateParams)),null!=t.href&&o.$set(c.attr,t.href)}var s,c=Rt(i),f=a[1]||a[0],l=null,h={},p=function(){return bt(r,i,h)},d=$t(o.uiSref);h.uiState=d.state,h.uiStateOpts=o.uiSrefOpts?n.$eval(o.uiSrefOpts):{},d.paramExpr&&(n.$watch(d.paramExpr,function(t){h.uiStateParams=he({},t),u()},!0),h.uiStateParams=he({},n.$eval(d.paramExpr))),u(),n.$on("$destroy",t.stateRegistry.onStatesChanged(u)),n.$on("$destroy",t.transitionService.onSuccess({},u)),c.clickable&&(s=Et(i,r,e,c,p),Tt(i,n,s,h.uiStateOpts))}}}];var gi;gi=["$uiRouter","$timeout",function(t,e){var r=t.stateService;return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(n,i,o,a){function u(){var t=d();h&&h(),f&&(h=f.$$addStateInfo(t.uiState,t.uiStateParams)),null!=t.href&&o.$set(c.attr,t.href)}var s,c=Rt(i),f=a[1]||a[0],h=null,p={},d=function(){return bt(r,i,p)},v=["uiState","uiStateParams","uiStateOpts"],m=v.reduce(function(t,e){return t[e]=l,t},{});v.forEach(function(t){p[t]=o[t]?n.$eval(o[t]):null,o.$observe(t,function(e){m[t](),m[t]=n.$watch(e,function(e){p[t]=e,u()},!0)})}),u(),n.$on("$destroy",t.stateRegistry.onStatesChanged(u)),n.$on("$destroy",t.transitionService.onSuccess({},u)),c.clickable&&(s=Et(i,r,e,c,d),Tt(i,n,s,p.uiStateOpts))}}}];var wi;wi=["$state","$stateParams","$interpolate","$uiRouter",function(t,e,r,n){return{restrict:"A",controller:["$scope","$element","$attrs",function(e,i,o){function a(t){t.promise.then(s,l)}function u(e,r,n){var o={state:t.get(e,St(i))||{name:e},params:r,activeClass:n};return p.push(o),function(){me(p)(o)}}function s(){var r=function(t){return t.split(/\s/).filter(f)},n=function(t){return t.map(function(t){return t.activeClass}).map(r).reduce(Re,[])},o=n(p).concat(r(c)).reduce(Ce,[]),a=n(p.filter(function(e){return t.includes(e.state.name,e.params)})),u=!!p.filter(function(e){return t.is(e.state.name,e.params)}).length?r(c):[],s=a.concat(u).reduce(Ce,[]),l=o.filter(function(t){return!ve(s,t)});e.$evalAsync(function(){s.forEach(function(t){return i.addClass(t)}),l.forEach(function(t){return i.removeClass(t)})})}var c,h,p=[];c=r(o.uiSrefActiveEq||"",!1)(e);try{h=e.$eval(o.uiSrefActive)}catch(t){}h=h||r(o.uiSrefActive||"",!1)(e),te(h)&&le(h,function(t,r){if(Xt(t)){var n=$t(t);u(n.state,e.$eval(n.paramExpr),r)}}),this.$$addStateInfo=function(t,e){if(!(te(h)&&p.length>0)){var r=u(t,e,h);return s(),r}},e.$on("$stateChangeSuccess",s),e.$on("$destroy",n.transitionService.onStart({},a)),n.globals.transition&&a(n.globals.transition),s()}]}}],jt.module("ui.router.state").directive("uiSref",mi).directive("uiSrefActive",wi).directive("uiSrefActiveEq",wi).directive("uiState",gi),Pt.$inject=["$state"],kt.$inject=["$state"],jt.module("ui.router.state").filter("isState",Pt).filter("includedByState",kt);var _i;_i=["$view","$animate","$uiViewScroll","$interpolate","$q",function(t,e,r,n,i){function o(t,r){return{enter:function(t,r,n){jt.version.minor>2?e.enter(t,null,r).then(n):e.enter(t,null,r,n)},leave:function(t,r){jt.version.minor>2?e.leave(t).then(r):e.leave(t,r)}}}function a(t,e){return t===e}var u={$cfg:{viewDecl:{$context:t._pluginapi._rootViewContext()}},$uiView:{}},s={count:0,restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(e,c,f){return function(e,c,l){function h(){if(d&&(Me.traceUIViewEvent("Removing (previous) el",d.data("$uiView")),d.remove(),d=null),m&&(Me.traceUIViewEvent("Destroying scope",R),m.$destroy(),m=null),v){var t=v.data("$uiViewAnim");Me.traceUIViewEvent("Animate out",t),_.leave(v,function(){t.$$animLeave.resolve(),d=null}),d=v,v=null}}function p(t){var n=e.$new(),o=i.defer(),a=i.defer(),u={$cfg:t,$uiView:R},s={$animEnter:o.promise,$animLeave:a.promise,$$animLeave:a};n.$emit("$viewContentLoading",b);var l=f(n,function(t){t.data("$uiViewAnim",s),t.data("$uiView",u),_.enter(t,c,function(){o.resolve(),m&&m.$emit("$viewContentAnimationEnded"),(Jt(w)&&!w||e.$eval(w))&&r(t)}),h()});v=l,(m=n).$emit("$viewContentLoaded",t||$),m.$eval(g)}var d,v,m,y,g=l.onload||"",w=l.autoscroll,_=o(),$=void 0,S=c.inheritedData("$uiView")||u,b=n(l.uiView||l.name||"")(e)||"$default",R={$type:"ng1",id:s.count++,name:b,fqn:S.$uiView.fqn?S.$uiView.fqn+"."+b:b,config:null,configUpdated:function(t){(!t||t instanceof ei)&&(a($,t)||(Me.traceUIViewConfigUpdated(R,t&&t.viewDecl&&t.viewDecl.$context),$=t,p(t)))},get creationContext(){var t=Ht("$cfg.viewDecl.$context")(S),e=Ht("$uiView.creationContext")(S);return t||e}};Me.traceUIViewEvent("Linking",R),c.data("$uiView",{$uiView:R}),p(),y=t.registerUIView(R),e.$on("$destroy",function(){Me.traceUIViewEvent("Destroying/Unregistering",R),y()})}}};return s}],Ot.$inject=["$compile","$controller","$transitions","$view","$q","$timeout"];var $i="function"==typeof jt.module("ui.router").component,Si=0;jt.module("ui.router.state").directive("uiView",_i),jt.module("ui.router.state").directive("uiView",Ot),jt.module("ui.router.state").provider("$uiViewScroll",function(){var t=!1;this.useAnchorScroll=function(){t=!0},this.$get=["$anchorScroll","$timeout",function(e,r){return t?e:function(t){return r(function(){t[0].scrollIntoView()},0,!1)}}]});t.default="ui.router",t.core=Zn,t.watchDigests=_t,t.getLocals=yi,t.getNg1ViewConfigFactory=vt,t.ng1ViewsBuilder=mt,t.Ng1ViewConfig=ei,t.StateProvider=oi,t.UrlRouterProvider=si,t.fromJson=ce,t.toJson=fe,t.forEach=le,t.extend=he,t.equals=pe,t.identity=f,t.noop=l,t.createProxyFunctions=h,t.inherit=de,t.inArray=ve,t._inArray=p,t.removeFrom=me,t._removeFrom=d,t.pushTo=ye,t._pushTo=v,t.deregAll=ge,t.defaults=m,t.mergeR=we,t.ancestors=y,t.pick=g,t.omit=w,t.pluck=_,t.filter=$,t.find=S,t.mapObj=_e,t.map=b,t.values=$e,t.allTrueR=Se,t.anyTrueR=be,t.unnestR=Re,t.flattenR=Ee,t.pushR=R,t.uniqR=Ce,t.unnest=Te,t.flatten=Pe,t.assertPredicate=ke,t.assertMap=Oe,t.assertFn=E,t.pairs=xe,t.arrayTuples=C,t.applyPairs=T,t.tail=P,t.copy=k,t._extend=O,t.silenceUncaughtInPromise=Ie,t.silentRejection=je,t.notImplemented=ae,t.services=ue,t.Glob=Mt,t.curry=r,t.compose=n,t.pipe=i,t.prop=Vt,t.propEq=At,t.parse=Ht,t.not=qt,t.and=o,t.or=a,t.all=Dt,t.any=Ft,t.is=Nt,t.eq=Ut,t.val=Lt,t.invoke=u,t.pattern=s,t.isUndefined=zt,t.isDefined=Jt,t.isNull=Qt,t.isNullOrUndefined=Kt,t.isFunction=Yt,t.isNumber=Zt,t.isString=Xt,t.isObject=te,t.isArray=ee,t.isDate=re,t.isRegExp=ne,t.isState=ie,t.isInjectable=c,t.isPromise=oe,t.Queue=Ve,t.maxLength=M,t.padString=B,t.kebobString=G,t.functionToString=W,t.fnToString=z,t.stringify=J,t.beforeAfterSubstr=dr,t.hostRegex=vr,t.stripFile=mr,t.splitHash=yr,t.splitQuery=gr,t.splitEqual=wr,t.trimHashVal=_r,t.splitOnDelim=Q,t.joinNeighborsR=K,t.Trace=Le,t.trace=Me,t.Param=Ze,t.ParamTypes=$r,t.StateParams=br,t.ParamType=Qe,t.PathNode=Xe,t.PathUtils=tr,t.resolvePolicies=nr,t.defaultResolvePolicy=er,t.Resolvable=rr,t.NATIVE_INJECTOR_TOKEN=ur,t.ResolveContext=sr,t.resolvablesBuilder=rt,t.StateBuilder=Pr,t.StateObject=Bt,t.StateMatcher=kr,t.StateQueueManager=Or,t.StateRegistry=xr,t.StateService=kn,t.TargetState=Be,t.HookBuilder=Je,t.matchState=A,t.RegisteredHook=ze,t.makeEvent=H,t.Rejection=He,t.Transition=lr,t.TransitionHook=We,t.TransitionEventType=Rn,t.defaultTransOpts=Tn,t.TransitionService=Pn,t.UrlMatcher=Vr,t.UrlMatcherFactory=Ar,t.UrlRouter=Lr,t.UrlRuleFactory=Hr,t.BaseUrlRule=qr,t.UrlService=Yr,t.ViewService=Mr,t.UIRouterGlobals=Br,t.UIRouter=Xr,t.$q=On,t.$injector=Vn,t.BaseLocationServices=Fn,t.HashLocationService=Un,t.MemoryLocationService=Mn,t.PushStateLocationService=Gn,t.MemoryLocationConfig=Wn,t.BrowserLocationConfig=zn,t.keyValsToObjectR=An,t.getParams=Hn,t.parseUrl=lt,t.buildUrl=qn,t.locationPluginFactory=ht,t.getCustomEventCtor=pt,t.servicesPlugin=dt,t.hashLocationPlugin=Jn,t.pushStateLocationPlugin=Qn,t.memoryLocationPlugin=Kn,t.UIRouterPluginBase=Yn,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=angular-ui-router.min.js.map diff --git a/UI/WebServerResources/js/vendor/angular-ui-router.min.js.map b/UI/WebServerResources/js/vendor/angular-ui-router.min.js.map index 77d6155d4..a9c73f65d 100644 --- a/UI/WebServerResources/js/vendor/angular-ui-router.min.js.map +++ b/UI/WebServerResources/js/vendor/angular-ui-router.min.js.map @@ -1 +1 @@ -{"version":3,"file":null,"sources":["../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/hof.ts","../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/predicates.ts","../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/common.ts","../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/trace.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/hookRegistry.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/hookBuilder.ts","../node_modules/@uirouter/core/lib-esm/params/@uirouter/core/params/paramType.ts","../node_modules/@uirouter/core/lib-esm/params/@uirouter/core/params/param.ts","../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/strings.ts","../node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateBuilder.ts","../node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlMatcher.ts","../node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlRouter.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/coreResolvables.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/onEnterExitRetain.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/lazyLoad.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/ignoredTransition.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/invalidTransition.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/utils.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/plugins.ts","@uirouter/angularjs/statebuilders/views.ts","@uirouter/angularjs/templateFactory.ts","@uirouter/angularjs/services.ts","@uirouter/angularjs/directives/stateDirectives.ts","@uirouter/angularjs/stateFilters.ts","@uirouter/angularjs/directives/viewDirective.ts","@uirouter/angularjs/viewScroll.ts","@uirouter/angularjs/angular.ts","../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/glob.ts","../node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateObject.ts","../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/coreservices.ts","../node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/queue.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/rejectFactory.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/interface.ts","../node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/targetState.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/transitionHook.ts","../node_modules/@uirouter/core/lib-esm/path/@uirouter/core/path/pathNode.ts","../node_modules/@uirouter/core/lib-esm/path/@uirouter/core/path/pathFactory.ts","../node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/resolvable.ts","../node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/interface.ts","../node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/resolveContext.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/transition.ts","../node_modules/@uirouter/core/lib-esm/params/@uirouter/core/params/paramTypes.ts","../node_modules/@uirouter/core/lib-esm/params/@uirouter/core/params/stateParams.ts","../node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateMatcher.ts","../node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateQueueManager.ts","../node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateRegistry.ts","../node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlMatcherFactory.ts","../node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlRule.ts","../node_modules/@uirouter/core/lib-esm/view/@uirouter/core/view/view.ts","../node_modules/@uirouter/core/lib-esm/@uirouter/core/globals.ts","../node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlService.ts","../node_modules/@uirouter/core/lib-esm/@uirouter/core/router.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/redirectTo.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/resolve.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/views.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/updateGlobals.ts","../node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/url.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/transitionEventType.ts","../node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/transitionService.ts","../node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateService.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/q.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/injector.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/baseLocationService.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/hashLocationService.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/memoryLocationService.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/pushStateLocationService.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/memoryLocationConfig.ts","../node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/browserLocationConfig.ts","../node_modules/@uirouter/core/lib-esm/@uirouter/core/interface.ts","@uirouter/angularjs/stateProvider.ts","@uirouter/angularjs/statebuilders/onEnterExitRetain.ts","@uirouter/angularjs/locationServices.ts","@uirouter/angularjs/urlRouterProvider.ts","@uirouter/angularjs/index.ts"],"sourcesContent":["/**\n * Higher order functions\n *\n * These utility functions are exported, but are subject to change without notice.\n *\n * @module common_hof\n */ /** */\n\nimport {Predicate} from \"./common\";\n/**\n * Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function.\n *\n * Given a function with N parameters, returns a new function that supports partial application.\n * The new function accepts anywhere from 1 to N parameters. When that function is called with M parameters,\n * where M is less than N, it returns a new function that accepts the remaining parameters. It continues to\n * accept more parameters until all N parameters have been supplied.\n *\n *\n * This contrived example uses a partially applied function as an predicate, which returns true\n * if an object is found in both arrays.\n * @example\n * ```\n * // returns true if an object is in both of the two arrays\n * function inBoth(array1, array2, object) {\n * return array1.indexOf(object) !== -1 &&\n * array2.indexOf(object) !== 1;\n * }\n * let obj1, obj2, obj3, obj4, obj5, obj6, obj7\n * let foos = [obj1, obj3]\n * let bars = [obj3, obj4, obj5]\n *\n * // A curried \"copy\" of inBoth\n * let curriedInBoth = curry(inBoth);\n * // Partially apply both the array1 and array2\n * let inFoosAndBars = curriedInBoth(foos, bars);\n *\n * // Supply the final argument; since all arguments are\n * // supplied, the original inBoth function is then called.\n * let obj1InBoth = inFoosAndBars(obj1); // false\n *\n * // Use the inFoosAndBars as a predicate.\n * // Filter, on each iteration, supplies the final argument\n * let allObjs = [ obj1, obj2, obj3, obj4, obj5, obj6, obj7 ];\n * let foundInBoth = allObjs.filter(inFoosAndBars); // [ obj3 ]\n *\n * ```\n *\n * Stolen from: http://stackoverflow.com/questions/4394747/javascript-curry-function\n *\n * @param fn\n * @returns {*|function(): (*|any)}\n */\nexport function curry(fn: Function): Function {\n let initial_args = [].slice.apply(arguments, [1]);\n let func_args_length = fn.length;\n\n function curried(args: any[]) {\n if (args.length >= func_args_length)\n return fn.apply(null, args);\n return function () {\n return curried(args.concat([].slice.apply(arguments)));\n };\n }\n return curried(initial_args);\n}\n\n\n\n/**\n * Given a varargs list of functions, returns a function that composes the argument functions, right-to-left\n * given: f(x), g(x), h(x)\n * let composed = compose(f,g,h)\n * then, composed is: f(g(h(x)))\n */\nexport function compose() {\n let args = arguments;\n let start = args.length - 1;\n return function() {\n let i = start, result = args[start].apply(this, arguments);\n while (i--) result = args[i].call(this, result);\n return result;\n };\n}\n\n/**\n * Given a varargs list of functions, returns a function that is composes the argument functions, left-to-right\n * given: f(x), g(x), h(x)\n * let piped = pipe(f,g,h);\n * then, piped is: h(g(f(x)))\n */\nexport function pipe(...funcs: Function[]): (obj: any) => any {\n return compose.apply(null, [].slice.call(arguments).reverse());\n}\n\n/**\n * Given a property name, returns a function that returns that property from an object\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = prop(\"name\");\n * getName(obj) === \"blarg\"\n */\nexport const prop = (name: string) =>\n (obj: any) => obj && obj[name];\n\n/**\n * Given a property name and a value, returns a function that returns a boolean based on whether\n * the passed object has a property that matches the value\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = propEq(\"name\", \"blarg\");\n * getName(obj) === true\n */\nexport const propEq = curry((name: string, val: any, obj: any) => obj && obj[name] === val);\n\n/**\n * Given a dotted property name, returns a function that returns a nested property from an object, or undefined\n * let obj = { id: 1, nestedObj: { foo: 1, name: \"blarg\" }, };\n * let getName = prop(\"nestedObj.name\");\n * getName(obj) === \"blarg\"\n * let propNotFound = prop(\"this.property.doesnt.exist\");\n * propNotFound(obj) === undefined\n */\nexport const parse = (name: string) =>\n pipe.apply(null, name.split(\".\").map(prop));\n\n/**\n * Given a function that returns a truthy or falsey value, returns a\n * function that returns the opposite (falsey or truthy) value given the same inputs\n */\nexport const not: (fn: Predicate) => Predicate = (fn: Predicate) =>\n (...args: any[]) => !fn.apply(null, args);\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if both functions return truthy for the given arguments\n */\nexport function and(fn1: Predicate, fn2: Predicate): Predicate {\n return (...args: any[]) => fn1.apply(null, args) && fn2.apply(null, args);\n}\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if at least one of the functions returns truthy for the given arguments\n */\nexport function or(fn1: Predicate, fn2: Predicate): Predicate {\n return (...args: any[]) => fn1.apply(null, args) || fn2.apply(null, args);\n}\n\n/**\n * Check if all the elements of an array match a predicate function\n *\n * @param fn1 a predicate function `fn1`\n * @returns a function which takes an array and returns true if `fn1` is true for all elements of the array\n */\nexport const all = (fn1: Predicate) =>\n (arr: any[]) => arr.reduce((b, x) => b && !!fn1(x), true) as boolean;\nexport const any = (fn1: Predicate) =>\n (arr: any[]) => arr.reduce((b, x) => b || !!fn1(x), false) as boolean;\n\n/** Given a class, returns a Predicate function that returns true if the object is of that class */\nexport const is = (ctor: { new(...args): T }) =>\n (obj: any): obj is T =>\n (obj != null && obj.constructor === ctor || obj instanceof ctor);\n\n/** Given a value, returns a Predicate function that returns true if another value is === equal to the original value */\nexport const eq: (comp: any) => Predicate = (val: any) => (other: any) =>\n val === other;\n\n/** Given a value, returns a function which returns the value */\nexport const val = (v: T) => () => v;\n\n\n\nexport function invoke(fnName: string): Function;\nexport function invoke(fnName: string, args: any[]): Function;\nexport function invoke(fnName: string, args?: any[]): Function {\n return (obj: any) =>\n obj[fnName].apply(obj, args);\n}\n\n/**\n * Sorta like Pattern Matching (a functional programming conditional construct)\n *\n * See http://c2.com/cgi/wiki?PatternMatching\n *\n * This is a conditional construct which allows a series of predicates and output functions\n * to be checked and then applied. Each predicate receives the input. If the predicate\n * returns truthy, then its matching output function (mapping function) is provided with\n * the input and, then the result is returned.\n *\n * Each combination (2-tuple) of predicate + output function should be placed in an array\n * of size 2: [ predicate, mapFn ]\n *\n * These 2-tuples should be put in an outer array.\n *\n * @example\n * ```\n *\n * // Here's a 2-tuple where the first element is the isString predicate\n * // and the second element is a function that returns a description of the input\n * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];\n *\n * // Second tuple: predicate \"isNumber\", mapfn returns a description\n * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];\n *\n * let third = [ (input) => input === null, (input) => `Oh, null...` ];\n *\n * let fourth = [ (input) => input === undefined, (input) => `notdefined` ];\n *\n * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);\n *\n * console.log(descriptionOf(undefined)); // 'notdefined'\n * console.log(descriptionOf(55)); // '(55) That's a number!'\n * console.log(descriptionOf(\"foo\")); // 'Here's your string foo'\n * ```\n *\n * @param struct A 2D array. Each element of the array should be an array, a 2-tuple,\n * with a Predicate and a mapping/output function\n * @returns {function(any): *}\n */\nexport function pattern(struct: Function[][]): Function {\n return function(x: any) {\n for (var i = 0; i < struct.length; i++) {\n if (struct[i][0](x)) return struct[i][1](x);\n }\n };\n}\n\n","/** Predicates\n *\n * These predicates return true/false based on the input.\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_predicates\n */\n/** */\nimport { and, not, pipe, prop, or } from \"./hof\";\nimport { Predicate } from \"./common\"; // has or is using\nimport { StateObject } from \"../state/stateObject\";\n\nconst toStr = Object.prototype.toString;\nconst tis = (t: string) => (x: any) => typeof(x) === t;\nexport const isUndefined = tis('undefined');\nexport const isDefined = not(isUndefined);\nexport const isNull = (o: any) => o === null;\nexport const isNullOrUndefined = or(isNull, isUndefined);\nexport const isFunction: (x: any) => x is Function = tis('function');\nexport const isNumber: (x: any) => x is number = tis('number');\nexport const isString = <(x: any) => x is string> tis('string');\nexport const isObject = (x: any) => x !== null && typeof x === 'object';\nexport const isArray = Array.isArray;\nexport const isDate: (x: any) => x is Date = ((x: any) => toStr.call(x) === '[object Date]');\nexport const isRegExp: (x: any) => x is RegExp = ((x: any) => toStr.call(x) === '[object RegExp]');\nexport const isState: (x: any) => x is StateObject = StateObject.isState;\n\n/**\n * Predicate which checks if a value is injectable\n *\n * A value is \"injectable\" if it is a function, or if it is an ng1 array-notation-style array\n * where all the elements in the array are Strings, except the last one, which is a Function\n */\nexport function isInjectable(val: any) {\n if (isArray(val) && val.length) {\n let head = val.slice(0, -1), tail = val.slice(-1);\n return !(head.filter(not(isString)).length || tail.filter(not(isFunction)).length);\n }\n return isFunction(val);\n}\n\n/**\n * Predicate which checks if a value looks like a Promise\n *\n * It is probably a Promise if it's an object, and it has a `then` property which is a Function\n */\nexport const isPromise = <(x: any) => x is Promise> and(isObject, pipe(prop('then'), isFunction));\n\n","/**\n * Random utility functions used in the UI-Router code\n *\n * These functions are exported, but are subject to change without notice.\n *\n * @preferred\n * @module common\n */\n/** for typedoc */\nimport { isFunction, isString, isArray, isRegExp, isDate } from \"./predicates\";\nimport { all, any, prop, curry, not } from \"./hof\";\nimport { services } from \"./coreservices\";\nimport { StateObject } from \"../state/stateObject\";\n\nlet w: any = typeof window === 'undefined' ? {} : window;\nlet angular = w.angular || {};\nexport const fromJson = angular.fromJson || JSON.parse.bind(JSON);\nexport const toJson = angular.toJson || JSON.stringify.bind(JSON);\nexport const copy = angular.copy || _copy;\nexport const forEach = angular.forEach || _forEach;\nexport const extend = Object.assign || _extend;\nexport const equals = angular.equals || _equals;\nexport function identity(x: any) { return x; }\nexport function noop(): any {}\n\nexport type Mapper = (x: X, key?: (string|number)) => T;\nexport interface TypedMap { [key: string]: T; }\nexport type Predicate = (x?: X) => boolean;\n/**\n * An ng1-style injectable\n *\n * This could be a (non-minified) function such as:\n * ```js\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an explicitly annotated function (minify safe)\n * ```js\n * injectableFunction.$inject = [ 'SomeDependency' ];\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an array style annotated function (minify safe)\n * ```js\n * ['SomeDependency', function injectableFunction(SomeDependency) {\n *\n * }];\n * ```\n *\n * @publicapi\n */\nexport type IInjectable = (Function|any[]);\n\nexport interface Obj extends Object {\n [key: string]: any;\n}\n\n/**\n * Builds proxy functions on the `to` object which pass through to the `from` object.\n *\n * For each key in `fnNames`, creates a proxy function on the `to` object.\n * The proxy function calls the real function on the `from` object.\n *\n *\n * #### Example:\n * This example creates an new class instance whose functions are prebound to the new'd object.\n * ```js\n * class Foo {\n * constructor(data) {\n * // Binds all functions from Foo.prototype to 'this',\n * // then copies them to 'this'\n * bindFunctions(Foo.prototype, this, this);\n * this.data = data;\n * }\n *\n * log() {\n * console.log(this.data);\n * }\n * }\n *\n * let myFoo = new Foo([1,2,3]);\n * var logit = myFoo.log;\n * logit(); // logs [1, 2, 3] from the myFoo 'this' instance\n * ```\n *\n * #### Example:\n * This example creates a bound version of a service function, and copies it to another object\n * ```\n *\n * var SomeService = {\n * this.data = [3, 4, 5];\n * this.log = function() {\n * console.log(this.data);\n * }\n * }\n *\n * // Constructor fn\n * function OtherThing() {\n * // Binds all functions from SomeService to SomeService,\n * // then copies them to 'this'\n * bindFunctions(SomeService, this, SomeService);\n * }\n *\n * let myOtherThing = new OtherThing();\n * myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this'\n * ```\n *\n * @param source A function that returns the source object which contains the original functions to be bound\n * @param target A function that returns the target object which will receive the bound functions\n * @param bind A function that returns the object which the functions will be bound to\n * @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object)\n * @param latebind If true, the binding of the function is delayed until the first time it's invoked\n */\nexport function createProxyFunctions(source: Function, target: Obj, bind: Function, fnNames?: string[], latebind = false): Obj {\n const bindFunction = (fnName) =>\n source()[fnName].bind(bind());\n\n const makeLateRebindFn = fnName => function lateRebindFunction() {\n target[fnName] = bindFunction(fnName);\n return target[fnName].apply(null, arguments);\n };\n\n fnNames = fnNames || Object.keys(source());\n\n return fnNames.reduce((acc, name) => {\n acc[name] = latebind ? makeLateRebindFn(name) : bindFunction(name);\n return acc;\n }, target);\n}\n\n\n/**\n * prototypal inheritance helper.\n * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it\n */\nexport const inherit = (parent: Obj, extra?: Obj) =>\n extend(Object.create(parent), extra);\n\n/** Given an array, returns true if the object is found in the array, (using indexOf) */\nexport const inArray: typeof _inArray = curry(_inArray) as any;\nexport function _inArray(array: any[], obj: any): boolean;\nexport function _inArray(array: any[]): (obj: any) => boolean;\nexport function _inArray(array, obj?): any {\n return array.indexOf(obj) !== -1;\n}\n\n/**\n * Given an array, and an item, if the item is found in the array, it removes it (in-place).\n * The same array is returned\n */\nexport const removeFrom: typeof _removeFrom = curry(_removeFrom) as any;\nexport function _removeFrom(array: T[], obj: T): T[];\nexport function _removeFrom(array: T[]): (obj: T) => T[];\nexport function _removeFrom(array, obj?) {\n let idx = array.indexOf(obj);\n if (idx >= 0) array.splice(idx, 1);\n return array;\n}\n\n/** pushes a values to an array and returns the value */\nexport const pushTo: typeof _pushTo = curry(_pushTo) as any;\nexport function _pushTo(arr: T[], val: T): T ;\nexport function _pushTo(arr: T[]): (val: T) => T ;\nexport function _pushTo(arr, val?): any {\n return (arr.push(val), val);\n}\n\n/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */\nexport const deregAll = (functions: Function[]) =>\n functions.slice().forEach(fn => {\n typeof fn === 'function' && fn();\n removeFrom(functions, fn);\n });\n/**\n * Applies a set of defaults to an options object. The options object is filtered\n * to only those properties of the objects in the defaultsList.\n * Earlier objects in the defaultsList take precedence when applying defaults.\n */\nexport function defaults(opts, ...defaultsList: Obj[]) {\n let _defaultsList = defaultsList.concat({}).reverse();\n let defaultVals = extend.apply(null, _defaultsList);\n return extend({}, defaultVals, pick(opts || {}, Object.keys(defaultVals)));\n}\n\n/** Reduce function that merges each element of the list into a single object, using extend */\nexport const mergeR = (memo: Obj, item: Obj) => extend(memo, item);\n\n/**\n * Finds the common ancestor path between two states.\n *\n * @param {Object} first The first state.\n * @param {Object} second The second state.\n * @return {Array} Returns an array of state names in descending order, not including the root.\n */\nexport function ancestors(first: StateObject, second: StateObject) {\n let path: StateObject[] = [];\n\n for (let n in first.path) {\n if (first.path[n] !== second.path[n]) break;\n path.push(first.path[n]);\n }\n return path;\n}\n\n/**\n * Return a copy of the object only containing the whitelisted properties.\n *\n * #### Example:\n * ```\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the whitelisted property names\n */\nexport function pick(obj: Obj, propNames: string[]): Obj {\n let objCopy = {};\n for (let prop in obj) {\n if (propNames.indexOf(prop) !== -1) {\n objCopy[prop] = obj[prop];\n }\n }\n return objCopy;\n}\n\n/**\n * Return a copy of the object omitting the blacklisted properties.\n *\n * @example\n * ```\n *\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = omit(foo, ['a', 'b']); // { c: 3 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the blacklisted property names\n */\nexport function omit(obj: Obj, propNames: string[]): Obj {\n return Object.keys(obj)\n .filter(not(inArray(propNames)))\n .reduce((acc, key) => (acc[key] = obj[key], acc), {});\n}\n\n\n/** Given an array of objects, maps each element to a named property of the element. */\nexport function pluck(collection: Obj[], propName: string): T[];\n/** Given an object, maps each property of the object to a named property of the property. */\nexport function pluck(collection: { [key: string]: any }, propName: string): { [key: string]: any };\n/**\n * Maps an array, or object to a property (by name)\n */\nexport function pluck(collection: any, propName: string): any {\n return map(collection, > prop(propName));\n}\n\n\n/** Given an array of objects, returns a new array containing only the elements which passed the callback predicate */\nexport function filter(collection: T[], callback: (t: T, key?: number) => boolean): T[];\n/** Given an object, returns a new object with only those properties that passed the callback predicate */\nexport function filter(collection: TypedMap, callback: (t: T, key?: string) => boolean): TypedMap;\n/** Filters an Array or an Object's properties based on a predicate */\nexport function filter(collection: any, callback: Function): T {\n let arr = isArray(collection), result: any = arr ? [] : {};\n let accept = arr ? x => result.push(x) : (x, key) => result[key] = x;\n forEach(collection, function(item, i) {\n if (callback(item, i)) accept(item, i);\n });\n return result;\n}\n\n\n/** Given an object, return the first property of that object which passed the callback predicate */\nexport function find(collection: TypedMap, callback: Predicate): T;\n/** Given an array of objects, returns the first object which passed the callback predicate */\nexport function find(collection: T[], callback: Predicate): T;\n/** Finds an object from an array, or a property of an object, that matches a predicate */\nexport function find(collection: any, callback: any) {\n let result;\n\n forEach(collection, function(item, i) {\n if (result) return;\n if (callback(item, i)) result = item;\n });\n\n return result;\n}\n\n/** Given an object, returns a new object, where each property is transformed by the callback function */\nexport let mapObj: (collection: { [key: string]: T }, callback: Mapper) => { [key: string]: U } = map;\n/** Given an array, returns a new array, where each element is transformed by the callback function */\nexport function map(collection: T[], callback: Mapper): U[];\nexport function map(collection: { [key: string]: T }, callback: Mapper): { [key: string]: U };\n/** Maps an array or object properties using a callback function */\nexport function map(collection: any, callback: any): any {\n let result = isArray(collection) ? [] : {};\n forEach(collection, (item, i) => result[i] = callback(item, i));\n return result;\n}\n\n/**\n * Given an object, return its enumerable property values\n *\n * @example\n * ```\n *\n * let foo = { a: 1, b: 2, c: 3 }\n * let vals = values(foo); // [ 1, 2, 3 ]\n * ```\n */\nexport const values: ( (obj: TypedMap) => T[]) = (obj: Obj) =>\n Object.keys(obj).map(key => obj[key]);\n\n/**\n * Reduce function that returns true if all of the values are truthy.\n *\n * @example\n * ```\n *\n * let vals = [ 1, true, {}, \"hello world\"];\n * vals.reduce(allTrueR, true); // true\n *\n * vals.push(0);\n * vals.reduce(allTrueR, true); // false\n * ```\n */\nexport const allTrueR = (memo: boolean, elem: any) => memo && elem;\n\n/**\n * Reduce function that returns true if any of the values are truthy.\n *\n * * @example\n * ```\n *\n * let vals = [ 0, null, undefined ];\n * vals.reduce(anyTrueR, true); // false\n *\n * vals.push(\"hello world\");\n * vals.reduce(anyTrueR, true); // true\n * ```\n */\nexport const anyTrueR = (memo: boolean, elem: any) => memo || elem;\n\n/**\n * Reduce function which un-nests a single level of arrays\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnestR = (memo: any[], elem: any[]) => memo.concat(elem);\n\n/**\n * Reduce function which recursively un-nests all arrays\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flattenR = (memo: any[], elem: any) =>\n isArray(elem) ? memo.concat(elem.reduce(flattenR, [])) : pushR(memo, elem);\n\n/**\n * Reduce function that pushes an object to an array, then returns the array.\n * Mostly just for [[flattenR]] and [[uniqR]]\n */\nexport function pushR(arr: any[], obj: any) {\n arr.push(obj);\n return arr;\n}\n\n/** Reduce function that filters out duplicates */\nexport const uniqR = (acc: T[], token: T): T[] =>\n inArray(acc, token) ? acc : pushR(acc, token);\n\n/**\n * Return a new array with a single level of arrays unnested.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * unnest(input) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnest = (arr: any[]) => arr.reduce(unnestR, []);\n/**\n * Return a completely flattened version of an array.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * flatten(input) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flatten = (arr: any[]) => arr.reduce(flattenR, []);\n\n/**\n * Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass.\n * @example\n * ```\n *\n * let isNumber = (obj) => typeof(obj) === 'number';\n * let allNumbers = [ 1, 2, 3, 4, 5 ];\n * allNumbers.filter(assertPredicate(isNumber)); //OK\n *\n * let oneString = [ 1, 2, 3, 4, \"5\" ];\n * oneString.filter(assertPredicate(isNumber, \"Not all numbers\")); // throws Error(\"\"Not all numbers\"\");\n * ```\n */\nexport const assertPredicate: (predicate: Predicate, errMsg: (string|Function)) => Predicate = assertFn;\n/**\n * Given a .map function, builds a .map function which throws an error if any mapped elements do not pass a truthyness test.\n * @example\n * ```\n *\n * var data = { foo: 1, bar: 2 };\n *\n * let keys = [ 'foo', 'bar' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // values is [1, 2]\n *\n * let keys = [ 'foo', 'bar', 'baz' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // throws Error(\"Key not found\")\n * ```\n */\nexport const assertMap: (mapFn: (t: T) => U, errMsg: (string|Function)) => (t: T) => U = assertFn;\nexport function assertFn(predicateOrMap: Function, errMsg: (string|Function) = \"assert failure\"): any {\n return (obj) => {\n let result = predicateOrMap(obj);\n if (!result) {\n throw new Error(isFunction(errMsg) ? ( errMsg)(obj) : errMsg);\n }\n return result;\n };\n}\n\n/**\n * Like _.pairs: Given an object, returns an array of key/value pairs\n *\n * @example\n * ```\n *\n * pairs({ foo: \"FOO\", bar: \"BAR }) // [ [ \"foo\", \"FOO\" ], [ \"bar\": \"BAR\" ] ]\n * ```\n */\nexport const pairs = (obj: Obj) =>\n Object.keys(obj).map(key => [ key, obj[key]] );\n\n/**\n * Given two or more parallel arrays, returns an array of tuples where\n * each tuple is composed of [ a[i], b[i], ... z[i] ]\n *\n * @example\n * ```\n *\n * let foo = [ 0, 2, 4, 6 ];\n * let bar = [ 1, 3, 5, 7 ];\n * let baz = [ 10, 30, 50, 70 ];\n * arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ]\n * arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ]\n * ```\n */\nexport function arrayTuples(...args: any[]): any[] {\n if (args.length === 0) return [];\n let maxArrayLen = args.reduce((min, arr) => Math.min(arr.length, min), 9007199254740991); // aka 2^53 − 1 aka Number.MAX_SAFE_INTEGER\n\n let i, result = [];\n\n for (i = 0; i < maxArrayLen; i++) {\n // This is a hot function\n // Unroll when there are 1-4 arguments\n switch (args.length) {\n case 1: result.push([args[0][i]]); break;\n case 2: result.push([args[0][i], args[1][i]]); break;\n case 3: result.push([args[0][i], args[1][i], args[2][i]]); break;\n case 4: result.push([args[0][i], args[1][i], args[2][i], args[3][i]]); break;\n default:\n result.push(args.map(array => array[i])); break;\n }\n }\n\n return result;\n}\n\n/**\n * Reduce function which builds an object from an array of [key, value] pairs.\n *\n * Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration.\n *\n * Each keyValueTuple should be an array with values [ key: string, value: any ]\n *\n * @example\n * ```\n *\n * var pairs = [ [\"fookey\", \"fooval\"], [\"barkey\", \"barval\"] ]\n *\n * var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n *\n * // Or, more simply:\n * var pairsToObj = pairs.reduce(applyPairs, {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n * ```\n */\nexport function applyPairs(memo: TypedMap, keyValTuple: any[]) {\n let key: string, value: any;\n if (isArray(keyValTuple)) [key, value] = keyValTuple;\n if (!isString(key)) throw new Error(\"invalid parameters to applyPairs\");\n memo[key] = value;\n return memo;\n}\n\n/** Get the last element of an array */\nexport function tail(arr: T[]): T {\n return arr.length && arr[arr.length - 1] || undefined;\n}\n\n/**\n * shallow copy from src to dest\n *\n * note: This is a shallow copy, while angular.copy is a deep copy.\n * ui-router uses `copy` only to make copies of state parameters.\n */\nfunction _copy(src: Obj, dest: Obj) {\n if (dest) Object.keys(dest).forEach(key => delete dest[key]);\n if (!dest) dest = {};\n return extend(dest, src);\n}\n\n/** Naive forEach implementation works with Objects or Arrays */\nfunction _forEach(obj: (any[]|any), cb: (el, idx?) => void, _this: Obj) {\n if (isArray(obj)) return obj.forEach(cb, _this);\n Object.keys(obj).forEach(key => cb(obj[key], key));\n}\n\n/** Like Object.assign() */\nexport function _extend(toObj: Obj, ...fromObjs: Obj[]): any;\nexport function _extend(toObj: Obj): any {\n for (let i = 1; i < arguments.length; i++) {\n let obj = arguments[i];\n if (!obj) continue;\n let keys = Object.keys(obj);\n\n for (let j = 0; j < keys.length; j++) {\n toObj[keys[j]] = obj[keys[j]];\n }\n }\n\n return toObj;\n}\n\nfunction _equals(o1: any, o2: any): boolean {\n if (o1 === o2) return true;\n if (o1 === null || o2 === null) return false;\n if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN\n let t1 = typeof o1, t2 = typeof o2;\n if (t1 !== t2 || t1 !== 'object') return false;\n\n const tup = [o1, o2];\n if (all(isArray)(tup)) return _arraysEq(o1, o2);\n if (all(isDate)(tup)) return o1.getTime() === o2.getTime();\n if (all(isRegExp)(tup)) return o1.toString() === o2.toString();\n if (all(isFunction)(tup)) return true; // meh\n\n let predicates = [isFunction, isArray, isDate, isRegExp];\n if (predicates.map(any).reduce((b, fn) => b || !!fn(tup), false)) return false;\n\n let key: string, keys: { [i: string]: boolean } = {};\n for (key in o1) {\n if (!_equals(o1[key], o2[key])) return false;\n keys[key] = true;\n }\n for (key in o2) {\n if (!keys[key]) return false;\n }\n\n return true;\n}\n\nfunction _arraysEq(a1: any[], a2: any[]) {\n if (a1.length !== a2.length) return false;\n return arrayTuples(a1, a2).reduce((b, t) => b && _equals(t[0], t[1]), true);\n}\n\n// issue #2676\nexport const silenceUncaughtInPromise = (promise: Promise) =>\n promise.catch(e => 0) && promise;\nexport const silentRejection = (error: any) =>\n silenceUncaughtInPromise(services.$q.reject(error));\n","/**\n * # Transition tracing (debug)\n *\n * Enable transition tracing to print transition information to the console,\n * in order to help debug your application.\n * Tracing logs detailed information about each Transition to your console.\n *\n * To enable tracing, import the [[Trace]] singleton and enable one or more categories.\n *\n * ### ES6\n * ```js\n * import {trace} from \"ui-router-ng2\"; // or \"angular-ui-router\"\n * trace.enable(1, 5); // TRANSITION and VIEWCONFIG\n * ```\n *\n * ### CJS\n * ```js\n * let trace = require(\"angular-ui-router\").trace; // or \"ui-router-ng2\"\n * trace.enable(\"TRANSITION\", \"VIEWCONFIG\");\n * ```\n *\n * ### Globals\n * ```js\n * let trace = window[\"angular-ui-router\"].trace; // or \"ui-router-ng2\"\n * trace.enable(); // Trace everything (very verbose)\n * ```\n *\n * ### Angular 1:\n * ```js\n * app.run($trace => $trace.enable());\n * ```\n *\n * @coreapi\n * @module trace\n */ /** for typedoc */\nimport {parse} from \"../common/hof\";\nimport {isNumber} from \"../common/predicates\";\nimport {Transition} from \"../transition/transition\";\nimport {ActiveUIView, ViewConfig, ViewContext} from \"../view/interface\";\nimport {stringify, functionToString, maxLength, padString} from \"./strings\";\nimport {Resolvable} from \"../resolve/resolvable\";\nimport {PathNode} from \"../path/pathNode\";\nimport {PolicyWhen} from \"../resolve/interface\";\nimport {TransitionHook} from \"../transition/transitionHook\";\nimport {HookResult} from \"../transition/interface\";\nimport {StateObject} from \"../state/stateObject\";\n\n/** @hidden */\nfunction uiViewString (uiview: ActiveUIView) {\n if (!uiview) return 'ui-view (defunct)';\n const state = uiview.creationContext ? uiview.creationContext.name || '(root)' : '(none)';\n return `[ui-view#${uiview.id} ${uiview.$type}:${uiview.fqn} (${uiview.name}@${state})]`;\n}\n\n/** @hidden */\nconst viewConfigString = (viewConfig: ViewConfig) => {\n let view = viewConfig.viewDecl;\n const state = view.$context.name || '(root)';\n return `[View#${viewConfig.$id} from '${state}' state]: target ui-view: '${view.$uiViewName}@${view.$uiViewContextAnchor}'`;\n};\n\n/** @hidden */\nfunction normalizedCat(input: Category|string): string {\n return isNumber(input) ? Category[input] : Category[Category[input]];\n}\n\n\n/**\n * Trace categories Enum\n *\n * Enable or disable a category using [[Trace.enable]] or [[Trace.disable]]\n *\n * `trace.enable(Category.TRANSITION)`\n *\n * These can also be provided using a matching string, or position ordinal\n *\n * `trace.enable(\"TRANSITION\")`\n *\n * `trace.enable(1)`\n */\nexport enum Category {\n RESOLVE, TRANSITION, HOOK, UIVIEW, VIEWCONFIG,\n}\n\n/** @hidden */ const _tid = parse(\"$id\");\n/** @hidden */ const _rid = parse(\"router.$id\");\n/** @hidden */ const transLbl = (trans) => `Transition #${_tid(trans)}-${_rid(trans)}`;\n\n/**\n * Prints UI-Router Transition trace information to the console.\n */\nexport class Trace {\n /** @hidden */\n approximateDigests: number;\n\n /** @hidden */\n constructor() {\n this.approximateDigests = 0;\n }\n\n /** @hidden */\n private _enabled: { [key: string]: boolean } = {};\n\n /** @hidden */\n private _set(enabled: boolean, categories: Category[]) {\n if (!categories.length) {\n categories = Object.keys(Category)\n .map(k => parseInt(k, 10))\n .filter(k => !isNaN(k))\n .map(key => Category[key]);\n }\n categories.map(normalizedCat).forEach(category => this._enabled[category] = enabled);\n }\n\n /**\n * Enables a trace [[Category]]\n *\n * ```js\n * trace.enable(\"TRANSITION\");\n * ```\n *\n * @param categories categories to enable. If `categories` is omitted, all categories are enabled.\n * Also takes strings (category name) or ordinal (category position)\n */\n enable(...categories: (Category|string|number)[]);\n enable(...categories: any[]) { this._set(true, categories); }\n /**\n * Disables a trace [[Category]]\n *\n * ```js\n * trace.disable(\"VIEWCONFIG\");\n * ```\n *\n * @param categories categories to disable. If `categories` is omitted, all categories are disabled.\n * Also takes strings (category name) or ordinal (category position)\n */\n disable(...categories: (Category|string|number)[]);\n disable(...categories: any[]) { this._set(false, categories); }\n\n /**\n * Retrieves the enabled stateus of a [[Category]]\n *\n * ```js\n * trace.enabled(\"VIEWCONFIG\"); // true or false\n * ```\n *\n * @returns boolean true if the category is enabled\n */\n enabled(category: (Category|string|number)): boolean {\n return !!this._enabled[normalizedCat(category)];\n }\n\n /** @internalapi called by ui-router code */\n traceTransitionStart(trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: Started -> ${stringify(trans)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceTransitionIgnored(trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: Ignored <> ${stringify(trans)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceHookInvocation(step: TransitionHook, trans: Transition, options: any) {\n if (!this.enabled(Category.HOOK)) return;\n let event = parse(\"traceData.hookType\")(options) || \"internal\",\n context = parse(\"traceData.context.state.name\")(options) || parse(\"traceData.context\")(options) || \"unknown\",\n name = functionToString((step as any).registeredHook.callback);\n console.log(`${transLbl(trans)}: Hook -> ${event} context: ${context}, ${maxLength(200, name)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceHookResult(hookResult: HookResult, trans: Transition, transitionOptions: any) {\n if (!this.enabled(Category.HOOK)) return;\n console.log(`${transLbl(trans)}: <- Hook returned: ${maxLength(200, stringify(hookResult))}`);\n }\n\n /** @internalapi called by ui-router code */\n traceResolvePath(path: PathNode[], when: PolicyWhen, trans?: Transition) {\n if (!this.enabled(Category.RESOLVE)) return;\n console.log(`${transLbl(trans)}: Resolving ${path} (${when})`);\n }\n\n /** @internalapi called by ui-router code */\n traceResolvableResolved(resolvable: Resolvable, trans?: Transition) {\n if (!this.enabled(Category.RESOLVE)) return;\n console.log(`${transLbl(trans)}: <- Resolved ${resolvable} to: ${maxLength(200, stringify(resolvable.data))}`);\n }\n\n /** @internalapi called by ui-router code */\n traceError(reason: any, trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: <- Rejected ${stringify(trans)}, reason: ${reason}`);\n }\n\n /** @internalapi called by ui-router code */\n traceSuccess(finalState: StateObject, trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: <- Success ${stringify(trans)}, final state: ${finalState.name}`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewEvent(event: string, viewData: ActiveUIView, extra = \"\") {\n if (!this.enabled(Category.UIVIEW)) return;\n console.log(`ui-view: ${padString(30, event)} ${uiViewString(viewData)}${extra}`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewConfigUpdated(viewData: ActiveUIView, context: ViewContext) {\n if (!this.enabled(Category.UIVIEW)) return;\n this.traceUIViewEvent(\"Updating\", viewData, ` with ViewConfig from context='${context}'`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewFill(viewData: ActiveUIView, html: string) {\n if (!this.enabled(Category.UIVIEW)) return;\n this.traceUIViewEvent(\"Fill\", viewData, ` with: ${maxLength(200, html)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceViewSync(pairs: any[]) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n const mapping = pairs.map(([ uiViewData, config ]) => {\n const uiView = `${uiViewData.$type}:${uiViewData.fqn}`;\n const view = config && `${config.viewDecl.$context.name}: ${config.viewDecl.$name} (${config.viewDecl.$type})`;\n\n return { 'ui-view fqn': uiView, 'state: view name': view };\n }).sort((a, b) => a['ui-view fqn'].localeCompare(b['ui-view fqn']));\n\n console.table(mapping);\n }\n\n /** @internalapi called by ui-router code */\n traceViewServiceEvent(event: string, viewConfig: ViewConfig) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n console.log(`VIEWCONFIG: ${event} ${viewConfigString(viewConfig)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceViewServiceUIViewEvent(event: string, viewData: ActiveUIView) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n console.log(`VIEWCONFIG: ${event} ${uiViewString(viewData)}`);\n }\n}\n\n/**\n * The [[Trace]] singleton\n *\n * #### Example:\n * ```js\n * import {trace} from \"angular-ui-router\";\n * trace.enable(1, 5);\n * ```\n */\nlet trace = new Trace();\nexport {trace};\n","/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\nimport { extend, removeFrom, tail, values, identity, map } from \"../common/common\";\nimport {isString, isFunction} from \"../common/predicates\";\nimport {PathNode} from \"../path/pathNode\";\nimport {\n TransitionStateHookFn, TransitionHookFn, TransitionHookPhase, TransitionHookScope, IHookRegistry, PathType\n} from \"./interface\"; // has or is using\n\nimport {\n HookRegOptions, HookMatchCriteria, TreeChanges,\n HookMatchCriterion, IMatchingNodes, HookFn\n} from \"./interface\";\nimport {Glob} from \"../common/glob\";\nimport {StateObject} from \"../state/stateObject\";\nimport {TransitionEventType} from \"./transitionEventType\";\nimport { TransitionService } from \"./transitionService\";\n\n/**\n * Determines if the given state matches the matchCriteria\n *\n * @hidden\n *\n * @param state a State Object to test against\n * @param criterion\n * - If a string, matchState uses the string as a glob-matcher against the state name\n * - If an array (of strings), matchState uses each string in the array as a glob-matchers against the state name\n * and returns a positive match if any of the globs match.\n * - If a function, matchState calls the function with the state and returns true if the function's result is truthy.\n * @returns {boolean}\n */\nexport function matchState(state: StateObject, criterion: HookMatchCriterion) {\n let toMatch = isString(criterion) ? [criterion] : criterion;\n\n function matchGlobs(_state: StateObject) {\n let globStrings = toMatch;\n for (let i = 0; i < globStrings.length; i++) {\n let glob = new Glob(globStrings[i]);\n\n if ((glob && glob.matches(_state.name)) || (!glob && globStrings[i] === _state.name)) {\n return true;\n }\n }\n return false;\n }\n\n let matchFn = (isFunction(toMatch) ? toMatch : matchGlobs);\n return !!matchFn(state);\n}\n\n/**\n * @internalapi\n * The registration data for a registered transition hook\n */\nexport class RegisteredHook {\n priority: number;\n bind: any;\n _deregistered: boolean;\n\n constructor(public tranSvc: TransitionService,\n public eventType: TransitionEventType,\n public callback: HookFn,\n public matchCriteria: HookMatchCriteria,\n options: HookRegOptions = {} as any) {\n this.priority = options.priority || 0;\n this.bind = options.bind || null;\n this._deregistered = false;\n }\n\n /**\n * Gets the matching [[PathNode]]s\n *\n * Given an array of [[PathNode]]s, and a [[HookMatchCriterion]], returns an array containing\n * the [[PathNode]]s that the criteria matches, or `null` if there were no matching nodes.\n *\n * Returning `null` is significant to distinguish between the default\n * \"match-all criterion value\" of `true` compared to a `() => true` function,\n * when the nodes is an empty array.\n *\n * This is useful to allow a transition match criteria of `entering: true`\n * to still match a transition, even when `entering === []`. Contrast that\n * with `entering: (state) => true` which only matches when a state is actually\n * being entered.\n */\n private _matchingNodes(nodes: PathNode[], criterion: HookMatchCriterion): PathNode[] {\n if (criterion === true) return nodes;\n let matching = nodes.filter(node => matchState(node.state, criterion));\n return matching.length ? matching : null;\n }\n\n /**\n * Gets the default match criteria (all `true`)\n *\n * Returns an object which has all the criteria match paths as keys and `true` as values, i.e.:\n *\n * ```js\n * {\n * to: true,\n * from: true,\n * entering: true,\n * exiting: true,\n * retained: true,\n * }\n */\n private _getDefaultMatchCriteria(): HookMatchCriteria {\n return map(this.tranSvc._pluginapi._getPathTypes(), () => true);\n }\n\n /**\n * Gets matching nodes as [[IMatchingNodes]]\n *\n * Create a IMatchingNodes object from the TransitionHookTypes that is roughly equivalent to:\n *\n * ```js\n * let matches: IMatchingNodes = {\n * to: _matchingNodes([tail(treeChanges.to)], mc.to),\n * from: _matchingNodes([tail(treeChanges.from)], mc.from),\n * exiting: _matchingNodes(treeChanges.exiting, mc.exiting),\n * retained: _matchingNodes(treeChanges.retained, mc.retained),\n * entering: _matchingNodes(treeChanges.entering, mc.entering),\n * };\n * ```\n */\n private _getMatchingNodes(treeChanges: TreeChanges): IMatchingNodes {\n let criteria = extend(this._getDefaultMatchCriteria(), this.matchCriteria);\n let paths: PathType[] = values(this.tranSvc._pluginapi._getPathTypes());\n\n return paths.reduce((mn: IMatchingNodes, pathtype: PathType) => {\n // STATE scope criteria matches against every node in the path.\n // TRANSITION scope criteria matches against only the last node in the path\n let isStateHook = pathtype.scope === TransitionHookScope.STATE;\n let path = treeChanges[pathtype.name] || [];\n let nodes: PathNode[] = isStateHook ? path : [tail(path)];\n\n mn[pathtype.name] = this._matchingNodes(nodes, criteria[pathtype.name]);\n return mn;\n }, {} as IMatchingNodes);\n }\n\n /**\n * Determines if this hook's [[matchCriteria]] match the given [[TreeChanges]]\n *\n * @returns an IMatchingNodes object, or null. If an IMatchingNodes object is returned, its values\n * are the matching [[PathNode]]s for each [[HookMatchCriterion]] (to, from, exiting, retained, entering)\n */\n matches(treeChanges: TreeChanges): IMatchingNodes {\n let matches = this._getMatchingNodes(treeChanges);\n\n // Check if all the criteria matched the TreeChanges object\n let allMatched = values(matches).every(identity);\n return allMatched ? matches : null;\n }\n}\n\n/** @hidden Return a registration function of the requested type. */\nexport function makeEvent(registry: IHookRegistry, transitionService: TransitionService, eventType: TransitionEventType) {\n // Create the object which holds the registered transition hooks.\n let _registeredHooks = registry._registeredHooks = (registry._registeredHooks || {});\n let hooks = _registeredHooks[eventType.name] = [];\n\n // Create hook registration function on the IHookRegistry for the event\n registry[eventType.name] = hookRegistrationFn;\n\n function hookRegistrationFn(matchObject, callback, options = {}) {\n let registeredHook = new RegisteredHook(transitionService, eventType, callback, matchObject, options);\n hooks.push(registeredHook);\n\n return function deregisterEventHook() {\n registeredHook._deregistered = true;\n removeFrom(hooks)(registeredHook);\n };\n }\n\n return hookRegistrationFn;\n}","/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\n\nimport {extend, tail, assertPredicate, unnestR, identity} from \"../common/common\";\nimport {isArray} from \"../common/predicates\";\n\nimport {\n TransitionOptions, TransitionHookOptions, IHookRegistry, TreeChanges, IMatchingNodes,\n TransitionHookPhase, TransitionHookScope\n} from \"./interface\";\n\nimport {Transition} from \"./transition\";\nimport {TransitionHook} from \"./transitionHook\";\nimport {StateObject} from \"../state/stateObject\";\nimport {PathNode} from \"../path/pathNode\";\nimport {TransitionService} from \"./transitionService\";\nimport {TransitionEventType} from \"./transitionEventType\";\nimport {RegisteredHook} from \"./hookRegistry\";\n\n/**\n * This class returns applicable TransitionHooks for a specific Transition instance.\n *\n * Hooks ([[RegisteredHook]]) may be registered globally, e.g., $transitions.onEnter(...), or locally, e.g.\n * myTransition.onEnter(...). The HookBuilder finds matching RegisteredHooks (where the match criteria is\n * determined by the type of hook)\n *\n * The HookBuilder also converts RegisteredHooks objects to TransitionHook objects, which are used to run a Transition.\n *\n * The HookBuilder constructor is given the $transitions service and a Transition instance. Thus, a HookBuilder\n * instance may only be used for one specific Transition object. (side note: the _treeChanges accessor is private\n * in the Transition class, so we must also provide the Transition's _treeChanges)\n *\n */\nexport class HookBuilder {\n constructor(private transition: Transition) { }\n\n buildHooksForPhase(phase: TransitionHookPhase): TransitionHook[] {\n let $transitions = this.transition.router.transitionService;\n return $transitions._pluginapi._getEvents(phase)\n .map(type => this.buildHooks(type))\n .reduce(unnestR, [])\n .filter(identity);\n }\n\n /**\n * Returns an array of newly built TransitionHook objects.\n *\n * - Finds all RegisteredHooks registered for the given `hookType` which matched the transition's [[TreeChanges]].\n * - Finds [[PathNode]] (or `PathNode[]`) to use as the TransitionHook context(s)\n * - For each of the [[PathNode]]s, creates a TransitionHook\n *\n * @param hookType the type of the hook registration function, e.g., 'onEnter', 'onFinish'.\n */\n buildHooks(hookType: TransitionEventType): TransitionHook[] {\n let transition = this.transition;\n let treeChanges = transition.treeChanges();\n\n // Find all the matching registered hooks for a given hook type\n let matchingHooks = this.getMatchingHooks(hookType, treeChanges);\n if (!matchingHooks) return [];\n\n let baseHookOptions = {\n transition: transition,\n current: transition.options().current\n };\n\n const makeTransitionHooks = (hook: RegisteredHook) => {\n // Fetch the Nodes that caused this hook to match.\n let matches: IMatchingNodes = hook.matches(treeChanges);\n // Select the PathNode[] that will be used as TransitionHook context objects\n let matchingNodes: PathNode[] = matches[hookType.criteriaMatchPath.name];\n\n // Return an array of HookTuples\n return matchingNodes.map(node => {\n let _options = extend({\n bind: hook.bind,\n traceData: { hookType: hookType.name, context: node }\n }, baseHookOptions);\n\n let state = hookType.criteriaMatchPath.scope === TransitionHookScope.STATE ? node.state.self : null;\n let transitionHook = new TransitionHook(transition, state, hook, _options);\n return { hook, node, transitionHook };\n });\n };\n\n return matchingHooks.map(makeTransitionHooks)\n .reduce(unnestR, [])\n .sort(tupleSort(hookType.reverseSort))\n .map(tuple => tuple.transitionHook);\n }\n\n /**\n * Finds all RegisteredHooks from:\n * - The Transition object instance hook registry\n * - The TransitionService ($transitions) global hook registry\n *\n * which matched:\n * - the eventType\n * - the matchCriteria (to, from, exiting, retained, entering)\n *\n * @returns an array of matched [[RegisteredHook]]s\n */\n public getMatchingHooks(hookType: TransitionEventType, treeChanges: TreeChanges): RegisteredHook[] {\n let isCreate = hookType.hookPhase === TransitionHookPhase.CREATE;\n\n // Instance and Global hook registries\n let $transitions = this.transition.router.transitionService;\n let registries = isCreate ? [ $transitions ] : [ this.transition, $transitions ];\n\n return registries.map((reg: IHookRegistry) => reg.getHooks(hookType.name)) // Get named hooks from registries\n .filter(assertPredicate(isArray, `broken event named: ${hookType.name}`)) // Sanity check\n .reduce(unnestR, []) // Un-nest RegisteredHook[][] to RegisteredHook[] array\n .filter(hook => hook.matches(treeChanges)); // Only those satisfying matchCriteria\n }\n}\n\ninterface HookTuple { hook: RegisteredHook, node: PathNode, transitionHook: TransitionHook }\n\n/**\n * A factory for a sort function for HookTuples.\n *\n * The sort function first compares the PathNode depth (how deep in the state tree a node is), then compares\n * the EventHook priority.\n *\n * @param reverseDepthSort a boolean, when true, reverses the sort order for the node depth\n * @returns a tuple sort function\n */\nfunction tupleSort(reverseDepthSort = false) {\n return function nodeDepthThenPriority(l: HookTuple, r: HookTuple): number {\n let factor = reverseDepthSort ? -1 : 1;\n let depthDelta = (l.node.state.path.length - r.node.state.path.length) * factor;\n return depthDelta !== 0 ? depthDelta : r.hook.priority - l.hook.priority;\n }\n}","/**\n * @coreapi\n * @module params\n */\n/** */\nimport {extend, filter, map} from \"../common/common\";\nimport {isArray, isDefined} from \"../common/predicates\";\nimport {ParamTypeDefinition} from \"./interface\";\n\n/**\n * An internal class which implements [[ParamTypeDefinition]].\n *\n * A [[ParamTypeDefinition]] is a plain javascript object used to register custom parameter types.\n * When a param type definition is registered, an instance of this class is created internally.\n *\n * This class has naive implementations for all the [[ParamTypeDefinition]] methods.\n *\n * Used by [[UrlMatcher]] when matching or formatting URLs, or comparing and validating parameter values.\n *\n * #### Example:\n * ```js\n * var paramTypeDef = {\n * decode: function(val) { return parseInt(val, 10); },\n * encode: function(val) { return val && val.toString(); },\n * equals: function(a, b) { return this.is(a) && a === b; },\n * is: function(val) { return angular.isNumber(val) && isFinite(val) && val % 1 === 0; },\n * pattern: /\\d+/\n * }\n *\n * var paramType = new ParamType(paramTypeDef);\n * ```\n * @internalapi\n */\nexport class ParamType implements ParamTypeDefinition {\n /** @inheritdoc */\n pattern: RegExp = /.*/;\n /** The name/id of the parameter type */\n name: string;\n /** @inheritdoc */\n raw: boolean;\n /** @inheritdoc */\n dynamic: boolean;\n /** @inheritdoc */\n inherit = true;\n\n /**\n * @param def A configuration object which contains the custom type definition. The object's\n * properties will override the default methods and/or pattern in `ParamType`'s public interface.\n * @returns a new ParamType object\n */\n constructor(def: ParamTypeDefinition) {\n extend(this, def);\n }\n\n\n // consider these four methods to be \"abstract methods\" that should be overridden\n /** @inheritdoc */\n is(val: any, key?: string): boolean { return true; }\n /** @inheritdoc */\n encode(val: any, key?: string): (string|string[]) { return val; }\n /** @inheritdoc */\n decode(val: string, key?: string): any { return val; }\n /** @inheritdoc */\n equals(a: any, b: any): boolean { return a == b; }\n\n\n $subPattern() {\n let sub = this.pattern.toString();\n return sub.substr(1, sub.length - 2);\n }\n\n toString() {\n return `{ParamType:${this.name}}`;\n }\n\n /** Given an encoded string, or a decoded object, returns a decoded object */\n $normalize(val: any) {\n return this.is(val) ? val : this.decode(val);\n }\n\n /**\n * Wraps an existing custom ParamType as an array of ParamType, depending on 'mode'.\n * e.g.:\n * - urlmatcher pattern \"/path?{queryParam[]:int}\"\n * - url: \"/path?queryParam=1&queryParam=2\n * - $stateParams.queryParam will be [1, 2]\n * if `mode` is \"auto\", then\n * - url: \"/path?queryParam=1 will create $stateParams.queryParam: 1\n * - url: \"/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2]\n */\n $asArray(mode: (boolean|\"auto\"), isSearch: boolean) {\n if (!mode) return this;\n if (mode === \"auto\" && !isSearch) throw new Error(\"'auto' array mode is for query parameters only\");\n return new ( ArrayType)(this, mode);\n }\n}\n\n/**\n * Wraps up a `ParamType` object to handle array values.\n * @internalapi\n */\nfunction ArrayType(type: ParamType, mode: (boolean|\"auto\")) {\n // Wrap non-array value as array\n function arrayWrap(val: any): any[] {\n return isArray(val) ? val : (isDefined(val) ? [ val ] : []);\n }\n\n // Unwrap array value for \"auto\" mode. Return undefined for empty array.\n function arrayUnwrap(val: any) {\n switch (val.length) {\n case 0: return undefined;\n case 1: return mode === \"auto\" ? val[0] : val;\n default: return val;\n }\n }\n\n // Wraps type (.is/.encode/.decode) functions to operate on each value of an array\n function arrayHandler(callback: (x: any) => any, allTruthyMode?: boolean) {\n return function handleArray(val: any) {\n if (isArray(val) && val.length === 0) return val;\n let arr = arrayWrap(val);\n let result = map(arr, callback);\n return (allTruthyMode === true) ? filter(result, x => !x).length === 0 : arrayUnwrap(result);\n };\n }\n\n // Wraps type (.equals) functions to operate on each value of an array\n function arrayEqualsHandler(callback: (l: any, r: any) => boolean) {\n return function handleArray(val1: any, val2: any) {\n let left = arrayWrap(val1), right = arrayWrap(val2);\n if (left.length !== right.length) return false;\n for (let i = 0; i < left.length; i++) {\n if (!callback(left[i], right[i])) return false;\n }\n return true;\n };\n }\n\n ['encode', 'decode', 'equals', '$normalize'].forEach(name => {\n var paramTypeFn = type[name].bind(type);\n var wrapperFn: Function = name === 'equals' ? arrayEqualsHandler : arrayHandler;\n this[name] = wrapperFn(paramTypeFn);\n });\n\n extend(this, {\n dynamic: type.dynamic,\n name: type.name,\n pattern: type.pattern,\n inherit: type.inherit,\n is: arrayHandler(type.is.bind(type), true),\n $arrayMode: mode\n });\n}\n","/**\n * @coreapi\n * @module params\n */ /** for typedoc */\nimport { extend, filter, map, allTrueR } from \"../common/common\";\nimport { prop } from \"../common/hof\";\nimport { isInjectable, isDefined, isString, isArray, isUndefined } from \"../common/predicates\";\nimport { RawParams, ParamDeclaration } from \"../params/interface\";\nimport { services } from \"../common/coreservices\";\nimport { ParamType } from \"./paramType\";\nimport { ParamTypes } from \"./paramTypes\";\nimport { UrlMatcherFactory } from \"../url/urlMatcherFactory\";\n\n/** @hidden */ let hasOwn = Object.prototype.hasOwnProperty;\n/** @hidden */ let isShorthand = (cfg: ParamDeclaration) =>\n [\"value\", \"type\", \"squash\", \"array\", \"dynamic\"].filter(hasOwn.bind(cfg || {})).length === 0;\n\n/** @internalapi */\nexport enum DefType {\n PATH,\n SEARCH,\n CONFIG,\n}\n\n/** @hidden */\nfunction unwrapShorthand(cfg: ParamDeclaration): ParamDeclaration {\n cfg = isShorthand(cfg) && { value: cfg } as any || cfg;\n\n getStaticDefaultValue['__cacheable'] = true;\n function getStaticDefaultValue() {\n return cfg.value;\n }\n\n return extend(cfg, {\n $$fn: isInjectable(cfg.value) ? cfg.value : getStaticDefaultValue,\n });\n}\n\n/** @hidden */\nfunction getType(cfg: ParamDeclaration, urlType: ParamType, location: DefType, id: string, paramTypes: ParamTypes) {\n if (cfg.type && urlType && urlType.name !== 'string') throw new Error(`Param '${id}' has two type configurations.`);\n if (cfg.type && urlType && urlType.name === 'string' && paramTypes.type(cfg.type as string)) return paramTypes.type(cfg.type as string);\n if (urlType) return urlType;\n if (!cfg.type) {\n let type = location === DefType.CONFIG ? \"any\" :\n location === DefType.PATH ? \"path\" :\n location === DefType.SEARCH ? \"query\" : \"string\";\n return paramTypes.type(type);\n }\n return cfg.type instanceof ParamType ? cfg.type : paramTypes.type(cfg.type as string);\n}\n\n/**\n * @internalapi\n * returns false, true, or the squash value to indicate the \"default parameter url squash policy\".\n */\nfunction getSquashPolicy(config: ParamDeclaration, isOptional: boolean, defaultPolicy: (boolean|string)) {\n let squash = config.squash;\n if (!isOptional || squash === false) return false;\n if (!isDefined(squash) || squash == null) return defaultPolicy;\n if (squash === true || isString(squash)) return squash;\n throw new Error(`Invalid squash policy: '${squash}'. Valid policies: false, true, or arbitrary string`);\n}\n\n/** @internalapi */\nfunction getReplace(config: ParamDeclaration, arrayMode: boolean, isOptional: boolean, squash: (string|boolean)) {\n let replace: any, configuredKeys: string[], defaultPolicy = [\n {from: \"\", to: (isOptional || arrayMode ? undefined : \"\")},\n {from: null, to: (isOptional || arrayMode ? undefined : \"\")},\n ];\n replace = isArray(config.replace) ? config.replace : [];\n if (isString(squash)) replace.push({ from: squash, to: undefined });\n configuredKeys = map(replace, prop(\"from\"));\n return filter(defaultPolicy, item => configuredKeys.indexOf(item.from) === -1).concat(replace);\n}\n\n\n/** @internalapi */\nexport class Param {\n id: string;\n type: ParamType;\n location: DefType;\n isOptional: boolean;\n dynamic: boolean;\n raw: boolean;\n squash: (boolean|string);\n replace: [{ to: any, from: any }];\n inherit: boolean;\n array: boolean;\n config: any;\n /** Cache the default value if it is a static value */\n _defaultValueCache: {\n defaultValue: any,\n };\n\n constructor(id: string, type: ParamType, config: ParamDeclaration, location: DefType, urlMatcherFactory: UrlMatcherFactory) {\n config = unwrapShorthand(config);\n type = getType(config, type, location, id, urlMatcherFactory.paramTypes);\n let arrayMode = getArrayMode();\n type = arrayMode ? type.$asArray(arrayMode, location === DefType.SEARCH) : type;\n let isOptional = config.value !== undefined || location === DefType.SEARCH;\n let dynamic = isDefined(config.dynamic) ? !!config.dynamic : !!type.dynamic;\n let raw = isDefined(config.raw) ? !!config.raw : !!type.raw;\n let squash = getSquashPolicy(config, isOptional, urlMatcherFactory.defaultSquashPolicy());\n let replace = getReplace(config, arrayMode, isOptional, squash);\n let inherit = isDefined(config.inherit) ? !!config.inherit : !!type.inherit;\n\n // array config: param name (param[]) overrides default settings. explicit config overrides param name.\n function getArrayMode() {\n let arrayDefaults = { array: (location === DefType.SEARCH ? \"auto\" : false) };\n let arrayParamNomenclature = id.match(/\\[\\]$/) ? { array: true } : {};\n return extend(arrayDefaults, arrayParamNomenclature, config).array;\n }\n\n extend(this, {id, type, location, isOptional, dynamic, raw, squash, replace, inherit, array: arrayMode, config });\n }\n\n isDefaultValue(value: any): boolean {\n return this.isOptional && this.type.equals(this.value(), value);\n }\n\n /**\n * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the\n * default value, which may be the result of an injectable function.\n */\n value(value?: any): any {\n /**\n * [Internal] Get the default value of a parameter, which may be an injectable function.\n */\n const getDefaultValue = () => {\n if (this._defaultValueCache) return this._defaultValueCache.defaultValue;\n\n if (!services.$injector) throw new Error(\"Injectable functions cannot be called at configuration time\");\n\n let defaultValue = services.$injector.invoke(this.config.$$fn);\n\n if (defaultValue !== null && defaultValue !== undefined && !this.type.is(defaultValue))\n throw new Error(`Default value (${defaultValue}) for parameter '${this.id}' is not an instance of ParamType (${this.type.name})`);\n\n if (this.config.$$fn['__cacheable']) {\n this._defaultValueCache = { defaultValue };\n }\n\n return defaultValue;\n };\n\n const replaceSpecialValues = (val: any) => {\n for (let tuple of this.replace) {\n if (tuple.from === val) return tuple.to;\n }\n return val;\n };\n\n value = replaceSpecialValues(value);\n\n return isUndefined(value) ? getDefaultValue() : this.type.$normalize(value);\n }\n\n isSearch(): boolean {\n return this.location === DefType.SEARCH;\n }\n\n validates(value: any): boolean {\n // There was no parameter value, but the param is optional\n if ((isUndefined(value) || value === null) && this.isOptional) return true;\n\n // The value was not of the correct ParamType, and could not be decoded to the correct ParamType\n const normalized = this.type.$normalize(value);\n if (!this.type.is(normalized)) return false;\n\n // The value was of the correct type, but when encoded, did not match the ParamType's regexp\n const encoded = this.type.encode(normalized);\n return !(isString(encoded) && !this.type.pattern.exec( encoded));\n }\n\n toString() {\n return `{Param:${this.id} ${this.type} squash: '${this.squash}' optional: ${this.isOptional}}`;\n }\n\n static values(params: Param[], values: RawParams = {}): RawParams {\n const paramValues = {} as RawParams;\n for (let param of params) {\n paramValues[param.id] = param.value(values[param.id]);\n }\n return paramValues;\n }\n\n /**\n * Finds [[Param]] objects which have different param values\n *\n * Filters a list of [[Param]] objects to only those whose parameter values differ in two param value objects\n *\n * @param params: The list of Param objects to filter\n * @param values1: The first set of parameter values\n * @param values2: the second set of parameter values\n *\n * @returns any Param objects whose values were different between values1 and values2\n */\n static changed(params: Param[], values1: RawParams = {}, values2: RawParams = {}): Param[] {\n return params.filter(param => !param.type.equals(values1[param.id], values2[param.id]));\n }\n\n /**\n * Checks if two param value objects are equal (for a set of [[Param]] objects)\n *\n * @param params The list of [[Param]] objects to check\n * @param values1 The first set of param values\n * @param values2 The second set of param values\n *\n * @returns true if the param values in values1 and values2 are equal\n */\n static equals(params: Param[], values1 = {}, values2 = {}): boolean {\n return Param.changed(params, values1, values2).length === 0;\n }\n\n /** Returns true if a the parameter values are valid, according to the Param definitions */\n static validates(params: Param[], values: RawParams = {}): boolean {\n return params.map(param => param.validates(values[param.id])).reduce(allTrueR, true);\n }\n}","/**\n * Functions that manipulate strings\n *\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_strings\n */ /** */\n\nimport { isString, isArray, isDefined, isNull, isPromise, isInjectable, isObject } from \"./predicates\";\nimport { Rejection } from \"../transition/rejectFactory\";\nimport { IInjectable, identity, Obj, tail, pushR } from \"./common\";\nimport { pattern, is, not, val, invoke } from \"./hof\";\nimport { Transition } from \"../transition/transition\";\nimport { Resolvable } from \"../resolve/resolvable\";\n\n/**\n * Returns a string shortened to a maximum length\n *\n * If the string is already less than the `max` length, return the string.\n * Else return the string, shortened to `max - 3` and append three dots (\"...\").\n *\n * @param max the maximum length of the string to return\n * @param str the input string\n */\nexport function maxLength(max: number, str: string) {\n if (str.length <= max) return str;\n return str.substr(0, max - 3) + \"...\";\n}\n\n/**\n * Returns a string, with spaces added to the end, up to a desired str length\n *\n * If the string is already longer than the desired length, return the string.\n * Else returns the string, with extra spaces on the end, such that it reaches `length` characters.\n *\n * @param length the desired length of the string to return\n * @param str the input string\n */\nexport function padString(length: number, str: string) {\n while (str.length < length) str += \" \";\n return str;\n}\n\nexport function kebobString(camelCase: string) {\n return camelCase\n .replace(/^([A-Z])/, $1 => $1.toLowerCase()) // replace first char\n .replace(/([A-Z])/g, $1 => \"-\" + $1.toLowerCase()); // replace rest\n}\n\nfunction _toJson(obj: Obj) {\n return JSON.stringify(obj);\n}\n\nfunction _fromJson(json: string) {\n return isString(json) ? JSON.parse(json) : json;\n}\n\n\nfunction promiseToString(p: Promise) {\n return `Promise(${JSON.stringify(p)})`;\n}\n\nexport function functionToString(fn: Function) {\n let fnStr = fnToString(fn);\n let namedFunctionMatch = fnStr.match(/^(function [^ ]+\\([^)]*\\))/);\n let toStr = namedFunctionMatch ? namedFunctionMatch[1] : fnStr;\n\n let fnName = fn['name'] || \"\";\n if (fnName && toStr.match(/function \\(/)) {\n return 'function ' + fnName + toStr.substr(9);\n }\n return toStr;\n}\n\nexport function fnToString(fn: IInjectable) {\n let _fn = isArray(fn) ? fn.slice(-1)[0] : fn;\n return _fn && _fn.toString() || \"undefined\";\n}\n\nlet stringifyPatternFn: (val: any) => string = null;\nlet stringifyPattern = function(value: any) {\n let isRejection = Rejection.isRejectionPromise;\n\n stringifyPatternFn = stringifyPatternFn || pattern([\n [not(isDefined), val(\"undefined\")],\n [isNull, val(\"null\")],\n [isPromise, val(\"[Promise]\")],\n [isRejection, (x: any) => x._transitionRejection.toString()],\n [is(Rejection), invoke(\"toString\")],\n [is(Transition), invoke(\"toString\")],\n [is(Resolvable), invoke(\"toString\")],\n [isInjectable, functionToString],\n [val(true), identity]\n ]);\n\n return stringifyPatternFn(value);\n};\n\nexport function stringify(o: any) {\n var seen: any[] = [];\n\n function format(val: any) {\n if (isObject(val)) {\n if (seen.indexOf(val) !== -1) return '[circular ref]';\n seen.push(val);\n }\n return stringifyPattern(val);\n }\n\n return JSON.stringify(o, (key, val) => format(val)).replace(/\\\\\"/g, '\"');\n}\n\n/** Returns a function that splits a string on a character or substring */\nexport const beforeAfterSubstr = (char: string) => (str: string) => {\n if (!str) return [\"\", \"\"];\n let idx = str.indexOf(char);\n if (idx === -1) return [str, \"\"];\n return [str.substr(0, idx), str.substr(idx + 1)];\n};\n\n/**\n * Splits on a delimiter, but returns the delimiters in the array\n *\n * #### Example:\n * ```js\n * var splitOnSlashes = splitOnDelim('/');\n * splitOnSlashes(\"/foo\"); // [\"/\", \"foo\"]\n * splitOnSlashes(\"/foo/\"); // [\"/\", \"foo\", \"/\"]\n * ```\n */\nexport function splitOnDelim(delim: string) {\n let re = new RegExp(\"(\" + delim + \")\", \"g\");\n return (str: string) =>\n str.split(re).filter(identity);\n};\n\n\n/**\n * Reduce fn that joins neighboring strings\n *\n * Given an array of strings, returns a new array\n * where all neighboring strings have been joined.\n *\n * #### Example:\n * ```js\n * let arr = [\"foo\", \"bar\", 1, \"baz\", \"\", \"qux\" ];\n * arr.reduce(joinNeighborsR, []) // [\"foobar\", 1, \"bazqux\" ]\n * ```\n */\nexport function joinNeighborsR(acc: any[], x: any) {\n if (isString(tail(acc)) && isString(x))\n return acc.slice(0, -1).concat(tail(acc)+ x);\n return pushR(acc, x);\n};\n\n","/** @module state */ /** for typedoc */\nimport {Obj, omit, noop, extend, inherit, values, applyPairs, tail, mapObj, identity} from \"../common/common\";\nimport {isDefined, isFunction, isString, isArray} from \"../common/predicates\";\nimport {stringify} from \"../common/strings\";\nimport {prop, pattern, is, pipe, val} from \"../common/hof\";\nimport {StateDeclaration} from \"./interface\";\n\nimport {StateObject} from \"./stateObject\";\nimport {StateMatcher} from \"./stateMatcher\";\nimport {Param} from \"../params/param\";\nimport {UrlMatcherFactory} from \"../url/urlMatcherFactory\";\nimport {UrlMatcher} from \"../url/urlMatcher\";\nimport {Resolvable} from \"../resolve/resolvable\";\nimport {services} from \"../common/coreservices\";\nimport {ResolvePolicy} from \"../resolve/interface\";\nimport { ParamFactory } from \"../url/interface\";\n\nconst parseUrl = (url: string): any => {\n if (!isString(url)) return false;\n let root = url.charAt(0) === '^';\n return { val: root ? url.substring(1) : url, root };\n};\n\nexport type BuilderFunction = (state: StateObject, parent?: BuilderFunction) => any;\n\ninterface Builders {\n [key: string]: BuilderFunction[];\n\n name: BuilderFunction[];\n parent: BuilderFunction[];\n data: BuilderFunction[];\n url: BuilderFunction[];\n navigable: BuilderFunction[];\n params: BuilderFunction[];\n views: BuilderFunction[];\n path: BuilderFunction[];\n includes: BuilderFunction[];\n resolvables: BuilderFunction[];\n}\n\n\nfunction nameBuilder(state: StateObject) {\n return state.name;\n}\n\nfunction selfBuilder(state: StateObject) {\n state.self.$$state = () => state;\n return state.self;\n}\n\nfunction dataBuilder(state: StateObject) {\n if (state.parent && state.parent.data) {\n state.data = state.self.data = inherit(state.parent.data, state.data);\n }\n return state.data;\n}\n\nconst getUrlBuilder = ($urlMatcherFactoryProvider: UrlMatcherFactory, root: () => StateObject) =>\nfunction urlBuilder(state: StateObject) {\n let stateDec: StateDeclaration = state;\n\n // For future states, i.e., states whose name ends with `.**`,\n // match anything that starts with the url prefix\n if (stateDec && stateDec.url && stateDec.name && stateDec.name.match(/\\.\\*\\*$/)) {\n stateDec.url += \"{remainder:any}\"; // match any path (.*)\n }\n\n const parsed = parseUrl(stateDec.url), parent = state.parent;\n const url = !parsed ? stateDec.url : $urlMatcherFactoryProvider.compile(parsed.val, {\n params: state.params || {},\n paramMap: function (paramConfig: any, isSearch: boolean) {\n if (stateDec.reloadOnSearch === false && isSearch) paramConfig = extend(paramConfig || {}, {dynamic: true});\n return paramConfig;\n }\n });\n\n if (!url) return null;\n if (!$urlMatcherFactoryProvider.isMatcher(url)) throw new Error(`Invalid url '${url}' in state '${state}'`);\n return (parsed && parsed.root) ? url : ((parent && parent.navigable) || root()).url.append( url);\n};\n\nconst getNavigableBuilder = (isRoot: (state: StateObject) => boolean) =>\nfunction navigableBuilder(state: StateObject) {\n return !isRoot(state) && state.url ? state : (state.parent ? state.parent.navigable : null);\n};\n\nconst getParamsBuilder = (paramFactory: ParamFactory) =>\nfunction paramsBuilder(state: StateObject): { [key: string]: Param } {\n const makeConfigParam = (config: any, id: string) => paramFactory.fromConfig(id, null, config);\n let urlParams: Param[] = (state.url && state.url.parameters({inherit: false})) || [];\n let nonUrlParams: Param[] = values(mapObj(omit(state.params || {}, urlParams.map(prop('id'))), makeConfigParam));\n return urlParams.concat(nonUrlParams).map(p => [p.id, p]).reduce(applyPairs, {});\n};\n\nfunction pathBuilder(state: StateObject) {\n return state.parent ? state.parent.path.concat(state) : /*root*/ [state];\n}\n\nfunction includesBuilder(state: StateObject) {\n let includes = state.parent ? extend({}, state.parent.includes) : {};\n includes[state.name] = true;\n return includes;\n}\n\n/**\n * This is a [[StateBuilder.builder]] function for the `resolve:` block on a [[StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * validates the `resolve` property and converts it to a [[Resolvable]] array.\n *\n * resolve: input value can be:\n *\n * {\n * // analyzed but not injected\n * myFooResolve: function() { return \"myFooData\"; },\n *\n * // function.toString() parsed, \"DependencyName\" dep as string (not min-safe)\n * myBarResolve: function(DependencyName) { return DependencyName.fetchSomethingAsPromise() },\n *\n * // Array split; \"DependencyName\" dep as string\n * myBazResolve: [ \"DependencyName\", function(dep) { return dep.fetchSomethingAsPromise() },\n *\n * // Array split; DependencyType dep as token (compared using ===)\n * myQuxResolve: [ DependencyType, function(dep) { return dep.fetchSometingAsPromise() },\n *\n * // val.$inject used as deps\n * // where:\n * // corgeResolve.$inject = [\"DependencyName\"];\n * // function corgeResolve(dep) { dep.fetchSometingAsPromise() }\n * // then \"DependencyName\" dep as string\n * myCorgeResolve: corgeResolve,\n *\n * // inject service by name\n * // When a string is found, desugar creating a resolve that injects the named service\n * myGraultResolve: \"SomeService\"\n * }\n *\n * or:\n *\n * [\n * new Resolvable(\"myFooResolve\", function() { return \"myFooData\" }),\n * new Resolvable(\"myBarResolve\", function(dep) { return dep.fetchSomethingAsPromise() }, [ \"DependencyName\" ]),\n * { provide: \"myBazResolve\", useFactory: function(dep) { dep.fetchSomethingAsPromise() }, deps: [ \"DependencyName\" ] }\n * ]\n */\nexport function resolvablesBuilder(state: StateObject): Resolvable[] {\n interface Tuple { token: any, val: any, deps: any[], policy: ResolvePolicy }\n \n /** convert resolve: {} and resolvePolicy: {} objects to an array of tuples */\n const objects2Tuples = (resolveObj: Obj, resolvePolicies: { [key: string]: ResolvePolicy }) =>\n Object.keys(resolveObj || {}).map(token => ({token, val: resolveObj[token], deps: undefined, policy: resolvePolicies[token]}));\n\n /** fetch DI annotations from a function or ng1-style array */\n const annotate = (fn: Function) => {\n let $injector = services.$injector;\n // ng1 doesn't have an $injector until runtime.\n // If the $injector doesn't exist, use \"deferred\" literal as a\n // marker indicating they should be annotated when runtime starts\n return fn['$inject'] || ($injector && $injector.annotate(fn, $injector.strictDi)) || \"deferred\";\n };\n\n /** true if the object has both `token` and `resolveFn`, and is probably a [[ResolveLiteral]] */\n const isResolveLiteral = (obj: any) => !!(obj.token && obj.resolveFn);\n\n /** true if the object looks like a provide literal, or a ng2 Provider */\n const isLikeNg2Provider = (obj: any) => !!((obj.provide || obj.token) && (obj.useValue || obj.useFactory || obj.useExisting || obj.useClass));\n\n /** true if the object looks like a tuple from obj2Tuples */\n const isTupleFromObj = (obj: any) => !!(obj && obj.val && (isString(obj.val) || isArray(obj.val) || isFunction(obj.val)));\n\n /** extracts the token from a Provider or provide literal */\n const token = (p: any) => p.provide || p.token;\n\n /** Given a literal resolve or provider object, returns a Resolvable */\n const literal2Resolvable = pattern([\n [prop('resolveFn'), p => new Resolvable(token(p), p.resolveFn, p.deps, p.policy)],\n [prop('useFactory'), p => new Resolvable(token(p), p.useFactory, (p.deps || p.dependencies), p.policy)],\n [prop('useClass'), p => new Resolvable(token(p), () => new (p.useClass)(), [], p.policy)],\n [prop('useValue'), p => new Resolvable(token(p), () => p.useValue, [], p.policy, p.useValue)],\n [prop('useExisting'), p => new Resolvable(token(p), identity, [p.useExisting], p.policy)],\n ]);\n\n const tuple2Resolvable = pattern([\n [pipe(prop(\"val\"), isString), (tuple: Tuple) => new Resolvable(tuple.token, identity, [ tuple.val ], tuple.policy)],\n [pipe(prop(\"val\"), isArray), (tuple: Tuple) => new Resolvable(tuple.token, tail( tuple.val), tuple.val.slice(0, -1), tuple.policy)],\n [pipe(prop(\"val\"), isFunction), (tuple: Tuple) => new Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy)],\n ]);\n\n const item2Resolvable = <(obj: any) => Resolvable> pattern([\n [is(Resolvable), (r: Resolvable) => r],\n [isResolveLiteral, literal2Resolvable],\n [isLikeNg2Provider, literal2Resolvable],\n [isTupleFromObj, tuple2Resolvable],\n [val(true), (obj: any) => { throw new Error(\"Invalid resolve value: \" + stringify(obj)) }]\n ]);\n\n // If resolveBlock is already an array, use it as-is.\n // Otherwise, assume it's an object and convert to an Array of tuples\n let decl = state.resolve;\n let items: any[] = isArray(decl) ? decl : objects2Tuples(decl, state.resolvePolicy || {});\n return items.map(item2Resolvable);\n}\n\n/**\n * @internalapi A internal global service\n *\n * StateBuilder is a factory for the internal [[StateObject]] objects.\n *\n * When you register a state with the [[StateRegistry]], you register a plain old javascript object which\n * conforms to the [[StateDeclaration]] interface. This factory takes that object and builds the corresponding\n * [[StateObject]] object, which has an API and is used internally.\n *\n * Custom properties or API may be added to the internal [[StateObject]] object by registering a decorator function\n * using the [[builder]] method.\n */\nexport class StateBuilder {\n /** An object that contains all the BuilderFunctions registered, key'd by the name of the State property they build */\n private builders: Builders;\n\n constructor(private matcher: StateMatcher, urlMatcherFactory: UrlMatcherFactory) {\n let self = this;\n\n const root = () => matcher.find(\"\");\n const isRoot = (state: StateObject) => state.name === \"\";\n\n function parentBuilder(state: StateObject) {\n if (isRoot(state)) return null;\n return matcher.find(self.parentName(state)) || root();\n }\n\n this.builders = {\n name: [ nameBuilder ],\n self: [ selfBuilder ],\n parent: [ parentBuilder ],\n data: [ dataBuilder ],\n // Build a URLMatcher if necessary, either via a relative or absolute URL\n url: [ getUrlBuilder(urlMatcherFactory, root) ],\n // Keep track of the closest ancestor state that has a URL (i.e. is navigable)\n navigable: [ getNavigableBuilder(isRoot) ],\n params: [ getParamsBuilder(urlMatcherFactory.paramFactory) ],\n // Each framework-specific ui-router implementation should define its own `views` builder\n // e.g., src/ng1/statebuilders/views.ts\n views: [],\n // Keep a full path from the root down to this state as this is needed for state activation.\n path: [ pathBuilder ],\n // Speed up $state.includes() as it's used a lot\n includes: [ includesBuilder ],\n resolvables: [ resolvablesBuilder ]\n };\n }\n\n /**\n * Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`).\n * More than one BuilderFunction can be registered for a given property.\n *\n * The BuilderFunction(s) will be used to define the property on any subsequently built [[StateObject]] objects.\n *\n * @param name The name of the State property being registered for.\n * @param fn The BuilderFunction which will be used to build the State property\n * @returns a function which deregisters the BuilderFunction\n */\n builder(name: string, fn: BuilderFunction): (BuilderFunction|BuilderFunction[]|Function) {\n let builders = this.builders;\n let array = builders[name] || [];\n // Backwards compat: if only one builder exists, return it, else return whole arary.\n if (isString(name) && !isDefined(fn)) return array.length > 1 ? array : array[0];\n if (!isString(name) || !isFunction(fn)) return;\n\n builders[name] = array;\n builders[name].push(fn);\n return () => builders[name].splice(builders[name].indexOf(fn, 1)) && null;\n }\n\n /**\n * Builds all of the properties on an essentially blank State object, returning a State object which has all its\n * properties and API built.\n *\n * @param state an uninitialized State object\n * @returns the built State object\n */\n build(state: StateObject): StateObject {\n let {matcher, builders} = this;\n let parent = this.parentName(state);\n\n if (parent && !matcher.find(parent, undefined, false)) {\n return null;\n }\n\n for (let key in builders) {\n if (!builders.hasOwnProperty(key)) continue;\n let chain = builders[key].reduce((parentFn: BuilderFunction, step: BuilderFunction) => (_state) => step(_state, parentFn), noop);\n state[key] = chain(state);\n }\n return state;\n }\n\n parentName(state: StateObject) {\n // name = 'foo.bar.baz.**'\n let name = state.name || \"\";\n // segments = ['foo', 'bar', 'baz', '.**']\n let segments = name.split('.');\n // segments = ['foo', 'bar', 'baz']\n let lastSegment = segments.pop();\n // segments = ['foo', 'bar'] (ignore .** segment for future states)\n if (lastSegment === '**') segments.pop();\n\n if (segments.length) {\n if (state.parent) {\n throw new Error(`States that specify the 'parent:' property should not have a '.' in their name (${name})`);\n }\n\n // 'foo.bar'\n return segments.join(\".\");\n }\n\n if (!state.parent) return \"\";\n return isString(state.parent) ? state.parent : state.parent.name;\n }\n\n name(state: StateObject) {\n let name = state.name;\n if (name.indexOf('.') !== -1 || !state.parent) return name;\n\n let parentName = isString(state.parent) ? state.parent : state.parent.name;\n return parentName ? parentName + \".\" + name : name;\n }\n}\n","/**\n * @coreapi\n * @module url\n */\n/** for typedoc */\nimport {\n map, defaults, inherit, identity, unnest, tail, find, Obj, pairs, allTrueR, unnestR, arrayTuples\n} from \"../common/common\";\nimport { prop, propEq } from \"../common/hof\";\nimport { isArray, isString, isDefined } from \"../common/predicates\";\nimport { Param, DefType } from \"../params/param\";\nimport { ParamTypes } from \"../params/paramTypes\";\nimport { RawParams } from \"../params/interface\";\nimport { ParamFactory } from \"./interface\";\nimport { joinNeighborsR, splitOnDelim } from \"../common/strings\";\n\n/** @hidden */\nfunction quoteRegExp(string: any, param?: any) {\n let surroundPattern = ['', ''], result = string.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, \"\\\\$&\");\n if (!param) return result;\n\n switch (param.squash) {\n case false:\n surroundPattern = ['(', ')' + (param.isOptional ? '?' : '')]; break;\n case true:\n result = result.replace(/\\/$/, '');\n surroundPattern = ['(?:\\/(', ')|\\/)?'];\n break;\n default:\n surroundPattern = [`(${param.squash}|`, ')?']; break;\n }\n return result + surroundPattern[0] + param.type.pattern.source + surroundPattern[1];\n}\n\n/** @hidden */\nconst memoizeTo = (obj: Obj, prop: string, fn: Function) =>\n obj[prop] = obj[prop] || fn();\n\n/** @hidden */\nconst splitOnSlash = splitOnDelim('/');\n\n/** @hidden */\ninterface UrlMatcherCache {\n segments?: any[];\n weights?: number[];\n path?: UrlMatcher[];\n parent?: UrlMatcher;\n pattern?: RegExp;\n}\n\n/**\n * Matches URLs against patterns.\n *\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL.\n *\n * A URL pattern consists of a path pattern, optionally followed by '?' and a list of search (query)\n * parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by [[UrlMatcher.exec]].\n *\n * - *Path parameters* are defined using curly brace placeholders (`/somepath/{param}`)\n * or colon placeholders (`/somePath/:param`).\n *\n * - *A parameter RegExp* may be defined for a param after a colon\n * (`/somePath/{param:[a-zA-Z0-9]+}`) in a curly brace placeholder.\n * The regexp must match for the url to be matched.\n * Should the regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Note: a RegExp parameter will encode its value using either [[ParamTypes.path]] or [[ParamTypes.query]].\n *\n * - *Custom parameter types* may also be specified after a colon (`/somePath/{param:int}`) in curly brace parameters.\n * See [[UrlMatcherFactory.type]] for more information.\n *\n * - *Catch-all parameters* are defined using an asterisk placeholder (`/somepath/*catchallparam`).\n * A catch-all * parameter value will contain the remainder of the URL.\n *\n * ---\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters).\n * A path parameter matches any number of characters other than '/'. For catch-all\n * placeholders the path parameter matches any number of characters.\n *\n * Examples:\n *\n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n * trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n * '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n * parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n * path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n * * `'/calendar/{start:date}'` - Matches \"/calendar/2014-11-12\" (because the pattern defined\n * in the built-in `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start\n *\n */\nexport class UrlMatcher {\n /** @hidden */\n static nameValidator: RegExp = /^\\w+([-.]+\\w+)*(?:\\[\\])?$/;\n\n /** @hidden */\n private _cache: UrlMatcherCache = { path: [this] };\n /** @hidden */\n private _children: UrlMatcher[] = [];\n /** @hidden */\n private _params: Param[] = [];\n /** @hidden */\n private _segments: string[] = [];\n /** @hidden */\n private _compiled: string[] = [];\n\n /** The pattern that was passed into the constructor */\n public pattern: string;\n\n /**\n * @param pattern The pattern to compile into a matcher.\n * @param paramTypes The [[ParamTypes]] registry\n * @param config A configuration object\n * - `caseInsensitive` - `true` if URL matching should be case insensitive, otherwise `false`, the default value (for backward compatibility) is `false`.\n * - `strict` - `false` if matching against a URL with a trailing slash should be treated as equivalent to a URL without a trailing slash, the default value is `true`.\n */\n constructor(pattern: string, paramTypes: ParamTypes, paramFactory: ParamFactory, public config?: any) {\n this.pattern = pattern;\n this.config = defaults(this.config, {\n params: {},\n strict: true,\n caseInsensitive: false,\n paramMap: identity\n });\n\n // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n // '*' name\n // ':' name\n // '{' name '}'\n // '{' name ':' regexp '}'\n // The regular expression is somewhat complicated due to the need to allow curly braces\n // inside the regular expression. The placeholder regexp breaks down as follows:\n // ([:*])([\\w\\[\\]]+) - classic placeholder ($1 / $2) (search version has - for snake-case)\n // \\{([\\w\\[\\]]+)(?:\\:\\s*( ... ))?\\} - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case\n // (?: ... | ... | ... )+ - the regexp consists of any number of atoms, an atom being either\n // [^{}\\\\]+ - anything other than curly braces or backslash\n // \\\\. - a backslash escape\n // \\{(?:[^{}\\\\]+|\\\\.)*\\} - a matched set of curly braces containing other atoms\n let placeholder = /([:*])([\\w\\[\\]]+)|\\{([\\w\\[\\]]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n searchPlaceholder = /([:]?)([\\w\\[\\].-]+)|\\{([\\w\\[\\].-]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n last = 0, m: RegExpExecArray, patterns: any[][] = [];\n\n const checkParamErrors = (id: string) => {\n if (!UrlMatcher.nameValidator.test(id)) throw new Error(`Invalid parameter name '${id}' in pattern '${pattern}'`);\n if (find(this._params, propEq('id', id))) throw new Error(`Duplicate parameter name '${id}' in pattern '${pattern}'`);\n };\n\n // Split into static segments separated by path parameter placeholders.\n // The number of segments is always 1 more than the number of parameters.\n const matchDetails = (m: RegExpExecArray, isSearch: boolean) => {\n // IE[78] returns '' for unmatched groups instead of null\n let id = m[2] || m[3];\n let regexp = isSearch ? m[4] : m[4] || (m[1] === '*' ? '[\\\\s\\\\S]*' : null);\n\n const makeRegexpType = (regexp) => inherit(paramTypes.type(isSearch ? \"query\" : \"path\"), {\n pattern: new RegExp(regexp, this.config.caseInsensitive ? 'i' : undefined)\n });\n\n return {\n id,\n regexp,\n cfg: this.config.params[id],\n segment: pattern.substring(last, m.index),\n type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp)\n };\n };\n\n let p: any, segment: string;\n\n while ((m = placeholder.exec(pattern))) {\n p = matchDetails(m, false);\n if (p.segment.indexOf('?') >= 0) break; // we're into the search part\n\n checkParamErrors(p.id);\n this._params.push(paramFactory.fromPath(p.id, p.type, this.config.paramMap(p.cfg, false)));\n this._segments.push(p.segment);\n patterns.push([p.segment, tail(this._params)]);\n last = placeholder.lastIndex;\n }\n segment = pattern.substring(last);\n\n // Find any search parameter names and remove them from the last segment\n let i = segment.indexOf('?');\n\n if (i >= 0) {\n let search = segment.substring(i);\n segment = segment.substring(0, i);\n\n if (search.length > 0) {\n last = 0;\n\n while ((m = searchPlaceholder.exec(search))) {\n p = matchDetails(m, true);\n checkParamErrors(p.id);\n this._params.push(paramFactory.fromSearch(p.id, p.type, this.config.paramMap(p.cfg, true)));\n last = placeholder.lastIndex;\n // check if ?&\n }\n }\n }\n\n this._segments.push(segment);\n this._compiled = patterns.map(pattern => quoteRegExp.apply(null, pattern)).concat(quoteRegExp(segment));\n }\n\n /**\n * Creates a new concatenated UrlMatcher\n *\n * Builds a new UrlMatcher by appending another UrlMatcher to this one.\n *\n * @param url A `UrlMatcher` instance to append as a child of the current `UrlMatcher`.\n */\n append(url: UrlMatcher): UrlMatcher {\n this._children.push(url);\n url._cache = {\n path: this._cache.path.concat(url),\n parent: this,\n pattern: null,\n };\n return url;\n }\n\n /** @hidden */\n isRoot(): boolean {\n return this._cache.path[0] === this;\n }\n\n /** Returns the input pattern string */\n toString(): string {\n return this.pattern;\n }\n\n /**\n * Tests the specified url/path against this matcher.\n *\n * Tests if the given url matches this matcher's pattern, and returns an object containing the captured\n * parameter values. Returns null if the path does not match.\n *\n * The returned object contains the values\n * of any search parameters that are mentioned in the pattern, but their value may be null if\n * they are not present in `search`. This means that search parameters are always treated\n * as optional.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', {\n * x: '1', q: 'hello'\n * });\n * // returns { id: 'bob', q: 'hello', r: null }\n * ```\n *\n * @param path The URL path to match, e.g. `$location.path()`.\n * @param search URL search parameters, e.g. `$location.search()`.\n * @param hash URL hash e.g. `$location.hash()`.\n * @param options\n *\n * @returns The captured parameter values.\n */\n exec(path: string, search: any = {}, hash?: string, options: any = {}): RawParams {\n let match = memoizeTo(this._cache, 'pattern', () => {\n return new RegExp([\n '^',\n unnest(this._cache.path.map(prop('_compiled'))).join(''),\n this.config.strict === false ? '\\/?' : '',\n '$'\n ].join(''), this.config.caseInsensitive ? 'i' : undefined);\n }).exec(path);\n\n if (!match) return null;\n\n //options = defaults(options, { isolate: false });\n\n let allParams: Param[] = this.parameters(),\n pathParams: Param[] = allParams.filter(param => !param.isSearch()),\n searchParams: Param[] = allParams.filter(param => param.isSearch()),\n nPathSegments = this._cache.path.map(urlm => urlm._segments.length - 1).reduce((a, x) => a + x),\n values: RawParams = {};\n\n if (nPathSegments !== match.length - 1)\n throw new Error(`Unbalanced capture group in route '${this.pattern}'`);\n\n function decodePathArray(string: string) {\n const reverseString = (str: string) => str.split(\"\").reverse().join(\"\");\n const unquoteDashes = (str: string) => str.replace(/\\\\-/g, \"-\");\n\n let split = reverseString(string).split(/-(?!\\\\)/);\n let allReversed = map(split, reverseString);\n return map(allReversed, unquoteDashes).reverse();\n }\n\n for (let i = 0; i < nPathSegments; i++) {\n let param: Param = pathParams[i];\n let value: (any|any[]) = match[i + 1];\n\n // if the param value matches a pre-replace pair, replace the value before decoding.\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n if (value && param.array === true) value = decodePathArray(value);\n if (isDefined(value)) value = param.type.decode(value);\n values[param.id] = param.value(value);\n }\n searchParams.forEach(param => {\n let value = search[param.id];\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n if (isDefined(value)) value = param.type.decode(value);\n values[param.id] = param.value(value);\n });\n\n if (hash) values[\"#\"] = hash;\n\n return values;\n }\n\n /**\n * @hidden\n * Returns all the [[Param]] objects of all path and search parameters of this pattern in order of appearance.\n *\n * @returns {Array.} An array of [[Param]] objects. Must be treated as read-only. If the\n * pattern has no parameters, an empty array is returned.\n */\n parameters(opts: any = {}): Param[] {\n if (opts.inherit === false) return this._params;\n return unnest(this._cache.path.map(matcher => matcher._params));\n }\n\n /**\n * @hidden\n * Returns a single parameter from this UrlMatcher by id\n *\n * @param id\n * @param opts\n * @returns {T|Param|any|boolean|UrlMatcher|null}\n */\n parameter(id: string, opts: any = {}): Param {\n const findParam = () => {\n for (let param of this._params) {\n if (param.id === id) return param;\n }\n };\n\n let parent = this._cache.parent;\n return findParam() || (opts.inherit !== false && parent && parent.parameter(id, opts)) || null;\n }\n\n /**\n * Validates the input parameter values against this UrlMatcher\n *\n * Checks an object hash of parameters to validate their correctness according to the parameter\n * types of this `UrlMatcher`.\n *\n * @param params The object hash of parameters to validate.\n * @returns Returns `true` if `params` validates, otherwise `false`.\n */\n validates(params: RawParams): boolean {\n const validParamVal = (param: Param, val: any) =>\n !param || param.validates(val);\n\n params = params || {};\n\n // I'm not sure why this checks only the param keys passed in, and not all the params known to the matcher\n let paramSchema = this.parameters().filter(paramDef => params.hasOwnProperty(paramDef.id));\n return paramSchema.map(paramDef => validParamVal(paramDef, params[paramDef.id])).reduce(allTrueR, true);\n }\n\n /**\n * Given a set of parameter values, creates a URL from this UrlMatcher.\n *\n * Creates a URL that matches this pattern by substituting the specified values\n * for the path and search parameters.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n * // returns '/user/bob?q=yes'\n * ```\n *\n * @param values the values to substitute for the parameters in this pattern.\n * @returns the formatted URL (path and optionally search part).\n */\n format(values: RawParams = {}) {\n // Build the full path of UrlMatchers (including all parent UrlMatchers)\n let urlMatchers = this._cache.path;\n\n // Extract all the static segments and Params (processed as ParamDetails)\n // into an ordered array\n let pathSegmentsAndParams: Array = urlMatchers.map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .map(x => isString(x) ? x : getDetails(x));\n\n // Extract the query params into a separate array\n let queryParams: Array = urlMatchers.map(UrlMatcher.queryParams)\n .reduce(unnestR, [])\n .map(getDetails);\n\n const isInvalid = (param: ParamDetails) => param.isValid === false;\n if (pathSegmentsAndParams.concat(queryParams).filter(isInvalid).length) {\n return null;\n }\n\n /**\n * Given a Param, applies the parameter value, then returns detailed information about it\n */\n function getDetails(param: Param): ParamDetails {\n // Normalize to typed value\n let value = param.value(values[param.id]);\n let isValid = param.validates(value);\n let isDefaultValue = param.isDefaultValue(value);\n // Check if we're in squash mode for the parameter\n let squash = isDefaultValue ? param.squash : false;\n // Allow the Parameter's Type to encode the value\n let encoded = param.type.encode(value);\n\n return { param, value, isValid, isDefaultValue, squash, encoded };\n }\n\n // Build up the path-portion from the list of static segments and parameters\n let pathString = pathSegmentsAndParams.reduce((acc: string, x: string|ParamDetails) => {\n // The element is a static segment (a raw string); just append it\n if (isString(x)) return acc + x;\n\n // Otherwise, it's a ParamDetails.\n let { squash, encoded, param } = x;\n\n // If squash is === true, try to remove a slash from the path\n if (squash === true) return (acc.match(/\\/$/)) ? acc.slice(0, -1) : acc;\n // If squash is a string, use the string for the param value\n if (isString(squash)) return acc + squash;\n if (squash !== false) return acc; // ?\n if (encoded == null) return acc;\n // If this parameter value is an array, encode the value using encodeDashes\n if (isArray(encoded)) return acc + map( encoded, UrlMatcher.encodeDashes).join(\"-\");\n // If the parameter type is \"raw\", then do not encodeURIComponent\n if (param.raw) return acc + encoded;\n // Encode the value\n return acc + encodeURIComponent( encoded);\n }, \"\");\n\n // Build the query string by applying parameter values (array or regular)\n // then mapping to key=value, then flattening and joining using \"&\"\n let queryString = queryParams.map((paramDetails: ParamDetails) => {\n let { param, squash, encoded, isDefaultValue } = paramDetails;\n if (encoded == null || (isDefaultValue && squash !== false)) return;\n if (!isArray(encoded)) encoded = [ encoded];\n if (encoded.length === 0) return;\n if (!param.raw) encoded = map( encoded, encodeURIComponent);\n\n return ( encoded).map(val => `${param.id}=${val}`);\n }).filter(identity).reduce(unnestR, []).join(\"&\");\n\n // Concat the pathstring with the queryString (if exists) and the hashString (if exists)\n return pathString + (queryString ? `?${queryString}` : \"\") + (values[\"#\"] ? \"#\" + values[\"#\"] : \"\");\n }\n\n /** @hidden */\n static encodeDashes(str: string) { // Replace dashes with encoded \"\\-\"\n return encodeURIComponent(str).replace(/-/g, c => `%5C%${c.charCodeAt(0).toString(16).toUpperCase()}`);\n }\n\n /** @hidden Given a matcher, return an array with the matcher's path segments and path params, in order */\n static pathSegmentsAndParams(matcher: UrlMatcher) {\n let staticSegments = matcher._segments;\n let pathParams = matcher._params.filter(p => p.location === DefType.PATH);\n return arrayTuples(staticSegments, pathParams.concat(undefined))\n .reduce(unnestR, [])\n .filter(x => x !== \"\" && isDefined(x));\n }\n\n /** @hidden Given a matcher, return an array with the matcher's query params */\n static queryParams(matcher: UrlMatcher): Param[] {\n return matcher._params.filter(p => p.location === DefType.SEARCH);\n }\n\n /**\n * Compare two UrlMatchers\n *\n * This comparison function converts a UrlMatcher into static and dynamic path segments.\n * Each static path segment is a static string between a path separator (slash character).\n * Each dynamic segment is a path parameter.\n *\n * The comparison function sorts static segments before dynamic ones.\n */\n static compare(a: UrlMatcher, b: UrlMatcher): number {\n /**\n * Turn a UrlMatcher and all its parent matchers into an array\n * of slash literals '/', string literals, and Param objects\n *\n * This example matcher matches strings like \"/foo/:param/tail\":\n * var matcher = $umf.compile(\"/foo\").append($umf.compile(\"/:param\")).append($umf.compile(\"/\")).append($umf.compile(\"tail\"));\n * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ]\n *\n * Caches the result as `matcher._cache.segments`\n */\n const segments = (matcher: UrlMatcher) =>\n matcher._cache.segments = matcher._cache.segments ||\n matcher._cache.path.map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .reduce(joinNeighborsR, [])\n .map(x => isString(x) ? splitOnSlash(x) : x)\n .reduce(unnestR, []);\n\n /**\n * Gets the sort weight for each segment of a UrlMatcher\n *\n * Caches the result as `matcher._cache.weights`\n */\n const weights = (matcher: UrlMatcher) =>\n matcher._cache.weights = matcher._cache.weights ||\n segments(matcher).map(segment => {\n // Sort slashes first, then static strings, the Params\n if (segment === '/') return 1;\n if (isString(segment)) return 2;\n if (segment instanceof Param) return 3;\n });\n\n /**\n * Pads shorter array in-place (mutates)\n */\n const padArrays = (l: any[], r: any[], padVal: any) => {\n const len = Math.max(l.length, r.length);\n while (l.length < len) l.push(padVal);\n while (r.length < len) r.push(padVal);\n };\n\n const weightsA = weights(a), weightsB = weights(b);\n padArrays(weightsA, weightsB, 0);\n let cmp, i, pairs = arrayTuples(weightsA, weightsB);\n\n for (i = 0; i < pairs.length; i++) {\n cmp = pairs[i][0] - pairs[i][1];\n if (cmp !== 0) return cmp;\n }\n\n return 0;\n }\n}\n\n/** @hidden */\ninterface ParamDetails {\n param: Param;\n value: any;\n isValid: boolean;\n isDefaultValue: boolean;\n squash: (boolean|string);\n encoded: (string|string[]);\n}\n","/**\n * @internalapi\n * @module url\n */\n/** for typedoc */\nimport { createProxyFunctions, extend, removeFrom } from '../common/common';\nimport { isDefined, isFunction, isString } from '../common/predicates';\nimport { UrlMatcher } from './urlMatcher';\nimport { RawParams } from '../params/interface';\nimport { Disposable } from '../interface';\nimport { UIRouter } from '../router';\nimport { is, pattern, val } from '../common/hof';\nimport { UrlRuleFactory } from './urlRule';\nimport { TargetState } from '../state/targetState';\nimport { MatcherUrlRule, MatchResult, UrlParts, UrlRule, UrlRuleHandlerFn, UrlRuleMatchFn, UrlRulesApi, UrlSyncApi, } from './interface';\nimport { TargetStateDef } from '../state/interface';\n\n/** @hidden */\nfunction appendBasePath(url: string, isHtml5: boolean, absolute: boolean, baseHref: string): string {\n if (baseHref === '/') return url;\n if (isHtml5) return baseHref.slice(0, -1) + url;\n if (absolute) return baseHref.slice(1) + url;\n return url;\n}\n\n/** @hidden */\nconst prioritySort = (a: UrlRule, b: UrlRule) =>\n (b.priority || 0) - (a.priority || 0);\n\n/** @hidden */\nconst typeSort = (a: UrlRule, b: UrlRule) => {\n const weights = { \"STATE\": 4, \"URLMATCHER\": 4, \"REGEXP\": 3, \"RAW\": 2, \"OTHER\": 1 };\n return (weights[a.type] || 0) - (weights[b.type] || 0);\n};\n\n/** @hidden */\nconst urlMatcherSort = (a: MatcherUrlRule, b: MatcherUrlRule) =>\n !a.urlMatcher || !b.urlMatcher ? 0 : UrlMatcher.compare(a.urlMatcher, b.urlMatcher);\n\n/** @hidden */\nconst idSort = (a: UrlRule, b: UrlRule) => {\n // Identically sorted STATE and URLMATCHER best rule will be chosen by `matchPriority` after each rule matches the URL\n const useMatchPriority = { STATE: true, URLMATCHER: true };\n const equal = useMatchPriority[a.type] && useMatchPriority[b.type];\n return equal ? 0 : (a.$id || 0) - (b.$id || 0);\n};\n\n/**\n * Default rule priority sorting function.\n *\n * Sorts rules by:\n *\n * - Explicit priority (set rule priority using [[UrlRulesApi.when]])\n * - Rule type (STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1)\n * - `UrlMatcher` specificity ([[UrlMatcher.compare]]): works for STATE and URLMATCHER types to pick the most specific rule.\n * - Rule registration order (for rule types other than STATE and URLMATCHER)\n * - Equally sorted State and UrlMatcher rules will each match the URL.\n * Then, the *best* match is chosen based on how many parameter values were matched.\n *\n * @coreapi\n */\nlet defaultRuleSortFn: (a: UrlRule, b: UrlRule) => number;\ndefaultRuleSortFn = (a, b) => {\n let cmp = prioritySort(a, b);\n if (cmp !== 0) return cmp;\n\n cmp = typeSort(a, b);\n if (cmp !== 0) return cmp;\n\n cmp = urlMatcherSort(a as MatcherUrlRule, b as MatcherUrlRule);\n if (cmp !== 0) return cmp;\n\n return idSort(a, b);\n};\n\n/**\n * Updates URL and responds to URL changes\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class updates the URL when the state changes.\n * It also responds to changes in the URL.\n */\nexport class UrlRouter implements UrlRulesApi, UrlSyncApi, Disposable {\n /** used to create [[UrlRule]] objects for common cases */\n public urlRuleFactory: UrlRuleFactory;\n\n /** @hidden */ private _router: UIRouter;\n /** @hidden */ private location: string;\n /** @hidden */ private _sortFn = defaultRuleSortFn;\n /** @hidden */ private _stopFn: Function;\n /** @hidden */ _rules: UrlRule[] = [];\n /** @hidden */ private _otherwiseFn: UrlRule;\n /** @hidden */ interceptDeferred = false;\n /** @hidden */ private _id = 0;\n /** @hidden */ private _sorted = false;\n\n /** @hidden */\n constructor(router: UIRouter) {\n this._router = router;\n this.urlRuleFactory = new UrlRuleFactory(router);\n createProxyFunctions(val(UrlRouter.prototype), this, val(this));\n }\n\n /** @internalapi */\n dispose() {\n this.listen(false);\n this._rules = [];\n delete this._otherwiseFn;\n }\n\n /** @inheritdoc */\n sort(compareFn?: (a: UrlRule, b: UrlRule) => number) {\n this._rules = this.stableSort(this._rules, this._sortFn = compareFn || this._sortFn);\n this._sorted = true;\n }\n\n private ensureSorted() {\n this._sorted || this.sort();\n }\n\n private stableSort(arr, compareFn) {\n const arrOfWrapper = arr.map((elem, idx) => ({ elem, idx }));\n\n arrOfWrapper.sort((wrapperA, wrapperB) => {\n const cmpDiff = compareFn(wrapperA.elem, wrapperB.elem);\n return cmpDiff === 0\n ? wrapperA.idx - wrapperB.idx\n : cmpDiff;\n });\n\n return arrOfWrapper.map(wrapper => wrapper.elem);\n }\n\n /**\n * Given a URL, check all rules and return the best [[MatchResult]]\n * @param url\n * @returns {MatchResult}\n */\n match(url: UrlParts): MatchResult {\n this.ensureSorted();\n\n url = extend({path: '', search: {}, hash: '' }, url);\n let rules = this.rules();\n if (this._otherwiseFn) rules.push(this._otherwiseFn);\n\n // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined\n\n let checkRule = (rule: UrlRule): MatchResult => {\n let match = rule.match(url, this._router);\n return match && { match, rule, weight: rule.matchPriority(match) };\n };\n\n // The rules are pre-sorted.\n // - Find the first matching rule.\n // - Find any other matching rule that sorted *exactly the same*, according to `.sort()`.\n // - Choose the rule with the highest match weight.\n let best: MatchResult;\n for (let i = 0; i < rules.length; i++) {\n // Stop when there is a 'best' rule and the next rule sorts differently than it.\n if (best && this._sortFn(rules[i], best.rule) !== 0) break;\n\n let current = checkRule(rules[i]);\n // Pick the best MatchResult\n best = (!best || current && current.weight > best.weight) ? current : best;\n }\n\n return best;\n }\n\n /** @inheritdoc */\n sync(evt?) {\n if (evt && evt.defaultPrevented) return;\n\n let router = this._router,\n $url = router.urlService,\n $state = router.stateService;\n\n let url: UrlParts = {\n path: $url.path(), search: $url.search(), hash: $url.hash(),\n };\n\n let best = this.match(url);\n\n let applyResult = pattern([\n [isString, (newurl: string) => $url.url(newurl, true)],\n [TargetState.isDef, (def: TargetStateDef) => $state.go(def.state, def.params, def.options)],\n [is(TargetState), (target: TargetState) => $state.go(target.state(), target.params(), target.options())],\n ]);\n\n applyResult(best && best.rule.handler(best.match, url, router));\n }\n\n /** @inheritdoc */\n listen(enabled?: boolean): Function {\n if (enabled === false) {\n this._stopFn && this._stopFn();\n delete this._stopFn;\n } else {\n return this._stopFn = this._stopFn || this._router.urlService.onChange(evt => this.sync(evt));\n }\n }\n\n /**\n * Internal API.\n * @internalapi\n */\n update(read?: boolean) {\n let $url = this._router.locationService;\n if (read) {\n this.location = $url.path();\n return;\n }\n if ($url.path() === this.location) return;\n\n $url.url(this.location, true);\n }\n\n /**\n * Internal API.\n *\n * Pushes a new location to the browser history.\n *\n * @internalapi\n * @param urlMatcher\n * @param params\n * @param options\n */\n push(urlMatcher: UrlMatcher, params?: RawParams, options?: { replace?: (string|boolean) }) {\n let replace = options && !!options.replace;\n this._router.urlService.url(urlMatcher.format(params || {}), replace);\n }\n\n /**\n * Builds and returns a URL with interpolated parameters\n *\n * #### Example:\n * ```js\n * matcher = $umf.compile(\"/about/:person\");\n * params = { person: \"bob\" };\n * $bob = $urlRouter.href(matcher, params);\n * // $bob == \"/about/bob\";\n * ```\n *\n * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate.\n * @param params An object of parameter values to fill the matcher's required parameters.\n * @param options Options object. The options are:\n *\n * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n *\n * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`\n */\n href(urlMatcher: UrlMatcher, params?: any, options?: { absolute: boolean }): string {\n let url = urlMatcher.format(params);\n if (url == null) return null;\n\n options = options || { absolute: false };\n\n let cfg = this._router.urlService.config;\n let isHtml5 = cfg.html5Mode();\n if (!isHtml5 && url !== null) {\n url = \"#\" + cfg.hashPrefix() + url;\n }\n url = appendBasePath(url, isHtml5, options.absolute, cfg.baseHref());\n\n if (!options.absolute || !url) {\n return url;\n }\n\n let slash = (!isHtml5 && url ? '/' : ''), port = cfg.port();\n port = (port === 80 || port === 443 ? '' : ':' + port);\n\n return [cfg.protocol(), '://', cfg.host(), port, slash, url].join('');\n }\n\n\n /**\n * Manually adds a URL Rule.\n *\n * Usually, a url rule is added using [[StateDeclaration.url]] or [[when]].\n * This api can be used directly for more control (to register a [[BaseUrlRule]], for example).\n * Rules can be created using [[UrlRouter.urlRuleFactory]], or create manually as simple objects.\n *\n * A rule should have a `match` function which returns truthy if the rule matched.\n * It should also have a `handler` function which is invoked if the rule is the best match.\n *\n * @return a function that deregisters the rule\n */\n rule(rule: UrlRule): Function {\n if (!UrlRuleFactory.isUrlRule(rule)) throw new Error(\"invalid rule\");\n rule.$id = this._id++;\n rule.priority = rule.priority || 0;\n\n this._rules.push(rule);\n this._sorted = false;\n\n return () => this.removeRule(rule);\n }\n\n /** @inheritdoc */\n removeRule(rule): void {\n removeFrom(this._rules, rule);\n }\n\n /** @inheritdoc */\n rules(): UrlRule[] {\n this.ensureSorted();\n return this._rules.slice();\n }\n\n /** @inheritdoc */\n otherwise(handler: string|UrlRuleHandlerFn|TargetState|TargetStateDef) {\n let handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n this._otherwiseFn = this.urlRuleFactory.create(val(true), handlerFn);\n this._sorted = false;\n };\n\n /** @inheritdoc */\n initial(handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef) {\n let handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n let matchFn: UrlRuleMatchFn = (urlParts, router) =>\n router.globals.transitionHistory.size() === 0 && !!/^\\/?$/.exec(urlParts.path);\n\n this.rule(this.urlRuleFactory.create(matchFn, handlerFn));\n };\n\n /** @inheritdoc */\n when(matcher: (RegExp|UrlMatcher|string), handler: string|UrlRuleHandlerFn, options?: { priority: number }): UrlRule {\n let rule = this.urlRuleFactory.create(matcher, handler);\n if (isDefined(options && options.priority)) rule.priority = options.priority;\n this.rule(rule);\n return rule;\n };\n\n /** @inheritdoc */\n deferIntercept(defer?: boolean) {\n if (defer === undefined) defer = true;\n this.interceptDeferred = defer;\n };\n}\n\nfunction getHandlerFn(handler: string|UrlRuleHandlerFn|TargetState|TargetStateDef): UrlRuleHandlerFn {\n if (!isFunction(handler) && !isString(handler) && !is(TargetState)(handler) && !TargetState.isDef(handler)) {\n throw new Error(\"'handler' must be a string, function, TargetState, or have a state: 'newtarget' property\");\n }\n return isFunction(handler) ? handler as UrlRuleHandlerFn : val(handler);\n}\n","/** @module hooks */ /** */\nimport { Transition } from \"../transition/transition\";\nimport { UIRouter } from \"../router\";\nimport { TransitionService } from \"../transition/transitionService\";\n\nfunction addCoreResolvables(trans: Transition) {\n trans.addResolvable({ token: UIRouter, deps: [], resolveFn: () => trans.router, data: trans.router }, \"\");\n trans.addResolvable({ token: Transition, deps: [], resolveFn: () => trans, data: trans }, \"\");\n trans.addResolvable({ token: '$transition$', deps: [], resolveFn: () => trans, data: trans }, \"\");\n trans.addResolvable({ token: '$stateParams', deps: [], resolveFn: () => trans.params(), data: trans.params() }, \"\");\n\n trans.entering().forEach(state => {\n trans.addResolvable({ token: '$state$', deps: [], resolveFn: () => state, data: state }, state);\n });\n}\n\nexport const registerAddCoreResolvables = (transitionService: TransitionService) =>\n transitionService.onCreate({}, addCoreResolvables);\n","/** @module hooks */\n/** for typedoc */\nimport { TransitionStateHookFn } from '../transition/interface';\nimport { Transition } from '../transition/transition';\nimport { TransitionService } from '../transition/transitionService';\nimport { StateDeclaration } from '../state/interface';\nimport { StateObject } from '../state/stateObject';\n\n/**\n * A factory which creates an onEnter, onExit or onRetain transition hook function\n *\n * The returned function invokes the (for instance) state.onEnter hook when the\n * state is being entered.\n *\n * @hidden\n */\nfunction makeEnterExitRetainHook(hookName: string): TransitionStateHookFn {\n return (transition: Transition, state: StateDeclaration) => {\n let _state: StateObject = state.$$state();\n let hookFn: TransitionStateHookFn = _state[hookName];\n return hookFn(transition, state);\n }\n}\n\n/**\n * The [[TransitionStateHookFn]] for onExit\n *\n * When the state is being exited, the state's .onExit function is invoked.\n *\n * Registered using `transitionService.onExit({ exiting: (state) => !!state.onExit }, onExitHook);`\n *\n * See: [[IHookRegistry.onExit]]\n */\nconst onExitHook: TransitionStateHookFn = makeEnterExitRetainHook('onExit');\nexport const registerOnExitHook = (transitionService: TransitionService) =>\n transitionService.onExit({exiting: state => !!state.onExit}, onExitHook);\n\n/**\n * The [[TransitionStateHookFn]] for onRetain\n *\n * When the state was already entered, and is not being exited or re-entered, the state's .onRetain function is invoked.\n *\n * Registered using `transitionService.onRetain({ retained: (state) => !!state.onRetain }, onRetainHook);`\n *\n * See: [[IHookRegistry.onRetain]]\n */\nconst onRetainHook: TransitionStateHookFn = makeEnterExitRetainHook('onRetain');\nexport const registerOnRetainHook = (transitionService: TransitionService) =>\n transitionService.onRetain({retained: state => !!state.onRetain}, onRetainHook);\n\n/**\n * The [[TransitionStateHookFn]] for onEnter\n *\n * When the state is being entered, the state's .onEnter function is invoked.\n *\n * Registered using `transitionService.onEnter({ entering: (state) => !!state.onEnter }, onEnterHook);`\n *\n * See: [[IHookRegistry.onEnter]]\n */\nconst onEnterHook: TransitionStateHookFn = makeEnterExitRetainHook('onEnter');\nexport const registerOnEnterHook = (transitionService: TransitionService) =>\n transitionService.onEnter({entering: state => !!state.onEnter}, onEnterHook);\n\n","/** @module hooks */ /** */\nimport {Transition} from \"../transition/transition\";\nimport {TransitionService} from \"../transition/transitionService\";\nimport {TransitionHookFn} from \"../transition/interface\";\nimport {StateDeclaration, LazyLoadResult} from \"../state/interface\";\nimport {services} from \"../common/coreservices\";\nimport { StateRule } from \"../url/interface\";\n\n/**\n * A [[TransitionHookFn]] that performs lazy loading\n *\n * When entering a state \"abc\" which has a `lazyLoad` function defined:\n * - Invoke the `lazyLoad` function (unless it is already in process)\n * - Flag the hook function as \"in process\"\n * - The function should return a promise (that resolves when lazy loading is complete)\n * - Wait for the promise to settle\n * - If the promise resolves to a [[LazyLoadResult]], then register those states\n * - Flag the hook function as \"not in process\"\n * - If the hook was successful\n * - Remove the `lazyLoad` function from the state declaration\n * - If all the hooks were successful\n * - Retry the transition (by returning a TargetState)\n *\n * ```\n * .state('abc', {\n * component: 'fooComponent',\n * lazyLoad: () => System.import('./fooComponent')\n * });\n * ```\n *\n * See [[StateDeclaration.lazyLoad]]\n */\nconst lazyLoadHook: TransitionHookFn = (transition: Transition) => {\n let router = transition.router;\n\n function retryTransition() {\n if (transition.originalTransition().options().source !== 'url') {\n // The original transition was not triggered via url sync\n // The lazy state should be loaded now, so re-try the original transition\n let orig = transition.targetState();\n return router.stateService.target(orig.identifier(), orig.params(), orig.options());\n }\n\n // The original transition was triggered via url sync\n // Run the URL rules and find the best match\n let $url = router.urlService;\n let result = $url.match($url.parts());\n let rule = result && result.rule;\n\n // If the best match is a state, redirect the transition (instead\n // of calling sync() which supersedes the current transition)\n if (rule && rule.type === \"STATE\") {\n let state = (rule as StateRule).state;\n let params = result.match;\n return router.stateService.target(state, params, transition.options());\n }\n\n // No matching state found, so let .sync() choose the best non-state match/otherwise\n router.urlService.sync();\n }\n\n let promises = transition.entering()\n .filter(state => !!state.$$state().lazyLoad)\n .map(state => lazyLoadState(transition, state));\n\n return services.$q.all(promises).then(retryTransition);\n};\n\nexport const registerLazyLoadHook = (transitionService: TransitionService) =>\n transitionService.onBefore({ entering: (state) => !!state.lazyLoad }, lazyLoadHook);\n\n\n/**\n * Invokes a state's lazy load function\n *\n * @param transition a Transition context\n * @param state the state to lazy load\n * @returns A promise for the lazy load result\n */\nexport function lazyLoadState(transition: Transition, state: StateDeclaration): Promise {\n let lazyLoadFn = state.$$state().lazyLoad;\n\n // Store/get the lazy load promise on/from the hookfn so it doesn't get re-invoked\n let promise = lazyLoadFn['_promise'];\n if (!promise) {\n const success = (result) => {\n delete state.lazyLoad;\n delete state.$$state().lazyLoad;\n delete lazyLoadFn['_promise'];\n return result;\n };\n\n const error = (err) => {\n delete lazyLoadFn['_promise'];\n return services.$q.reject(err);\n };\n\n promise = lazyLoadFn['_promise'] =\n services.$q.when(lazyLoadFn(transition, state))\n .then(updateStateRegistry)\n .then(success, error);\n }\n\n /** Register any lazy loaded state definitions */\n function updateStateRegistry(result: LazyLoadResult) {\n if (result && Array.isArray(result.states)) {\n result.states.forEach(state => transition.router.stateRegistry.register(state));\n }\n return result;\n }\n\n return promise;\n}\n","/** @module hooks */ /** */\n\nimport { trace } from '../common/trace';\nimport { Rejection } from '../transition/rejectFactory';\nimport { TransitionService } from '../transition/transitionService';\nimport { Transition } from '../transition/transition';\n\n/**\n * A [[TransitionHookFn]] that skips a transition if it should be ignored\n *\n * This hook is invoked at the end of the onBefore phase.\n *\n * If the transition should be ignored (because no parameter or states changed)\n * then the transition is ignored and not processed.\n */\nfunction ignoredHook(trans: Transition) {\n const ignoredReason = trans._ignoredReason();\n if (!ignoredReason) return;\n\n trace.traceTransitionIgnored(trans);\n\n const pending = trans.router.globals.transition;\n\n // The user clicked a link going back to the *current state* ('A')\n // However, there is also a pending transition in flight (to 'B')\n // Abort the transition to 'B' because the user now wants to be back at 'A'.\n if (ignoredReason === 'SameAsCurrent' && pending) {\n pending.abort();\n }\n\n return Rejection.ignored().toPromise();\n}\n\nexport const registerIgnoredTransitionHook = (transitionService: TransitionService) =>\n transitionService.onBefore({}, ignoredHook, { priority: -9999 });\n","/** @module hooks */ /** */\n\nimport { TransitionService } from '../transition/transitionService';\nimport { Transition } from '../transition/transition';\n\n/**\n * A [[TransitionHookFn]] that rejects the Transition if it is invalid\n *\n * This hook is invoked at the end of the onBefore phase.\n * If the transition is invalid (for example, param values do not validate)\n * then the transition is rejected.\n */\nfunction invalidTransitionHook(trans: Transition) {\n if (!trans.valid()) {\n throw new Error(trans.error());\n }\n}\n\nexport const registerInvalidTransitionHook = (transitionService: TransitionService) =>\n transitionService.onBefore({}, invalidTransitionHook, { priority: -10000 });\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { isArray } from \"../common/index\";\nimport { LocationServices, LocationConfig } from \"../common/coreservices\";\nimport { UIRouter } from \"../router\";\nimport { identity, unnestR, removeFrom, deregAll, extend } from \"../common/common\";\nimport { LocationLike, HistoryLike } from \"./interface\";\nimport { isDefined } from \"../common/predicates\";\nimport { Disposable } from \"../interface\";\n\nconst beforeAfterSubstr = (char: string) => (str: string): string[] => {\n if (!str) return [\"\", \"\"];\n let idx = str.indexOf(char);\n if (idx === -1) return [str, \"\"];\n return [str.substr(0, idx), str.substr(idx + 1)];\n};\n\nexport const splitHash = beforeAfterSubstr(\"#\");\nexport const splitQuery = beforeAfterSubstr(\"?\");\nexport const splitEqual = beforeAfterSubstr(\"=\");\nexport const trimHashVal = (str) => str ? str.replace(/^#/, \"\") : \"\";\n\nexport const keyValsToObjectR = (accum, [key, val]) => {\n if (!accum.hasOwnProperty(key)) {\n accum[key] = val;\n } else if (isArray(accum[key])) {\n accum[key].push(val);\n } else {\n accum[key] = [accum[key], val]\n }\n return accum;\n};\n\nexport const getParams = (queryString: string): any =>\n queryString.split(\"&\").filter(identity).map(splitEqual).reduce(keyValsToObjectR, {});\n\nexport function parseUrl(url: string) {\n const orEmptyString = x => x || \"\";\n let [beforehash, hash] = splitHash(url).map(orEmptyString);\n let [path, search] = splitQuery(beforehash).map(orEmptyString);\n\n return { path, search, hash, url };\n}\n\nexport const buildUrl = (loc: LocationServices) => {\n let path = loc.path();\n let searchObject = loc.search();\n let hash = loc.hash();\n\n let search = Object.keys(searchObject).map(key => {\n let param = searchObject[key];\n let vals = isArray(param) ? param : [param];\n return vals.map(val => key + \"=\" + val);\n }).reduce(unnestR, []).join(\"&\");\n\n return path + (search ? \"?\" + search : \"\") + (hash ? \"#\" + hash : \"\");\n};\n\nexport function locationPluginFactory(\n name: string,\n isHtml5: boolean,\n serviceClass: { new(router?: UIRouter): LocationServices },\n configurationClass: { new(router?: UIRouter, isHtml5?: boolean): LocationConfig }\n) {\n return function(router: UIRouter) {\n let service = router.locationService = new serviceClass(router);\n let configuration = router.locationConfig = new configurationClass(router, isHtml5);\n\n function dispose(router: UIRouter) {\n router.dispose(service);\n router.dispose(configuration);\n }\n\n return { name, service, configuration, dispose };\n };\n}\n\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { BrowserLocationConfig } from \"./browserLocationConfig\";\nimport { HashLocationService } from \"./hashLocationService\";\nimport { locationPluginFactory } from \"./utils\";\nimport { LocationPlugin, ServicesPlugin } from \"./interface\";\nimport { UIRouter } from \"../router\";\nimport { PushStateLocationService } from \"./pushStateLocationService\";\nimport { MemoryLocationService } from \"./memoryLocationService\";\nimport { MemoryLocationConfig } from \"./memoryLocationConfig\";\nimport { $injector } from \"./injector\";\nimport { $q } from \"./q\";\nimport { services } from \"../common/coreservices\";\n\nexport function servicesPlugin(router: UIRouter): ServicesPlugin {\n services.$injector = $injector;\n services.$q = $q;\n\n return { name: \"vanilla.services\", $q, $injector, dispose: () => null };\n}\n\n/** A `UIRouterPlugin` uses the browser hash to get/set the current location */\nexport const hashLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory('vanilla.hashBangLocation', false, HashLocationService, BrowserLocationConfig);\n\n/** A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis */\nexport const pushStateLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory(\"vanilla.pushStateLocation\", true, PushStateLocationService, BrowserLocationConfig);\n\n/** A `UIRouterPlugin` that gets/sets the current location from an in-memory object */\nexport const memoryLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory(\"vanilla.memoryLocation\", false, MemoryLocationService, MemoryLocationConfig);\n","/** @module ng1 */ /** */\nimport { ng as angular } from \"../angular\";\nimport {\n StateObject, pick, forEach, tail, extend,\n isArray, isInjectable, isDefined, isString, services, trace,\n ViewConfig, ViewService, ViewConfigFactory, PathNode, ResolveContext, Resolvable, IInjectable\n} from \"@uirouter/core\";\nimport { Ng1ViewDeclaration } from \"../interface\";\nimport { TemplateFactory } from \"../templateFactory\";\nimport IInjectorService = angular.auto.IInjectorService;\n\nexport function getNg1ViewConfigFactory(): ViewConfigFactory {\n let templateFactory: TemplateFactory = null;\n return (path, view) => {\n templateFactory = templateFactory || services.$injector.get(\"$templateFactory\");\n return [new Ng1ViewConfig(path, view, templateFactory)];\n };\n}\n\nconst hasAnyKey = (keys, obj) =>\n keys.reduce((acc, key) => acc || isDefined(obj[key]), false);\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `views`.\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * handles the `views` property with logic specific to @uirouter/angularjs (ng1).\n *\n * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object\n * and applies the state-level configuration to a view named `$default`.\n */\nexport function ng1ViewsBuilder(state: StateObject) {\n // Do not process root state\n if (!state.parent) return {};\n\n let tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'],\n ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'],\n compKeys = ['component', 'bindings', 'componentProvider'],\n nonCompKeys = tplKeys.concat(ctrlKeys),\n allViewKeys = compKeys.concat(nonCompKeys);\n\n // Do not allow a state to have both state-level props and also a `views: {}` property.\n // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state.\n // However, the `$default` approach should not be mixed with a separate `views: ` block.\n if (isDefined(state.views) && hasAnyKey(allViewKeys, state)) {\n throw new Error(`State '${state.name}' has a 'views' object. ` +\n `It cannot also have \"view properties\" at the state level. ` +\n `Move the following properties into a view (in the 'views' object): ` +\n ` ${allViewKeys.filter(key => isDefined(state[key])).join(\", \")}`);\n }\n\n let views: { [key: string]: Ng1ViewDeclaration } = {},\n viewsObject = state.views || { \"$default\": pick(state, allViewKeys) };\n\n forEach(viewsObject, function (config: Ng1ViewDeclaration, name: string) {\n // Account for views: { \"\": { template... } }\n name = name || \"$default\";\n // Account for views: { header: \"headerComponent\" }\n if (isString(config)) config = { component: config };\n\n // Make a shallow copy of the config object\n config = extend({}, config);\n\n // Do not allow a view to mix props for component-style view with props for template/controller-style view\n if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {\n throw new Error(`Cannot combine: ${compKeys.join(\"|\")} with: ${nonCompKeys.join(\"|\")} in stateview: '${name}@${state.name}'`);\n }\n\n config.resolveAs = config.resolveAs || '$resolve';\n config.$type = \"ng1\";\n config.$context = state;\n config.$name = name;\n\n let normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name);\n config.$uiViewName = normalized.uiViewName;\n config.$uiViewContextAnchor = normalized.uiViewContextAnchor;\n\n views[name] = config;\n });\n return views;\n}\n\nlet id = 0;\nexport class Ng1ViewConfig implements ViewConfig {\n $id = id++;\n loaded: boolean = false;\n controller: Function; // actually IInjectable|string\n template: string;\n component: string;\n locals: any; // TODO: delete me\n\n constructor(public path: PathNode[], public viewDecl: Ng1ViewDeclaration, public factory: TemplateFactory) { }\n\n load() {\n let $q = services.$q;\n let context = new ResolveContext(this.path);\n let params = this.path.reduce((acc, node) => extend(acc, node.paramValues), {});\n\n let promises: any = {\n template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)),\n controller: $q.when(this.getController(context))\n };\n\n return $q.all(promises).then((results) => {\n trace.traceViewServiceEvent(\"Loaded\", this);\n this.controller = results.controller;\n extend(this, results.template); // Either { template: \"tpl\" } or { component: \"cmpName\" }\n return this;\n });\n }\n\n getTemplate = (uiView, context: ResolveContext) =>\n this.component ? this.factory.makeComponentTemplate(uiView, context, this.component, this.viewDecl.bindings) : this.template;\n\n /**\n * Gets the controller for a view configuration.\n *\n * @returns {Function|Promise.} Returns a controller, or a promise that resolves to a controller.\n */\n getController(context: ResolveContext): (IInjectable|string|Promise) {\n let provider = this.viewDecl.controllerProvider;\n if (!isInjectable(provider)) return this.viewDecl.controller;\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n }\n}\n","/** @module view */\n/** for typedoc */\nimport { ng as angular } from \"./angular\";\nimport { IAugmentedJQuery } from \"angular\";\nimport {\n isArray, isDefined, isFunction, isObject, services, Obj, IInjectable, tail, kebobString, unnestR, ResolveContext,\n Resolvable, RawParams\n} from \"@uirouter/core\";\nimport { Ng1ViewDeclaration, TemplateFactoryProvider } from \"./interface\";\n\n/**\n * Service which manages loading of templates from a ViewConfig.\n */\nexport class TemplateFactory implements TemplateFactoryProvider {\n /** @hidden */ private _useHttp = angular.version.minor < 3;\n /** @hidden */ private $templateRequest;\n /** @hidden */ private $templateCache;\n /** @hidden */ private $http;\n\n /** @hidden */ $get = ['$http', '$templateCache', '$injector', ($http, $templateCache, $injector) => {\n this.$templateRequest = $injector.has && $injector.has('$templateRequest') && $injector.get('$templateRequest');\n this.$http = $http;\n this.$templateCache = $templateCache;\n return this;\n }];\n\n /** @hidden */\n useHttpService(value: boolean) {\n this._useHttp = value;\n };\n\n /**\n * Creates a template from a configuration object.\n *\n * @param config Configuration object for which to load a template.\n * The following properties are search in the specified order, and the first one\n * that is defined is used to create the template:\n *\n * @param params Parameters to pass to the template function.\n * @param context The resolve context associated with the template's view\n *\n * @return {string|object} The template html as a string, or a promise for\n * that string,or `null` if no template is configured.\n */\n fromConfig(config: Ng1ViewDeclaration, params: any, context: ResolveContext): Promise<{ template?: string, component?: string }> {\n const defaultTemplate = \"\";\n\n const asTemplate = (result) => services.$q.when(result).then(str => ({ template: str }));\n const asComponent = (result) => services.$q.when(result).then(str => ({ component: str }));\n\n return (\n isDefined(config.template) ? asTemplate(this.fromString(config.template, params)) :\n isDefined(config.templateUrl) ? asTemplate(this.fromUrl(config.templateUrl, params)) :\n isDefined(config.templateProvider) ? asTemplate(this.fromProvider(config.templateProvider, params, context)) :\n isDefined(config.component) ? asComponent(config.component) :\n isDefined(config.componentProvider) ? asComponent(this.fromComponentProvider(config.componentProvider, params, context)) :\n asTemplate(defaultTemplate)\n );\n };\n\n /**\n * Creates a template from a string or a function returning a string.\n *\n * @param template html template as a string or function that returns an html template as a string.\n * @param params Parameters to pass to the template function.\n *\n * @return {string|object} The template html as a string, or a promise for that\n * string.\n */\n fromString(template: (string | Function), params?: RawParams) {\n return isFunction(template) ? ( template)(params) : template;\n };\n\n /**\n * Loads a template from the a URL via `$http` and `$templateCache`.\n *\n * @param {string|Function} url url of the template to load, or a function\n * that returns a url.\n * @param {Object} params Parameters to pass to the url function.\n * @return {string|Promise.} The template html as a string, or a promise\n * for that string.\n */\n fromUrl(url: (string | Function), params: any) {\n if (isFunction(url)) url = ( url)(params);\n if (url == null) return null;\n\n if (this._useHttp) {\n return this.$http.get(url, { cache: this.$templateCache, headers: { Accept: 'text/html' } })\n .then(function (response) {\n return response.data;\n });\n }\n\n return this.$templateRequest(url);\n };\n\n /**\n * Creates a template by invoking an injectable provider function.\n *\n * @param provider Function to invoke via `locals`\n * @param {Function} injectFn a function used to invoke the template provider\n * @return {string|Promise.} The template html as a string, or a promise\n * for that string.\n */\n fromProvider(provider: IInjectable, params: any, context: ResolveContext) {\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n };\n\n /**\n * Creates a component's template by invoking an injectable provider function.\n *\n * @param provider Function to invoke via `locals`\n * @param {Function} injectFn a function used to invoke the template provider\n * @return {string} The template html as a string: \"\".\n */\n fromComponentProvider(provider: IInjectable, params: any, context: ResolveContext) {\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n };\n\n /**\n * Creates a template from a component's name\n *\n * This implements route-to-component.\n * It works by retrieving the component (directive) metadata from the injector.\n * It analyses the component's bindings, then constructs a template that instantiates the component.\n * The template wires input and output bindings to resolves or from the parent component.\n *\n * @param uiView {object} The parent ui-view (for binding outputs to callbacks)\n * @param context The ResolveContext (for binding outputs to callbacks returned from resolves)\n * @param component {string} Component's name in camel case.\n * @param bindings An object defining the component's bindings: {foo: '<'}\n * @return {string} The template as a string: \"\".\n */\n makeComponentTemplate(uiView: IAugmentedJQuery, context: ResolveContext, component: string, bindings?: any) {\n bindings = bindings || {};\n\n // Bind once prefix\n const prefix = angular.version.minor >= 3 ? \"::\" : \"\";\n // Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-`\n const kebob = (camelCase: string) => {\n const kebobed = kebobString(camelCase);\n return /^(x|data)-/.exec(kebobed) ? `x-${kebobed}` : kebobed;\n };\n\n\n const attributeTpl = (input: BindingTuple) => {\n let { name, type } = input;\n let attrName = kebob(name);\n // If the ui-view has an attribute which matches a binding on the routed component\n // then pass that attribute through to the routed component template.\n // Prefer ui-view wired mappings to resolve data, unless the resolve was explicitly bound using `bindings:`\n if (uiView.attr(attrName) && !bindings[name])\n return `${attrName}='${uiView.attr(attrName)}'`;\n\n let resolveName = bindings[name] || name;\n // Pre-evaluate the expression for \"@\" bindings by enclosing in {{ }}\n // some-attr=\"{{ ::$resolve.someResolveName }}\"\n if (type === '@')\n return `${attrName}='{{${prefix}$resolve.${resolveName}}}'`;\n\n // Wire \"&\" callbacks to resolves that return a callback function\n // Get the result of the resolve (should be a function) and annotate it to get its arguments.\n // some-attr=\"$resolve.someResolveResultName(foo, bar)\"\n if (type === '&') {\n let res = context.getResolvable(resolveName);\n let fn = res && res.data;\n let args = fn && services.$injector.annotate(fn) || [];\n // account for array style injection, i.e., ['foo', function(foo) {}]\n let arrayIdxStr = isArray(fn) ? `[${fn.length - 1}]` : '';\n return `${attrName}='$resolve.${resolveName}${arrayIdxStr}(${args.join(\",\")})'`;\n }\n\n // some-attr=\"::$resolve.someResolveName\"\n return `${attrName}='${prefix}$resolve.${resolveName}'`;\n };\n\n let attrs = getComponentBindings(component).map(attributeTpl).join(\" \");\n let kebobName = kebob(component);\n return `<${kebobName} ${attrs}>`;\n };\n}\n\n// Gets all the directive(s)' inputs ('@', '=', and '<') and outputs ('&')\nfunction getComponentBindings(name: string) {\n let cmpDefs = services.$injector.get(name + \"Directive\"); // could be multiple\n if (!cmpDefs || !cmpDefs.length) throw new Error(`Unable to find component named '${name}'`);\n return cmpDefs.map(getBindings).reduce(unnestR, []);\n}\n\n// Given a directive definition, find its object input attributes\n// Use different properties, depending on the type of directive (component, bindToController, normal)\nconst getBindings = (def: any) => {\n if (isObject(def.bindToController)) return scopeBindings(def.bindToController);\n return scopeBindings(def.scope);\n};\n\ninterface BindingTuple {\n name: string;\n type: string;\n}\n\n// for ng 1.2 style, process the scope: { input: \"=foo\" }\n// for ng 1.3 through ng 1.5, process the component's bindToController: { input: \"=foo\" } object\nconst scopeBindings = (bindingsObj: Obj) => Object.keys(bindingsObj || {})\n // [ 'input', [ '=foo', '=', 'foo' ] ]\n .map(key => [key, /^([=<@&])[?]?(.*)/.exec(bindingsObj[key])])\n // skip malformed values\n .filter(tuple => isDefined(tuple) && isArray(tuple[1]))\n // { name: ('foo' || 'input'), type: '=' }\n .map(tuple => ({ name: tuple[1][2] || tuple[0], type: tuple[1][1] } as BindingTuple));\n\n","/**\n * # Angular 1 types\n *\n * UI-Router core provides various Typescript types which you can use for code completion and validating parameter values, etc.\n * The customizations to the core types for Angular UI-Router are documented here.\n *\n * The optional [[$resolve]] service is also documented here.\n *\n * @module ng1\n * @preferred\n */\n/** for typedoc */\nimport { ng as angular } from \"./angular\";\nimport {\n IRootScopeService, IQService, ILocationService, ILocationProvider, IHttpService, ITemplateCacheService\n} from \"angular\";\nimport {\n services, applyPairs, isString, trace, extend, UIRouter, StateService, UrlRouter, UrlMatcherFactory, ResolveContext,\n unnestR, TypedMap\n} from \"@uirouter/core\";\nimport { ng1ViewsBuilder, getNg1ViewConfigFactory } from \"./statebuilders/views\";\nimport { TemplateFactory } from \"./templateFactory\";\nimport { StateProvider } from \"./stateProvider\";\nimport { getStateHookBuilder } from \"./statebuilders/onEnterExitRetain\";\nimport { Ng1LocationServices } from \"./locationServices\";\nimport { UrlRouterProvider } from \"./urlRouterProvider\";\nimport IInjectorService = angular.auto.IInjectorService; // tslint:disable-line\n\nangular.module(\"ui.router.angular1\", []);\nlet mod_init = angular.module('ui.router.init', []);\nlet mod_util = angular.module('ui.router.util', ['ng', 'ui.router.init']);\nlet mod_rtr = angular.module('ui.router.router', ['ui.router.util']);\nlet mod_state = angular.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']);\nlet mod_main = angular.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']);\nlet mod_cmpt = angular.module('ui.router.compat', ['ui.router']); // tslint:disable-line\n\ndeclare module '@uirouter/core/lib/router' {\n interface UIRouter {\n /** @hidden */\n stateProvider: StateProvider;\n /** @hidden */\n urlRouterProvider: UrlRouterProvider;\n }\n}\n\nlet router: UIRouter = null;\n\n$uiRouter.$inject = ['$locationProvider'];\n/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */\nfunction $uiRouter($locationProvider: ILocationProvider) {\n\n // Create a new instance of the Router when the $uiRouterProvider is initialized\n router = this.router = new UIRouter();\n router.stateProvider = new StateProvider(router.stateRegistry, router.stateService);\n\n // Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties\n router.stateRegistry.decorator(\"views\", ng1ViewsBuilder);\n router.stateRegistry.decorator(\"onExit\", getStateHookBuilder(\"onExit\"));\n router.stateRegistry.decorator(\"onRetain\", getStateHookBuilder(\"onRetain\"));\n router.stateRegistry.decorator(\"onEnter\", getStateHookBuilder(\"onEnter\"));\n\n router.viewService._pluginapi._viewConfigFactory('ng1', getNg1ViewConfigFactory());\n\n let ng1LocationService = router.locationService = router.locationConfig = new Ng1LocationServices($locationProvider);\n\n Ng1LocationServices.monkeyPatchPathParameterType(router);\n\n // backwards compat: also expose router instance as $uiRouterProvider.router\n router['router'] = router;\n router['$get'] = $get;\n $get.$inject = ['$location', '$browser', '$sniffer', '$rootScope', '$http', '$templateCache'];\n function $get($location: ILocationService, $browser: any, $sniffer: any, $rootScope: ng.IScope, $http: IHttpService, $templateCache: ITemplateCacheService) {\n ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser);\n delete router['router'];\n delete router['$get'];\n return router;\n }\n return router;\n}\n\nconst getProviderFor = (serviceName) => [ '$uiRouterProvider', ($urp) => {\n let service = $urp.router[serviceName];\n service[\"$get\"] = () => service;\n return service;\n}];\n\n// This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime)\nrunBlock.$inject = ['$injector', '$q', '$uiRouter'];\nfunction runBlock($injector: IInjectorService, $q: IQService, $uiRouter: UIRouter) {\n services.$injector = $injector;\n services.$q = $q;\n\n // The $injector is now available.\n // Find any resolvables that had dependency annotation deferred\n $uiRouter.stateRegistry.get()\n .map(x => x.$$state().resolvables)\n .reduce(unnestR, [])\n .filter(x => x.deps === \"deferred\")\n .forEach(resolvable => resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi));\n}\n\n// $urlRouter service and $urlRouterProvider\nconst getUrlRouterProvider = (uiRouter: UIRouter) =>\n uiRouter.urlRouterProvider = new UrlRouterProvider(uiRouter);\n\n// $state service and $stateProvider\n// $urlRouter service and $urlRouterProvider\nconst getStateProvider = () =>\n extend(router.stateProvider, { $get: () => router.stateService });\n\nwatchDigests.$inject = ['$rootScope'];\nexport function watchDigests($rootScope: IRootScopeService) {\n $rootScope.$watch(function() { trace.approximateDigests++; });\n}\n\nmod_init .provider(\"$uiRouter\", $uiRouter);\nmod_rtr .provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]);\nmod_util .provider('$urlService', getProviderFor('urlService'));\nmod_util .provider('$urlMatcherFactory', ['$uiRouterProvider', () => router.urlMatcherFactory]);\nmod_util .provider('$templateFactory', () => new TemplateFactory());\nmod_state.provider('$stateRegistry', getProviderFor('stateRegistry'));\nmod_state.provider('$uiRouterGlobals', getProviderFor('globals'));\nmod_state.provider('$transitions', getProviderFor('transitionService'));\nmod_state.provider('$state', ['$uiRouterProvider', getStateProvider]);\n\nmod_state.factory ('$stateParams', ['$uiRouter', ($uiRouter: UIRouter) => $uiRouter.globals.params]);\nmod_main .factory ('$view', () => router.viewService);\nmod_main .service (\"$trace\", () => trace);\n\nmod_main .run (watchDigests);\nmod_util .run (['$urlMatcherFactory', function ($urlMatcherFactory: UrlMatcherFactory) { }]);\nmod_state.run (['$state', function ($state: StateService) { }]);\nmod_rtr .run (['$urlRouter', function ($urlRouter: UrlRouter) { }]);\nmod_init .run (runBlock);\n\n/** @hidden TODO: find a place to move this */\nexport const getLocals = (ctx: ResolveContext): TypedMap => {\n let tokens = ctx.getTokens().filter(isString);\n\n let tuples = tokens .map(key => {\n let resolvable = ctx.getResolvable(key);\n let waitPolicy = ctx.getPolicy(resolvable).async;\n return [ key, waitPolicy === 'NOWAIT' ? resolvable.promise : resolvable.data ];\n });\n\n return tuples.reduce(applyPairs, {});\n};\n\n","/**\n * # Angular 1 Directives\n *\n * These are the directives included in UI-Router for Angular 1.\n * These directives are used in templates to create viewports and link/navigate to states.\n *\n * @ng1api\n * @preferred\n * @module directives\n */ /** for typedoc */\nimport { ng as angular } from \"../angular\";\nimport { IAugmentedJQuery, ITimeoutService, IScope, IInterpolateService } from \"angular\";\n\nimport {\n Obj, extend, forEach, tail, isString, isObject, isArray, parse, noop, unnestR, identity, uniqR, inArray, removeFrom,\n RawParams, PathNode, StateOrName, StateService, StateDeclaration, UIRouter\n} from \"@uirouter/core\";\nimport { UIViewData } from \"./viewDirective\";\n\n/** @hidden Used for typedoc */\nexport interface ng1_directive {}\n\n/** @hidden */\nfunction parseStateRef(ref: string) {\n let paramsOnly = ref.match(/^\\s*({[^}]*})\\s*$/), parsed;\n if (paramsOnly) ref = '(' + paramsOnly[1] + ')';\n\n parsed = ref.replace(/\\n/g, \" \").match(/^\\s*([^(]*?)\\s*(\\((.*)\\))?\\s*$/);\n if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n return { state: parsed[1] || null, paramExpr: parsed[3] || null };\n}\n\n/** @hidden */\nfunction stateContext(el: IAugmentedJQuery) {\n let $uiView: UIViewData = (el.parent() as IAugmentedJQuery).inheritedData('$uiView');\n let path: PathNode[] = parse('$cfg.path')($uiView);\n return path ? tail(path).state.name : undefined;\n}\n\n/** @hidden */\nfunction processedDef($state: StateService, $element: IAugmentedJQuery, def: Def): Def {\n let uiState = def.uiState || $state.current.name;\n let uiStateOpts = extend(defaultOpts($element, $state), def.uiStateOpts || {});\n let href = $state.href(uiState, def.uiStateParams, uiStateOpts);\n return { uiState, uiStateParams: def.uiStateParams, uiStateOpts, href };\n}\n\n/** @hidden */\ninterface TypeInfo {\n attr: string;\n isAnchor: boolean;\n clickable: boolean;\n}\n\n/** @hidden */\nfunction getTypeInfo(el: IAugmentedJQuery): TypeInfo {\n // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.\n var isSvg = Object.prototype.toString.call(el.prop('href')) === '[object SVGAnimatedString]';\n var isForm = el[0].nodeName === \"FORM\";\n\n return {\n attr: isForm ? \"action\" : (isSvg ? 'xlink:href' : 'href'),\n isAnchor: el.prop(\"tagName\").toUpperCase() === \"A\",\n clickable: !isForm\n };\n}\n\n/** @hidden */\nfunction clickHook(el: IAugmentedJQuery, $state: StateService, $timeout: ITimeoutService, type: TypeInfo, getDef: () => Def) {\n return function (e: JQueryMouseEventObject) {\n var button = e.which || e.button, target = getDef();\n\n if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || el.attr('target'))) {\n // HACK: This is to allow ng-clicks to be processed before the transition is initiated:\n var transition = $timeout(function () {\n $state.go(target.uiState, target.uiStateParams, target.uiStateOpts);\n });\n e.preventDefault();\n\n // if the state has no URL, ignore one preventDefault from the
    directive.\n var ignorePreventDefaultCount = type.isAnchor && !target.href ? 1 : 0;\n\n e.preventDefault = function () {\n if (ignorePreventDefaultCount-- <= 0) $timeout.cancel(transition);\n };\n }\n };\n}\n\n/** @hidden */\nfunction defaultOpts(el: IAugmentedJQuery, $state: StateService) {\n return {\n relative: stateContext(el) || $state.$current,\n inherit: true,\n source: \"sref\"\n };\n}\n\n/** @hidden */\nfunction bindEvents(element: IAugmentedJQuery, scope: IScope, hookFn: (e: JQueryMouseEventObject) => void, uiStateOpts: any): void {\n let events;\n\n if (uiStateOpts) {\n events = uiStateOpts.events;\n }\n\n if (!isArray(events)) {\n events = ['click'];\n }\n\n let on = element.on ? 'on' : 'bind';\n for (let event of events) {\n element[on](event, hookFn);\n }\n\n scope.$on('$destroy', function() {\n let off = element.off ? 'off' : 'unbind';\n for (let event of events) {\n element[off](event, hookFn);\n }\n });\n}\n\n/**\n * `ui-sref`: A directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of the `ui-sref` is the name of the state to link to.\n *\n * #### Example:\n * This will activate the `home` state when the link is clicked.\n * ```html\n * Home\n * ```\n *\n * ### Relative Links\n * You can also use relative state paths within `ui-sref`, just like a relative path passed to `$state.go()` ([[StateService.go]]).\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create a relative `ui-sref` which always targets the same destination.\n *\n * #### Example:\n * Both these links are relative to the parent state, even when a child state is currently active.\n * ```html\n * child 1 state\n * child 2 state\n * ```\n *\n * This link activates the parent state.\n * ```html\n * Return\n * ```\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]] method).\n *\n * #### Example:\n * Assuming the `users` state has a url of `/users/`\n * ```html\n * Users\n * ```\n *\n * ### Parameter Values\n * In addition to the state name, a `ui-sref` can include parameter values which are applied when activating the state.\n * Param values can be provided in the `ui-sref` value after the state name, enclosed by parentheses.\n * The content inside the parentheses is an expression, evaluated to the parameter values.\n *\n * #### Example:\n * This example renders a list of links to users.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n *
  • \n * {{ user.displayName }}\n *
  • \n * ```\n *\n * Note:\n * The parameter values expression is `$watch`ed for updates.\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-sref-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n *\n * #### Example:\n * ```html\n * Home\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-sref-opts` attribute.\n *\n * #### Example:\n * ```html\n * \n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Examples\n * If you have the following template:\n *\n * ```html\n * Home\n * About\n * Next page\n *\n * \n * ```\n *\n * Then (assuming the current state is `contacts`) the rendered html including hrefs would be:\n *\n * ```html\n * Home\n * About\n * Next page\n *\n *
      \n *
    • \n * Joe\n *
    • \n *
    • \n * Alice\n *
    • \n *
    • \n * Bob\n *
    • \n *
    \n *\n * Home\n * ```\n *\n * ### Notes\n *\n * - You can use `ui-sref` to change **only the parameter values** by omitting the state name and parentheses.\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * English\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n *\n * - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons).\n * If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive.\n */\nlet uiSref: ng1_directive;\nuiSref = ['$uiRouter', '$timeout',\n function $StateRefDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n let $state = $uiRouter.stateService;\n\n return {\n restrict: 'A',\n require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n link: function (scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n let type = getTypeInfo(element);\n let active = uiSrefActive[1] || uiSrefActive[0];\n let unlinkInfoFn: Function = null;\n let hookFn;\n\n let rawDef = {} as Def;\n let getDef = () => processedDef($state, element, rawDef);\n\n let ref = parseStateRef(attrs.uiSref);\n rawDef.uiState = ref.state;\n rawDef.uiStateOpts = attrs.uiSrefOpts ? scope.$eval(attrs.uiSrefOpts) : {};\n\n function update() {\n let def = getDef();\n if (unlinkInfoFn) unlinkInfoFn();\n if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n if (def.href != null) attrs.$set(type.attr, def.href);\n }\n\n if (ref.paramExpr) {\n scope.$watch(ref.paramExpr, function (val) {\n rawDef.uiStateParams = extend({}, val);\n update();\n }, true);\n rawDef.uiStateParams = extend({}, scope.$eval(ref.paramExpr));\n }\n\n update();\n\n scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update));\n scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update));\n\n if (!type.clickable) return;\n hookFn = clickHook(element, $state, $timeout, type, getDef);\n bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n }\n };\n }];\n\n/**\n * `ui-state`: A fully dynamic directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * **This directive is very similar to [[uiSref]], but it `$observe`s and `$watch`es/evaluates all its inputs.**\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of `ui-state` is an expression which is `$watch`ed and evaluated as the state to link to.\n * **This is in contrast with `ui-sref`, which takes a state name as a string literal.**\n *\n * #### Example:\n * Create a list of links.\n * ```html\n *
  • \n * {{ link.displayName }}\n *
  • \n * ```\n *\n * ### Relative Links\n * If the expression evaluates to a relative path, it is processed like [[uiSref]].\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create relative `ui-state` which always targets the same destination.\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]] method).\n *\n * ### Parameter Values\n * In addition to the state name expression, a `ui-state` can include parameter values which are applied when activating the state.\n * Param values should be provided using the `ui-state-params` attribute.\n * The `ui-state-params` attribute value is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * This example renders a list of links with param values.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n *
  • \n * {{ link.displayName }}\n *
  • \n * ```\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-state-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n * The value of the `ui-state-opts` is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * ```html\n * Home\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-state-opts` attribute.\n *\n * #### Example:\n * ```html\n * \n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Notes\n *\n * - You can use `ui-params` to change **only the parameter values** by omitting the state name and supplying only `ui-state-params`.\n * However, it might be simpler to use [[uiSref]] parameter-only links.\n *\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * English\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n * ```\n */\nlet uiState: ng1_directive;\nuiState = ['$uiRouter', '$timeout',\n function $StateRefDynamicDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n let $state = $uiRouter.stateService;\n\n return {\n restrict: 'A',\n require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n link: function (scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n let type = getTypeInfo(element);\n let active = uiSrefActive[1] || uiSrefActive[0];\n let unlinkInfoFn: Function = null;\n let hookFn;\n\n let rawDef = {} as Def;\n let getDef = () => processedDef($state, element, rawDef);\n\n let inputAttrs = ['uiState', 'uiStateParams', 'uiStateOpts'];\n let watchDeregFns = inputAttrs.reduce((acc, attr) => (acc[attr] = noop, acc), {});\n\n function update() {\n let def = getDef();\n if (unlinkInfoFn) unlinkInfoFn();\n if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n if (def.href != null) attrs.$set(type.attr, def.href);\n }\n\n inputAttrs.forEach((field) => {\n rawDef[field] = attrs[field] ? scope.$eval(attrs[field]) : null;\n\n attrs.$observe(field, (expr) => {\n watchDeregFns[field]();\n watchDeregFns[field] = scope.$watch(expr, (newval) => {\n rawDef[field] = newval;\n update();\n }, true);\n })\n });\n\n update();\n\n scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update));\n scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update));\n\n if (!type.clickable) return;\n hookFn = clickHook(element, $state, $timeout, type, getDef);\n bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n }\n };\n }];\n\n\n/**\n * `ui-sref-active` and `ui-sref-active-eq`: A directive that adds a CSS class when a `ui-sref` is active\n *\n * A directive working alongside [[uiSref]] and [[uiState]] to add classes to an element when the\n * related directive's state is active (and remove them when it is inactive).\n *\n * The primary use-case is to highlight the active link in navigation menus,\n * distinguishing it from the inactive menu items.\n *\n * ### Linking to a `ui-sref` or `ui-state`\n * `ui-sref-active` can live on the same element as `ui-sref`/`ui-state`, or it can be on a parent element.\n * If a `ui-sref-active` is a parent to more than one `ui-sref`/`ui-state`, it will apply the CSS class when **any of the links are active**.\n *\n * ### Matching\n *\n * The `ui-sref-active` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state **or any child state is active**.\n * This is a \"fuzzy match\" which uses [[StateService.includes]].\n *\n * The `ui-sref-active-eq` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state is directly active (not when child states are active).\n * This is an \"exact match\" which uses [[StateService.is]].\n *\n * ### Parameter values\n * If the `ui-sref`/`ui-state` includes parameter values, the current parameter values must match the link's values for the link to be highlighted.\n * This allows a list of links to the same state with different parameters to be rendered, and the correct one highlighted.\n *\n * #### Example:\n * ```html\n *
  • \n * {{ user.lastName }}\n *
  • \n * ```\n *\n * ### Examples\n *\n * Given the following template:\n * #### Example:\n * ```html\n * \n * ```\n *\n * When the app state is `app.user` (or any child state),\n * and contains the state parameter \"user\" with value \"bilbobaggins\",\n * the resulting HTML will appear as (note the 'active' class):\n *\n * ```html\n * \n * ```\n *\n * ### Glob mode\n *\n * It is possible to pass `ui-sref-active` an expression that evaluates to an object.\n * The objects keys represent active class names and values represent the respective state names/globs.\n * `ui-sref-active` will match if the current active state **includes** any of\n * the specified state names/globs, even the abstract ones.\n *\n * #### Example:\n * Given the following template, with \"admin\" being an abstract state:\n * ```html\n *
    \n * Roles\n *
    \n * ```\n *\n * When the current state is \"admin.roles\" the \"active\" class will be applied to both the
    and elements.\n * It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`.\n *\n * ### Notes:\n *\n * - The class name is interpolated **once** during the directives link time (any further changes to the\n * interpolated value are ignored).\n *\n * - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'`\n */\nlet uiSrefActive: ng1_directive;\nuiSrefActive = ['$state', '$stateParams', '$interpolate', '$uiRouter',\n function $StateRefActiveDirective($state: StateService, $stateParams: Obj, $interpolate: IInterpolateService, $uiRouter: UIRouter) {\n return {\n restrict: \"A\",\n controller: ['$scope', '$element', '$attrs',\n function ($scope: IScope, $element: IAugmentedJQuery, $attrs: any) {\n let states: StateData[] = [],\n activeEqClass: string,\n uiSrefActive: any;\n\n // There probably isn't much point in $observing this\n // uiSrefActive and uiSrefActiveEq share the same directive object with some\n // slight difference in logic routing\n activeEqClass = $interpolate($attrs.uiSrefActiveEq || '', false)($scope);\n\n try {\n uiSrefActive = $scope.$eval($attrs.uiSrefActive);\n } catch (e) {\n // Do nothing. uiSrefActive is not a valid expression.\n // Fall back to using $interpolate below\n }\n uiSrefActive = uiSrefActive || $interpolate($attrs.uiSrefActive || '', false)($scope);\n if (isObject(uiSrefActive)) {\n forEach(uiSrefActive, function (stateOrName: StateOrName, activeClass: string) {\n if (isString(stateOrName)) {\n let ref = parseStateRef(stateOrName);\n addState(ref.state, $scope.$eval(ref.paramExpr), activeClass);\n }\n });\n }\n\n // Allow uiSref to communicate with uiSrefActive[Equals]\n this.$$addStateInfo = function (newState: string, newParams: Obj) {\n // we already got an explicit state provided by ui-sref-active, so we\n // shadow the one that comes from ui-sref\n if (isObject(uiSrefActive) && states.length > 0) {\n return;\n }\n let deregister = addState(newState, newParams, uiSrefActive);\n update();\n return deregister;\n };\n\n function updateAfterTransition(trans) {\n trans.promise.then(update, noop);\n }\n\n $scope.$on('$stateChangeSuccess', update);\n $scope.$on('$destroy', $uiRouter.transitionService.onStart({}, updateAfterTransition));\n if ($uiRouter.globals.transition) {\n updateAfterTransition($uiRouter.globals.transition);\n }\n\n function addState(stateName: string, stateParams: Obj, activeClass: string) {\n var state = $state.get(stateName, stateContext($element));\n\n var stateInfo = {\n state: state || { name: stateName },\n params: stateParams,\n activeClass: activeClass\n };\n\n states.push(stateInfo);\n\n return function removeState() {\n removeFrom(states)(stateInfo);\n }\n }\n\n // Update route state\n function update() {\n const splitClasses = str =>\n str.split(/\\s/).filter(identity);\n const getClasses = (stateList: StateData[]) =>\n stateList.map(x => x.activeClass).map(splitClasses).reduce(unnestR, []);\n\n let allClasses = getClasses(states).concat(splitClasses(activeEqClass)).reduce(uniqR, []);\n let fuzzyClasses = getClasses(states.filter(x => $state.includes(x.state.name, x.params)));\n let exactlyMatchesAny = !!states.filter(x => $state.is(x.state.name, x.params)).length;\n let exactClasses = exactlyMatchesAny ? splitClasses(activeEqClass) : [];\n\n let addClasses = fuzzyClasses.concat(exactClasses).reduce(uniqR, []);\n let removeClasses = allClasses.filter(cls => !inArray(addClasses, cls));\n\n $scope.$evalAsync(() => {\n addClasses.forEach(className => $element.addClass(className));\n removeClasses.forEach(className => $element.removeClass(className));\n });\n }\n\n update();\n }]\n };\n }];\n\n/** @hidden */\ninterface Def { uiState: string; href: string; uiStateParams: Obj; uiStateOpts: any; }\n/** @hidden */\ninterface StateData { state: StateDeclaration; params: RawParams; activeClass: string; }\n\nangular.module('ui.router.state')\n .directive('uiSref', uiSref)\n .directive('uiSrefActive', uiSrefActive)\n .directive('uiSrefActiveEq', uiSrefActive)\n .directive('uiState', uiState);\n","/** @module ng1 */ /** for typedoc */\n\nimport { ng as angular } from \"./angular\";\nimport { Obj, StateService, StateOrName } from \"@uirouter/core\";\n\n/**\n * `isState` Filter: truthy if the current state is the parameter\n *\n * Translates to [[StateService.is]] `$state.is(\"stateName\")`.\n *\n * #### Example:\n * ```html\n *
    show if state is 'stateName'
    \n * ```\n */\n$IsStateFilter.$inject = ['$state'];\nexport function $IsStateFilter($state: StateService) {\n var isFilter: any = function(state: StateOrName, params: Obj, options?: { relative?: StateOrName }) {\n return $state.is(state, params, options);\n };\n isFilter.$stateful = true;\n return isFilter;\n}\n\n/**\n * `includedByState` Filter: truthy if the current state includes the parameter\n *\n * Translates to [[StateService.includes]]` $state.is(\"fullOrPartialStateName\")`.\n *\n * #### Example:\n * ```html\n *
    show if state includes 'fullOrPartialStateName'
    \n * ```\n */\n$IncludedByStateFilter.$inject = ['$state'];\nexport function $IncludedByStateFilter($state: StateService) {\n var includesFilter: any = function(state: StateOrName, params: Obj, options: { relative?: StateOrName }) {\n return $state.includes(state, params, options);\n };\n includesFilter.$stateful = true;\n return includesFilter;\n}\n\nangular.module('ui.router.state')\n .filter('isState', $IsStateFilter)\n .filter('includedByState', $IncludedByStateFilter);\n","/** \n * @ng1api \n * @module directives \n */ /** for typedoc */\nimport { ng as angular } from \"../angular\";\nimport {\n IInterpolateService, IScope, ITranscludeFunction, IAugmentedJQuery,\n ICompileService, IControllerService, ITimeoutService, noop\n} from \"angular\";\n\nimport {\n extend, unnestR, filter, tail, isDefined, isFunction, isString, trace, parse,\n ActiveUIView, TransitionService, ResolveContext, Transition, PathNode, StateDeclaration,\n Param, kebobString, HookRegOptions, ViewService, $QLike, Obj, TypedMap\n} from \"@uirouter/core\";\nimport {Ng1ViewConfig} from \"../statebuilders/views\";\nimport {Ng1Controller, Ng1StateDeclaration} from \"../interface\";\nimport {getLocals} from \"../services\";\nimport { ng1_directive } from \"./stateDirectives\";\n\n/** @hidden */\nexport type UIViewData = {\n $cfg: Ng1ViewConfig;\n $uiView: ActiveUIView;\n}\n\n/** @hidden */\nexport type UIViewAnimData = {\n $animEnter: Promise;\n $animLeave: Promise;\n $$animLeave: { resolve: () => any; } // \"deferred\"\n}\n\n/**\n * `ui-view`: A viewport directive which is filled in by a view from the active state.\n *\n * ### Attributes\n *\n * - `name`: (Optional) A view name.\n * The name should be unique amongst the other views in the same state.\n * You can have views of the same name that live in different states.\n * The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]).\n *\n * - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated.\n * Uses [[$uiViewScroll]] to do the scrolling.\n *\n * - `onload`: Expression to evaluate whenever the view updates.\n *\n * #### Example:\n * A view can be unnamed or named.\n * ```html\n * \n *
    \n *\n * \n *
    \n *\n * \n * \n * ```\n *\n * You can only have one unnamed view within any template (or root html). If you are only using a\n * single view and it is unnamed then you can populate it like so:\n *\n * ```html\n *
    \n * $stateProvider.state(\"home\", {\n * template: \"

    HELLO!

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

    HELLO!

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

    HELLO!

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

    HELLO!

    \"\n * },\n * \"chart\": {\n * template: \"\"\n * },\n * \"data\": {\n * template: \"\"\n * }\n * }\n * })\n * ```\n *\n * #### Examples for `autoscroll`:\n * ```html\n * \n * \n *\n * \n * \n * \n * \n * ```\n *\n * Resolve data:\n *\n * The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this\n * can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template.\n *\n * Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the\n * controller is instantiated. The `$onInit()` hook can be used to perform initialization code which\n * depends on `$resolve` data.\n *\n * #### Example:\n * ```js\n * $stateProvider.state('home', {\n * template: '',\n * resolve: {\n * user: function(UserService) { return UserService.fetchUser(); }\n * }\n * });\n * ```\n */\nexport let uiView: ng1_directive;\nuiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q',\nfunction $ViewDirective($view: ViewService, $animate: any, $uiViewScroll: any, $interpolate: IInterpolateService, $q: $QLike) {\n\n function getRenderer(attrs: Obj, scope: IScope) {\n return {\n enter: function(element: JQuery, target: any, cb: Function) {\n if (angular.version.minor > 2) {\n $animate.enter(element, null, target).then(cb);\n } else {\n $animate.enter(element, null, target, cb);\n }\n },\n leave: function(element: JQuery, cb: Function) {\n if (angular.version.minor > 2) {\n $animate.leave(element).then(cb);\n } else {\n $animate.leave(element, cb);\n }\n }\n };\n }\n\n function configsEqual(config1: Ng1ViewConfig, config2: Ng1ViewConfig) {\n return config1 === config2;\n }\n\n let rootData = {\n $cfg: { viewDecl: { $context: $view._pluginapi._rootViewContext() } },\n $uiView: { }\n };\n\n let directive = {\n count: 0,\n restrict: 'ECA',\n terminal: true,\n priority: 400,\n transclude: 'element',\n compile: function (tElement: JQuery, tAttrs: Obj, $transclude: ITranscludeFunction) {\n\n return function (scope: IScope, $element: IAugmentedJQuery, attrs: Obj) {\n let previousEl: JQuery, currentEl: JQuery,\n currentScope: IScope, unregister: Function,\n onloadExp = attrs['onload'] || '',\n autoScrollExp = attrs['autoscroll'],\n renderer = getRenderer(attrs, scope),\n viewConfig = undefined as Ng1ViewConfig,\n inherited = $element.inheritedData('$uiView') || rootData,\n name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default';\n\n let activeUIView: ActiveUIView = {\n $type: 'ng1',\n id: directive.count++, // Global sequential ID for ui-view tags added to DOM\n name: name, // ui-view name (
    \n fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + \".\" + name : name, // fully qualified name, describes location in DOM\n config: null, // The ViewConfig loaded (from a state.views definition)\n configUpdated: configUpdatedCallback, // Called when the matching ViewConfig changes\n get creationContext() { // The context in which this ui-view \"tag\" was created\n let fromParentTagConfig = parse('$cfg.viewDecl.$context')(inherited);\n // Allow \n // See https://github.com/angular-ui/ui-router/issues/3355\n let fromParentTag = parse('$uiView.creationContext')(inherited);\n return fromParentTagConfig || fromParentTag;\n }\n };\n\n trace.traceUIViewEvent(\"Linking\", activeUIView);\n\n function configUpdatedCallback(config?: Ng1ViewConfig) {\n if (config && !(config instanceof Ng1ViewConfig)) return;\n if (configsEqual(viewConfig, config)) return;\n trace.traceUIViewConfigUpdated(activeUIView, config && config.viewDecl && config.viewDecl.$context);\n\n viewConfig = config;\n updateView(config);\n }\n\n $element.data('$uiView', { $uiView: activeUIView });\n\n updateView();\n\n unregister = $view.registerUIView(activeUIView);\n scope.$on(\"$destroy\", function() {\n trace.traceUIViewEvent(\"Destroying/Unregistering\", activeUIView);\n unregister();\n });\n\n function cleanupLastView() {\n if (previousEl) {\n trace.traceUIViewEvent(\"Removing (previous) el\", previousEl.data('$uiView'));\n previousEl.remove();\n previousEl = null;\n }\n\n if (currentScope) {\n trace.traceUIViewEvent(\"Destroying scope\", activeUIView);\n currentScope.$destroy();\n currentScope = null;\n }\n\n if (currentEl) {\n let _viewData = currentEl.data('$uiViewAnim');\n trace.traceUIViewEvent(\"Animate out\", _viewData);\n renderer.leave(currentEl, function() {\n _viewData.$$animLeave.resolve();\n previousEl = null;\n });\n\n previousEl = currentEl;\n currentEl = null;\n }\n }\n\n function updateView(config?: Ng1ViewConfig) {\n let newScope = scope.$new();\n let animEnter = $q.defer(), animLeave = $q.defer();\n\n let $uiViewData: UIViewData = {\n $cfg: config,\n $uiView: activeUIView,\n };\n\n let $uiViewAnim: UIViewAnimData = {\n $animEnter: animEnter.promise,\n $animLeave: animLeave.promise,\n $$animLeave: animLeave\n };\n\n /**\n * @ngdoc event\n * @name ui.router.state.directive:ui-view#$viewContentLoading\n * @eventOf ui.router.state.directive:ui-view\n * @eventType emits on ui-view directive scope\n * @description\n *\n * Fired once the view **begins loading**, *before* the DOM is rendered.\n *\n * @param {Object} event Event object.\n * @param {string} viewName Name of the view.\n */\n newScope.$emit('$viewContentLoading', name);\n\n let cloned = $transclude(newScope, function(clone) {\n clone.data('$uiViewAnim', $uiViewAnim);\n clone.data('$uiView', $uiViewData);\n renderer.enter(clone, $element, function onUIViewEnter() {\n animEnter.resolve();\n if (currentScope) currentScope.$emit('$viewContentAnimationEnded');\n\n if (isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {\n $uiViewScroll(clone);\n }\n });\n\n cleanupLastView();\n });\n\n currentEl = cloned;\n currentScope = newScope;\n /**\n * @ngdoc event\n * @name ui.router.state.directive:ui-view#$viewContentLoaded\n * @eventOf ui.router.state.directive:ui-view\n * @eventType emits on ui-view directive scope\n * @description *\n * Fired once the view is **loaded**, *after* the DOM is rendered.\n *\n * @param {Object} event Event object.\n */\n currentScope.$emit('$viewContentLoaded', config || viewConfig);\n currentScope.$eval(onloadExp);\n }\n };\n }\n };\n\n return directive;\n}];\n\n$ViewDirectiveFill.$inject = ['$compile', '$controller', '$transitions', '$view', '$q', '$timeout'];\n/** @hidden */\nfunction $ViewDirectiveFill($compile: angular.ICompileService,\n $controller: angular.IControllerService,\n $transitions: TransitionService,\n $view: ViewService,\n $q: angular.IQService,\n $timeout: ITimeoutService) {\n const getControllerAs = parse('viewDecl.controllerAs');\n const getResolveAs = parse('viewDecl.resolveAs');\n\n return {\n restrict: 'ECA',\n priority: -400,\n compile: function (tElement: JQuery) {\n let initial = tElement.html();\n tElement.empty();\n\n return function (scope: IScope, $element: JQuery) {\n let data: UIViewData = $element.data('$uiView');\n if (!data) {\n $element.html(initial);\n $compile($element.contents())(scope);\n return;\n }\n\n let cfg: Ng1ViewConfig = data.$cfg || { viewDecl: {}, getTemplate: noop };\n let resolveCtx: ResolveContext = cfg.path && new ResolveContext(cfg.path);\n $element.html(cfg.getTemplate($element, resolveCtx) || initial);\n trace.traceUIViewFill(data.$uiView, $element.html());\n\n let link = $compile($element.contents());\n let controller = cfg.controller;\n let controllerAs: string = getControllerAs(cfg);\n let resolveAs: string = getResolveAs(cfg);\n let locals = resolveCtx && getLocals(resolveCtx);\n\n scope[resolveAs] = locals;\n\n if (controller) {\n let controllerInstance = $controller(controller, extend({}, locals, { $scope: scope, $element: $element }));\n if (controllerAs) {\n scope[controllerAs] = controllerInstance;\n scope[controllerAs][resolveAs] = locals;\n }\n\n // TODO: Use $view service as a central point for registering component-level hooks\n // Then, when a component is created, tell the $view service, so it can invoke hooks\n // $view.componentLoaded(controllerInstance, { $scope: scope, $element: $element });\n // scope.$on('$destroy', () => $view.componentUnloaded(controllerInstance, { $scope: scope, $element: $element }));\n\n $element.data('$ngControllerController', controllerInstance);\n $element.children().data('$ngControllerController', controllerInstance);\n\n registerControllerCallbacks($q, $transitions, controllerInstance, scope, cfg);\n }\n\n // Wait for the component to appear in the DOM\n if (isString(cfg.viewDecl.component)) {\n let cmp = cfg.viewDecl.component;\n let kebobName = kebobString(cmp);\n let tagRegexp = new RegExp(`^(x-|data-)?${kebobName}$`, \"i\");\n\n let getComponentController = () => {\n let directiveEl = [].slice.call($element[0].children)\n .filter((el: Element) => el && el.tagName && tagRegexp.exec(el.tagName)) ;\n \n return directiveEl && angular.element(directiveEl).data(`$${cmp}Controller`);\n };\n\n let deregisterWatch = scope.$watch(getComponentController, function(ctrlInstance) {\n if (!ctrlInstance) return;\n registerControllerCallbacks($q, $transitions, ctrlInstance, scope, cfg);\n deregisterWatch();\n });\n }\n\n link(scope);\n };\n }\n };\n}\n\n/** @hidden */\nlet hasComponentImpl = typeof (angular as any).module('ui.router')['component'] === 'function';\n/** @hidden incrementing id */\nlet _uiCanExitId = 0;\n\n/** @hidden TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */\nfunction registerControllerCallbacks($q: angular.IQService,\n $transitions: TransitionService,\n controllerInstance: Ng1Controller,\n $scope: IScope,\n cfg: Ng1ViewConfig) {\n // Call $onInit() ASAP\n if (isFunction(controllerInstance.$onInit) && !(cfg.viewDecl.component && hasComponentImpl)) {\n controllerInstance.$onInit();\n }\n\n let viewState: Ng1StateDeclaration = tail(cfg.path).state.self;\n\n let hookOptions: HookRegOptions = { bind: controllerInstance };\n // Add component-level hook for onParamsChange\n if (isFunction(controllerInstance.uiOnParamsChanged)) {\n let resolveContext: ResolveContext = new ResolveContext(cfg.path);\n let viewCreationTrans = resolveContext.getResolvable('$transition$').data;\n\n // Fire callback on any successful transition\n const paramsUpdated = ($transition$: Transition) => {\n // Exit early if the $transition$ is the same as the view was created within.\n // Exit early if the $transition$ will exit the state the view is for.\n if ($transition$ === viewCreationTrans || $transition$.exiting().indexOf(viewState as StateDeclaration) !== -1) return;\n\n let toParams = $transition$.params(\"to\") as TypedMap;\n let fromParams = $transition$.params>(\"from\") as TypedMap;\n let toSchema: Param[] = $transition$.treeChanges().to.map((node: PathNode) => node.paramSchema).reduce(unnestR, []);\n let fromSchema: Param[] = $transition$.treeChanges().from.map((node: PathNode) => node.paramSchema).reduce(unnestR, []);\n\n // Find the to params that have different values than the from params\n let changedToParams = toSchema.filter((param: Param) => {\n let idx = fromSchema.indexOf(param);\n return idx === -1 || !fromSchema[idx].type.equals(toParams[param.id], fromParams[param.id]);\n });\n\n // Only trigger callback if a to param has changed or is new\n if (changedToParams.length) {\n let changedKeys: string[] = changedToParams.map(x => x.id);\n // Filter the params to only changed/new to params. `$transition$.params()` may be used to get all params.\n let newValues = filter(toParams, (val, key) => changedKeys.indexOf(key) !== -1);\n controllerInstance.uiOnParamsChanged(newValues, $transition$);\n }\n };\n $scope.$on('$destroy', $transitions.onSuccess({}, paramsUpdated, hookOptions));\n }\n\n // Add component-level hook for uiCanExit\n if (isFunction(controllerInstance.uiCanExit)) {\n let id = _uiCanExitId++;\n let cacheProp = '_uiCanExitIds';\n\n // Returns true if a redirect transition already answered truthy\n const prevTruthyAnswer = (trans: Transition) =>\n !!trans && (trans[cacheProp] && trans[cacheProp][id] === true || prevTruthyAnswer(trans.redirectedFrom()));\n\n // If a user answered yes, but the transition was later redirected, don't also ask for the new redirect transition\n const wrappedHook = (trans: Transition) => {\n let promise, ids = trans[cacheProp] = trans[cacheProp] || {};\n if (!prevTruthyAnswer(trans)) {\n promise = $q.when(controllerInstance.uiCanExit(trans));\n promise.then(val => ids[id] = (val !== false));\n }\n return promise;\n };\n\n let criteria = {exiting: viewState.name};\n $scope.$on('$destroy', $transitions.onBefore(criteria, wrappedHook, hookOptions));\n }\n}\n\nangular.module('ui.router.state').directive('uiView', uiView);\nangular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);\n","/** @module ng1 */ /** */\nimport { ng as angular } from \"./angular\";\nimport { IServiceProviderFactory } from \"angular\";\nimport IAnchorScrollService = angular.IAnchorScrollService;\nimport ITimeoutService = angular.ITimeoutService;\n\nexport interface UIViewScrollProvider {\n /**\n * Uses standard anchorScroll behavior\n *\n * Reverts [[$uiViewScroll]] back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)\n * service for scrolling based on the url anchor.\n */\n useAnchorScroll(): void;\n}\n\n\n/** @hidden */\nfunction $ViewScrollProvider() {\n\n var useAnchorScroll = false;\n\n this.useAnchorScroll = function () {\n useAnchorScroll = true;\n };\n\n this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll: IAnchorScrollService, $timeout: ITimeoutService): Function {\n if (useAnchorScroll) {\n return $anchorScroll;\n }\n\n return function ($element: JQuery) {\n return $timeout(function () {\n $element[0].scrollIntoView();\n }, 0, false);\n };\n }];\n}\n\nangular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);\n","/**\n * @hidden\n * @module ng1\n */ /** */\ndeclare var angular;\nimport * as ng_from_import from \"angular\";\nlet ng_from_global = angular;\n\nexport const ng = (ng_from_import && ng_from_import.module) ? ng_from_import : ng_from_global;\n","/**\n * @coreapi\n * @module core\n */\n/** \n * Matches state names using glob-like pattern strings.\n *\n * Globs can be used in specific APIs including:\n *\n * - [[StateService.is]]\n * - [[StateService.includes]]\n * - The first argument to Hook Registration functions like [[TransitionService.onStart]]\n * - [[HookMatchCriteria]] and [[HookMatchCriterion]]\n *\n * A `Glob` string is a pattern which matches state names.\n * Nested state names are split into segments (separated by a dot) when processing.\n * The state named `foo.bar.baz` is split into three segments ['foo', 'bar', 'baz']\n *\n * Globs work according to the following rules:\n *\n * ### Exact match:\n *\n * The glob `'A.B'` matches the state named exactly `'A.B'`.\n *\n * | Glob |Matches states named|Does not match state named|\n * |:------------|:--------------------|:---------------------|\n * | `'A'` | `'A'` | `'B'` , `'A.C'` |\n * | `'A.B'` | `'A.B'` | `'A'` , `'A.B.C'` |\n * | `'foo'` | `'foo'` | `'FOO'` , `'foo.bar'`|\n *\n * ### Single star (`*`)\n *\n * A single star (`*`) is a wildcard that matches exactly one segment.\n *\n * | Glob |Matches states named |Does not match state named |\n * |:------------|:---------------------|:--------------------------|\n * | `'*'` | `'A'` , `'Z'` | `'A.B'` , `'Z.Y.X'` |\n * | `'A.*'` | `'A.B'` , `'A.C'` | `'A'` , `'A.B.C'` |\n * | `'A.*.*'` | `'A.B.C'` , `'A.X.Y'`| `'A'`, `'A.B'` , `'Z.Y.X'`|\n *\n * ### Double star (`**`)\n *\n * A double star (`'**'`) is a wildcard that matches *zero or more segments*\n *\n * | Glob |Matches states named |Does not match state named |\n * |:------------|:----------------------------------------------|:----------------------------------|\n * | `'**'` | `'A'` , `'A.B'`, `'Z.Y.X'` | (matches all states) |\n * | `'A.**'` | `'A'` , `'A.B'` , `'A.C.X'` | `'Z.Y.X'` |\n * | `'**.X'` | `'X'` , `'A.X'` , `'Z.Y.X'` | `'A'` , `'A.login.Z'` |\n * | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` |\n *\n */\nexport class Glob {\n text: string;\n glob: Array;\n regexp: RegExp;\n\n constructor(text: string) {\n this.text = text;\n this.glob = text.split('.');\n\n let regexpString = this.text.split('.')\n .map(seg => {\n if (seg === '**') return '(?:|(?:\\\\.[^.]*)*)';\n if (seg === '*') return '\\\\.[^.]*';\n return '\\\\.' + seg;\n }).join('');\n\n this.regexp = new RegExp(\"^\" + regexpString + \"$\");\n }\n\n matches(name: string) {\n return this.regexp.test('.' + name);\n }\n\n /** Returns true if the string has glob-like characters in it */\n static is(text: string) {\n return !!/[!,*]+/.exec(text);\n }\n\n /** Returns a glob from the string, or null if the string isn't Glob-like */\n static fromString(text: string) {\n return Glob.is(text) ? new Glob(text) : null;\n }\n}\n","/**\n * @coreapi\n * @module state\n */\n/** for typedoc */\nimport { StateDeclaration, _ViewDeclaration, _StateDeclaration, LazyLoadResult } from \"./interface\";\nimport { defaults, values, find, inherit } from \"../common/common\";\nimport { propEq } from \"../common/hof\";\nimport { Param } from \"../params/param\";\nimport { UrlMatcher } from \"../url/urlMatcher\";\nimport { Resolvable } from \"../resolve/resolvable\";\nimport { TransitionStateHookFn } from \"../transition/interface\";\nimport { TargetState } from \"./targetState\";\nimport { Transition } from \"../transition/transition\";\nimport { Glob } from \"../common/glob\";\nimport { isObject, isFunction } from \"../common/predicates\";\n\n/**\n * Internal representation of a UI-Router state.\n *\n * Instances of this class are created when a [[StateDeclaration]] is registered with the [[StateRegistry]].\n *\n * A registered [[StateDeclaration]] is augmented with a getter ([[StateDeclaration.$$state]]) which returns the corresponding [[StateObject]] object.\n *\n * This class prototypally inherits from the corresponding [[StateDeclaration]].\n * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]].\n */\nexport class StateObject {\n /** The parent [[StateObject]] */\n public parent: StateObject;\n\n /** The name used to register the state */\n public name: string;\n\n /** Prototypally inherits from [[StateDeclaration.abstract]] */\n public abstract: boolean;\n\n /** Prototypally inherits from [[StateDeclaration.resolve]] */\n public resolve: ({ [key: string]: (string|any[]|Function) }|any[]);\n\n /** A list of [[Resolvable]] objects. The internal representation of [[resolve]]. */\n public resolvables: Resolvable[];\n\n /** Prototypally inherits from [[StateDeclaration.resolvePolicy]] */\n public resolvePolicy: any;\n\n /** A compiled URLMatcher which detects when the state's URL is matched */\n public url: UrlMatcher;\n\n /** The parameters for the state, built from the URL and [[StateDeclaration.params]] */\n public params: { [key: string]: Param };\n\n /**\n * The views for the state.\n * Note: `@uirouter/core` does not register a builder for views.\n * The framework specific code should register a `views` builder.\n */\n public views: { [key: string]: _ViewDeclaration; };\n\n /**\n * The original [[StateDeclaration]] used to build this [[StateObject]].\n * Note: `this` object also prototypally inherits from the `self` declaration object.\n */\n public self: StateDeclaration;\n\n /** The nearest parent [[StateObject]] which has a URL */\n public navigable: StateObject;\n\n /** The parent [[StateObject]] objects from this state up to the root */\n public path: StateObject[];\n\n /**\n * Prototypally inherits from [[StateDeclaration.data]]\n * Note: This is the only field on the [[StateDeclaration]] which is mutated.\n * The definition object's `data` field is replaced with a new object\n * which prototypally inherits from the parent state definition's `data` field.\n */\n public data: any;\n\n /** \n * An object containing the parent States' names as keys and \n * true as their values.\n */\n public includes: { [name: string]: boolean };\n\n /** Prototypally inherits from [[StateDeclaration.onExit]] */\n public onExit: TransitionStateHookFn;\n /** Prototypally inherits from [[StateDeclaration.onRetain]] */\n public onRetain: TransitionStateHookFn;\n /** Prototypally inherits from [[StateDeclaration.onEnter]] */\n public onEnter: TransitionStateHookFn;\n\n /** Prototypally inherits from [[StateDeclaration.lazyLoad]] */\n public lazyLoad: (transition: Transition, state: StateDeclaration) => Promise;\n\n /** Prototypally inherits from [[StateDeclaration.redirectTo]] */\n redirectTo: (\n string |\n (($transition$: Transition) => TargetState) |\n { state: (string|StateDeclaration), params: { [key: string]: any }}\n );\n\n /** @hidden */\n __stateObjectCache: {\n /** Might be null */\n nameGlob?: Glob\n };\n\n\n /** @deprecated use State.create() */\n constructor(config?: StateDeclaration) {\n return StateObject.create(config || {});\n }\n\n /**\n * Create a state object to put the private/internal implementation details onto.\n * The object's prototype chain looks like:\n * (Internal State Object) -> (Copy of State.prototype) -> (State Declaration object) -> (State Declaration's prototype...)\n *\n * @param stateDecl the user-supplied State Declaration\n * @returns {StateObject} an internal State object\n */\n static create(stateDecl: _StateDeclaration): StateObject {\n stateDecl = StateObject.isStateClass(stateDecl) ? new stateDecl() : stateDecl;\n\n let state = inherit(inherit(stateDecl, StateObject.prototype)) as StateObject;\n stateDecl.$$state = () => state;\n state.self = stateDecl;\n state.__stateObjectCache = {\n nameGlob: Glob.fromString(state.name) // might return null\n };\n return state;\n }\n\n /** Predicate which returns true if the object is an class with @State() decorator */\n static isStateClass = (stateDecl: _StateDeclaration): stateDecl is ({ new (): StateDeclaration }) =>\n isFunction(stateDecl) && stateDecl['__uiRouterState'] === true;\n\n /** Predicate which returns true if the object is an internal [[StateObject]] object */\n static isState = (obj: any): obj is StateObject =>\n isObject(obj['__stateObjectCache']);\n\n /**\n * Returns true if the provided parameter is the same state.\n *\n * Compares the identity of the state against the passed value, which is either an object\n * reference to the actual `State` instance, the original definition object passed to\n * `$stateProvider.state()`, or the fully-qualified name.\n *\n * @param ref Can be one of (a) a `State` instance, (b) an object that was passed\n * into `$stateProvider.state()`, (c) the fully-qualified name of a state as a string.\n * @returns Returns `true` if `ref` matches the current `State` instance.\n */\n is(ref: StateObject|StateDeclaration|string): boolean {\n return this === ref || this.self === ref || this.fqn() === ref;\n }\n\n /**\n * @deprecated this does not properly handle dot notation\n * @returns Returns a dot-separated name of the state.\n */\n fqn(): string {\n if (!this.parent || !(this.parent instanceof this.constructor)) return this.name;\n let name = this.parent.fqn();\n return name ? name + \".\" + this.name : this.name;\n }\n\n /**\n * Returns the root node of this state's tree.\n *\n * @returns The root of this state's tree.\n */\n root(): StateObject {\n return this.parent && this.parent.root() || this;\n }\n\n /**\n * Gets the state's `Param` objects\n *\n * Gets the list of [[Param]] objects owned by the state.\n * If `opts.inherit` is true, it also includes the ancestor states' [[Param]] objects.\n * If `opts.matchingKeys` exists, returns only `Param`s whose `id` is a key on the `matchingKeys` object\n *\n * @param opts options\n */\n parameters(opts?: { inherit?: boolean, matchingKeys?: any }): Param[] {\n opts = defaults(opts, { inherit: true, matchingKeys: null });\n let inherited = opts.inherit && this.parent && this.parent.parameters() || [];\n return inherited.concat(values(this.params))\n .filter(param => !opts.matchingKeys || opts.matchingKeys.hasOwnProperty(param.id));\n }\n\n /**\n * Returns a single [[Param]] that is owned by the state\n *\n * If `opts.inherit` is true, it also searches the ancestor states` [[Param]]s.\n * @param id the name of the [[Param]] to return\n * @param opts options\n */\n parameter(id: string, opts: { inherit?: boolean } = {}): Param {\n return (\n this.url && this.url.parameter(id, opts) ||\n find(values(this.params), propEq('id', id)) ||\n opts.inherit && this.parent && this.parent.parameter(id)\n );\n }\n\n toString() {\n return this.fqn();\n }\n}\n","/**\n * This module is a stub for core services such as Dependency Injection or Browser Location.\n * Core services may be implemented by a specific framework, such as ng1 or ng2, or be pure javascript.\n *\n * @module common\n */\n/** for typedoc */\nimport {IInjectable, Obj} from \"./common\";\nimport { Disposable } from \"../interface\";\nimport { UrlParts } from \"../url/interface\";\n\nexport let notImplemented = (fnname: string) => () => {\n throw new Error(`${fnname}(): No coreservices implementation for UI-Router is loaded.`);\n};\n\nlet services: CoreServices = {\n $q: undefined,\n $injector: undefined,\n};\n\nexport interface $QLikeDeferred {\n resolve: (val?: any) => void;\n reject: (reason?: any) => void;\n promise: Promise;\n}\n\nexport interface $QLike {\n when(value?: T | PromiseLike): Promise;\n reject(reason: any): Promise;\n defer(): $QLikeDeferred;\n all(promises: { [key: string]: Promise }): Promise;\n all(promises: Promise[]): Promise;\n}\n\nexport interface $InjectorLike {\n get(token: any): any;\n get(token: any): T;\n has(token: any): boolean;\n invoke(fn: IInjectable, context?: any, locals?: Obj): any;\n annotate(fn: IInjectable, strictDi?: boolean): any[];\n strictDi?: boolean;\n}\n\nexport interface CoreServices {\n $q: $QLike;\n $injector: $InjectorLike;\n}\n\nexport interface LocationServices extends Disposable {\n /**\n * Gets the current url string\n *\n * The URL is normalized using the internal [[path]]/[[search]]/[[hash]] values.\n *\n * For example, the URL may be stored in the hash ([[HashLocationServices]]) or\n * have a base HREF prepended ([[PushStateLocationServices]]).\n *\n * The raw URL in the browser might be:\n *\n * ```\n * http://mysite.com/somepath/index.html#/internal/path/123?param1=foo#anchor\n * ```\n *\n * or\n *\n * ```\n * http://mysite.com/basepath/internal/path/123?param1=foo#anchor\n * ```\n *\n * then this method returns:\n *\n * ```\n * /internal/path/123?param1=foo#anchor\n * ```\n *\n *\n * #### Example:\n * ```js\n * locationServices.url(); // \"/some/path?query=value#anchor\"\n * ```\n *\n * @returns the current value of the url, as a string.\n */\n url(): string;\n\n /**\n * Updates the url, or gets the current url\n *\n * Updates the url, changing it to the value in `newurl`\n *\n * #### Example:\n * ```js\n * locationServices.url(\"/some/path?query=value#anchor\", true);\n * ```\n *\n * @param newurl The new value for the URL.\n * This url should reflect only the new internal [[path]], [[search]], and [[hash]] values.\n * It should not include the protocol, site, port, or base path of an absolute HREF.\n * @param replace When true, replaces the current history entry (instead of appending it) with this new url\n * @param state The history's state object, i.e., pushState (if the LocationServices implementation supports it)\n * @return the url (after potentially being processed)\n */\n url(newurl: string, replace?: boolean, state?: any): string;\n\n /**\n * Gets the path part of the current url\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`\n *\n * @return the path portion of the url\n */\n path(): string;\n\n /**\n * Gets the search part of the current url as an object\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`\n *\n * @return the search (querystring) portion of the url, as an object\n */\n search(): { [key: string]: any };\n\n /**\n * Gets the hash part of the current url\n *\n * If the current URL is `/some/path?query=value#anchor`, this returns `anchor`\n *\n * @return the hash (anchor) portion of the url\n */\n hash(): string;\n\n /**\n * Registers a url change handler\n *\n * #### Example:\n * ```js\n * let deregisterFn = locationServices.onChange((evt) => console.log(\"url change\", evt));\n * ```\n *\n * @param callback a function that will be called when the url is changing\n * @return a function that de-registers the callback\n */\n onChange(callback: Function): Function;\n}\n\n/**\n * This service returns the location configuration\n *\n * This service returns information about the location configuration.\n * This service is primarily used when building URLs (e.g., for `hrefs`)\n */\nexport interface LocationConfig extends Disposable {\n /**\n * Gets the port, e.g., `80`\n *\n * @return the port number\n */\n port(): number;\n /**\n * Gets the protocol, e.g., `http`\n *\n * @return the protocol\n */\n protocol(): string;\n /**\n * Gets the host, e.g., `localhost`\n *\n * @return the protocol\n */\n host(): string;\n /**\n * Gets the base Href, e.g., `http://localhost/approot/`\n *\n * @return the application's base href\n */\n baseHref(): string;\n /**\n * Returns true when running in pushstate mode\n *\n * @return true when running in pushstate mode\n */\n html5Mode(): boolean;\n /**\n * Gets the hashPrefix (when not running in pushstate mode)\n *\n * If the current url is `http://localhost/app#!/uirouter/path/#anchor`, it returns `!` which is the prefix for the \"hashbang\" portion.\n *\n * @return the hash prefix\n */\n hashPrefix(): string;\n /**\n * Sets the hashPrefix (when not running in pushstate mode)\n *\n * @return the new hash prefix\n */\n hashPrefix(newprefix: string): string;\n}\n\nexport {services};\n","/**\n * @module common\n */ /** for typedoc */\n\nexport class Queue {\n constructor(private _items: T[] = [], private _limit: number = null) { }\n\n enqueue(item: T) {\n let items = this._items;\n items.push(item);\n if (this._limit && items.length > this._limit) items.shift();\n return item;\n }\n\n dequeue(): T {\n if (this.size())\n return this._items.splice(0, 1)[0];\n }\n\n clear(): Array {\n let current = this._items;\n this._items = [];\n return current;\n }\n\n size(): number {\n return this._items.length;\n }\n\n remove(item: T) {\n let idx = this._items.indexOf(item);\n return idx > -1 && this._items.splice(idx, 1)[0];\n }\n\n peekTail(): T {\n return this._items[this._items.length - 1];\n }\n\n peekHead(): T {\n if (this.size())\n return this._items[0];\n }\n}\n","/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\n\"use strict\";\nimport {extend, silentRejection} from \"../common/common\";\nimport {stringify} from \"../common/strings\";\nimport { is } from '../common/hof';\n\nexport enum RejectType {\n SUPERSEDED = 2, ABORTED = 3, INVALID = 4, IGNORED = 5, ERROR = 6\n}\n\n/** @hidden */ let id = 0;\n\nexport class Rejection {\n $id = id++;\n type: number;\n message: string;\n detail: any;\n redirected: boolean;\n\n constructor(type: number, message?: string, detail?: any) {\n this.type = type;\n this.message = message;\n this.detail = detail;\n }\n\n toString() {\n const detailString = (d: any) => \n d && d.toString !== Object.prototype.toString ? d.toString() : stringify(d);\n let detail = detailString(this.detail);\n let { $id, type, message } = this;\n return `Transition Rejection($id: ${$id} type: ${type}, message: ${message}, detail: ${detail})`;\n }\n\n toPromise(): Promise {\n return extend(silentRejection(this), { _transitionRejection: this });\n }\n\n /** Returns true if the obj is a rejected promise created from the `asPromise` factory */\n static isRejectionPromise(obj: any): boolean {\n return obj && (typeof obj.then === 'function') && is(Rejection)(obj._transitionRejection);\n }\n\n /** Returns a Rejection due to transition superseded */\n static superseded(detail?: any, options?: any): Rejection {\n let message = \"The transition has been superseded by a different transition\";\n let rejection = new Rejection(RejectType.SUPERSEDED, message, detail);\n if (options && options.redirected) {\n rejection.redirected = true;\n }\n return rejection;\n }\n\n /** Returns a Rejection due to redirected transition */\n static redirected(detail?: any): Rejection {\n return Rejection.superseded(detail, { redirected: true });\n }\n\n /** Returns a Rejection due to invalid transition */\n static invalid(detail?: any): Rejection {\n let message = \"This transition is invalid\";\n return new Rejection(RejectType.INVALID, message, detail);\n }\n\n /** Returns a Rejection due to ignored transition */\n static ignored(detail?: any): Rejection {\n let message = \"The transition was ignored\";\n return new Rejection(RejectType.IGNORED, message, detail);\n }\n\n /** Returns a Rejection due to aborted transition */\n static aborted(detail?: any): Rejection {\n let message = \"The transition has been aborted\";\n return new Rejection(RejectType.ABORTED, message, detail);\n }\n\n /** Returns a Rejection due to aborted transition */\n static errored(detail?: any): Rejection {\n let message = \"The transition errored\";\n return new Rejection(RejectType.ERROR, message, detail);\n }\n \n /**\n * Returns a Rejection\n *\n * Normalizes a value as a Rejection.\n * If the value is already a Rejection, returns it.\n * Otherwise, wraps and returns the value as a Rejection (Rejection type: ERROR).\n *\n * @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection.\n */\n static normalize(detail?: Rejection | Error | any): Rejection {\n return is(Rejection)(detail) ? detail : Rejection.errored(detail);\n }\n}\n","/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\nimport {StateDeclaration} from \"../state/interface\";\nimport {Predicate} from \"../common/common\";\n\nimport {Transition} from \"./transition\";\nimport {StateObject} from \"../state/stateObject\";\nimport {PathNode} from \"../path/pathNode\";\nimport {TargetState} from \"../state/targetState\";\nimport {RegisteredHook} from \"./hookRegistry\";\n\n/**\n * The TransitionOptions object can be used to change the behavior of a transition.\n *\n * It is passed as the third argument to [[StateService.go]], [[StateService.transitionTo]].\n * It can also be used with a `uiSref`.\n */\nexport interface TransitionOptions {\n /**\n * This option changes how the Transition interacts with the browser's location bar (URL).\n *\n * - If `true`, it will update the url in the location bar.\n * - If `false`, it will not update the url in the location bar.\n * - If it is the string `\"replace\"`, it will update the url and also replace the last history record.\n *\n * @default `true`\n */\n location ?: (boolean|string);\n\n /**\n * When transitioning to relative path (e.g '`^`'), this option defines which state to be relative from.\n * @default `$state.current`\n */\n relative ?: (string|StateDeclaration|StateObject);\n\n /**\n * This option sets whether or not the transition's parameter values should be inherited from\n * the current parameter values.\n *\n * - If `true`, it will inherit parameter values from the current parameter values.\n * - If `false`, only the parameters which are provided to `transitionTo` will be used.\n *\n * @default `false`\n */\n inherit ?: boolean;\n\n /**\n * @deprecated\n */\n notify ?: boolean;\n\n /**\n * This option may be used to force states which are currently active to reload.\n *\n * During a normal transition, a state is \"retained\" if:\n * - It was previously active\n * - The state's parameter values have not changed\n * - All the parent states' parameter values have not changed\n *\n * Forcing a reload of a state will cause it to be exited and entered, which will:\n * - Refetch that state's resolve data\n * - Exit the state (onExit hook)\n * - Re-enter the state (onEnter hook)\n * - Re-render the views (controllers and templates)\n *\n * - When `true`, the destination state (and all parent states) will be reloaded.\n * - When it is a string and is the name of a state, or when it is a State object,\n * that state and any children states will be reloaded.\n *\n * @default `false`\n */\n reload ?: (boolean|string|StateDeclaration|StateObject);\n /**\n * You can define your own Transition Options inside this property and use them, e.g., from a Transition Hook\n */\n custom ?: any;\n /** @internalapi */\n reloadState ?: (StateObject);\n /** @internalapi\n * If this transition is a redirect, this property should be the original Transition (which was redirected to this one)\n */\n redirectedFrom?: Transition;\n /** @internalapi */\n current ?: () => Transition;\n /** @internalapi */\n source ?: \"sref\" | \"url\" | \"redirect\" | \"otherwise\" | \"unknown\";\n}\n\n/** @internalapi */\nexport interface TransitionHookOptions {\n current ?: () => Transition; //path?\n transition ?: Transition;\n hookType ?: string;\n target ?: any;\n traceData ?: any;\n bind ?: any;\n stateHook ?: boolean;\n}\n\n/**\n * TreeChanges encapsulates the various Paths that are involved in a Transition.\n *\n * Get a TreeChanges object using [[Transition.treeChanges]]\n *\n * A UI-Router Transition is from one Path in a State Tree to another Path. For a given Transition,\n * this object stores the \"to\" and \"from\" paths, as well as subsets of those: the \"retained\",\n * \"exiting\" and \"entering\" paths.\n *\n * Each path in TreeChanges is an array of [[PathNode]] objects. Each PathNode in the array corresponds to a portion\n * of a nested state.\n *\n * For example, if you had a nested state named `foo.bar.baz`, it would have three\n * portions, `foo, bar, baz`. If you transitioned **to** `foo.bar.baz` and inspected the [[TreeChanges.to]]\n * Path, you would find a node in the array for each portion: `foo`, `bar`, and `baz`.\n *\n * ---\n *\n * @todo show visual state tree\n */\nexport interface TreeChanges {\n /** @nodoc */\n [key: string]: PathNode[];\n\n /** The path of nodes in the state tree that the transition is coming *from* */\n from: PathNode[];\n\n /** The path of nodes in the state tree that the transition is going *to* */\n to: PathNode[];\n\n /**\n * The path of active nodes that the transition is retaining.\n *\n * These nodes are neither exited, nor entered.\n * Before and after the transition is successful, these nodes are active.\n */\n retained: PathNode[];\n\n /**\n * The path of previously active nodes that the transition is exiting.\n *\n * After the Transition is successful, these nodes are no longer active.\n *\n * Note that a state that is being reloaded (due to parameter values changing, or `reload: true`) may be in both the\n * `exiting` and `entering` paths.\n */\n exiting: PathNode[];\n\n /**\n * The path of nodes that the transition is entering.\n *\n * After the Transition is successful, these nodes will be active.\n * Because they are entering, they have their resolves fetched, `onEnter` hooks run, and their views\n * (component(s) or controller(s)+template(s)) refreshed.\n *\n * Note that a state that is reloaded (due to parameter values changing, or `reload: true`) may be in both the\n * `exiting` and `entering` paths.\n */\n entering: PathNode[];\n}\n\nexport type IHookRegistration = (matchCriteria: HookMatchCriteria, callback: HookFn, options?: HookRegOptions) => Function;\n\n/**\n * The signature for Transition Hooks.\n *\n * Transition hooks are callback functions that hook into the lifecycle of transitions.\n * As a transition runs, it reaches certain lifecycle events.\n * As each event occurs, the hooks which are registered for the event are called (in priority order).\n *\n * A transition hook may alter a Transition by returning a [[HookResult]].\n *\n * #### See:\n *\n * - [[IHookRegistry.onBefore]]\n * - [[IHookRegistry.onStart]]\n * - [[IHookRegistry.onFinish]]\n * - [[IHookRegistry.onSuccess]]\n * - [[IHookRegistry.onError]]\n *\n * @param transition the current [[Transition]]\n * @param injector (for ng1 or ng2 only) the injector service\n *\n * @returns a [[HookResult]] which may alter the transition\n *\n */\nexport interface TransitionHookFn {\n (transition: Transition) : HookResult;\n}\n\n/**\n * The signature for Transition State Hooks.\n *\n * A function which hooks into a lifecycle event for a specific state.\n *\n * Transition State Hooks are callback functions that hook into the lifecycle events of specific states during a transition.\n * As a transition runs, it may exit some states, retain (keep) states, and enter states.\n * As each lifecycle event occurs, the hooks which are registered for the event and that state are called (in priority order).\n *\n * #### See:\n *\n * - [[IHookRegistry.onExit]]\n * - [[IHookRegistry.onRetain]]\n * - [[IHookRegistry.onEnter]]\n *\n * @param transition the current [[Transition]]\n * @param state the [[StateObject]] that the hook is bound to\n * @param injector (for ng1 or ng2 only) the injector service\n *\n * @returns a [[HookResult]] which may alter the transition\n */\nexport interface TransitionStateHookFn {\n (transition: Transition, state: StateDeclaration) : HookResult;\n}\n\n/**\n * The signature for Transition onCreate Hooks.\n *\n * Transition onCreate Hooks are callbacks that allow customization or preprocessing of\n * a Transition before it is returned from [[TransitionService.create]]\n *\n * @param transition the [[Transition]] that was just created\n * @return a [[Transition]] which will then be returned from [[TransitionService.create]]\n */\nexport interface TransitionCreateHookFn {\n (transition: Transition): void;\n}\n\nexport type HookFn = (TransitionHookFn|TransitionStateHookFn|TransitionCreateHookFn);\n\n/**\n * The return value of a [[TransitionHookFn]] or [[TransitionStateHookFn]]\n *\n * When returned from a [[TransitionHookFn]] or [[TransitionStateHookFn]], these values alter the running [[Transition]]:\n *\n * - `false`: the transition will be cancelled.\n * - [[TargetState]]: the transition will be redirected to the new target state (see: [[StateService.target]])\n * - `Promise`: the transition will wait for the promise to resolve or reject\n * - If the promise is rejected (or resolves to `false`), the transition will be cancelled\n * - If the promise resolves to a [[TargetState]], the transition will be redirected\n * - If the promise resolves to anything else, the transition will resume\n * - Anything else: the transition will resume\n */\nexport type HookResult = (boolean | TargetState | void | Promise);\n\n/**\n * These options may be provided when registering a Transition Hook (such as `onStart`)\n */\nexport interface HookRegOptions {\n /**\n * Sets the priority of the registered hook\n *\n * Hooks of the same type (onBefore, onStart, etc) are invoked in priority order. A hook with a higher priority\n * is invoked before a hook with a lower priority.\n *\n * The default hook priority is 0\n */\n priority?: number;\n\n /**\n * Specifies what `this` is bound to during hook invocation.\n */\n bind?: any;\n}\n\n/**\n * This interface specifies the api for registering Transition Hooks. Both the\n * [[TransitionService]] and also the [[Transition]] object itself implement this interface.\n * Note: the Transition object only allows hooks to be registered before the Transition is started.\n */\nexport interface IHookRegistry {\n /**\n * Registers a [[TransitionHookFn]], called *before a transition starts*.\n *\n * Registers a transition lifecycle hook, which is invoked before a transition even begins.\n * This hook can be useful to implement logic which prevents a transition from even starting, such\n * as authentication, redirection\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onBefore` hooks are invoked *before a Transition starts*.\n * No resolves have been fetched yet.\n * Each `onBefore` hook is invoked synchronously, in the same call stack as [[StateService.transitionTo]].\n * The registered `onBefore` hooks are invoked in priority order.\n *\n * Note: during the `onBefore` phase, additional hooks can be added to the specific [[Transition]] instance.\n * These \"on-the-fly\" hooks only affect the currently running transition..\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * If any hook modifies the transition *synchronously* (by throwing, returning `false`, or returning\n * a [[TargetState]]), the remainder of the hooks are skipped.\n * If a hook returns a promise, the remainder of the `onBefore` hooks are still invoked synchronously.\n * All promises are resolved, and processed asynchronously before the `onStart` phase of the Transition.\n *\n * ### Examples\n *\n * #### Default Substate\n *\n * This example redirects any transition from 'home' to 'home.dashboard'. This is commonly referred to as a\n * \"default substate\".\n *\n * @example\n * ```js\n * // ng2\n * transitionService.onBefore({ to: 'home' }, (trans: Transition) =>\n * trans.router.stateService.target(\"home.dashboard\"));\n * ```\n *\n * #### Data Driven Default Substate\n *\n * This example provides data-driven default substate functionality. It matches on a transition to any state\n * which has `defaultSubstate: \"some.sub.state\"` defined. See: [[Transition.to]] which returns the \"to state\"\n * definition.\n *\n * @example\n * ```js\n * // ng1\n * // state declaration\n * {\n * name: 'home',\n * template: '
    ',\n * defaultSubstate: 'home.dashboard'\n * }\n *\n * var criteria = {\n * to: function(state) {\n * return state.defaultSubstate != null;\n * }\n * }\n *\n * $transitions.onBefore(criteria, function(trans: Transition) {\n * var substate = trans.to().defaultSubstate;\n * return trans.router.stateService.target(substate);\n * });\n * ```\n *\n *\n * #### Require authentication\n *\n * This example cancels a transition to a state which requires authentication, if the user is not currently authenticated.\n *\n * This example assumes a state tree where all states which require authentication are children of a parent `'requireauth'` state.\n * This example assumes `MyAuthService` synchronously returns a boolean from `isAuthenticated()`.\n *\n * #### Example:\n * ```js\n * // ng1\n * $transitions.onBefore( { to: 'requireauth.**' }, function(trans) {\n * var myAuthService = trans.injector().get('MyAuthService');\n * // If isAuthenticated returns false, the transition is cancelled.\n * return myAuthService.isAuthenticated();\n * });\n * ```\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be invoked.\n * @returns a function which deregisters the hook.\n */\n onBefore(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called when a transition starts.\n *\n * Registers a transition lifecycle hook, which is invoked as a transition starts running.\n * This hook can be useful to perform some asynchronous action before completing a transition.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onStart` hooks are invoked asynchronously when the Transition starts running.\n * This happens after the `onBefore` phase is complete.\n * At this point, the Transition has not yet exited nor entered any states.\n * The registered `onStart` hooks are invoked in priority order.\n *\n * Note: A built-in `onStart` hook with high priority is used to fetch any eager resolve data.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Example\n *\n * #### Login during transition\n *\n * This example intercepts any transition to a state which requires authentication, when the user is\n * not currently authenticated. It allows the user to authenticate asynchronously, then resumes the\n * transition. If the user did not authenticate successfully, it redirects to the \"guest\" state, which\n * does not require authentication.\n *\n * This example assumes:\n * - a state tree where all states which require authentication are children of a parent `'auth'` state.\n * - `MyAuthService.isAuthenticated()` synchronously returns a boolean.\n * - `MyAuthService.authenticate()` presents a login dialog, and returns a promise which is resolved\n * or rejected, whether or not the login attempt was successful.\n *\n * #### Example:\n * ```js\n * // ng1\n * $transitions.onStart( { to: 'auth.**' }, function(trans) {\n * var $state = trans.router.stateService;\n * var MyAuthService = trans.injector().get('MyAuthService');\n *\n * // If the user is not authenticated\n * if (!MyAuthService.isAuthenticated()) {\n *\n * // Then return a promise for a successful login.\n * // The transition will wait for this promise to settle\n *\n * return MyAuthService.authenticate().catch(function() {\n *\n * // If the authenticate() method failed for whatever reason,\n * // redirect to a 'guest' state which doesn't require auth.\n * return $state.target(\"guest\");\n * });\n * }\n * });\n * ```\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onStart(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is entered.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being entered.\n *\n * Since this hook is run only when the specific state is being *entered*, it can be useful for\n * performing tasks when entering a submodule/feature area such as initializing a stateful service, \n * or for guarding access to a submodule/feature area.\n *\n * See [[TransitionStateHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onEnter` hooks generally specify `{ entering: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onEnter` hooks are invoked when the Transition is entering a state.\n * States are entered after the `onRetain` phase is complete.\n * If more than one state is being entered, the parent state is entered first.\n * The registered `onEnter` hooks for a state are invoked in priority order.\n *\n * Note: A built-in `onEnter` hook with high priority is used to fetch lazy resolve data for states being entered.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onEnter` hooks using the [[TransitionService]], you may define an `onEnter` hook\n * directly on a state declaration (see: [[StateDeclaration.onEnter]]).\n * \n *\n * ### Examples\n *\n * #### Audit Log\n *\n * This example uses a service to log that a user has entered the admin section of an app.\n * This assumes that there are substates of the \"admin\" state, such as \"admin.users\", \"admin.pages\", etc.\n * @example\n * ```\n *\n * $transitions.onEnter({ entering: 'admin' }, function(transition, state) {\n * var AuditService = trans.injector().get('AuditService');\n * AuditService.log(\"Entered \" + state.name + \" module while transitioning to \" + transition.to().name);\n * }\n * ```\n *\n * #### Audit Log (inside a state declaration)\n *\n * The `onEnter` inside this state declaration is syntactic sugar for the previous Audit Log example.\n * ```\n * {\n * name: 'admin',\n * component: 'admin',\n * onEnter: function($transition$, $state$) {\n * var AuditService = $transition$.injector().get('AuditService');\n * AuditService.log(\"Entered \" + state.name + \" module while transitioning to \" + transition.to().name);\n * }\n * }\n * ```\n *\n * Note: A state declaration's `onEnter` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onEnter(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is retained/kept.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) for\n * a specific state that was previously active will remain active (is not being entered nor exited).\n * \n * This hook is invoked when a state is \"retained\" or \"kept\".\n * It means the transition is coming *from* a substate of the retained state *to* a substate of the retained state.\n * This hook can be used to perform actions when the user moves from one substate to another, such as between steps in a wizard.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onRetain` hooks generally specify `{ retained: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onRetain` hooks are invoked after any `onExit` hooks have been fired.\n * If more than one state is retained, the child states' `onRetain` hooks are invoked first.\n * The registered `onRetain` hooks for a state are invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onRetain` hooks using the [[TransitionService]], you may define an `onRetain` hook\n * directly on a state declaration (see: [[StateDeclaration.onRetain]]).\n *\n * Note: A state declaration's `onRetain` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onRetain(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionStateHookFn]], called when a specific state is exited.\n *\n * Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being exited.\n *\n * Since this hook is run only when the specific state is being *exited*, it can be useful for\n * performing tasks when leaving a submodule/feature area such as cleaning up a stateful service, \n * or for preventing the user from leaving a state or submodule until some criteria is satisfied.\n *\n * See [[TransitionStateHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * `onExit` hooks generally specify `{ exiting: 'somestate' }`.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onExit` hooks are invoked when the Transition is exiting a state.\n * States are exited after any `onStart` phase is complete.\n * If more than one state is being exited, the child states are exited first.\n * The registered `onExit` hooks for a state are invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * ### Inside a state declaration\n *\n * Instead of registering `onExit` hooks using the [[TransitionService]], you may define an `onExit` hook\n * directly on a state declaration (see: [[StateDeclaration.onExit]]).\n *\n * Note: A state declaration's `onExit` function is injected for Angular 1 only.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onExit(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called *just before a transition finishes*.\n *\n * Registers a transition lifecycle hook, which is invoked just before a transition finishes.\n * This hook is a last chance to cancel or redirect a transition.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onFinish` hooks are invoked after the `onEnter` phase is complete.\n * These hooks are invoked just before the transition is \"committed\".\n * Each hook is invoked in priority order.\n *\n * ### Return value\n *\n * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n * See [[HookResult]] for more information.\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onFinish(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called after a successful transition completed.\n *\n * Registers a transition lifecycle hook, which is invoked after a transition successfully completes.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * `onSuccess` hooks are chained off the Transition's promise (see [[Transition.promise]]).\n * If the Transition is successful and its promise is resolved, then the `onSuccess` hooks are invoked.\n * Since these hooks are run after the transition is over, their return value is ignored.\n * The `onSuccess` hooks are invoked in priority order.\n *\n * ### Return value\n *\n * Since the Transition is already completed, the hook's return value is ignored\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onSuccess(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Registers a [[TransitionHookFn]], called after a transition has errored.\n *\n * Registers a transition lifecycle hook, which is invoked after a transition has been rejected for any reason.\n *\n * See [[TransitionHookFn]] for the signature of the function.\n *\n * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n * To match all Transitions, use an empty criteria object `{}`.\n *\n * ### Lifecycle\n *\n * The `onError` hooks are chained off the Transition's promise (see [[Transition.promise]]).\n * If a Transition fails, its promise is rejected and the `onError` hooks are invoked.\n * The `onError` hooks are invoked in priority order.\n *\n * Since these hooks are run after the transition is over, their return value is ignored.\n *\n * A transition \"errors\" if it was started, but failed to complete (for any reason).\n * A *non-exhaustive list* of reasons a transition can error:\n *\n * - A transition was cancelled because a new transition started while it was still running (`Transition superseded`)\n * - A transition was cancelled by a Transition Hook returning false\n * - A transition was redirected by a Transition Hook returning a [[TargetState]]\n * - A Transition Hook or resolve function threw an error\n * - A Transition Hook returned a rejected promise\n * - A resolve function returned a rejected promise\n *\n * To check the failure reason, inspect the return value of [[Transition.error]].\n * \n * Note: `onError` should be used for targeted error handling, or error recovery.\n * For simple catch-all error reporting, use [[StateService.defaultErrorHandler]].\n *\n * ### Return value\n *\n * Since the Transition is already completed, the hook's return value is ignored\n *\n * @param matchCriteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be injected and invoked.\n * @returns a function which deregisters the hook.\n */\n onError(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n /**\n * Returns all the registered hooks of a given `hookName` type\n *\n * #### Example:\n * ```\n * $transitions.getHooks(\"onEnter\")\n * ```\n */\n getHooks(hookName: string): RegisteredHook[];\n\n /** @hidden place to store the hooks */\n _registeredHooks: { [key: string]: RegisteredHook[] };\n}\n\n/** A predicate type which tests if a [[StateDeclaration]] passes some test. Returns a boolean. */\nexport type IStateMatch = Predicate\n\n/**\n * This object is used to configure whether or not a Transition Hook is invoked for a particular transition,\n * based on the Transition's \"to state\" and \"from state\".\n *\n * Each property (`to`, `from`, `exiting`, `retained`, and `entering`) can be a state [[Glob]] string,\n * a boolean, or a function that takes a state and returns a boolean (see [[HookMatchCriterion]])\n *\n * All properties are optional. If any property is omitted, it is replaced with the value `true`, and always matches.\n * To match any transition, use an empty criteria object `{}`.\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from the `parent` state and going to the `parent.child` state.\n * var match = {\n * to: 'parent',\n * from: 'parent.child'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any substate of `parent` and going directly to the `parent` state.\n * var match = {\n * to: 'parent',\n * from: 'parent.**'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any state and going to any substate of `mymodule`\n * var match = {\n * to: 'mymodule.**'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any state and going to any state that has `data.authRequired`\n * // set to a truthy value.\n * var match = {\n * to: function(state) {\n * return state.data != null && state.data.authRequired === true;\n * }\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition that is exiting `parent.child`\n * var match = {\n * exiting: 'parent.child'\n * }\n * ```\n */\nexport interface HookMatchCriteria {\n [key: string]: HookMatchCriterion | undefined;\n\n /** A [[HookMatchCriterion]] to match the destination state */\n to?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match the original (from) state */\n from?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be exiting */\n exiting?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be retained */\n retained?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be entering */\n entering?: HookMatchCriterion;\n}\n\nexport interface IMatchingNodes {\n [key: string]: PathNode[];\n\n to: PathNode[];\n from: PathNode[];\n exiting: PathNode[];\n retained: PathNode[];\n entering: PathNode[];\n}\n\n/** @hidden */\nexport interface RegisteredHooks {\n [key: string]: RegisteredHook[];\n}\n\n/** @hidden */\nexport interface PathTypes {\n [key: string]: PathType;\n\n to: PathType;\n from: PathType;\n exiting: PathType;\n retained: PathType;\n entering: PathType;\n}\n\n/** @hidden */\nexport interface PathType {\n name: string;\n scope: TransitionHookScope;\n}\n\n/**\n * Hook Criterion used to match a transition.\n *\n * A [[Glob]] string that matches the name of a state.\n *\n * Or, a function with the signature `function(state) { return matches; }`\n * which should return a boolean to indicate if a state matches.\n *\n * Or, `true` to always match\n */\nexport type HookMatchCriterion = (string|IStateMatch|boolean)\n\nexport enum TransitionHookPhase { CREATE, BEFORE, RUN, SUCCESS, ERROR }\nexport enum TransitionHookScope { TRANSITION, STATE }\n","/**\n * @coreapi\n * @module state\n */ /** for typedoc */\n\nimport { StateDeclaration, StateOrName, TargetStateDef } from \"./interface\";\nimport { ParamsOrArray } from \"../params/interface\";\nimport { TransitionOptions } from \"../transition/interface\";\nimport { StateObject } from \"./stateObject\";\nimport { toJson } from \"../common/common\";\nimport { isString } from \"../common/predicates\";\n\n/**\n * Encapsulate the target (destination) state/params/options of a [[Transition]].\n *\n * This class is frequently used to redirect a transition to a new destination.\n *\n * See:\n *\n * - [[HookResult]]\n * - [[TransitionHookFn]]\n * - [[TransitionService.onStart]]\n *\n * To create a `TargetState`, use [[StateService.target]].\n *\n * ---\n *\n * This class wraps:\n *\n * 1) an identifier for a state\n * 2) a set of parameters\n * 3) and transition options\n * 4) the registered state object (the [[StateDeclaration]])\n *\n * Many UI-Router APIs such as [[StateService.go]] take a [[StateOrName]] argument which can\n * either be a *state object* (a [[StateDeclaration]] or [[StateObject]]) or a *state name* (a string).\n * The `TargetState` class normalizes those options.\n *\n * A `TargetState` may be valid (the state being targeted exists in the registry)\n * or invalid (the state being targeted is not registered).\n */\nexport class TargetState {\n private _params: ParamsOrArray;\n\n /**\n * The TargetState constructor\n *\n * Note: Do not construct a `TargetState` manually.\n * To create a `TargetState`, use the [[StateService.target]] factory method.\n *\n * @param _identifier An identifier for a state.\n * Either a fully-qualified state name, or the object used to define the state.\n * @param _definition The internal state representation, if exists.\n * @param _params Parameters for the target state\n * @param _options Transition options.\n *\n * @internalapi\n */\n constructor(\n private _identifier: StateOrName,\n private _definition?: StateObject,\n _params?: ParamsOrArray,\n private _options: TransitionOptions = {}\n ) {\n this._params = _params || {};\n }\n\n /** The name of the state this object targets */\n name(): string {\n return this._definition && this._definition.name || this._identifier;\n }\n\n /** The identifier used when creating this TargetState */\n identifier(): StateOrName {\n return this._identifier;\n }\n\n /** The target parameter values */\n params(): ParamsOrArray {\n return this._params;\n }\n\n /** The internal state object (if it was found) */\n $state(): StateObject {\n return this._definition;\n }\n\n /** The internal state declaration (if it was found) */\n state(): StateDeclaration {\n return this._definition && this._definition.self;\n }\n\n /** The target options */\n options() {\n return this._options;\n }\n\n /** True if the target state was found */\n exists(): boolean {\n return !!(this._definition && this._definition.self);\n }\n\n /** True if the object is valid */\n valid(): boolean {\n return !this.error();\n }\n\n /** If the object is invalid, returns the reason why */\n error(): string {\n let base = this.options().relative;\n if (!this._definition && !!base) {\n let stateName = base.name ? base.name : base;\n return `Could not resolve '${this.name()}' from state '${stateName}'`;\n }\n if (!this._definition)\n return `No such state '${this.name()}'`;\n if (!this._definition.self)\n return `State '${this.name()}' has an invalid definition`;\n }\n\n toString() {\n return `'${this.name()}'${toJson(this.params())}`;\n }\n\n /** Returns true if the object has a state property that might be a state or state name */\n static isDef = (obj): obj is TargetStateDef =>\n obj && obj.state && (isString(obj.state) || isString(obj.state.name));\n\n // /** Returns a new TargetState based on this one, but using the specified options */\n // withOptions(_options: TransitionOptions): TargetState {\n // return extend(this._clone(), { _options });\n // }\n //\n // /** Returns a new TargetState based on this one, but using the specified params */\n // withParams(_params: ParamsOrArray): TargetState {\n // return extend(this._clone(), { _params });\n // }\n\n // private _clone = () =>\n // new TargetState(this._identifier, this._definition, this._params, this._options);\n}\n","/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport { TransitionHookOptions, HookResult, TransitionHookPhase } from './interface';\nimport { defaults, noop, silentRejection } from '../common/common';\nimport { fnToString, maxLength } from '../common/strings';\nimport { isPromise } from '../common/predicates';\nimport { is, parse } from '../common/hof';\nimport { trace } from '../common/trace';\nimport { services } from '../common/coreservices';\nimport { Rejection } from './rejectFactory';\nimport { TargetState } from '../state/targetState';\nimport { Transition } from './transition';\nimport { TransitionEventType } from './transitionEventType';\nimport { RegisteredHook } from './hookRegistry';\nimport { StateDeclaration } from '../state/interface';\n\nlet defaultOptions: TransitionHookOptions = {\n current: noop,\n transition: null,\n traceData: {},\n bind: null,\n};\n\nexport type GetResultHandler = (hook: TransitionHook) => ResultHandler;\nexport type GetErrorHandler = (hook: TransitionHook) => ErrorHandler;\n\nexport type ResultHandler = (result: HookResult) => Promise;\nexport type ErrorHandler = (error: any) => Promise;\n\n/** @hidden */\nexport class TransitionHook {\n type: TransitionEventType;\n constructor(private transition: Transition,\n private stateContext: StateDeclaration,\n private registeredHook: RegisteredHook,\n private options: TransitionHookOptions) {\n this.options = defaults(options, defaultOptions);\n this.type = registeredHook.eventType;\n }\n\n /**\n * These GetResultHandler(s) are used by [[invokeHook]] below\n * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]])\n */\n static HANDLE_RESULT: GetResultHandler = (hook: TransitionHook) => (result: HookResult) =>\n hook.handleHookResult(result);\n\n /**\n * If the result is a promise rejection, log it.\n * Otherwise, ignore the result.\n */\n static LOG_REJECTED_RESULT: GetResultHandler = (hook: TransitionHook) => (result: HookResult) => {\n isPromise(result) && result.catch(err =>\n hook.logError(Rejection.normalize(err)));\n return undefined;\n }\n\n /**\n * These GetErrorHandler(s) are used by [[invokeHook]] below\n * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]])\n */\n static LOG_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) =>\n hook.logError(error);\n\n static REJECT_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) =>\n silentRejection(error);\n\n static THROW_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) => {\n throw error;\n }\n\n private isSuperseded = () =>\n this.type.hookPhase === TransitionHookPhase.RUN && !this.options.transition.isActive();\n\n logError(err): any {\n this.transition.router.stateService.defaultErrorHandler()(err);\n }\n\n invokeHook(): Promise | void {\n let hook = this.registeredHook;\n if (hook._deregistered) return;\n\n let notCurrent = this.getNotCurrentRejection();\n if (notCurrent) return notCurrent;\n\n let options = this.options;\n trace.traceHookInvocation(this, this.transition, options);\n\n const invokeCallback = () =>\n hook.callback.call(options.bind, this.transition, this.stateContext);\n\n const normalizeErr = err =>\n Rejection.normalize(err).toPromise();\n\n const handleError = err =>\n hook.eventType.getErrorHandler(this)(err);\n\n const handleResult = result =>\n hook.eventType.getResultHandler(this)(result);\n\n try {\n let result = invokeCallback();\n\n if (!this.type.synchronous && isPromise(result)) {\n return result.catch(normalizeErr)\n .then(handleResult, handleError);\n } else {\n return handleResult(result);\n }\n } catch (err) {\n // If callback throws (synchronously)\n return handleError(Rejection.normalize(err));\n }\n }\n\n /**\n * This method handles the return value of a Transition Hook.\n *\n * A hook can return false (cancel), a TargetState (redirect),\n * or a promise (which may later resolve to false or a redirect)\n *\n * This also handles \"transition superseded\" -- when a new transition\n * was started while the hook was still running\n */\n handleHookResult(result: HookResult): Promise {\n let notCurrent = this.getNotCurrentRejection();\n if (notCurrent) return notCurrent;\n\n // Hook returned a promise\n if (isPromise(result)) {\n // Wait for the promise, then reprocess with the resulting value\n return result.then(val => this.handleHookResult(val));\n }\n\n trace.traceHookResult(result, this.transition, this.options);\n\n // Hook returned false\n if (result === false) {\n // Abort this Transition\n return Rejection.aborted(\"Hook aborted transition\").toPromise();\n }\n\n const isTargetState = is(TargetState);\n // hook returned a TargetState\n if (isTargetState(result)) {\n // Halt the current Transition and redirect (a new Transition) to the TargetState.\n return Rejection.redirected(result).toPromise();\n }\n }\n\n\n /**\n * Return a Rejection promise if the transition is no longer current due\n * to a stopped router (disposed), or a new transition has started and superseded this one.\n */\n private getNotCurrentRejection() {\n let router = this.transition.router;\n\n // The router is stopped\n if (router._disposed) {\n return Rejection.aborted(`UIRouter instance #${router.$id} has been stopped (disposed)`).toPromise();\n }\n\n if (this.transition._aborted) {\n return Rejection.aborted().toPromise();\n }\n\n // This transition is no longer current.\n // Another transition started while this hook was still running.\n if (this.isSuperseded()) {\n // Abort this transition\n return Rejection.superseded(this.options.current()).toPromise();\n }\n }\n\n toString() {\n let { options, registeredHook } = this;\n let event = parse(\"traceData.hookType\")(options) || \"internal\",\n context = parse(\"traceData.context.state.name\")(options) || parse(\"traceData.context\")(options) || \"unknown\",\n name = fnToString(registeredHook.callback);\n return `${event} context: ${context}, ${maxLength(200, name)}`;\n }\n\n /**\n * Chains together an array of TransitionHooks.\n *\n * Given a list of [[TransitionHook]] objects, chains them together.\n * Each hook is invoked after the previous one completes.\n *\n * #### Example:\n * ```js\n * var hooks: TransitionHook[] = getHooks();\n * let promise: Promise = TransitionHook.chain(hooks);\n *\n * promise.then(handleSuccess, handleError);\n * ```\n *\n * @param hooks the list of hooks to chain together\n * @param waitFor if provided, the chain is `.then()`'ed off this promise\n * @returns a `Promise` for sequentially invoking the hooks (in order)\n */\n static chain(hooks: TransitionHook[], waitFor?: Promise): Promise {\n // Chain the next hook off the previous\n const createHookChainR = (prev: Promise, nextHook: TransitionHook) =>\n prev.then(() => nextHook.invokeHook());\n return hooks.reduce(createHookChainR, waitFor || services.$q.when());\n }\n\n\n /**\n * Invokes all the provided TransitionHooks, in order.\n * Each hook's return value is checked.\n * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned.\n * If no hook returns a promise, then all hooks are processed synchronously.\n *\n * @param hooks the list of TransitionHooks to invoke\n * @param doneCallback a callback that is invoked after all the hooks have successfully completed\n *\n * @returns a promise for the async result, or the result of the callback\n */\n static invokeHooks(hooks: TransitionHook[], doneCallback: (result?: HookResult) => T): Promise | T {\n for (let idx = 0; idx < hooks.length; idx++) {\n let hookResult = hooks[idx].invokeHook();\n\n if (isPromise(hookResult)) {\n let remainingHooks = hooks.slice(idx + 1);\n\n return TransitionHook.chain(remainingHooks, hookResult)\n .then(doneCallback);\n }\n }\n\n return doneCallback();\n }\n\n /**\n * Run all TransitionHooks, ignoring their return value.\n */\n static runAllHooks(hooks: TransitionHook[]): void {\n hooks.forEach(hook => hook.invokeHook());\n }\n\n}","/** @module path */ /** for typedoc */\nimport {extend, applyPairs, find, allTrueR, pairs, arrayTuples} from \"../common/common\";\nimport {propEq} from \"../common/hof\";\nimport {StateObject} from \"../state/stateObject\";\nimport {RawParams} from \"../params/interface\";\nimport {Param} from \"../params/param\";\nimport {Resolvable} from \"../resolve/resolvable\";\nimport {ViewConfig} from \"../view/interface\";\n\n/**\n * @internalapi\n *\n * A node in a [[TreeChanges]] path\n *\n * For a [[TreeChanges]] path, this class holds the stateful information for a single node in the path.\n * Each PathNode corresponds to a state being entered, exited, or retained.\n * The stateful information includes parameter values and resolve data.\n */\nexport class PathNode {\n /** The state being entered, exited, or retained */\n public state: StateObject;\n /** The parameters declared on the state */\n public paramSchema: Param[];\n /** The parameter values that belong to the state */\n public paramValues: { [key: string]: any };\n /** The individual (stateful) resolvable objects that belong to the state */\n public resolvables: Resolvable[];\n /** The state's declared view configuration objects */\n public views: ViewConfig[];\n\n /** Creates a copy of a PathNode */\n constructor(node: PathNode);\n /** Creates a new (empty) PathNode for a State */\n constructor(state: StateObject);\n constructor(stateOrNode: any) {\n if (stateOrNode instanceof PathNode) {\n let node: PathNode = stateOrNode;\n this.state = node.state;\n this.paramSchema = node.paramSchema.slice();\n this.paramValues = extend({}, node.paramValues);\n this.resolvables = node.resolvables.slice();\n this.views = node.views && node.views.slice();\n } else {\n let state: StateObject = stateOrNode;\n this.state = state;\n this.paramSchema = state.parameters({ inherit: false });\n this.paramValues = {};\n this.resolvables = state.resolvables.map(res => res.clone());\n }\n }\n\n /** Sets [[paramValues]] for the node, from the values of an object hash */\n applyRawParams(params: RawParams): PathNode {\n const getParamVal = (paramDef: Param) => [ paramDef.id, paramDef.value(params[paramDef.id]) ];\n this.paramValues = this.paramSchema.reduce((memo, pDef) => applyPairs(memo, getParamVal(pDef)), {});\n return this;\n }\n\n /** Gets a specific [[Param]] metadata that belongs to the node */\n parameter(name: string): Param {\n return find(this.paramSchema, propEq(\"id\", name));\n }\n\n /**\n * @returns true if the state and parameter values for another PathNode are\n * equal to the state and param values for this PathNode\n */\n equals(node: PathNode, paramsFn?: GetParamsFn): boolean {\n const diff = this.diff(node, paramsFn);\n return diff && diff.length === 0;\n }\n\n /**\n * Finds Params with different parameter values on another PathNode.\n *\n * Given another node (of the same state), finds the parameter values which differ.\n * Returns the [[Param]] (schema objects) whose parameter values differ.\n *\n * Given another node for a different state, returns `false`\n *\n * @param node The node to compare to\n * @param paramsFn A function that returns which parameters should be compared.\n * @returns The [[Param]]s which differ, or null if the two nodes are for different states\n */\n diff(node: PathNode, paramsFn?: GetParamsFn): Param[] | false {\n if (this.state !== node.state) return false;\n\n const params: Param[] = paramsFn ? paramsFn(this) : this.paramSchema;\n return Param.changed(params, this.paramValues, node.paramValues);\n }\n\n /** Returns a clone of the PathNode */\n static clone(node: PathNode) {\n return new PathNode(node);\n }\n}\n\n/** @hidden */\nexport type GetParamsFn = (pathNode: PathNode) => Param[];","/** @module path */ /** for typedoc */\n\nimport {\n extend, find, pick, omit, tail, mergeR, values, unnestR, Predicate, inArray, arrayTuples,\n} from \"../common/common\";\nimport {prop, propEq, not} from \"../common/hof\";\n\nimport {RawParams} from \"../params/interface\";\nimport {TreeChanges} from \"../transition/interface\";\nimport {ViewConfig} from \"../view/interface\";\nimport {_ViewDeclaration} from \"../state/interface\";\n\nimport {StateObject} from \"../state/stateObject\";\nimport {TargetState} from \"../state/targetState\";\nimport {GetParamsFn, PathNode} from \"./pathNode\";\nimport {ViewService} from \"../view/view\";\nimport { Param } from '../params/param';\n\n/**\n * This class contains functions which convert TargetStates, Nodes and paths from one type to another.\n */\nexport class PathUtils {\n\n constructor() { }\n\n /** Given a PathNode[], create an TargetState */\n static makeTargetState(path: PathNode[]): TargetState {\n let state = tail(path).state;\n return new TargetState(state, state, path.map(prop(\"paramValues\")).reduce(mergeR, {}));\n }\n\n static buildPath(targetState: TargetState) {\n let toParams = targetState.params();\n return targetState.$state().path.map(state => new PathNode(state).applyRawParams(toParams));\n }\n\n /** Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[] */\n static buildToPath(fromPath: PathNode[], targetState: TargetState): PathNode[] {\n let toPath: PathNode[] = PathUtils.buildPath(targetState);\n if (targetState.options().inherit) {\n return PathUtils.inheritParams(fromPath, toPath, Object.keys(targetState.params()));\n }\n return toPath;\n }\n\n /**\n * Creates ViewConfig objects and adds to nodes.\n *\n * On each [[PathNode]], creates ViewConfig objects from the views: property of the node's state\n */\n static applyViewConfigs($view: ViewService, path: PathNode[], states: StateObject[]) {\n // Only apply the viewConfigs to the nodes for the given states\n path.filter(node => inArray(states, node.state)).forEach(node => {\n let viewDecls: _ViewDeclaration[] = values(node.state.views || {});\n let subPath = PathUtils.subPath(path, n => n === node);\n let viewConfigs: ViewConfig[][] = viewDecls.map(view => $view.createViewConfig(subPath, view));\n node.views = viewConfigs.reduce(unnestR, []);\n });\n }\n\n /**\n * Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath\n *\n * For a parameter in a node to be inherited from the from path:\n * - The toPath's node must have a matching node in the fromPath (by state).\n * - The parameter name must not be found in the toKeys parameter array.\n *\n * Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some\n * caller, for instance, $state.transitionTo(..., toParams). If a key was found in toParams,\n * it is not inherited from the fromPath.\n */\n static inheritParams(fromPath: PathNode[], toPath: PathNode[], toKeys: string[] = []): PathNode[] {\n function nodeParamVals(path: PathNode[], state: StateObject): RawParams {\n let node: PathNode = find(path, propEq('state', state));\n return extend({}, node && node.paramValues);\n }\n\n let noInherit = fromPath.map(node => node.paramSchema)\n .reduce(unnestR, [])\n .filter(param => !param.inherit)\n .map(prop('id'));\n\n /**\n * Given an [[PathNode]] \"toNode\", return a new [[PathNode]] with param values inherited from the\n * matching node in fromPath. Only inherit keys that aren't found in \"toKeys\" from the node in \"fromPath\"\"\n */\n function makeInheritedParamsNode(toNode: PathNode): PathNode {\n // All param values for the node (may include default key/vals, when key was not found in toParams)\n let toParamVals = extend({}, toNode && toNode.paramValues);\n // limited to only those keys found in toParams\n let incomingParamVals = pick(toParamVals, toKeys);\n toParamVals = omit(toParamVals, toKeys);\n let fromParamVals = omit(nodeParamVals(fromPath, toNode.state) || {}, noInherit);\n // extend toParamVals with any fromParamVals, then override any of those those with incomingParamVals\n let ownParamVals: RawParams = extend(toParamVals, fromParamVals, incomingParamVals);\n return new PathNode(toNode.state).applyRawParams(ownParamVals);\n }\n\n // The param keys specified by the incoming toParams\n return toPath.map(makeInheritedParamsNode);\n }\n\n static nonDynamicParams = (node: PathNode): Param[] =>\n node.state.parameters({ inherit: false })\n .filter(param => !param.dynamic);\n\n /**\n * Computes the tree changes (entering, exiting) between a fromPath and toPath.\n */\n static treeChanges(fromPath: PathNode[], toPath: PathNode[], reloadState: StateObject): TreeChanges {\n let keep = 0, max = Math.min(fromPath.length, toPath.length);\n\n const nodesMatch = (node1: PathNode, node2: PathNode) =>\n node1.equals(node2, PathUtils.nonDynamicParams);\n\n while (keep < max && fromPath[keep].state !== reloadState && nodesMatch(fromPath[keep], toPath[keep])) {\n keep++;\n }\n\n /** Given a retained node, return a new node which uses the to node's param values */\n function applyToParams(retainedNode: PathNode, idx: number): PathNode {\n let cloned = PathNode.clone(retainedNode);\n cloned.paramValues = toPath[idx].paramValues;\n return cloned;\n }\n\n let from: PathNode[], retained: PathNode[], exiting: PathNode[], entering: PathNode[], to: PathNode[];\n\n from = fromPath;\n retained = from.slice(0, keep);\n exiting = from.slice(keep);\n\n // Create a new retained path (with shallow copies of nodes) which have the params of the toPath mapped\n let retainedWithToParams = retained.map(applyToParams);\n entering = toPath.slice(keep);\n to = (retainedWithToParams).concat(entering);\n\n return { from, to, retained, exiting, entering };\n }\n\n /**\n * Returns a new path which is: the subpath of the first path which matches the second path.\n *\n * The new path starts from root and contains any nodes that match the nodes in the second path.\n * It stops before the first non-matching node.\n *\n * Nodes are compared using their state property and their parameter values.\n * If a `paramsFn` is provided, only the [[Param]] returned by the function will be considered when comparing nodes.\n *\n * @param pathA the first path\n * @param pathB the second path\n * @param paramsFn a function which returns the parameters to consider when comparing\n *\n * @returns an array of PathNodes from the first path which match the nodes in the second path\n */\n static matching(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): PathNode[] {\n let done = false;\n let tuples: PathNode[][] = arrayTuples(pathA, pathB);\n return tuples.reduce((matching, [nodeA, nodeB]) => {\n done = done || !nodeA.equals(nodeB, paramsFn);\n return done ? matching : matching.concat(nodeA);\n }, []);\n }\n\n /**\n * Returns true if two paths are identical.\n *\n * @param pathA\n * @param pathB\n * @param paramsFn a function which returns the parameters to consider when comparing\n * @returns true if the the states and parameter values for both paths are identical\n */\n static equals(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): boolean {\n return pathA.length === pathB.length &&\n PathUtils.matching(pathA, pathB, paramsFn).length === pathA.length;\n }\n\n /**\n * Return a subpath of a path, which stops at the first matching node\n *\n * Given an array of nodes, returns a subset of the array starting from the first node,\n * stopping when the first node matches the predicate.\n *\n * @param path a path of [[PathNode]]s\n * @param predicate a [[Predicate]] fn that matches [[PathNode]]s\n * @returns a subpath up to the matching node, or undefined if no match is found\n */\n static subPath(path: PathNode[], predicate: Predicate): PathNode[] {\n let node = find(path, predicate);\n let elementIdx = path.indexOf(node);\n return elementIdx === -1 ? undefined : path.slice(0, elementIdx + 1);\n }\n\n /** Gets the raw parameter values from a path */\n static paramValues = (path: PathNode[]) =>\n path.reduce((acc, node) => extend(acc, node.paramValues), {});\n}\n","/**\n * @coreapi\n * @module resolve\n */ /** for typedoc */\nimport {extend, equals, inArray, identity} from \"../common/common\";\nimport {services} from \"../common/coreservices\";\nimport {trace} from \"../common/trace\";\nimport {ResolvePolicy, ResolvableLiteral, resolvePolicies} from \"./interface\";\n\nimport {ResolveContext} from \"./resolveContext\";\nimport {stringify} from \"../common/strings\";\nimport {isFunction, isObject} from \"../common/predicates\";\nimport {Transition} from \"../transition/transition\";\nimport {StateObject} from \"../state/stateObject\";\nimport {PathNode} from \"../path/pathNode\";\nimport { isNullOrUndefined } from '../common';\n\n\n// TODO: explicitly make this user configurable\nexport let defaultResolvePolicy: ResolvePolicy = {\n when: \"LAZY\",\n async: \"WAIT\"\n};\n\n/**\n * The basic building block for the resolve system.\n *\n * Resolvables encapsulate a state's resolve's resolveFn, the resolveFn's declared dependencies, the wrapped (.promise),\n * and the unwrapped-when-complete (.data) result of the resolveFn.\n *\n * Resolvable.get() either retrieves the Resolvable's existing promise, or else invokes resolve() (which invokes the\n * resolveFn) and returns the resulting promise.\n *\n * Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first\n * parameter to those fns.\n */\nexport class Resolvable implements ResolvableLiteral {\n token: any;\n policy: ResolvePolicy;\n resolveFn: Function;\n deps: any[];\n\n data: any;\n resolved: boolean = false;\n promise: Promise = undefined;\n\n /** This constructor creates a Resolvable copy */\n constructor(resolvable: Resolvable)\n\n /** This constructor creates a new Resolvable from the plain old [[ResolvableLiteral]] javascript object */\n constructor(resolvable: ResolvableLiteral)\n\n /**\n * This constructor creates a new `Resolvable`\n *\n * #### Example:\n * ```js\n * var resolvable1 = new Resolvable('mytoken', http => http.get('foo.json').toPromise(), [Http]);\n *\n * var resolvable2 = new Resolvable(UserService, dep => new UserService(dep.data), [SomeDependency]);\n *\n * var resolvable1Clone = new Resolvable(resolvable1);\n * ```\n *\n * @param token The new resolvable's injection token, such as `\"userList\"` (a string) or `UserService` (a class).\n * When this token is used during injection, the resolved value will be injected.\n * @param resolveFn The function that returns the resolved value, or a promise for the resolved value\n * @param deps An array of dependencies, which will be injected into the `resolveFn`\n * @param policy the [[ResolvePolicy]] defines when and how the Resolvable is processed\n * @param data Pre-resolved data. If the resolve value is already known, it may be provided here.\n */\n constructor(token: any, resolveFn: Function, deps?: any[], policy?: ResolvePolicy, data?: any)\n constructor(arg1: any, resolveFn?: Function, deps?: any[], policy?: ResolvePolicy, data?: any) {\n if (arg1 instanceof Resolvable) {\n extend(this, arg1);\n } else if (isFunction(resolveFn)) {\n if (isNullOrUndefined(arg1)) throw new Error(\"new Resolvable(): token argument is required\");\n if (!isFunction(resolveFn)) throw new Error(\"new Resolvable(): resolveFn argument must be a function\");\n\n this.token = arg1;\n this.policy = policy;\n this.resolveFn = resolveFn;\n this.deps = deps || [];\n\n this.data = data;\n this.resolved = data !== undefined;\n this.promise = this.resolved ? services.$q.when(this.data) : undefined;\n } else if (isObject(arg1) && arg1.token && isFunction(arg1.resolveFn)) {\n let literal = arg1;\n return new Resolvable(literal.token, literal.resolveFn, literal.deps, literal.policy, literal.data);\n }\n }\n\n getPolicy(state: StateObject): ResolvePolicy {\n let thisPolicy = this.policy || {};\n let statePolicy = state && state.resolvePolicy || {};\n return {\n when: thisPolicy.when || statePolicy.when || defaultResolvePolicy.when,\n async: thisPolicy.async || statePolicy.async || defaultResolvePolicy.async,\n };\n }\n\n /**\n * Asynchronously resolve this Resolvable's data\n *\n * Given a ResolveContext that this Resolvable is found in:\n * Wait for this Resolvable's dependencies, then invoke this Resolvable's function\n * and update the Resolvable's state\n */\n resolve(resolveContext: ResolveContext, trans?: Transition) {\n let $q = services.$q;\n\n // Gets all dependencies from ResolveContext and wait for them to be resolved\n const getResolvableDependencies = () =>\n $q.all(resolveContext.getDependencies(this).map(resolvable =>\n resolvable.get(resolveContext, trans))) as Promise;\n\n // Invokes the resolve function passing the resolved dependencies as arguments\n const invokeResolveFn = (resolvedDeps: any[]) =>\n this.resolveFn.apply(null, resolvedDeps);\n\n /**\n * For RXWAIT policy:\n *\n * Given an observable returned from a resolve function:\n * - enables .cache() mode (this allows multicast subscribers)\n * - then calls toPromise() (this triggers subscribe() and thus fetches)\n * - Waits for the promise, then return the cached observable (not the first emitted value).\n */\n const waitForRx = (observable$: any) => {\n let cached = observable$.cache(1);\n return cached.take(1).toPromise().then(() => cached);\n };\n\n // If the resolve policy is RXWAIT, wait for the observable to emit something. otherwise pass through.\n let node: PathNode = resolveContext.findNode(this);\n let state: StateObject = node && node.state;\n let maybeWaitForRx = this.getPolicy(state).async === \"RXWAIT\" ? waitForRx : identity;\n\n // After the final value has been resolved, update the state of the Resolvable\n const applyResolvedValue = (resolvedValue: any) => {\n this.data = resolvedValue;\n this.resolved = true;\n trace.traceResolvableResolved(this, trans);\n return this.data;\n };\n\n // Sets the promise property first, then getsResolvableDependencies in the context of the promise chain. Always waits one tick.\n return this.promise = $q.when()\n .then(getResolvableDependencies)\n .then(invokeResolveFn)\n .then(maybeWaitForRx)\n .then(applyResolvedValue);\n }\n\n /**\n * Gets a promise for this Resolvable's data.\n *\n * Fetches the data and returns a promise.\n * Returns the existing promise if it has already been fetched once.\n */\n get(resolveContext: ResolveContext, trans?: Transition): Promise {\n return this.promise || this.resolve(resolveContext, trans);\n }\n\n toString() {\n return `Resolvable(token: ${stringify(this.token)}, requires: [${this.deps.map(stringify)}])`;\n }\n\n clone(): Resolvable {\n return new Resolvable(this);\n }\n \n static fromData = (token: any, data: any) => \n new Resolvable(token, () => data, null, null, data);\n}\n","/**\n * # The Resolve subsystem\n *\n * This subsystem is an asynchronous, hierarchical Dependency Injection system.\n *\n * Typically, resolve is configured on a state using a [[StateDeclaration.resolve]] declaration.\n *\n * @coreapi\n * @module resolve\n */ /** for typedoc */\nimport {Resolvable} from \"./resolvable\";\n\n/**\n * An interface which is similar to an Angular 2 `Provider`\n */\nexport interface ProviderLike {\n provide: any,\n useClass?: any,\n useFactory?: Function,\n useValue?: any,\n useExisting?: any,\n deps?: any[]\n}\n\n/**\n * A plain object used to describe a [[Resolvable]]\n *\n * These objects may be used in the [[StateDeclaration.resolve]] array to declare\n * async data that the state or substates require.\n *\n * #### Example:\n * ```js\n *\n * var state = {\n * name: 'main',\n * resolve: [\n * { token: 'myData', deps: [MyDataApi], resolveFn: (myDataApi) => myDataApi.getData() },\n * ],\n * }\n * ```\n */\nexport interface ResolvableLiteral {\n /**\n * A Dependency Injection token\n *\n * This Resolvable's DI token.\n * The Resolvable will be injectable elsewhere using the token.\n */\n token: any;\n\n /**\n * A function which fetches the Resolvable's data\n *\n * A function which returns one of:\n *\n * - The resolved value (synchronously)\n * - A promise for the resolved value\n * - An Observable of the resolved value(s)\n *\n * This function will be provided the dependencies listed in [[deps]] as its arguments.\n * The resolve system will asynchronously fetch the dependencies before invoking this function.\n */\n resolveFn: Function;\n\n /**\n * Defines the Resolve Policy\n *\n * A policy that defines when to invoke the resolve,\n * and whether to wait for async and unwrap the data\n */\n policy?: ResolvePolicy;\n\n /**\n * The Dependency Injection tokens\n *\n * This is an array of Dependency Injection tokens for the dependencies of the [[resolveFn]].\n *\n * The DI tokens are references to other `Resolvables`, or to other\n * services from the native DI system.\n */\n deps?: any[];\n\n /** Pre-resolved data. */\n data?: any\n}\n\n/**\n * Defines how a resolve is processed during a transition\n *\n * This object is the [[StateDeclaration.resolvePolicy]] property.\n *\n * #### Example:\n * ```js\n * // Fetched when the resolve's state is being entered.\n * // Wait for the promise to resolve.\n * var policy1 = { when: \"LAZY\", async: \"WAIT\" }\n *\n * // Fetched when the Transition is starting.\n * // Do not wait for the returned promise to resolve.\n * // Inject the raw promise/value\n * var policy2 = { when: \"EAGER\", async: \"NOWAIT\" }\n * ```\n *\n * The policy for a given Resolvable is merged from three sources (highest priority first):\n *\n * - 1) Individual resolve definition\n * - 2) State definition\n * - 3) Global default\n *\n * #### Example:\n * ```js\n * // Wait for an Observable to emit one item.\n * // Since `wait` is not specified, it uses the `wait`\n * // policy defined on the state, or the global default\n * // if no `wait` policy is defined on the state\n * var myResolvablePolicy = { async: \"RXWAIT\" }\n * ```\n */\nexport interface ResolvePolicy {\n /**\n * Defines when a Resolvable is resolved (fetched) during a transition\n *\n * - `LAZY` (default)\n * - Resolved as the resolve's state is being entered\n * - `EAGER`\n * - Resolved as the transition is starting\n *\n * #### Example:\n * Resolves for `main` and `main.home` are fetched when each state is entered.\n * All of `main` resolves are processed before fetching `main.home` resolves.\n * ```js\n * var state = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { when: 'LAZY' }, // default\n * }\n *\n * var state = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { when: 'LAZY' }, // default\n * }\n * ```\n *\n * #### Example:\n * Resolves for `main` and `main.home` are fetched at the same time when the transition starts.\n * This happens earlier in the lifecycle than when states are entered.\n * All of the `main` and `main.home` resolves are fetched as soon as possible.\n * ```js\n * var mainState = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { when: 'EAGER' },\n * }\n *\n * var homeState = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { when: 'EAGER' },\n * }\n * ```\n */\n when?: PolicyWhen;\n\n /**\n * Determines the unwrapping behavior of asynchronous resolve values.\n *\n * - `WAIT` (default)\n * - If a promise is returned from the resolveFn, wait for the promise before proceeding\n * - The unwrapped value from the promise\n * - `NOWAIT`\n * - If a promise is returned from the resolve, do not wait for the promise.\n * - Any other value returned is wrapped in a promise.\n * - The promise will not be unwrapped.\n * - The promise itself will be provided when the resolve is injected or bound elsewhere.\n * - `RXWAIT`\n * - When an Observable is returned from the resolveFn, wait until the Observable emits at least one item.\n * - The Observable item will not be unwrapped.\n * - The Observable stream itself will be provided when the resolve is injected or bound elsewhere.\n *\n * #### Example:\n * The `Transition` will not wait for the resolve promise(s) from `main` to settle before continuing.\n * Resolves for `main` will be provided to components wrapped in a `Promise`.\n *\n * The `Transition` will wait for the `main.home` resolve promises.\n * Resolved values will be unwrapped before being provided to components.\n * ```js\n * var mainState = {\n * name: 'main',\n * resolve: mainResolves, // defined elsewhere\n * resolvePolicy: { async: 'NOWAIT' },\n * }\n * var homeState = {\n * name: 'main.home',\n * resolve: homeResolves, // defined elsewhere\n * resolvePolicy: { async: 'WAIT' }, // default\n * }\n * ```\n */\n async?: PolicyAsync;\n}\n\nexport type PolicyWhen = \"LAZY\" | \"EAGER\" ;\nexport type PolicyAsync = \"WAIT\" | \"NOWAIT\" | \"RXWAIT\" ;\n\n/** @internalapi */\nexport let resolvePolicies = {\n when: {\n LAZY: \"LAZY\",\n EAGER: \"EAGER\"\n },\n async: {\n WAIT: \"WAIT\",\n NOWAIT: \"NOWAIT\",\n RXWAIT: \"RXWAIT\"\n }\n};\n","/** @module resolve */\n/** for typedoc */\nimport { find, tail, uniqR, unnestR, inArray } from \"../common/common\";\nimport { propEq, not } from \"../common/hof\";\nimport { trace } from \"../common/trace\";\nimport { services, $InjectorLike } from \"../common/coreservices\";\nimport { resolvePolicies, PolicyWhen, ResolvePolicy } from \"./interface\";\nimport { PathNode } from \"../path/pathNode\";\nimport { Resolvable } from \"./resolvable\";\nimport { StateObject } from \"../state/stateObject\";\nimport { PathUtils } from \"../path/pathFactory\";\nimport { stringify } from \"../common/strings\";\nimport { Transition } from \"../transition/transition\";\nimport { UIInjector } from \"../interface\";\n\nconst when = resolvePolicies.when;\nconst ALL_WHENS = [when.EAGER, when.LAZY];\nconst EAGER_WHENS = [when.EAGER];\n\nexport const NATIVE_INJECTOR_TOKEN: string = \"Native Injector\";\n\n/**\n * Encapsulates Dependency Injection for a path of nodes\n *\n * UI-Router states are organized as a tree.\n * A nested state has a path of ancestors to the root of the tree.\n * When a state is being activated, each element in the path is wrapped as a [[PathNode]].\n * A `PathNode` is a stateful object that holds things like parameters and resolvables for the state being activated.\n *\n * The ResolveContext closes over the [[PathNode]]s, and provides DI for the last node in the path.\n */\nexport class ResolveContext {\n _injector: UIInjector;\n\n constructor(private _path: PathNode[]) { }\n\n /** Gets all the tokens found in the resolve context, de-duplicated */\n getTokens(): any[] {\n return this._path.reduce((acc, node) => acc.concat(node.resolvables.map(r => r.token)), []).reduce(uniqR, []);\n }\n\n /**\n * Gets the Resolvable that matches the token\n *\n * Gets the last Resolvable that matches the token in this context, or undefined.\n * Throws an error if it doesn't exist in the ResolveContext\n */\n getResolvable(token: any): Resolvable {\n let matching = this._path.map(node => node.resolvables)\n .reduce(unnestR, [])\n .filter((r: Resolvable) => r.token === token);\n return tail(matching);\n }\n\n /** Returns the [[ResolvePolicy]] for the given [[Resolvable]] */\n getPolicy(resolvable: Resolvable): ResolvePolicy {\n let node = this.findNode(resolvable);\n return resolvable.getPolicy(node.state);\n }\n\n /**\n * Returns a ResolveContext that includes a portion of this one\n *\n * Given a state, this method creates a new ResolveContext from this one.\n * The new context starts at the first node (root) and stops at the node for the `state` parameter.\n *\n * #### Why\n *\n * When a transition is created, the nodes in the \"To Path\" are injected from a ResolveContext.\n * A ResolveContext closes over a path of [[PathNode]]s and processes the resolvables.\n * The \"To State\" can inject values from its own resolvables, as well as those from all its ancestor state's (node's).\n * This method is used to create a narrower context when injecting ancestor nodes.\n *\n * @example\n * `let ABCD = new ResolveContext([A, B, C, D]);`\n *\n * Given a path `[A, B, C, D]`, where `A`, `B`, `C` and `D` are nodes for states `a`, `b`, `c`, `d`:\n * When injecting `D`, `D` should have access to all resolvables from `A`, `B`, `C`, `D`.\n * However, `B` should only be able to access resolvables from `A`, `B`.\n *\n * When resolving for the `B` node, first take the full \"To Path\" Context `[A,B,C,D]` and limit to the subpath `[A,B]`.\n * `let AB = ABCD.subcontext(a)`\n */\n subContext(state: StateObject): ResolveContext {\n return new ResolveContext(PathUtils.subPath(this._path, node => node.state === state));\n }\n\n /**\n * Adds Resolvables to the node that matches the state\n *\n * This adds a [[Resolvable]] (generally one created on the fly; not declared on a [[StateDeclaration.resolve]] block).\n * The resolvable is added to the node matching the `state` parameter.\n *\n * These new resolvables are not automatically fetched.\n * The calling code should either fetch them, fetch something that depends on them,\n * or rely on [[resolvePath]] being called when some state is being entered.\n *\n * Note: each resolvable's [[ResolvePolicy]] is merged with the state's policy, and the global default.\n *\n * @param newResolvables the new Resolvables\n * @param state Used to find the node to put the resolvable on\n */\n addResolvables(newResolvables: Resolvable[], state: StateObject) {\n let node = find(this._path, propEq('state', state));\n let keys = newResolvables.map(r => r.token);\n node.resolvables = node.resolvables.filter(r => keys.indexOf(r.token) === -1).concat(newResolvables);\n }\n \n /**\n * Returns a promise for an array of resolved path Element promises\n *\n * @param when\n * @param trans\n * @returns {Promise|any}\n */\n resolvePath(when: PolicyWhen = \"LAZY\", trans?: Transition): Promise<{ token: any, value: any }[]> {\n // This option determines which 'when' policy Resolvables we are about to fetch.\n let whenOption: string = inArray(ALL_WHENS, when) ? when : \"LAZY\";\n // If the caller specified EAGER, only the EAGER Resolvables are fetched.\n // if the caller specified LAZY, both EAGER and LAZY Resolvables are fetched.`\n let matchedWhens = whenOption === resolvePolicies.when.EAGER ? EAGER_WHENS : ALL_WHENS;\n \n // get the subpath to the state argument, if provided\n trace.traceResolvePath(this._path, when, trans);\n\n const matchesPolicy = (acceptedVals: string[], whenOrAsync: \"when\"|\"async\") =>\n (resolvable: Resolvable) =>\n inArray(acceptedVals, this.getPolicy(resolvable)[whenOrAsync]);\n\n // Trigger all the (matching) Resolvables in the path\n // Reduce all the \"WAIT\" Resolvables into an array\n let promises: Promise[] = this._path.reduce((acc, node) => {\n let nodeResolvables = node.resolvables.filter(matchesPolicy(matchedWhens, 'when'));\n let nowait = nodeResolvables.filter(matchesPolicy(['NOWAIT'], 'async'));\n let wait = nodeResolvables.filter(not(matchesPolicy(['NOWAIT'], 'async')));\n\n // For the matching Resolvables, start their async fetch process.\n let subContext = this.subContext(node.state);\n let getResult = (r: Resolvable) => r.get(subContext, trans)\n // Return a tuple that includes the Resolvable's token\n .then(value => ({ token: r.token, value: value }));\n nowait.forEach(getResult);\n return acc.concat(wait.map(getResult));\n }, []);\n\n // Wait for all the \"WAIT\" resolvables\n return services.$q.all(promises);\n }\n\n injector(): UIInjector {\n return this._injector || (this._injector = new UIInjectorImpl(this));\n }\n\n findNode(resolvable: Resolvable): PathNode {\n return find(this._path, (node: PathNode) => inArray(node.resolvables, resolvable));\n }\n\n /**\n * Gets the async dependencies of a Resolvable\n *\n * Given a Resolvable, returns its dependencies as a Resolvable[]\n */\n getDependencies(resolvable: Resolvable): Resolvable[] {\n let node = this.findNode(resolvable);\n // Find which other resolvables are \"visible\" to the `resolvable` argument\n // subpath stopping at resolvable's node, or the whole path (if the resolvable isn't in the path)\n let subPath: PathNode[] = PathUtils.subPath(this._path, x => x === node) || this._path;\n let availableResolvables: Resolvable[] = subPath\n .reduce((acc, node) => acc.concat(node.resolvables), []) //all of subpath's resolvables\n .filter(res => res !== resolvable); // filter out the `resolvable` argument\n\n const getDependency = (token: any) => {\n let matching = availableResolvables.filter(r => r.token === token);\n if (matching.length) return tail(matching);\n\n let fromInjector = this.injector().getNative(token);\n if (!fromInjector) {\n throw new Error(\"Could not find Dependency Injection token: \" + stringify(token));\n }\n\n return new Resolvable(token, () => fromInjector, [], fromInjector);\n };\n\n return resolvable.deps.map(getDependency);\n }\n}\n\nclass UIInjectorImpl implements UIInjector {\n native: $InjectorLike;\n\n constructor(public context: ResolveContext) {\n this.native = this.get(NATIVE_INJECTOR_TOKEN) || services.$injector;\n }\n\n get(token: any) {\n let resolvable = this.context.getResolvable(token);\n if (resolvable) {\n if (this.context.getPolicy(resolvable).async === 'NOWAIT') {\n return resolvable.get(this.context);\n }\n\n if (!resolvable.resolved) {\n throw new Error(\"Resolvable async .get() not complete:\" + stringify(resolvable.token))\n }\n return resolvable.data;\n }\n return this.native && this.native.get(token);\n }\n\n getAsync(token: any) {\n let resolvable = this.context.getResolvable(token);\n if (resolvable) return resolvable.get(this.context);\n return services.$q.when(this.native.get(token));\n }\n\n getNative(token: any) {\n return this.native && this.native.get(token);\n }\n}","/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport { trace } from '../common/trace';\nimport { services } from '../common/coreservices';\nimport {\n map, find, extend, mergeR, tail, omit, toJson, arrayTuples, unnestR, identity, anyTrueR,\n} from '../common/common';\nimport {isObject, isUndefined} from '../common/predicates';\nimport { prop, propEq, val, not, is } from '../common/hof';\nimport { StateDeclaration, StateOrName } from '../state/interface';\nimport {\n TransitionOptions, TreeChanges, IHookRegistry, TransitionHookPhase, RegisteredHooks, HookRegOptions,\n HookMatchCriteria, TransitionStateHookFn, TransitionHookFn,\n} from './interface'; // has or is using\nimport { TransitionHook } from './transitionHook';\nimport { matchState, makeEvent, RegisteredHook } from './hookRegistry';\nimport { HookBuilder } from './hookBuilder';\nimport { PathNode } from '../path/pathNode';\nimport { PathUtils } from '../path/pathFactory';\nimport { StateObject } from '../state/stateObject';\nimport { TargetState } from '../state/targetState';\nimport { Param } from '../params/param';\nimport { Resolvable } from '../resolve/resolvable';\nimport { ViewConfig } from '../view/interface';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { UIRouter } from '../router';\nimport { UIInjector } from '../interface';\nimport { RawParams } from '../params/interface';\nimport { ResolvableLiteral } from '../resolve/interface';\n\n/** @hidden */\nconst stateSelf: (_state: StateObject) => StateDeclaration = prop(\"self\");\n\n/**\n * Represents a transition between two states.\n *\n * When navigating to a state, we are transitioning **from** the current state **to** the new state.\n *\n * This object contains all contextual information about the to/from states, parameters, resolves.\n * It has information about all states being entered and exited as a result of the transition.\n */\nexport class Transition implements IHookRegistry {\n\n /** @hidden */\n static diToken = Transition;\n\n /**\n * A unique identifier for the transition.\n *\n * This is an auto incrementing integer, starting from `0`.\n */\n $id: number;\n\n /**\n * A reference to the [[UIRouter]] instance\n *\n * This reference can be used to access the router services, such as the [[StateService]]\n */\n router: UIRouter;\n\n /** @hidden */\n private _deferred = services.$q.defer();\n /**\n * This promise is resolved or rejected based on the outcome of the Transition.\n *\n * When the transition is successful, the promise is resolved\n * When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error\n */\n promise: Promise = this._deferred.promise;\n /**\n * A boolean which indicates if the transition was successful\n *\n * After a successful transition, this value is set to true.\n * After an unsuccessful transition, this value is set to false.\n *\n * The value will be undefined if the transition is not complete\n */\n success: boolean;\n /** @hidden */\n _aborted: boolean;\n /** @hidden */\n private _error: any;\n\n /** @hidden Holds the hook registration functions such as those passed to Transition.onStart() */\n _registeredHooks: RegisteredHooks = { };\n\n /** @hidden */\n private _options: TransitionOptions;\n /** @hidden */\n private _treeChanges: TreeChanges;\n /** @hidden */\n private _targetState: TargetState;\n /** @hidden */\n private _hookBuilder = new HookBuilder(this);\n\n\n /** @hidden */\n onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n /** @inheritdoc */\n onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return; }\n\n /** @hidden\n * Creates the transition-level hook registration functions\n * (which can then be used to register hooks)\n */\n private createTransitionHookRegFns() {\n this.router.transitionService._pluginapi._getEvents()\n .filter(type => type.hookPhase !== TransitionHookPhase.CREATE)\n .forEach(type => makeEvent(this, this.router.transitionService, type));\n }\n\n /** @internalapi */\n getHooks(hookName: string): RegisteredHook[] {\n return this._registeredHooks[hookName];\n }\n\n /**\n * Creates a new Transition object.\n *\n * If the target state is not valid, an error is thrown.\n *\n * @internalapi\n *\n * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`\n * encapsulates the \"from state\".\n * @param targetState The target state and parameters being transitioned to (also, the transition options)\n * @param router The [[UIRouter]] instance\n */\n constructor(fromPath: PathNode[], targetState: TargetState, router: UIRouter) {\n this.router = router;\n this._targetState = targetState;\n\n if (!targetState.valid()) {\n throw new Error(targetState.error());\n }\n\n // current() is assumed to come from targetState.options, but provide a naive implementation otherwise.\n this._options = extend({ current: val(this) }, targetState.options());\n this.$id = router.transitionService._transitionCount++;\n let toPath = PathUtils.buildToPath(fromPath, targetState);\n this._treeChanges = PathUtils.treeChanges(fromPath, toPath, this._options.reloadState);\n this.createTransitionHookRegFns();\n\n let onCreateHooks = this._hookBuilder.buildHooksForPhase(TransitionHookPhase.CREATE);\n TransitionHook.invokeHooks(onCreateHooks, () => null);\n\n this.applyViewConfigs(router);\n }\n\n private applyViewConfigs(router: UIRouter) {\n let enteringStates = this._treeChanges.entering.map(node => node.state);\n PathUtils.applyViewConfigs(router.transitionService.$view, this._treeChanges.to, enteringStates);\n }\n\n /**\n * @internalapi\n *\n * @returns the internal from [State] object\n */\n $from() {\n return tail(this._treeChanges.from).state;\n }\n\n /**\n * @internalapi\n *\n * @returns the internal to [State] object\n */\n $to() {\n return tail(this._treeChanges.to).state;\n }\n\n /**\n * Returns the \"from state\"\n *\n * Returns the state that the transition is coming *from*.\n *\n * @returns The state declaration object for the Transition's (\"from state\").\n */\n from(): StateDeclaration {\n return this.$from().self;\n }\n\n /**\n * Returns the \"to state\"\n *\n * Returns the state that the transition is going *to*.\n *\n * @returns The state declaration object for the Transition's target state (\"to state\").\n */\n to(): StateDeclaration {\n return this.$to().self;\n }\n\n /**\n * Gets the Target State\n *\n * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object.\n *\n * @returns the [[TargetState]] of this Transition\n */\n targetState() {\n return this._targetState;\n }\n\n /**\n * Determines whether two transitions are equivalent.\n * @deprecated\n */\n is(compare: (Transition|{to?: any, from?: any})): boolean {\n if (compare instanceof Transition) {\n // TODO: Also compare parameters\n return this.is({ to: compare.$to().name, from: compare.$from().name });\n }\n return !(\n (compare.to && !matchState(this.$to(), compare.to)) ||\n (compare.from && !matchState(this.$from(), compare.from))\n );\n }\n\n /**\n * Gets transition parameter values\n *\n * Returns the parameter values for a transition as key/value pairs.\n * This object is immutable.\n *\n * By default, returns the new parameter values (for the \"to state\").\n * To return the previous parameter values, supply `'from'` as the `pathname` argument.\n *\n * @param pathname the name of the treeChanges path to get parameter values for:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n *\n * @returns transition parameter values for the desired path.\n */\n params(pathname?: string): any;\n params(pathname?: string): T;\n params(pathname: string = \"to\") {\n return Object.freeze(this._treeChanges[pathname].map(prop(\"paramValues\")).reduce(mergeR, {}));\n }\n\n\n /**\n * Creates a [[UIInjector]] Dependency Injector\n *\n * Returns a Dependency Injector for the Transition's target state (to state).\n * The injector provides resolve values which the target state has access to.\n *\n * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2).\n *\n * #### Example:\n * ```js\n * .onEnter({ entering: 'myState' }, trans => {\n * var myResolveValue = trans.injector().get('myResolve');\n * // Inject a global service from the global/native injector (if it exists)\n * var MyService = trans.injector().get('MyService');\n * })\n * ```\n *\n * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched.\n * You can use [[UIInjector.getAsync]] to get a promise for the data.\n * #### Example:\n * ```js\n * .onBefore({}, trans => {\n * return trans.injector().getAsync('myResolve').then(myResolveValue =>\n * return myResolveValue !== 'ABORT';\n * });\n * });\n * ```\n *\n * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to.\n * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`.\n * #### Example:\n * ```js\n * .onEnter({ to: 'foo.bar' }, trans => {\n * // returns result of `foo` state's `data` resolve\n * // even though `foo.bar` also has a `data` resolve\n * var fooData = trans.injector('foo').get('data');\n * });\n * ```\n *\n * If you need resolve data from the exiting states, pass `'from'` as `pathName`.\n * The resolve data from the `from` path will be returned.\n * #### Example:\n * ```js\n * .onExit({ exiting: 'foo.bar' }, trans => {\n * // Gets the resolve value of `data` from the exiting state.\n * var fooData = trans.injector(null, 'foo.bar').get('data');\n * });\n * ```\n *\n *\n * @param state Limits the resolves provided to only the resolves the provided state has access to.\n * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states.\n *\n * @returns a [[UIInjector]]\n */\n injector(state?: StateOrName, pathName = \"to\"): UIInjector {\n let path: PathNode[] = this._treeChanges[pathName];\n if (state) path = PathUtils.subPath(path, node => node.state === state || node.state.name === state);\n return new ResolveContext(path).injector();\n }\n\n /**\n * Gets all available resolve tokens (keys)\n *\n * This method can be used in conjunction with [[injector]] to inspect the resolve values\n * available to the Transition.\n *\n * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states\n * in the Transition's [[TreeChanges.to]] path.\n *\n * #### Example:\n * This example logs all resolve values\n * ```js\n * let tokens = trans.getResolveTokens();\n * tokens.forEach(token => console.log(token + \" = \" + trans.injector().get(token)));\n * ```\n *\n * #### Example:\n * This example creates promises for each resolve value.\n * This triggers fetches of resolves (if any have not yet been fetched).\n * When all promises have all settled, it logs the resolve values.\n * ```js\n * let tokens = trans.getResolveTokens();\n * let promise = tokens.map(token => trans.injector().getAsync(token));\n * Promise.all(promises).then(values => console.log(\"Resolved values: \" + values));\n * ```\n *\n * Note: Angular 1 users whould use `$q.all()`\n *\n * @param pathname resolve context's path name (e.g., `to` or `from`)\n *\n * @returns an array of resolve tokens (keys)\n */\n getResolveTokens(pathname: string = \"to\"): any[] {\n return new ResolveContext(this._treeChanges[pathname]).getTokens();\n }\n\n /**\n * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition.\n *\n * #### Example:\n * ```js\n * transitionService.onBefore({}, transition => {\n * transition.addResolvable({\n * token: 'myResolve',\n * deps: ['MyService'],\n * resolveFn: myService => myService.getData()\n * });\n * });\n * ```\n *\n * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]])\n * @param state the state in the \"to path\" which should receive the new resolve (otherwise, the root state)\n */\n addResolvable(resolvable: Resolvable|ResolvableLiteral, state: StateOrName = \"\"): void {\n resolvable = is(Resolvable)(resolvable) ? resolvable : new Resolvable(resolvable);\n\n let stateName: string = (typeof state === \"string\") ? state : state.name;\n let topath = this._treeChanges.to;\n let targetNode = find(topath, node => node.state.name === stateName);\n let resolveContext: ResolveContext = new ResolveContext(topath);\n resolveContext.addResolvables([resolvable as Resolvable], targetNode.state);\n }\n\n /**\n * Gets the transition from which this transition was redirected.\n *\n * If the current transition is a redirect, this method returns the transition that was redirected.\n *\n * #### Example:\n * ```js\n * let transitionA = $state.go('A').transition\n * transitionA.onStart({}, () => $state.target('B'));\n * $transitions.onSuccess({ to: 'B' }, (trans) => {\n * trans.to().name === 'B'; // true\n * trans.redirectedFrom() === transitionA; // true\n * });\n * ```\n *\n * @returns The previous Transition, or null if this Transition is not the result of a redirection\n */\n redirectedFrom(): Transition {\n return this._options.redirectedFrom || null;\n }\n\n /**\n * Gets the original transition in a redirect chain\n *\n * A transition might belong to a long chain of multiple redirects.\n * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain.\n *\n * #### Example:\n * ```js\n * // states\n * registry.register({ name: 'A', redirectTo: 'B' });\n * registry.register({ name: 'B', redirectTo: 'C' });\n * registry.register({ name: 'C', redirectTo: 'D' });\n * registry.register({ name: 'D' });\n *\n * let transitionA = $state.go('A').transition\n *\n * $transitions.onSuccess({ to: 'D' }, (trans) => {\n * trans.to().name === 'D'; // true\n * trans.redirectedFrom().to().name === 'C'; // true\n * trans.originalTransition() === transitionA; // true\n * trans.originalTransition().to().name === 'A'; // true\n * });\n * ```\n *\n * @returns The original Transition that started a redirect chain\n */\n originalTransition(): Transition {\n let rf = this.redirectedFrom();\n return (rf && rf.originalTransition()) || this;\n }\n\n /**\n * Get the transition options\n *\n * @returns the options for this Transition.\n */\n options(): TransitionOptions {\n return this._options;\n }\n\n /**\n * Gets the states being entered.\n *\n * @returns an array of states that will be entered during this transition.\n */\n entering(): StateDeclaration[] {\n return map(this._treeChanges.entering, prop('state')).map(stateSelf);\n }\n\n /**\n * Gets the states being exited.\n *\n * @returns an array of states that will be exited during this transition.\n */\n exiting(): StateDeclaration[] {\n return map(this._treeChanges.exiting, prop('state')).map(stateSelf).reverse();\n }\n\n /**\n * Gets the states being retained.\n *\n * @returns an array of states that are already entered from a previous Transition, that will not be\n * exited during this Transition\n */\n retained(): StateDeclaration[] {\n return map(this._treeChanges.retained, prop('state')).map(stateSelf);\n }\n\n /**\n * Get the [[ViewConfig]]s associated with this Transition\n *\n * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects.\n * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., \"to\" or \"entering\").\n *\n * @param pathname the name of the path to fetch views for:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n * @param state If provided, only returns the `ViewConfig`s for a single state in the path\n *\n * @returns a list of ViewConfig objects for the given path.\n */\n views(pathname: string = \"entering\", state?: StateObject): ViewConfig[] {\n let path = this._treeChanges[pathname];\n path = !state ? path : path.filter(propEq('state', state));\n return path.map(prop(\"views\")).filter(identity).reduce(unnestR, []);\n }\n\n /**\n * Return the transition's tree changes\n *\n * A transition goes from one state/parameters to another state/parameters.\n * During a transition, states are entered and/or exited.\n *\n * This function returns various branches (paths) which represent the changes to the\n * active state tree that are caused by the transition.\n *\n * @param pathname The name of the tree changes path to get:\n * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n */\n treeChanges(pathname: string): PathNode[];\n treeChanges(): TreeChanges;\n treeChanges(pathname?: string) {\n return pathname ? this._treeChanges[pathname] : this._treeChanges;\n }\n\n /**\n * Creates a new transition that is a redirection of the current one.\n *\n * This transition can be returned from a [[TransitionService]] hook to\n * redirect a transition to a new state and/or set of parameters.\n *\n * @internalapi\n *\n * @returns Returns a new [[Transition]] instance.\n */\n redirect(targetState: TargetState): Transition {\n let redirects = 1, trans: Transition = this;\n while ((trans = trans.redirectedFrom()) != null) {\n if (++redirects > 20) throw new Error(`Too many consecutive Transition redirects (20+)`);\n }\n\n let redirectOpts: TransitionOptions = { redirectedFrom: this, source: \"redirect\" };\n // If the original transition was caused by URL sync, then use { location: 'replace' }\n // on the new transition (unless the target state explicitly specifies location: false).\n // This causes the original url to be replaced with the url for the redirect target\n // so the original url disappears from the browser history.\n if (this.options().source === 'url' && targetState.options().location !== false) {\n redirectOpts.location = 'replace';\n }\n\n let newOptions = extend({}, this.options(), targetState.options(), redirectOpts);\n\n targetState = new TargetState(targetState.identifier(), targetState.$state(), targetState.params(), newOptions);\n\n let newTransition = this.router.transitionService.create(this._treeChanges.from, targetState);\n let originalEnteringNodes = this._treeChanges.entering;\n let redirectEnteringNodes = newTransition._treeChanges.entering;\n\n // --- Re-use resolve data from original transition ---\n // When redirecting from a parent state to a child state where the parent parameter values haven't changed\n // (because of the redirect), the resolves fetched by the original transition are still valid in the\n // redirected transition.\n //\n // This allows you to define a redirect on a parent state which depends on an async resolve value.\n // You can wait for the resolve, then redirect to a child state based on the result.\n // The redirected transition does not have to re-fetch the resolve.\n // ---------------------------------------------------------\n\n const nodeIsReloading = (reloadState: StateObject) => (node: PathNode) => {\n return reloadState && node.state.includes[reloadState.name];\n };\n\n // Find any \"entering\" nodes in the redirect path that match the original path and aren't being reloaded\n let matchingEnteringNodes: PathNode[] = PathUtils.matching(redirectEnteringNodes, originalEnteringNodes, PathUtils.nonDynamicParams)\n .filter(not(nodeIsReloading(targetState.options().reloadState)));\n\n // Use the existing (possibly pre-resolved) resolvables for the matching entering nodes.\n matchingEnteringNodes.forEach((node, idx) => {\n node.resolvables = originalEnteringNodes[idx].resolvables;\n });\n\n return newTransition;\n }\n\n /** @hidden If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */\n private _changedParams(): Param[] {\n let tc = this._treeChanges;\n\n /** Return undefined if it's not a \"dynamic\" transition, for the following reasons */\n // If user explicitly wants a reload\n if (this._options.reload) return undefined;\n // If any states are exiting or entering\n if (tc.exiting.length || tc.entering.length) return undefined;\n // If to/from path lengths differ\n if (tc.to.length !== tc.from.length) return undefined;\n // If the to/from paths are different\n let pathsDiffer: boolean = arrayTuples(tc.to, tc.from)\n .map(tuple => tuple[0].state !== tuple[1].state)\n .reduce(anyTrueR, false);\n if (pathsDiffer) return undefined;\n\n // Find any parameter values that differ\n let nodeSchemas: Param[][] = tc.to.map((node: PathNode) => node.paramSchema);\n let [toValues, fromValues] = [tc.to, tc.from].map(path => path.map(x => x.paramValues));\n let tuples = arrayTuples(nodeSchemas, toValues, fromValues);\n\n return tuples.map(([schema, toVals, fromVals]) => Param.changed(schema, toVals, fromVals)).reduce(unnestR, []);\n }\n\n /**\n * Returns true if the transition is dynamic.\n *\n * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed.\n *\n * @returns true if the Transition is dynamic\n */\n dynamic(): boolean {\n let changes = this._changedParams();\n return !changes ? false : changes.map(x => x.dynamic).reduce(anyTrueR, false);\n }\n\n /**\n * Returns true if the transition is ignored.\n *\n * A transition is ignored if no states are entered nor exited, and no parameter values have changed.\n *\n * @returns true if the Transition is ignored.\n */\n ignored(): boolean {\n return !!this._ignoredReason();\n }\n\n /** @hidden */\n _ignoredReason(): \"SameAsCurrent\"|\"SameAsPending\"|undefined {\n const pending = this.router.globals.transition;\n const reloadState = this._options.reloadState;\n\n const same = (pathA, pathB) => {\n if (pathA.length !== pathB.length) return false;\n const matching = PathUtils.matching(pathA, pathB);\n return pathA.length === matching.filter(node => !reloadState || !node.state.includes[reloadState.name]).length;\n };\n\n let newTC = this.treeChanges();\n let pendTC = pending && pending.treeChanges();\n\n if (pendTC && same(pendTC.to, newTC.to) && same(pendTC.exiting, newTC.exiting)) return \"SameAsPending\";\n if (newTC.exiting.length === 0 && newTC.entering.length === 0 && same(newTC.from, newTC.to)) return \"SameAsCurrent\";\n }\n\n /**\n * Runs the transition\n *\n * This method is generally called from the [[StateService.transitionTo]]\n *\n * @internalapi\n *\n * @returns a promise for a successful transition.\n */\n run(): Promise {\n let runAllHooks = TransitionHook.runAllHooks;\n\n // Gets transition hooks array for the given phase\n const getHooksFor = (phase: TransitionHookPhase) =>\n this._hookBuilder.buildHooksForPhase(phase);\n\n // When the chain is complete, then resolve or reject the deferred\n const transitionSuccess = () => {\n trace.traceSuccess(this.$to(), this);\n this.success = true;\n this._deferred.resolve(this.to());\n runAllHooks(getHooksFor(TransitionHookPhase.SUCCESS));\n };\n\n const transitionError = (reason: any) => {\n trace.traceError(reason, this);\n this.success = false;\n this._deferred.reject(reason);\n this._error = reason;\n runAllHooks(getHooksFor(TransitionHookPhase.ERROR));\n };\n\n const runTransition = () => {\n // Wait to build the RUN hook chain until the BEFORE hooks are done\n // This allows a BEFORE hook to dynamically add additional RUN hooks via the Transition object.\n let allRunHooks = getHooksFor(TransitionHookPhase.RUN);\n let done = () => services.$q.when(undefined);\n return TransitionHook.invokeHooks(allRunHooks, done);\n };\n\n const startTransition = () => {\n let globals = this.router.globals;\n\n globals.lastStartedTransitionId = this.$id;\n globals.transition = this;\n globals.transitionHistory.enqueue(this);\n\n trace.traceTransitionStart(this);\n\n return services.$q.when(undefined);\n };\n\n let allBeforeHooks = getHooksFor(TransitionHookPhase.BEFORE);\n TransitionHook.invokeHooks(allBeforeHooks, startTransition)\n .then(runTransition)\n .then(transitionSuccess, transitionError);\n\n return this.promise;\n }\n\n /** Checks if this transition is currently active/running. */\n isActive = () =>\n this.router.globals.transition === this;\n\n /**\n * Checks if the Transition is valid\n *\n * @returns true if the Transition is valid\n */\n valid() {\n return !this.error() || this.success !== undefined;\n }\n\n /**\n * Aborts this transition\n *\n * Imperative API to abort a Transition.\n * This only applies to Transitions that are not yet complete.\n */\n abort() {\n // Do not set flag if the transition is already complete\n if (isUndefined(this.success)) {\n this._aborted = true;\n }\n }\n\n /**\n * The Transition error reason.\n *\n * If the transition is invalid (and could not be run), returns the reason the transition is invalid.\n * If the transition was valid and ran, but was not successful, returns the reason the transition failed.\n *\n * @returns an error message explaining why the transition is invalid, or the reason the transition failed.\n */\n error() {\n let state: StateObject = this.$to();\n\n if (state.self.abstract)\n return `Cannot transition to abstract state '${state.name}'`;\n\n const paramDefs = state.parameters(), values = this.params();\n const invalidParams = paramDefs.filter(param => !param.validates(values[param.id]));\n if (invalidParams.length) {\n return `Param values not valid for state '${state.name}'. Invalid params: [ ${invalidParams.map(param => param.id).join(', ')} ]`;\n }\n\n if (this.success === false)\n return this._error;\n }\n\n /**\n * A string representation of the Transition\n *\n * @returns A string representation of the Transition\n */\n toString () {\n let fromStateOrName = this.from();\n let toStateOrName = this.to();\n\n const avoidEmptyHash = (params: RawParams) =>\n (params[\"#\"] !== null && params[\"#\"] !== undefined) ? params : omit(params, [\"#\"]);\n\n // (X) means the to state is invalid.\n let id = this.$id,\n from = isObject(fromStateOrName) ? fromStateOrName.name : fromStateOrName,\n fromParams = toJson(avoidEmptyHash(this._treeChanges.from.map(prop('paramValues')).reduce(mergeR, {}))),\n toValid = this.valid() ? \"\" : \"(X) \",\n to = isObject(toStateOrName) ? toStateOrName.name : toStateOrName,\n toParams = toJson(avoidEmptyHash(this.params()));\n\n return `Transition#${id}( '${from}'${fromParams} -> ${toValid}'${to}'${toParams} )`;\n }\n}\n","/**\n * @coreapi\n * @module params\n */\n/** */\nimport { fromJson, toJson, identity, equals, inherit, map, extend, pick } from \"../common/common\";\nimport { isDefined, isNullOrUndefined } from \"../common/predicates\";\nimport { is } from \"../common/hof\";\nimport { services } from \"../common/coreservices\";\nimport { ParamType } from \"./paramType\";\nimport { ParamTypeDefinition } from \"./interface\";\n\n/**\n * A registry for parameter types.\n *\n * This registry manages the built-in (and custom) parameter types.\n *\n * The built-in parameter types are:\n *\n * - [[string]]\n * - [[path]]\n * - [[query]]\n * - [[hash]]\n * - [[int]]\n * - [[bool]]\n * - [[date]]\n * - [[json]]\n * - [[any]]\n */\nexport class ParamTypes {\n /** @hidden */\n types: any;\n /** @hidden */\n enqueue: boolean = true;\n /** @hidden */\n typeQueue: any[] = [];\n\n /**\n * Built-in parameter type: `string`\n *\n * This parameter type coerces values to strings.\n * It matches anything (`new RegExp(\".*\")`) in the URL\n */\n static string: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `path`\n *\n * This parameter type is the default type for path parameters.\n * A path parameter is any parameter declared in the path portion of a url\n *\n * - `/foo/:param1/:param2`: two path parameters\n *\n * This parameter type behaves exactly like the [[string]] type with one exception.\n * When matching parameter values in the URL, the `path` type does not match forward slashes `/`.\n *\n * #### Angular 1 note:\n * In ng1, this type is overridden with one that pre-encodes slashes as `~2F` instead of `%2F`.\n * For more details about this angular 1 behavior, see: https://github.com/angular-ui/ui-router/issues/2598\n */\n static path: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `query`\n *\n * This parameter type is the default type for query/search parameters.\n * It behaves the same as the [[string]] parameter type.\n *\n * A query parameter is any parameter declared in the query/search portion of a url\n *\n * - `/bar?param2`: a query parameter\n */\n static query: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `hash`\n *\n * This parameter type is used for the `#` parameter (the hash)\n * It behaves the same as the [[string]] parameter type.\n * @coreapi\n */\n static hash: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `int`\n *\n * This parameter type serializes javascript integers (`number`s which represent an integer) to the URL.\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'user',\n * url: '/user/{id:int}'\n * });\n * ```\n * ```js\n * $state.go('user', { id: 1298547 });\n * ```\n *\n * The URL will serialize to: `/user/1298547`.\n *\n * When the parameter value is read, it will be the `number` `1298547`, not the string `\"1298547\"`.\n */\n static int: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `bool`\n *\n * This parameter type serializes `true`/`false` as `1`/`0`\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'inbox',\n * url: '/inbox?{unread:bool}'\n * });\n * ```\n * ```js\n * $state.go('inbox', { unread: true });\n * ```\n *\n * The URL will serialize to: `/inbox?unread=1`.\n *\n * Conversely, if the url is `/inbox?unread=0`, the value of the `unread` parameter will be a `false`.\n */\n static bool: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `date`\n *\n * This parameter type can be used to serialize Javascript dates as parameter values.\n *\n * #### Example:\n * ```js\n * .state({\n * name: 'search',\n * url: '/search?{start:date}'\n * });\n * ```\n * ```js\n * $state.go('search', { start: new Date(2000, 0, 1) });\n * ```\n *\n * The URL will serialize to: `/search?start=2000-01-01`.\n *\n * Conversely, if the url is `/search?start=2016-12-25`, the value of the `start` parameter will be a `Date` object where:\n *\n * - `date.getFullYear() === 2016`\n * - `date.getMonth() === 11` (month is 0-based)\n * - `date.getDate() === 25`\n */\n static date: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `json`\n *\n * This parameter type can be used to serialize javascript objects into the URL using JSON serialization.\n *\n * #### Example:\n * This example serializes an plain javascript object to the URL\n * ```js\n * .state({\n * name: 'map',\n * url: '/map/{coords:json}'\n * });\n * ```\n * ```js\n * $state.go('map', { coords: { x: 10399.2, y: 49071 });\n * ```\n *\n * The URL will serialize to: `/map/%7B%22x%22%3A10399.2%2C%22y%22%3A49071%7D`\n */\n static json: ParamTypeDefinition;\n\n /**\n * Built-in parameter type: `any`\n *\n * This parameter type is used by default for url-less parameters (parameters that do not appear in the URL).\n * This type does not encode or decode.\n * It is compared using a deep `equals` comparison.\n *\n * #### Example:\n * This example defines a non-url parameter on a [[StateDeclaration]].\n * ```js\n * .state({\n * name: 'new',\n * url: '/new',\n * params: {\n * inrepyto: null\n * }\n * });\n * ```\n * ```js\n * $state.go('new', { inreplyto: currentMessage });\n * ```\n */\n static any: ParamTypeDefinition;\n\n\n /** @internalapi */\n private defaultTypes: any = pick(ParamTypes.prototype, [\"hash\", \"string\", \"query\", \"path\", \"int\", \"bool\", \"date\", \"json\", \"any\"]);\n\n /** @internalapi */\n constructor() {\n // Register default types. Store them in the prototype of this.types.\n const makeType = (definition: ParamTypeDefinition, name: string) =>\n new ParamType(extend({ name }, definition));\n this.types = inherit(map(this.defaultTypes, makeType), {});\n }\n\n /** @internalapi */\n dispose() {\n this.types = {};\n }\n\n /**\n * Registers a parameter type\n *\n * End users should call [[UrlMatcherFactory.type]], which delegates to this method.\n */\n type(name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {\n if (!isDefined(definition)) return this.types[name];\n if (this.types.hasOwnProperty(name)) throw new Error(`A type named '${name}' has already been defined.`);\n\n this.types[name] = new ParamType(extend({ name }, definition));\n\n if (definitionFn) {\n this.typeQueue.push({ name, def: definitionFn });\n if (!this.enqueue) this._flushTypeQueue();\n }\n\n return this;\n }\n\n /** @internalapi */\n _flushTypeQueue() {\n while (this.typeQueue.length) {\n let type = this.typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n extend(this.types[type.name], services.$injector.invoke(type.def));\n }\n }\n}\n\n/** @hidden */\nfunction initDefaultTypes() {\n\n const makeDefaultType = (def) => {\n const valToString = (val: any) =>\n val != null ? val.toString() : val;\n\n const defaultTypeBase = {\n encode: valToString,\n decode: valToString,\n is: is(String),\n pattern: /.*/,\n equals: (a: any, b: any) => a == b, // allow coersion for null/undefined/\"\"\n };\n\n return extend({}, defaultTypeBase, def) as ParamTypeDefinition;\n };\n\n // Default Parameter Type Definitions\n extend(ParamTypes.prototype, {\n string: makeDefaultType({}),\n\n path: makeDefaultType({\n pattern: /[^/]*/,\n }),\n\n query: makeDefaultType({}),\n\n hash: makeDefaultType({\n inherit: false,\n }),\n\n int: makeDefaultType({\n decode: (val: string) => parseInt(val, 10),\n is: function(val: any) {\n return !isNullOrUndefined(val) && this.decode(val.toString()) === val;\n },\n pattern: /-?\\d+/,\n }),\n\n bool: makeDefaultType({\n encode: (val: any) => val && 1 || 0,\n decode: (val: string) => parseInt(val, 10) !== 0,\n is: is(Boolean),\n pattern: /0|1/\n }),\n\n date: makeDefaultType({\n encode: function(val: any) {\n return !this.is(val) ? undefined : [\n val.getFullYear(),\n ('0' + (val.getMonth() + 1)).slice(-2),\n ('0' + val.getDate()).slice(-2)\n ].join(\"-\");\n },\n decode: function(val: string) {\n if (this.is(val)) return val as Date;\n let match = this.capture.exec(val);\n return match ? new Date(match[1], match[2] - 1, match[3]) : undefined;\n },\n is: (val: any) => val instanceof Date && !isNaN(val.valueOf()),\n equals(l: any, r: any) {\n return ['getFullYear', 'getMonth', 'getDate']\n .reduce((acc, fn) => acc && l[fn]() === r[fn](), true)\n },\n pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,\n capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/\n }),\n\n json: makeDefaultType({\n encode: toJson,\n decode: fromJson,\n is: is(Object),\n equals: equals,\n pattern: /[^/]*/\n }),\n\n // does not encode/decode\n any: makeDefaultType({\n encode: identity,\n decode: identity,\n is: () => true,\n equals: equals,\n }),\n })\n\n}\n\ninitDefaultTypes();\n\n","/**\n * @coreapi\n * @module params\n */\n/** */\nimport {extend, ancestors, Obj} from \"../common/common\";\nimport {StateObject} from \"../state/stateObject\";\n\n/** @internalapi */\nexport class StateParams {\n [key: string]: any;\n\n constructor(params: Obj = {}) {\n extend(this, params);\n }\n\n /**\n * Merges a set of parameters with all parameters inherited between the common parents of the\n * current state and a given destination state.\n *\n * @param {Object} newParams The set of parameters which will be composited with inherited params.\n * @param {Object} $current Internal definition of object representing the current state.\n * @param {Object} $to Internal definition of object representing state to transition to.\n */\n $inherit(newParams: Obj, $current: StateObject, $to: StateObject) {\n let parents = ancestors($current, $to),\n parentParams: string[],\n inherited: Obj = {},\n inheritList: string[] = [];\n\n for (let i in parents) {\n if (!parents[i] || !parents[i].params) continue;\n parentParams = Object.keys(parents[i].params);\n if (!parentParams.length) continue;\n\n for (let j in parentParams) {\n if (inheritList.indexOf(parentParams[j]) >= 0) continue;\n inheritList.push(parentParams[j]);\n inherited[parentParams[j]] = this[parentParams[j]];\n }\n }\n return extend({}, inherited, newParams);\n };\n}\n\n","/** @module state */ /** for typedoc */\nimport {isString} from \"../common/predicates\";\nimport {StateOrName} from \"./interface\";\nimport {StateObject} from \"./stateObject\";\nimport {values} from \"../common/common\";\n\nexport class StateMatcher {\n constructor (private _states: { [key: string]: StateObject }) { }\n \n isRelative(stateName: string) {\n stateName = stateName || \"\";\n return stateName.indexOf(\".\") === 0 || stateName.indexOf(\"^\") === 0;\n }\n\n\n find(stateOrName: StateOrName, base?: StateOrName, matchGlob = true): StateObject {\n if (!stateOrName && stateOrName !== \"\") return undefined;\n let isStr = isString(stateOrName);\n let name: string = isStr ? stateOrName : (stateOrName).name;\n\n if (this.isRelative(name)) name = this.resolvePath(name, base);\n let state = this._states[name];\n\n if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {\n return state;\n } else if (isStr && matchGlob) {\n let _states = values(this._states);\n let matches = _states.filter(state =>\n state.__stateObjectCache.nameGlob &&\n state.__stateObjectCache.nameGlob.matches(name)\n );\n\n if (matches.length > 1) {\n console.log(`stateMatcher.find: Found multiple matches for ${name} using glob: `, matches.map(match => match.name));\n }\n return matches[0];\n }\n return undefined;\n }\n\n resolvePath(name: string, base: StateOrName) {\n if (!base) throw new Error(`No reference point given for path '${name}'`);\n \n let baseState: StateObject = this.find(base);\n\n let splitName = name.split(\".\"), i = 0, pathLength = splitName.length, current = baseState;\n\n for (; i < pathLength; i++) {\n if (splitName[i] === \"\" && i === 0) {\n current = baseState;\n continue;\n }\n if (splitName[i] === \"^\") {\n if (!current.parent) throw new Error(`Path '${name}' not valid for state '${baseState.name}'`);\n current = current.parent;\n continue;\n }\n break;\n }\n let relName = splitName.slice(i).join(\".\");\n return current.name + (current.name && relName ? \".\" : \"\") + relName;\n }\n}\n","/** @module state */ /** for typedoc */\nimport { inArray } from \"../common/common\";\nimport { isString } from \"../common/predicates\";\nimport { StateDeclaration, _StateDeclaration } from \"./interface\";\nimport { StateObject } from \"./stateObject\";\nimport { StateBuilder } from \"./stateBuilder\";\nimport { StateRegistryListener, StateRegistry } from \"./stateRegistry\";\nimport { Disposable } from \"../interface\";\nimport { UrlRouter } from \"../url/urlRouter\";\nimport { prop } from \"../common/hof\";\nimport { StateMatcher } from \"./stateMatcher\";\n\n/** @internalapi */\nexport class StateQueueManager implements Disposable {\n queue: StateObject[];\n matcher: StateMatcher;\n\n constructor(\n private $registry: StateRegistry,\n private $urlRouter: UrlRouter,\n public states: { [key: string]: StateObject; },\n public builder: StateBuilder,\n public listeners: StateRegistryListener[]) {\n this.queue = [];\n this.matcher = $registry.matcher;\n }\n\n /** @internalapi */\n dispose() {\n this.queue = [];\n }\n\n register(stateDecl: _StateDeclaration) {\n let queue = this.queue;\n let state = StateObject.create(stateDecl);\n let name = state.name;\n\n if (!isString(name)) throw new Error(\"State must have a valid name\");\n if (this.states.hasOwnProperty(name) || inArray(queue.map(prop('name')), name))\n throw new Error(`State '${name}' is already defined`);\n\n queue.push(state);\n this.flush();\n\n return state;\n }\n\n flush() {\n let {queue, states, builder} = this;\n let registered: StateObject[] = [], // states that got registered\n orphans: StateObject[] = [], // states that don't yet have a parent registered\n previousQueueLength = {}; // keep track of how long the queue when an orphan was first encountered\n const getState = (name) =>\n this.states.hasOwnProperty(name) && this.states[name];\n\n while (queue.length > 0) {\n let state: StateObject = queue.shift();\n let name = state.name;\n let result: StateObject = builder.build(state);\n let orphanIdx: number = orphans.indexOf(state);\n\n if (result) {\n let existingState = getState(name);\n if (existingState && existingState.name === name) {\n throw new Error(`State '${name}' is already defined`);\n }\n\n let existingFutureState = getState(name + \".**\");\n if (existingFutureState) {\n // Remove future state of the same name\n this.$registry.deregister(existingFutureState);\n }\n\n states[name] = state;\n this.attachRoute(state);\n if (orphanIdx >= 0) orphans.splice(orphanIdx, 1);\n registered.push(state);\n continue;\n }\n\n let prev = previousQueueLength[name];\n previousQueueLength[name] = queue.length;\n if (orphanIdx >= 0 && prev === queue.length) {\n // Wait until two consecutive iterations where no additional states were dequeued successfully.\n // throw new Error(`Cannot register orphaned state '${name}'`);\n queue.push(state);\n return states;\n } else if (orphanIdx < 0) {\n orphans.push(state);\n }\n\n queue.push(state);\n }\n\n if (registered.length) {\n this.listeners.forEach(listener => listener(\"registered\", registered.map(s => s.self)));\n }\n\n return states;\n }\n\n attachRoute(state: StateObject) {\n if (state.abstract || !state.url) return;\n\n this.$urlRouter.rule(this.$urlRouter.urlRuleFactory.create(state));\n }\n}\n","/**\n * @coreapi\n * @module state\n */ /** for typedoc */\n\nimport { StateObject } from \"./stateObject\";\nimport { StateMatcher } from \"./stateMatcher\";\nimport { StateBuilder } from \"./stateBuilder\";\nimport { StateQueueManager } from \"./stateQueueManager\";\nimport { StateDeclaration, _StateDeclaration } from \"./interface\";\nimport { BuilderFunction } from \"./stateBuilder\";\nimport { StateOrName } from \"./interface\";\nimport { removeFrom } from \"../common/common\";\nimport { UIRouter } from \"../router\";\nimport { propEq } from \"../common/hof\";\n\n/**\n * The signature for the callback function provided to [[StateRegistry.onStatesChanged]].\n *\n * This callback receives two parameters:\n *\n * @param event a string; either \"registered\" or \"deregistered\"\n * @param states the list of [[StateDeclaration]]s that were registered (or deregistered).\n */\nexport type StateRegistryListener = (event: \"registered\"|\"deregistered\", states: StateDeclaration[]) => void;\n\nexport class StateRegistry {\n private _root: StateObject;\n private states: { [key: string]: StateObject } = {};\n\n matcher: StateMatcher;\n private builder: StateBuilder;\n stateQueue: StateQueueManager;\n\n listeners: StateRegistryListener[] = [];\n\n /** @internalapi */\n constructor(private _router: UIRouter) {\n this.matcher = new StateMatcher(this.states);\n this.builder = new StateBuilder(this.matcher, _router.urlMatcherFactory);\n this.stateQueue = new StateQueueManager(this, _router.urlRouter, this.states, this.builder, this.listeners);\n this._registerRoot();\n }\n\n /** @internalapi */\n private _registerRoot() {\n let rootStateDef: StateDeclaration = {\n name: '',\n url: '^',\n views: null,\n params: {\n '#': { value: null, type: 'hash', dynamic: true }\n },\n abstract: true\n };\n\n let _root = this._root = this.stateQueue.register(rootStateDef);\n _root.navigable = null;\n }\n\n /** @internalapi */\n dispose() {\n this.stateQueue.dispose();\n this.listeners = [];\n this.get().forEach(state => this.get(state) && this.deregister(state));\n }\n\n /**\n * Listen for a State Registry events\n *\n * Adds a callback that is invoked when states are registered or deregistered with the StateRegistry.\n *\n * #### Example:\n * ```js\n * let allStates = registry.get();\n *\n * // Later, invoke deregisterFn() to remove the listener\n * let deregisterFn = registry.onStatesChanged((event, states) => {\n * switch(event) {\n * case: 'registered':\n * states.forEach(state => allStates.push(state));\n * break;\n * case: 'deregistered':\n * states.forEach(state => {\n * let idx = allStates.indexOf(state);\n * if (idx !== -1) allStates.splice(idx, 1);\n * });\n * break;\n * }\n * });\n * ```\n *\n * @param listener a callback function invoked when the registered states changes.\n * The function receives two parameters, `event` and `state`.\n * See [[StateRegistryListener]]\n * @return a function that deregisters the listener\n */\n onStatesChanged(listener: StateRegistryListener): () => void {\n this.listeners.push(listener);\n return function deregisterListener() {\n removeFrom(this.listeners)(listener);\n }.bind(this);\n }\n\n /**\n * Gets the implicit root state\n *\n * Gets the root of the state tree.\n * The root state is implicitly created by UI-Router.\n * Note: this returns the internal [[StateObject]] representation, not a [[StateDeclaration]]\n *\n * @return the root [[StateObject]]\n */\n root() {\n return this._root;\n }\n\n /**\n * Adds a state to the registry\n *\n * Registers a [[StateDeclaration]] or queues it for registration.\n *\n * Note: a state will be queued if the state's parent isn't yet registered.\n *\n * @param stateDefinition the definition of the state to register.\n * @returns the internal [[StateObject]] object.\n * If the state was successfully registered, then the object is fully built (See: [[StateBuilder]]).\n * If the state was only queued, then the object is not fully built.\n */\n register(stateDefinition: _StateDeclaration): StateObject {\n return this.stateQueue.register(stateDefinition);\n }\n\n /** @hidden */\n private _deregisterTree(state: StateObject) {\n let all = this.get().map(s => s.$$state());\n const getChildren = (states: StateObject[]) => {\n let children = all.filter(s => states.indexOf(s.parent) !== -1);\n return children.length === 0 ? children : children.concat(getChildren(children));\n };\n\n let children = getChildren([state]);\n let deregistered: StateObject[] = [state].concat(children).reverse();\n\n deregistered.forEach(state => {\n let $ur = this._router.urlRouter;\n // Remove URL rule\n $ur.rules().filter(propEq(\"state\", state)).forEach($ur.removeRule.bind($ur));\n // Remove state from registry\n delete this.states[state.name];\n });\n\n return deregistered;\n }\n\n /**\n * Removes a state from the registry\n *\n * This removes a state from the registry.\n * If the state has children, they are are also removed from the registry.\n *\n * @param stateOrName the state's name or object representation\n * @returns {StateObject[]} a list of removed states\n */\n deregister(stateOrName: StateOrName) {\n let _state = this.get(stateOrName);\n if (!_state) throw new Error(\"Can't deregister state; not found: \" + stateOrName);\n let deregisteredStates = this._deregisterTree(_state.$$state());\n\n this.listeners.forEach(listener => listener(\"deregistered\", deregisteredStates.map(s => s.self)));\n return deregisteredStates;\n }\n\n /**\n * Gets all registered states\n *\n * Calling this method with no arguments will return a list of all the states that are currently registered.\n * Note: this does not return states that are *queued* but not yet registered.\n *\n * @return a list of [[StateDeclaration]]s\n */\n get(): StateDeclaration[];\n\n /**\n * Gets a registered state\n *\n * Given a state or a name, finds and returns the [[StateDeclaration]] from the registry.\n * Note: this does not return states that are *queued* but not yet registered.\n *\n * @param stateOrName either the name of a state, or a state object.\n * @return a registered [[StateDeclaration]] that matched the `stateOrName`, or null if the state isn't registered.\n */\n get(stateOrName: StateOrName, base?: StateOrName): StateDeclaration;\n get(stateOrName?: StateOrName, base?: StateOrName): any {\n if (arguments.length === 0) \n return Object.keys(this.states).map(name => this.states[name].self);\n let found = this.matcher.find(stateOrName, base);\n return found && found.self || null;\n }\n\n decorator(name: string, func: BuilderFunction) {\n return this.builder.builder(name, func);\n }\n}","/**\n * @internalapi\n * @module url\n */ /** for typedoc */\nimport { forEach, extend } from \"../common/common\";\nimport { isObject, isDefined, isFunction, isString } from \"../common/predicates\";\nimport { UrlMatcher } from \"./urlMatcher\";\nimport { Param, DefType } from \"../params/param\";\nimport { ParamTypes } from \"../params/paramTypes\";\nimport { ParamTypeDefinition } from \"../params/interface\";\nimport { Disposable } from \"../interface\";\nimport { ParamType } from \"../params/paramType\";\nimport { ParamFactory, UrlMatcherConfig } from \"./interface\";\n\n/**\n * Factory for [[UrlMatcher]] instances.\n *\n * The factory is available to ng1 services as\n * `$urlMatcherFactor` or ng1 providers as `$urlMatcherFactoryProvider`.\n */\nexport class UrlMatcherFactory implements Disposable, UrlMatcherConfig {\n /** @hidden */ paramTypes = new ParamTypes();\n /** @hidden */ _isCaseInsensitive: boolean = false;\n /** @hidden */ _isStrictMode: boolean = true;\n /** @hidden */ _defaultSquashPolicy: (boolean|string) = false;\n\n constructor() {\n extend(this, { UrlMatcher, Param });\n }\n\n /** @inheritdoc */\n caseInsensitive(value?: boolean): boolean {\n return this._isCaseInsensitive = isDefined(value) ? value : this._isCaseInsensitive;\n }\n\n /** @inheritdoc */\n strictMode(value?: boolean): boolean {\n return this._isStrictMode = isDefined(value) ? value : this._isStrictMode;\n }\n\n /** @inheritdoc */\n defaultSquashPolicy(value?: (boolean|string)) {\n if (isDefined(value) && value !== true && value !== false && !isString(value))\n throw new Error(`Invalid squash policy: ${value}. Valid policies: false, true, arbitrary-string`);\n return this._defaultSquashPolicy = isDefined(value) ? value : this._defaultSquashPolicy;\n }\n\n /** @hidden */\n private _getConfig = (config) =>\n extend({ strict: this._isStrictMode, caseInsensitive: this._isCaseInsensitive }, config);\n\n /**\n * Creates a [[UrlMatcher]] for the specified pattern.\n *\n * @param pattern The URL pattern.\n * @param config The config object hash.\n * @returns The UrlMatcher.\n */\n compile(pattern: string, config?: { [key: string]: any }) {\n return new UrlMatcher(pattern, this.paramTypes, this.paramFactory, this._getConfig(config));\n }\n\n /**\n * Returns true if the specified object is a [[UrlMatcher]], or false otherwise.\n *\n * @param object The object to perform the type check against.\n * @returns `true` if the object matches the `UrlMatcher` interface, by\n * implementing all the same methods.\n */\n isMatcher(object: any): boolean {\n // TODO: typeof?\n if (!isObject(object)) return false;\n let result = true;\n\n forEach(UrlMatcher.prototype, (val, name) => {\n if (isFunction(val)) result = result && (isDefined(object[name]) && isFunction(object[name]));\n });\n return result;\n };\n\n /**\n * Creates and registers a custom [[ParamType]] object\n *\n * A [[ParamType]] can be used to generate URLs with typed parameters.\n *\n * @param name The type name.\n * @param definition The type definition. See [[ParamTypeDefinition]] for information on the values accepted.\n * @param definitionFn A function that is injected before the app runtime starts.\n * The result of this function should be a [[ParamTypeDefinition]].\n * The result is merged into the existing `definition`.\n * See [[ParamType]] for information on the values accepted.\n *\n * @returns - if a type was registered: the [[UrlMatcherFactory]]\n * - if only the `name` parameter was specified: the currently registered [[ParamType]] object, or undefined\n *\n * Note: Register custom types *before using them* in a state definition.\n *\n * See [[ParamTypeDefinition]] for examples\n */\n type(name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {\n let type = this.paramTypes.type(name, definition, definitionFn);\n return !isDefined(definition) ? type : this;\n };\n\n /** @hidden */\n $get() {\n this.paramTypes.enqueue = false;\n this.paramTypes._flushTypeQueue();\n return this;\n };\n\n /** @internalapi Creates a new [[Param]] for a given location (DefType) */\n paramFactory: ParamFactory = {\n /** Creates a new [[Param]] from a CONFIG block */\n fromConfig: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.CONFIG, this),\n\n /** Creates a new [[Param]] from a url PATH */\n fromPath: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.PATH, this),\n\n /** Creates a new [[Param]] from a url SEARCH */\n fromSearch: (id: string, type: ParamType, config: any) =>\n new Param(id, type, config, DefType.SEARCH, this),\n };\n\n /** @internalapi */\n dispose() {\n this.paramTypes.dispose();\n }\n}\n","/**\n * @coreapi\n * @module url\n */ /** */\nimport { UrlMatcher } from \"./urlMatcher\";\nimport { isString, isDefined, isFunction, isState } from \"../common/predicates\";\nimport { UIRouter } from \"../router\";\nimport { identity, extend } from \"../common/common\";\nimport { is, pattern } from \"../common/hof\";\nimport { StateObject } from \"../state/stateObject\";\nimport { RawParams } from \"../params/interface\";\nimport {\n UrlRule, UrlRuleMatchFn, UrlRuleHandlerFn, UrlRuleType, UrlParts, MatcherUrlRule, StateRule, RegExpRule\n} from \"./interface\";\n\n/**\n * Creates a [[UrlRule]]\n *\n * Creates a [[UrlRule]] from a:\n *\n * - `string`\n * - [[UrlMatcher]]\n * - `RegExp`\n * - [[StateObject]]\n * @internalapi\n */\nexport class UrlRuleFactory {\n constructor(public router: UIRouter) { }\n\n compile(str: string) {\n return this.router.urlMatcherFactory.compile(str);\n }\n\n static isUrlRule = obj =>\n obj && ['type', 'match', 'handler'].every(key => isDefined(obj[key]));\n\n create(what: string|UrlMatcher|StateObject|RegExp|UrlRuleMatchFn, handler?: string|UrlRuleHandlerFn): UrlRule {\n const makeRule = pattern([\n [isString, (_what: string) => makeRule(this.compile(_what))],\n [is(UrlMatcher), (_what: UrlMatcher) => this.fromUrlMatcher(_what, handler)],\n [isState, (_what: StateObject) => this.fromState(_what, this.router)],\n [is(RegExp), (_what: RegExp) => this.fromRegExp(_what, handler)],\n [isFunction, (_what: UrlRuleMatchFn) => new BaseUrlRule(_what, handler as UrlRuleHandlerFn)],\n ]);\n\n let rule = makeRule(what);\n if (!rule) throw new Error(\"invalid 'what' in when()\");\n return rule;\n }\n\n /**\n * A UrlRule which matches based on a UrlMatcher\n *\n * The `handler` may be either a `string`, a [[UrlRuleHandlerFn]] or another [[UrlMatcher]]\n *\n * ## Handler as a function\n *\n * If `handler` is a function, the function is invoked with:\n *\n * - matched parameter values ([[RawParams]] from [[UrlMatcher.exec]])\n * - url: the current Url ([[UrlParts]])\n * - router: the router object ([[UIRouter]])\n *\n * #### Example:\n * ```js\n * var urlMatcher = $umf.compile(\"/foo/:fooId/:barId\");\n * var rule = factory.fromUrlMatcher(urlMatcher, match => \"/home/\" + match.fooId + \"/\" + match.barId);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match); // '/home/123/456'\n * ```\n *\n * ## Handler as UrlMatcher\n *\n * If `handler` is a UrlMatcher, the handler matcher is used to create the new url.\n * The `handler` UrlMatcher is formatted using the matched param from the first matcher.\n * The url is replaced with the result.\n *\n * #### Example:\n * ```js\n * var urlMatcher = $umf.compile(\"/foo/:fooId/:barId\");\n * var handler = $umf.compile(\"/home/:fooId/:barId\");\n * var rule = factory.fromUrlMatcher(urlMatcher, handler);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match); // '/home/123/456'\n * ```\n */\n fromUrlMatcher(urlMatcher: UrlMatcher, handler: string|UrlMatcher|UrlRuleHandlerFn): MatcherUrlRule {\n let _handler: UrlRuleHandlerFn = handler as any;\n if (isString(handler)) handler = this.router.urlMatcherFactory.compile(handler);\n if (is(UrlMatcher)(handler)) _handler = (match: RawParams) => (handler as UrlMatcher).format(match);\n\n function match(url: UrlParts) {\n let match = urlMatcher.exec(url.path, url.search, url.hash);\n return urlMatcher.validates(match) && match;\n }\n\n // Prioritize URLs, lowest to highest:\n // - Some optional URL parameters, but none matched\n // - No optional parameters in URL\n // - Some optional parameters, some matched\n // - Some optional parameters, all matched\n function matchPriority(params: RawParams): number {\n let optional = urlMatcher.parameters().filter(param => param.isOptional);\n if (!optional.length) return 0.000001;\n let matched = optional.filter(param => params[param.id]);\n return matched.length / optional.length;\n }\n\n let details = { urlMatcher, matchPriority, type: \"URLMATCHER\" };\n return extend(new BaseUrlRule(match, _handler), details) as MatcherUrlRule;\n }\n\n\n /**\n * A UrlRule which matches a state by its url\n *\n * #### Example:\n * ```js\n * var rule = factory.fromState($state.get('foo'), router);\n * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n * var result = rule.handler(match);\n * // Starts a transition to 'foo' with params: { fooId: '123', barId: '456' }\n * ```\n */\n fromState(state: StateObject, router: UIRouter): StateRule {\n /**\n * Handles match by transitioning to matched state\n *\n * First checks if the router should start a new transition.\n * A new transition is not required if the current state's URL\n * and the new URL are already identical\n */\n const handler = (match: RawParams) => {\n let $state = router.stateService;\n let globals = router.globals;\n if ($state.href(state, match) !== $state.href(globals.current, globals.params)) {\n $state.transitionTo(state, match, { inherit: true, source: \"url\" });\n }\n };\n\n let details = { state, type: \"STATE\" };\n return extend(this.fromUrlMatcher(state.url, handler), details) as StateRule;\n }\n\n /**\n * A UrlRule which matches based on a regular expression\n *\n * The `handler` may be either a [[UrlRuleHandlerFn]] or a string.\n *\n * ## Handler as a function\n *\n * If `handler` is a function, the function is invoked with:\n *\n * - regexp match array (from `regexp`)\n * - url: the current Url ([[UrlParts]])\n * - router: the router object ([[UIRouter]])\n *\n * #### Example:\n * ```js\n * var rule = factory.fromRegExp(/^\\/foo\\/(bar|baz)$/, match => \"/home/\" + match[1])\n * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ]\n * var result = rule.handler(match); // '/home/bar'\n * ```\n *\n * ## Handler as string\n *\n * If `handler` is a string, the url is *replaced by the string* when the Rule is invoked.\n * The string is first interpolated using `string.replace()` style pattern.\n *\n * #### Example:\n * ```js\n * var rule = factory.fromRegExp(/^\\/foo\\/(bar|baz)$/, \"/home/$1\")\n * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ]\n * var result = rule.handler(match); // '/home/bar'\n * ```\n */\n fromRegExp(regexp: RegExp, handler: string|UrlRuleHandlerFn): RegExpRule {\n if (regexp.global || regexp.sticky) throw new Error(\"Rule RegExp must not be global or sticky\");\n\n /**\n * If handler is a string, the url will be replaced by the string.\n * If the string has any String.replace() style variables in it (like `$2`),\n * they will be replaced by the captures from [[match]]\n */\n const redirectUrlTo = (match: RegExpExecArray) =>\n // Interpolates matched values into $1 $2, etc using a String.replace()-style pattern\n (handler as string).replace(/\\$(\\$|\\d{1,2})/, (m, what) =>\n match[what === '$' ? 0 : Number(what)]);\n\n const _handler = isString(handler) ? redirectUrlTo : handler;\n\n const match = (url: UrlParts): RegExpExecArray =>\n regexp.exec(url.path);\n\n let details = { regexp, type: \"REGEXP\" };\n return extend(new BaseUrlRule(match, _handler), details) as RegExpRule\n }\n}\n\n/**\n * A base rule which calls `match`\n *\n * The value from the `match` function is passed through to the `handler`.\n * @internalapi\n */\nexport class BaseUrlRule implements UrlRule {\n $id: number;\n priority: number;\n type: UrlRuleType = \"RAW\";\n handler: UrlRuleHandlerFn;\n matchPriority = (match) => 0 - this.$id;\n\n constructor(public match: UrlRuleMatchFn, handler?: UrlRuleHandlerFn) {\n this.handler = handler || identity;\n }\n}","/**\n * @coreapi\n * @module view\n */ /** for typedoc */\nimport {equals, applyPairs, removeFrom, TypedMap} from \"../common/common\";\nimport {curry, prop} from \"../common/hof\";\nimport {isString, isArray} from \"../common/predicates\";\nimport {trace} from \"../common/trace\";\nimport {PathNode} from \"../path/pathNode\";\n\nimport {ActiveUIView, ViewContext, ViewConfig} from \"./interface\";\nimport {_ViewDeclaration} from \"../state/interface\";\n\nexport type ViewConfigFactory = (path: PathNode[], decl: _ViewDeclaration) => ViewConfig|ViewConfig[];\n\nexport interface ViewServicePluginAPI {\n _rootViewContext(context?: ViewContext): ViewContext;\n _viewConfigFactory(viewType: string, factory: ViewConfigFactory);\n _registeredUIViews(): ActiveUIView[];\n _activeViewConfigs(): ViewConfig[];\n}\n\n/**\n * The View service\n *\n * This service pairs existing `ui-view` components (which live in the DOM)\n * with view configs (from the state declaration objects: [[StateDeclaration.views]]).\n *\n * - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]].\n * The views from exited states are deactivated via [[deactivateViewConfig]].\n * (See: the [[registerActivateViews]] Transition Hook)\n *\n * - As `ui-view` components pop in and out of existence, they register themselves using [[registerUIView]].\n *\n * - When the [[sync]] function is called, the registered `ui-view`(s) ([[ActiveUIView]])\n * are configured with the matching [[ViewConfig]](s)\n *\n */\nexport class ViewService {\n private _uiViews: ActiveUIView[] = [];\n private _viewConfigs: ViewConfig[] = [];\n private _rootContext: ViewContext;\n private _viewConfigFactories: { [key: string]: ViewConfigFactory } = {};\n\n constructor() { }\n\n public _pluginapi: ViewServicePluginAPI = {\n _rootViewContext: this._rootViewContext.bind(this),\n _viewConfigFactory: this._viewConfigFactory.bind(this),\n _registeredUIViews: () => this._uiViews,\n _activeViewConfigs: () => this._viewConfigs,\n };\n\n private _rootViewContext(context?: ViewContext): ViewContext {\n return this._rootContext = context || this._rootContext;\n };\n\n private _viewConfigFactory(viewType: string, factory: ViewConfigFactory) {\n this._viewConfigFactories[viewType] = factory;\n }\n\n createViewConfig(path: PathNode[], decl: _ViewDeclaration): ViewConfig[] {\n let cfgFactory = this._viewConfigFactories[decl.$type];\n if (!cfgFactory) throw new Error(\"ViewService: No view config factory registered for type \" + decl.$type);\n let cfgs = cfgFactory(path, decl);\n return isArray(cfgs) ? cfgs : [cfgs];\n }\n \n /**\n * Deactivates a ViewConfig.\n *\n * This function deactivates a `ViewConfig`.\n * After calling [[sync]], it will un-pair from any `ui-view` with which it is currently paired.\n *\n * @param viewConfig The ViewConfig view to deregister.\n */\n deactivateViewConfig(viewConfig: ViewConfig) {\n trace.traceViewServiceEvent(\"<- Removing\", viewConfig);\n removeFrom(this._viewConfigs, viewConfig);\n }\n\n activateViewConfig(viewConfig: ViewConfig) {\n trace.traceViewServiceEvent(\"-> Registering\", viewConfig);\n this._viewConfigs.push(viewConfig);\n }\n\n /**\n * Given a ui-view and a ViewConfig, determines if they \"match\".\n *\n * A ui-view has a fully qualified name (fqn) and a context object. The fqn is built from its overall location in\n * the DOM, describing its nesting relationship to any parent ui-view tags it is nested inside of.\n *\n * A ViewConfig has a target ui-view name and a context anchor. The ui-view name can be a simple name, or\n * can be a segmented ui-view path, describing a portion of a ui-view fqn.\n *\n * In order for a ui-view to match ViewConfig, ui-view's $type must match the ViewConfig's $type\n *\n * If the ViewConfig's target ui-view name is a simple name (no dots), then a ui-view matches if:\n * - the ui-view's name matches the ViewConfig's target name\n * - the ui-view's context matches the ViewConfig's anchor\n *\n * If the ViewConfig's target ui-view name is a segmented name (with dots), then a ui-view matches if:\n * - There exists a parent ui-view where:\n * - the parent ui-view's name matches the first segment (index 0) of the ViewConfig's target name\n * - the parent ui-view's context matches the ViewConfig's anchor\n * - And the remaining segments (index 1..n) of the ViewConfig's target name match the tail of the ui-view's fqn\n *\n * Example:\n *\n * DOM:\n * \n * \n * \n * \n * \n * \n * \n * \n *\n * uiViews: [\n * { fqn: \"$default\", creationContext: { name: \"\" } },\n * { fqn: \"$default.foo\", creationContext: { name: \"A\" } },\n * { fqn: \"$default.foo.$default\", creationContext: { name: \"A.B\" } }\n * { fqn: \"$default.foo.$default.bar\", creationContext: { name: \"A.B.C\" } }\n * ]\n *\n * These four view configs all match the ui-view with the fqn: \"$default.foo.$default.bar\":\n *\n * - ViewConfig1: { uiViewName: \"bar\", uiViewContextAnchor: \"A.B.C\" }\n * - ViewConfig2: { uiViewName: \"$default.bar\", uiViewContextAnchor: \"A.B\" }\n * - ViewConfig3: { uiViewName: \"foo.$default.bar\", uiViewContextAnchor: \"A\" }\n * - ViewConfig4: { uiViewName: \"$default.foo.$default.bar\", uiViewContextAnchor: \"\" }\n *\n * Using ViewConfig3 as an example, it matches the ui-view with fqn \"$default.foo.$default.bar\" because:\n * - The ViewConfig's segmented target name is: [ \"foo\", \"$default\", \"bar\" ]\n * - There exists a parent ui-view (which has fqn: \"$default.foo\") where:\n * - the parent ui-view's name \"foo\" matches the first segment \"foo\" of the ViewConfig's target name\n * - the parent ui-view's context \"A\" matches the ViewConfig's anchor context \"A\"\n * - And the remaining segments [ \"$default\", \"bar\" ].join(\".\"_ of the ViewConfig's target name match\n * the tail of the ui-view's fqn \"default.bar\"\n *\n * @internalapi\n */\n static matches = (uiViewsByFqn: TypedMap, uiView: ActiveUIView) => (viewConfig: ViewConfig) => {\n // Don't supply an ng1 ui-view with an ng2 ViewConfig, etc\n if (uiView.$type !== viewConfig.viewDecl.$type) return false;\n\n // Split names apart from both viewConfig and uiView into segments\n let vc = viewConfig.viewDecl;\n let vcSegments = vc.$uiViewName.split(\".\");\n let uivSegments = uiView.fqn.split(\".\");\n\n // Check if the tails of the segment arrays match. ex, these arrays' tails match:\n // vc: [\"foo\", \"bar\"], uiv fqn: [\"$default\", \"foo\", \"bar\"]\n if (!equals(vcSegments, uivSegments.slice(0 - vcSegments.length)))\n return false;\n\n // Now check if the fqn ending at the first segment of the viewConfig matches the context:\n // [\"$default\", \"foo\"].join(\".\") == \"$default.foo\", does the ui-view $default.foo context match?\n let negOffset = (1 - vcSegments.length) || undefined;\n let fqnToFirstSegment = uivSegments.slice(0, negOffset).join(\".\");\n let uiViewContext = uiViewsByFqn[fqnToFirstSegment].creationContext;\n return vc.$uiViewContextAnchor === (uiViewContext && uiViewContext.name);\n }\n\n sync() {\n let uiViewsByFqn: TypedMap =\n this._uiViews.map(uiv => [uiv.fqn, uiv]).reduce(applyPairs, {});\n\n // Return a weighted depth value for a uiView.\n // The depth is the nesting depth of ui-views (based on FQN; times 10,000)\n // plus the depth of the state that is populating the uiView\n function uiViewDepth(uiView: ActiveUIView) {\n const stateDepth = (context: ViewContext) =>\n context && context.parent ? stateDepth(context.parent) + 1 : 1;\n return (uiView.fqn.split(\".\").length * 10000) + stateDepth(uiView.creationContext);\n }\n\n // Return the ViewConfig's context's depth in the context tree.\n function viewConfigDepth(config: ViewConfig) {\n let context: ViewContext = config.viewDecl.$context, count = 0;\n while (++count && context.parent) context = context.parent;\n return count;\n }\n\n // Given a depth function, returns a compare function which can return either ascending or descending order\n const depthCompare = curry((depthFn, posNeg, left, right) => posNeg * (depthFn(left) - depthFn(right)));\n\n const matchingConfigPair = (uiView: ActiveUIView) => {\n let matchingConfigs = this._viewConfigs.filter(ViewService.matches(uiViewsByFqn, uiView));\n if (matchingConfigs.length > 1) {\n // This is OK. Child states can target a ui-view that the parent state also targets (the child wins)\n // Sort by depth and return the match from the deepest child\n // console.log(`Multiple matching view configs for ${uiView.fqn}`, matchingConfigs);\n matchingConfigs.sort(depthCompare(viewConfigDepth, -1)); // descending\n }\n return [uiView, matchingConfigs[0]];\n };\n\n const configureUIView = ([uiView, viewConfig]) => {\n // If a parent ui-view is reconfigured, it could destroy child ui-views.\n // Before configuring a child ui-view, make sure it's still in the active uiViews array.\n if (this._uiViews.indexOf(uiView) !== -1)\n uiView.configUpdated(viewConfig);\n };\n\n // Sort views by FQN and state depth. Process uiviews nearest the root first.\n const pairs = this._uiViews.sort(depthCompare(uiViewDepth, 1)).map(matchingConfigPair);\n\n trace.traceViewSync(pairs);\n\n pairs.forEach(configureUIView);\n };\n\n /**\n * Registers a `ui-view` component\n *\n * When a `ui-view` component is created, it uses this method to register itself.\n * After registration the [[sync]] method is used to ensure all `ui-view` are configured with the proper [[ViewConfig]].\n *\n * Note: the `ui-view` component uses the `ViewConfig` to determine what view should be loaded inside the `ui-view`,\n * and what the view's state context is.\n *\n * Note: There is no corresponding `deregisterUIView`.\n * A `ui-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself.\n *\n * @param uiView The metadata for a UIView\n * @return a de-registration function used when the view is destroyed.\n */\n registerUIView(uiView: ActiveUIView) {\n trace.traceViewServiceUIViewEvent(\"-> Registering\", uiView);\n let uiViews = this._uiViews;\n const fqnAndTypeMatches = (uiv: ActiveUIView) => uiv.fqn === uiView.fqn && uiv.$type === uiView.$type;\n if (uiViews.filter(fqnAndTypeMatches).length)\n trace.traceViewServiceUIViewEvent(\"!!!! duplicate uiView named:\", uiView);\n\n uiViews.push(uiView);\n this.sync();\n\n return () => {\n let idx = uiViews.indexOf(uiView);\n if (idx === -1) {\n trace.traceViewServiceUIViewEvent(\"Tried removing non-registered uiView\", uiView);\n return;\n }\n trace.traceViewServiceUIViewEvent(\"<- Deregistering\", uiView);\n removeFrom(uiViews)(uiView);\n };\n };\n\n /**\n * Returns the list of views currently available on the page, by fully-qualified name.\n *\n * @return {Array} Returns an array of fully-qualified view names.\n */\n available() {\n return this._uiViews.map(prop(\"fqn\"));\n }\n\n /**\n * Returns the list of views on the page containing loaded content.\n *\n * @return {Array} Returns an array of fully-qualified view names.\n */\n active() {\n return this._uiViews.filter(prop(\"$config\")).map(prop(\"name\"));\n }\n\n /**\n * Normalizes a view's name from a state.views configuration block.\n *\n * This should be used by a framework implementation to calculate the values for\n * [[_ViewDeclaration.$uiViewName]] and [[_ViewDeclaration.$uiViewContextAnchor]].\n *\n * @param context the context object (state declaration) that the view belongs to\n * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]]\n *\n * @returns the normalized uiViewName and uiViewContextAnchor that the view targets\n */\n static normalizeUIViewTarget(context: ViewContext, rawViewName = \"\") {\n // TODO: Validate incoming view name with a regexp to allow:\n // ex: \"view.name@foo.bar\" , \"^.^.view.name\" , \"view.name@^.^\" , \"\" ,\n // \"@\" , \"$default@^\" , \"!$default.$default\" , \"!foo.bar\"\n let viewAtContext: string[] = rawViewName.split(\"@\");\n let uiViewName = viewAtContext[0] || \"$default\"; // default to unnamed view\n let uiViewContextAnchor = isString(viewAtContext[1]) ? viewAtContext[1] : \"^\"; // default to parent context\n\n // Handle relative view-name sugar syntax.\n // Matches rawViewName \"^.^.^.foo.bar\" into array: [\"^.^.^.foo.bar\", \"^.^.^\", \"foo.bar\"],\n let relativeViewNameSugar = /^(\\^(?:\\.\\^)*)\\.(.*$)/.exec(uiViewName);\n if (relativeViewNameSugar) {\n // Clobbers existing contextAnchor (rawViewName validation will fix this)\n uiViewContextAnchor = relativeViewNameSugar[1]; // set anchor to \"^.^.^\"\n uiViewName = relativeViewNameSugar[2]; // set view-name to \"foo.bar\"\n }\n\n if (uiViewName.charAt(0) === '!') {\n uiViewName = uiViewName.substr(1);\n uiViewContextAnchor = \"\"; // target absolutely from root\n }\n\n // handle parent relative targeting \"^.^.^\"\n let relativeMatch = /^(\\^(?:\\.\\^)*)$/;\n if (relativeMatch.exec(uiViewContextAnchor)) {\n let anchor = uiViewContextAnchor.split(\".\").reduce(((anchor, x) => anchor.parent), context);\n uiViewContextAnchor = anchor.name;\n } else if (uiViewContextAnchor === '.') {\n uiViewContextAnchor = context.name;\n }\n\n return {uiViewName, uiViewContextAnchor};\n }\n}","/**\n * @coreapi\n * @module core\n */ /** */\nimport {StateParams} from \"./params/stateParams\";\nimport {StateDeclaration} from \"./state/interface\";\nimport {StateObject} from \"./state/stateObject\";\nimport {Transition} from \"./transition/transition\";\nimport {Queue} from \"./common/queue\";\nimport {TransitionService} from \"./transition/transitionService\";\nimport {copy} from \"./common/common\";\nimport { Disposable } from './interface';\n\n/**\n * Global router state\n *\n * This is where we hold the global mutable state such as current state, current\n * params, current transition, etc.\n */\nexport class UIRouterGlobals implements Disposable {\n /**\n * Current parameter values\n *\n * The parameter values from the latest successful transition\n */\n params: StateParams = new StateParams();\n\n /**\n * Current state\n *\n * The to-state from the latest successful transition\n */\n current: StateDeclaration;\n\n /**\n * Current state (internal object)\n *\n * The to-state from the latest successful transition\n * @internalapi\n */\n $current: StateObject;\n\n /**\n * The current started/running transition.\n * This transition has reached at least the onStart phase, but is not yet complete\n */\n transition: Transition;\n\n /** @internalapi */\n lastStartedTransitionId: number = -1;\n\n /** @internalapi */\n transitionHistory = new Queue([], 1);\n\n /** @internalapi */\n successfulTransitions = new Queue([], 1);\n\n dispose() {\n this.transitionHistory.clear();\n this.successfulTransitions.clear();\n this.transition = null;\n }\n}\n","/**\n * @coreapi\n * @module url\n */ /** */\n\nimport { UIRouter } from \"../router\";\nimport { LocationServices, notImplemented, LocationConfig } from \"../common/coreservices\";\nimport { noop, createProxyFunctions } from \"../common/common\";\nimport { UrlConfigApi, UrlSyncApi, UrlRulesApi, UrlParts, MatchResult } from \"./interface\";\n\n/** @hidden */\nconst makeStub = (keys: string[]): any =>\n keys.reduce((acc, key) => (acc[key] = notImplemented(key), acc), { dispose: noop });\n\n/** @hidden */ const locationServicesFns = [\"url\", \"path\", \"search\", \"hash\", \"onChange\"];\n/** @hidden */ const locationConfigFns = [\"port\", \"protocol\", \"host\", \"baseHref\", \"html5Mode\", \"hashPrefix\"];\n/** @hidden */ const umfFns = [\"type\", \"caseInsensitive\", \"strictMode\", \"defaultSquashPolicy\"];\n/** @hidden */ const rulesFns = [\"sort\", \"when\", \"initial\", \"otherwise\", \"rules\", \"rule\", \"removeRule\"];\n/** @hidden */ const syncFns = [\"deferIntercept\", \"listen\", \"sync\", \"match\"];\n\n/**\n * API for URL management\n */\nexport class UrlService implements LocationServices, UrlSyncApi {\n /** @hidden */\n static locationServiceStub: LocationServices = makeStub(locationServicesFns);\n /** @hidden */\n static locationConfigStub: LocationConfig = makeStub(locationConfigFns);\n\n /** @inheritdoc */\n url(): string;\n /** @inheritdoc */\n url(newurl: string, replace?: boolean, state?): void;\n url(newurl?, replace?, state?): any { return };\n /** @inheritdoc */\n path(): string { return };\n /** @inheritdoc */\n search(): { [key: string]: any } { return };\n /** @inheritdoc */\n hash(): string { return };\n /** @inheritdoc */\n onChange(callback: Function): Function { return };\n\n\n /**\n * Returns the current URL parts\n *\n * This method returns the current URL components as a [[UrlParts]] object.\n *\n * @returns the current url parts\n */\n parts(): UrlParts {\n return { path: this.path(), search: this.search(), hash: this.hash() }\n }\n\n dispose() { }\n\n /** @inheritdoc */\n sync(evt?) { return }\n /** @inheritdoc */\n listen(enabled?: boolean): Function { return };\n /** @inheritdoc */\n deferIntercept(defer?: boolean) { return }\n /** @inheritdoc */\n match(urlParts: UrlParts): MatchResult { return }\n\n /**\n * A nested API for managing URL rules and rewrites\n *\n * See: [[UrlRulesApi]] for details\n */\n rules: UrlRulesApi;\n\n /**\n * A nested API to configure the URL and retrieve URL information\n *\n * See: [[UrlConfigApi]] for details\n */\n config: UrlConfigApi;\n\n /** @hidden */\n private router: UIRouter;\n\n /** @hidden */\n constructor(router: UIRouter, lateBind = true) {\n this.router = router;\n this.rules = {} as any;\n this.config = {} as any;\n\n // proxy function calls from UrlService to the LocationService/LocationConfig\n const locationServices = () => router.locationService;\n createProxyFunctions(locationServices, this, locationServices, locationServicesFns, lateBind);\n\n const locationConfig = () => router.locationConfig;\n createProxyFunctions(locationConfig, this.config, locationConfig, locationConfigFns, lateBind);\n\n const umf = () => router.urlMatcherFactory;\n createProxyFunctions(umf, this.config, umf, umfFns);\n\n const urlRouter = () => router.urlRouter;\n createProxyFunctions(urlRouter, this.rules, urlRouter, rulesFns);\n createProxyFunctions(urlRouter, this, urlRouter, syncFns);\n }\n}\n","/**\n * @coreapi\n * @module core\n */ /** */\nimport { UrlMatcherFactory } from \"./url/urlMatcherFactory\";\nimport { UrlRouter } from \"./url/urlRouter\";\nimport { TransitionService } from \"./transition/transitionService\";\nimport { ViewService } from \"./view/view\";\nimport { StateRegistry } from \"./state/stateRegistry\";\nimport { StateService } from \"./state/stateService\";\nimport { UIRouterGlobals } from \"./globals\";\nimport { UIRouterPlugin, Disposable } from \"./interface\";\nimport { values, removeFrom } from \"./common/common\";\nimport { isFunction } from \"./common/predicates\";\nimport { UrlService } from \"./url/urlService\";\nimport { LocationServices, LocationConfig } from \"./common/coreservices\";\nimport { Trace, trace } from \"./common/trace\";\n\n/** @hidden */\nlet _routerInstance = 0;\n\n/**\n * The master class used to instantiate an instance of UI-Router.\n *\n * UI-Router (for each specific framework) will create an instance of this class during bootstrap.\n * This class instantiates and wires the UI-Router services together.\n *\n * After a new instance of the UIRouter class is created, it should be configured for your app.\n * For instance, app states should be registered with the [[UIRouter.stateRegistry]].\n *\n * ---\n *\n * Normally the framework code will bootstrap UI-Router.\n * If you are bootstrapping UIRouter manually, tell it to monitor the URL by calling\n * [[UrlService.listen]] then [[UrlService.sync]].\n */\nexport class UIRouter {\n /** @hidden */ $id = _routerInstance++;\n /** @hidden */ _disposed = false;\n /** @hidden */ private _disposables: Disposable[] = [];\n\n /** Provides trace information to the console */\n trace: Trace = trace;\n\n /** Provides services related to ui-view synchronization */\n viewService = new ViewService();\n\n /** Provides services related to Transitions */\n transitionService: TransitionService = new TransitionService(this);\n\n /** Global router state */\n globals: UIRouterGlobals = new UIRouterGlobals();\n\n /**\n * Deprecated for public use. Use [[urlService]] instead.\n * @deprecated Use [[urlService]] instead\n */\n urlMatcherFactory: UrlMatcherFactory = new UrlMatcherFactory();\n\n /**\n * Deprecated for public use. Use [[urlService]] instead.\n * @deprecated Use [[urlService]] instead\n */\n urlRouter: UrlRouter = new UrlRouter(this);\n\n /** Provides a registry for states, and related registration services */\n stateRegistry: StateRegistry = new StateRegistry(this);\n\n /** Provides services related to states */\n stateService = new StateService(this);\n\n /** Provides services related to the URL */\n urlService: UrlService = new UrlService(this);\n\n\n /** Registers an object to be notified when the router is disposed */\n disposable(disposable: Disposable) {\n this._disposables.push(disposable);\n }\n\n /**\n * Disposes this router instance\n *\n * When called, clears resources retained by the router by calling `dispose(this)` on all\n * registered [[disposable]] objects.\n *\n * Or, if a `disposable` object is provided, calls `dispose(this)` on that object only.\n *\n * @param disposable (optional) the disposable to dispose\n */\n dispose(disposable?: any): void {\n if (disposable && isFunction(disposable.dispose)) {\n disposable.dispose(this);\n return undefined;\n }\n\n this._disposed = true;\n this._disposables.slice().forEach(d => {\n try {\n typeof d.dispose === 'function' && d.dispose(this);\n removeFrom(this._disposables, d);\n } catch (ignored) {}\n });\n }\n\n /**\n * Creates a new `UIRouter` object\n *\n * @param locationService a [[LocationServices]] implementation\n * @param locationConfig a [[LocationConfig]] implementation\n * @internalapi\n */\n constructor(\n public locationService: LocationServices = UrlService.locationServiceStub,\n public locationConfig: LocationConfig = UrlService.locationConfigStub\n ) {\n\n this.viewService._pluginapi._rootViewContext(this.stateRegistry.root());\n this.globals.$current = this.stateRegistry.root();\n this.globals.current = this.globals.$current.self;\n\n this.disposable(this.globals);\n this.disposable(this.stateService);\n this.disposable(this.stateRegistry);\n this.disposable(this.transitionService);\n this.disposable(this.urlRouter);\n this.disposable(locationService);\n this.disposable(locationConfig);\n }\n\n /** @hidden */\n private _plugins: { [key: string]: UIRouterPlugin } = {};\n\n /** Add plugin (as ES6 class) */\n plugin(plugin: { new(router: UIRouter, options?: any): T }, options?: any): T;\n /** Add plugin (as javascript constructor function) */\n plugin(plugin: { (router: UIRouter, options?: any): void }, options?: any): T;\n /** Add plugin (as javascript factory function) */\n plugin(plugin: PluginFactory, options?: any): T;\n /**\n * Adds a plugin to UI-Router\n *\n * This method adds a UI-Router Plugin.\n * A plugin can enhance or change UI-Router behavior using any public API.\n *\n * #### Example:\n * ```js\n * import { MyCoolPlugin } from \"ui-router-cool-plugin\";\n *\n * var plugin = router.addPlugin(MyCoolPlugin);\n * ```\n *\n * ### Plugin authoring\n *\n * A plugin is simply a class (or constructor function) which accepts a [[UIRouter]] instance and (optionally) an options object.\n *\n * The plugin can implement its functionality using any of the public APIs of [[UIRouter]].\n * For example, it may configure router options or add a Transition Hook.\n *\n * The plugin can then be published as a separate module.\n *\n * #### Example:\n * ```js\n * export class MyAuthPlugin implements UIRouterPlugin {\n * constructor(router: UIRouter, options: any) {\n * this.name = \"MyAuthPlugin\";\n * let $transitions = router.transitionService;\n * let $state = router.stateService;\n *\n * let authCriteria = {\n * to: (state) => state.data && state.data.requiresAuth\n * };\n *\n * function authHook(transition: Transition) {\n * let authService = transition.injector().get('AuthService');\n * if (!authService.isAuthenticated()) {\n * return $state.target('login');\n * }\n * }\n *\n * $transitions.onStart(authCriteria, authHook);\n * }\n * }\n * ```\n *\n * @param plugin one of:\n * - a plugin class which implements [[UIRouterPlugin]]\n * - a constructor function for a [[UIRouterPlugin]] which accepts a [[UIRouter]] instance\n * - a factory function which accepts a [[UIRouter]] instance and returns a [[UIRouterPlugin]] instance\n * @param options options to pass to the plugin class/factory\n * @returns the registered plugin instance\n */\n plugin(plugin: any, options: any = {}): T {\n let pluginInstance = new plugin(this, options);\n if (!pluginInstance.name) throw new Error(\"Required property `name` missing on plugin: \" + pluginInstance);\n this._disposables.push(pluginInstance);\n return this._plugins[pluginInstance.name] = pluginInstance;\n }\n\n /**\n * Returns registered plugins\n *\n * Returns the registered plugin of the given `pluginName`.\n * If no `pluginName` is given, returns all registered plugins\n *\n * @param pluginName (optional) the name of the plugin to get\n * @return the named plugin (undefined if not found), or all plugins (if `pluginName` is omitted)\n */\n getPlugin(pluginName: string): UIRouterPlugin;\n getPlugin(): UIRouterPlugin[];\n getPlugin(pluginName?: string): UIRouterPlugin|UIRouterPlugin[] {\n return pluginName ? this._plugins[pluginName] : values(this._plugins);\n }\n}\n\n/** @internalapi */\nexport type PluginFactory = (router: UIRouter, options?: any) => T;\n","/** @module hooks */ /** */\nimport {isString, isFunction} from \"../common/predicates\"\nimport {Transition} from \"../transition/transition\";\nimport {services} from \"../common/coreservices\";\nimport {TargetState} from \"../state/targetState\";\nimport {TransitionService} from \"../transition/transitionService\";\nimport {TransitionHookFn} from \"../transition/interface\";\n\n/**\n * A [[TransitionHookFn]] that redirects to a different state or params\n *\n * Registered using `transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectHook);`\n * \n * See [[StateDeclaration.redirectTo]]\n */\nconst redirectToHook: TransitionHookFn = (trans: Transition) => {\n let redirect = trans.to().redirectTo;\n if (!redirect) return;\n\n let $state = trans.router.stateService;\n\n function handleResult(result: any) {\n if (!result) return;\n if (result instanceof TargetState) return result;\n if (isString(result)) return $state.target( result, trans.params(), trans.options());\n if (result['state'] || result['params'])\n return $state.target(result['state'] || trans.to(), result['params'] || trans.params(), trans.options());\n }\n\n if (isFunction(redirect)) {\n return services.$q.when(redirect(trans)).then(handleResult);\n }\n return handleResult(redirect);\n};\n\nexport const registerRedirectToHook = (transitionService: TransitionService) =>\n transitionService.onStart({to: (state) => !!state.redirectTo}, redirectToHook);\n","/** @module hooks */\n/** for typedoc */\nimport { noop } from '../common/common';\nimport { Transition } from '../transition/transition';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { TransitionStateHookFn, TransitionHookFn } from '../transition/interface';\nimport { TransitionService } from '../transition/transitionService';\nimport { val } from '../common/hof';\nimport { StateDeclaration } from '../state/interface';\n\n/**\n * A [[TransitionHookFn]] which resolves all EAGER Resolvables in the To Path\n *\n * Registered using `transitionService.onStart({}, eagerResolvePath);`\n *\n * When a Transition starts, this hook resolves all the EAGER Resolvables, which the transition then waits for.\n *\n * See [[StateDeclaration.resolve]]\n */\nconst eagerResolvePath: TransitionHookFn = (trans: Transition) =>\n new ResolveContext(trans.treeChanges().to)\n .resolvePath(\"EAGER\", trans)\n .then(noop);\n\nexport const registerEagerResolvePath = (transitionService: TransitionService) =>\n transitionService.onStart({}, eagerResolvePath, {priority: 1000});\n\n/**\n * A [[TransitionHookFn]] which resolves all LAZY Resolvables for the state (and all its ancestors) in the To Path\n *\n * Registered using `transitionService.onEnter({ entering: () => true }, lazyResolveState);`\n *\n * When a State is being entered, this hook resolves all the Resolvables for this state, which the transition then waits for.\n *\n * See [[StateDeclaration.resolve]]\n */\nconst lazyResolveState: TransitionStateHookFn = (trans: Transition, state: StateDeclaration) =>\n new ResolveContext(trans.treeChanges().to)\n .subContext(state.$$state())\n .resolvePath(\"LAZY\", trans)\n .then(noop);\n\nexport const registerLazyResolveState = (transitionService: TransitionService) =>\n transitionService.onEnter({ entering: val(true) }, lazyResolveState, {priority: 1000});\n\n","/** @module hooks */ /** for typedoc */\nimport {noop} from \"../common/common\";\nimport {services} from \"../common/coreservices\";\nimport {Transition} from \"../transition/transition\";\nimport {ViewService} from \"../view/view\";\nimport {ViewConfig} from \"../view/interface\";\nimport {TransitionHookFn} from \"../transition/interface\";\nimport {TransitionService} from \"../transition/transitionService\";\n\n\n/**\n * A [[TransitionHookFn]] which waits for the views to load\n *\n * Registered using `transitionService.onStart({}, loadEnteringViews);`\n *\n * Allows the views to do async work in [[ViewConfig.load]] before the transition continues.\n * In angular 1, this includes loading the templates.\n */\nconst loadEnteringViews: TransitionHookFn = (transition: Transition) => {\n let $q = services.$q;\n let enteringViews = transition.views(\"entering\");\n if (!enteringViews.length) return;\n return $q.all(enteringViews.map(view => $q.when(view.load()))).then(noop);\n};\n\nexport const registerLoadEnteringViews = (transitionService: TransitionService) =>\n transitionService.onFinish({}, loadEnteringViews);\n\n/**\n * A [[TransitionHookFn]] which activates the new views when a transition is successful.\n *\n * Registered using `transitionService.onSuccess({}, activateViews);`\n *\n * After a transition is complete, this hook deactivates the old views from the previous state,\n * and activates the new views from the destination state.\n *\n * See [[ViewService]]\n */\nconst activateViews: TransitionHookFn = (transition: Transition) => {\n let enteringViews = transition.views(\"entering\");\n let exitingViews = transition.views(\"exiting\");\n if (!enteringViews.length && !exitingViews.length) return;\n\n let $view: ViewService = transition.router.viewService;\n\n exitingViews.forEach((vc: ViewConfig) => $view.deactivateViewConfig(vc));\n enteringViews.forEach((vc: ViewConfig) => $view.activateViewConfig(vc));\n\n $view.sync();\n};\n\nexport const registerActivateViews = (transitionService: TransitionService) =>\n transitionService.onSuccess({}, activateViews);\n","/** @module hooks */\n/** for typedoc */\nimport { Transition } from '../transition/transition';\nimport { copy } from '../common/common';\nimport { TransitionService } from '../transition/transitionService';\n\n/**\n * A [[TransitionHookFn]] which updates global UI-Router state\n *\n * Registered using `transitionService.onBefore({}, updateGlobalState);`\n *\n * Before a [[Transition]] starts, updates the global value of \"the current transition\" ([[Globals.transition]]).\n * After a successful [[Transition]], updates the global values of \"the current state\"\n * ([[Globals.current]] and [[Globals.$current]]) and \"the current param values\" ([[Globals.params]]).\n *\n * See also the deprecated properties:\n * [[StateService.transition]], [[StateService.current]], [[StateService.params]]\n */\nconst updateGlobalState = (trans: Transition) => {\n let globals = trans.router.globals;\n\n const transitionSuccessful = () => {\n globals.successfulTransitions.enqueue(trans);\n globals.$current = trans.$to();\n globals.current = globals.$current.self;\n\n copy(trans.params(), globals.params);\n };\n\n const clearCurrentTransition = () => {\n // Do not clear globals.transition if a different transition has started in the meantime\n if (globals.transition === trans) globals.transition = null;\n };\n\n trans.onSuccess({}, transitionSuccessful, { priority: 10000 });\n trans.promise.then(clearCurrentTransition, clearCurrentTransition);\n};\n\nexport const registerUpdateGlobalState = (transitionService: TransitionService) =>\n transitionService.onCreate({}, updateGlobalState);\n","/** @module hooks */ /** */\nimport {UrlRouter} from \"../url/urlRouter\";\nimport {StateService} from \"../state/stateService\";\nimport {Transition} from \"../transition/transition\";\nimport {TransitionHookFn} from \"../transition/interface\";\nimport {TransitionService} from \"../transition/transitionService\";\n\n/** \n * A [[TransitionHookFn]] which updates the URL after a successful transition\n * \n * Registered using `transitionService.onSuccess({}, updateUrl);`\n */\nconst updateUrl: TransitionHookFn = (transition: Transition) => {\n let options = transition.options();\n let $state: StateService = transition.router.stateService;\n let $urlRouter: UrlRouter = transition.router.urlRouter;\n\n // Dont update the url in these situations:\n // The transition was triggered by a URL sync (options.source === 'url')\n // The user doesn't want the url to update (options.location === false)\n // The destination state, and all parents have no navigable url\n if (options.source !== 'url' && options.location && $state.$current.navigable) {\n var urlOptions = {replace: options.location === 'replace'};\n $urlRouter.push($state.$current.navigable.url, $state.params, urlOptions);\n }\n\n $urlRouter.update(true);\n};\n\nexport const registerUpdateUrl = (transitionService: TransitionService) =>\n transitionService.onSuccess({}, updateUrl, {priority: 9999});\n","/** @module transition */ /** */\nimport { TransitionHookPhase, PathType } from \"./interface\";\nimport { GetErrorHandler, GetResultHandler, TransitionHook } from \"./transitionHook\";\n/**\n * This class defines a type of hook, such as `onBefore` or `onEnter`.\n * Plugins can define custom hook types, such as sticky states does for `onInactive`.\n *\n * @interalapi\n */\nexport class TransitionEventType {\n\n constructor(public name: string,\n public hookPhase: TransitionHookPhase,\n public hookOrder: number,\n public criteriaMatchPath: PathType,\n public reverseSort: boolean = false,\n public getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,\n public getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,\n public synchronous: boolean = false,\n ) { }\n}\n","/**\n * @coreapi\n * @module transition\n */\n/** for typedoc */\nimport {\n IHookRegistry, TransitionOptions, TransitionHookScope, TransitionHookPhase, TransitionCreateHookFn, HookMatchCriteria,\n HookRegOptions, PathTypes, PathType, RegisteredHooks, TransitionHookFn, TransitionStateHookFn\n} from \"./interface\";\nimport { Transition } from \"./transition\";\nimport { makeEvent, RegisteredHook } from \"./hookRegistry\";\nimport { TargetState } from \"../state/targetState\";\nimport { PathNode } from \"../path/pathNode\";\nimport { ViewService } from \"../view/view\";\nimport { UIRouter } from \"../router\";\nimport { registerAddCoreResolvables } from \"../hooks/coreResolvables\";\nimport { registerRedirectToHook } from \"../hooks/redirectTo\";\nimport { registerOnExitHook, registerOnRetainHook, registerOnEnterHook } from \"../hooks/onEnterExitRetain\";\nimport { registerEagerResolvePath, registerLazyResolveState } from \"../hooks/resolve\";\nimport { registerLoadEnteringViews, registerActivateViews } from \"../hooks/views\";\nimport { registerUpdateGlobalState } from \"../hooks/updateGlobals\";\nimport { registerUpdateUrl } from \"../hooks/url\";\nimport { registerLazyLoadHook } from \"../hooks/lazyLoad\";\nimport { TransitionEventType } from \"./transitionEventType\";\nimport { TransitionHook, GetResultHandler, GetErrorHandler } from \"./transitionHook\";\nimport { isDefined } from \"../common/predicates\";\nimport { removeFrom, values, createProxyFunctions } from \"../common/common\";\nimport { Disposable } from \"../interface\"; // has or is using\nimport { val } from \"../common/hof\";\nimport { registerIgnoredTransitionHook } from '../hooks/ignoredTransition';\nimport { registerInvalidTransitionHook } from '../hooks/invalidTransition';\n\n/**\n * The default [[Transition]] options.\n *\n * Include this object when applying custom defaults:\n * let reloadOpts = { reload: true, notify: true }\n * let options = defaults(theirOpts, customDefaults, defaultOptions);\n */\nexport let defaultTransOpts: TransitionOptions = {\n location : true,\n relative : null,\n inherit : false,\n notify : true,\n reload : false,\n custom : {},\n current : () => null,\n source : \"unknown\"\n};\n\n\n/**\n * Plugin API for Transition Service\n * @internalapi\n */\nexport interface TransitionServicePluginAPI {\n /**\n * Adds a Path to be used as a criterion against a TreeChanges path\n *\n * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.\n * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`\n * Each state in the exiting path is checked against the criteria and returned as part of the match.\n *\n * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.\n * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`\n * Only the tail of the `to` path is checked against the criteria and returned as part of the match.\n */\n _definePathType(name: string, hookScope: TransitionHookScope);\n\n /**\n * Gets a Path definition used as a criterion against a TreeChanges path\n */\n _getPathTypes(): PathTypes;\n\n /**\n * Defines a transition hook type and returns a transition hook registration\n * function (which can then be used to register hooks of this type).\n */\n _defineEvent(name: string,\n hookPhase: TransitionHookPhase,\n hookOrder: number,\n criteriaMatchPath: PathType,\n reverseSort?: boolean,\n getResultHandler?: GetResultHandler,\n getErrorHandler?: GetErrorHandler,\n rejectIfSuperseded?: boolean);\n\n /**\n * Returns the known event types, such as `onBefore`\n * If a phase argument is provided, returns only events for the given phase.\n */\n _getEvents(phase?: TransitionHookPhase): TransitionEventType[];\n\n /** Returns the hooks registered for the given hook name */\n getHooks(hookName: string): RegisteredHook[];\n}\n\n/**\n * This class provides services related to Transitions.\n *\n * - Most importantly, it allows global Transition Hooks to be registered.\n * - It allows the default transition error handler to be set.\n * - It also has a factory function for creating new [[Transition]] objects, (used internally by the [[StateService]]).\n *\n * At bootstrap, [[UIRouter]] creates a single instance (singleton) of this class.\n */\nexport class TransitionService implements IHookRegistry, Disposable {\n /** @hidden */\n _transitionCount = 0;\n\n /**\n * Registers a [[TransitionHookFn]], called *while a transition is being constructed*.\n *\n * Registers a transition lifecycle hook, which is invoked during transition construction.\n *\n * This low level hook should only be used by plugins.\n * This can be a useful time for plugins to add resolves or mutate the transition as needed.\n * The Sticky States plugin uses this hook to modify the treechanges.\n *\n * ### Lifecycle\n *\n * `onCreate` hooks are invoked *while a transition is being constructed*.\n *\n * ### Return value\n *\n * The hook's return value is ignored\n *\n * @internalapi\n * @param criteria defines which Transitions the Hook should be invoked for.\n * @param callback the hook function which will be invoked.\n * @param options the registration options\n * @returns a function which deregisters the hook.\n */\n onCreate(criteria: HookMatchCriteria, callback: TransitionCreateHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return }\n /** @inheritdoc */\n onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function { return }\n\n /** @hidden */\n public $view: ViewService;\n\n /** @hidden The transition hook types, such as `onEnter`, `onStart`, etc */\n private _eventTypes: TransitionEventType[] = [];\n /** @hidden The registered transition hooks */\n _registeredHooks = { } as RegisteredHooks;\n /** @hidden The paths on a criteria object */\n private _criteriaPaths = { } as PathTypes;\n /** @hidden */\n private _router: UIRouter;\n\n /** @internalapi */\n _pluginapi: TransitionServicePluginAPI;\n\n /**\n * This object has hook de-registration functions for the built-in hooks.\n * This can be used by third parties libraries that wish to customize the behaviors\n *\n * @hidden\n */\n _deregisterHookFns: {\n addCoreResolves: Function;\n ignored: Function;\n invalid: Function;\n redirectTo: Function;\n onExit: Function;\n onRetain: Function;\n onEnter: Function;\n eagerResolve: Function;\n lazyResolve: Function;\n loadViews: Function;\n activateViews: Function;\n updateGlobals: Function;\n updateUrl: Function;\n lazyLoad: Function;\n };\n\n /** @hidden */\n constructor(_router: UIRouter) {\n this._router = _router;\n this.$view = _router.viewService;\n this._deregisterHookFns = {};\n this._pluginapi = createProxyFunctions(val(this), {}, val(this), [\n '_definePathType',\n '_defineEvent',\n '_getPathTypes',\n '_getEvents',\n 'getHooks',\n ]);\n\n this._defineCorePaths();\n this._defineCoreEvents();\n this._registerCoreTransitionHooks();\n }\n\n /**\n * dispose\n * @internalapi\n */\n dispose(router: UIRouter) {\n values(this._registeredHooks).forEach((hooksArray: RegisteredHook[]) => hooksArray.forEach(hook => {\n hook._deregistered = true;\n removeFrom(hooksArray, hook);\n }));\n }\n\n /**\n * Creates a new [[Transition]] object\n *\n * This is a factory function for creating new Transition objects.\n * It is used internally by the [[StateService]] and should generally not be called by application code.\n *\n * @param fromPath the path to the current state (the from state)\n * @param targetState the target state (destination)\n * @returns a Transition\n */\n create(fromPath: PathNode[], targetState: TargetState): Transition {\n return new Transition(fromPath, targetState, this._router);\n }\n\n /** @hidden */\n private _defineCoreEvents() {\n const Phase = TransitionHookPhase;\n const TH = TransitionHook;\n const paths = this._criteriaPaths;\n const NORMAL_SORT = false, REVERSE_SORT = true;\n const ASYNCHRONOUS = false, SYNCHRONOUS = true;\n\n this._defineEvent(\"onCreate\", Phase.CREATE, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.THROW_ERROR, SYNCHRONOUS);\n\n this._defineEvent(\"onBefore\", Phase.BEFORE, 0, paths.to);\n\n this._defineEvent(\"onStart\", Phase.RUN, 0, paths.to);\n this._defineEvent(\"onExit\", Phase.RUN, 100, paths.exiting, REVERSE_SORT);\n this._defineEvent(\"onRetain\", Phase.RUN, 200, paths.retained);\n this._defineEvent(\"onEnter\", Phase.RUN, 300, paths.entering);\n this._defineEvent(\"onFinish\", Phase.RUN, 400, paths.to);\n\n this._defineEvent(\"onSuccess\", Phase.SUCCESS, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS);\n this._defineEvent(\"onError\", Phase.ERROR, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS);\n }\n\n /** @hidden */\n private _defineCorePaths() {\n const { STATE, TRANSITION } = TransitionHookScope;\n\n this._definePathType(\"to\", TRANSITION);\n this._definePathType(\"from\", TRANSITION);\n this._definePathType(\"exiting\", STATE);\n this._definePathType(\"retained\", STATE);\n this._definePathType(\"entering\", STATE);\n }\n\n /** @hidden */\n _defineEvent(name: string,\n hookPhase: TransitionHookPhase,\n hookOrder: number,\n criteriaMatchPath: PathType,\n reverseSort: boolean = false,\n getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,\n getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,\n synchronous: boolean = false)\n {\n let eventType = new TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous);\n\n this._eventTypes.push(eventType);\n makeEvent(this, this, eventType);\n };\n\n /** @hidden */\n private _getEvents(phase?: TransitionHookPhase): TransitionEventType[] {\n let transitionHookTypes = isDefined(phase) ?\n this._eventTypes.filter(type => type.hookPhase === phase) :\n this._eventTypes.slice();\n\n return transitionHookTypes.sort((l, r) => {\n let cmpByPhase = l.hookPhase - r.hookPhase;\n return cmpByPhase === 0 ? l.hookOrder - r.hookOrder : cmpByPhase;\n })\n }\n\n /**\n * Adds a Path to be used as a criterion against a TreeChanges path\n *\n * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.\n * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`\n * Each state in the exiting path is checked against the criteria and returned as part of the match.\n *\n * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.\n * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`\n * Only the tail of the `to` path is checked against the criteria and returned as part of the match.\n *\n * @hidden\n */\n private _definePathType(name: string, hookScope: TransitionHookScope) {\n this._criteriaPaths[name] = { name, scope: hookScope };\n }\n\n /** * @hidden */\n private _getPathTypes(): PathTypes {\n return this._criteriaPaths;\n }\n\n /** @hidden */\n public getHooks(hookName: string): RegisteredHook[] {\n return this._registeredHooks[hookName];\n }\n\n /** @hidden */\n private _registerCoreTransitionHooks() {\n let fns = this._deregisterHookFns;\n\n fns.addCoreResolves = registerAddCoreResolvables(this);\n fns.ignored = registerIgnoredTransitionHook(this);\n fns.invalid = registerInvalidTransitionHook(this);\n\n // Wire up redirectTo hook\n fns.redirectTo = registerRedirectToHook(this);\n \n // Wire up onExit/Retain/Enter state hooks\n fns.onExit = registerOnExitHook(this);\n fns.onRetain = registerOnRetainHook(this);\n fns.onEnter = registerOnEnterHook(this);\n\n // Wire up Resolve hooks\n fns.eagerResolve = registerEagerResolvePath(this);\n fns.lazyResolve = registerLazyResolveState(this);\n \n // Wire up the View management hooks\n fns.loadViews = registerLoadEnteringViews(this);\n fns.activateViews = registerActivateViews(this);\n\n // Updates global state after a transition\n fns.updateGlobals = registerUpdateGlobalState(this);\n\n // After globals.current is updated at priority: 10000\n fns.updateUrl = registerUpdateUrl(this);\n\n // Lazy load state trees\n fns.lazyLoad = registerLazyLoadHook(this);\n }\n}\n","/**\n * @coreapi\n * @module state\n */\n/** */\nimport { createProxyFunctions, defaults, extend, inArray, noop, removeFrom, silenceUncaughtInPromise, silentRejection } from '../common/common';\nimport { isDefined, isObject, isString } from '../common/predicates';\nimport { Queue } from '../common/queue';\nimport { services } from '../common/coreservices';\n\nimport { PathUtils } from '../path/pathFactory';\nimport { PathNode } from '../path/pathNode';\n\nimport { HookResult, TransitionOptions } from '../transition/interface';\nimport { defaultTransOpts } from '../transition/transitionService';\nimport { Rejection, RejectType } from '../transition/rejectFactory';\nimport { Transition } from '../transition/transition';\n\nimport { HrefOptions, LazyLoadResult, StateDeclaration, StateOrName, TransitionPromise } from './interface';\nimport { StateObject } from './stateObject';\nimport { TargetState } from './targetState';\n\nimport { ParamsOrArray, RawParams } from '../params/interface';\nimport { Param } from '../params/param';\nimport { Glob } from '../common/glob';\nimport { UIRouter } from '../router';\nimport { UIInjector } from '../interface';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { lazyLoadState } from '../hooks/lazyLoad';\nimport { not, val } from '../common/hof';\nimport { StateParams } from '../params/stateParams';\n\nexport type OnInvalidCallback =\n (toState?: TargetState, fromState?: TargetState, injector?: UIInjector) => HookResult;\n\n/**\n * Provides state related service functions\n *\n * This class provides services related to ui-router states.\n * An instance of this class is located on the global [[UIRouter]] object.\n */\nexport class StateService {\n /** @internalapi */\n invalidCallbacks: OnInvalidCallback[] = [];\n\n /**\n * The [[Transition]] currently in progress (or null)\n *\n * This is a passthrough through to [[UIRouterGlobals.transition]]\n */\n get transition() { return this.router.globals.transition; }\n /**\n * The latest successful state parameters\n *\n * This is a passthrough through to [[UIRouterGlobals.params]]\n */\n get params(): StateParams { return this.router.globals.params; }\n /**\n * The current [[StateDeclaration]]\n *\n * This is a passthrough through to [[UIRouterGlobals.current]]\n */\n get current() { return this.router.globals.current; }\n /**\n * The current [[StateObject]]\n *\n * This is a passthrough through to [[UIRouterGlobals.$current]]\n */\n get $current() { return this.router.globals.$current; }\n\n /** @internalapi */\n constructor(private router: UIRouter) {\n let getters = ['current', '$current', 'params', 'transition'];\n let boundFns = Object.keys(StateService.prototype).filter(not(inArray(getters)));\n createProxyFunctions(val(StateService.prototype), this, val(this), boundFns);\n }\n\n /** @internalapi */\n dispose() {\n this.defaultErrorHandler(noop);\n this.invalidCallbacks = [];\n }\n\n /**\n * Handler for when [[transitionTo]] is called with an invalid state.\n *\n * Invokes the [[onInvalid]] callbacks, in natural order.\n * Each callback's return value is checked in sequence until one of them returns an instance of TargetState.\n * The results of the callbacks are wrapped in $q.when(), so the callbacks may return promises.\n *\n * If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned.\n *\n * @internalapi\n */\n private _handleInvalidTargetState(fromPath: PathNode[], toState: TargetState) {\n let fromState = PathUtils.makeTargetState(fromPath);\n let globals = this.router.globals;\n const latestThing = () => globals.transitionHistory.peekTail();\n let latest = latestThing();\n let callbackQueue = new Queue(this.invalidCallbacks.slice());\n let injector = new ResolveContext(fromPath).injector();\n\n const checkForRedirect = (result: HookResult) => {\n if (!(result instanceof TargetState)) {\n return;\n }\n\n let target = result;\n // Recreate the TargetState, in case the state is now defined.\n target = this.target(target.identifier(), target.params(), target.options());\n\n if (!target.valid()) {\n return Rejection.invalid(target.error()).toPromise();\n }\n\n if (latestThing() !== latest) {\n return Rejection.superseded().toPromise();\n }\n\n return this.transitionTo(target.identifier(), target.params(), target.options());\n };\n\n function invokeNextCallback() {\n let nextCallback = callbackQueue.dequeue();\n if (nextCallback === undefined) return Rejection.invalid(toState.error()).toPromise();\n\n let callbackResult = services.$q.when(nextCallback(toState, fromState, injector));\n return callbackResult.then(checkForRedirect).then(result => result || invokeNextCallback());\n }\n\n return invokeNextCallback();\n }\n\n /**\n * Registers an Invalid State handler\n *\n * Registers a [[OnInvalidCallback]] function to be invoked when [[StateService.transitionTo]]\n * has been called with an invalid state reference parameter\n *\n * Example:\n * ```js\n * stateService.onInvalid(function(to, from, injector) {\n * if (to.name() === 'foo') {\n * let lazyLoader = injector.get('LazyLoadService');\n * return lazyLoader.load('foo')\n * .then(() => stateService.target('foo'));\n * }\n * });\n * ```\n *\n * @param {function} callback invoked when the toState is invalid\n * This function receives the (invalid) toState, the fromState, and an injector.\n * The function may optionally return a [[TargetState]] or a Promise for a TargetState.\n * If one is returned, it is treated as a redirect.\n *\n * @returns a function which deregisters the callback\n */\n onInvalid(callback: OnInvalidCallback): Function {\n this.invalidCallbacks.push(callback);\n return function deregisterListener() {\n removeFrom(this.invalidCallbacks)(callback);\n }.bind(this);\n }\n\n\n /**\n * Reloads the current state\n *\n * A method that force reloads the current state, or a partial state hierarchy.\n * All resolves are re-resolved, and components reinstantiated.\n *\n * #### Example:\n * ```js\n * let app angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.reload = function(){\n * $state.reload();\n * }\n * });\n * ```\n *\n * Note: `reload()` is just an alias for:\n *\n * ```js\n * $state.transitionTo($state.current, $state.params, {\n * reload: true, inherit: false\n * });\n * ```\n *\n * @param reloadState A state name or a state object.\n * If present, this state and all its children will be reloaded, but ancestors will not reload.\n *\n * #### Example:\n * ```js\n * //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item'\n * //and current state is 'contacts.detail.item'\n * let app angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.reload = function(){\n * //will reload 'contact.detail' and nested 'contact.detail.item' states\n * $state.reload('contact.detail');\n * }\n * });\n * ```\n *\n * @returns A promise representing the state of the new transition. See [[StateService.go]]\n */\n reload(reloadState?: StateOrName): Promise {\n return this.transitionTo(this.current, this.params, {\n reload: isDefined(reloadState) ? reloadState : true,\n inherit: false,\n notify: false,\n });\n };\n\n /**\n * Transition to a different state and/or parameters\n *\n * Convenience method for transitioning to a new state.\n *\n * `$state.go` calls `$state.transitionTo` internally but automatically sets options to\n * `{ location: true, inherit: true, relative: router.globals.$current, notify: true }`.\n * This allows you to use either an absolute or relative `to` argument (because of `relative: router.globals.$current`).\n * It also allows you to specify * only the parameters you'd like to update, while letting unspecified parameters\n * inherit from the current parameter values (because of `inherit: true`).\n *\n * #### Example:\n * ```js\n * let app = angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.changeState = function () {\n * $state.go('contact.detail');\n * };\n * });\n * ```\n *\n * @param to Absolute state name, state object, or relative state path (relative to current state).\n *\n * Some examples:\n *\n * - `$state.go('contact.detail')` - will go to the `contact.detail` state\n * - `$state.go('^')` - will go to the parent state\n * - `$state.go('^.sibling')` - if current state is `home.child`, will go to the `home.sibling` state\n * - `$state.go('.child.grandchild')` - if current state is home, will go to the `home.child.grandchild` state\n *\n * @param params A map of the parameters that will be sent to the state, will populate $stateParams.\n *\n * Any parameters that are not specified will be inherited from current parameter values (because of `inherit: true`).\n * This allows, for example, going to a sibling state that shares parameters defined by a parent state.\n *\n * @param options Transition options\n *\n * @returns {promise} A promise representing the state of the new transition.\n */\n go(to: StateOrName, params?: RawParams, options?: TransitionOptions): TransitionPromise {\n let defautGoOpts = { relative: this.$current, inherit: true };\n let transOpts = defaults(options, defautGoOpts, defaultTransOpts);\n return this.transitionTo(to, params, transOpts);\n };\n\n /**\n * Creates a [[TargetState]]\n *\n * This is a factory method for creating a TargetState\n *\n * This may be returned from a Transition Hook to redirect a transition, for example.\n */\n target(identifier: StateOrName, params?: ParamsOrArray, options: TransitionOptions = {}): TargetState {\n // If we're reloading, find the state object to reload from\n if (isObject(options.reload) && !(options.reload).name)\n throw new Error('Invalid reload state object');\n let reg = this.router.stateRegistry;\n options.reloadState = options.reload === true ? reg.root() : reg.matcher.find( options.reload, options.relative);\n\n if (options.reload && !options.reloadState)\n throw new Error(`No such reload state '${(isString(options.reload) ? options.reload : (options.reload).name)}'`);\n\n let stateDefinition = reg.matcher.find(identifier, options.relative);\n return new TargetState(identifier, stateDefinition, params, options);\n };\n\n private getCurrentPath(): PathNode[] {\n let globals = this.router.globals;\n let latestSuccess: Transition = globals.successfulTransitions.peekTail();\n const rootPath = () => [ new PathNode(this.router.stateRegistry.root()) ];\n return latestSuccess ? latestSuccess.treeChanges().to : rootPath();\n }\n\n /**\n * Low-level method for transitioning to a new state.\n *\n * The [[go]] method (which uses `transitionTo` internally) is recommended in most situations.\n *\n * #### Example:\n * ```js\n * let app = angular.module('app', ['ui.router']);\n *\n * app.controller('ctrl', function ($scope, $state) {\n * $scope.changeState = function () {\n * $state.transitionTo('contact.detail');\n * };\n * });\n * ```\n *\n * @param to State name or state object.\n * @param toParams A map of the parameters that will be sent to the state,\n * will populate $stateParams.\n * @param options Transition options\n *\n * @returns A promise representing the state of the new transition. See [[go]]\n */\n transitionTo(to: StateOrName, toParams: RawParams = {}, options: TransitionOptions = {}): TransitionPromise {\n let router = this.router;\n let globals = router.globals;\n options = defaults(options, defaultTransOpts);\n const getCurrent = () =>\n globals.transition;\n options = extend(options, { current: getCurrent });\n\n let ref: TargetState = this.target(to, toParams, options);\n let currentPath = this.getCurrentPath();\n\n if (!ref.exists())\n return this._handleInvalidTargetState(currentPath, ref);\n\n if (!ref.valid())\n return silentRejection(ref.error());\n\n /**\n * Special handling for Ignored, Aborted, and Redirected transitions\n *\n * The semantics for the transition.run() promise and the StateService.transitionTo()\n * promise differ. For instance, the run() promise may be rejected because it was\n * IGNORED, but the transitionTo() promise is resolved because from the user perspective\n * no error occurred. Likewise, the transition.run() promise may be rejected because of\n * a Redirect, but the transitionTo() promise is chained to the new Transition's promise.\n */\n const rejectedTransitionHandler = (transition: Transition) => (error: any): Promise => {\n if (error instanceof Rejection) {\n const isLatest = router.globals.lastStartedTransitionId === transition.$id;\n\n if (error.type === RejectType.IGNORED) {\n isLatest && router.urlRouter.update();\n // Consider ignored `Transition.run()` as a successful `transitionTo`\n return services.$q.when(globals.current);\n }\n\n const detail: any = error.detail;\n if (error.type === RejectType.SUPERSEDED && error.redirected && detail instanceof TargetState) {\n // If `Transition.run()` was redirected, allow the `transitionTo()` promise to resolve successfully\n // by returning the promise for the new (redirect) `Transition.run()`.\n let redirect: Transition = transition.redirect(detail);\n return redirect.run().catch(rejectedTransitionHandler(redirect));\n }\n\n if (error.type === RejectType.ABORTED) {\n isLatest && router.urlRouter.update();\n return services.$q.reject(error);\n }\n }\n\n let errorHandler = this.defaultErrorHandler();\n errorHandler(error);\n\n return services.$q.reject(error);\n };\n\n let transition = this.router.transitionService.create(currentPath, ref);\n let transitionToPromise = transition.run().catch(rejectedTransitionHandler(transition));\n silenceUncaughtInPromise(transitionToPromise); // issue #2676\n\n // Return a promise for the transition, which also has the transition object on it.\n return extend(transitionToPromise, { transition });\n };\n\n /**\n * Checks if the current state *is* the provided state\n *\n * Similar to [[includes]] but only checks for the full state name.\n * If params is supplied then it will be tested for strict equality against the current\n * active params object, so all params must match with none missing and no extras.\n *\n * #### Example:\n * ```js\n * $state.$current.name = 'contacts.details.item';\n *\n * // absolute name\n * $state.is('contact.details.item'); // returns true\n * $state.is(contactDetailItemStateObject); // returns true\n * ```\n *\n * // relative name (. and ^), typically from a template\n * // E.g. from the 'contacts.details' template\n * ```html\n *
    Item
    \n * ```\n *\n * @param stateOrName The state name (absolute or relative) or state object you'd like to check.\n * @param params A param object, e.g. `{sectionId: section.id}`, that you'd like\n * to test against the current active state.\n * @param options An options object. The options are:\n * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will\n * test relative to `options.relative` state (or name).\n *\n * @returns Returns true if it is the state.\n */\n is(stateOrName: StateOrName, params?: RawParams, options?: { relative?: StateOrName }): boolean {\n options = defaults(options, { relative: this.$current });\n let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);\n if (!isDefined(state)) return undefined;\n if (this.$current !== state) return false;\n if (!params) return true;\n\n let schema: Param[] = state.parameters({ inherit: true, matchingKeys: params });\n return Param.equals(schema, Param.values(schema, params), this.params);\n };\n\n /**\n * Checks if the current state *includes* the provided state\n *\n * A method to determine if the current active state is equal to or is the child of the\n * state stateName. If any params are passed then they will be tested for a match as well.\n * Not all the parameters need to be passed, just the ones you'd like to test for equality.\n *\n * #### Example when `$state.$current.name === 'contacts.details.item'`\n * ```js\n * // Using partial names\n * $state.includes(\"contacts\"); // returns true\n * $state.includes(\"contacts.details\"); // returns true\n * $state.includes(\"contacts.details.item\"); // returns true\n * $state.includes(\"contacts.list\"); // returns false\n * $state.includes(\"about\"); // returns false\n * ```\n *\n * #### Glob Examples when `* $state.$current.name === 'contacts.details.item.url'`:\n * ```js\n * $state.includes(\"*.details.*.*\"); // returns true\n * $state.includes(\"*.details.**\"); // returns true\n * $state.includes(\"**.item.**\"); // returns true\n * $state.includes(\"*.details.item.url\"); // returns true\n * $state.includes(\"*.details.*.url\"); // returns true\n * $state.includes(\"*.details.*\"); // returns false\n * $state.includes(\"item.**\"); // returns false\n * ```\n *\n * @param stateOrName A partial name, relative name, glob pattern,\n * or state object to be searched for within the current state name.\n * @param params A param object, e.g. `{sectionId: section.id}`,\n * that you'd like to test against the current active state.\n * @param options An options object. The options are:\n * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will\n * test relative to `options.relative` state (or name).\n *\n * @returns {boolean} Returns true if it does include the state\n */\n includes(stateOrName: StateOrName, params?: RawParams, options?: TransitionOptions): boolean {\n options = defaults(options, { relative: this.$current });\n let glob = isString(stateOrName) && Glob.fromString( stateOrName);\n\n if (glob) {\n if (!glob.matches(this.$current.name)) return false;\n stateOrName = this.$current.name;\n }\n let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative), include = this.$current.includes;\n\n if (!isDefined(state)) return undefined;\n if (!isDefined(include[state.name])) return false;\n if (!params) return true;\n\n let schema: Param[] = state.parameters({ inherit: true, matchingKeys: params });\n return Param.equals(schema, Param.values(schema, params), this.params);\n };\n\n\n /**\n * Generates a URL for a state and parameters\n *\n * Returns the url for the given state populated with the given params.\n *\n * #### Example:\n * ```js\n * expect($state.href(\"about.person\", { person: \"bob\" })).toEqual(\"/about/bob\");\n * ```\n *\n * @param stateOrName The state name or state object you'd like to generate a url from.\n * @param params An object of parameter values to fill the state's required parameters.\n * @param options Options object. The options are:\n *\n * @returns {string} compiled state url\n */\n href(stateOrName: StateOrName, params: RawParams, options?: HrefOptions): string {\n let defaultHrefOpts = {\n lossy: true,\n inherit: true,\n absolute: false,\n relative: this.$current,\n };\n options = defaults(options, defaultHrefOpts);\n params = params || {};\n\n let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);\n\n if (!isDefined(state)) return null;\n if (options.inherit) params = this.params.$inherit(params, this.$current, state);\n\n let nav = (state && options.lossy) ? state.navigable : state;\n\n if (!nav || nav.url === undefined || nav.url === null) {\n return null;\n }\n return this.router.urlRouter.href(nav.url, params, {\n absolute: options.absolute,\n });\n };\n\n /** @hidden */\n private _defaultErrorHandler: ((_error: any) => void) = function $defaultErrorHandler($error$) {\n if ($error$ instanceof Error && $error$.stack) {\n console.error($error$);\n console.error($error$.stack);\n } else if ($error$ instanceof Rejection) {\n console.error($error$.toString());\n if ($error$.detail && $error$.detail.stack)\n console.error($error$.detail.stack);\n } else {\n console.error($error$);\n }\n };\n\n /**\n * Sets or gets the default [[transitionTo]] error handler.\n *\n * The error handler is called when a [[Transition]] is rejected or when any error occurred during the Transition.\n * This includes errors caused by resolves and transition hooks.\n *\n * Note:\n * This handler does not receive certain Transition rejections.\n * Redirected and Ignored Transitions are not considered to be errors by [[StateService.transitionTo]].\n *\n * The built-in default error handler logs the error to the console.\n *\n * You can provide your own custom handler.\n *\n * #### Example:\n * ```js\n * stateService.defaultErrorHandler(function() {\n * // Do not log transitionTo errors\n * });\n * ```\n *\n * @param handler a global error handler function\n * @returns the current global error handler\n */\n defaultErrorHandler(handler?: (error: any) => void): (error: any) => void {\n return this._defaultErrorHandler = handler || this._defaultErrorHandler;\n }\n\n /**\n * Gets a registered [[StateDeclaration]] object\n *\n * Returns the state declaration object for any specific state, or for all registered states.\n *\n * @param stateOrName (absolute or relative) If provided, will only get the declaration object for the requested state.\n * If not provided, returns an array of ALL states.\n * @param base When `stateOrName` is a relative state reference (such as `.bar.baz`), the state will be retrieved relative to this state.\n *\n * @returns a [[StateDeclaration]] object (or array of all registered [[StateDeclaration]] objects.)\n */\n get(stateOrName: StateOrName, base: StateOrName): StateDeclaration;\n get(stateOrName: StateOrName): StateDeclaration;\n get(): StateDeclaration[];\n get(stateOrName?: StateOrName, base?: StateOrName): any {\n let reg = this.router.stateRegistry;\n if (arguments.length === 0) return reg.get();\n return reg.get(stateOrName, base || this.$current);\n }\n\n /**\n * Lazy loads a state\n *\n * Explicitly runs a state's [[StateDeclaration.lazyLoad]] function.\n *\n * @param stateOrName the state that should be lazy loaded\n * @param transition the optional Transition context to use (if the lazyLoad function requires an injector, etc)\n * Note: If no transition is provided, a noop transition is created using the from the current state to the current state.\n * This noop transition is not actually run.\n *\n * @returns a promise to lazy load\n */\n lazyLoad(stateOrName: StateOrName, transition?: Transition): Promise {\n let state: StateDeclaration = this.get(stateOrName);\n if (!state || !state.lazyLoad) throw new Error(\"Can not lazy load \" + stateOrName);\n\n let currentPath = this.getCurrentPath();\n let target = PathUtils.makeTargetState(currentPath);\n transition = transition || this.router.transitionService.create(currentPath, target);\n\n return lazyLoadState(transition, state);\n }\n}\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { isArray, isObject, $QLike } from \"../common/index\";\n\n/**\n * An angular1-like promise api\n *\n * This object implements four methods similar to the\n * [angular 1 promise api](https://docs.angularjs.org/api/ng/service/$q)\n *\n * UI-Router evolved from an angular 1 library to a framework agnostic library.\n * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.\n *\n * This API provides native ES6 promise support wrapped as a $q-like API.\n * Internally, UI-Router uses this $q object to perform promise operations.\n * The `angular-ui-router` (ui-router for angular 1) uses the $q API provided by angular.\n *\n * $q-like promise api\n */\nexport const $q = {\n /** Normalizes a value as a promise */\n when: (val) => new Promise((resolve, reject) => resolve(val)),\n\n /** Normalizes a value as a promise rejection */\n reject: (val) => new Promise((resolve, reject) => { reject(val); }),\n\n /** @returns a deferred object, which has `resolve` and `reject` functions */\n defer: () => {\n let deferred: any = {};\n deferred.promise = new Promise((resolve, reject) => {\n deferred.resolve = resolve;\n deferred.reject = reject;\n });\n return deferred;\n },\n\n /** Like Promise.all(), but also supports object key/promise notation like $q */\n all: (promises: { [key: string]: Promise } | Promise[]) => {\n if (isArray(promises)) {\n return Promise.all(promises);\n }\n\n if (isObject(promises)) {\n // Convert promises map to promises array.\n // When each promise resolves, map it to a tuple { key: key, val: val }\n let chain = Object.keys(promises)\n .map(key => promises[key].then(val => ({key, val})));\n\n // Then wait for all promises to resolve, and convert them back to an object\n return $q.all(chain).then(values =>\n values.reduce((acc, tuple) => { acc[tuple.key] = tuple.val; return acc; }, {}));\n }\n }\n} as $QLike;","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport {\n extend, assertPredicate, isFunction, isArray, isInjectable, $InjectorLike, IInjectable\n} from \"../common/index\";\n\n// globally available injectables\nlet globals = {};\nlet STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg;\nlet ARGUMENT_NAMES = /([^\\s,]+)/g;\n\n/**\n * A basic angular1-like injector api\n *\n * This object implements four methods similar to the\n * [angular 1 dependency injector](https://docs.angularjs.org/api/auto/service/$injector)\n *\n * UI-Router evolved from an angular 1 library to a framework agnostic library.\n * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.\n *\n * This object provides a naive implementation of a globally scoped dependency injection system.\n * It supports the following DI approaches:\n *\n * ### Function parameter names\n *\n * A function's `.toString()` is called, and the parameter names are parsed.\n * This only works when the parameter names aren't \"mangled\" by a minifier such as UglifyJS.\n *\n * ```js\n * function injectedFunction(FooService, BarService) {\n * // FooService and BarService are injected\n * }\n * ```\n *\n * ### Function annotation\n *\n * A function may be annotated with an array of dependency names as the `$inject` property.\n *\n * ```js\n * injectedFunction.$inject = [ 'FooService', 'BarService' ];\n * function injectedFunction(fs, bs) {\n * // FooService and BarService are injected as fs and bs parameters\n * }\n * ```\n *\n * ### Array notation\n *\n * An array provides the names of the dependencies to inject (as strings).\n * The function is the last element of the array.\n *\n * ```js\n * [ 'FooService', 'BarService', function (fs, bs) {\n * // FooService and BarService are injected as fs and bs parameters\n * }]\n * ```\n *\n * @type {$InjectorLike}\n */\nexport const $injector = {\n /** Gets an object from DI based on a string token */\n get: name => globals[name],\n\n /** Returns true if an object named `name` exists in global DI */\n has: (name) => $injector.get(name) != null,\n\n /**\n * Injects a function\n *\n * @param fn the function to inject\n * @param context the function's `this` binding\n * @param locals An object with additional DI tokens and values, such as `{ someToken: { foo: 1 } }`\n */\n invoke: (fn: IInjectable, context?, locals?) => {\n let all = extend({}, globals, locals || {});\n let params = $injector.annotate(fn);\n let ensureExist = assertPredicate((key: string) => all.hasOwnProperty(key), key => `DI can't find injectable: '${key}'`);\n let args = params.filter(ensureExist).map(x => all[x]);\n if (isFunction(fn)) return fn.apply(context, args);\n else return (fn as any[]).slice(-1)[0].apply(context, args);\n },\n\n /**\n * Returns a function's dependencies\n *\n * Analyzes a function (or array) and returns an array of DI tokens that the function requires.\n * @return an array of `string`s\n */\n annotate: (fn: IInjectable): any[] => {\n if (!isInjectable(fn)) throw new Error(`Not an injectable function: ${fn}`);\n if (fn && (fn as any).$inject) return (fn as any).$inject;\n if (isArray(fn)) return fn.slice(0, -1);\n let fnStr = fn.toString().replace(STRIP_COMMENTS, '');\n let result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES);\n return result || [];\n }\n} as $InjectorLike;","/**\n * @internalapi\n * @module vanilla\n */ /** */\n\nimport { LocationServices } from \"../common/coreservices\";\nimport { Disposable } from \"../interface\";\nimport { UIRouter } from \"../router\";\nimport { LocationLike, HistoryLike } from \"./interface\";\nimport { parseUrl, getParams, buildUrl } from \"./utils\";\nimport { isDefined } from \"../common/predicates\";\nimport { extend, deregAll, removeFrom } from \"../common/common\";\n/** A base `LocationServices` */\nexport abstract class BaseLocationServices implements LocationServices, Disposable {\n constructor(router: UIRouter, public fireAfterUpdate: boolean) {\n this._location = window && window.location;\n this._history = window && window.history;\n }\n\n _listener = evt => this._listeners.forEach(cb => cb(evt));\n\n private _listeners: Function[] = [];\n _location: LocationLike;\n _history: HistoryLike;\n\n /**\n * This should return the current internal URL representation.\n *\n * The internal URL includes only the portion that UI-Router matches.\n * It does not include:\n * - protocol\n * - server\n * - port\n * - base href or hash\n */\n abstract _get(): string;\n\n /**\n * This should set the current URL.\n *\n * The `url` param should include only the portion that UI-Router matches on.\n * It should not include:\n * - protocol\n * - server\n * - port\n * - base href or hash\n *\n * However, after this function completes, the browser URL should reflect the entire (fully qualified)\n * HREF including those data.\n */\n abstract _set(state: any, title: string, url: string, replace: boolean);\n\n hash = () => parseUrl(this._get()).hash;\n path = () => parseUrl(this._get()).path;\n search = () => getParams(parseUrl(this._get()).search);\n\n url(url?: string, replace: boolean = true): string {\n if (isDefined(url) && url !== this._get()) {\n this._set(null, null, url, replace);\n\n if (this.fireAfterUpdate) {\n let evt = extend(new Event(\"locationchange\"), { url });\n this._listeners.forEach(cb => cb(evt));\n }\n }\n\n return buildUrl(this);\n }\n\n onChange(cb: EventListener) {\n this._listeners.push(cb);\n return () => removeFrom(this._listeners, cb);\n }\n\n dispose(router: UIRouter) {\n deregAll(this._listeners);\n }\n}\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { trimHashVal } from \"./utils\";\nimport { UIRouter } from \"../router\";\nimport { BaseLocationServices } from \"./baseLocationService\";\n\n/** A `LocationServices` that uses the browser hash \"#\" to get/set the current location */\nexport class HashLocationService extends BaseLocationServices {\n constructor(router: UIRouter) {\n super(router, false);\n window.addEventListener('hashchange', this._listener, false);\n }\n\n _get() {\n return trimHashVal(this._location.hash);\n }\n _set(state: any, title: string, url: string, replace: boolean) {\n this._location.hash = url;\n }\n\n dispose (router: UIRouter) {\n super.dispose(router);\n window.removeEventListener('hashchange', this._listener);\n }\n}\n\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { BaseLocationServices } from \"./baseLocationService\";\nimport { UIRouter } from \"../router\";\n\n/** A `LocationServices` that gets/sets the current location from an in-memory object */\nexport class MemoryLocationService extends BaseLocationServices {\n _url: string;\n\n constructor(router: UIRouter) {\n super(router, true);\n }\n\n _get() {\n return this._url;\n }\n\n _set(state: any, title: string, url: string, replace: boolean) {\n this._url = url;\n }\n}\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { LocationConfig } from \"../common/coreservices\";\nimport { splitQuery, splitHash } from \"./utils\";\nimport { UIRouter } from \"../router\";\nimport { BaseLocationServices } from \"./baseLocationService\";\n\n/**\n * A `LocationServices` that gets/sets the current location using the browser's `location` and `history` apis\n *\n * Uses `history.pushState` and `history.replaceState`\n */\nexport class PushStateLocationService extends BaseLocationServices {\n _config: LocationConfig;\n\n constructor(router: UIRouter) {\n super(router, true);\n this._config = router.urlService.config;\n window.addEventListener(\"popstate\", this._listener, false);\n };\n\n _get() {\n let { pathname, hash, search } = this._location;\n search = splitQuery(search)[1]; // strip ? if found\n hash = splitHash(hash)[1]; // strip # if found\n return pathname + (search ? \"?\" + search : \"\") + (hash ? \"$\" + search : \"\");\n }\n\n _set(state: any, title: string, url: string, replace: boolean) {\n let { _config, _history } = this;\n let fullUrl = _config.baseHref() + url;\n\n if (replace) {\n _history.replaceState(state, title, fullUrl);\n } else {\n _history.pushState(state, title, fullUrl);\n }\n }\n\n dispose(router: UIRouter) {\n super.dispose(router);\n window.removeEventListener(\"popstate\", this._listener);\n }\n}\n\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { LocationConfig } from \"../common/coreservices\";\nimport { isDefined } from \"../common/predicates\";\nimport { noop } from \"../common/common\";\n\n/** A `LocationConfig` mock that gets/sets all config from an in-memory object */\nexport class MemoryLocationConfig implements LocationConfig {\n _baseHref = '';\n _port = 80;\n _protocol = \"http\";\n _host = \"localhost\";\n _hashPrefix = \"\";\n\n port = () => this._port;\n protocol = () => this._protocol;\n host = () => this._host;\n baseHref = () => this._baseHref;\n html5Mode = () => false;\n hashPrefix = (newval?) => isDefined(newval) ? this._hashPrefix = newval : this._hashPrefix;\n dispose = noop;\n}","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { isDefined } from \"../common/predicates\";\nimport { LocationConfig } from \"../common/coreservices\";\n\n/** A `LocationConfig` that delegates to the browser's `location` object */\nexport class BrowserLocationConfig implements LocationConfig {\n private _baseHref = undefined;\n private _hashPrefix = \"\";\n\n constructor(router?, private _isHtml5 = false) { }\n\n port(): number {\n if (location.port) {\n return Number(location.port);\n }\n\n return this.protocol() === 'https' ? 443 : 80;\n }\n\n protocol(): string {\n return location.protocol.replace(/:/g, '');\n }\n\n host(): string {\n return location.hostname;\n }\n\n html5Mode(): boolean {\n return this._isHtml5;\n }\n\n hashPrefix(): string;\n hashPrefix(newprefix?: string): string {\n return isDefined(newprefix) ? this._hashPrefix = newprefix : this._hashPrefix;\n };\n\n baseHref(href?: string): string {\n return isDefined(href) ? this._baseHref = href : this._baseHref || this.applyDocumentBaseHref();\n }\n\n applyDocumentBaseHref() {\n let baseTags = document.getElementsByTagName(\"base\");\n return this._baseHref = baseTags.length ? baseTags[0].href.substr(location.origin.length) : \"\";\n }\n\n dispose() {}\n}\n","/**\n * # Core classes and interfaces\n *\n * The classes and interfaces that are core to ui-router and do not belong\n * to a more specific subsystem (such as resolve).\n *\n * @coreapi\n * @preferred\n * @module core\n */ /** for typedoc */\n\n// Need to import or export at least one concrete something\nimport {noop} from \"./common/common\";\nimport {UIRouter} from \"./router\";\n\n/**\n * An interface for getting values from dependency injection.\n *\n * This is primarily used to get resolve values for a given token.\n * An instance of the `UIInjector` can be retrieved from the current transition using [[Transition.injector]].\n *\n * ---\n *\n * If no resolve is found for a token, then it will delegate to the native injector.\n * The native injector may be Angular 1 `$injector`, Angular 2 `Injector`, or a simple polyfill.\n *\n * In Angular 2, the native injector might be the root Injector,\n * or it might be a lazy loaded `NgModule` injector scoped to a lazy load state tree.\n */\nexport interface UIInjector {\n /**\n * Gets a value from the injector.\n *\n * For a given token, returns the value from the injector that matches the token.\n * If the token is for a resolve that has not yet been fetched, this throws an error.\n *\n * #### Example:\n * ```js\n * var myResolve = injector.get('myResolve');\n * ```\n *\n * #### ng1 Example:\n * ```js\n * // Fetch StateService\n * injector.get('$state').go('home');\n * ```\n *\n * #### ng2 Example:\n * ```js\n * import {StateService} from \"ui-router-ng2\";\n * // Fetch StateService\n * injector.get(StateService).go('home');\n * ```\n *\n * #### Typescript Example:\n * ```js\n * var stringArray = injector.get('myStringArray');\n * ```\n *\n * ### `NOWAIT` policy\n *\n * When using [[ResolvePolicy.async]] === `NOWAIT`, the value returned from `get()` is a promise for the result.\n * The promise is not automatically unwrapped.\n *\n * @param token the key for the value to get. May be a string, a class, or any arbitrary object.\n * @return the Dependency Injection value that matches the token\n */\n get(token: any): any;\n /** Gets a value as type `T` (generics parameter) */\n get(token: any): T;\n\n /**\n * Asynchronously gets a value from the injector\n *\n * For a given token, returns a promise for the value from the injector that matches the token.\n * If the token is for a resolve that has not yet been fetched, this triggers the resolve to load.\n *\n * #### Example:\n * ```js\n * return injector.getAsync('myResolve').then(value => {\n * if (value === 'declined') return false;\n * });\n * ```\n *\n * @param token the key for the value to get. May be a string or arbitrary object.\n * @return a Promise for the Dependency Injection value that matches the token\n */\n getAsync(token: any): Promise;\n /** Asynchronously gets a value as type `T` (generics parameter) */\n getAsync(token: any): Promise;\n\n /**\n * Gets a value from the native injector\n *\n * Returns a value from the native injector, bypassing anything in the [[ResolveContext]].\n *\n * Example:\n * ```js\n * let someThing = injector.getNative(SomeToken);\n * ```\n *\n * @param token the key for the value to get. May be a string or arbitrary object.\n * @return the Dependency Injection value that matches the token\n */\n getNative(token: any): any;\n getNative(token: any): T;\n}\n\n/** @internalapi */\nexport interface UIRouterPlugin extends Disposable {\n name: string;\n}\n\n/** @internalapi */\nexport abstract class UIRouterPluginBase implements UIRouterPlugin, Disposable {\n abstract name: string;\n dispose(router: UIRouter) { }\n}\n\n/** @internalapi */\nexport interface Disposable {\n /** Instructs the Disposable to clean up any resources */\n dispose(router?: UIRouter);\n}","/** @module ng1 */ /** for typedoc */\nimport {\n val, isObject, createProxyFunctions, BuilderFunction, StateRegistry, StateService, OnInvalidCallback\n} from \"@uirouter/core\";\nimport { Ng1StateDeclaration } from \"./interface\";\n\n/**\n * The Angular 1 `StateProvider`\n *\n * The `$stateProvider` works similar to Angular's v1 router, but it focuses purely\n * on state.\n *\n * A state corresponds to a \"place\" in the application in terms of the overall UI and\n * navigation. A state describes (via the controller / template / view properties) what\n * the UI looks like and does at that place.\n *\n * States often have things in common, and the primary way of factoring out these\n * commonalities in this model is via the state hierarchy, i.e. parent/child states aka\n * nested states.\n *\n * The `$stateProvider` provides interfaces to declare these states for your app.\n */\nexport class StateProvider {\n constructor(private stateRegistry: StateRegistry, private stateService: StateService) {\n createProxyFunctions(val(StateProvider.prototype), this, val(this));\n }\n\n /**\n * Decorates states when they are registered\n *\n * Allows you to extend (carefully) or override (at your own peril) the\n * `stateBuilder` object used internally by [[StateRegistry]].\n * This can be used to add custom functionality to ui-router,\n * for example inferring templateUrl based on the state name.\n *\n * When passing only a name, it returns the current (original or decorated) builder\n * function that matches `name`.\n *\n * The builder functions that can be decorated are listed below. Though not all\n * necessarily have a good use case for decoration, that is up to you to decide.\n *\n * In addition, users can attach custom decorators, which will generate new\n * properties within the state's internal definition. There is currently no clear\n * use-case for this beyond accessing internal states (i.e. $state.$current),\n * however, expect this to become increasingly relevant as we introduce additional\n * meta-programming features.\n *\n * **Warning**: Decorators should not be interdependent because the order of\n * execution of the builder functions in non-deterministic. Builder functions\n * should only be dependent on the state definition object and super function.\n *\n *\n * Existing builder functions and current return values:\n *\n * - **parent** `{object}` - returns the parent state object.\n * - **data** `{object}` - returns state data, including any inherited data that is not\n * overridden by own values (if any).\n * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}\n * or `null`.\n * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is\n * navigable).\n * - **params** `{object}` - returns an array of state params that are ensured to\n * be a super-set of parent's params.\n * - **views** `{object}` - returns a views object where each key is an absolute view\n * name (i.e. \"viewName@stateName\") and each value is the config object\n * (template, controller) for the view. Even when you don't use the views object\n * explicitly on a state config, one is still created for you internally.\n * So by decorating this builder function you have access to decorating template\n * and controller properties.\n * - **ownParams** `{object}` - returns an array of params that belong to the state,\n * not including any params defined by ancestor states.\n * - **path** `{string}` - returns the full path from the root down to this state.\n * Needed for state activation.\n * - **includes** `{object}` - returns an object that includes every state that\n * would pass a `$state.includes()` test.\n *\n * #### Example:\n * Override the internal 'views' builder with a function that takes the state\n * definition, and a reference to the internal function being overridden:\n * ```js\n * $stateProvider.decorator('views', function (state, parent) {\n * let result = {},\n * views = parent(state);\n *\n * angular.forEach(views, function (config, name) {\n * let autoName = (state.name + '.' + name).replace('.', '/');\n * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';\n * result[name] = config;\n * });\n * return result;\n * });\n *\n * $stateProvider.state('home', {\n * views: {\n * 'contact.list': { controller: 'ListController' },\n * 'contact.item': { controller: 'ItemController' }\n * }\n * });\n * ```\n *\n *\n * ```js\n * // Auto-populates list and item views with /partials/home/contact/list.html,\n * // and /partials/home/contact/item.html, respectively.\n * $state.go('home');\n * ```\n *\n * @param {string} name The name of the builder function to decorate.\n * @param {object} func A function that is responsible for decorating the original\n * builder function. The function receives two parameters:\n *\n * - `{object}` - state - The state config object.\n * - `{object}` - super - The original builder function.\n *\n * @return {object} $stateProvider - $stateProvider instance\n */\n decorator(name: string, func: BuilderFunction) {\n return this.stateRegistry.decorator(name, func) || this;\n }\n\n /**\n * Registers a state\n *\n * ### This is a passthrough to [[StateRegistry.register]].\n *\n * Registers a state configuration under a given state name.\n * The stateConfig object has the following acceptable properties.\n *\n *
    \n *\n * - **`template`** - {string|function=} - html template as a string or a function that returns\n * an html template as a string which should be used by the uiView directives. This property\n * takes precedence over templateUrl.\n *\n * If `template` is a function, it will be called with the following parameters:\n *\n * - {array.<object>} - state parameters extracted from the current $location.path() by\n * applying the current state\n *\n * \n *\n * - **`templateUrl`** - {string|function=} - path or function that returns a path to an html\n * template that should be used by uiView.\n *\n * If `templateUrl` is a function, it will be called with the following parameters:\n *\n * - {array.<object>} - state parameters extracted from the current $location.path() by\n * applying the current state\n *\n * \n *\n * - **`templateProvider`** - {function=} - Provider function that returns HTML content\n * string.\n *\n * \n *\n * - **`controller`** - {string|function=} - Controller fn that should be associated with newly\n * related scope or the name of a registered controller if passed as a string.\n *\n * \n *\n * - **`controllerProvider`** - {function=} - Injectable provider function that returns\n * the actual controller or string.\n *\n * \n *\n * - **`controllerAs`** – {string=} – A controller alias name. If present the controller will be\n * published to scope under the controllerAs name.\n *\n * \n *\n * - **`resolve`** - {object.<string, function>=} - An optional map of dependencies which\n * should be injected into the controller. If any of these dependencies are promises,\n * the router will wait for them all to be resolved or one to be rejected before the\n * controller is instantiated. If all the promises are resolved successfully, the values\n * of the resolved promises are injected and $stateChangeSuccess event is fired. If any\n * of the promises are rejected the $stateChangeError event is fired. The map object is:\n *\n * - key - {string}: name of dependency to be injected into controller\n * - factory - {string|function}: If string then it is alias for service. Otherwise if function,\n * it is injected and return value it treated as dependency. If result is a promise, it is\n * resolved before its value is injected into controller.\n *\n * \n *\n * - **`url`** - {string=} - A url with optional parameters. When a state is navigated or\n * transitioned to, the `$stateParams` service will be populated with any\n * parameters that were passed.\n *\n * \n *\n * - **`params`** - {object=} - An array of parameter names or regular expressions. Only\n * use this within a state if you are not using url. Otherwise you can specify your\n * parameters within the url. When a state is navigated or transitioned to, the\n * $stateParams service will be populated with any parameters that were passed.\n *\n * \n *\n * - **`views`** - {object=} - Use the views property to set up multiple views or to target views\n * manually/explicitly.\n *\n * \n *\n * - **`abstract`** - {boolean=} - An abstract state will never be directly activated,\n * but can provide inherited properties to its common children states.\n *\n * \n *\n * - **`onEnter`** - {object=} - Callback function for when a state is entered. Good way\n * to trigger an action or dispatch an event, such as opening a dialog.\n * If minifying your scripts, make sure to use the `['injection1', 'injection2', function(injection1, injection2){}]` syntax.\n *\n * \n *\n * - **`onExit`** - {object=} - Callback function for when a state is exited. Good way to\n * trigger an action or dispatch an event, such as opening a dialog.\n * If minifying your scripts, make sure to use the `['injection1', 'injection2', function(injection1, injection2){}]` syntax.\n *\n * \n *\n * - **`reloadOnSearch = true`** - {boolean=} - If `false`, will not retrigger the same state\n * just because a search/query parameter has changed (via $location.search() or $location.hash()).\n * Useful for when you'd like to modify $location.search() without triggering a reload.\n *\n * \n *\n * - **`data`** - {object=} - Arbitrary data object, useful for custom configuration.\n *\n * #### Example:\n * Some state name examples\n * ```js\n * // stateName can be a single top-level name (must be unique).\n * $stateProvider.state(\"home\", {});\n *\n * // Or it can be a nested state name. This state is a child of the\n * // above \"home\" state.\n * $stateProvider.state(\"home.newest\", {});\n *\n * // Nest states as deeply as needed.\n * $stateProvider.state(\"home.newest.abc.xyz.inception\", {});\n *\n * // state() returns $stateProvider, so you can chain state declarations.\n * $stateProvider\n * .state(\"home\", {})\n * .state(\"about\", {})\n * .state(\"contacts\", {});\n * ```\n *\n * @param {string} name A unique state name, e.g. \"home\", \"about\", \"contacts\".\n * To create a parent/child state use a dot, e.g. \"about.sales\", \"home.newest\".\n * @param {object} definition State configuration object.\n */\n state(name: string, definition: Ng1StateDeclaration): StateProvider;\n state(definition: Ng1StateDeclaration): StateProvider;\n state(name: any, definition?: any) {\n if (isObject(name)) {\n definition = name;\n } else {\n definition.name = name;\n }\n this.stateRegistry.register(definition);\n return this;\n }\n\n /**\n * Registers an invalid state handler\n *\n * This is a passthrough to [[StateService.onInvalid]] for ng1.\n */\n\n onInvalid(callback: OnInvalidCallback): Function {\n return this.stateService.onInvalid(callback);\n }\n}\n","/** @module ng1 */ /** */\nimport {\n StateObject, TransitionStateHookFn, HookResult, Transition, services, ResolveContext, extend, BuilderFunction\n} from \"@uirouter/core\";\nimport { getLocals } from \"../services\";\nimport { Ng1StateDeclaration } from '../interface';\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`,\n * `onRetain` callback hooks on a [[Ng1StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * ensures that those hooks are injectable for @uirouter/angularjs (ng1).\n */\nexport const getStateHookBuilder = (hookName: \"onEnter\"|\"onExit\"|\"onRetain\") =>\nfunction stateHookBuilder(state: StateObject, parentFn: BuilderFunction): TransitionStateHookFn {\n let hook = state[hookName];\n let pathname = hookName === 'onExit' ? 'from' : 'to';\n\n function decoratedNg1Hook(trans: Transition, state: Ng1StateDeclaration): HookResult {\n let resolveContext = new ResolveContext(trans.treeChanges(pathname));\n let locals = extend(getLocals(resolveContext), { $state$: state, $transition$: trans });\n return services.$injector.invoke(hook, this, locals);\n }\n\n return hook ? decoratedNg1Hook : undefined;\n};\n","/**\n * @internalapi\n * @module ng1\n */ /** */\nimport { LocationConfig, LocationServices, UIRouter, ParamType } from \"@uirouter/core\";\nimport { val, createProxyFunctions, removeFrom, isObject } from \"@uirouter/core\";\nimport { ILocationService, ILocationProvider } from \"angular\";\n\n/**\n * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service\n */\nexport class Ng1LocationServices implements LocationConfig, LocationServices {\n private $locationProvider: ILocationProvider;\n private $location: ILocationService;\n private $sniffer;\n\n path;\n search;\n hash;\n hashPrefix;\n port;\n protocol;\n host;\n baseHref;\n\n // .onChange() registry\n private _urlListeners: Function[] = [];\n\n dispose() { }\n\n constructor($locationProvider: ILocationProvider) {\n this.$locationProvider = $locationProvider;\n let _lp = val($locationProvider);\n createProxyFunctions(_lp, this, _lp, ['hashPrefix']);\n }\n\n onChange(callback: Function) {\n this._urlListeners.push(callback);\n return () => removeFrom(this._urlListeners)(callback);\n }\n\n html5Mode() {\n let html5Mode: any = this.$locationProvider.html5Mode();\n html5Mode = isObject(html5Mode) ? html5Mode.enabled : html5Mode;\n return html5Mode && this.$sniffer.history;\n }\n\n url(newUrl?: string, replace = false, state?) {\n if (newUrl) this.$location.url(newUrl);\n if (replace) this.$location.replace();\n if (state) this.$location.state(state);\n return this.$location.url();\n }\n\n _runtimeServices($rootScope, $location: ILocationService, $sniffer, $browser) {\n this.$location = $location;\n this.$sniffer = $sniffer;\n\n // Bind $locationChangeSuccess to the listeners registered in LocationService.onChange\n $rootScope.$on(\"$locationChangeSuccess\", evt => this._urlListeners.forEach(fn => fn(evt)));\n let _loc = val($location);\n let _browser = val($browser);\n\n // Bind these LocationService functions to $location\n createProxyFunctions(_loc, this, _loc, [\"replace\", \"path\", \"search\", \"hash\"]);\n // Bind these LocationConfig functions to $location\n createProxyFunctions(_loc, this, _loc, ['port', 'protocol', 'host']);\n // Bind these LocationConfig functions to $browser\n createProxyFunctions(_browser, this, _browser, ['baseHref']);\n }\n\n /**\n * Applys ng1-specific path parameter encoding\n *\n * The Angular 1 `$location` service is a bit weird.\n * It doesn't allow slashes to be encoded/decoded bi-directionally.\n *\n * See the writeup at https://github.com/angular-ui/ui-router/issues/2598\n *\n * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F\n *\n * @param router\n */\n static monkeyPatchPathParameterType(router: UIRouter) {\n let pathType: ParamType = router.urlMatcherFactory.type('path');\n\n pathType.encode = (val: any) =>\n val != null ? val.toString().replace(/(~|\\/)/g, m => ({ '~': '~~', '/': '~2F' }[m])) : val;\n\n pathType.decode = (val: string) =>\n val != null ? val.toString().replace(/(~~|~2F)/g, m => ({ '~~': '~', '~2F': '/' }[m])) : val;\n\n }\n}\n","/** @module url */ /** */\nimport {\n UIRouter, UrlRouter, LocationServices, $InjectorLike, BaseUrlRule, UrlRuleHandlerFn, UrlMatcher,\n IInjectable\n} from \"@uirouter/core\";\nimport { services, isString, isFunction, isArray, identity } from \"@uirouter/core\";\n\nexport interface RawNg1RuleFunction {\n ($injector: $InjectorLike, $location: LocationServices): string|void;\n}\n\n/**\n * Manages rules for client-side URL\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class manages the router rules for what to do when the URL changes.\n *\n * This provider remains for backwards compatibility.\n *\n * @deprecated\n */\nexport class UrlRouterProvider {\n /** @hidden */ _router: UIRouter;\n /** @hidden */ _urlRouter: UrlRouter;\n\n /** @hidden */\n constructor(router: UIRouter) {\n this._router = router;\n this._urlRouter = router.urlRouter;\n }\n\n /** @hidden */\n $get() {\n let urlRouter = this._urlRouter;\n urlRouter.update(true);\n if (!urlRouter.interceptDeferred) urlRouter.listen();\n return urlRouter;\n }\n\n /**\n * Registers a url handler function.\n *\n * Registers a low level url handler (a `rule`).\n * A rule detects specific URL patterns and returns a redirect, or performs some action.\n *\n * If a rule returns a string, the URL is replaced with the string, and all rules are fired again.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // Here's an example of how you might allow case insensitive urls\n * $urlRouterProvider.rule(function ($injector, $location) {\n * var path = $location.path(),\n * normalized = path.toLowerCase();\n *\n * if (path !== normalized) {\n * return normalized;\n * }\n * });\n * });\n * ```\n *\n * @param ruleFn\n * Handler function that takes `$injector` and `$location` services as arguments.\n * You can use them to detect a url and return a different url as a string.\n *\n * @return [[UrlRouterProvider]] (`this`)\n */\n rule(ruleFn: RawNg1RuleFunction): UrlRouterProvider {\n if (!isFunction(ruleFn)) throw new Error(\"'rule' must be a function\");\n\n const match = () =>\n ruleFn(services.$injector, this._router.locationService);\n\n let rule = new BaseUrlRule(match, identity);\n this._urlRouter.rule(rule);\n return this;\n };\n\n /**\n * Defines the path or behavior to use when no url can be matched.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // if the path doesn't match any of the urls you configured\n * // otherwise will take care of routing the user to the\n * // specified url\n * $urlRouterProvider.otherwise('/index');\n *\n * // Example of using function rule as param\n * $urlRouterProvider.otherwise(function ($injector, $location) {\n * return '/a/valid/url';\n * });\n * });\n * ```\n *\n * @param rule\n * The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`.\n * The function version is passed two params: `$injector` and `$location` services, and should return a url string.\n *\n * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n */\n otherwise(rule: string | RawNg1RuleFunction): UrlRouterProvider {\n let urlRouter = this._urlRouter;\n\n if (isString(rule)) {\n urlRouter.otherwise(rule);\n } else if (isFunction(rule)) {\n urlRouter.otherwise(() => rule(services.$injector, this._router.locationService));\n } else {\n throw new Error(\"'rule' must be a string or function\");\n }\n\n return this;\n };\n\n /**\n * Registers a handler for a given url matching.\n *\n * If the handler is a string, it is\n * treated as a redirect, and is interpolated according to the syntax of match\n * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).\n *\n * If the handler is a function, it is injectable.\n * It gets invoked if `$location` matches.\n * You have the option of inject the match object as `$match`.\n *\n * The handler can return\n *\n * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n * will continue trying to find another one that matches.\n * - **string** which is treated as a redirect and passed to `$location.url()`\n * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n * if ($state.$current.navigable !== state ||\n * !equalForKeys($match, $stateParams) {\n * $state.transitionTo(state, $match, false);\n * }\n * });\n * });\n * ```\n *\n * @param what A pattern string to match, compiled as a [[UrlMatcher]].\n * @param handler The path (or function that returns a path) that you want to redirect your user to.\n * @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]]\n *\n * Note: the handler may also invoke arbitrary code, such as `$state.go()`\n */\n when(what: (RegExp|UrlMatcher|string), handler: string|IInjectable) {\n if (isArray(handler) || isFunction(handler)) {\n handler = UrlRouterProvider.injectableHandler(this._router, handler);\n }\n\n this._urlRouter.when(what, handler as any);\n return this;\n };\n\n static injectableHandler(router: UIRouter, handler): UrlRuleHandlerFn {\n return match =>\n services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params });\n }\n\n /**\n * Disables monitoring of the URL.\n *\n * Call this method before UI-Router has bootstrapped.\n * It will stop UI-Router from performing the initial url sync.\n *\n * This can be useful to perform some asynchronous initialization before the router starts.\n * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // Prevent $urlRouter from automatically intercepting URL changes;\n * $urlRouterProvider.deferIntercept();\n * })\n *\n * app.run(function (MyService, $urlRouter, $http) {\n * $http.get(\"/stuff\").then(function(resp) {\n * MyService.doStuff(resp.data);\n * $urlRouter.listen();\n * $urlRouter.sync();\n * });\n * });\n * ```\n *\n * @param defer Indicates whether to defer location change interception.\n * Passing no parameter is equivalent to `true`.\n */\n deferIntercept(defer?: boolean) {\n this._urlRouter.deferIntercept(defer);\n };\n}\n","/**\n * Main entry point for angular 1.x build\n * @module ng1\n */ /** */\n\nexport * from \"./interface\";\nexport * from \"./services\";\nexport * from \"./statebuilders/views\";\nexport * from \"./stateProvider\";\nexport * from \"./urlRouterProvider\";\n\nimport \"./injectables\";\nimport \"./directives/stateDirectives\";\nimport \"./stateFilters\";\nimport \"./directives/viewDirective\";\nimport \"./viewScroll\";\n\nexport default \"ui.router\";\n\nimport * as core from \"@uirouter/core\";\nexport { core };\nexport * from \"@uirouter/core\";\n\n"],"names":["fn","args","length","func_args_length","apply","curried","concat","slice","arguments","initial_args","start","i","result","this","call","_i","funcs","compose","reverse","fn1","fn2","fnName","obj","struct","x","val","isArray","head","tail","filter","not","isString","isFunction","source","target","bind","fnNames","latebind","bindFunction","makeLateRebindFn","Object","keys","reduce","acc","name","array","indexOf","idx","splice","arr","push","opts","defaultsList","_defaultsList","defaultVals","extend","pick","first","second","path","n","propNames","objCopy","prop_1","inArray","key","collection","propName","map","prop","callback","accept","forEach","item","predicateOrMap","errMsg","Error","maxArrayLen","min","Math","memo","keyValTuple","value","undefined","src","dest","cb","_this","toObj","j","o1","o2","t1","tup","all","_arraysEq","isDate","getTime","isRegExp","toString","any","b","_equals","a1","a2","arrayTuples","t","uiview","state","creationContext","id","$type","fqn","input","isNumber","Category","criterion","_state","globStrings","toMatch","glob","Glob","matches","matchGlobs","registry","transitionService","eventType","matchObject","options","registeredHook","RegisteredHook","hooks","_deregistered","removeFrom","_registeredHooks","hookRegistrationFn","reverseDepthSort","l","r","factor","depthDelta","node","hook","priority","type","mode","isDefined","allTruthyMode","arrayWrap","arrayUnwrap","val1","val2","left","right","paramTypeFn","wrapperFn","arrayEqualsHandler","arrayHandler","dynamic","pattern","inherit","is","$arrayMode","cfg","isShorthand","getStaticDefaultValue","$$fn","isInjectable","urlType","location","paramTypes","DefType","CONFIG","PATH","SEARCH","ParamType","config","isOptional","defaultPolicy","squash","arrayMode","replace","configuredKeys","from","to","max","str","substr","camelCase","$1","toLowerCase","fnStr","fnToString","namedFunctionMatch","match","toStr","_fn","o","isObject","seen","stringifyPattern","JSON","stringify","format","delim","re","RegExp","split","identity","pushR","self","$$state","parent","data","includes","annotate","$injector","services","strictDi","isResolveLiteral","token","resolveFn","isLikeNg2Provider","provide","useValue","useFactory","useExisting","useClass","isTupleFromObj","p","literal2Resolvable","Resolvable","deps","policy","dependencies","tuple2Resolvable","pipe","tuple","item2Resolvable","decl","resolve","resolveObj","resolvePolicies","resolvePolicy","string","param","surroundPattern","url","isHtml5","absolute","baseHref","handler","TargetState","isDef","trans","addResolvable","UIRouter","router","Transition","params","entering","hookName","transition","hookFn","Array","states","stateRegistry","register","lazyLoadFn","lazyLoad","promise","success","error","err","$q","reject","when","then","updateStateRegistry","ignoredReason","_ignoredReason","trace","traceTransitionIgnored","pending","globals","abort","Rejection","ignored","toPromise","valid","orEmptyString","_a","beforehash","hash","_b","search","serviceClass","configurationClass","dispose","service","configuration","locationService","locationConfig","templateFactory","view","get","Ng1ViewConfig","tplKeys","ctrlKeys","compKeys","nonCompKeys","allViewKeys","views","hasAnyKey","join","viewsObject","$default","component","resolveAs","$context","$name","normalized","ViewService","normalizeUIViewTarget","$uiViewName","uiViewName","$uiViewContextAnchor","uiViewContextAnchor","cmpDefs","getBindings","unnestR","$locationProvider","$location","$browser","$sniffer","$rootScope","$http","$templateCache","ng1LocationService","_runtimeServices","stateProvider","StateProvider","stateService","decorator","ng1ViewsBuilder","getStateHookBuilder","viewService","_pluginapi","_viewConfigFactory","getNg1ViewConfigFactory","Ng1LocationServices","monkeyPatchPathParameterType","$get","$inject","$uiRouter","resolvables","resolvable","$watch","approximateDigests","ref","parsed","paramsOnly","paramExpr","el","$uiView","inheritedData","parse","$state","$element","def","uiState","current","uiStateOpts","defaultOpts","href","uiStateParams","isSvg","prototype","isForm","nodeName","attr","isAnchor","toUpperCase","clickable","$timeout","getDef","e","button","which","ctrlKey","metaKey","shiftKey","go","preventDefault","ignorePreventDefaultCount","cancel","relative","stateContext","$current","element","scope","events","on","events_1","event_1","$on","off","events_2","event_2","isFilter","$stateful","includesFilter","$compile","$controller","$transitions","$view","getControllerAs","getResolveAs","restrict","compile","tElement","initial","html","empty","contents","$cfg","viewDecl","getTemplate","noop","resolveCtx","ResolveContext","traceUIViewFill","link","controller","controllerAs","locals","getLocals","controllerInstance","$scope","children","registerControllerCallbacks","cmp_1","kebobName","kebobString","tagRegexp_1","getComponentController","directiveEl","tagName","exec","angular","deregisterWatch_1","ctrlInstance","$onInit","hasComponentImpl","viewState","hookOptions","uiOnParamsChanged","resolveContext","viewCreationTrans_1","getResolvable","paramsUpdated","$transition$","exiting","toParams","fromParams","toSchema","treeChanges","paramSchema","fromSchema","changedToParams","equals","changedKeys_1","newValues","onSuccess","uiCanExit","id_1","_uiCanExitId","prevTruthyAnswer_1","redirectedFrom","wrappedHook","ids","criteria","onBefore","useAnchorScroll","$anchorScroll","scrollIntoView","ng_from_global","ng","ng_from_import","ng_from_import.module","propEq","curry","ctor","constructor","eq","other","v","text","regexpString","seg","regexp","test","StateObject","create","stateDecl","isStateClass","__stateObjectCache","nameGlob","fromString","root","defaults","matchingKeys","parameters","values","hasOwnProperty","parameter","find","tis","isUndefined","isNull","isNullOrUndefined","or","isState","isPromise","and","notImplemented","fnname","w","window","fromJson","toJson","copy","_copy","_forEach","assign","_extend","extra","_inArray","_removeFrom","pushTo","_pushTo","deregAll","functions","mergeR","mapObj","allTrueR","elem","anyTrueR","flattenR","uniqR","unnest","flatten","assertPredicate","assertFn","assertMap","pairs","silenceUncaughtInPromise","catch","silentRejection","_items","_limit","Queue","items","shift","size","RejectType","message","detail","d","_transitionRejection","rejection","SUPERSEDED","redirected","superseded","INVALID","IGNORED","ABORTED","ERROR","errored","viewConfigString","viewConfig","$id","_tid","_rid","transLbl","Trace","enabled","categories","k","parseInt","isNaN","normalizedCat","category","_enabled","_set","TRANSITION","console","log","step","HOOK","event","context","functionToString","maxLength","hookResult","transitionOptions","RESOLVE","reason","finalState","viewData","UIVIEW","padString","uiViewString","traceUIViewEvent","VIEWCONFIG","mapping","uiViewData","ui-view fqn","state: view name","sort","a","localeCompare","table","TransitionHookPhase","TransitionHookScope","_identifier","_definition","_params","_options","base","stateName","defaultOptions","traceData","hookPhase","RUN","isActive","TransitionHook","defaultErrorHandler","notCurrent","getNotCurrentRejection","traceHookInvocation","normalizeErr","normalize","handleError","getErrorHandler","handleResult","getResultHandler","synchronous","handleHookResult","traceHookResult","aborted","_disposed","_aborted","isSuperseded","waitFor","createHookChainR","prev","nextHook","invokeHook","doneCallback","remainingHooks","chain","logError","tranSvc","matchCriteria","nodes","matching","matchState","_getPathTypes","_getDefaultMatchCriteria","mn","pathtype","isStateHook","STATE","_matchingNodes","_getMatchingNodes","every","HookBuilder","phase","_getEvents","buildHooks","hookType","matchingHooks","getMatchingHooks","baseHookOptions","makeTransitionHooks","criteriaMatchPath","transitionHook","tupleSort","reverseSort","isCreate","CREATE","reg","getHooks","sub","decode","isSearch","ArrayType","hasOwn","urlMatcherFactory","unwrapShorthand","getType","arrayDefaults","arrayParamNomenclature","$asArray","raw","getSquashPolicy","defaultSquashPolicy","getReplace","Param","_defaultValueCache","defaultValue","invoke","$normalize","encoded","encode","paramValues","params_1","values1","values2","changed","validates","stateOrNode","PathNode","res","clone","getParamVal","paramDef","pDef","applyPairs","paramsFn","diff","PathUtils","targetState","applyRawParams","fromPath","toPath","buildPath","inheritParams","viewDecls","subPath","viewConfigs","createViewConfig","toKeys","toNode","toParamVals","incomingParamVals","omit","fromParamVals","nodeParamVals","noInherit","ownParamVals","makeInheritedParamsNode","reloadState","retainedNode","cloned","keep","node1","node2","nonDynamicParams","retained","retainedWithToParams","applyToParams","pathA","pathB","done","nodeA","nodeB","predicate","elementIdx","defaultResolvePolicy","async","arg1","resolved","literal","thisPolicy","statePolicy","getResolvableDependencies","getDependencies","invokeResolveFn","resolvedDeps","waitForRx","observable$","cached","cache","take","findNode","maybeWaitForRx","getPolicy","applyResolvedValue","resolvedValue","traceResolvableResolved","LAZY","EAGER","WAIT","NOWAIT","RXWAIT","ALL_WHENS","EAGER_WHENS","NATIVE_INJECTOR_TOKEN","_path","newResolvables","whenOption","matchedWhens","traceResolvePath","matchesPolicy","acceptedVals","whenOrAsync","promises","nodeResolvables","nowait","wait","subContext","getResult","_injector","UIInjectorImpl","availableResolvables","getDependency","fromInjector","injector","getNative","native","stateSelf","defer","_deferred","_targetState","_transitionCount","buildToPath","_treeChanges","createTransitionHookRegFns","onCreateHooks","_hookBuilder","buildHooksForPhase","invokeHooks","applyViewConfigs","makeEvent","enteringStates","$from","$to","compare","pathname","freeze","pathName","getTokens","topath","targetNode","addResolvables","rf","originalTransition","redirects","redirectOpts","newOptions","identifier","newTransition","originalEnteringNodes","redirectEnteringNodes","tc","reload","nodeSchemas","schema","toVals","fromVals","changes","_changedParams","same","newTC","pendTC","runAllHooks","getHooksFor","transitionSuccess","traceSuccess","SUCCESS","transitionError","traceError","_error","runTransition","allRunHooks","startTransition","lastStartedTransitionId","transitionHistory","enqueue","traceTransitionStart","allBeforeHooks","BEFORE","abstract","paramDefs","invalidParams","fromStateOrName","toStateOrName","avoidEmptyHash","stringifyPatternFn","isRejection","isRejectionPromise","beforeAfterSubstr","char","ParamTypes","makeType","definition","types","defaultTypes","definitionFn","typeQueue","_flushTypeQueue","makeDefaultType","valToString","defaultTypeBase","String","query","int","bool","Boolean","date","getFullYear","getMonth","getDate","capture","Date","valueOf","json","defaultRuleSortFn","StateParams","newParams","parentParams","parents","ancestors","inherited","inheritList","parseUrl","charAt","substring","getUrlBuilder","$urlMatcherFactoryProvider","stateDec","paramMap","paramConfig","reloadOnSearch","isMatcher","navigable","append","getNavigableBuilder","isRoot","getParamsBuilder","paramFactory","makeConfigParam","fromConfig","urlParams","nonUrlParams","matcher","parentName","builders","nameBuilder","selfBuilder","parentBuilder","dataBuilder","pathBuilder","includesBuilder","resolvablesBuilder","StateBuilder","parentFn","segments","pop","_states","StateMatcher","stateOrName","matchGlob","isStr","isRelative","resolvePath","baseState","splitName","pathLength","relName","$registry","$urlRouter","builder","listeners","queue","StateQueueManager","flush","registered","orphans","previousQueueLength","getState","name_1","build","orphanIdx","existingState","existingFutureState","deregister","attachRoute","listener","s","rule","urlRuleFactory","_router","stateQueue","urlRouter","_registerRoot","StateRegistry","rootStateDef","#","_root","stateDefinition","getChildren","deregistered","$ur","rules","removeRule","deregisteredStates","_deregisterTree","found","func","memoizeTo","splitOnSlash","splitOnDelim","strict","caseInsensitive","m","segment","placeholder","searchPlaceholder","last","patterns","checkParamErrors","UrlMatcher","nameValidator","matchDetails","index","_segments","lastIndex","fromSearch","_compiled","quoteRegExp","_children","_cache","allParams","pathParams","searchParams","nPathSegments","urlm","reverseString","unquoteDashes","validParamVal","isValid","isDefaultValue","urlMatchers","pathSegmentsAndParams","getDetails","queryParams","isInvalid","pathString","encodeDashes","encodeURIComponent","queryString","paramDetails","c","charCodeAt","joinNeighborsR","weights","weightsA","weightsB","padVal","len","cmp","_isStrictMode","_isCaseInsensitive","UrlMatcherFactory","_defaultSquashPolicy","_getConfig","object","UrlRuleFactory","what","makeRule","_what","fromUrlMatcher","fromState","fromRegExp","BaseUrlRule","urlMatcher","optional","_handler","details","matchPriority","transitionTo","global","sticky","redirectUrlTo","Number","prioritySort","typeSort","URLMATCHER","REGEXP","RAW","OTHER","urlMatcherSort","idSort","useMatchPriority","createProxyFunctions","UrlRouter","listen","_rules","_otherwiseFn","compareFn","stableSort","_sortFn","_sorted","arrOfWrapper","wrapperA","wrapperB","cmpDiff","wrapper","ensureSorted","best","weight","evt","defaultPrevented","$url","urlService","newurl","_stopFn","onChange","sync","read","html5Mode","hashPrefix","appendBasePath","slash","port","protocol","host","isUrlRule","_id","handlerFn","getHandlerFn","matchFn","urlParts","interceptDeferred","_rootViewContext","_registeredUIViews","_uiViews","_activeViewConfigs","_viewConfigs","_rootContext","viewType","factory","_viewConfigFactories","cfgFactory","cfgs","traceViewServiceEvent","uiView","stateDepth","count","uiViewsByFqn","uiv","depthCompare","depthFn","posNeg","matchingConfigPair","matchingConfigs","viewConfigDepth","configureUIView","configUpdated","uiViewDepth","traceViewSync","traceViewServiceUIViewEvent","uiViews","fqnAndTypeMatches","rawViewName","viewAtContext","relativeViewNameSugar","anchor","vc","vcSegments","uivSegments","negOffset","fqnToFirstSegment","uiViewContext","UIRouterGlobals","clear","successfulTransitions","makeStub","locationServicesFns","locationConfigFns","umfFns","rulesFns","syncFns","lateBind","locationServices","umf","UrlService","_routerInstance","locationServiceStub","locationConfigStub","TransitionService","StateService","disposable","_disposables","plugin","pluginInstance","_plugins","pluginName","registerAddCoreResolvables","onCreate","addCoreResolvables","redirectToHook","redirect","redirectTo","registerRedirectToHook","onStart","onExitHook","makeEnterExitRetainHook","registerOnExitHook","onExit","onRetainHook","registerOnRetainHook","onRetain","onEnterHook","registerOnEnterHook","onEnter","eagerResolvePath","registerEagerResolvePath","lazyResolveState","registerLazyResolveState","loadEnteringViews","enteringViews","load","registerLoadEnteringViews","onFinish","activateViews","exitingViews","deactivateViewConfig","activateViewConfig","registerActivateViews","updateGlobalState","transitionSuccessful","clearCurrentTransition","registerUpdateGlobalState","updateUrl","urlOptions","update","registerUpdateUrl","lazyLoadHook","orig","parts","lazyLoadState","retryTransition","registerLazyLoadHook","hookOrder","HANDLE_RESULT","REJECT_ERROR","registerIgnoredTransitionHook","ignoredHook","registerInvalidTransitionHook","invalidTransitionHook","defaultTransOpts","notify","custom","_deregisterHookFns","_defineCorePaths","_defineCoreEvents","_registerCoreTransitionHooks","hooksArray","Phase","TH","paths","_criteriaPaths","_defineEvent","LOG_REJECTED_RESULT","THROW_ERROR","LOG_ERROR","_definePathType","TransitionEventType","_eventTypes","cmpByPhase","hookScope","fns","addCoreResolves","invalid","eagerResolve","lazyResolve","loadViews","updateGlobals","$error$","stack","getters","boundFns","invalidCallbacks","toState","nextCallback","callbackQueue","dequeue","checkForRedirect","invokeNextCallback","makeTargetState","latestThing","peekTail","latest","defautGoOpts","transOpts","latestSuccess","currentPath","getCurrentPath","exists","_handleInvalidTargetState","rejectedTransitionHandler","isLatest","run","transitionToPromise","include","lossy","$inherit","nav","_defaultErrorHandler","Promise","deferred","STRIP_COMMENTS","ARGUMENT_NAMES","has","ensureExist","splitHash","splitQuery","splitEqual","trimHashVal","keyValsToObjectR","accum","getParams","buildUrl","loc","searchObject","fireAfterUpdate","_listeners","_get","_location","_history","history","BaseLocationServices","evt_1","Event","_super","addEventListener","_listener","__extends","HashLocationService","title","removeEventListener","MemoryLocationService","_url","_config","PushStateLocationService","fullUrl","replaceState","pushState","_port","_protocol","_host","_baseHref","newval","_hashPrefix","_isHtml5","BrowserLocationConfig","hostname","newprefix","applyDocumentBaseHref","baseTags","document","getElementsByTagName","origin","hashLocationPlugin","locationPluginFactory","pushStateLocationPlugin","memoryLocationPlugin","MemoryLocationConfig","UIRouterPluginBase","makeComponentTemplate","bindings","template","getController","results","provider","controllerProvider","providerFn","version","minor","$templateRequest","TemplateFactory","_useHttp","asTemplate","asComponent","templateUrl","fromUrl","templateProvider","fromProvider","componentProvider","fromComponentProvider","headers","Accept","response","prefix","kebob","kebobed","attributeTpl","attrName","resolveName","attrs","getComponentBindings","scopeBindings","bindToController","bindingsObj","onInvalid","$state$","decoratedNg1Hook","_lp","_urlListeners","newUrl","_loc","_browser","pathType","~","/","~~","~2F","_urlRouter","UrlRouterProvider","ruleFn","otherwise","injectableHandler","$match","$stateParams","deferIntercept","module","mod_init","mod_util","mod_rtr","mod_state","mod_main","getProviderFor","serviceName","$urp","runBlock","getUrlRouterProvider","uiRouter","urlRouterProvider","getStateProvider","watchDigests","$urlMatcherFactory","uiSref","ctx","require","uiSrefActive","unlinkInfoFn","active","$$addStateInfo","$set","getTypeInfo","rawDef","processedDef","parseStateRef","uiSrefOpts","$eval","onStatesChanged","clickHook","bindEvents","inputAttrs","watchDeregFns","field","$observe","expr","$interpolate","$attrs","stateParams","activeClass","stateInfo","splitClasses","getClasses","stateList","allClasses","activeEqClass","fuzzyClasses","exactlyMatchesAny","exactClasses","addClasses","removeClasses","cls","$evalAsync","className","addClass","removeClass","uiSrefActiveEq","addState","newState","updateAfterTransition","directive","$IsStateFilter","$IncludedByStateFilter","$animate","$uiViewScroll","enter","leave","config1","config2","rootData","terminal","transclude","tAttrs","$transclude","configsEqual","traceUIViewConfigUpdated","activeUIView","updateView","previousEl","remove","currentScope","$destroy","currentEl","_viewData_1","renderer","$$animLeave","newScope","$new","animEnter","animLeave","$uiViewData","$uiViewAnim","$animEnter","$animLeave","$emit","autoScrollExp","cleanupLastView","onloadExp","unregister","getRenderer","configUpdatedCallback","fromParentTagConfig","fromParentTag","registerUIView","$ViewDirectiveFill","$ViewScrollProvider"],"mappings":";;;;;;;;;;2QAoDA,YAAsBA,GAIpB,WAAiBC,GACf,MAAIA,GAAKC,QAAUC,EACVH,EAAGI,MAAM,KAAMH,GACjB,WACL,MAAOI,GAAQJ,EAAKK,UAAUC,MAAMH,MAAMI,cAP9C,GAAIC,MAAkBF,MAAMH,MAAMI,WAAY,IAC1CL,EAAmBH,EAAGE,MAS1B,OAAOG,GAAQI,GAWjB,aACE,GAAIR,GAAOO,UACPE,EAAQT,EAAKC,OAAS,CAC1B,OAAO,YAEL,IADA,GAAIS,GAAID,EAAOE,EAASX,EAAKS,GAAON,MAAMS,KAAML,WACzCG,KAAKC,EAASX,EAAKU,GAAGG,KAAKD,KAAMD,EACxC,OAAOA,IAUX,iBAAqB,aAAAG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J,KAAK,WAAauJ,QAASunC,IAEpCC,IAEAqB,EAAa1lC,EAAM+lC,eAAe3B,GAClCnlC,EAAMK,IAAI,WAAY,WACpB5H,GAAM4U,iBAAiB,2BAA4B83B,GACnDsB,QA4FR,OAAOtC,KAGT4C,GAAmB9pC,SAAW,WAAY,cAAe,eAAgB,QAAS,KAAM,WAoFxF,IAAIoG,IAAgF,kBAArDJ,IAAgBo9B,OAAO,aAAwB,UAE1Ez7B,GAAe,CAyEnB3B,IAAQo9B,OAAO,mBAAmB8D,UAAU,SAAgBtV,IAC5D5rB,GAAQo9B,OAAO,mBAAmB8D,UAAU,SAAgB4C,IC1c5D9jC,GAAQo9B,OAAO,mBAAmBnD,SAAS,gBAA2C8J,cgDtBvE"} \ No newline at end of file +{"version":3,"file":"angular-ui-router.min.js","sources":["@uirouter/core/lib-esm/common/@uirouter/core/common/hof.ts","@uirouter/core/lib-esm/common/@uirouter/core/common/predicates.ts","@uirouter/core/lib-esm/common/@uirouter/core/common/common.ts","@uirouter/core/lib-esm/common/@uirouter/core/common/trace.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/hookRegistry.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/hookBuilder.ts","@uirouter/core/lib-esm/params/@uirouter/core/params/paramType.ts","@uirouter/core/lib-esm/params/@uirouter/core/params/param.ts","@uirouter/core/lib-esm/common/@uirouter/core/common/strings.ts","@uirouter/core/lib-esm/state/@uirouter/core/state/stateBuilder.ts","@uirouter/core/lib-esm/url/@uirouter/core/url/urlMatcher.ts","@uirouter/core/lib-esm/url/@uirouter/core/url/urlRouter.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/coreResolvables.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/onEnterExitRetain.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/lazyLoad.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/ignoredTransition.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/invalidTransition.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/utils.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/plugins.ts","@uirouter/angularjs/statebuilders/views.ts","@uirouter/angularjs/templateFactory.ts","@uirouter/angularjs/services.ts","@uirouter/angularjs/directives/stateDirectives.ts","@uirouter/angularjs/stateFilters.ts","@uirouter/angularjs/directives/viewDirective.ts","@uirouter/angularjs/angular.ts","@uirouter/core/lib-esm/common/@uirouter/core/common/glob.ts","@uirouter/core/lib-esm/state/@uirouter/core/state/stateObject.ts","@uirouter/core/lib-esm/common/@uirouter/core/common/coreservices.ts","@uirouter/core/lib-esm/common/@uirouter/core/common/queue.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/rejectFactory.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/interface.ts","@uirouter/core/lib-esm/state/@uirouter/core/state/targetState.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/transitionHook.ts","@uirouter/core/lib-esm/path/@uirouter/core/path/pathNode.ts","@uirouter/core/lib-esm/path/@uirouter/core/path/pathFactory.ts","@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/resolvable.ts","@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/interface.ts","@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/resolveContext.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/transition.ts","@uirouter/core/lib-esm/params/@uirouter/core/params/paramTypes.ts","@uirouter/core/lib-esm/params/@uirouter/core/params/stateParams.ts","@uirouter/core/lib-esm/state/@uirouter/core/state/stateMatcher.ts","@uirouter/core/lib-esm/state/@uirouter/core/state/stateQueueManager.ts","@uirouter/core/lib-esm/state/@uirouter/core/state/stateRegistry.ts","@uirouter/core/lib-esm/url/@uirouter/core/url/urlMatcherFactory.ts","@uirouter/core/lib-esm/url/@uirouter/core/url/urlRule.ts","@uirouter/core/lib-esm/view/@uirouter/core/view/view.ts","@uirouter/core/lib-esm/@uirouter/core/globals.ts","@uirouter/core/lib-esm/url/@uirouter/core/url/urlService.ts","@uirouter/core/lib-esm/@uirouter/core/router.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/redirectTo.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/resolve.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/views.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/updateGlobals.ts","@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/url.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/transitionEventType.ts","@uirouter/core/lib-esm/transition/@uirouter/core/transition/transitionService.ts","@uirouter/core/lib-esm/state/@uirouter/core/state/stateService.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/q.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/injector.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/baseLocationService.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/hashLocationService.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/memoryLocationService.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/pushStateLocationService.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/memoryLocationConfig.ts","@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/browserLocationConfig.ts","@uirouter/core/lib-esm/@uirouter/core/interface.ts","@uirouter/angularjs/stateProvider.ts","@uirouter/angularjs/statebuilders/onEnterExitRetain.ts","@uirouter/angularjs/locationServices.ts","@uirouter/angularjs/urlRouterProvider.ts","@uirouter/angularjs/viewScroll.ts","@uirouter/angularjs/index.ts"],"sourcesContent":["/**\n * Higher order functions\n *\n * These utility functions are exported, but are subject to change without notice.\n *\n * @module common_hof\n */ /** */\n\nimport {Predicate} from \"./common\";\n/**\n * Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function.\n *\n * Given a function with N parameters, returns a new function that supports partial application.\n * The new function accepts anywhere from 1 to N parameters. When that function is called with M parameters,\n * where M is less than N, it returns a new function that accepts the remaining parameters. It continues to\n * accept more parameters until all N parameters have been supplied.\n *\n *\n * This contrived example uses a partially applied function as an predicate, which returns true\n * if an object is found in both arrays.\n * @example\n * ```\n * // returns true if an object is in both of the two arrays\n * function inBoth(array1, array2, object) {\n * return array1.indexOf(object) !== -1 &&\n * array2.indexOf(object) !== 1;\n * }\n * let obj1, obj2, obj3, obj4, obj5, obj6, obj7\n * let foos = [obj1, obj3]\n * let bars = [obj3, obj4, obj5]\n *\n * // A curried \"copy\" of inBoth\n * let curriedInBoth = curry(inBoth);\n * // Partially apply both the array1 and array2\n * let inFoosAndBars = curriedInBoth(foos, bars);\n *\n * // Supply the final argument; since all arguments are\n * // supplied, the original inBoth function is then called.\n * let obj1InBoth = inFoosAndBars(obj1); // false\n *\n * // Use the inFoosAndBars as a predicate.\n * // Filter, on each iteration, supplies the final argument\n * let allObjs = [ obj1, obj2, obj3, obj4, obj5, obj6, obj7 ];\n * let foundInBoth = allObjs.filter(inFoosAndBars); // [ obj3 ]\n *\n * ```\n *\n * Stolen from: http://stackoverflow.com/questions/4394747/javascript-curry-function\n *\n * @param fn\n * @returns {*|function(): (*|any)}\n */\nexport function curry(fn: Function): Function {\n let initial_args = [].slice.apply(arguments, [1]);\n let func_args_length = fn.length;\n\n function curried(args: any[]) {\n if (args.length >= func_args_length)\n return fn.apply(null, args);\n return function () {\n return curried(args.concat([].slice.apply(arguments)));\n };\n }\n return curried(initial_args);\n}\n\n\n\n/**\n * Given a varargs list of functions, returns a function that composes the argument functions, right-to-left\n * given: f(x), g(x), h(x)\n * let composed = compose(f,g,h)\n * then, composed is: f(g(h(x)))\n */\nexport function compose() {\n let args = arguments;\n let start = args.length - 1;\n return function() {\n let i = start, result = args[start].apply(this, arguments);\n while (i--) result = args[i].call(this, result);\n return result;\n };\n}\n\n/**\n * Given a varargs list of functions, returns a function that is composes the argument functions, left-to-right\n * given: f(x), g(x), h(x)\n * let piped = pipe(f,g,h);\n * then, piped is: h(g(f(x)))\n */\nexport function pipe(...funcs: Function[]): (obj: any) => any {\n return compose.apply(null, [].slice.call(arguments).reverse());\n}\n\n/**\n * Given a property name, returns a function that returns that property from an object\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = prop(\"name\");\n * getName(obj) === \"blarg\"\n */\nexport const prop = (name: string) =>\n (obj: any) => obj && obj[name];\n\n/**\n * Given a property name and a value, returns a function that returns a boolean based on whether\n * the passed object has a property that matches the value\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = propEq(\"name\", \"blarg\");\n * getName(obj) === true\n */\nexport const propEq = curry((name: string, val: any, obj: any) => obj && obj[name] === val);\n\n/**\n * Given a dotted property name, returns a function that returns a nested property from an object, or undefined\n * let obj = { id: 1, nestedObj: { foo: 1, name: \"blarg\" }, };\n * let getName = prop(\"nestedObj.name\");\n * getName(obj) === \"blarg\"\n * let propNotFound = prop(\"this.property.doesnt.exist\");\n * propNotFound(obj) === undefined\n */\nexport const parse = (name: string) =>\n pipe.apply(null, name.split(\".\").map(prop));\n\n/**\n * Given a function that returns a truthy or falsey value, returns a\n * function that returns the opposite (falsey or truthy) value given the same inputs\n */\nexport const not: (fn: Predicate) => Predicate = (fn: Predicate) =>\n (...args: any[]) => !fn.apply(null, args);\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if both functions return truthy for the given arguments\n */\nexport function and(fn1: Predicate, fn2: Predicate): Predicate {\n return (...args: any[]) => fn1.apply(null, args) && fn2.apply(null, args);\n}\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if at least one of the functions returns truthy for the given arguments\n */\nexport function or(fn1: Predicate, fn2: Predicate): Predicate {\n return (...args: any[]) => fn1.apply(null, args) || fn2.apply(null, args);\n}\n\n/**\n * Check if all the elements of an array match a predicate function\n *\n * @param fn1 a predicate function `fn1`\n * @returns a function which takes an array and returns true if `fn1` is true for all elements of the array\n */\nexport const all = (fn1: Predicate) =>\n (arr: any[]) => arr.reduce((b, x) => b && !!fn1(x), true) as boolean;\nexport const any = (fn1: Predicate) =>\n (arr: any[]) => arr.reduce((b, x) => b || !!fn1(x), false) as boolean;\n\n/** Given a class, returns a Predicate function that returns true if the object is of that class */\nexport const is = (ctor: { new(...args): T }) =>\n (obj: any): obj is T =>\n (obj != null && obj.constructor === ctor || obj instanceof ctor);\n\n/** Given a value, returns a Predicate function that returns true if another value is === equal to the original value */\nexport const eq: (comp: any) => Predicate = (val: any) => (other: any) =>\n val === other;\n\n/** Given a value, returns a function which returns the value */\nexport const val = (v: T) => () => v;\n\n\n\nexport function invoke(fnName: string): Function;\nexport function invoke(fnName: string, args: any[]): Function;\nexport function invoke(fnName: string, args?: any[]): Function {\n return (obj: any) =>\n obj[fnName].apply(obj, args);\n}\n\n/**\n * Sorta like Pattern Matching (a functional programming conditional construct)\n *\n * See http://c2.com/cgi/wiki?PatternMatching\n *\n * This is a conditional construct which allows a series of predicates and output functions\n * to be checked and then applied. Each predicate receives the input. If the predicate\n * returns truthy, then its matching output function (mapping function) is provided with\n * the input and, then the result is returned.\n *\n * Each combination (2-tuple) of predicate + output function should be placed in an array\n * of size 2: [ predicate, mapFn ]\n *\n * These 2-tuples should be put in an outer array.\n *\n * @example\n * ```\n *\n * // Here's a 2-tuple where the first element is the isString predicate\n * // and the second element is a function that returns a description of the input\n * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];\n *\n * // Second tuple: predicate \"isNumber\", mapfn returns a description\n * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];\n *\n * let third = [ (input) => input === null, (input) => `Oh, null...` ];\n *\n * let fourth = [ (input) => input === undefined, (input) => `notdefined` ];\n *\n * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);\n *\n * console.log(descriptionOf(undefined)); // 'notdefined'\n * console.log(descriptionOf(55)); // '(55) That's a number!'\n * console.log(descriptionOf(\"foo\")); // 'Here's your string foo'\n * ```\n *\n * @param struct A 2D array. Each element of the array should be an array, a 2-tuple,\n * with a Predicate and a mapping/output function\n * @returns {function(any): *}\n */\nexport function pattern(struct: Function[][]): Function {\n return function(x: any) {\n for (var i = 0; i < struct.length; i++) {\n if (struct[i][0](x)) return struct[i][1](x);\n }\n };\n}\n\n","/** Predicates\n *\n * These predicates return true/false based on the input.\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_predicates\n */\n/** */\nimport { and, not, pipe, prop, or } from \"./hof\";\nimport { Predicate } from \"./common\"; // has or is using\nimport { StateObject } from \"../state/stateObject\";\n\nconst toStr = Object.prototype.toString;\nconst tis = (t: string) => (x: any) => typeof(x) === t;\nexport const isUndefined = tis('undefined');\nexport const isDefined = not(isUndefined);\nexport const isNull = (o: any) => o === null;\nexport const isNullOrUndefined = or(isNull, isUndefined);\nexport const isFunction: (x: any) => x is Function = tis('function');\nexport const isNumber: (x: any) => x is number = tis('number');\nexport const isString = <(x: any) => x is string> tis('string');\nexport const isObject = (x: any) => x !== null && typeof x === 'object';\nexport const isArray = Array.isArray;\nexport const isDate: (x: any) => x is Date = ((x: any) => toStr.call(x) === '[object Date]');\nexport const isRegExp: (x: any) => x is RegExp = ((x: any) => toStr.call(x) === '[object RegExp]');\nexport const isState: (x: any) => x is StateObject = StateObject.isState;\n\n/**\n * Predicate which checks if a value is injectable\n *\n * A value is \"injectable\" if it is a function, or if it is an ng1 array-notation-style array\n * where all the elements in the array are Strings, except the last one, which is a Function\n */\nexport function isInjectable(val: any) {\n if (isArray(val) && val.length) {\n let head = val.slice(0, -1), tail = val.slice(-1);\n return !(head.filter(not(isString)).length || tail.filter(not(isFunction)).length);\n }\n return isFunction(val);\n}\n\n/**\n * Predicate which checks if a value looks like a Promise\n *\n * It is probably a Promise if it's an object, and it has a `then` property which is a Function\n */\nexport const isPromise = <(x: any) => x is Promise> and(isObject, pipe(prop('then'), isFunction));\n\n","/**\n * Random utility functions used in the UI-Router code\n *\n * These functions are exported, but are subject to change without notice.\n *\n * @preferred\n * @module common\n */\n/** for typedoc */\nimport { isFunction, isString, isArray, isRegExp, isDate } from \"./predicates\";\nimport { all, any, prop, curry, not } from \"./hof\";\nimport { services } from \"./coreservices\";\nimport { StateObject } from \"../state/stateObject\";\n\nlet w: any = typeof window === 'undefined' ? {} : window;\nlet angular = w.angular || {};\nexport const fromJson = angular.fromJson || JSON.parse.bind(JSON);\nexport const toJson = angular.toJson || JSON.stringify.bind(JSON);\nexport const forEach = angular.forEach || _forEach;\nexport const extend = Object.assign || _extend;\nexport const equals = angular.equals || _equals;\nexport function identity(x: any) { return x; }\nexport function noop(): any {}\n\nexport type Mapper = (x: X, key?: (string|number)) => T;\nexport interface TypedMap { [key: string]: T; }\nexport type Predicate = (x?: X) => boolean;\n/**\n * An ng1-style injectable\n *\n * This could be a (non-minified) function such as:\n * ```js\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an explicitly annotated function (minify safe)\n * ```js\n * injectableFunction.$inject = [ 'SomeDependency' ];\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an array style annotated function (minify safe)\n * ```js\n * ['SomeDependency', function injectableFunction(SomeDependency) {\n *\n * }];\n * ```\n *\n * @publicapi\n */\nexport type IInjectable = (Function|any[]);\n\nexport interface Obj extends Object {\n [key: string]: any;\n}\n\n/**\n * Builds proxy functions on the `to` object which pass through to the `from` object.\n *\n * For each key in `fnNames`, creates a proxy function on the `to` object.\n * The proxy function calls the real function on the `from` object.\n *\n *\n * #### Example:\n * This example creates an new class instance whose functions are prebound to the new'd object.\n * ```js\n * class Foo {\n * constructor(data) {\n * // Binds all functions from Foo.prototype to 'this',\n * // then copies them to 'this'\n * bindFunctions(Foo.prototype, this, this);\n * this.data = data;\n * }\n *\n * log() {\n * console.log(this.data);\n * }\n * }\n *\n * let myFoo = new Foo([1,2,3]);\n * var logit = myFoo.log;\n * logit(); // logs [1, 2, 3] from the myFoo 'this' instance\n * ```\n *\n * #### Example:\n * This example creates a bound version of a service function, and copies it to another object\n * ```\n *\n * var SomeService = {\n * this.data = [3, 4, 5];\n * this.log = function() {\n * console.log(this.data);\n * }\n * }\n *\n * // Constructor fn\n * function OtherThing() {\n * // Binds all functions from SomeService to SomeService,\n * // then copies them to 'this'\n * bindFunctions(SomeService, this, SomeService);\n * }\n *\n * let myOtherThing = new OtherThing();\n * myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this'\n * ```\n *\n * @param source A function that returns the source object which contains the original functions to be bound\n * @param target A function that returns the target object which will receive the bound functions\n * @param bind A function that returns the object which the functions will be bound to\n * @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object)\n * @param latebind If true, the binding of the function is delayed until the first time it's invoked\n */\nexport function createProxyFunctions(source: Function, target: Obj, bind: Function, fnNames?: string[], latebind = false): Obj {\n const bindFunction = (fnName) =>\n source()[fnName].bind(bind());\n\n const makeLateRebindFn = fnName => function lateRebindFunction() {\n target[fnName] = bindFunction(fnName);\n return target[fnName].apply(null, arguments);\n };\n\n fnNames = fnNames || Object.keys(source());\n\n return fnNames.reduce((acc, name) => {\n acc[name] = latebind ? makeLateRebindFn(name) : bindFunction(name);\n return acc;\n }, target);\n}\n\n\n/**\n * prototypal inheritance helper.\n * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it\n */\nexport const inherit = (parent: Obj, extra?: Obj) =>\n extend(Object.create(parent), extra);\n\n/** Given an array, returns true if the object is found in the array, (using indexOf) */\nexport const inArray: typeof _inArray = curry(_inArray) as any;\nexport function _inArray(array: any[], obj: any): boolean;\nexport function _inArray(array: any[]): (obj: any) => boolean;\nexport function _inArray(array, obj?): any {\n return array.indexOf(obj) !== -1;\n}\n\n/**\n * Given an array, and an item, if the item is found in the array, it removes it (in-place).\n * The same array is returned\n */\nexport const removeFrom: typeof _removeFrom = curry(_removeFrom) as any;\nexport function _removeFrom(array: T[], obj: T): T[];\nexport function _removeFrom(array: T[]): (obj: T) => T[];\nexport function _removeFrom(array, obj?) {\n let idx = array.indexOf(obj);\n if (idx >= 0) array.splice(idx, 1);\n return array;\n}\n\n/** pushes a values to an array and returns the value */\nexport const pushTo: typeof _pushTo = curry(_pushTo) as any;\nexport function _pushTo(arr: T[], val: T): T ;\nexport function _pushTo(arr: T[]): (val: T) => T ;\nexport function _pushTo(arr, val?): any {\n return (arr.push(val), val);\n}\n\n/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */\nexport const deregAll = (functions: Function[]) =>\n functions.slice().forEach(fn => {\n typeof fn === 'function' && fn();\n removeFrom(functions, fn);\n });\n/**\n * Applies a set of defaults to an options object. The options object is filtered\n * to only those properties of the objects in the defaultsList.\n * Earlier objects in the defaultsList take precedence when applying defaults.\n */\nexport function defaults(opts, ...defaultsList: Obj[]) {\n let _defaultsList = defaultsList.concat({}).reverse();\n let defaultVals = extend.apply(null, _defaultsList);\n return extend({}, defaultVals, pick(opts || {}, Object.keys(defaultVals)));\n}\n\n/** Reduce function that merges each element of the list into a single object, using extend */\nexport const mergeR = (memo: Obj, item: Obj) => extend(memo, item);\n\n/**\n * Finds the common ancestor path between two states.\n *\n * @param {Object} first The first state.\n * @param {Object} second The second state.\n * @return {Array} Returns an array of state names in descending order, not including the root.\n */\nexport function ancestors(first: StateObject, second: StateObject) {\n let path: StateObject[] = [];\n\n for (let n in first.path) {\n if (first.path[n] !== second.path[n]) break;\n path.push(first.path[n]);\n }\n return path;\n}\n\n/**\n * Return a copy of the object only containing the whitelisted properties.\n *\n * #### Example:\n * ```\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the whitelisted property names\n */\nexport function pick(obj: Obj, propNames: string[]): Obj {\n let objCopy = {};\n for (let prop in obj) {\n if (propNames.indexOf(prop) !== -1) {\n objCopy[prop] = obj[prop];\n }\n }\n return objCopy;\n}\n\n/**\n * Return a copy of the object omitting the blacklisted properties.\n *\n * @example\n * ```\n *\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = omit(foo, ['a', 'b']); // { c: 3 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the blacklisted property names\n */\nexport function omit(obj: Obj, propNames: string[]): Obj {\n return Object.keys(obj)\n .filter(not(inArray(propNames)))\n .reduce((acc, key) => (acc[key] = obj[key], acc), {});\n}\n\n\n/** Given an array of objects, maps each element to a named property of the element. */\nexport function pluck(collection: Obj[], propName: string): T[];\n/** Given an object, maps each property of the object to a named property of the property. */\nexport function pluck(collection: { [key: string]: any }, propName: string): { [key: string]: any };\n/**\n * Maps an array, or object to a property (by name)\n */\nexport function pluck(collection: any, propName: string): any {\n return map(collection, > prop(propName));\n}\n\n\n/** Given an array of objects, returns a new array containing only the elements which passed the callback predicate */\nexport function filter(collection: T[], callback: (t: T, key?: number) => boolean): T[];\n/** Given an object, returns a new object with only those properties that passed the callback predicate */\nexport function filter(collection: TypedMap, callback: (t: T, key?: string) => boolean): TypedMap;\n/** Filters an Array or an Object's properties based on a predicate */\nexport function filter(collection: any, callback: Function): T {\n let arr = isArray(collection), result: any = arr ? [] : {};\n let accept = arr ? x => result.push(x) : (x, key) => result[key] = x;\n forEach(collection, function(item, i) {\n if (callback(item, i)) accept(item, i);\n });\n return result;\n}\n\n\n/** Given an object, return the first property of that object which passed the callback predicate */\nexport function find(collection: TypedMap, callback: Predicate): T;\n/** Given an array of objects, returns the first object which passed the callback predicate */\nexport function find(collection: T[], callback: Predicate): T;\n/** Finds an object from an array, or a property of an object, that matches a predicate */\nexport function find(collection: any, callback: any) {\n let result;\n\n forEach(collection, function(item, i) {\n if (result) return;\n if (callback(item, i)) result = item;\n });\n\n return result;\n}\n\n/** Given an object, returns a new object, where each property is transformed by the callback function */\nexport let mapObj: (collection: { [key: string]: T }, callback: Mapper) => { [key: string]: U } = map;\n/** Given an array, returns a new array, where each element is transformed by the callback function */\nexport function map(collection: T[], callback: Mapper): U[];\nexport function map(collection: { [key: string]: T }, callback: Mapper): { [key: string]: U };\n/** Maps an array or object properties using a callback function */\nexport function map(collection: any, callback: any): any {\n let result = isArray(collection) ? [] : {};\n forEach(collection, (item, i) => result[i] = callback(item, i));\n return result;\n}\n\n/**\n * Given an object, return its enumerable property values\n *\n * @example\n * ```\n *\n * let foo = { a: 1, b: 2, c: 3 }\n * let vals = values(foo); // [ 1, 2, 3 ]\n * ```\n */\nexport const values: ( (obj: TypedMap) => T[]) = (obj: Obj) =>\n Object.keys(obj).map(key => obj[key]);\n\n/**\n * Reduce function that returns true if all of the values are truthy.\n *\n * @example\n * ```\n *\n * let vals = [ 1, true, {}, \"hello world\"];\n * vals.reduce(allTrueR, true); // true\n *\n * vals.push(0);\n * vals.reduce(allTrueR, true); // false\n * ```\n */\nexport const allTrueR = (memo: boolean, elem: any) => memo && elem;\n\n/**\n * Reduce function that returns true if any of the values are truthy.\n *\n * * @example\n * ```\n *\n * let vals = [ 0, null, undefined ];\n * vals.reduce(anyTrueR, true); // false\n *\n * vals.push(\"hello world\");\n * vals.reduce(anyTrueR, true); // true\n * ```\n */\nexport const anyTrueR = (memo: boolean, elem: any) => memo || elem;\n\n/**\n * Reduce function which un-nests a single level of arrays\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnestR = (memo: any[], elem: any[]) => memo.concat(elem);\n\n/**\n * Reduce function which recursively un-nests all arrays\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flattenR = (memo: any[], elem: any) =>\n isArray(elem) ? memo.concat(elem.reduce(flattenR, [])) : pushR(memo, elem);\n\n/**\n * Reduce function that pushes an object to an array, then returns the array.\n * Mostly just for [[flattenR]] and [[uniqR]]\n */\nexport function pushR(arr: any[], obj: any) {\n arr.push(obj);\n return arr;\n}\n\n/** Reduce function that filters out duplicates */\nexport const uniqR = (acc: T[], token: T): T[] =>\n inArray(acc, token) ? acc : pushR(acc, token);\n\n/**\n * Return a new array with a single level of arrays unnested.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * unnest(input) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnest = (arr: any[]) => arr.reduce(unnestR, []);\n/**\n * Return a completely flattened version of an array.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * flatten(input) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flatten = (arr: any[]) => arr.reduce(flattenR, []);\n\n/**\n * Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass.\n * @example\n * ```\n *\n * let isNumber = (obj) => typeof(obj) === 'number';\n * let allNumbers = [ 1, 2, 3, 4, 5 ];\n * allNumbers.filter(assertPredicate(isNumber)); //OK\n *\n * let oneString = [ 1, 2, 3, 4, \"5\" ];\n * oneString.filter(assertPredicate(isNumber, \"Not all numbers\")); // throws Error(\"\"Not all numbers\"\");\n * ```\n */\nexport const assertPredicate: (predicate: Predicate, errMsg: (string|Function)) => Predicate = assertFn;\n/**\n * Given a .map function, builds a .map function which throws an error if any mapped elements do not pass a truthyness test.\n * @example\n * ```\n *\n * var data = { foo: 1, bar: 2 };\n *\n * let keys = [ 'foo', 'bar' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // values is [1, 2]\n *\n * let keys = [ 'foo', 'bar', 'baz' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // throws Error(\"Key not found\")\n * ```\n */\nexport const assertMap: (mapFn: (t: T) => U, errMsg: (string|Function)) => (t: T) => U = assertFn;\nexport function assertFn(predicateOrMap: Function, errMsg: (string|Function) = \"assert failure\"): any {\n return (obj) => {\n let result = predicateOrMap(obj);\n if (!result) {\n throw new Error(isFunction(errMsg) ? ( errMsg)(obj) : errMsg);\n }\n return result;\n };\n}\n\n/**\n * Like _.pairs: Given an object, returns an array of key/value pairs\n *\n * @example\n * ```\n *\n * pairs({ foo: \"FOO\", bar: \"BAR }) // [ [ \"foo\", \"FOO\" ], [ \"bar\": \"BAR\" ] ]\n * ```\n */\nexport const pairs = (obj: Obj) =>\n Object.keys(obj).map(key => [ key, obj[key]] );\n\n/**\n * Given two or more parallel arrays, returns an array of tuples where\n * each tuple is composed of [ a[i], b[i], ... z[i] ]\n *\n * @example\n * ```\n *\n * let foo = [ 0, 2, 4, 6 ];\n * let bar = [ 1, 3, 5, 7 ];\n * let baz = [ 10, 30, 50, 70 ];\n * arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ]\n * arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ]\n * ```\n */\nexport function arrayTuples(...args: any[]): any[] {\n if (args.length === 0) return [];\n let maxArrayLen = args.reduce((min, arr) => Math.min(arr.length, min), 9007199254740991); // aka 2^53 − 1 aka Number.MAX_SAFE_INTEGER\n\n let i, result = [];\n\n for (i = 0; i < maxArrayLen; i++) {\n // This is a hot function\n // Unroll when there are 1-4 arguments\n switch (args.length) {\n case 1: result.push([args[0][i]]); break;\n case 2: result.push([args[0][i], args[1][i]]); break;\n case 3: result.push([args[0][i], args[1][i], args[2][i]]); break;\n case 4: result.push([args[0][i], args[1][i], args[2][i], args[3][i]]); break;\n default:\n result.push(args.map(array => array[i])); break;\n }\n }\n\n return result;\n}\n\n/**\n * Reduce function which builds an object from an array of [key, value] pairs.\n *\n * Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration.\n *\n * Each keyValueTuple should be an array with values [ key: string, value: any ]\n *\n * @example\n * ```\n *\n * var pairs = [ [\"fookey\", \"fooval\"], [\"barkey\", \"barval\"] ]\n *\n * var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n *\n * // Or, more simply:\n * var pairsToObj = pairs.reduce(applyPairs, {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n * ```\n */\nexport function applyPairs(memo: TypedMap, keyValTuple: any[]) {\n let key: string, value: any;\n if (isArray(keyValTuple)) [key, value] = keyValTuple;\n if (!isString(key)) throw new Error(\"invalid parameters to applyPairs\");\n memo[key] = value;\n return memo;\n}\n\n/** Get the last element of an array */\nexport function tail(arr: T[]): T {\n return arr.length && arr[arr.length - 1] || undefined;\n}\n\n/**\n * shallow copy from src to dest\n */\nexport function copy(src: Obj, dest?: Obj) {\n if (dest) Object.keys(dest).forEach(key => delete dest[key]);\n if (!dest) dest = {};\n return extend(dest, src);\n}\n\n/** Naive forEach implementation works with Objects or Arrays */\nfunction _forEach(obj: (any[]|any), cb: (el, idx?) => void, _this: Obj) {\n if (isArray(obj)) return obj.forEach(cb, _this);\n Object.keys(obj).forEach(key => cb(obj[key], key));\n}\n\n/** Like Object.assign() */\nexport function _extend(toObj: Obj, ...fromObjs: Obj[]): any;\nexport function _extend(toObj: Obj): any {\n for (let i = 1; i < arguments.length; i++) {\n let obj = arguments[i];\n if (!obj) continue;\n let keys = Object.keys(obj);\n\n for (let j = 0; j < keys.length; j++) {\n toObj[keys[j]] = obj[keys[j]];\n }\n }\n\n return toObj;\n}\n\nfunction _equals(o1: any, o2: any): boolean {\n if (o1 === o2) return true;\n if (o1 === null || o2 === null) return false;\n if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN\n let t1 = typeof o1, t2 = typeof o2;\n if (t1 !== t2 || t1 !== 'object') return false;\n\n const tup = [o1, o2];\n if (all(isArray)(tup)) return _arraysEq(o1, o2);\n if (all(isDate)(tup)) return o1.getTime() === o2.getTime();\n if (all(isRegExp)(tup)) return o1.toString() === o2.toString();\n if (all(isFunction)(tup)) return true; // meh\n\n let predicates = [isFunction, isArray, isDate, isRegExp];\n if (predicates.map(any).reduce((b, fn) => b || !!fn(tup), false)) return false;\n\n let key: string, keys: { [i: string]: boolean } = {};\n for (key in o1) {\n if (!_equals(o1[key], o2[key])) return false;\n keys[key] = true;\n }\n for (key in o2) {\n if (!keys[key]) return false;\n }\n\n return true;\n}\n\nfunction _arraysEq(a1: any[], a2: any[]) {\n if (a1.length !== a2.length) return false;\n return arrayTuples(a1, a2).reduce((b, t) => b && _equals(t[0], t[1]), true);\n}\n\n// issue #2676\nexport const silenceUncaughtInPromise = (promise: Promise) =>\n promise.catch(e => 0) && promise;\nexport const silentRejection = (error: any) =>\n silenceUncaughtInPromise(services.$q.reject(error));\n","/**\n * # Transition tracing (debug)\n *\n * Enable transition tracing to print transition information to the console,\n * in order to help debug your application.\n * Tracing logs detailed information about each Transition to your console.\n *\n * To enable tracing, import the [[Trace]] singleton and enable one or more categories.\n *\n * ### ES6\n * ```js\n * import {trace} from \"ui-router-ng2\"; // or \"angular-ui-router\"\n * trace.enable(1, 5); // TRANSITION and VIEWCONFIG\n * ```\n *\n * ### CJS\n * ```js\n * let trace = require(\"angular-ui-router\").trace; // or \"ui-router-ng2\"\n * trace.enable(\"TRANSITION\", \"VIEWCONFIG\");\n * ```\n *\n * ### Globals\n * ```js\n * let trace = window[\"angular-ui-router\"].trace; // or \"ui-router-ng2\"\n * trace.enable(); // Trace everything (very verbose)\n * ```\n *\n * ### Angular 1:\n * ```js\n * app.run($trace => $trace.enable());\n * ```\n *\n * @coreapi\n * @module trace\n */ /** for typedoc */\nimport {parse} from \"../common/hof\";\nimport {isFunction, isNumber} from \"../common/predicates\";\nimport {Transition} from \"../transition/transition\";\nimport {ActiveUIView, ViewConfig, ViewContext} from \"../view/interface\";\nimport {stringify, functionToString, maxLength, padString} from \"./strings\";\nimport {Resolvable} from \"../resolve/resolvable\";\nimport {PathNode} from \"../path/pathNode\";\nimport {PolicyWhen} from \"../resolve/interface\";\nimport {TransitionHook} from \"../transition/transitionHook\";\nimport {HookResult} from \"../transition/interface\";\nimport {StateObject} from \"../state/stateObject\";\n\n/** @hidden */\nfunction uiViewString (uiview: ActiveUIView) {\n if (!uiview) return 'ui-view (defunct)';\n const state = uiview.creationContext ? uiview.creationContext.name || '(root)' : '(none)';\n return `[ui-view#${uiview.id} ${uiview.$type}:${uiview.fqn} (${uiview.name}@${state})]`;\n}\n\n/** @hidden */\nconst viewConfigString = (viewConfig: ViewConfig) => {\n let view = viewConfig.viewDecl;\n const state = view.$context.name || '(root)';\n return `[View#${viewConfig.$id} from '${state}' state]: target ui-view: '${view.$uiViewName}@${view.$uiViewContextAnchor}'`;\n};\n\n/** @hidden */\nfunction normalizedCat(input: Category|string): string {\n return isNumber(input) ? Category[input] : Category[Category[input]];\n}\n\n/** @hidden */\nconst consoletable = isFunction(console.table) ? console.table.bind(console) : console.log.bind(console);\n\n/**\n * Trace categories Enum\n *\n * Enable or disable a category using [[Trace.enable]] or [[Trace.disable]]\n *\n * `trace.enable(Category.TRANSITION)`\n *\n * These can also be provided using a matching string, or position ordinal\n *\n * `trace.enable(\"TRANSITION\")`\n *\n * `trace.enable(1)`\n */\nexport enum Category {\n RESOLVE, TRANSITION, HOOK, UIVIEW, VIEWCONFIG,\n}\n\n/** @hidden */ const _tid = parse(\"$id\");\n/** @hidden */ const _rid = parse(\"router.$id\");\n/** @hidden */ const transLbl = (trans) => `Transition #${_tid(trans)}-${_rid(trans)}`;\n\n/**\n * Prints UI-Router Transition trace information to the console.\n */\nexport class Trace {\n /** @hidden */\n approximateDigests: number;\n\n /** @hidden */\n constructor() {\n this.approximateDigests = 0;\n }\n\n /** @hidden */\n private _enabled: { [key: string]: boolean } = {};\n\n /** @hidden */\n private _set(enabled: boolean, categories: Category[]) {\n if (!categories.length) {\n categories = Object.keys(Category)\n .map(k => parseInt(k, 10))\n .filter(k => !isNaN(k))\n .map(key => Category[key]);\n }\n categories.map(normalizedCat).forEach(category => this._enabled[category] = enabled);\n }\n\n /**\n * Enables a trace [[Category]]\n *\n * ```js\n * trace.enable(\"TRANSITION\");\n * ```\n *\n * @param categories categories to enable. If `categories` is omitted, all categories are enabled.\n * Also takes strings (category name) or ordinal (category position)\n */\n enable(...categories: (Category|string|number)[]);\n enable(...categories: any[]) { this._set(true, categories); }\n /**\n * Disables a trace [[Category]]\n *\n * ```js\n * trace.disable(\"VIEWCONFIG\");\n * ```\n *\n * @param categories categories to disable. If `categories` is omitted, all categories are disabled.\n * Also takes strings (category name) or ordinal (category position)\n */\n disable(...categories: (Category|string|number)[]);\n disable(...categories: any[]) { this._set(false, categories); }\n\n /**\n * Retrieves the enabled stateus of a [[Category]]\n *\n * ```js\n * trace.enabled(\"VIEWCONFIG\"); // true or false\n * ```\n *\n * @returns boolean true if the category is enabled\n */\n enabled(category: (Category|string|number)): boolean {\n return !!this._enabled[normalizedCat(category)];\n }\n\n /** @internalapi called by ui-router code */\n traceTransitionStart(trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: Started -> ${stringify(trans)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceTransitionIgnored(trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: Ignored <> ${stringify(trans)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceHookInvocation(step: TransitionHook, trans: Transition, options: any) {\n if (!this.enabled(Category.HOOK)) return;\n let event = parse(\"traceData.hookType\")(options) || \"internal\",\n context = parse(\"traceData.context.state.name\")(options) || parse(\"traceData.context\")(options) || \"unknown\",\n name = functionToString((step as any).registeredHook.callback);\n console.log(`${transLbl(trans)}: Hook -> ${event} context: ${context}, ${maxLength(200, name)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceHookResult(hookResult: HookResult, trans: Transition, transitionOptions: any) {\n if (!this.enabled(Category.HOOK)) return;\n console.log(`${transLbl(trans)}: <- Hook returned: ${maxLength(200, stringify(hookResult))}`);\n }\n\n /** @internalapi called by ui-router code */\n traceResolvePath(path: PathNode[], when: PolicyWhen, trans?: Transition) {\n if (!this.enabled(Category.RESOLVE)) return;\n console.log(`${transLbl(trans)}: Resolving ${path} (${when})`);\n }\n\n /** @internalapi called by ui-router code */\n traceResolvableResolved(resolvable: Resolvable, trans?: Transition) {\n if (!this.enabled(Category.RESOLVE)) return;\n console.log(`${transLbl(trans)}: <- Resolved ${resolvable} to: ${maxLength(200, stringify(resolvable.data))}`);\n }\n\n /** @internalapi called by ui-router code */\n traceError(reason: any, trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: <- Rejected ${stringify(trans)}, reason: ${reason}`);\n }\n\n /** @internalapi called by ui-router code */\n traceSuccess(finalState: StateObject, trans: Transition) {\n if (!this.enabled(Category.TRANSITION)) return;\n console.log(`${transLbl(trans)}: <- Success ${stringify(trans)}, final state: ${finalState.name}`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewEvent(event: string, viewData: ActiveUIView, extra = \"\") {\n if (!this.enabled(Category.UIVIEW)) return;\n console.log(`ui-view: ${padString(30, event)} ${uiViewString(viewData)}${extra}`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewConfigUpdated(viewData: ActiveUIView, context: ViewContext) {\n if (!this.enabled(Category.UIVIEW)) return;\n this.traceUIViewEvent(\"Updating\", viewData, ` with ViewConfig from context='${context}'`);\n }\n\n /** @internalapi called by ui-router code */\n traceUIViewFill(viewData: ActiveUIView, html: string) {\n if (!this.enabled(Category.UIVIEW)) return;\n this.traceUIViewEvent(\"Fill\", viewData, ` with: ${maxLength(200, html)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceViewSync(pairs: any[]) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n const mapping = pairs.map(([ uiViewData, config ]) => {\n const uiView = `${uiViewData.$type}:${uiViewData.fqn}`;\n const view = config && `${config.viewDecl.$context.name}: ${config.viewDecl.$name} (${config.viewDecl.$type})`;\n\n return { 'ui-view fqn': uiView, 'state: view name': view };\n }).sort((a, b) => a['ui-view fqn'].localeCompare(b['ui-view fqn']));\n\n consoletable(mapping);\n }\n\n /** @internalapi called by ui-router code */\n traceViewServiceEvent(event: string, viewConfig: ViewConfig) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n console.log(`VIEWCONFIG: ${event} ${viewConfigString(viewConfig)}`);\n }\n\n /** @internalapi called by ui-router code */\n traceViewServiceUIViewEvent(event: string, viewData: ActiveUIView) {\n if (!this.enabled(Category.VIEWCONFIG)) return;\n console.log(`VIEWCONFIG: ${event} ${uiViewString(viewData)}`);\n }\n}\n\n/**\n * The [[Trace]] singleton\n *\n * #### Example:\n * ```js\n * import {trace} from \"angular-ui-router\";\n * trace.enable(1, 5);\n * ```\n */\nlet trace = new Trace();\nexport {trace};\n","/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\nimport { extend, removeFrom, tail, values, identity, map } from \"../common/common\";\nimport {isString, isFunction} from \"../common/predicates\";\nimport {PathNode} from \"../path/pathNode\";\nimport {\n TransitionStateHookFn, TransitionHookFn, TransitionHookPhase, TransitionHookScope, IHookRegistry, PathType\n} from \"./interface\"; // has or is using\n\nimport {\n HookRegOptions, HookMatchCriteria, TreeChanges,\n HookMatchCriterion, IMatchingNodes, HookFn\n} from \"./interface\";\nimport {Glob} from \"../common/glob\";\nimport {StateObject} from \"../state/stateObject\";\nimport {TransitionEventType} from \"./transitionEventType\";\nimport { TransitionService } from \"./transitionService\";\n\n/**\n * Determines if the given state matches the matchCriteria\n *\n * @hidden\n *\n * @param state a State Object to test against\n * @param criterion\n * - If a string, matchState uses the string as a glob-matcher against the state name\n * - If an array (of strings), matchState uses each string in the array as a glob-matchers against the state name\n * and returns a positive match if any of the globs match.\n * - If a function, matchState calls the function with the state and returns true if the function's result is truthy.\n * @returns {boolean}\n */\nexport function matchState(state: StateObject, criterion: HookMatchCriterion) {\n let toMatch = isString(criterion) ? [criterion] : criterion;\n\n function matchGlobs(_state: StateObject) {\n let globStrings = toMatch;\n for (let i = 0; i < globStrings.length; i++) {\n let glob = new Glob(globStrings[i]);\n\n if ((glob && glob.matches(_state.name)) || (!glob && globStrings[i] === _state.name)) {\n return true;\n }\n }\n return false;\n }\n\n let matchFn = (isFunction(toMatch) ? toMatch : matchGlobs);\n return !!matchFn(state);\n}\n\n/**\n * @internalapi\n * The registration data for a registered transition hook\n */\nexport class RegisteredHook {\n priority: number;\n bind: any;\n _deregistered: boolean;\n\n constructor(public tranSvc: TransitionService,\n public eventType: TransitionEventType,\n public callback: HookFn,\n public matchCriteria: HookMatchCriteria,\n options: HookRegOptions = {} as any) {\n this.priority = options.priority || 0;\n this.bind = options.bind || null;\n this._deregistered = false;\n }\n\n /**\n * Gets the matching [[PathNode]]s\n *\n * Given an array of [[PathNode]]s, and a [[HookMatchCriterion]], returns an array containing\n * the [[PathNode]]s that the criteria matches, or `null` if there were no matching nodes.\n *\n * Returning `null` is significant to distinguish between the default\n * \"match-all criterion value\" of `true` compared to a `() => true` function,\n * when the nodes is an empty array.\n *\n * This is useful to allow a transition match criteria of `entering: true`\n * to still match a transition, even when `entering === []`. Contrast that\n * with `entering: (state) => true` which only matches when a state is actually\n * being entered.\n */\n private _matchingNodes(nodes: PathNode[], criterion: HookMatchCriterion): PathNode[] {\n if (criterion === true) return nodes;\n let matching = nodes.filter(node => matchState(node.state, criterion));\n return matching.length ? matching : null;\n }\n\n /**\n * Gets the default match criteria (all `true`)\n *\n * Returns an object which has all the criteria match paths as keys and `true` as values, i.e.:\n *\n * ```js\n * {\n * to: true,\n * from: true,\n * entering: true,\n * exiting: true,\n * retained: true,\n * }\n */\n private _getDefaultMatchCriteria(): HookMatchCriteria {\n return map(this.tranSvc._pluginapi._getPathTypes(), () => true);\n }\n\n /**\n * Gets matching nodes as [[IMatchingNodes]]\n *\n * Create a IMatchingNodes object from the TransitionHookTypes that is roughly equivalent to:\n *\n * ```js\n * let matches: IMatchingNodes = {\n * to: _matchingNodes([tail(treeChanges.to)], mc.to),\n * from: _matchingNodes([tail(treeChanges.from)], mc.from),\n * exiting: _matchingNodes(treeChanges.exiting, mc.exiting),\n * retained: _matchingNodes(treeChanges.retained, mc.retained),\n * entering: _matchingNodes(treeChanges.entering, mc.entering),\n * };\n * ```\n */\n private _getMatchingNodes(treeChanges: TreeChanges): IMatchingNodes {\n let criteria = extend(this._getDefaultMatchCriteria(), this.matchCriteria);\n let paths: PathType[] = values(this.tranSvc._pluginapi._getPathTypes());\n\n return paths.reduce((mn: IMatchingNodes, pathtype: PathType) => {\n // STATE scope criteria matches against every node in the path.\n // TRANSITION scope criteria matches against only the last node in the path\n let isStateHook = pathtype.scope === TransitionHookScope.STATE;\n let path = treeChanges[pathtype.name] || [];\n let nodes: PathNode[] = isStateHook ? path : [tail(path)];\n\n mn[pathtype.name] = this._matchingNodes(nodes, criteria[pathtype.name]);\n return mn;\n }, {} as IMatchingNodes);\n }\n\n /**\n * Determines if this hook's [[matchCriteria]] match the given [[TreeChanges]]\n *\n * @returns an IMatchingNodes object, or null. If an IMatchingNodes object is returned, its values\n * are the matching [[PathNode]]s for each [[HookMatchCriterion]] (to, from, exiting, retained, entering)\n */\n matches(treeChanges: TreeChanges): IMatchingNodes {\n let matches = this._getMatchingNodes(treeChanges);\n\n // Check if all the criteria matched the TreeChanges object\n let allMatched = values(matches).every(identity);\n return allMatched ? matches : null;\n }\n}\n\n/** @hidden Return a registration function of the requested type. */\nexport function makeEvent(registry: IHookRegistry, transitionService: TransitionService, eventType: TransitionEventType) {\n // Create the object which holds the registered transition hooks.\n let _registeredHooks = registry._registeredHooks = (registry._registeredHooks || {});\n let hooks = _registeredHooks[eventType.name] = [];\n\n // Create hook registration function on the IHookRegistry for the event\n registry[eventType.name] = hookRegistrationFn;\n\n function hookRegistrationFn(matchObject, callback, options = {}) {\n let registeredHook = new RegisteredHook(transitionService, eventType, callback, matchObject, options);\n hooks.push(registeredHook);\n\n return function deregisterEventHook() {\n registeredHook._deregistered = true;\n removeFrom(hooks)(registeredHook);\n };\n }\n\n return hookRegistrationFn;\n}","/**\n * @coreapi\n * @module transition\n */ /** for typedoc */\n\nimport {extend, tail, assertPredicate, unnestR, identity} from \"../common/common\";\nimport {isArray} from \"../common/predicates\";\n\nimport {\n TransitionOptions, TransitionHookOptions, IHookRegistry, TreeChanges, IMatchingNodes,\n TransitionHookPhase, TransitionHookScope\n} from \"./interface\";\n\nimport {Transition} from \"./transition\";\nimport {TransitionHook} from \"./transitionHook\";\nimport {StateObject} from \"../state/stateObject\";\nimport {PathNode} from \"../path/pathNode\";\nimport {TransitionService} from \"./transitionService\";\nimport {TransitionEventType} from \"./transitionEventType\";\nimport {RegisteredHook} from \"./hookRegistry\";\n\n/**\n * This class returns applicable TransitionHooks for a specific Transition instance.\n *\n * Hooks ([[RegisteredHook]]) may be registered globally, e.g., $transitions.onEnter(...), or locally, e.g.\n * myTransition.onEnter(...). The HookBuilder finds matching RegisteredHooks (where the match criteria is\n * determined by the type of hook)\n *\n * The HookBuilder also converts RegisteredHooks objects to TransitionHook objects, which are used to run a Transition.\n *\n * The HookBuilder constructor is given the $transitions service and a Transition instance. Thus, a HookBuilder\n * instance may only be used for one specific Transition object. (side note: the _treeChanges accessor is private\n * in the Transition class, so we must also provide the Transition's _treeChanges)\n *\n */\nexport class HookBuilder {\n constructor(private transition: Transition) { }\n\n buildHooksForPhase(phase: TransitionHookPhase): TransitionHook[] {\n let $transitions = this.transition.router.transitionService;\n return $transitions._pluginapi._getEvents(phase)\n .map(type => this.buildHooks(type))\n .reduce(unnestR, [])\n .filter(identity);\n }\n\n /**\n * Returns an array of newly built TransitionHook objects.\n *\n * - Finds all RegisteredHooks registered for the given `hookType` which matched the transition's [[TreeChanges]].\n * - Finds [[PathNode]] (or `PathNode[]`) to use as the TransitionHook context(s)\n * - For each of the [[PathNode]]s, creates a TransitionHook\n *\n * @param hookType the type of the hook registration function, e.g., 'onEnter', 'onFinish'.\n */\n buildHooks(hookType: TransitionEventType): TransitionHook[] {\n let transition = this.transition;\n let treeChanges = transition.treeChanges();\n\n // Find all the matching registered hooks for a given hook type\n let matchingHooks = this.getMatchingHooks(hookType, treeChanges);\n if (!matchingHooks) return [];\n\n let baseHookOptions = {\n transition: transition,\n current: transition.options().current\n };\n\n const makeTransitionHooks = (hook: RegisteredHook) => {\n // Fetch the Nodes that caused this hook to match.\n let matches: IMatchingNodes = hook.matches(treeChanges);\n // Select the PathNode[] that will be used as TransitionHook context objects\n let matchingNodes: PathNode[] = matches[hookType.criteriaMatchPath.name];\n\n // Return an array of HookTuples\n return matchingNodes.map(node => {\n let _options = extend({\n bind: hook.bind,\n traceData: { hookType: hookType.name, context: node }\n }, baseHookOptions);\n\n let state = hookType.criteriaMatchPath.scope === TransitionHookScope.STATE ? node.state.self : null;\n let transitionHook = new TransitionHook(transition, state, hook, _options);\n return { hook, node, transitionHook };\n });\n };\n\n return matchingHooks.map(makeTransitionHooks)\n .reduce(unnestR, [])\n .sort(tupleSort(hookType.reverseSort))\n .map(tuple => tuple.transitionHook);\n }\n\n /**\n * Finds all RegisteredHooks from:\n * - The Transition object instance hook registry\n * - The TransitionService ($transitions) global hook registry\n *\n * which matched:\n * - the eventType\n * - the matchCriteria (to, from, exiting, retained, entering)\n *\n * @returns an array of matched [[RegisteredHook]]s\n */\n public getMatchingHooks(hookType: TransitionEventType, treeChanges: TreeChanges): RegisteredHook[] {\n let isCreate = hookType.hookPhase === TransitionHookPhase.CREATE;\n\n // Instance and Global hook registries\n let $transitions = this.transition.router.transitionService;\n let registries = isCreate ? [ $transitions ] : [ this.transition, $transitions ];\n\n return registries.map((reg: IHookRegistry) => reg.getHooks(hookType.name)) // Get named hooks from registries\n .filter(assertPredicate(isArray, `broken event named: ${hookType.name}`)) // Sanity check\n .reduce(unnestR, []) // Un-nest RegisteredHook[][] to RegisteredHook[] array\n .filter(hook => hook.matches(treeChanges)); // Only those satisfying matchCriteria\n }\n}\n\ninterface HookTuple { hook: RegisteredHook, node: PathNode, transitionHook: TransitionHook }\n\n/**\n * A factory for a sort function for HookTuples.\n *\n * The sort function first compares the PathNode depth (how deep in the state tree a node is), then compares\n * the EventHook priority.\n *\n * @param reverseDepthSort a boolean, when true, reverses the sort order for the node depth\n * @returns a tuple sort function\n */\nfunction tupleSort(reverseDepthSort = false) {\n return function nodeDepthThenPriority(l: HookTuple, r: HookTuple): number {\n let factor = reverseDepthSort ? -1 : 1;\n let depthDelta = (l.node.state.path.length - r.node.state.path.length) * factor;\n return depthDelta !== 0 ? depthDelta : r.hook.priority - l.hook.priority;\n }\n}","/**\n * @coreapi\n * @module params\n */\n/** */\nimport {extend, filter, map} from \"../common/common\";\nimport {isArray, isDefined} from \"../common/predicates\";\nimport {ParamTypeDefinition} from \"./interface\";\n\n/**\n * An internal class which implements [[ParamTypeDefinition]].\n *\n * A [[ParamTypeDefinition]] is a plain javascript object used to register custom parameter types.\n * When a param type definition is registered, an instance of this class is created internally.\n *\n * This class has naive implementations for all the [[ParamTypeDefinition]] methods.\n *\n * Used by [[UrlMatcher]] when matching or formatting URLs, or comparing and validating parameter values.\n *\n * #### Example:\n * ```js\n * var paramTypeDef = {\n * decode: function(val) { return parseInt(val, 10); },\n * encode: function(val) { return val && val.toString(); },\n * equals: function(a, b) { return this.is(a) && a === b; },\n * is: function(val) { return angular.isNumber(val) && isFinite(val) && val % 1 === 0; },\n * pattern: /\\d+/\n * }\n *\n * var paramType = new ParamType(paramTypeDef);\n * ```\n * @internalapi\n */\nexport class ParamType implements ParamTypeDefinition {\n /** @inheritdoc */\n pattern: RegExp = /.*/;\n /** The name/id of the parameter type */\n name: string;\n /** @inheritdoc */\n raw: boolean;\n /** @inheritdoc */\n dynamic: boolean;\n /** @inheritdoc */\n inherit = true;\n\n /**\n * @param def A configuration object which contains the custom type definition. The object's\n * properties will override the default methods and/or pattern in `ParamType`'s public interface.\n * @returns a new ParamType object\n */\n constructor(def: ParamTypeDefinition) {\n extend(this, def);\n }\n\n\n // consider these four methods to be \"abstract methods\" that should be overridden\n /** @inheritdoc */\n is(val: any, key?: string): boolean { return true; }\n /** @inheritdoc */\n encode(val: any, key?: string): (string|string[]) { return val; }\n /** @inheritdoc */\n decode(val: string, key?: string): any { return val; }\n /** @inheritdoc */\n equals(a: any, b: any): boolean { return a == b; }\n\n\n $subPattern() {\n let sub = this.pattern.toString();\n return sub.substr(1, sub.length - 2);\n }\n\n toString() {\n return `{ParamType:${this.name}}`;\n }\n\n /** Given an encoded string, or a decoded object, returns a decoded object */\n $normalize(val: any) {\n return this.is(val) ? val : this.decode(val);\n }\n\n /**\n * Wraps an existing custom ParamType as an array of ParamType, depending on 'mode'.\n * e.g.:\n * - urlmatcher pattern \"/path?{queryParam[]:int}\"\n * - url: \"/path?queryParam=1&queryParam=2\n * - $stateParams.queryParam will be [1, 2]\n * if `mode` is \"auto\", then\n * - url: \"/path?queryParam=1 will create $stateParams.queryParam: 1\n * - url: \"/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2]\n */\n $asArray(mode: (boolean|\"auto\"), isSearch: boolean) {\n if (!mode) return this;\n if (mode === \"auto\" && !isSearch) throw new Error(\"'auto' array mode is for query parameters only\");\n return new ( ArrayType)(this, mode);\n }\n}\n\n/**\n * Wraps up a `ParamType` object to handle array values.\n * @internalapi\n */\nfunction ArrayType(type: ParamType, mode: (boolean|\"auto\")) {\n // Wrap non-array value as array\n function arrayWrap(val: any): any[] {\n return isArray(val) ? val : (isDefined(val) ? [ val ] : []);\n }\n\n // Unwrap array value for \"auto\" mode. Return undefined for empty array.\n function arrayUnwrap(val: any) {\n switch (val.length) {\n case 0: return undefined;\n case 1: return mode === \"auto\" ? val[0] : val;\n default: return val;\n }\n }\n\n // Wraps type (.is/.encode/.decode) functions to operate on each value of an array\n function arrayHandler(callback: (x: any) => any, allTruthyMode?: boolean) {\n return function handleArray(val: any) {\n if (isArray(val) && val.length === 0) return val;\n let arr = arrayWrap(val);\n let result = map(arr, callback);\n return (allTruthyMode === true) ? filter(result, x => !x).length === 0 : arrayUnwrap(result);\n };\n }\n\n // Wraps type (.equals) functions to operate on each value of an array\n function arrayEqualsHandler(callback: (l: any, r: any) => boolean) {\n return function handleArray(val1: any, val2: any) {\n let left = arrayWrap(val1), right = arrayWrap(val2);\n if (left.length !== right.length) return false;\n for (let i = 0; i < left.length; i++) {\n if (!callback(left[i], right[i])) return false;\n }\n return true;\n };\n }\n\n ['encode', 'decode', 'equals', '$normalize'].forEach(name => {\n var paramTypeFn = type[name].bind(type);\n var wrapperFn: Function = name === 'equals' ? arrayEqualsHandler : arrayHandler;\n this[name] = wrapperFn(paramTypeFn);\n });\n\n extend(this, {\n dynamic: type.dynamic,\n name: type.name,\n pattern: type.pattern,\n inherit: type.inherit,\n is: arrayHandler(type.is.bind(type), true),\n $arrayMode: mode\n });\n}\n","/**\n * @coreapi\n * @module params\n */ /** for typedoc */\nimport { extend, filter, map, allTrueR } from \"../common/common\";\nimport { prop } from \"../common/hof\";\nimport { isInjectable, isDefined, isString, isArray, isUndefined } from \"../common/predicates\";\nimport { RawParams, ParamDeclaration } from \"../params/interface\";\nimport { services } from \"../common/coreservices\";\nimport { ParamType } from \"./paramType\";\nimport { ParamTypes } from \"./paramTypes\";\nimport { UrlMatcherFactory } from \"../url/urlMatcherFactory\";\n\n/** @hidden */ let hasOwn = Object.prototype.hasOwnProperty;\n/** @hidden */ let isShorthand = (cfg: ParamDeclaration) =>\n [\"value\", \"type\", \"squash\", \"array\", \"dynamic\"].filter(hasOwn.bind(cfg || {})).length === 0;\n\n/** @internalapi */\nexport enum DefType {\n PATH,\n SEARCH,\n CONFIG,\n}\n\n/** @hidden */\nfunction unwrapShorthand(cfg: ParamDeclaration): ParamDeclaration {\n cfg = isShorthand(cfg) && { value: cfg } as any || cfg;\n\n getStaticDefaultValue['__cacheable'] = true;\n function getStaticDefaultValue() {\n return cfg.value;\n }\n\n return extend(cfg, {\n $$fn: isInjectable(cfg.value) ? cfg.value : getStaticDefaultValue,\n });\n}\n\n/** @hidden */\nfunction getType(cfg: ParamDeclaration, urlType: ParamType, location: DefType, id: string, paramTypes: ParamTypes) {\n if (cfg.type && urlType && urlType.name !== 'string') throw new Error(`Param '${id}' has two type configurations.`);\n if (cfg.type && urlType && urlType.name === 'string' && paramTypes.type(cfg.type as string)) return paramTypes.type(cfg.type as string);\n if (urlType) return urlType;\n if (!cfg.type) {\n let type = location === DefType.CONFIG ? \"any\" :\n location === DefType.PATH ? \"path\" :\n location === DefType.SEARCH ? \"query\" : \"string\";\n return paramTypes.type(type);\n }\n return cfg.type instanceof ParamType ? cfg.type : paramTypes.type(cfg.type as string);\n}\n\n/**\n * @internalapi\n * returns false, true, or the squash value to indicate the \"default parameter url squash policy\".\n */\nfunction getSquashPolicy(config: ParamDeclaration, isOptional: boolean, defaultPolicy: (boolean|string)) {\n let squash = config.squash;\n if (!isOptional || squash === false) return false;\n if (!isDefined(squash) || squash == null) return defaultPolicy;\n if (squash === true || isString(squash)) return squash;\n throw new Error(`Invalid squash policy: '${squash}'. Valid policies: false, true, or arbitrary string`);\n}\n\n/** @internalapi */\nfunction getReplace(config: ParamDeclaration, arrayMode: boolean, isOptional: boolean, squash: (string|boolean)) {\n let replace: any, configuredKeys: string[], defaultPolicy = [\n {from: \"\", to: (isOptional || arrayMode ? undefined : \"\")},\n {from: null, to: (isOptional || arrayMode ? undefined : \"\")},\n ];\n replace = isArray(config.replace) ? config.replace : [];\n if (isString(squash)) replace.push({ from: squash, to: undefined });\n configuredKeys = map(replace, prop(\"from\"));\n return filter(defaultPolicy, item => configuredKeys.indexOf(item.from) === -1).concat(replace);\n}\n\n\n/** @internalapi */\nexport class Param {\n id: string;\n type: ParamType;\n location: DefType;\n isOptional: boolean;\n dynamic: boolean;\n raw: boolean;\n squash: (boolean|string);\n replace: [{ to: any, from: any }];\n inherit: boolean;\n array: boolean;\n config: any;\n /** Cache the default value if it is a static value */\n _defaultValueCache: {\n defaultValue: any,\n };\n\n constructor(id: string, type: ParamType, config: ParamDeclaration, location: DefType, urlMatcherFactory: UrlMatcherFactory) {\n config = unwrapShorthand(config);\n type = getType(config, type, location, id, urlMatcherFactory.paramTypes);\n let arrayMode = getArrayMode();\n type = arrayMode ? type.$asArray(arrayMode, location === DefType.SEARCH) : type;\n let isOptional = config.value !== undefined || location === DefType.SEARCH;\n let dynamic = isDefined(config.dynamic) ? !!config.dynamic : !!type.dynamic;\n let raw = isDefined(config.raw) ? !!config.raw : !!type.raw;\n let squash = getSquashPolicy(config, isOptional, urlMatcherFactory.defaultSquashPolicy());\n let replace = getReplace(config, arrayMode, isOptional, squash);\n let inherit = isDefined(config.inherit) ? !!config.inherit : !!type.inherit;\n\n // array config: param name (param[]) overrides default settings. explicit config overrides param name.\n function getArrayMode() {\n let arrayDefaults = { array: (location === DefType.SEARCH ? \"auto\" : false) };\n let arrayParamNomenclature = id.match(/\\[\\]$/) ? { array: true } : {};\n return extend(arrayDefaults, arrayParamNomenclature, config).array;\n }\n\n extend(this, {id, type, location, isOptional, dynamic, raw, squash, replace, inherit, array: arrayMode, config });\n }\n\n isDefaultValue(value: any): boolean {\n return this.isOptional && this.type.equals(this.value(), value);\n }\n\n /**\n * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the\n * default value, which may be the result of an injectable function.\n */\n value(value?: any): any {\n /**\n * [Internal] Get the default value of a parameter, which may be an injectable function.\n */\n const getDefaultValue = () => {\n if (this._defaultValueCache) return this._defaultValueCache.defaultValue;\n\n if (!services.$injector) throw new Error(\"Injectable functions cannot be called at configuration time\");\n\n let defaultValue = services.$injector.invoke(this.config.$$fn);\n\n if (defaultValue !== null && defaultValue !== undefined && !this.type.is(defaultValue))\n throw new Error(`Default value (${defaultValue}) for parameter '${this.id}' is not an instance of ParamType (${this.type.name})`);\n\n if (this.config.$$fn['__cacheable']) {\n this._defaultValueCache = { defaultValue };\n }\n\n return defaultValue;\n };\n\n const replaceSpecialValues = (val: any) => {\n for (let tuple of this.replace) {\n if (tuple.from === val) return tuple.to;\n }\n return val;\n };\n\n value = replaceSpecialValues(value);\n\n return isUndefined(value) ? getDefaultValue() : this.type.$normalize(value);\n }\n\n isSearch(): boolean {\n return this.location === DefType.SEARCH;\n }\n\n validates(value: any): boolean {\n // There was no parameter value, but the param is optional\n if ((isUndefined(value) || value === null) && this.isOptional) return true;\n\n // The value was not of the correct ParamType, and could not be decoded to the correct ParamType\n const normalized = this.type.$normalize(value);\n if (!this.type.is(normalized)) return false;\n\n // The value was of the correct type, but when encoded, did not match the ParamType's regexp\n const encoded = this.type.encode(normalized);\n return !(isString(encoded) && !this.type.pattern.exec( encoded));\n }\n\n toString() {\n return `{Param:${this.id} ${this.type} squash: '${this.squash}' optional: ${this.isOptional}}`;\n }\n\n static values(params: Param[], values: RawParams = {}): RawParams {\n const paramValues = {} as RawParams;\n for (let param of params) {\n paramValues[param.id] = param.value(values[param.id]);\n }\n return paramValues;\n }\n\n /**\n * Finds [[Param]] objects which have different param values\n *\n * Filters a list of [[Param]] objects to only those whose parameter values differ in two param value objects\n *\n * @param params: The list of Param objects to filter\n * @param values1: The first set of parameter values\n * @param values2: the second set of parameter values\n *\n * @returns any Param objects whose values were different between values1 and values2\n */\n static changed(params: Param[], values1: RawParams = {}, values2: RawParams = {}): Param[] {\n return params.filter(param => !param.type.equals(values1[param.id], values2[param.id]));\n }\n\n /**\n * Checks if two param value objects are equal (for a set of [[Param]] objects)\n *\n * @param params The list of [[Param]] objects to check\n * @param values1 The first set of param values\n * @param values2 The second set of param values\n *\n * @returns true if the param values in values1 and values2 are equal\n */\n static equals(params: Param[], values1 = {}, values2 = {}): boolean {\n return Param.changed(params, values1, values2).length === 0;\n }\n\n /** Returns true if a the parameter values are valid, according to the Param definitions */\n static validates(params: Param[], values: RawParams = {}): boolean {\n return params.map(param => param.validates(values[param.id])).reduce(allTrueR, true);\n }\n}","/**\n * Functions that manipulate strings\n *\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_strings\n */ /** */\n\nimport { isString, isArray, isDefined, isNull, isPromise, isInjectable, isObject } from \"./predicates\";\nimport { Rejection } from \"../transition/rejectFactory\";\nimport { IInjectable, identity, Obj, tail, pushR } from \"./common\";\nimport { pattern, is, not, val, invoke } from \"./hof\";\nimport { Transition } from \"../transition/transition\";\nimport { Resolvable } from \"../resolve/resolvable\";\n\n/**\n * Returns a string shortened to a maximum length\n *\n * If the string is already less than the `max` length, return the string.\n * Else return the string, shortened to `max - 3` and append three dots (\"...\").\n *\n * @param max the maximum length of the string to return\n * @param str the input string\n */\nexport function maxLength(max: number, str: string) {\n if (str.length <= max) return str;\n return str.substr(0, max - 3) + \"...\";\n}\n\n/**\n * Returns a string, with spaces added to the end, up to a desired str length\n *\n * If the string is already longer than the desired length, return the string.\n * Else returns the string, with extra spaces on the end, such that it reaches `length` characters.\n *\n * @param length the desired length of the string to return\n * @param str the input string\n */\nexport function padString(length: number, str: string) {\n while (str.length < length) str += \" \";\n return str;\n}\n\nexport function kebobString(camelCase: string) {\n return camelCase\n .replace(/^([A-Z])/, $1 => $1.toLowerCase()) // replace first char\n .replace(/([A-Z])/g, $1 => \"-\" + $1.toLowerCase()); // replace rest\n}\n\nfunction _toJson(obj: Obj) {\n return JSON.stringify(obj);\n}\n\nfunction _fromJson(json: string) {\n return isString(json) ? JSON.parse(json) : json;\n}\n\n\nfunction promiseToString(p: Promise) {\n return `Promise(${JSON.stringify(p)})`;\n}\n\nexport function functionToString(fn: Function) {\n let fnStr = fnToString(fn);\n let namedFunctionMatch = fnStr.match(/^(function [^ ]+\\([^)]*\\))/);\n let toStr = namedFunctionMatch ? namedFunctionMatch[1] : fnStr;\n\n let fnName = fn['name'] || \"\";\n if (fnName && toStr.match(/function \\(/)) {\n return 'function ' + fnName + toStr.substr(9);\n }\n return toStr;\n}\n\nexport function fnToString(fn: IInjectable) {\n let _fn = isArray(fn) ? fn.slice(-1)[0] : fn;\n return _fn && _fn.toString() || \"undefined\";\n}\n\nlet stringifyPatternFn: (val: any) => string = null;\nlet stringifyPattern = function(value: any) {\n let isRejection = Rejection.isRejectionPromise;\n\n stringifyPatternFn = stringifyPatternFn || pattern([\n [not(isDefined), val(\"undefined\")],\n [isNull, val(\"null\")],\n [isPromise, val(\"[Promise]\")],\n [isRejection, (x: any) => x._transitionRejection.toString()],\n [is(Rejection), invoke(\"toString\")],\n [is(Transition), invoke(\"toString\")],\n [is(Resolvable), invoke(\"toString\")],\n [isInjectable, functionToString],\n [val(true), identity]\n ]);\n\n return stringifyPatternFn(value);\n};\n\nexport function stringify(o: any) {\n var seen: any[] = [];\n\n function format(val: any) {\n if (isObject(val)) {\n if (seen.indexOf(val) !== -1) return '[circular ref]';\n seen.push(val);\n }\n return stringifyPattern(val);\n }\n\n return JSON.stringify(o, (key, val) => format(val)).replace(/\\\\\"/g, '\"');\n}\n\n/** Returns a function that splits a string on a character or substring */\nexport const beforeAfterSubstr = (char: string) => (str: string): string[] => {\n if (!str) return [\"\", \"\"];\n let idx = str.indexOf(char);\n if (idx === -1) return [str, \"\"];\n return [str.substr(0, idx), str.substr(idx + 1)];\n};\n\nexport const hostRegex = new RegExp('^(?:[a-z]+:)?//[^/]+/');\nexport const stripFile = (str: string) => str.replace(/\\/[^/]*$/, '');\nexport const splitHash = beforeAfterSubstr(\"#\");\nexport const splitQuery = beforeAfterSubstr(\"?\");\nexport const splitEqual = beforeAfterSubstr(\"=\");\nexport const trimHashVal = (str: string) => str ? str.replace(/^#/, \"\") : \"\";\n\n/**\n * Splits on a delimiter, but returns the delimiters in the array\n *\n * #### Example:\n * ```js\n * var splitOnSlashes = splitOnDelim('/');\n * splitOnSlashes(\"/foo\"); // [\"/\", \"foo\"]\n * splitOnSlashes(\"/foo/\"); // [\"/\", \"foo\", \"/\"]\n * ```\n */\nexport function splitOnDelim(delim: string) {\n let re = new RegExp(\"(\" + delim + \")\", \"g\");\n return (str: string) =>\n str.split(re).filter(identity);\n};\n\n\n/**\n * Reduce fn that joins neighboring strings\n *\n * Given an array of strings, returns a new array\n * where all neighboring strings have been joined.\n *\n * #### Example:\n * ```js\n * let arr = [\"foo\", \"bar\", 1, \"baz\", \"\", \"qux\" ];\n * arr.reduce(joinNeighborsR, []) // [\"foobar\", 1, \"bazqux\" ]\n * ```\n */\nexport function joinNeighborsR(acc: any[], x: any) {\n if (isString(tail(acc)) && isString(x))\n return acc.slice(0, -1).concat(tail(acc)+ x);\n return pushR(acc, x);\n};\n\n","/** @module state */ /** for typedoc */\nimport {Obj, omit, noop, extend, inherit, values, applyPairs, tail, mapObj, identity} from \"../common/common\";\nimport {isDefined, isFunction, isString, isArray} from \"../common/predicates\";\nimport {stringify} from \"../common/strings\";\nimport {prop, pattern, is, pipe, val} from \"../common/hof\";\nimport {StateDeclaration} from \"./interface\";\n\nimport {StateObject} from \"./stateObject\";\nimport {StateMatcher} from \"./stateMatcher\";\nimport {Param} from \"../params/param\";\nimport {UrlMatcherFactory} from \"../url/urlMatcherFactory\";\nimport {UrlMatcher} from \"../url/urlMatcher\";\nimport {Resolvable} from \"../resolve/resolvable\";\nimport {services} from \"../common/coreservices\";\nimport {ResolvePolicy} from \"../resolve/interface\";\nimport { ParamFactory } from \"../url/interface\";\n\nconst parseUrl = (url: string): any => {\n if (!isString(url)) return false;\n let root = url.charAt(0) === '^';\n return { val: root ? url.substring(1) : url, root };\n};\n\nexport type BuilderFunction = (state: StateObject, parent?: BuilderFunction) => any;\n\ninterface Builders {\n [key: string]: BuilderFunction[];\n\n name: BuilderFunction[];\n parent: BuilderFunction[];\n data: BuilderFunction[];\n url: BuilderFunction[];\n navigable: BuilderFunction[];\n params: BuilderFunction[];\n views: BuilderFunction[];\n path: BuilderFunction[];\n includes: BuilderFunction[];\n resolvables: BuilderFunction[];\n}\n\n\nfunction nameBuilder(state: StateObject) {\n return state.name;\n}\n\nfunction selfBuilder(state: StateObject) {\n state.self.$$state = () => state;\n return state.self;\n}\n\nfunction dataBuilder(state: StateObject) {\n if (state.parent && state.parent.data) {\n state.data = state.self.data = inherit(state.parent.data, state.data);\n }\n return state.data;\n}\n\nconst getUrlBuilder = ($urlMatcherFactoryProvider: UrlMatcherFactory, root: () => StateObject) =>\nfunction urlBuilder(state: StateObject) {\n let stateDec: StateDeclaration = state;\n\n // For future states, i.e., states whose name ends with `.**`,\n // match anything that starts with the url prefix\n if (stateDec && stateDec.url && stateDec.name && stateDec.name.match(/\\.\\*\\*$/)) {\n stateDec.url += \"{remainder:any}\"; // match any path (.*)\n }\n\n const parsed = parseUrl(stateDec.url), parent = state.parent;\n const url = !parsed ? stateDec.url : $urlMatcherFactoryProvider.compile(parsed.val, {\n params: state.params || {},\n paramMap: function (paramConfig: any, isSearch: boolean) {\n if (stateDec.reloadOnSearch === false && isSearch) paramConfig = extend(paramConfig || {}, {dynamic: true});\n return paramConfig;\n }\n });\n\n if (!url) return null;\n if (!$urlMatcherFactoryProvider.isMatcher(url)) throw new Error(`Invalid url '${url}' in state '${state}'`);\n return (parsed && parsed.root) ? url : ((parent && parent.navigable) || root()).url.append( url);\n};\n\nconst getNavigableBuilder = (isRoot: (state: StateObject) => boolean) =>\nfunction navigableBuilder(state: StateObject) {\n return !isRoot(state) && state.url ? state : (state.parent ? state.parent.navigable : null);\n};\n\nconst getParamsBuilder = (paramFactory: ParamFactory) =>\nfunction paramsBuilder(state: StateObject): { [key: string]: Param } {\n const makeConfigParam = (config: any, id: string) => paramFactory.fromConfig(id, null, config);\n let urlParams: Param[] = (state.url && state.url.parameters({inherit: false})) || [];\n let nonUrlParams: Param[] = values(mapObj(omit(state.params || {}, urlParams.map(prop('id'))), makeConfigParam));\n return urlParams.concat(nonUrlParams).map(p => [p.id, p]).reduce(applyPairs, {});\n};\n\nfunction pathBuilder(state: StateObject) {\n return state.parent ? state.parent.path.concat(state) : /*root*/ [state];\n}\n\nfunction includesBuilder(state: StateObject) {\n let includes = state.parent ? extend({}, state.parent.includes) : {};\n includes[state.name] = true;\n return includes;\n}\n\n/**\n * This is a [[StateBuilder.builder]] function for the `resolve:` block on a [[StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * validates the `resolve` property and converts it to a [[Resolvable]] array.\n *\n * resolve: input value can be:\n *\n * {\n * // analyzed but not injected\n * myFooResolve: function() { return \"myFooData\"; },\n *\n * // function.toString() parsed, \"DependencyName\" dep as string (not min-safe)\n * myBarResolve: function(DependencyName) { return DependencyName.fetchSomethingAsPromise() },\n *\n * // Array split; \"DependencyName\" dep as string\n * myBazResolve: [ \"DependencyName\", function(dep) { return dep.fetchSomethingAsPromise() },\n *\n * // Array split; DependencyType dep as token (compared using ===)\n * myQuxResolve: [ DependencyType, function(dep) { return dep.fetchSometingAsPromise() },\n *\n * // val.$inject used as deps\n * // where:\n * // corgeResolve.$inject = [\"DependencyName\"];\n * // function corgeResolve(dep) { dep.fetchSometingAsPromise() }\n * // then \"DependencyName\" dep as string\n * myCorgeResolve: corgeResolve,\n *\n * // inject service by name\n * // When a string is found, desugar creating a resolve that injects the named service\n * myGraultResolve: \"SomeService\"\n * }\n *\n * or:\n *\n * [\n * new Resolvable(\"myFooResolve\", function() { return \"myFooData\" }),\n * new Resolvable(\"myBarResolve\", function(dep) { return dep.fetchSomethingAsPromise() }, [ \"DependencyName\" ]),\n * { provide: \"myBazResolve\", useFactory: function(dep) { dep.fetchSomethingAsPromise() }, deps: [ \"DependencyName\" ] }\n * ]\n */\nexport function resolvablesBuilder(state: StateObject): Resolvable[] {\n interface Tuple { token: any, val: any, deps: any[], policy: ResolvePolicy }\n \n /** convert resolve: {} and resolvePolicy: {} objects to an array of tuples */\n const objects2Tuples = (resolveObj: Obj, resolvePolicies: { [key: string]: ResolvePolicy }) =>\n Object.keys(resolveObj || {}).map(token => ({token, val: resolveObj[token], deps: undefined, policy: resolvePolicies[token]}));\n\n /** fetch DI annotations from a function or ng1-style array */\n const annotate = (fn: Function) => {\n let $injector = services.$injector;\n // ng1 doesn't have an $injector until runtime.\n // If the $injector doesn't exist, use \"deferred\" literal as a\n // marker indicating they should be annotated when runtime starts\n return fn['$inject'] || ($injector && $injector.annotate(fn, $injector.strictDi)) || \"deferred\";\n };\n\n /** true if the object has both `token` and `resolveFn`, and is probably a [[ResolveLiteral]] */\n const isResolveLiteral = (obj: any) => !!(obj.token && obj.resolveFn);\n\n /** true if the object looks like a provide literal, or a ng2 Provider */\n const isLikeNg2Provider = (obj: any) => !!((obj.provide || obj.token) && (obj.useValue || obj.useFactory || obj.useExisting || obj.useClass));\n\n /** true if the object looks like a tuple from obj2Tuples */\n const isTupleFromObj = (obj: any) => !!(obj && obj.val && (isString(obj.val) || isArray(obj.val) || isFunction(obj.val)));\n\n /** extracts the token from a Provider or provide literal */\n const token = (p: any) => p.provide || p.token;\n\n /** Given a literal resolve or provider object, returns a Resolvable */\n const literal2Resolvable = pattern([\n [prop('resolveFn'), p => new Resolvable(token(p), p.resolveFn, p.deps, p.policy)],\n [prop('useFactory'), p => new Resolvable(token(p), p.useFactory, (p.deps || p.dependencies), p.policy)],\n [prop('useClass'), p => new Resolvable(token(p), () => new (p.useClass)(), [], p.policy)],\n [prop('useValue'), p => new Resolvable(token(p), () => p.useValue, [], p.policy, p.useValue)],\n [prop('useExisting'), p => new Resolvable(token(p), identity, [p.useExisting], p.policy)],\n ]);\n\n const tuple2Resolvable = pattern([\n [pipe(prop(\"val\"), isString), (tuple: Tuple) => new Resolvable(tuple.token, identity, [ tuple.val ], tuple.policy)],\n [pipe(prop(\"val\"), isArray), (tuple: Tuple) => new Resolvable(tuple.token, tail( tuple.val), tuple.val.slice(0, -1), tuple.policy)],\n [pipe(prop(\"val\"), isFunction), (tuple: Tuple) => new Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy)],\n ]);\n\n const item2Resolvable = <(obj: any) => Resolvable> pattern([\n [is(Resolvable), (r: Resolvable) => r],\n [isResolveLiteral, literal2Resolvable],\n [isLikeNg2Provider, literal2Resolvable],\n [isTupleFromObj, tuple2Resolvable],\n [val(true), (obj: any) => { throw new Error(\"Invalid resolve value: \" + stringify(obj)) }]\n ]);\n\n // If resolveBlock is already an array, use it as-is.\n // Otherwise, assume it's an object and convert to an Array of tuples\n let decl = state.resolve;\n let items: any[] = isArray(decl) ? decl : objects2Tuples(decl, state.resolvePolicy || {});\n return items.map(item2Resolvable);\n}\n\n/**\n * @internalapi A internal global service\n *\n * StateBuilder is a factory for the internal [[StateObject]] objects.\n *\n * When you register a state with the [[StateRegistry]], you register a plain old javascript object which\n * conforms to the [[StateDeclaration]] interface. This factory takes that object and builds the corresponding\n * [[StateObject]] object, which has an API and is used internally.\n *\n * Custom properties or API may be added to the internal [[StateObject]] object by registering a decorator function\n * using the [[builder]] method.\n */\nexport class StateBuilder {\n /** An object that contains all the BuilderFunctions registered, key'd by the name of the State property they build */\n private builders: Builders;\n\n constructor(private matcher: StateMatcher, urlMatcherFactory: UrlMatcherFactory) {\n let self = this;\n\n const root = () => matcher.find(\"\");\n const isRoot = (state: StateObject) => state.name === \"\";\n\n function parentBuilder(state: StateObject) {\n if (isRoot(state)) return null;\n return matcher.find(self.parentName(state)) || root();\n }\n\n this.builders = {\n name: [ nameBuilder ],\n self: [ selfBuilder ],\n parent: [ parentBuilder ],\n data: [ dataBuilder ],\n // Build a URLMatcher if necessary, either via a relative or absolute URL\n url: [ getUrlBuilder(urlMatcherFactory, root) ],\n // Keep track of the closest ancestor state that has a URL (i.e. is navigable)\n navigable: [ getNavigableBuilder(isRoot) ],\n params: [ getParamsBuilder(urlMatcherFactory.paramFactory) ],\n // Each framework-specific ui-router implementation should define its own `views` builder\n // e.g., src/ng1/statebuilders/views.ts\n views: [],\n // Keep a full path from the root down to this state as this is needed for state activation.\n path: [ pathBuilder ],\n // Speed up $state.includes() as it's used a lot\n includes: [ includesBuilder ],\n resolvables: [ resolvablesBuilder ]\n };\n }\n\n /**\n * Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`).\n * More than one BuilderFunction can be registered for a given property.\n *\n * The BuilderFunction(s) will be used to define the property on any subsequently built [[StateObject]] objects.\n *\n * @param name The name of the State property being registered for.\n * @param fn The BuilderFunction which will be used to build the State property\n * @returns a function which deregisters the BuilderFunction\n */\n builder(name: string, fn: BuilderFunction): (BuilderFunction|BuilderFunction[]|Function) {\n let builders = this.builders;\n let array = builders[name] || [];\n // Backwards compat: if only one builder exists, return it, else return whole arary.\n if (isString(name) && !isDefined(fn)) return array.length > 1 ? array : array[0];\n if (!isString(name) || !isFunction(fn)) return;\n\n builders[name] = array;\n builders[name].push(fn);\n return () => builders[name].splice(builders[name].indexOf(fn, 1)) && null;\n }\n\n /**\n * Builds all of the properties on an essentially blank State object, returning a State object which has all its\n * properties and API built.\n *\n * @param state an uninitialized State object\n * @returns the built State object\n */\n build(state: StateObject): StateObject {\n let {matcher, builders} = this;\n let parent = this.parentName(state);\n\n if (parent && !matcher.find(parent, undefined, false)) {\n return null;\n }\n\n for (let key in builders) {\n if (!builders.hasOwnProperty(key)) continue;\n let chain = builders[key].reduce((parentFn: BuilderFunction, step: BuilderFunction) => (_state) => step(_state, parentFn), noop);\n state[key] = chain(state);\n }\n return state;\n }\n\n parentName(state: StateObject) {\n // name = 'foo.bar.baz.**'\n let name = state.name || \"\";\n // segments = ['foo', 'bar', 'baz', '.**']\n let segments = name.split('.');\n // segments = ['foo', 'bar', 'baz']\n let lastSegment = segments.pop();\n // segments = ['foo', 'bar'] (ignore .** segment for future states)\n if (lastSegment === '**') segments.pop();\n\n if (segments.length) {\n if (state.parent) {\n throw new Error(`States that specify the 'parent:' property should not have a '.' in their name (${name})`);\n }\n\n // 'foo.bar'\n return segments.join(\".\");\n }\n\n if (!state.parent) return \"\";\n return isString(state.parent) ? state.parent : state.parent.name;\n }\n\n name(state: StateObject) {\n let name = state.name;\n if (name.indexOf('.') !== -1 || !state.parent) return name;\n\n let parentName = isString(state.parent) ? state.parent : state.parent.name;\n return parentName ? parentName + \".\" + name : name;\n }\n}\n","/**\n * @coreapi\n * @module url\n */\n/** for typedoc */\nimport {\n map, defaults, inherit, identity, unnest, tail, find, Obj, pairs, allTrueR, unnestR, arrayTuples\n} from \"../common/common\";\nimport { prop, propEq } from \"../common/hof\";\nimport { isArray, isString, isDefined } from \"../common/predicates\";\nimport { Param, DefType } from \"../params/param\";\nimport { ParamTypes } from \"../params/paramTypes\";\nimport { RawParams } from \"../params/interface\";\nimport { ParamFactory } from \"./interface\";\nimport { joinNeighborsR, splitOnDelim } from \"../common/strings\";\n\n/** @hidden */\nfunction quoteRegExp(string: any, param?: any) {\n let surroundPattern = ['', ''], result = string.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, \"\\\\$&\");\n if (!param) return result;\n\n switch (param.squash) {\n case false:\n surroundPattern = ['(', ')' + (param.isOptional ? '?' : '')]; break;\n case true:\n result = result.replace(/\\/$/, '');\n surroundPattern = ['(?:\\/(', ')|\\/)?'];\n break;\n default:\n surroundPattern = [`(${param.squash}|`, ')?']; break;\n }\n return result + surroundPattern[0] + param.type.pattern.source + surroundPattern[1];\n}\n\n/** @hidden */\nconst memoizeTo = (obj: Obj, prop: string, fn: Function) =>\n obj[prop] = obj[prop] || fn();\n\n/** @hidden */\nconst splitOnSlash = splitOnDelim('/');\n\n/** @hidden */\ninterface UrlMatcherCache {\n segments?: any[];\n weights?: number[];\n path?: UrlMatcher[];\n parent?: UrlMatcher;\n pattern?: RegExp;\n}\n\n/**\n * Matches URLs against patterns.\n *\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL.\n *\n * A URL pattern consists of a path pattern, optionally followed by '?' and a list of search (query)\n * parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by [[UrlMatcher.exec]].\n *\n * - *Path parameters* are defined using curly brace placeholders (`/somepath/{param}`)\n * or colon placeholders (`/somePath/:param`).\n *\n * - *A parameter RegExp* may be defined for a param after a colon\n * (`/somePath/{param:[a-zA-Z0-9]+}`) in a curly brace placeholder.\n * The regexp must match for the url to be matched.\n * Should the regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Note: a RegExp parameter will encode its value using either [[ParamTypes.path]] or [[ParamTypes.query]].\n *\n * - *Custom parameter types* may also be specified after a colon (`/somePath/{param:int}`) in curly brace parameters.\n * See [[UrlMatcherFactory.type]] for more information.\n *\n * - *Catch-all parameters* are defined using an asterisk placeholder (`/somepath/*catchallparam`).\n * A catch-all * parameter value will contain the remainder of the URL.\n *\n * ---\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters).\n * A path parameter matches any number of characters other than '/'. For catch-all\n * placeholders the path parameter matches any number of characters.\n *\n * Examples:\n *\n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n * trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n * '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n * parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n * path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n * * `'/calendar/{start:date}'` - Matches \"/calendar/2014-11-12\" (because the pattern defined\n * in the built-in `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start\n *\n */\nexport class UrlMatcher {\n /** @hidden */\n static nameValidator: RegExp = /^\\w+([-.]+\\w+)*(?:\\[\\])?$/;\n\n /** @hidden */\n private _cache: UrlMatcherCache = { path: [this] };\n /** @hidden */\n private _children: UrlMatcher[] = [];\n /** @hidden */\n private _params: Param[] = [];\n /** @hidden */\n private _segments: string[] = [];\n /** @hidden */\n private _compiled: string[] = [];\n\n /** The pattern that was passed into the constructor */\n public pattern: string;\n\n /**\n * @param pattern The pattern to compile into a matcher.\n * @param paramTypes The [[ParamTypes]] registry\n * @param config A configuration object\n * - `caseInsensitive` - `true` if URL matching should be case insensitive, otherwise `false`, the default value (for backward compatibility) is `false`.\n * - `strict` - `false` if matching against a URL with a trailing slash should be treated as equivalent to a URL without a trailing slash, the default value is `true`.\n */\n constructor(pattern: string, paramTypes: ParamTypes, paramFactory: ParamFactory, public config?: any) {\n this.pattern = pattern;\n this.config = defaults(this.config, {\n params: {},\n strict: true,\n caseInsensitive: false,\n paramMap: identity\n });\n\n // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n // '*' name\n // ':' name\n // '{' name '}'\n // '{' name ':' regexp '}'\n // The regular expression is somewhat complicated due to the need to allow curly braces\n // inside the regular expression. The placeholder regexp breaks down as follows:\n // ([:*])([\\w\\[\\]]+) - classic placeholder ($1 / $2) (search version has - for snake-case)\n // \\{([\\w\\[\\]]+)(?:\\:\\s*( ... ))?\\} - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case\n // (?: ... | ... | ... )+ - the regexp consists of any number of atoms, an atom being either\n // [^{}\\\\]+ - anything other than curly braces or backslash\n // \\\\. - a backslash escape\n // \\{(?:[^{}\\\\]+|\\\\.)*\\} - a matched set of curly braces containing other atoms\n let placeholder = /([:*])([\\w\\[\\]]+)|\\{([\\w\\[\\]]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n searchPlaceholder = /([:]?)([\\w\\[\\].-]+)|\\{([\\w\\[\\].-]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n last = 0, m: RegExpExecArray, patterns: any[][] = [];\n\n const checkParamErrors = (id: string) => {\n if (!UrlMatcher.nameValidator.test(id)) throw new Error(`Invalid parameter name '${id}' in pattern '${pattern}'`);\n if (find(this._params, propEq('id', id))) throw new Error(`Duplicate parameter name '${id}' in pattern '${pattern}'`);\n };\n\n // Split into static segments separated by path parameter placeholders.\n // The number of segments is always 1 more than the number of parameters.\n const matchDetails = (m: RegExpExecArray, isSearch: boolean) => {\n // IE[78] returns '' for unmatched groups instead of null\n let id = m[2] || m[3];\n let regexp = isSearch ? m[4] : m[4] || (m[1] === '*' ? '[\\\\s\\\\S]*' : null);\n\n const makeRegexpType = (regexp) => inherit(paramTypes.type(isSearch ? \"query\" : \"path\"), {\n pattern: new RegExp(regexp, this.config.caseInsensitive ? 'i' : undefined)\n });\n\n return {\n id,\n regexp,\n cfg: this.config.params[id],\n segment: pattern.substring(last, m.index),\n type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp)\n };\n };\n\n let p: any, segment: string;\n\n while ((m = placeholder.exec(pattern))) {\n p = matchDetails(m, false);\n if (p.segment.indexOf('?') >= 0) break; // we're into the search part\n\n checkParamErrors(p.id);\n this._params.push(paramFactory.fromPath(p.id, p.type, this.config.paramMap(p.cfg, false)));\n this._segments.push(p.segment);\n patterns.push([p.segment, tail(this._params)]);\n last = placeholder.lastIndex;\n }\n segment = pattern.substring(last);\n\n // Find any search parameter names and remove them from the last segment\n let i = segment.indexOf('?');\n\n if (i >= 0) {\n let search = segment.substring(i);\n segment = segment.substring(0, i);\n\n if (search.length > 0) {\n last = 0;\n\n while ((m = searchPlaceholder.exec(search))) {\n p = matchDetails(m, true);\n checkParamErrors(p.id);\n this._params.push(paramFactory.fromSearch(p.id, p.type, this.config.paramMap(p.cfg, true)));\n last = placeholder.lastIndex;\n // check if ?&\n }\n }\n }\n\n this._segments.push(segment);\n this._compiled = patterns.map(pattern => quoteRegExp.apply(null, pattern)).concat(quoteRegExp(segment));\n }\n\n /**\n * Creates a new concatenated UrlMatcher\n *\n * Builds a new UrlMatcher by appending another UrlMatcher to this one.\n *\n * @param url A `UrlMatcher` instance to append as a child of the current `UrlMatcher`.\n */\n append(url: UrlMatcher): UrlMatcher {\n this._children.push(url);\n url._cache = {\n path: this._cache.path.concat(url),\n parent: this,\n pattern: null,\n };\n return url;\n }\n\n /** @hidden */\n isRoot(): boolean {\n return this._cache.path[0] === this;\n }\n\n /** Returns the input pattern string */\n toString(): string {\n return this.pattern;\n }\n\n /**\n * Tests the specified url/path against this matcher.\n *\n * Tests if the given url matches this matcher's pattern, and returns an object containing the captured\n * parameter values. Returns null if the path does not match.\n *\n * The returned object contains the values\n * of any search parameters that are mentioned in the pattern, but their value may be null if\n * they are not present in `search`. This means that search parameters are always treated\n * as optional.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', {\n * x: '1', q: 'hello'\n * });\n * // returns { id: 'bob', q: 'hello', r: null }\n * ```\n *\n * @param path The URL path to match, e.g. `$location.path()`.\n * @param search URL search parameters, e.g. `$location.search()`.\n * @param hash URL hash e.g. `$location.hash()`.\n * @param options\n *\n * @returns The captured parameter values.\n */\n exec(path: string, search: any = {}, hash?: string, options: any = {}): RawParams {\n let match = memoizeTo(this._cache, 'pattern', () => {\n return new RegExp([\n '^',\n unnest(this._cache.path.map(prop('_compiled'))).join(''),\n this.config.strict === false ? '\\/?' : '',\n '$'\n ].join(''), this.config.caseInsensitive ? 'i' : undefined);\n }).exec(path);\n\n if (!match) return null;\n\n //options = defaults(options, { isolate: false });\n\n let allParams: Param[] = this.parameters(),\n pathParams: Param[] = allParams.filter(param => !param.isSearch()),\n searchParams: Param[] = allParams.filter(param => param.isSearch()),\n nPathSegments = this._cache.path.map(urlm => urlm._segments.length - 1).reduce((a, x) => a + x),\n values: RawParams = {};\n\n if (nPathSegments !== match.length - 1)\n throw new Error(`Unbalanced capture group in route '${this.pattern}'`);\n\n function decodePathArray(string: string) {\n const reverseString = (str: string) => str.split(\"\").reverse().join(\"\");\n const unquoteDashes = (str: string) => str.replace(/\\\\-/g, \"-\");\n\n let split = reverseString(string).split(/-(?!\\\\)/);\n let allReversed = map(split, reverseString);\n return map(allReversed, unquoteDashes).reverse();\n }\n\n for (let i = 0; i < nPathSegments; i++) {\n let param: Param = pathParams[i];\n let value: (any|any[]) = match[i + 1];\n\n // if the param value matches a pre-replace pair, replace the value before decoding.\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n if (value && param.array === true) value = decodePathArray(value);\n if (isDefined(value)) value = param.type.decode(value);\n values[param.id] = param.value(value);\n }\n searchParams.forEach(param => {\n let value = search[param.id];\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n if (isDefined(value)) value = param.type.decode(value);\n values[param.id] = param.value(value);\n });\n\n if (hash) values[\"#\"] = hash;\n\n return values;\n }\n\n /**\n * @hidden\n * Returns all the [[Param]] objects of all path and search parameters of this pattern in order of appearance.\n *\n * @returns {Array.} An array of [[Param]] objects. Must be treated as read-only. If the\n * pattern has no parameters, an empty array is returned.\n */\n parameters(opts: any = {}): Param[] {\n if (opts.inherit === false) return this._params;\n return unnest(this._cache.path.map(matcher => matcher._params));\n }\n\n /**\n * @hidden\n * Returns a single parameter from this UrlMatcher by id\n *\n * @param id\n * @param opts\n * @returns {T|Param|any|boolean|UrlMatcher|null}\n */\n parameter(id: string, opts: any = {}): Param {\n const findParam = () => {\n for (let param of this._params) {\n if (param.id === id) return param;\n }\n };\n\n let parent = this._cache.parent;\n return findParam() || (opts.inherit !== false && parent && parent.parameter(id, opts)) || null;\n }\n\n /**\n * Validates the input parameter values against this UrlMatcher\n *\n * Checks an object hash of parameters to validate their correctness according to the parameter\n * types of this `UrlMatcher`.\n *\n * @param params The object hash of parameters to validate.\n * @returns Returns `true` if `params` validates, otherwise `false`.\n */\n validates(params: RawParams): boolean {\n const validParamVal = (param: Param, val: any) =>\n !param || param.validates(val);\n\n params = params || {};\n\n // I'm not sure why this checks only the param keys passed in, and not all the params known to the matcher\n let paramSchema = this.parameters().filter(paramDef => params.hasOwnProperty(paramDef.id));\n return paramSchema.map(paramDef => validParamVal(paramDef, params[paramDef.id])).reduce(allTrueR, true);\n }\n\n /**\n * Given a set of parameter values, creates a URL from this UrlMatcher.\n *\n * Creates a URL that matches this pattern by substituting the specified values\n * for the path and search parameters.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n * // returns '/user/bob?q=yes'\n * ```\n *\n * @param values the values to substitute for the parameters in this pattern.\n * @returns the formatted URL (path and optionally search part).\n */\n format(values: RawParams = {}) {\n // Build the full path of UrlMatchers (including all parent UrlMatchers)\n let urlMatchers = this._cache.path;\n\n // Extract all the static segments and Params (processed as ParamDetails)\n // into an ordered array\n let pathSegmentsAndParams: Array = urlMatchers.map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .map(x => isString(x) ? x : getDetails(x));\n\n // Extract the query params into a separate array\n let queryParams: Array = urlMatchers.map(UrlMatcher.queryParams)\n .reduce(unnestR, [])\n .map(getDetails);\n\n const isInvalid = (param: ParamDetails) => param.isValid === false;\n if (pathSegmentsAndParams.concat(queryParams).filter(isInvalid).length) {\n return null;\n }\n\n /**\n * Given a Param, applies the parameter value, then returns detailed information about it\n */\n function getDetails(param: Param): ParamDetails {\n // Normalize to typed value\n let value = param.value(values[param.id]);\n let isValid = param.validates(value);\n let isDefaultValue = param.isDefaultValue(value);\n // Check if we're in squash mode for the parameter\n let squash = isDefaultValue ? param.squash : false;\n // Allow the Parameter's Type to encode the value\n let encoded = param.type.encode(value);\n\n return { param, value, isValid, isDefaultValue, squash, encoded };\n }\n\n // Build up the path-portion from the list of static segments and parameters\n let pathString = pathSegmentsAndParams.reduce((acc: string, x: string|ParamDetails) => {\n // The element is a static segment (a raw string); just append it\n if (isString(x)) return acc + x;\n\n // Otherwise, it's a ParamDetails.\n let { squash, encoded, param } = x;\n\n // If squash is === true, try to remove a slash from the path\n if (squash === true) return (acc.match(/\\/$/)) ? acc.slice(0, -1) : acc;\n // If squash is a string, use the string for the param value\n if (isString(squash)) return acc + squash;\n if (squash !== false) return acc; // ?\n if (encoded == null) return acc;\n // If this parameter value is an array, encode the value using encodeDashes\n if (isArray(encoded)) return acc + map( encoded, UrlMatcher.encodeDashes).join(\"-\");\n // If the parameter type is \"raw\", then do not encodeURIComponent\n if (param.raw) return acc + encoded;\n // Encode the value\n return acc + encodeURIComponent( encoded);\n }, \"\");\n\n // Build the query string by applying parameter values (array or regular)\n // then mapping to key=value, then flattening and joining using \"&\"\n let queryString = queryParams.map((paramDetails: ParamDetails) => {\n let { param, squash, encoded, isDefaultValue } = paramDetails;\n if (encoded == null || (isDefaultValue && squash !== false)) return;\n if (!isArray(encoded)) encoded = [ encoded];\n if (encoded.length === 0) return;\n if (!param.raw) encoded = map( encoded, encodeURIComponent);\n\n return ( encoded).map(val => `${param.id}=${val}`);\n }).filter(identity).reduce(unnestR, []).join(\"&\");\n\n // Concat the pathstring with the queryString (if exists) and the hashString (if exists)\n return pathString + (queryString ? `?${queryString}` : \"\") + (values[\"#\"] ? \"#\" + values[\"#\"] : \"\");\n }\n\n /** @hidden */\n static encodeDashes(str: string) { // Replace dashes with encoded \"\\-\"\n return encodeURIComponent(str).replace(/-/g, c => `%5C%${c.charCodeAt(0).toString(16).toUpperCase()}`);\n }\n\n /** @hidden Given a matcher, return an array with the matcher's path segments and path params, in order */\n static pathSegmentsAndParams(matcher: UrlMatcher) {\n let staticSegments = matcher._segments;\n let pathParams = matcher._params.filter(p => p.location === DefType.PATH);\n return arrayTuples(staticSegments, pathParams.concat(undefined))\n .reduce(unnestR, [])\n .filter(x => x !== \"\" && isDefined(x));\n }\n\n /** @hidden Given a matcher, return an array with the matcher's query params */\n static queryParams(matcher: UrlMatcher): Param[] {\n return matcher._params.filter(p => p.location === DefType.SEARCH);\n }\n\n /**\n * Compare two UrlMatchers\n *\n * This comparison function converts a UrlMatcher into static and dynamic path segments.\n * Each static path segment is a static string between a path separator (slash character).\n * Each dynamic segment is a path parameter.\n *\n * The comparison function sorts static segments before dynamic ones.\n */\n static compare(a: UrlMatcher, b: UrlMatcher): number {\n /**\n * Turn a UrlMatcher and all its parent matchers into an array\n * of slash literals '/', string literals, and Param objects\n *\n * This example matcher matches strings like \"/foo/:param/tail\":\n * var matcher = $umf.compile(\"/foo\").append($umf.compile(\"/:param\")).append($umf.compile(\"/\")).append($umf.compile(\"tail\"));\n * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ]\n *\n * Caches the result as `matcher._cache.segments`\n */\n const segments = (matcher: UrlMatcher) =>\n matcher._cache.segments = matcher._cache.segments ||\n matcher._cache.path.map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .reduce(joinNeighborsR, [])\n .map(x => isString(x) ? splitOnSlash(x) : x)\n .reduce(unnestR, []);\n\n /**\n * Gets the sort weight for each segment of a UrlMatcher\n *\n * Caches the result as `matcher._cache.weights`\n */\n const weights = (matcher: UrlMatcher) =>\n matcher._cache.weights = matcher._cache.weights ||\n segments(matcher).map(segment => {\n // Sort slashes first, then static strings, the Params\n if (segment === '/') return 1;\n if (isString(segment)) return 2;\n if (segment instanceof Param) return 3;\n });\n\n /**\n * Pads shorter array in-place (mutates)\n */\n const padArrays = (l: any[], r: any[], padVal: any) => {\n const len = Math.max(l.length, r.length);\n while (l.length < len) l.push(padVal);\n while (r.length < len) r.push(padVal);\n };\n\n const weightsA = weights(a), weightsB = weights(b);\n padArrays(weightsA, weightsB, 0);\n let cmp, i, pairs = arrayTuples(weightsA, weightsB);\n\n for (i = 0; i < pairs.length; i++) {\n cmp = pairs[i][0] - pairs[i][1];\n if (cmp !== 0) return cmp;\n }\n\n return 0;\n }\n}\n\n/** @hidden */\ninterface ParamDetails {\n param: Param;\n value: any;\n isValid: boolean;\n isDefaultValue: boolean;\n squash: (boolean|string);\n encoded: (string|string[]);\n}\n","/**\n * @internalapi\n * @module url\n */\n/** for typedoc */\nimport { createProxyFunctions, extend, removeFrom } from '../common/common';\nimport { isDefined, isFunction, isString } from '../common/predicates';\nimport { UrlMatcher } from './urlMatcher';\nimport { RawParams } from '../params/interface';\nimport { Disposable } from '../interface';\nimport { UIRouter } from '../router';\nimport { is, pattern, val } from '../common/hof';\nimport { UrlRuleFactory } from './urlRule';\nimport { TargetState } from '../state/targetState';\nimport { MatcherUrlRule, MatchResult, UrlParts, UrlRule, UrlRuleHandlerFn, UrlRuleMatchFn, UrlRulesApi, UrlSyncApi, } from './interface';\nimport { TargetStateDef } from '../state/interface';\nimport { stripFile } from '../common';\n\n/** @hidden */\nfunction appendBasePath(url: string, isHtml5: boolean, absolute: boolean, baseHref: string): string {\n if (baseHref === '/') return url;\n if (isHtml5) return stripFile(baseHref) + url;\n if (absolute) return baseHref.slice(1) + url;\n return url;\n}\n\n/** @hidden */\nconst prioritySort = (a: UrlRule, b: UrlRule) =>\n (b.priority || 0) - (a.priority || 0);\n\n/** @hidden */\nconst typeSort = (a: UrlRule, b: UrlRule) => {\n const weights = { \"STATE\": 4, \"URLMATCHER\": 4, \"REGEXP\": 3, \"RAW\": 2, \"OTHER\": 1 };\n return (weights[a.type] || 0) - (weights[b.type] || 0);\n};\n\n/** @hidden */\nconst urlMatcherSort = (a: MatcherUrlRule, b: MatcherUrlRule) =>\n !a.urlMatcher || !b.urlMatcher ? 0 : UrlMatcher.compare(a.urlMatcher, b.urlMatcher);\n\n/** @hidden */\nconst idSort = (a: UrlRule, b: UrlRule) => {\n // Identically sorted STATE and URLMATCHER best rule will be chosen by `matchPriority` after each rule matches the URL\n const useMatchPriority = { STATE: true, URLMATCHER: true };\n const equal = useMatchPriority[a.type] && useMatchPriority[b.type];\n return equal ? 0 : (a.$id || 0) - (b.$id || 0);\n};\n\n/**\n * Default rule priority sorting function.\n *\n * Sorts rules by:\n *\n * - Explicit priority (set rule priority using [[UrlRulesApi.when]])\n * - Rule type (STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1)\n * - `UrlMatcher` specificity ([[UrlMatcher.compare]]): works for STATE and URLMATCHER types to pick the most specific rule.\n * - Rule registration order (for rule types other than STATE and URLMATCHER)\n * - Equally sorted State and UrlMatcher rules will each match the URL.\n * Then, the *best* match is chosen based on how many parameter values were matched.\n *\n * @coreapi\n */\nlet defaultRuleSortFn: (a: UrlRule, b: UrlRule) => number;\ndefaultRuleSortFn = (a, b) => {\n let cmp = prioritySort(a, b);\n if (cmp !== 0) return cmp;\n\n cmp = typeSort(a, b);\n if (cmp !== 0) return cmp;\n\n cmp = urlMatcherSort(a as MatcherUrlRule, b as MatcherUrlRule);\n if (cmp !== 0) return cmp;\n\n return idSort(a, b);\n};\n\n/**\n * Updates URL and responds to URL changes\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class updates the URL when the state changes.\n * It also responds to changes in the URL.\n */\nexport class UrlRouter implements UrlRulesApi, UrlSyncApi, Disposable {\n /** used to create [[UrlRule]] objects for common cases */\n public urlRuleFactory: UrlRuleFactory;\n\n /** @hidden */ private _router: UIRouter;\n /** @hidden */ private location: string;\n /** @hidden */ private _sortFn = defaultRuleSortFn;\n /** @hidden */ private _stopFn: Function;\n /** @hidden */ _rules: UrlRule[] = [];\n /** @hidden */ private _otherwiseFn: UrlRule;\n /** @hidden */ interceptDeferred = false;\n /** @hidden */ private _id = 0;\n /** @hidden */ private _sorted = false;\n\n /** @hidden */\n constructor(router: UIRouter) {\n this._router = router;\n this.urlRuleFactory = new UrlRuleFactory(router);\n createProxyFunctions(val(UrlRouter.prototype), this, val(this));\n }\n\n /** @internalapi */\n dispose() {\n this.listen(false);\n this._rules = [];\n delete this._otherwiseFn;\n }\n\n /** @inheritdoc */\n sort(compareFn?: (a: UrlRule, b: UrlRule) => number) {\n this._rules = this.stableSort(this._rules, this._sortFn = compareFn || this._sortFn);\n this._sorted = true;\n }\n\n private ensureSorted() {\n this._sorted || this.sort();\n }\n\n private stableSort(arr, compareFn) {\n const arrOfWrapper = arr.map((elem, idx) => ({ elem, idx }));\n\n arrOfWrapper.sort((wrapperA, wrapperB) => {\n const cmpDiff = compareFn(wrapperA.elem, wrapperB.elem);\n return cmpDiff === 0\n ? wrapperA.idx - wrapperB.idx\n : cmpDiff;\n });\n\n return arrOfWrapper.map(wrapper => wrapper.elem);\n }\n\n /**\n * Given a URL, check all rules and return the best [[MatchResult]]\n * @param url\n * @returns {MatchResult}\n */\n match(url: UrlParts): MatchResult {\n this.ensureSorted();\n\n url = extend({path: '', search: {}, hash: '' }, url);\n let rules = this.rules();\n if (this._otherwiseFn) rules.push(this._otherwiseFn);\n\n // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined\n\n let checkRule = (rule: UrlRule): MatchResult => {\n let match = rule.match(url, this._router);\n return match && { match, rule, weight: rule.matchPriority(match) };\n };\n\n // The rules are pre-sorted.\n // - Find the first matching rule.\n // - Find any other matching rule that sorted *exactly the same*, according to `.sort()`.\n // - Choose the rule with the highest match weight.\n let best: MatchResult;\n for (let i = 0; i < rules.length; i++) {\n // Stop when there is a 'best' rule and the next rule sorts differently than it.\n if (best && this._sortFn(rules[i], best.rule) !== 0) break;\n\n let current = checkRule(rules[i]);\n // Pick the best MatchResult\n best = (!best || current && current.weight > best.weight) ? current : best;\n }\n\n return best;\n }\n\n /** @inheritdoc */\n sync(evt?) {\n if (evt && evt.defaultPrevented) return;\n\n let router = this._router,\n $url = router.urlService,\n $state = router.stateService;\n\n let url: UrlParts = {\n path: $url.path(), search: $url.search(), hash: $url.hash(),\n };\n\n let best = this.match(url);\n\n let applyResult = pattern([\n [isString, (newurl: string) => $url.url(newurl, true)],\n [TargetState.isDef, (def: TargetStateDef) => $state.go(def.state, def.params, def.options)],\n [is(TargetState), (target: TargetState) => $state.go(target.state(), target.params(), target.options())],\n ]);\n\n applyResult(best && best.rule.handler(best.match, url, router));\n }\n\n /** @inheritdoc */\n listen(enabled?: boolean): Function {\n if (enabled === false) {\n this._stopFn && this._stopFn();\n delete this._stopFn;\n } else {\n return this._stopFn = this._stopFn || this._router.urlService.onChange(evt => this.sync(evt));\n }\n }\n\n /**\n * Internal API.\n * @internalapi\n */\n update(read?: boolean) {\n let $url = this._router.locationService;\n if (read) {\n this.location = $url.path();\n return;\n }\n if ($url.path() === this.location) return;\n\n $url.url(this.location, true);\n }\n\n /**\n * Internal API.\n *\n * Pushes a new location to the browser history.\n *\n * @internalapi\n * @param urlMatcher\n * @param params\n * @param options\n */\n push(urlMatcher: UrlMatcher, params?: RawParams, options?: { replace?: (string|boolean) }) {\n let replace = options && !!options.replace;\n this._router.urlService.url(urlMatcher.format(params || {}), replace);\n }\n\n /**\n * Builds and returns a URL with interpolated parameters\n *\n * #### Example:\n * ```js\n * matcher = $umf.compile(\"/about/:person\");\n * params = { person: \"bob\" };\n * $bob = $urlRouter.href(matcher, params);\n * // $bob == \"/about/bob\";\n * ```\n *\n * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate.\n * @param params An object of parameter values to fill the matcher's required parameters.\n * @param options Options object. The options are:\n *\n * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n *\n * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`\n */\n href(urlMatcher: UrlMatcher, params?: any, options?: { absolute: boolean }): string {\n let url = urlMatcher.format(params);\n if (url == null) return null;\n\n options = options || { absolute: false };\n\n let cfg = this._router.urlService.config;\n let isHtml5 = cfg.html5Mode();\n if (!isHtml5 && url !== null) {\n url = \"#\" + cfg.hashPrefix() + url;\n }\n url = appendBasePath(url, isHtml5, options.absolute, cfg.baseHref());\n\n if (!options.absolute || !url) {\n return url;\n }\n\n let slash = (!isHtml5 && url ? '/' : ''), port = cfg.port();\n port = (port === 80 || port === 443 ? '' : ':' + port);\n\n return [cfg.protocol(), '://', cfg.host(), port, slash, url].join('');\n }\n\n\n /**\n * Manually adds a URL Rule.\n *\n * Usually, a url rule is added using [[StateDeclaration.url]] or [[when]].\n * This api can be used directly for more control (to register a [[BaseUrlRule]], for example).\n * Rules can be created using [[UrlRouter.urlRuleFactory]], or create manually as simple objects.\n *\n * A rule should have a `match` function which returns truthy if the rule matched.\n * It should also have a `handler` function which is invoked if the rule is the best match.\n *\n * @return a function that deregisters the rule\n */\n rule(rule: UrlRule): Function {\n if (!UrlRuleFactory.isUrlRule(rule)) throw new Error(\"invalid rule\");\n rule.$id = this._id++;\n rule.priority = rule.priority || 0;\n\n this._rules.push(rule);\n this._sorted = false;\n\n return () => this.removeRule(rule);\n }\n\n /** @inheritdoc */\n removeRule(rule): void {\n removeFrom(this._rules, rule);\n }\n\n /** @inheritdoc */\n rules(): UrlRule[] {\n this.ensureSorted();\n return this._rules.slice();\n }\n\n /** @inheritdoc */\n otherwise(handler: string|UrlRuleHandlerFn|TargetState|TargetStateDef) {\n let handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n this._otherwiseFn = this.urlRuleFactory.create(val(true), handlerFn);\n this._sorted = false;\n };\n\n /** @inheritdoc */\n initial(handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef) {\n let handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n let matchFn: UrlRuleMatchFn = (urlParts, router) =>\n router.globals.transitionHistory.size() === 0 && !!/^\\/?$/.exec(urlParts.path);\n\n this.rule(this.urlRuleFactory.create(matchFn, handlerFn));\n };\n\n /** @inheritdoc */\n when(matcher: (RegExp|UrlMatcher|string), handler: string|UrlRuleHandlerFn, options?: { priority: number }): UrlRule {\n let rule = this.urlRuleFactory.create(matcher, handler);\n if (isDefined(options && options.priority)) rule.priority = options.priority;\n this.rule(rule);\n return rule;\n };\n\n /** @inheritdoc */\n deferIntercept(defer?: boolean) {\n if (defer === undefined) defer = true;\n this.interceptDeferred = defer;\n };\n}\n\nfunction getHandlerFn(handler: string|UrlRuleHandlerFn|TargetState|TargetStateDef): UrlRuleHandlerFn {\n if (!isFunction(handler) && !isString(handler) && !is(TargetState)(handler) && !TargetState.isDef(handler)) {\n throw new Error(\"'handler' must be a string, function, TargetState, or have a state: 'newtarget' property\");\n }\n return isFunction(handler) ? handler as UrlRuleHandlerFn : val(handler);\n}\n","/** @module hooks */ /** */\nimport { Transition } from \"../transition/transition\";\nimport { UIRouter } from \"../router\";\nimport { TransitionService } from \"../transition/transitionService\";\n\nfunction addCoreResolvables(trans: Transition) {\n trans.addResolvable({ token: UIRouter, deps: [], resolveFn: () => trans.router, data: trans.router }, \"\");\n trans.addResolvable({ token: Transition, deps: [], resolveFn: () => trans, data: trans }, \"\");\n trans.addResolvable({ token: '$transition$', deps: [], resolveFn: () => trans, data: trans }, \"\");\n trans.addResolvable({ token: '$stateParams', deps: [], resolveFn: () => trans.params(), data: trans.params() }, \"\");\n\n trans.entering().forEach(state => {\n trans.addResolvable({ token: '$state$', deps: [], resolveFn: () => state, data: state }, state);\n });\n}\n\nexport const registerAddCoreResolvables = (transitionService: TransitionService) =>\n transitionService.onCreate({}, addCoreResolvables);\n","/** @module hooks */\n/** for typedoc */\nimport { TransitionStateHookFn } from '../transition/interface';\nimport { Transition } from '../transition/transition';\nimport { TransitionService } from '../transition/transitionService';\nimport { StateDeclaration } from '../state/interface';\nimport { StateObject } from '../state/stateObject';\n\n/**\n * A factory which creates an onEnter, onExit or onRetain transition hook function\n *\n * The returned function invokes the (for instance) state.onEnter hook when the\n * state is being entered.\n *\n * @hidden\n */\nfunction makeEnterExitRetainHook(hookName: string): TransitionStateHookFn {\n return (transition: Transition, state: StateDeclaration) => {\n let _state: StateObject = state.$$state();\n let hookFn: TransitionStateHookFn = _state[hookName];\n return hookFn(transition, state);\n }\n}\n\n/**\n * The [[TransitionStateHookFn]] for onExit\n *\n * When the state is being exited, the state's .onExit function is invoked.\n *\n * Registered using `transitionService.onExit({ exiting: (state) => !!state.onExit }, onExitHook);`\n *\n * See: [[IHookRegistry.onExit]]\n */\nconst onExitHook: TransitionStateHookFn = makeEnterExitRetainHook('onExit');\nexport const registerOnExitHook = (transitionService: TransitionService) =>\n transitionService.onExit({exiting: state => !!state.onExit}, onExitHook);\n\n/**\n * The [[TransitionStateHookFn]] for onRetain\n *\n * When the state was already entered, and is not being exited or re-entered, the state's .onRetain function is invoked.\n *\n * Registered using `transitionService.onRetain({ retained: (state) => !!state.onRetain }, onRetainHook);`\n *\n * See: [[IHookRegistry.onRetain]]\n */\nconst onRetainHook: TransitionStateHookFn = makeEnterExitRetainHook('onRetain');\nexport const registerOnRetainHook = (transitionService: TransitionService) =>\n transitionService.onRetain({retained: state => !!state.onRetain}, onRetainHook);\n\n/**\n * The [[TransitionStateHookFn]] for onEnter\n *\n * When the state is being entered, the state's .onEnter function is invoked.\n *\n * Registered using `transitionService.onEnter({ entering: (state) => !!state.onEnter }, onEnterHook);`\n *\n * See: [[IHookRegistry.onEnter]]\n */\nconst onEnterHook: TransitionStateHookFn = makeEnterExitRetainHook('onEnter');\nexport const registerOnEnterHook = (transitionService: TransitionService) =>\n transitionService.onEnter({entering: state => !!state.onEnter}, onEnterHook);\n\n","/** @module hooks */ /** */\nimport {Transition} from \"../transition/transition\";\nimport {TransitionService} from \"../transition/transitionService\";\nimport {TransitionHookFn} from \"../transition/interface\";\nimport {StateDeclaration, LazyLoadResult} from \"../state/interface\";\nimport {services} from \"../common/coreservices\";\nimport { StateRule } from \"../url/interface\";\n\n/**\n * A [[TransitionHookFn]] that performs lazy loading\n *\n * When entering a state \"abc\" which has a `lazyLoad` function defined:\n * - Invoke the `lazyLoad` function (unless it is already in process)\n * - Flag the hook function as \"in process\"\n * - The function should return a promise (that resolves when lazy loading is complete)\n * - Wait for the promise to settle\n * - If the promise resolves to a [[LazyLoadResult]], then register those states\n * - Flag the hook function as \"not in process\"\n * - If the hook was successful\n * - Remove the `lazyLoad` function from the state declaration\n * - If all the hooks were successful\n * - Retry the transition (by returning a TargetState)\n *\n * ```\n * .state('abc', {\n * component: 'fooComponent',\n * lazyLoad: () => System.import('./fooComponent')\n * });\n * ```\n *\n * See [[StateDeclaration.lazyLoad]]\n */\nconst lazyLoadHook: TransitionHookFn = (transition: Transition) => {\n let router = transition.router;\n\n function retryTransition() {\n if (transition.originalTransition().options().source !== 'url') {\n // The original transition was not triggered via url sync\n // The lazy state should be loaded now, so re-try the original transition\n let orig = transition.targetState();\n return router.stateService.target(orig.identifier(), orig.params(), orig.options());\n }\n\n // The original transition was triggered via url sync\n // Run the URL rules and find the best match\n let $url = router.urlService;\n let result = $url.match($url.parts());\n let rule = result && result.rule;\n\n // If the best match is a state, redirect the transition (instead\n // of calling sync() which supersedes the current transition)\n if (rule && rule.type === \"STATE\") {\n let state = (rule as StateRule).state;\n let params = result.match;\n return router.stateService.target(state, params, transition.options());\n }\n\n // No matching state found, so let .sync() choose the best non-state match/otherwise\n router.urlService.sync();\n }\n\n let promises = transition.entering()\n .filter(state => !!state.$$state().lazyLoad)\n .map(state => lazyLoadState(transition, state));\n\n return services.$q.all(promises).then(retryTransition);\n};\n\nexport const registerLazyLoadHook = (transitionService: TransitionService) =>\n transitionService.onBefore({ entering: (state) => !!state.lazyLoad }, lazyLoadHook);\n\n\n/**\n * Invokes a state's lazy load function\n *\n * @param transition a Transition context\n * @param state the state to lazy load\n * @returns A promise for the lazy load result\n */\nexport function lazyLoadState(transition: Transition, state: StateDeclaration): Promise {\n let lazyLoadFn = state.$$state().lazyLoad;\n\n // Store/get the lazy load promise on/from the hookfn so it doesn't get re-invoked\n let promise = lazyLoadFn['_promise'];\n if (!promise) {\n const success = (result) => {\n delete state.lazyLoad;\n delete state.$$state().lazyLoad;\n delete lazyLoadFn['_promise'];\n return result;\n };\n\n const error = (err) => {\n delete lazyLoadFn['_promise'];\n return services.$q.reject(err);\n };\n\n promise = lazyLoadFn['_promise'] =\n services.$q.when(lazyLoadFn(transition, state))\n .then(updateStateRegistry)\n .then(success, error);\n }\n\n /** Register any lazy loaded state definitions */\n function updateStateRegistry(result: LazyLoadResult) {\n if (result && Array.isArray(result.states)) {\n result.states.forEach(state => transition.router.stateRegistry.register(state));\n }\n return result;\n }\n\n return promise;\n}\n","/** @module hooks */ /** */\n\nimport { trace } from '../common/trace';\nimport { Rejection } from '../transition/rejectFactory';\nimport { TransitionService } from '../transition/transitionService';\nimport { Transition } from '../transition/transition';\n\n/**\n * A [[TransitionHookFn]] that skips a transition if it should be ignored\n *\n * This hook is invoked at the end of the onBefore phase.\n *\n * If the transition should be ignored (because no parameter or states changed)\n * then the transition is ignored and not processed.\n */\nfunction ignoredHook(trans: Transition) {\n const ignoredReason = trans._ignoredReason();\n if (!ignoredReason) return;\n\n trace.traceTransitionIgnored(trans);\n\n const pending = trans.router.globals.transition;\n\n // The user clicked a link going back to the *current state* ('A')\n // However, there is also a pending transition in flight (to 'B')\n // Abort the transition to 'B' because the user now wants to be back at 'A'.\n if (ignoredReason === 'SameAsCurrent' && pending) {\n pending.abort();\n }\n\n return Rejection.ignored().toPromise();\n}\n\nexport const registerIgnoredTransitionHook = (transitionService: TransitionService) =>\n transitionService.onBefore({}, ignoredHook, { priority: -9999 });\n","/** @module hooks */ /** */\n\nimport { TransitionService } from '../transition/transitionService';\nimport { Transition } from '../transition/transition';\n\n/**\n * A [[TransitionHookFn]] that rejects the Transition if it is invalid\n *\n * This hook is invoked at the end of the onBefore phase.\n * If the transition is invalid (for example, param values do not validate)\n * then the transition is rejected.\n */\nfunction invalidTransitionHook(trans: Transition) {\n if (!trans.valid()) {\n throw new Error(trans.error());\n }\n}\n\nexport const registerInvalidTransitionHook = (transitionService: TransitionService) =>\n transitionService.onBefore({}, invalidTransitionHook, { priority: -10000 });\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport {\n LocationConfig, LocationServices, identity, unnestR, isArray, splitEqual, splitHash, splitQuery\n} from \"../common\";\nimport { UIRouter } from \"../router\";\n\nexport const keyValsToObjectR = (accum, [key, val]) => {\n if (!accum.hasOwnProperty(key)) {\n accum[key] = val;\n } else if (isArray(accum[key])) {\n accum[key].push(val);\n } else {\n accum[key] = [accum[key], val]\n }\n return accum;\n};\n\nexport const getParams = (queryString: string): any =>\n queryString.split(\"&\").filter(identity).map(splitEqual).reduce(keyValsToObjectR, {});\n\nexport function parseUrl(url: string) {\n const orEmptyString = x => x || \"\";\n let [beforehash, hash] = splitHash(url).map(orEmptyString);\n let [path, search] = splitQuery(beforehash).map(orEmptyString);\n\n return { path, search, hash, url };\n}\n\nexport const buildUrl = (loc: LocationServices) => {\n let path = loc.path();\n let searchObject = loc.search();\n let hash = loc.hash();\n\n let search = Object.keys(searchObject).map(key => {\n let param = searchObject[key];\n let vals = isArray(param) ? param : [param];\n return vals.map(val => key + \"=\" + val);\n }).reduce(unnestR, []).join(\"&\");\n\n return path + (search ? \"?\" + search : \"\") + (hash ? \"#\" + hash : \"\");\n};\n\nexport function locationPluginFactory(\n name: string,\n isHtml5: boolean,\n serviceClass: { new(router?: UIRouter): LocationServices },\n configurationClass: { new(router?: UIRouter, isHtml5?: boolean): LocationConfig }\n) {\n return function(router: UIRouter) {\n let service = router.locationService = new serviceClass(router);\n let configuration = router.locationConfig = new configurationClass(router, isHtml5);\n\n function dispose(router: UIRouter) {\n router.dispose(service);\n router.dispose(configuration);\n }\n\n return { name, service, configuration, dispose };\n };\n}\n\nexport function getCustomEventCtor(): typeof CustomEvent {\n // CustomEvent Polyfill\n function _CustomEvent(event, params) {\n params = params || { bubbles: false, cancelable: false, detail: undefined };\n let evt = document.createEvent( 'CustomEvent' );\n evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );\n return evt;\n }\n _CustomEvent.prototype = Event.prototype;\n\n try {\n new CustomEvent('foo');\n return CustomEvent;\n } catch (_err) {\n return _CustomEvent as any;\n }\n}\n","/**\n * @internalapi\n * @module vanilla\n */\n/** */\nimport { BrowserLocationConfig } from \"./browserLocationConfig\";\nimport { HashLocationService } from \"./hashLocationService\";\nimport { locationPluginFactory } from \"./utils\";\nimport { LocationPlugin, ServicesPlugin } from \"./interface\";\nimport { UIRouter } from \"../router\";\nimport { PushStateLocationService } from \"./pushStateLocationService\";\nimport { MemoryLocationService } from \"./memoryLocationService\";\nimport { MemoryLocationConfig } from \"./memoryLocationConfig\";\nimport { $injector } from \"./injector\";\nimport { $q } from \"./q\";\nimport { services } from \"../common/coreservices\";\n\nexport function servicesPlugin(router: UIRouter): ServicesPlugin {\n services.$injector = $injector;\n services.$q = $q;\n\n return { name: \"vanilla.services\", $q, $injector, dispose: () => null };\n}\n\n/** A `UIRouterPlugin` uses the browser hash to get/set the current location */\nexport const hashLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory('vanilla.hashBangLocation', false, HashLocationService, BrowserLocationConfig);\n\n/** A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis */\nexport const pushStateLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory(\"vanilla.pushStateLocation\", true, PushStateLocationService, BrowserLocationConfig);\n\n/** A `UIRouterPlugin` that gets/sets the current location from an in-memory object */\nexport const memoryLocationPlugin: (router: UIRouter) => LocationPlugin =\n locationPluginFactory(\"vanilla.memoryLocation\", false, MemoryLocationService, MemoryLocationConfig);\n","/** @module ng1 */ /** */\nimport { ng as angular } from \"../angular\";\nimport {\n StateObject, pick, forEach, tail, extend,\n isArray, isInjectable, isDefined, isString, services, trace,\n ViewConfig, ViewService, ViewConfigFactory, PathNode, ResolveContext, Resolvable, IInjectable\n} from \"@uirouter/core\";\nimport { Ng1ViewDeclaration } from \"../interface\";\nimport { TemplateFactory } from \"../templateFactory\";\nimport IInjectorService = angular.auto.IInjectorService;\n\nexport function getNg1ViewConfigFactory(): ViewConfigFactory {\n let templateFactory: TemplateFactory = null;\n return (path, view) => {\n templateFactory = templateFactory || services.$injector.get(\"$templateFactory\");\n return [new Ng1ViewConfig(path, view, templateFactory)];\n };\n}\n\nconst hasAnyKey = (keys, obj) =>\n keys.reduce((acc, key) => acc || isDefined(obj[key]), false);\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `views`.\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * handles the `views` property with logic specific to @uirouter/angularjs (ng1).\n *\n * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object\n * and applies the state-level configuration to a view named `$default`.\n */\nexport function ng1ViewsBuilder(state: StateObject) {\n // Do not process root state\n if (!state.parent) return {};\n\n let tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'],\n ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'],\n compKeys = ['component', 'bindings', 'componentProvider'],\n nonCompKeys = tplKeys.concat(ctrlKeys),\n allViewKeys = compKeys.concat(nonCompKeys);\n\n // Do not allow a state to have both state-level props and also a `views: {}` property.\n // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state.\n // However, the `$default` approach should not be mixed with a separate `views: ` block.\n if (isDefined(state.views) && hasAnyKey(allViewKeys, state)) {\n throw new Error(`State '${state.name}' has a 'views' object. ` +\n `It cannot also have \"view properties\" at the state level. ` +\n `Move the following properties into a view (in the 'views' object): ` +\n ` ${allViewKeys.filter(key => isDefined(state[key])).join(\", \")}`);\n }\n\n let views: { [key: string]: Ng1ViewDeclaration } = {},\n viewsObject = state.views || { \"$default\": pick(state, allViewKeys) };\n\n forEach(viewsObject, function (config: Ng1ViewDeclaration, name: string) {\n // Account for views: { \"\": { template... } }\n name = name || \"$default\";\n // Account for views: { header: \"headerComponent\" }\n if (isString(config)) config = { component: config };\n\n // Make a shallow copy of the config object\n config = extend({}, config);\n\n // Do not allow a view to mix props for component-style view with props for template/controller-style view\n if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {\n throw new Error(`Cannot combine: ${compKeys.join(\"|\")} with: ${nonCompKeys.join(\"|\")} in stateview: '${name}@${state.name}'`);\n }\n\n config.resolveAs = config.resolveAs || '$resolve';\n config.$type = \"ng1\";\n config.$context = state;\n config.$name = name;\n\n let normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name);\n config.$uiViewName = normalized.uiViewName;\n config.$uiViewContextAnchor = normalized.uiViewContextAnchor;\n\n views[name] = config;\n });\n return views;\n}\n\nlet id = 0;\nexport class Ng1ViewConfig implements ViewConfig {\n $id = id++;\n loaded: boolean = false;\n controller: Function; // actually IInjectable|string\n template: string;\n component: string;\n locals: any; // TODO: delete me\n\n constructor(public path: PathNode[], public viewDecl: Ng1ViewDeclaration, public factory: TemplateFactory) { }\n\n load() {\n let $q = services.$q;\n let context = new ResolveContext(this.path);\n let params = this.path.reduce((acc, node) => extend(acc, node.paramValues), {});\n\n let promises: any = {\n template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)),\n controller: $q.when(this.getController(context))\n };\n\n return $q.all(promises).then((results) => {\n trace.traceViewServiceEvent(\"Loaded\", this);\n this.controller = results.controller;\n extend(this, results.template); // Either { template: \"tpl\" } or { component: \"cmpName\" }\n return this;\n });\n }\n\n getTemplate = (uiView, context: ResolveContext) =>\n this.component ? this.factory.makeComponentTemplate(uiView, context, this.component, this.viewDecl.bindings) : this.template;\n\n /**\n * Gets the controller for a view configuration.\n *\n * @returns {Function|Promise.} Returns a controller, or a promise that resolves to a controller.\n */\n getController(context: ResolveContext): (IInjectable|string|Promise) {\n let provider = this.viewDecl.controllerProvider;\n if (!isInjectable(provider)) return this.viewDecl.controller;\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n }\n}\n","/** @module view */\n/** for typedoc */\nimport { ng as angular } from \"./angular\";\nimport { IAugmentedJQuery } from \"angular\";\nimport {\n isArray, isDefined, isFunction, isObject, services, Obj, IInjectable, tail, kebobString, unnestR, ResolveContext,\n Resolvable, RawParams\n} from \"@uirouter/core\";\nimport { Ng1ViewDeclaration, TemplateFactoryProvider } from \"./interface\";\n\n/**\n * Service which manages loading of templates from a ViewConfig.\n */\nexport class TemplateFactory implements TemplateFactoryProvider {\n /** @hidden */ private _useHttp = angular.version.minor < 3;\n /** @hidden */ private $templateRequest;\n /** @hidden */ private $templateCache;\n /** @hidden */ private $http;\n\n /** @hidden */ $get = ['$http', '$templateCache', '$injector', ($http, $templateCache, $injector) => {\n this.$templateRequest = $injector.has && $injector.has('$templateRequest') && $injector.get('$templateRequest');\n this.$http = $http;\n this.$templateCache = $templateCache;\n return this;\n }];\n\n /** @hidden */\n useHttpService(value: boolean) {\n this._useHttp = value;\n };\n\n /**\n * Creates a template from a configuration object.\n *\n * @param config Configuration object for which to load a template.\n * The following properties are search in the specified order, and the first one\n * that is defined is used to create the template:\n *\n * @param params Parameters to pass to the template function.\n * @param context The resolve context associated with the template's view\n *\n * @return {string|object} The template html as a string, or a promise for\n * that string,or `null` if no template is configured.\n */\n fromConfig(config: Ng1ViewDeclaration, params: any, context: ResolveContext): Promise<{ template?: string, component?: string }> {\n const defaultTemplate = \"\";\n\n const asTemplate = (result) => services.$q.when(result).then(str => ({ template: str }));\n const asComponent = (result) => services.$q.when(result).then(str => ({ component: str }));\n\n return (\n isDefined(config.template) ? asTemplate(this.fromString(config.template, params)) :\n isDefined(config.templateUrl) ? asTemplate(this.fromUrl(config.templateUrl, params)) :\n isDefined(config.templateProvider) ? asTemplate(this.fromProvider(config.templateProvider, params, context)) :\n isDefined(config.component) ? asComponent(config.component) :\n isDefined(config.componentProvider) ? asComponent(this.fromComponentProvider(config.componentProvider, params, context)) :\n asTemplate(defaultTemplate)\n );\n };\n\n /**\n * Creates a template from a string or a function returning a string.\n *\n * @param template html template as a string or function that returns an html template as a string.\n * @param params Parameters to pass to the template function.\n *\n * @return {string|object} The template html as a string, or a promise for that\n * string.\n */\n fromString(template: (string | Function), params?: RawParams) {\n return isFunction(template) ? ( template)(params) : template;\n };\n\n /**\n * Loads a template from the a URL via `$http` and `$templateCache`.\n *\n * @param {string|Function} url url of the template to load, or a function\n * that returns a url.\n * @param {Object} params Parameters to pass to the url function.\n * @return {string|Promise.} The template html as a string, or a promise\n * for that string.\n */\n fromUrl(url: (string | Function), params: any) {\n if (isFunction(url)) url = ( url)(params);\n if (url == null) return null;\n\n if (this._useHttp) {\n return this.$http.get(url, { cache: this.$templateCache, headers: { Accept: 'text/html' } })\n .then(function (response) {\n return response.data;\n });\n }\n\n return this.$templateRequest(url);\n };\n\n /**\n * Creates a template by invoking an injectable provider function.\n *\n * @param provider Function to invoke via `locals`\n * @param {Function} injectFn a function used to invoke the template provider\n * @return {string|Promise.} The template html as a string, or a promise\n * for that string.\n */\n fromProvider(provider: IInjectable, params: any, context: ResolveContext) {\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n };\n\n /**\n * Creates a component's template by invoking an injectable provider function.\n *\n * @param provider Function to invoke via `locals`\n * @param {Function} injectFn a function used to invoke the template provider\n * @return {string} The template html as a string: \"\".\n */\n fromComponentProvider(provider: IInjectable, params: any, context: ResolveContext) {\n let deps = services.$injector.annotate(provider);\n let providerFn = isArray(provider) ? tail( provider) : provider;\n let resolvable = new Resolvable(\"\", providerFn, deps);\n return resolvable.get(context);\n };\n\n /**\n * Creates a template from a component's name\n *\n * This implements route-to-component.\n * It works by retrieving the component (directive) metadata from the injector.\n * It analyses the component's bindings, then constructs a template that instantiates the component.\n * The template wires input and output bindings to resolves or from the parent component.\n *\n * @param uiView {object} The parent ui-view (for binding outputs to callbacks)\n * @param context The ResolveContext (for binding outputs to callbacks returned from resolves)\n * @param component {string} Component's name in camel case.\n * @param bindings An object defining the component's bindings: {foo: '<'}\n * @return {string} The template as a string: \"\".\n */\n makeComponentTemplate(uiView: IAugmentedJQuery, context: ResolveContext, component: string, bindings?: any) {\n bindings = bindings || {};\n\n // Bind once prefix\n const prefix = angular.version.minor >= 3 ? \"::\" : \"\";\n // Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-`\n const kebob = (camelCase: string) => {\n const kebobed = kebobString(camelCase);\n return /^(x|data)-/.exec(kebobed) ? `x-${kebobed}` : kebobed;\n };\n\n\n const attributeTpl = (input: BindingTuple) => {\n let { name, type } = input;\n let attrName = kebob(name);\n // If the ui-view has an attribute which matches a binding on the routed component\n // then pass that attribute through to the routed component template.\n // Prefer ui-view wired mappings to resolve data, unless the resolve was explicitly bound using `bindings:`\n if (uiView.attr(attrName) && !bindings[name])\n return `${attrName}='${uiView.attr(attrName)}'`;\n\n let resolveName = bindings[name] || name;\n // Pre-evaluate the expression for \"@\" bindings by enclosing in {{ }}\n // some-attr=\"{{ ::$resolve.someResolveName }}\"\n if (type === '@')\n return `${attrName}='{{${prefix}$resolve.${resolveName}}}'`;\n\n // Wire \"&\" callbacks to resolves that return a callback function\n // Get the result of the resolve (should be a function) and annotate it to get its arguments.\n // some-attr=\"$resolve.someResolveResultName(foo, bar)\"\n if (type === '&') {\n let res = context.getResolvable(resolveName);\n let fn = res && res.data;\n let args = fn && services.$injector.annotate(fn) || [];\n // account for array style injection, i.e., ['foo', function(foo) {}]\n let arrayIdxStr = isArray(fn) ? `[${fn.length - 1}]` : '';\n return `${attrName}='$resolve.${resolveName}${arrayIdxStr}(${args.join(\",\")})'`;\n }\n\n // some-attr=\"::$resolve.someResolveName\"\n return `${attrName}='${prefix}$resolve.${resolveName}'`;\n };\n\n let attrs = getComponentBindings(component).map(attributeTpl).join(\" \");\n let kebobName = kebob(component);\n return `<${kebobName} ${attrs}>`;\n };\n}\n\n// Gets all the directive(s)' inputs ('@', '=', and '<') and outputs ('&')\nfunction getComponentBindings(name: string) {\n let cmpDefs = services.$injector.get(name + \"Directive\"); // could be multiple\n if (!cmpDefs || !cmpDefs.length) throw new Error(`Unable to find component named '${name}'`);\n return cmpDefs.map(getBindings).reduce(unnestR, []);\n}\n\n// Given a directive definition, find its object input attributes\n// Use different properties, depending on the type of directive (component, bindToController, normal)\nconst getBindings = (def: any) => {\n if (isObject(def.bindToController)) return scopeBindings(def.bindToController);\n return scopeBindings(def.scope);\n};\n\ninterface BindingTuple {\n name: string;\n type: string;\n}\n\n// for ng 1.2 style, process the scope: { input: \"=foo\" }\n// for ng 1.3 through ng 1.5, process the component's bindToController: { input: \"=foo\" } object\nconst scopeBindings = (bindingsObj: Obj) => Object.keys(bindingsObj || {})\n // [ 'input', [ '=foo', '=', 'foo' ] ]\n .map(key => [key, /^([=<@&])[?]?(.*)/.exec(bindingsObj[key])])\n // skip malformed values\n .filter(tuple => isDefined(tuple) && isArray(tuple[1]))\n // { name: ('foo' || 'input'), type: '=' }\n .map(tuple => ({ name: tuple[1][2] || tuple[0], type: tuple[1][1] } as BindingTuple));\n\n","/**\n * # Angular 1 types\n *\n * UI-Router core provides various Typescript types which you can use for code completion and validating parameter values, etc.\n * The customizations to the core types for Angular UI-Router are documented here.\n *\n * The optional [[$resolve]] service is also documented here.\n *\n * @module ng1\n * @preferred\n */\n/** for typedoc */\nimport { ng as angular } from \"./angular\";\nimport {\n IRootScopeService, IQService, ILocationService, ILocationProvider, IHttpService, ITemplateCacheService\n} from \"angular\";\nimport {\n services, applyPairs, isString, trace, extend, UIRouter, StateService, UrlRouter, UrlMatcherFactory, ResolveContext,\n unnestR, TypedMap\n} from \"@uirouter/core\";\nimport { ng1ViewsBuilder, getNg1ViewConfigFactory } from \"./statebuilders/views\";\nimport { TemplateFactory } from \"./templateFactory\";\nimport { StateProvider } from \"./stateProvider\";\nimport { getStateHookBuilder } from \"./statebuilders/onEnterExitRetain\";\nimport { Ng1LocationServices } from \"./locationServices\";\nimport { UrlRouterProvider } from \"./urlRouterProvider\";\nimport IInjectorService = angular.auto.IInjectorService; // tslint:disable-line\n\nangular.module(\"ui.router.angular1\", []);\nlet mod_init = angular.module('ui.router.init', []);\nlet mod_util = angular.module('ui.router.util', ['ng', 'ui.router.init']);\nlet mod_rtr = angular.module('ui.router.router', ['ui.router.util']);\nlet mod_state = angular.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']);\nlet mod_main = angular.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']);\nlet mod_cmpt = angular.module('ui.router.compat', ['ui.router']); // tslint:disable-line\n\ndeclare module '@uirouter/core/lib/router' {\n interface UIRouter {\n /** @hidden */\n stateProvider: StateProvider;\n /** @hidden */\n urlRouterProvider: UrlRouterProvider;\n }\n}\n\nlet router: UIRouter = null;\n\n$uiRouter.$inject = ['$locationProvider'];\n/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */\nfunction $uiRouter($locationProvider: ILocationProvider) {\n\n // Create a new instance of the Router when the $uiRouterProvider is initialized\n router = this.router = new UIRouter();\n router.stateProvider = new StateProvider(router.stateRegistry, router.stateService);\n\n // Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties\n router.stateRegistry.decorator(\"views\", ng1ViewsBuilder);\n router.stateRegistry.decorator(\"onExit\", getStateHookBuilder(\"onExit\"));\n router.stateRegistry.decorator(\"onRetain\", getStateHookBuilder(\"onRetain\"));\n router.stateRegistry.decorator(\"onEnter\", getStateHookBuilder(\"onEnter\"));\n\n router.viewService._pluginapi._viewConfigFactory('ng1', getNg1ViewConfigFactory());\n\n let ng1LocationService = router.locationService = router.locationConfig = new Ng1LocationServices($locationProvider);\n\n Ng1LocationServices.monkeyPatchPathParameterType(router);\n\n // backwards compat: also expose router instance as $uiRouterProvider.router\n router['router'] = router;\n router['$get'] = $get;\n $get.$inject = ['$location', '$browser', '$sniffer', '$rootScope', '$http', '$templateCache'];\n function $get($location: ILocationService, $browser: any, $sniffer: any, $rootScope: ng.IScope, $http: IHttpService, $templateCache: ITemplateCacheService) {\n ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser);\n delete router['router'];\n delete router['$get'];\n return router;\n }\n return router;\n}\n\nconst getProviderFor = (serviceName) => [ '$uiRouterProvider', ($urp) => {\n let service = $urp.router[serviceName];\n service[\"$get\"] = () => service;\n return service;\n}];\n\n// This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime)\nrunBlock.$inject = ['$injector', '$q', '$uiRouter'];\nfunction runBlock($injector: IInjectorService, $q: IQService, $uiRouter: UIRouter) {\n services.$injector = $injector;\n services.$q = $q;\n\n // The $injector is now available.\n // Find any resolvables that had dependency annotation deferred\n $uiRouter.stateRegistry.get()\n .map(x => x.$$state().resolvables)\n .reduce(unnestR, [])\n .filter(x => x.deps === \"deferred\")\n .forEach(resolvable => resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi));\n}\n\n// $urlRouter service and $urlRouterProvider\nconst getUrlRouterProvider = (uiRouter: UIRouter) =>\n uiRouter.urlRouterProvider = new UrlRouterProvider(uiRouter);\n\n// $state service and $stateProvider\n// $urlRouter service and $urlRouterProvider\nconst getStateProvider = () =>\n extend(router.stateProvider, { $get: () => router.stateService });\n\nwatchDigests.$inject = ['$rootScope'];\nexport function watchDigests($rootScope: IRootScopeService) {\n $rootScope.$watch(function() { trace.approximateDigests++; });\n}\n\nmod_init .provider(\"$uiRouter\", $uiRouter);\nmod_rtr .provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]);\nmod_util .provider('$urlService', getProviderFor('urlService'));\nmod_util .provider('$urlMatcherFactory', ['$uiRouterProvider', () => router.urlMatcherFactory]);\nmod_util .provider('$templateFactory', () => new TemplateFactory());\nmod_state.provider('$stateRegistry', getProviderFor('stateRegistry'));\nmod_state.provider('$uiRouterGlobals', getProviderFor('globals'));\nmod_state.provider('$transitions', getProviderFor('transitionService'));\nmod_state.provider('$state', ['$uiRouterProvider', getStateProvider]);\n\nmod_state.factory ('$stateParams', ['$uiRouter', ($uiRouter: UIRouter) => $uiRouter.globals.params]);\nmod_main .factory ('$view', () => router.viewService);\nmod_main .service (\"$trace\", () => trace);\n\nmod_main .run (watchDigests);\nmod_util .run (['$urlMatcherFactory', function ($urlMatcherFactory: UrlMatcherFactory) { }]);\nmod_state.run (['$state', function ($state: StateService) { }]);\nmod_rtr .run (['$urlRouter', function ($urlRouter: UrlRouter) { }]);\nmod_init .run (runBlock);\n\n/** @hidden TODO: find a place to move this */\nexport const getLocals = (ctx: ResolveContext): TypedMap => {\n let tokens = ctx.getTokens().filter(isString);\n\n let tuples = tokens .map(key => {\n let resolvable = ctx.getResolvable(key);\n let waitPolicy = ctx.getPolicy(resolvable).async;\n return [ key, waitPolicy === 'NOWAIT' ? resolvable.promise : resolvable.data ];\n });\n\n return tuples.reduce(applyPairs, {});\n};\n\n","/**\n * # Angular 1 Directives\n *\n * These are the directives included in UI-Router for Angular 1.\n * These directives are used in templates to create viewports and link/navigate to states.\n *\n * @ng1api\n * @preferred\n * @module directives\n */ /** for typedoc */\nimport { ng as angular } from \"../angular\";\nimport { IAugmentedJQuery, ITimeoutService, IScope, IInterpolateService } from \"angular\";\n\nimport {\n Obj, extend, forEach, tail, isString, isObject, isArray, parse, noop, unnestR, identity, uniqR, inArray, removeFrom,\n RawParams, PathNode, StateOrName, StateService, StateDeclaration, UIRouter\n} from \"@uirouter/core\";\nimport { UIViewData } from \"./viewDirective\";\n\n/** @hidden Used for typedoc */\nexport interface ng1_directive {}\n\n/** @hidden */\nfunction parseStateRef(ref: string) {\n let paramsOnly = ref.match(/^\\s*({[^}]*})\\s*$/), parsed;\n if (paramsOnly) ref = '(' + paramsOnly[1] + ')';\n\n parsed = ref.replace(/\\n/g, \" \").match(/^\\s*([^(]*?)\\s*(\\((.*)\\))?\\s*$/);\n if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n return { state: parsed[1] || null, paramExpr: parsed[3] || null };\n}\n\n/** @hidden */\nfunction stateContext(el: IAugmentedJQuery) {\n let $uiView: UIViewData = (el.parent() as IAugmentedJQuery).inheritedData('$uiView');\n let path: PathNode[] = parse('$cfg.path')($uiView);\n return path ? tail(path).state.name : undefined;\n}\n\n/** @hidden */\nfunction processedDef($state: StateService, $element: IAugmentedJQuery, def: Def): Def {\n let uiState = def.uiState || $state.current.name;\n let uiStateOpts = extend(defaultOpts($element, $state), def.uiStateOpts || {});\n let href = $state.href(uiState, def.uiStateParams, uiStateOpts);\n return { uiState, uiStateParams: def.uiStateParams, uiStateOpts, href };\n}\n\n/** @hidden */\ninterface TypeInfo {\n attr: string;\n isAnchor: boolean;\n clickable: boolean;\n}\n\n/** @hidden */\nfunction getTypeInfo(el: IAugmentedJQuery): TypeInfo {\n // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.\n var isSvg = Object.prototype.toString.call(el.prop('href')) === '[object SVGAnimatedString]';\n var isForm = el[0].nodeName === \"FORM\";\n\n return {\n attr: isForm ? \"action\" : (isSvg ? 'xlink:href' : 'href'),\n isAnchor: el.prop(\"tagName\").toUpperCase() === \"A\",\n clickable: !isForm\n };\n}\n\n/** @hidden */\nfunction clickHook(el: IAugmentedJQuery, $state: StateService, $timeout: ITimeoutService, type: TypeInfo, getDef: () => Def) {\n return function (e: JQueryMouseEventObject) {\n var button = e.which || e.button, target = getDef();\n\n if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || el.attr('target'))) {\n // HACK: This is to allow ng-clicks to be processed before the transition is initiated:\n var transition = $timeout(function () {\n $state.go(target.uiState, target.uiStateParams, target.uiStateOpts);\n });\n e.preventDefault();\n\n // if the state has no URL, ignore one preventDefault from the directive.\n var ignorePreventDefaultCount = type.isAnchor && !target.href ? 1 : 0;\n\n e.preventDefault = function () {\n if (ignorePreventDefaultCount-- <= 0) $timeout.cancel(transition);\n };\n }\n };\n}\n\n/** @hidden */\nfunction defaultOpts(el: IAugmentedJQuery, $state: StateService) {\n return {\n relative: stateContext(el) || $state.$current,\n inherit: true,\n source: \"sref\"\n };\n}\n\n/** @hidden */\nfunction bindEvents(element: IAugmentedJQuery, scope: IScope, hookFn: (e: JQueryMouseEventObject) => void, uiStateOpts: any): void {\n let events;\n\n if (uiStateOpts) {\n events = uiStateOpts.events;\n }\n\n if (!isArray(events)) {\n events = ['click'];\n }\n\n let on = element.on ? 'on' : 'bind';\n for (let event of events) {\n element[on](event, hookFn);\n }\n\n scope.$on('$destroy', function() {\n let off = element.off ? 'off' : 'unbind';\n for (let event of events) {\n element[off](event, hookFn);\n }\n });\n}\n\n/**\n * `ui-sref`: A directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of the `ui-sref` is the name of the state to link to.\n *\n * #### Example:\n * This will activate the `home` state when the link is clicked.\n * ```html\n * Home\n * ```\n *\n * ### Relative Links\n * You can also use relative state paths within `ui-sref`, just like a relative path passed to `$state.go()` ([[StateService.go]]).\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create a relative `ui-sref` which always targets the same destination.\n *\n * #### Example:\n * Both these links are relative to the parent state, even when a child state is currently active.\n * ```html\n * child 1 state\n * child 2 state\n * ```\n *\n * This link activates the parent state.\n * ```html\n * Return\n * ```\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]] method).\n *\n * #### Example:\n * Assuming the `users` state has a url of `/users/`\n * ```html\n * Users\n * ```\n *\n * ### Parameter Values\n * In addition to the state name, a `ui-sref` can include parameter values which are applied when activating the state.\n * Param values can be provided in the `ui-sref` value after the state name, enclosed by parentheses.\n * The content inside the parentheses is an expression, evaluated to the parameter values.\n *\n * #### Example:\n * This example renders a list of links to users.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n *
  • \n * {{ user.displayName }}\n *
  • \n * ```\n *\n * Note:\n * The parameter values expression is `$watch`ed for updates.\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-sref-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n *\n * #### Example:\n * ```html\n * Home\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-sref-opts` attribute.\n *\n * #### Example:\n * ```html\n * \n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Examples\n * If you have the following template:\n *\n * ```html\n * Home\n * About\n * Next page\n *\n * \n * ```\n *\n * Then (assuming the current state is `contacts`) the rendered html including hrefs would be:\n *\n * ```html\n * Home\n * About\n * Next page\n *\n *
      \n *
    • \n * Joe\n *
    • \n *
    • \n * Alice\n *
    • \n *
    • \n * Bob\n *
    • \n *
    \n *\n * Home\n * ```\n *\n * ### Notes\n *\n * - You can use `ui-sref` to change **only the parameter values** by omitting the state name and parentheses.\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * English\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n *\n * - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons).\n * If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive.\n */\nlet uiSref: ng1_directive;\nuiSref = ['$uiRouter', '$timeout',\n function $StateRefDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n let $state = $uiRouter.stateService;\n\n return {\n restrict: 'A',\n require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n link: function (scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n let type = getTypeInfo(element);\n let active = uiSrefActive[1] || uiSrefActive[0];\n let unlinkInfoFn: Function = null;\n let hookFn;\n\n let rawDef = {} as Def;\n let getDef = () => processedDef($state, element, rawDef);\n\n let ref = parseStateRef(attrs.uiSref);\n rawDef.uiState = ref.state;\n rawDef.uiStateOpts = attrs.uiSrefOpts ? scope.$eval(attrs.uiSrefOpts) : {};\n\n function update() {\n let def = getDef();\n if (unlinkInfoFn) unlinkInfoFn();\n if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n if (def.href != null) attrs.$set(type.attr, def.href);\n }\n\n if (ref.paramExpr) {\n scope.$watch(ref.paramExpr, function (val) {\n rawDef.uiStateParams = extend({}, val);\n update();\n }, true);\n rawDef.uiStateParams = extend({}, scope.$eval(ref.paramExpr));\n }\n\n update();\n\n scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update));\n scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update));\n\n if (!type.clickable) return;\n hookFn = clickHook(element, $state, $timeout, type, getDef);\n bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n }\n };\n }];\n\n/**\n * `ui-state`: A fully dynamic directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * **This directive is very similar to [[uiSref]], but it `$observe`s and `$watch`es/evaluates all its inputs.**\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of `ui-state` is an expression which is `$watch`ed and evaluated as the state to link to.\n * **This is in contrast with `ui-sref`, which takes a state name as a string literal.**\n *\n * #### Example:\n * Create a list of links.\n * ```html\n *
  • \n * {{ link.displayName }}\n *
  • \n * ```\n *\n * ### Relative Links\n * If the expression evaluates to a relative path, it is processed like [[uiSref]].\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create relative `ui-state` which always targets the same destination.\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]] method).\n *\n * ### Parameter Values\n * In addition to the state name expression, a `ui-state` can include parameter values which are applied when activating the state.\n * Param values should be provided using the `ui-state-params` attribute.\n * The `ui-state-params` attribute value is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * This example renders a list of links with param values.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n *
  • \n * {{ link.displayName }}\n *
  • \n * ```\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-state-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n * The value of the `ui-state-opts` is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * ```html\n * Home\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-state-opts` attribute.\n *\n * #### Example:\n * ```html\n * \n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Notes\n *\n * - You can use `ui-params` to change **only the parameter values** by omitting the state name and supplying only `ui-state-params`.\n * However, it might be simpler to use [[uiSref]] parameter-only links.\n *\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * English\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n * ```\n */\nlet uiState: ng1_directive;\nuiState = ['$uiRouter', '$timeout',\n function $StateRefDynamicDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n let $state = $uiRouter.stateService;\n\n return {\n restrict: 'A',\n require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n link: function (scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n let type = getTypeInfo(element);\n let active = uiSrefActive[1] || uiSrefActive[0];\n let unlinkInfoFn: Function = null;\n let hookFn;\n\n let rawDef = {} as Def;\n let getDef = () => processedDef($state, element, rawDef);\n\n let inputAttrs = ['uiState', 'uiStateParams', 'uiStateOpts'];\n let watchDeregFns = inputAttrs.reduce((acc, attr) => (acc[attr] = noop, acc), {});\n\n function update() {\n let def = getDef();\n if (unlinkInfoFn) unlinkInfoFn();\n if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n if (def.href != null) attrs.$set(type.attr, def.href);\n }\n\n inputAttrs.forEach((field) => {\n rawDef[field] = attrs[field] ? scope.$eval(attrs[field]) : null;\n\n attrs.$observe(field, (expr) => {\n watchDeregFns[field]();\n watchDeregFns[field] = scope.$watch(expr, (newval) => {\n rawDef[field] = newval;\n update();\n }, true);\n })\n });\n\n update();\n\n scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update));\n scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update));\n\n if (!type.clickable) return;\n hookFn = clickHook(element, $state, $timeout, type, getDef);\n bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n }\n };\n }];\n\n\n/**\n * `ui-sref-active` and `ui-sref-active-eq`: A directive that adds a CSS class when a `ui-sref` is active\n *\n * A directive working alongside [[uiSref]] and [[uiState]] to add classes to an element when the\n * related directive's state is active (and remove them when it is inactive).\n *\n * The primary use-case is to highlight the active link in navigation menus,\n * distinguishing it from the inactive menu items.\n *\n * ### Linking to a `ui-sref` or `ui-state`\n * `ui-sref-active` can live on the same element as `ui-sref`/`ui-state`, or it can be on a parent element.\n * If a `ui-sref-active` is a parent to more than one `ui-sref`/`ui-state`, it will apply the CSS class when **any of the links are active**.\n *\n * ### Matching\n *\n * The `ui-sref-active` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state **or any child state is active**.\n * This is a \"fuzzy match\" which uses [[StateService.includes]].\n *\n * The `ui-sref-active-eq` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state is directly active (not when child states are active).\n * This is an \"exact match\" which uses [[StateService.is]].\n *\n * ### Parameter values\n * If the `ui-sref`/`ui-state` includes parameter values, the current parameter values must match the link's values for the link to be highlighted.\n * This allows a list of links to the same state with different parameters to be rendered, and the correct one highlighted.\n *\n * #### Example:\n * ```html\n *
  • \n * {{ user.lastName }}\n *
  • \n * ```\n *\n * ### Examples\n *\n * Given the following template:\n * #### Example:\n * ```html\n * \n * ```\n *\n * When the app state is `app.user` (or any child state),\n * and contains the state parameter \"user\" with value \"bilbobaggins\",\n * the resulting HTML will appear as (note the 'active' class):\n *\n * ```html\n * \n * ```\n *\n * ### Glob mode\n *\n * It is possible to pass `ui-sref-active` an expression that evaluates to an object.\n * The objects keys represent active class names and values represent the respective state names/globs.\n * `ui-sref-active` will match if the current active state **includes** any of\n * the specified state names/globs, even the abstract ones.\n *\n * #### Example:\n * Given the following template, with \"admin\" being an abstract state:\n * ```html\n *
    \n * Roles\n *
    \n * ```\n *\n * When the current state is \"admin.roles\" the \"active\" class will be applied to both the
    and elements.\n * It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`.\n *\n * ### Notes:\n *\n * - The class name is interpolated **once** during the directives link time (any further changes to the\n * interpolated value are ignored).\n *\n * - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'`\n */\nlet uiSrefActive: ng1_directive;\nuiSrefActive = ['$state', '$stateParams', '$interpolate', '$uiRouter',\n function $StateRefActiveDirective($state: StateService, $stateParams: Obj, $interpolate: IInterpolateService, $uiRouter: UIRouter) {\n return {\n restrict: \"A\",\n controller: ['$scope', '$element', '$attrs',\n function ($scope: IScope, $element: IAugmentedJQuery, $attrs: any) {\n let states: StateData[] = [],\n activeEqClass: string,\n uiSrefActive: any;\n\n // There probably isn't much point in $observing this\n // uiSrefActive and uiSrefActiveEq share the same directive object with some\n // slight difference in logic routing\n activeEqClass = $interpolate($attrs.uiSrefActiveEq || '', false)($scope);\n\n try {\n uiSrefActive = $scope.$eval($attrs.uiSrefActive);\n } catch (e) {\n // Do nothing. uiSrefActive is not a valid expression.\n // Fall back to using $interpolate below\n }\n uiSrefActive = uiSrefActive || $interpolate($attrs.uiSrefActive || '', false)($scope);\n if (isObject(uiSrefActive)) {\n forEach(uiSrefActive, function (stateOrName: StateOrName, activeClass: string) {\n if (isString(stateOrName)) {\n let ref = parseStateRef(stateOrName);\n addState(ref.state, $scope.$eval(ref.paramExpr), activeClass);\n }\n });\n }\n\n // Allow uiSref to communicate with uiSrefActive[Equals]\n this.$$addStateInfo = function (newState: string, newParams: Obj) {\n // we already got an explicit state provided by ui-sref-active, so we\n // shadow the one that comes from ui-sref\n if (isObject(uiSrefActive) && states.length > 0) {\n return;\n }\n let deregister = addState(newState, newParams, uiSrefActive);\n update();\n return deregister;\n };\n\n function updateAfterTransition(trans) {\n trans.promise.then(update, noop);\n }\n\n $scope.$on('$stateChangeSuccess', update);\n $scope.$on('$destroy', $uiRouter.transitionService.onStart({}, updateAfterTransition));\n if ($uiRouter.globals.transition) {\n updateAfterTransition($uiRouter.globals.transition);\n }\n\n function addState(stateName: string, stateParams: Obj, activeClass: string) {\n var state = $state.get(stateName, stateContext($element));\n\n var stateInfo = {\n state: state || { name: stateName },\n params: stateParams,\n activeClass: activeClass\n };\n\n states.push(stateInfo);\n\n return function removeState() {\n removeFrom(states)(stateInfo);\n }\n }\n\n // Update route state\n function update() {\n const splitClasses = str =>\n str.split(/\\s/).filter(identity);\n const getClasses = (stateList: StateData[]) =>\n stateList.map(x => x.activeClass).map(splitClasses).reduce(unnestR, []);\n\n let allClasses = getClasses(states).concat(splitClasses(activeEqClass)).reduce(uniqR, []);\n let fuzzyClasses = getClasses(states.filter(x => $state.includes(x.state.name, x.params)));\n let exactlyMatchesAny = !!states.filter(x => $state.is(x.state.name, x.params)).length;\n let exactClasses = exactlyMatchesAny ? splitClasses(activeEqClass) : [];\n\n let addClasses = fuzzyClasses.concat(exactClasses).reduce(uniqR, []);\n let removeClasses = allClasses.filter(cls => !inArray(addClasses, cls));\n\n $scope.$evalAsync(() => {\n addClasses.forEach(className => $element.addClass(className));\n removeClasses.forEach(className => $element.removeClass(className));\n });\n }\n\n update();\n }]\n };\n }];\n\n/** @hidden */\ninterface Def { uiState: string; href: string; uiStateParams: Obj; uiStateOpts: any; }\n/** @hidden */\ninterface StateData { state: StateDeclaration; params: RawParams; activeClass: string; }\n\nangular.module('ui.router.state')\n .directive('uiSref', uiSref)\n .directive('uiSrefActive', uiSrefActive)\n .directive('uiSrefActiveEq', uiSrefActive)\n .directive('uiState', uiState);\n","/** @module ng1 */ /** for typedoc */\n\nimport { ng as angular } from \"./angular\";\nimport { Obj, StateService, StateOrName } from \"@uirouter/core\";\n\n/**\n * `isState` Filter: truthy if the current state is the parameter\n *\n * Translates to [[StateService.is]] `$state.is(\"stateName\")`.\n *\n * #### Example:\n * ```html\n *
    show if state is 'stateName'
    \n * ```\n */\n$IsStateFilter.$inject = ['$state'];\nexport function $IsStateFilter($state: StateService) {\n var isFilter: any = function(state: StateOrName, params: Obj, options?: { relative?: StateOrName }) {\n return $state.is(state, params, options);\n };\n isFilter.$stateful = true;\n return isFilter;\n}\n\n/**\n * `includedByState` Filter: truthy if the current state includes the parameter\n *\n * Translates to [[StateService.includes]]` $state.is(\"fullOrPartialStateName\")`.\n *\n * #### Example:\n * ```html\n *
    show if state includes 'fullOrPartialStateName'
    \n * ```\n */\n$IncludedByStateFilter.$inject = ['$state'];\nexport function $IncludedByStateFilter($state: StateService) {\n var includesFilter: any = function(state: StateOrName, params: Obj, options: { relative?: StateOrName }) {\n return $state.includes(state, params, options);\n };\n includesFilter.$stateful = true;\n return includesFilter;\n}\n\nangular.module('ui.router.state')\n .filter('isState', $IsStateFilter)\n .filter('includedByState', $IncludedByStateFilter);\n","/** \n * @ng1api \n * @module directives \n */ /** for typedoc */\nimport { ng as angular } from \"../angular\";\nimport {\n IInterpolateService, IScope, ITranscludeFunction, IAugmentedJQuery,\n ICompileService, IControllerService, ITimeoutService, noop\n} from \"angular\";\n\nimport {\n extend, unnestR, filter, tail, isDefined, isFunction, isString, trace, parse,\n ActiveUIView, TransitionService, ResolveContext, Transition, PathNode, StateDeclaration,\n Param, kebobString, HookRegOptions, ViewService, $QLike, Obj, TypedMap\n} from \"@uirouter/core\";\nimport {Ng1ViewConfig} from \"../statebuilders/views\";\nimport {Ng1Controller, Ng1StateDeclaration} from \"../interface\";\nimport {getLocals} from \"../services\";\nimport { ng1_directive } from \"./stateDirectives\";\n\n/** @hidden */\nexport type UIViewData = {\n $cfg: Ng1ViewConfig;\n $uiView: ActiveUIView;\n}\n\n/** @hidden */\nexport type UIViewAnimData = {\n $animEnter: Promise;\n $animLeave: Promise;\n $$animLeave: { resolve: () => any; } // \"deferred\"\n}\n\n/**\n * `ui-view`: A viewport directive which is filled in by a view from the active state.\n *\n * ### Attributes\n *\n * - `name`: (Optional) A view name.\n * The name should be unique amongst the other views in the same state.\n * You can have views of the same name that live in different states.\n * The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]).\n *\n * - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated.\n * Uses [[$uiViewScroll]] to do the scrolling.\n *\n * - `onload`: Expression to evaluate whenever the view updates.\n *\n * #### Example:\n * A view can be unnamed or named.\n * ```html\n * \n *
    \n *\n * \n *
    \n *\n * \n * \n * ```\n *\n * You can only have one unnamed view within any template (or root html). If you are only using a\n * single view and it is unnamed then you can populate it like so:\n *\n * ```html\n *
    \n * $stateProvider.state(\"home\", {\n * template: \"

    HELLO!

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

    HELLO!

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

    HELLO!

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

    HELLO!

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