1 | {"version":3,"file":"aurelia-router.js","sources":["../../src/navigation-instruction.ts","../../src/nav-model.ts","../../src/util.ts","../../src/router-configuration.ts","../../src/router.ts","../../src/next.ts","../../src/pipeline.ts","../../src/navigation-commands.ts","../../src/navigation-plan.ts","../../src/step-build-navigation-plan.ts","../../src/utilities-route-loading.ts","../../src/route-loader.ts","../../src/step-load-route.ts","../../src/step-commit-changes.ts","../../src/activation-strategy.ts","../../src/utilities-activation.ts","../../src/step-activation.ts","../../src/pipeline-provider.ts","../../src/app-router.ts","../../src/pipeline-status.ts","../../src/router-event.ts","../../src/pipeline-slot-name.ts"],"sourcesContent":["import { ViewPortInstruction, RouteConfig, ViewPort, LifecycleArguments, ViewPortComponent } from './interfaces';\nimport { Router } from './router';\nimport { ActivationStrategyType, InternalActivationStrategy } from './activation-strategy';\n\n/**\n * Initialization options for a navigation instruction\n */\nexport interface NavigationInstructionInit {\n fragment: string;\n queryString?: string;\n params?: Record<string, any>;\n queryParams?: Record<string, any>;\n config: RouteConfig;\n parentInstruction?: NavigationInstruction;\n previousInstruction?: NavigationInstruction;\n router: Router;\n options?: Object;\n plan?: Record<string, /*ViewPortInstruction*/any>;\n}\n\nexport interface ViewPortInstructionInit {\n name: string;\n strategy: ActivationStrategyType;\n moduleId: string;\n component: ViewPortComponent;\n}\n\n/**\n * Class used to represent an instruction during a navigation.\n */\nexport class NavigationInstruction {\n /**\n * The URL fragment.\n */\n fragment: string;\n\n /**\n * The query string.\n */\n queryString: string;\n\n /**\n * Parameters extracted from the route pattern.\n */\n params: any;\n\n /**\n * Parameters extracted from the query string.\n */\n queryParams: any;\n\n /**\n * The route config for the route matching this instruction.\n */\n config: RouteConfig;\n\n /**\n * The parent instruction, if this instruction was created by a child router.\n */\n parentInstruction: NavigationInstruction;\n\n parentCatchHandler: any;\n\n /**\n * The instruction being replaced by this instruction in the current router.\n */\n previousInstruction: NavigationInstruction;\n\n /**\n * viewPort instructions to used activation.\n */\n viewPortInstructions: Record<string, /*ViewPortInstruction*/any>;\n\n /**\n * The router instance.\n */\n router: Router;\n\n /**\n * Current built viewport plan of this nav instruction\n */\n plan: Record<string, /*ViewPortPlan*/any> = null;\n\n options: Record<string, any> = {};\n\n /**@internal */\n lifecycleArgs: LifecycleArguments;\n /**@internal */\n resolve?: (val?: any) => void;\n\n constructor(init: NavigationInstructionInit) {\n Object.assign(this, init);\n\n this.params = this.params || {};\n this.viewPortInstructions = {};\n\n let ancestorParams = [];\n let current: NavigationInstruction = this;\n do {\n let currentParams = Object.assign({}, current.params);\n if (current.config && current.config.hasChildRouter) {\n // remove the param for the injected child route segment\n delete currentParams[current.getWildCardName()];\n }\n\n ancestorParams.unshift(currentParams);\n current = current.parentInstruction;\n } while (current);\n\n let allParams = Object.assign({}, this.queryParams, ...ancestorParams);\n this.lifecycleArgs = [allParams, this.config, this];\n }\n\n /**\n * Gets an array containing this instruction and all child instructions for the current navigation.\n */\n getAllInstructions(): Array<NavigationInstruction> {\n let instructions: NavigationInstruction[] = [this];\n let viewPortInstructions: Record<string, ViewPortInstruction> = this.viewPortInstructions;\n\n for (let key in viewPortInstructions) {\n let childInstruction = viewPortInstructions[key].childNavigationInstruction;\n if (childInstruction) {\n instructions.push(...childInstruction.getAllInstructions());\n }\n }\n\n return instructions;\n }\n\n /**\n * Gets an array containing the instruction and all child instructions for the previous navigation.\n * Previous instructions are no longer available after navigation completes.\n */\n getAllPreviousInstructions(): Array<NavigationInstruction> {\n return this.getAllInstructions().map(c => c.previousInstruction).filter(c => c);\n }\n\n /**\n * Adds a viewPort instruction. Returns the newly created instruction based on parameters\n */\n addViewPortInstruction(initOptions: ViewPortInstructionInit): /*ViewPortInstruction*/ any;\n addViewPortInstruction(viewPortName: string, strategy: ActivationStrategyType, moduleId: string, component: any): /*ViewPortInstruction*/ any;\n addViewPortInstruction(\n nameOrInitOptions: string | ViewPortInstructionInit,\n strategy?: ActivationStrategyType,\n moduleId?: string,\n component?: any\n ): /*ViewPortInstruction*/ any {\n\n let viewPortInstruction: ViewPortInstruction;\n let viewPortName = typeof nameOrInitOptions === 'string' ? nameOrInitOptions : nameOrInitOptions.name;\n const lifecycleArgs = this.lifecycleArgs;\n const config: RouteConfig = Object.assign({}, lifecycleArgs[1], { currentViewPort: viewPortName });\n\n if (typeof nameOrInitOptions === 'string') {\n viewPortInstruction = {\n name: nameOrInitOptions,\n strategy: strategy,\n moduleId: moduleId,\n component: component,\n childRouter: component.childRouter,\n lifecycleArgs: [lifecycleArgs[0], config, lifecycleArgs[2]] as LifecycleArguments\n };\n } else {\n viewPortInstruction = {\n name: viewPortName,\n strategy: nameOrInitOptions.strategy,\n component: nameOrInitOptions.component,\n moduleId: nameOrInitOptions.moduleId,\n childRouter: nameOrInitOptions.component.childRouter,\n lifecycleArgs: [lifecycleArgs[0], config, lifecycleArgs[2]] as LifecycleArguments\n };\n }\n\n return this.viewPortInstructions[viewPortName] = viewPortInstruction;\n }\n\n /**\n * Gets the name of the route pattern's wildcard parameter, if applicable.\n */\n getWildCardName(): string {\n // todo: potential issue, or at least unsafe typings\n let configRoute = this.config.route as string;\n let wildcardIndex = configRoute.lastIndexOf('*');\n return configRoute.substr(wildcardIndex + 1);\n }\n\n /**\n * Gets the path and query string created by filling the route\n * pattern's wildcard parameter with the matching param.\n */\n getWildcardPath(): string {\n let wildcardName = this.getWildCardName();\n let path = this.params[wildcardName] || '';\n let queryString = this.queryString;\n\n if (queryString) {\n path += '?' + queryString;\n }\n\n return path;\n }\n\n /**\n * Gets the instruction's base URL, accounting for wildcard route parameters.\n */\n getBaseUrl(): string {\n let $encodeURI = encodeURI;\n let fragment = decodeURI(this.fragment);\n\n if (fragment === '') {\n let nonEmptyRoute = this.router.routes.find(route => {\n return route.name === this.config.name &&\n route.route !== '';\n });\n if (nonEmptyRoute) {\n fragment = nonEmptyRoute.route as any;\n }\n }\n\n if (!this.params) {\n return $encodeURI(fragment);\n }\n\n let wildcardName = this.getWildCardName();\n let path = this.params[wildcardName] || '';\n\n if (!path) {\n return $encodeURI(fragment);\n }\n\n return $encodeURI(fragment.substr(0, fragment.lastIndexOf(path)));\n }\n\n /**\n * Finalize a viewport instruction\n * @internal\n */\n _commitChanges(waitToSwap: boolean): Promise<void> {\n let router = this.router;\n router.currentInstruction = this;\n\n const previousInstruction = this.previousInstruction;\n if (previousInstruction) {\n previousInstruction.config.navModel.isActive = false;\n }\n\n this.config.navModel.isActive = true;\n\n router.refreshNavigation();\n\n let loads: Promise<void>[] = [];\n let delaySwaps: ISwapPlan[] = [];\n let viewPortInstructions: Record<string, ViewPortInstruction> = this.viewPortInstructions;\n\n for (let viewPortName in viewPortInstructions) {\n let viewPortInstruction = viewPortInstructions[viewPortName];\n let viewPort = router.viewPorts[viewPortName];\n\n if (!viewPort) {\n throw new Error(`There was no router-view found in the view for ${viewPortInstruction.moduleId}.`);\n }\n\n let childNavInstruction = viewPortInstruction.childNavigationInstruction;\n if (viewPortInstruction.strategy === InternalActivationStrategy.Replace) {\n if (childNavInstruction && childNavInstruction.parentCatchHandler) {\n loads.push(childNavInstruction._commitChanges(waitToSwap));\n } else {\n if (waitToSwap) {\n delaySwaps.push({ viewPort, viewPortInstruction });\n }\n loads.push(\n viewPort\n .process(viewPortInstruction, waitToSwap)\n .then(() => childNavInstruction\n ? childNavInstruction._commitChanges(waitToSwap)\n : Promise.resolve()\n )\n );\n }\n } else {\n if (childNavInstruction) {\n loads.push(childNavInstruction._commitChanges(waitToSwap));\n }\n }\n }\n\n return Promise\n .all(loads)\n .then(() => {\n delaySwaps.forEach(x => x.viewPort.swap(x.viewPortInstruction));\n return null;\n })\n .then(() => prune(this));\n }\n\n /**@internal */\n _updateTitle(): void {\n let router = this.router;\n let title = this._buildTitle(router.titleSeparator);\n if (title) {\n router.history.setTitle(title);\n }\n }\n\n /**@internal */\n _buildTitle(separator: string = ' | '): string {\n let title = '';\n let childTitles = [];\n let navModelTitle = this.config.navModel.title;\n let instructionRouter = this.router;\n let viewPortInstructions: Record<string, ViewPortInstruction> = this.viewPortInstructions;\n\n if (navModelTitle) {\n title = instructionRouter.transformTitle(navModelTitle);\n }\n\n for (let viewPortName in viewPortInstructions) {\n let viewPortInstruction = viewPortInstructions[viewPortName];\n let child_nav_instruction = viewPortInstruction.childNavigationInstruction;\n\n if (child_nav_instruction) {\n let childTitle = child_nav_instruction._buildTitle(separator);\n if (childTitle) {\n childTitles.push(childTitle);\n }\n }\n }\n\n if (childTitles.length) {\n title = childTitles.join(separator) + (title ? separator : '') + title;\n }\n\n if (instructionRouter.title) {\n title += (title ? separator : '') + instructionRouter.transformTitle(instructionRouter.title);\n }\n\n return title;\n }\n}\n\nconst prune = (instruction: NavigationInstruction): void => {\n instruction.previousInstruction = null;\n instruction.plan = null;\n};\n\ninterface ISwapPlan {\n viewPort: ViewPort;\n viewPortInstruction: ViewPortInstruction;\n}\n","import { Router } from './router';\nimport { RouteConfig } from './interfaces';\n\n/**\n* Class for storing and interacting with a route's navigation settings.\n*/\nexport class NavModel {\n\n /**\n * True if this nav item is currently active.\n */\n isActive: boolean = false;\n\n /**\n * The title.\n */\n title: string = null;\n\n /**\n * This nav item's absolute href.\n */\n href: string = null;\n\n /**\n * This nav item's relative href.\n */\n relativeHref: string = null;\n\n /**\n * Data attached to the route at configuration time.\n */\n settings: any = {};\n\n /**\n * The route config.\n */\n config: RouteConfig = null;\n\n /**\n * The router associated with this navigation model.\n */\n router: Router;\n\n order: number | boolean;\n\n constructor(router: Router, relativeHref: string) {\n this.router = router;\n this.relativeHref = relativeHref;\n }\n\n /**\n * Sets the route's title and updates document.title.\n * If the a navigation is in progress, the change will be applied\n * to document.title when the navigation completes.\n *\n * @param title The new title.\n */\n setTitle(title: string): void {\n this.title = title;\n\n if (this.isActive) {\n this.router.updateTitle();\n }\n }\n}\n","import { RouteConfig } from './interfaces';\n\nexport function _normalizeAbsolutePath(path: string, hasPushState: boolean, absolute: boolean = false) {\n if (!hasPushState && path[0] !== '#') {\n path = '#' + path;\n }\n\n if (hasPushState && absolute) {\n path = path.substring(1, path.length);\n }\n\n return path;\n}\n\nexport function _createRootedPath(fragment: string, baseUrl: string, hasPushState: boolean, absolute?: boolean) {\n if (isAbsoluteUrl.test(fragment)) {\n return fragment;\n }\n\n let path = '';\n\n if (baseUrl.length && baseUrl[0] !== '/') {\n path += '/';\n }\n\n path += baseUrl;\n\n if ((!path.length || path[path.length - 1] !== '/') && fragment[0] !== '/') {\n path += '/';\n }\n\n if (path.length && path[path.length - 1] === '/' && fragment[0] === '/') {\n path = path.substring(0, path.length - 1);\n }\n\n return _normalizeAbsolutePath(path + fragment, hasPushState, absolute);\n}\n\nexport function _resolveUrl(fragment: string, baseUrl: string, hasPushState?: boolean) {\n if (isRootedPath.test(fragment)) {\n return _normalizeAbsolutePath(fragment, hasPushState);\n }\n\n return _createRootedPath(fragment, baseUrl, hasPushState);\n}\n\nexport function _ensureArrayWithSingleRoutePerConfig(config: RouteConfig) {\n let routeConfigs = [];\n\n if (Array.isArray(config.route)) {\n for (let i = 0, ii = config.route.length; i < ii; ++i) {\n let current = Object.assign({}, config);\n current.route = config.route[i];\n routeConfigs.push(current);\n }\n } else {\n routeConfigs.push(Object.assign({}, config));\n }\n\n return routeConfigs;\n}\n\nconst isRootedPath = /^#?\\//;\nconst isAbsoluteUrl = /^([a-z][a-z0-9+\\-.]*:)?\\/\\//i;\n","import { RouteConfig, PipelineStep, RouteConfigSpecifier } from './interfaces';\nimport { _ensureArrayWithSingleRoutePerConfig } from './util';\nimport { Router } from './router';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { PipelineSlotName } from './pipeline-slot-name';\n\n/**\n * Class used to configure a [[Router]] instance.\n *\n * @constructor\n */\nexport class RouterConfiguration {\n instructions: Array<(router: Router) => void> = [];\n options: {\n [key: string]: any;\n compareQueryParams?: boolean;\n root?: string;\n pushState?: boolean;\n hashChange?: boolean;\n silent?: boolean;\n } = {};\n pipelineSteps: Array<{ name: string, step: Function | PipelineStep }> = [];\n title: string;\n titleSeparator: string;\n unknownRouteConfig: RouteConfigSpecifier;\n viewPortDefaults: Record<string, any>;\n\n /**@internal */\n _fallbackRoute: string;\n\n /**\n * Adds a step to be run during the [[Router]]'s navigation pipeline.\n *\n * @param name The name of the pipeline slot to insert the step into.\n * @param step The pipeline step.\n * @chainable\n */\n addPipelineStep(name: string, step: Function | PipelineStep): RouterConfiguration {\n if (step === null || step === undefined) {\n throw new Error('Pipeline step cannot be null or undefined.');\n }\n this.pipelineSteps.push({ name, step });\n return this;\n }\n\n /**\n * Adds a step to be run during the [[Router]]'s authorize pipeline slot.\n *\n * @param step The pipeline step.\n * @chainable\n */\n addAuthorizeStep(step: Function | PipelineStep): RouterConfiguration {\n return this.addPipelineStep(PipelineSlotName.Authorize, step);\n }\n\n /**\n * Adds a step to be run during the [[Router]]'s preActivate pipeline slot.\n *\n * @param step The pipeline step.\n * @chainable\n */\n addPreActivateStep(step: Function | PipelineStep): RouterConfiguration {\n return this.addPipelineStep(PipelineSlotName.PreActivate, step);\n }\n\n /**\n * Adds a step to be run during the [[Router]]'s preRender pipeline slot.\n *\n * @param step The pipeline step.\n * @chainable\n */\n addPreRenderStep(step: Function | PipelineStep): RouterConfiguration {\n return this.addPipelineStep(PipelineSlotName.PreRender, step);\n }\n\n /**\n * Adds a step to be run during the [[Router]]'s postRender pipeline slot.\n *\n * @param step The pipeline step.\n * @chainable\n */\n addPostRenderStep(step: Function | PipelineStep): RouterConfiguration {\n return this.addPipelineStep(PipelineSlotName.PostRender, step);\n }\n\n /**\n * Configures a route that will be used if there is no previous location available on navigation cancellation.\n *\n * @param fragment The URL fragment to use as the navigation destination.\n * @chainable\n */\n fallbackRoute(fragment: string): RouterConfiguration {\n this._fallbackRoute = fragment;\n return this;\n }\n\n /**\n * Maps one or more routes to be registered with the router.\n *\n * @param route The [[RouteConfig]] to map, or an array of [[RouteConfig]] to map.\n * @chainable\n */\n map(route: RouteConfig | RouteConfig[]): RouterConfiguration {\n if (Array.isArray(route)) {\n route.forEach(r => this.map(r));\n return this;\n }\n\n return this.mapRoute(route);\n }\n\n /**\n * Configures defaults to use for any view ports.\n *\n * @param viewPortConfig a view port configuration object to use as a\n * default, of the form { viewPortName: { moduleId } }.\n * @chainable\n */\n useViewPortDefaults(viewPortConfig: Record<string, { [key: string]: any; moduleId: string }>): RouterConfiguration {\n this.viewPortDefaults = viewPortConfig;\n return this;\n }\n\n /**\n * Maps a single route to be registered with the router.\n *\n * @param route The [[RouteConfig]] to map.\n * @chainable\n */\n mapRoute(config: RouteConfig): RouterConfiguration {\n this.instructions.push(router => {\n let routeConfigs = _ensureArrayWithSingleRoutePerConfig(config);\n\n let navModel;\n for (let i = 0, ii = routeConfigs.length; i < ii; ++i) {\n let routeConfig = routeConfigs[i];\n routeConfig.settings = routeConfig.settings || {};\n if (!navModel) {\n navModel = router.createNavModel(routeConfig);\n }\n\n router.addRoute(routeConfig, navModel);\n }\n });\n\n return this;\n }\n\n /**\n * Registers an unknown route handler to be run when the URL fragment doesn't match any registered routes.\n *\n * @param config A string containing a moduleId to load, or a [[RouteConfig]], or a function that takes the\n * [[NavigationInstruction]] and selects a moduleId to load.\n * @chainable\n */\n mapUnknownRoutes(config: RouteConfigSpecifier): RouterConfiguration {\n this.unknownRouteConfig = config;\n return this;\n }\n\n /**\n * Applies the current configuration to the specified [[Router]].\n *\n * @param router The [[Router]] to apply the configuration to.\n */\n exportToRouter(router: Router): void {\n let instructions = this.instructions;\n for (let i = 0, ii = instructions.length; i < ii; ++i) {\n instructions[i](router);\n }\n\n let { title, titleSeparator, unknownRouteConfig, _fallbackRoute, viewPortDefaults } = this;\n\n if (title) {\n router.title = title;\n }\n\n if (titleSeparator) {\n router.titleSeparator = titleSeparator;\n }\n\n if (unknownRouteConfig) {\n router.handleUnknownRoutes(unknownRouteConfig);\n }\n\n if (_fallbackRoute) {\n router.fallbackRoute = _fallbackRoute;\n }\n\n if (viewPortDefaults) {\n router.useViewPortDefaults(viewPortDefaults);\n }\n\n Object.assign(router.options, this.options);\n\n let pipelineSteps = this.pipelineSteps;\n let pipelineStepCount = pipelineSteps.length;\n if (pipelineStepCount) {\n if (!router.isRoot) {\n throw new Error('Pipeline steps can only be added to the root router');\n }\n\n let pipelineProvider = router.pipelineProvider;\n for (let i = 0, ii = pipelineStepCount; i < ii; ++i) {\n let { name, step } = pipelineSteps[i];\n pipelineProvider.addStep(name, step);\n }\n }\n }\n}\n","import { RouteRecognizer, RouteHandler, ConfigurableRoute, State, RecognizedRoute } from 'aurelia-route-recognizer';\nimport { Container } from 'aurelia-dependency-injection';\nimport { History, NavigationOptions } from 'aurelia-history';\nimport { NavigationInstruction, NavigationInstructionInit } from './navigation-instruction';\nimport { NavModel } from './nav-model';\nimport { RouterConfiguration } from './router-configuration';\nimport {\n _ensureArrayWithSingleRoutePerConfig,\n _normalizeAbsolutePath,\n _createRootedPath,\n _resolveUrl\n} from './util';\nimport { RouteConfig, RouteConfigSpecifier, ViewPortInstruction } from './interfaces';\nimport { PipelineProvider } from './pipeline-provider';\n\n/**@internal */\ndeclare module 'aurelia-history' {\n interface History {\n // This is wrong, as it's an implementation detail from aurelia-history-browser\n // but we are poking it in here so probably will need to make it official in `aurelia-history`\n /**\n * A private flag of Aurelia History implementation to indicate if push state should be used\n */\n _hasPushState: boolean;\n\n previousLocation: string;\n }\n}\n\n/**@internal */\ndeclare module 'aurelia-route-recognizer' {\n interface State {\n types: {\n dynamics: DynamicSegment;\n stars: StarSegment;\n };\n }\n\n interface RouteHandler {\n navigationStrategy?: (instruction: NavigationInstruction) => any;\n }\n\n interface RecognizedRoute {\n config?: RouteConfig;\n queryParams?: Record<string, any>;\n }\n}\n\ntype RouterConfigurationResolution = RouterConfiguration | ((cfg: RouterConfiguration) => void | RouterConfiguration | Promise<RouterConfiguration>);\n\n/**\n * The primary class responsible for handling routing and navigation.\n */\nexport class Router {\n\n /**\n * Container associated with this router. Also used to create child container for creating child router.\n */\n container: Container;\n\n /**\n * History instance of Aurelia abstract class for wrapping platform history global object\n */\n history: History;\n\n /**\n * A registry of registered viewport. Will be used to handle process navigation instruction route loading\n * and dom swapping\n */\n viewPorts: Record<string, any>;\n\n /**\n * List of route configs registered with this router\n */\n routes: RouteConfig[];\n\n /**\n * The [[Router]]'s current base URL, typically based on the [[Router.currentInstruction]].\n */\n baseUrl: string;\n\n /**\n * If defined, used in generation of document title for [[Router]]'s routes.\n */\n title: string | undefined;\n\n /**\n * The separator used in the document title between [[Router]]'s routes.\n */\n titleSeparator: string | undefined;\n\n /**\n * True if the [[Router]] has been configured.\n */\n isConfigured: boolean;\n\n /**\n * True if the [[Router]] is currently processing a navigation.\n */\n isNavigating: boolean;\n\n /**\n * True if the [[Router]] is navigating due to explicit call to navigate function(s).\n */\n isExplicitNavigation: boolean;\n\n /**\n * True if the [[Router]] is navigating due to explicit call to navigateBack function.\n */\n isExplicitNavigationBack: boolean;\n\n /**\n * True if the [[Router]] is navigating into the app for the first time in the browser session.\n */\n isNavigatingFirst: boolean;\n\n /**\n * True if the [[Router]] is navigating to a page instance not in the browser session history.\n */\n isNavigatingNew: boolean;\n\n /**\n * True if the [[Router]] is navigating forward in the browser session history.\n */\n isNavigatingForward: boolean;\n\n /**\n * True if the [[Router]] is navigating back in the browser session history.\n */\n isNavigatingBack: boolean;\n\n /**\n * True if the [[Router]] is navigating due to a browser refresh.\n */\n isNavigatingRefresh: boolean;\n\n /**\n * True if the previous instruction successfully completed the CanDeactivatePreviousStep in the current navigation.\n */\n couldDeactivate: boolean;\n\n /**\n * The currently active navigation tracker.\n */\n currentNavigationTracker: number;\n\n /**\n * The navigation models for routes that specified [[RouteConfig.nav]].\n */\n navigation: NavModel[];\n\n /**\n * The currently active navigation instruction.\n */\n currentInstruction: NavigationInstruction;\n\n /**\n * The parent router, or null if this instance is not a child router.\n */\n parent: Router = null;\n\n options: any = {};\n\n /**\n * The defaults used when a viewport lacks specified content\n */\n viewPortDefaults: Record<string, any> = {};\n\n /**@internal */\n catchAllHandler: (instruction: NavigationInstruction) => NavigationInstruction | Promise<NavigationInstruction>;\n /**@internal */\n fallbackRoute: string;\n /**@internal */\n pipelineProvider: PipelineProvider;\n /**@internal */\n _fallbackOrder: number;\n /**@internal */\n _recognizer: RouteRecognizer;\n /**@internal */\n _childRecognizer: RouteRecognizer;\n /**@internal */\n _configuredPromise: Promise<any>;\n /**@internal */\n _resolveConfiguredPromise: (value?: any) => void;\n\n /**\n * Extension point to transform the document title before it is built and displayed.\n * By default, child routers delegate to the parent router, and the app router\n * returns the title unchanged.\n */\n transformTitle: (title: string) => string = (title: string) => {\n if (this.parent) {\n return this.parent.transformTitle(title);\n }\n return title;\n }\n\n /**\n * @param container The [[Container]] to use when child routers.\n * @param history The [[History]] implementation to delegate navigation requests to.\n */\n constructor(container: Container, history: History) {\n this.container = container;\n this.history = history;\n this.reset();\n }\n\n /**\n * Fully resets the router's internal state. Primarily used internally by the framework when multiple calls to setRoot are made.\n * Use with caution (actually, avoid using this). Do not use this to simply change your navigation model.\n */\n reset() {\n this.viewPorts = {};\n this.routes = [];\n this.baseUrl = '';\n this.isConfigured = false;\n this.isNavigating = false;\n this.isExplicitNavigation = false;\n this.isExplicitNavigationBack = false;\n this.isNavigatingFirst = false;\n this.isNavigatingNew = false;\n this.isNavigatingRefresh = false;\n this.isNavigatingForward = false;\n this.isNavigatingBack = false;\n this.couldDeactivate = false;\n this.navigation = [];\n this.currentInstruction = null;\n this.viewPortDefaults = {};\n this._fallbackOrder = 100;\n this._recognizer = new RouteRecognizer();\n this._childRecognizer = new RouteRecognizer();\n this._configuredPromise = new Promise(resolve => {\n this._resolveConfiguredPromise = resolve;\n });\n }\n\n /**\n * Gets a value indicating whether or not this [[Router]] is the root in the router tree. I.e., it has no parent.\n */\n get isRoot(): boolean {\n return !this.parent;\n }\n\n /**\n * Registers a viewPort to be used as a rendering target for activated routes.\n *\n * @param viewPort The viewPort.\n * @param name The name of the viewPort. 'default' if unspecified.\n */\n registerViewPort(viewPort: /*ViewPort*/any, name?: string): void {\n name = name || 'default';\n this.viewPorts[name] = viewPort;\n }\n\n /**\n * Returns a Promise that resolves when the router is configured.\n */\n ensureConfigured(): Promise<void> {\n return this._configuredPromise;\n }\n\n /**\n * Configures the router.\n *\n * @param callbackOrConfig The [[RouterConfiguration]] or a callback that takes a [[RouterConfiguration]].\n */\n configure(callbackOrConfig: RouterConfiguration | ((config: RouterConfiguration) => RouterConfiguration)): Promise<void> {\n this.isConfigured = true;\n\n let result: RouterConfigurationResolution = callbackOrConfig as RouterConfiguration;\n let config: RouterConfiguration;\n if (typeof callbackOrConfig === 'function') {\n config = new RouterConfiguration();\n result = callbackOrConfig(config);\n }\n\n return Promise\n .resolve(result)\n .then((c) => {\n if (c && (c as RouterConfiguration).exportToRouter) {\n config = c;\n }\n\n config.exportToRouter(this);\n this.isConfigured = true;\n this._resolveConfiguredPromise();\n });\n }\n\n /**\n * Navigates to a new location.\n *\n * @param fragment The URL fragment to use as the navigation destination.\n * @param options The navigation options.\n */\n navigate(fragment: string, options?: NavigationOptions): boolean {\n if (!this.isConfigured && this.parent) {\n return this.parent.navigate(fragment, options);\n }\n\n this.isExplicitNavigation = true;\n return this.history.navigate(_resolveUrl(fragment, this.baseUrl, this.history._hasPushState), options);\n }\n\n /**\n * Navigates to a new location corresponding to the route and params specified. Equivallent to [[Router.generate]] followed\n * by [[Router.navigate]].\n *\n * @param route The name of the route to use when generating the navigation location.\n * @param params The route parameters to be used when populating the route pattern.\n * @param options The navigation options.\n */\n navigateToRoute(route: string, params?: any, options?: NavigationOptions): boolean {\n let path = this.generate(route, params);\n return this.navigate(path, options);\n }\n\n /**\n * Navigates back to the most recent location in history.\n */\n navigateBack(): void {\n this.isExplicitNavigationBack = true;\n this.history.navigateBack();\n }\n\n /**\n * Creates a child router of the current router.\n *\n * @param container The [[Container]] to provide to the child router. Uses the current [[Router]]'s [[Container]] if unspecified.\n * @returns {Router} The new child Router.\n */\n createChild(container?: Container): Router {\n let childRouter = new Router(container || this.container.createChild(), this.history);\n childRouter.parent = this;\n return childRouter;\n }\n\n /**\n * Generates a URL fragment matching the specified route pattern.\n *\n * @param name The name of the route whose pattern should be used to generate the fragment.\n * @param params The route params to be used to populate the route pattern.\n * @param options If options.absolute = true, then absolute url will be generated; otherwise, it will be relative url.\n * @returns {string} A string containing the generated URL fragment.\n */\n generate(nameOrRoute: string | RouteConfig, params: any = {}, options: any = {}): string {\n // A child recognizer generates routes for potential child routes. Any potential child route is added\n // to the childRoute property of params for the childRouter to recognize. When generating routes, we\n // use the childRecognizer when childRoute params are available to generate a child router enabled route.\n let recognizer = 'childRoute' in params ? this._childRecognizer : this._recognizer;\n let hasRoute = recognizer.hasRoute(nameOrRoute as string | RouteHandler);\n if (!hasRoute) {\n if (this.parent) {\n return this.parent.generate(nameOrRoute, params, options);\n }\n throw new Error(`A route with name '${nameOrRoute}' could not be found. Check that \\`name: '${nameOrRoute}'\\` was specified in the route's config.`);\n }\n let path = recognizer.generate(nameOrRoute as string | RouteHandler, params);\n let rootedPath = _createRootedPath(path, this.baseUrl, this.history._hasPushState, options.absolute);\n return options.absolute ? `${this.history.getAbsoluteRoot()}${rootedPath}` : rootedPath;\n }\n\n /**\n * Creates a [[NavModel]] for the specified route config.\n *\n * @param config The route config.\n */\n createNavModel(config: RouteConfig): NavModel {\n let navModel = new NavModel(\n this,\n 'href' in config\n ? config.href\n // potential error when config.route is a string[] ?\n : config.route as string);\n navModel.title = config.title;\n navModel.order = config.nav;\n navModel.href = config.href;\n navModel.settings = config.settings;\n navModel.config = config;\n\n return navModel;\n }\n\n /**\n * Registers a new route with the router.\n *\n * @param config The [[RouteConfig]].\n * @param navModel The [[NavModel]] to use for the route. May be omitted for single-pattern routes.\n */\n addRoute(config: RouteConfig, navModel?: NavModel): void {\n if (Array.isArray(config.route)) {\n let routeConfigs = _ensureArrayWithSingleRoutePerConfig(config);\n // the following is wrong. todo: fix this after TS refactoring release\n routeConfigs.forEach(this.addRoute.bind(this));\n return;\n }\n\n validateRouteConfig(config);\n\n if (!('viewPorts' in config) && !config.navigationStrategy) {\n config.viewPorts = {\n 'default': {\n moduleId: config.moduleId,\n view: config.view\n }\n };\n }\n\n if (!navModel) {\n navModel = this.createNavModel(config);\n }\n\n this.routes.push(config);\n\n let path = config.route;\n if (path.charAt(0) === '/') {\n path = path.substr(1);\n }\n let caseSensitive = config.caseSensitive === true;\n let state: State = this._recognizer.add({\n path: path,\n handler: config as RouteHandler,\n caseSensitive: caseSensitive\n } as ConfigurableRoute);\n\n if (path) {\n let settings = config.settings;\n delete config.settings;\n let withChild = JSON.parse(JSON.stringify(config));\n config.settings = settings;\n withChild.route = `${path}/*childRoute`;\n withChild.hasChildRouter = true;\n this._childRecognizer.add({\n path: withChild.route,\n handler: withChild,\n caseSensitive: caseSensitive\n });\n\n withChild.navModel = navModel;\n withChild.settings = config.settings;\n withChild.navigationStrategy = config.navigationStrategy;\n }\n\n config.navModel = navModel;\n\n let navigation = this.navigation;\n\n if ((navModel.order || navModel.order === 0) && navigation.indexOf(navModel) === -1) {\n if ((!navModel.href && navModel.href !== '') && (state.types.dynamics || state.types.stars)) {\n throw new Error('Invalid route config for \"' + config.route + '\" : dynamic routes must specify an \"href:\" to be included in the navigation model.');\n }\n\n if (typeof navModel.order !== 'number') {\n navModel.order = ++this._fallbackOrder;\n }\n\n navigation.push(navModel);\n // this is a potential error / inconsistency between browsers\n //\n // MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort\n // If compareFunction(a, b) returns 0, leave a and b unchanged with respect to each other,\n // but sorted with respect to all different elements.\n // Note: the ECMAscript standard does not guarantee this behaviour,\n // and thus not all browsers (e.g. Mozilla versions dating back to at least 2003) respect this.\n navigation.sort((a, b) => <any>a.order - <any>b.order);\n }\n }\n\n /**\n * Gets a value indicating whether or not this [[Router]] or one of its ancestors has a route registered with the specified name.\n *\n * @param name The name of the route to check.\n */\n hasRoute(name: string): boolean {\n return !!(this._recognizer.hasRoute(name) || this.parent && this.parent.hasRoute(name));\n }\n\n /**\n * Gets a value indicating whether or not this [[Router]] has a route registered with the specified name.\n *\n * @param name The name of the route to check.\n */\n hasOwnRoute(name: string): boolean {\n return this._recognizer.hasRoute(name);\n }\n\n /**\n * Register a handler to use when the incoming URL fragment doesn't match any registered routes.\n *\n * @param config The moduleId, or a function that selects the moduleId, or a [[RouteConfig]].\n */\n handleUnknownRoutes(config?: RouteConfigSpecifier): void {\n if (!config) {\n throw new Error('Invalid unknown route handler');\n }\n\n this.catchAllHandler = instruction => {\n return this\n ._createRouteConfig(config, instruction)\n .then(c => {\n instruction.config = c;\n return instruction;\n });\n };\n }\n\n /**\n * Updates the document title using the current navigation instruction.\n */\n updateTitle(): void {\n let parentRouter = this.parent;\n if (parentRouter) {\n return parentRouter.updateTitle();\n }\n\n let currentInstruction = this.currentInstruction;\n if (currentInstruction) {\n currentInstruction._updateTitle();\n }\n return undefined;\n }\n\n /**\n * Updates the navigation routes with hrefs relative to the current location.\n * Note: This method will likely move to a plugin in a future release.\n */\n refreshNavigation(): void {\n let nav = this.navigation;\n\n for (let i = 0, length = nav.length; i < length; i++) {\n let current = nav[i];\n if (!current.config.href) {\n current.href = _createRootedPath(current.relativeHref, this.baseUrl, this.history._hasPushState);\n } else {\n current.href = _normalizeAbsolutePath(current.config.href, this.history._hasPushState);\n }\n }\n }\n\n /**\n * Sets the default configuration for the view ports. This specifies how to\n * populate a view port for which no module is specified. The default is\n * an empty view/view-model pair.\n */\n useViewPortDefaults($viewPortDefaults: Record<string, any>): void {\n // a workaround to have strong typings while not requiring to expose interface ViewPortInstruction\n let viewPortDefaults: Record<string, ViewPortInstruction> = $viewPortDefaults;\n for (let viewPortName in viewPortDefaults) {\n let viewPortConfig = viewPortDefaults[viewPortName];\n this.viewPortDefaults[viewPortName] = {\n moduleId: viewPortConfig.moduleId\n };\n }\n }\n\n /**@internal */\n _refreshBaseUrl(): void {\n let parentRouter = this.parent;\n if (parentRouter) {\n this.baseUrl = generateBaseUrl(parentRouter, parentRouter.currentInstruction);\n }\n }\n\n /**@internal */\n _createNavigationInstruction(url: string = '', parentInstruction: NavigationInstruction = null): Promise<NavigationInstruction> {\n let fragment = url;\n let queryString = '';\n\n let queryIndex = url.indexOf('?');\n if (queryIndex !== -1) {\n fragment = url.substr(0, queryIndex);\n queryString = url.substr(queryIndex + 1);\n }\n\n let urlRecognizationResults = this._recognizer.recognize(url) as IRouteRecognizationResults;\n if (!urlRecognizationResults || !urlRecognizationResults.length) {\n urlRecognizationResults = this._childRecognizer.recognize(url) as IRouteRecognizationResults;\n }\n\n let instructionInit: NavigationInstructionInit = {\n fragment,\n queryString,\n config: null,\n parentInstruction,\n previousInstruction: this.currentInstruction,\n router: this,\n options: {\n compareQueryParams: this.options.compareQueryParams\n }\n };\n\n let result: Promise<NavigationInstruction>;\n\n if (urlRecognizationResults && urlRecognizationResults.length) {\n let first = urlRecognizationResults[0];\n let instruction = new NavigationInstruction(Object.assign({}, instructionInit, {\n params: first.params,\n queryParams: first.queryParams || urlRecognizationResults.queryParams,\n config: first.config || first.handler\n }));\n\n if (typeof first.handler === 'function') {\n result = evaluateNavigationStrategy(instruction, first.handler, first);\n } else if (first.handler && typeof first.handler.navigationStrategy === 'function') {\n result = evaluateNavigationStrategy(instruction, first.handler.navigationStrategy, first.handler);\n } else {\n result = Promise.resolve(instruction);\n }\n } else if (this.catchAllHandler) {\n let instruction = new NavigationInstruction(Object.assign({}, instructionInit, {\n params: { path: fragment },\n queryParams: urlRecognizationResults ? urlRecognizationResults.queryParams : {},\n config: null // config will be created by the catchAllHandler\n }));\n\n result = evaluateNavigationStrategy(instruction, this.catchAllHandler);\n } else if (this.parent) {\n let router = this._parentCatchAllHandler(this.parent);\n\n if (router) {\n let newParentInstruction = this._findParentInstructionFromRouter(router, parentInstruction);\n\n let instruction = new NavigationInstruction(Object.assign({}, instructionInit, {\n params: { path: fragment },\n queryParams: urlRecognizationResults ? urlRecognizationResults.queryParams : {},\n router: router,\n parentInstruction: newParentInstruction,\n parentCatchHandler: true,\n config: null // config will be created by the chained parent catchAllHandler\n }));\n\n result = evaluateNavigationStrategy(instruction, router.catchAllHandler);\n }\n }\n\n if (result && parentInstruction) {\n this.baseUrl = generateBaseUrl(this.parent, parentInstruction);\n }\n\n return result || Promise.reject(new Error(`Route not found: ${url}`));\n }\n\n /**@internal */\n _findParentInstructionFromRouter(router: Router, instruction: NavigationInstruction): NavigationInstruction {\n if (instruction.router === router) {\n instruction.fragment = router.baseUrl; // need to change the fragment in case of a redirect instead of moduleId\n return instruction;\n } else if (instruction.parentInstruction) {\n return this._findParentInstructionFromRouter(router, instruction.parentInstruction);\n }\n return undefined;\n }\n\n /**@internal */\n _parentCatchAllHandler(router: Router): Router | false {\n if (router.catchAllHandler) {\n return router;\n } else if (router.parent) {\n return this._parentCatchAllHandler(router.parent);\n }\n return false;\n }\n\n /**\n * @internal\n */\n _createRouteConfig(config: RouteConfigSpecifier, instruction: NavigationInstruction): Promise<RouteConfig> {\n return Promise\n .resolve(config)\n .then((c: any) => {\n if (typeof c === 'string') {\n return { moduleId: c } as RouteConfig;\n } else if (typeof c === 'function') {\n return c(instruction);\n }\n\n return c;\n })\n // typing here could be either RouteConfig or RedirectConfig\n // but temporarily treat both as RouteConfig\n // todo: improve typings precision\n .then((c: string | RouteConfig) => typeof c === 'string' ? { moduleId: c } as RouteConfig : c)\n .then((c: RouteConfig) => {\n c.route = instruction.params.path;\n validateRouteConfig(c);\n\n if (!c.navModel) {\n c.navModel = this.createNavModel(c);\n }\n\n return c;\n });\n }\n}\n\n/* @internal exported for unit testing */\nexport const generateBaseUrl = (router: Router, instruction: NavigationInstruction): string => {\n return `${router.baseUrl || ''}${instruction.getBaseUrl() || ''}`;\n};\n\n/* @internal exported for unit testing */\nexport const validateRouteConfig = (config: RouteConfig): void => {\n if (typeof config !== 'object') {\n throw new Error('Invalid Route Config');\n }\n\n if (typeof config.route !== 'string') {\n let name = config.name || '(no name)';\n throw new Error('Invalid Route Config for \"' + name + '\": You must specify a \"route:\" pattern.');\n }\n\n if (!('redirect' in config || config.moduleId || config.navigationStrategy || config.viewPorts)) {\n throw new Error('Invalid Route Config for \"' + config.route + '\": You must specify a \"moduleId:\", \"redirect:\", \"navigationStrategy:\", or \"viewPorts:\".');\n }\n};\n\n/* @internal exported for unit testing */\nexport const evaluateNavigationStrategy = (\n instruction: NavigationInstruction,\n evaluator: Function,\n context?: any\n): Promise<NavigationInstruction> => {\n return Promise\n .resolve(evaluator.call(context, instruction))\n .then(() => {\n if (!('viewPorts' in instruction.config)) {\n instruction.config.viewPorts = {\n 'default': {\n moduleId: instruction.config.moduleId\n }\n };\n }\n\n return instruction;\n });\n};\n\ninterface IRouteRecognizationResults extends Array<RecognizedRoute> {\n queryParams: Record<string, any>;\n}\n","import { PipelineStatus } from './pipeline-status';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { Next, StepRunnerFunction, NextCompletionHandler } from './interfaces';\n\n/**@internal exported for unit testing */\nexport const createNextFn = (instruction: NavigationInstruction, steps: StepRunnerFunction[]): Next => {\n let index = -1;\n const next: Next = function() {\n index++;\n\n if (index < steps.length) {\n let currentStep = steps[index];\n\n try {\n return currentStep(instruction, next);\n } catch (e) {\n return next.reject(e);\n }\n } else {\n return next.complete();\n }\n } as Next;\n\n next.complete = createCompletionHandler(next, PipelineStatus.Completed);\n next.cancel = createCompletionHandler(next, PipelineStatus.Canceled);\n next.reject = createCompletionHandler(next, PipelineStatus.Rejected);\n\n return next;\n};\n\n/**@internal exported for unit testing */\nexport const createCompletionHandler = (next: Next, status: PipelineStatus): NextCompletionHandler => {\n return (output: any) => Promise\n .resolve({\n status,\n output,\n completed: status === PipelineStatus.Completed\n });\n};\n","import { PipelineStep, PipelineResult, Next, StepRunnerFunction, IPipelineSlot } from './interfaces';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { createNextFn } from './next';\n\n/**\n * The class responsible for managing and processing the navigation pipeline.\n */\nexport class Pipeline {\n /**\n * The pipeline steps. And steps added via addStep will be converted to a function\n * The actualy running functions with correct step contexts of this pipeline\n */\n steps: StepRunnerFunction[] = [];\n\n /**\n * Adds a step to the pipeline.\n *\n * @param step The pipeline step.\n */\n addStep(step: StepRunnerFunction | PipelineStep | IPipelineSlot): Pipeline {\n let run;\n\n if (typeof step === 'function') {\n run = step;\n } else if (typeof step.getSteps === 'function') {\n // getSteps is to enable support open slots\n // where devs can add multiple steps into the same slot name\n let steps = step.getSteps();\n for (let i = 0, l = steps.length; i < l; i++) {\n this.addStep(steps[i]);\n }\n\n return this;\n } else {\n run = (step as PipelineStep).run.bind(step);\n }\n\n this.steps.push(run);\n\n return this;\n }\n\n /**\n * Runs the pipeline.\n *\n * @param instruction The navigation instruction to process.\n */\n run(instruction: NavigationInstruction): Promise<PipelineResult> {\n const nextFn = createNextFn(instruction, this.steps);\n return nextFn();\n }\n}\n","import { NavigationOptions } from 'aurelia-history';\nimport { Router } from './router';\n\n/**@internal */\ndeclare module 'aurelia-history' {\n interface NavigationOptions {\n useAppRouter?: boolean;\n }\n}\n\n/**\n* When a navigation command is encountered, the current navigation\n* will be cancelled and control will be passed to the navigation\n* command so it can determine the correct action.\n*/\nexport interface NavigationCommand {\n navigate: (router: Router) => void;\n /**@internal */\n shouldContinueProcessing?: boolean;\n /**@internal */\n setRouter?: (router: Router) => void;\n}\n\n/**\n* Determines if the provided object is a navigation command.\n* A navigation command is anything with a navigate method.\n*\n* @param obj The object to check.\n*/\nexport function isNavigationCommand(obj: any): obj is NavigationCommand {\n return obj && typeof obj.navigate === 'function';\n}\n\n/**\n* Used during the activation lifecycle to cause a redirect.\n*/\nexport class Redirect implements NavigationCommand {\n\n url: string;\n /**@internal */\n options: NavigationOptions;\n /**@internal */\n shouldContinueProcessing: boolean;\n\n private router: Router;\n\n /**\n * @param url The URL fragment to use as the navigation destination.\n * @param options The navigation options.\n */\n constructor(url: string, options: NavigationOptions = {}) {\n this.url = url;\n this.options = Object.assign({ trigger: true, replace: true }, options);\n this.shouldContinueProcessing = false;\n }\n\n /**\n * Called by the activation system to set the child router.\n *\n * @param router The router.\n */\n setRouter(router: Router): void {\n this.router = router;\n }\n\n /**\n * Called by the navigation pipeline to navigate.\n *\n * @param appRouter The router to be redirected.\n */\n navigate(appRouter: Router): void {\n let navigatingRouter = this.options.useAppRouter ? appRouter : (this.router || appRouter);\n navigatingRouter.navigate(this.url, this.options);\n }\n}\n\n/**\n * Used during the activation lifecycle to cause a redirect to a named route.\n */\nexport class RedirectToRoute implements NavigationCommand {\n\n route: string;\n params: any;\n /**@internal */\n options: NavigationOptions;\n\n /**@internal */\n shouldContinueProcessing: boolean;\n\n /**@internal */\n router: Router;\n\n /**\n * @param route The name of the route.\n * @param params The parameters to be sent to the activation method.\n * @param options The options to use for navigation.\n */\n constructor(route: string, params: any = {}, options: NavigationOptions = {}) {\n this.route = route;\n this.params = params;\n this.options = Object.assign({ trigger: true, replace: true }, options);\n this.shouldContinueProcessing = false;\n }\n\n /**\n * Called by the activation system to set the child router.\n *\n * @param router The router.\n */\n setRouter(router: Router): void {\n this.router = router;\n }\n\n /**\n * Called by the navigation pipeline to navigate.\n *\n * @param appRouter The router to be redirected.\n */\n navigate(appRouter: Router): void {\n let navigatingRouter = this.options.useAppRouter ? appRouter : (this.router || appRouter);\n navigatingRouter.navigateToRoute(this.route, this.params, this.options);\n }\n}\n","import { ViewPortPlan, ViewPortInstruction, RouteConfig, ViewPort } from './interfaces';\nimport { Redirect } from './navigation-commands';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { InternalActivationStrategy, ActivationStrategyType } from './activation-strategy';\n\ntype ViewPortPlansRecord = Record<string, ViewPortPlan>;\n\n/**\n * @internal exported for unit testing\n */\nexport function _buildNavigationPlan(\n instruction: NavigationInstruction,\n forceLifecycleMinimum?: boolean\n): Promise<ViewPortPlansRecord | Redirect> {\n let config = instruction.config;\n\n if ('redirect' in config) {\n return buildRedirectPlan(instruction);\n }\n\n const prevInstruction = instruction.previousInstruction;\n const defaultViewPortConfigs = instruction.router.viewPortDefaults;\n\n if (prevInstruction) {\n return buildTransitionPlans(instruction, prevInstruction, defaultViewPortConfigs, forceLifecycleMinimum);\n }\n\n // first navigation, only need to prepare a few information for each viewport plan\n const viewPortPlans: ViewPortPlansRecord = {};\n let viewPortConfigs = config.viewPorts;\n for (let viewPortName in viewPortConfigs) {\n let viewPortConfig = viewPortConfigs[viewPortName];\n if (viewPortConfig.moduleId === null && viewPortName in defaultViewPortConfigs) {\n viewPortConfig = defaultViewPortConfigs[viewPortName];\n }\n viewPortPlans[viewPortName] = {\n name: viewPortName,\n strategy: InternalActivationStrategy.Replace,\n config: viewPortConfig\n };\n }\n\n return Promise.resolve(viewPortPlans);\n}\n\n/**\n * Build redirect plan based on config of a navigation instruction\n * @internal exported for unit testing\n */\nexport const buildRedirectPlan = (instruction: NavigationInstruction) => {\n const config = instruction.config;\n const router = instruction.router;\n return router\n ._createNavigationInstruction(config.redirect)\n .then(redirectInstruction => {\n\n const params: Record<string, any> = {};\n const originalInstructionParams = instruction.params;\n const redirectInstructionParams = redirectInstruction.params;\n\n for (let key in redirectInstructionParams) {\n // If the param on the redirect points to another param, e.g. { route: first/:this, redirect: second/:this }\n let val = redirectInstructionParams[key];\n if (typeof val === 'string' && val[0] === ':') {\n val = val.slice(1);\n // And if that param is found on the original instruction then use it\n if (val in originalInstructionParams) {\n params[key] = originalInstructionParams[val];\n }\n } else {\n params[key] = redirectInstructionParams[key];\n }\n }\n let redirectLocation = router.generate(redirectInstruction.config, params, instruction.options);\n\n // Special handling for child routes\n for (let key in originalInstructionParams) {\n redirectLocation = redirectLocation.replace(`:${key}`, originalInstructionParams[key]);\n }\n\n let queryString = instruction.queryString;\n if (queryString) {\n redirectLocation += '?' + queryString;\n }\n\n return Promise.resolve(new Redirect(redirectLocation));\n });\n};\n\n/**\n * @param viewPortPlans the Plan record that holds information about built plans\n * @internal exported for unit testing\n */\nexport const buildTransitionPlans = (\n currentInstruction: NavigationInstruction,\n previousInstruction: NavigationInstruction,\n defaultViewPortConfigs: Record<string, ViewPortInstruction>,\n forceLifecycleMinimum?: boolean\n): Promise<ViewPortPlansRecord> => {\n\n let viewPortPlans: ViewPortPlansRecord = {};\n let newInstructionConfig = currentInstruction.config;\n let hasNewParams = hasDifferentParameterValues(previousInstruction, currentInstruction);\n let pending: Promise<void>[] = [];\n let previousViewPortInstructions = previousInstruction.viewPortInstructions as Record<string, ViewPortInstruction>;\n\n for (let viewPortName in previousViewPortInstructions) {\n\n const prevViewPortInstruction = previousViewPortInstructions[viewPortName];\n const prevViewPortComponent = prevViewPortInstruction.component;\n const newInstructionViewPortConfigs = newInstructionConfig.viewPorts as Record<string, RouteConfig>;\n\n // if this is invoked on a viewport without any changes, based on new url,\n // newViewPortConfig will be the existing viewport instruction\n let nextViewPortConfig = viewPortName in newInstructionViewPortConfigs\n ? newInstructionViewPortConfigs[viewPortName]\n : prevViewPortInstruction;\n\n if (nextViewPortConfig.moduleId === null && viewPortName in defaultViewPortConfigs) {\n nextViewPortConfig = defaultViewPortConfigs[viewPortName];\n }\n\n const viewPortActivationStrategy = determineActivationStrategy(\n currentInstruction,\n prevViewPortInstruction,\n nextViewPortConfig,\n hasNewParams,\n forceLifecycleMinimum\n );\n const viewPortPlan = viewPortPlans[viewPortName] = {\n name: viewPortName,\n // ViewPortInstruction can quack like a RouteConfig\n config: nextViewPortConfig as RouteConfig,\n prevComponent: prevViewPortComponent,\n prevModuleId: prevViewPortInstruction.moduleId,\n strategy: viewPortActivationStrategy\n } as ViewPortPlan;\n\n // recursively build nav plans for all existing child routers/viewports of this viewport\n // this is possible because existing child viewports and routers already have necessary information\n // to process the wildcard path from parent instruction\n if (viewPortActivationStrategy !== InternalActivationStrategy.Replace && prevViewPortInstruction.childRouter) {\n const path = currentInstruction.getWildcardPath();\n const task: Promise<void> = prevViewPortInstruction\n .childRouter\n ._createNavigationInstruction(path, currentInstruction)\n .then((childInstruction: NavigationInstruction) => {\n viewPortPlan.childNavigationInstruction = childInstruction;\n\n return _buildNavigationPlan(\n childInstruction,\n // is it safe to assume viewPortPlan has not been changed from previous assignment?\n // if so, can just use local variable viewPortPlanStrategy\n // there could be user code modifying viewport plan during _createNavigationInstruction?\n viewPortPlan.strategy === InternalActivationStrategy.InvokeLifecycle\n )\n .then(childPlan => {\n if (childPlan instanceof Redirect) {\n return Promise.reject(childPlan);\n }\n childInstruction.plan = childPlan;\n // for bluebird ?\n return null;\n });\n });\n\n pending.push(task);\n }\n }\n\n return Promise.all(pending).then(() => viewPortPlans);\n};\n\n/**\n * @param newViewPortConfig if this is invoked on a viewport without any changes, based on new url, newViewPortConfig will be the existing viewport instruction\n * @internal exported for unit testing\n */\nexport const determineActivationStrategy = (\n currentNavInstruction: NavigationInstruction,\n prevViewPortInstruction: ViewPortInstruction,\n newViewPortConfig: RouteConfig | ViewPortInstruction,\n // indicates whether there is difference between old and new url params\n hasNewParams: boolean,\n forceLifecycleMinimum?: boolean\n): ActivationStrategyType => {\n\n let newInstructionConfig = currentNavInstruction.config;\n let prevViewPortViewModel = prevViewPortInstruction.component.viewModel;\n let viewPortPlanStrategy: ActivationStrategyType;\n\n if (prevViewPortInstruction.moduleId !== newViewPortConfig.moduleId) {\n viewPortPlanStrategy = InternalActivationStrategy.Replace;\n } else if ('determineActivationStrategy' in prevViewPortViewModel) {\n viewPortPlanStrategy = prevViewPortViewModel.determineActivationStrategy(...currentNavInstruction.lifecycleArgs);\n } else if (newInstructionConfig.activationStrategy) {\n viewPortPlanStrategy = newInstructionConfig.activationStrategy;\n } else if (hasNewParams || forceLifecycleMinimum) {\n viewPortPlanStrategy = InternalActivationStrategy.InvokeLifecycle;\n } else {\n viewPortPlanStrategy = InternalActivationStrategy.NoChange;\n }\n return viewPortPlanStrategy;\n};\n\n/**@internal exported for unit testing */\nexport const hasDifferentParameterValues = (prev: NavigationInstruction, next: NavigationInstruction): boolean => {\n let prevParams = prev.params;\n let nextParams = next.params;\n let nextWildCardName = next.config.hasChildRouter ? next.getWildCardName() : null;\n\n for (let key in nextParams) {\n if (key === nextWildCardName) {\n continue;\n }\n\n if (prevParams[key] !== nextParams[key]) {\n return true;\n }\n }\n\n for (let key in prevParams) {\n if (key === nextWildCardName) {\n continue;\n }\n\n if (prevParams[key] !== nextParams[key]) {\n return true;\n }\n }\n\n if (!next.options.compareQueryParams) {\n return false;\n }\n\n let prevQueryParams = prev.queryParams;\n let nextQueryParams = next.queryParams;\n for (let key in nextQueryParams) {\n if (prevQueryParams[key] !== nextQueryParams[key]) {\n return true;\n }\n }\n\n for (let key in prevQueryParams) {\n if (prevQueryParams[key] !== nextQueryParams[key]) {\n return true;\n }\n }\n\n return false;\n};\n","import { Next } from './interfaces';\nimport { Redirect } from './navigation-commands';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { _buildNavigationPlan } from './navigation-plan';\n\n/**\n * Transform a navigation instruction into viewport plan record object,\n * or a redirect request if user viewmodel demands\n */\nexport class BuildNavigationPlanStep {\n run(navigationInstruction: NavigationInstruction, next: Next): Promise<any> {\n return _buildNavigationPlan(navigationInstruction)\n .then(plan => {\n if (plan instanceof Redirect) {\n return next.cancel(plan);\n }\n navigationInstruction.plan = plan;\n return next();\n })\n .catch(next.cancel);\n }\n}\n","import { RouteConfig, ViewPortComponent, ViewPortPlan, ViewPortInstruction } from './interfaces';\nimport { Redirect } from './navigation-commands';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { _buildNavigationPlan } from './navigation-plan';\nimport { InternalActivationStrategy } from './activation-strategy';\nimport { RouteLoader } from './route-loader';\n\n/**\n * Loading plan calculated based on a navigration-instruction and a viewport plan\n */\ninterface ILoadingPlan {\n viewPortPlan: ViewPortPlan;\n navigationInstruction: NavigationInstruction;\n}\n\n/**\n * @internal Exported for unit testing\n */\nexport const loadNewRoute = (\n routeLoader: RouteLoader,\n navigationInstruction: NavigationInstruction\n): Promise<any[] | void> => {\n let loadingPlans = determineLoadingPlans(navigationInstruction);\n let loadPromises = loadingPlans.map((loadingPlan: ILoadingPlan) => loadRoute(\n routeLoader,\n loadingPlan.navigationInstruction,\n loadingPlan.viewPortPlan\n ));\n\n return Promise.all(loadPromises);\n};\n\n/**\n * @internal Exported for unit testing\n */\nexport const determineLoadingPlans = (\n navigationInstruction: NavigationInstruction,\n loadingPlans: ILoadingPlan[] = []\n): ILoadingPlan[] => {\n let viewPortPlans: Record<string, ViewPortPlan> = navigationInstruction.plan;\n\n for (let viewPortName in viewPortPlans) {\n let viewPortPlan = viewPortPlans[viewPortName];\n let childNavInstruction = viewPortPlan.childNavigationInstruction;\n\n if (viewPortPlan.strategy === InternalActivationStrategy.Replace) {\n loadingPlans.push({ viewPortPlan, navigationInstruction } as ILoadingPlan);\n\n if (childNavInstruction) {\n determineLoadingPlans(childNavInstruction, loadingPlans);\n }\n } else {\n let viewPortInstruction = navigationInstruction.addViewPortInstruction({\n name: viewPortName,\n strategy: viewPortPlan.strategy,\n moduleId: viewPortPlan.prevModuleId,\n component: viewPortPlan.prevComponent\n }) as ViewPortInstruction;\n\n if (childNavInstruction) {\n viewPortInstruction.childNavigationInstruction = childNavInstruction;\n determineLoadingPlans(childNavInstruction, loadingPlans);\n }\n }\n }\n\n return loadingPlans;\n};\n\n/**\n * @internal Exported for unit testing\n */\nexport const loadRoute = (\n routeLoader: RouteLoader,\n navigationInstruction: NavigationInstruction,\n viewPortPlan: ViewPortPlan\n): Promise<any> => {\n let planConfig = viewPortPlan.config;\n let moduleId = planConfig ? planConfig.moduleId : null;\n\n return loadComponent(routeLoader, navigationInstruction, planConfig)\n .then((component) => {\n let viewPortInstruction = navigationInstruction.addViewPortInstruction({\n name: viewPortPlan.name,\n strategy: viewPortPlan.strategy,\n moduleId: moduleId,\n component: component\n }) as ViewPortInstruction;\n\n let childRouter = component.childRouter;\n if (childRouter) {\n let path = navigationInstruction.getWildcardPath();\n\n return childRouter\n ._createNavigationInstruction(path, navigationInstruction)\n .then((childInstruction) => {\n viewPortPlan.childNavigationInstruction = childInstruction;\n\n return _buildNavigationPlan(childInstruction)\n .then((childPlan) => {\n if (childPlan instanceof Redirect) {\n return Promise.reject(childPlan);\n }\n childInstruction.plan = childPlan;\n viewPortInstruction.childNavigationInstruction = childInstruction;\n\n return loadNewRoute(routeLoader, childInstruction);\n });\n });\n }\n // ts complains without this, though they are same\n return void 0;\n });\n};\n\n/**\n * Load a routed-component based on navigation instruction and route config\n * @internal exported for unit testing only\n */\nexport const loadComponent = (\n routeLoader: RouteLoader,\n navigationInstruction: NavigationInstruction,\n config: RouteConfig\n): Promise<ViewPortComponent> => {\n let router = navigationInstruction.router;\n let lifecycleArgs = navigationInstruction.lifecycleArgs;\n\n return Promise.resolve()\n .then(() => routeLoader.loadRoute(router, config, navigationInstruction))\n .then(\n /**\n * @param component an object carrying information about loaded route\n * typically contains information about view model, childContainer, view and router\n */\n (component: ViewPortComponent) => {\n let { viewModel, childContainer } = component;\n component.router = router;\n component.config = config;\n\n if ('configureRouter' in viewModel) {\n let childRouter = childContainer.getChildRouter();\n component.childRouter = childRouter;\n\n return childRouter\n .configure(c => viewModel.configureRouter(c, childRouter, lifecycleArgs[0], lifecycleArgs[1], lifecycleArgs[2]))\n .then(() => component);\n }\n\n return component;\n }\n );\n};\n","import { RouteConfig } from './interfaces';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { Router } from './router';\n\n/**\n * Abstract class that is responsible for loading view / view model from a route config\n * The default implementation can be found in `aurelia-templating-router`\n */\nexport class RouteLoader {\n /**\n * Load a route config based on its viewmodel / view configuration\n */\n // return typing: return typings used to be never\n // as it was a throw. Changing it to Promise<any> should not cause any issues\n loadRoute(router: Router, config: RouteConfig, navigationInstruction: NavigationInstruction): Promise</*ViewPortInstruction*/any> {\n throw new Error('Route loaders must implement \"loadRoute(router, config, navigationInstruction)\".');\n }\n}\n","import { Next } from './interfaces';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { loadNewRoute } from './utilities-route-loading';\nimport { RouteLoader } from './route-loader';\n/**\n * A pipeline step responsible for loading a route config of a navigation instruction\n */\nexport class LoadRouteStep {\n /**@internal */\n static inject() { return [RouteLoader]; }\n /**\n * Route loader isntance that will handle loading route config\n * @internal\n */\n routeLoader: RouteLoader;\n constructor(routeLoader: RouteLoader) {\n this.routeLoader = routeLoader;\n }\n /**\n * Run the internal to load route config of a navigation instruction to prepare for next steps in the pipeline\n */\n run(navigationInstruction: NavigationInstruction, next: Next): Promise<any> {\n return loadNewRoute(this.routeLoader, navigationInstruction)\n .then(next, next.cancel);\n }\n}\n","import { NavigationInstruction } from './navigation-instruction';\n\n/**\n * A pipeline step for instructing a piepline to commit changes on a navigation instruction\n */\nexport class CommitChangesStep {\n run(navigationInstruction: NavigationInstruction, next: Function): Promise<any> {\n return navigationInstruction\n ._commitChanges(/*wait to swap?*/ true)\n .then(() => {\n navigationInstruction._updateTitle();\n return next();\n });\n }\n}\n","/**\n * An optional interface describing the available activation strategies.\n * @internal Used internally.\n */\nexport const enum InternalActivationStrategy {\n /**\n * Reuse the existing view model, without invoking Router lifecycle hooks.\n */\n NoChange = 'no-change',\n /**\n * Reuse the existing view model, invoking Router lifecycle hooks.\n */\n InvokeLifecycle = 'invoke-lifecycle',\n /**\n * Replace the existing view model, invoking Router lifecycle hooks.\n */\n Replace = 'replace'\n}\n\n/**\n * The strategy to use when activating modules during navigation.\n */\n// kept for compat reason\nexport const activationStrategy: ActivationStrategy = {\n noChange: InternalActivationStrategy.NoChange,\n invokeLifecycle: InternalActivationStrategy.InvokeLifecycle,\n replace: InternalActivationStrategy.Replace\n};\n\n/**\n * An optional interface describing the available activation strategies.\n */\nexport interface ActivationStrategy {\n /**\n * Reuse the existing view model, without invoking Router lifecycle hooks.\n */\n noChange: 'no-change';\n /**\n * Reuse the existing view model, invoking Router lifecycle hooks.\n */\n invokeLifecycle: 'invoke-lifecycle';\n /**\n * Replace the existing view model, invoking Router lifecycle hooks.\n */\n replace: 'replace';\n}\n\n/**\n * Enum like type for activation strategy built-in values\n */\nexport type ActivationStrategyType = ActivationStrategy[keyof ActivationStrategy];\n","import { Next, ViewPortComponent, ViewPortPlan, ViewPortInstruction, LifecycleArguments } from './interfaces';\nimport { isNavigationCommand } from './navigation-commands';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { activationStrategy } from './activation-strategy';\nimport { Router } from './router';\n\n/**\n * Recursively find list of deactivate-able view models\n * and invoke the either 'canDeactivate' or 'deactivate' on each\n * @internal exported for unit testing\n */\nexport const processDeactivatable = (\n navigationInstruction: NavigationInstruction,\n callbackName: 'canDeactivate' | 'deactivate',\n next: Next,\n ignoreResult?: boolean\n): Promise<any> => {\n let plan: Record<string, ViewPortPlan> = navigationInstruction.plan;\n let infos = findDeactivatable(plan, callbackName);\n let i = infos.length; // query from inside out\n\n function inspect(val: any): Promise<any> {\n if (ignoreResult || shouldContinue(val)) {\n return iterate();\n }\n\n return next.cancel(val);\n }\n\n function iterate(): Promise<any> {\n if (i--) {\n try {\n let viewModel = infos[i];\n let result = viewModel[callbackName](navigationInstruction);\n return processPotential(result, inspect, next.cancel);\n } catch (error) {\n return next.cancel(error);\n }\n }\n\n navigationInstruction.router.couldDeactivate = true;\n\n return next();\n }\n\n return iterate();\n};\n\n/**\n * Recursively find and returns a list of deactivate-able view models\n * @internal exported for unit testing\n */\nexport const findDeactivatable = (\n plan: Record<string, ViewPortPlan>,\n callbackName: string,\n list: IActivatableInfo[] = []\n): any[] => {\n for (let viewPortName in plan) {\n let viewPortPlan = plan[viewPortName];\n let prevComponent = viewPortPlan.prevComponent;\n\n if ((viewPortPlan.strategy === activationStrategy.invokeLifecycle || viewPortPlan.strategy === activationStrategy.replace)\n && prevComponent\n ) {\n let viewModel = prevComponent.viewModel;\n\n if (callbackName in viewModel) {\n list.push(viewModel);\n }\n }\n\n if (viewPortPlan.strategy === activationStrategy.replace && prevComponent) {\n addPreviousDeactivatable(prevComponent, callbackName, list);\n } else if (viewPortPlan.childNavigationInstruction) {\n findDeactivatable(viewPortPlan.childNavigationInstruction.plan, callbackName, list);\n }\n }\n\n return list;\n};\n\n/**\n * @internal exported for unit testing\n */\nexport const addPreviousDeactivatable = (\n component: ViewPortComponent,\n callbackName: string,\n list: IActivatableInfo[]\n): void => {\n let childRouter = component.childRouter;\n\n if (childRouter && childRouter.currentInstruction) {\n let viewPortInstructions = childRouter.currentInstruction.viewPortInstructions;\n\n for (let viewPortName in viewPortInstructions) {\n let viewPortInstruction = viewPortInstructions[viewPortName];\n let prevComponent = viewPortInstruction.component;\n let prevViewModel = prevComponent.viewModel;\n\n if (callbackName in prevViewModel) {\n list.push(prevViewModel);\n }\n\n addPreviousDeactivatable(prevComponent, callbackName, list);\n }\n }\n};\n\n/**\n * @internal exported for unit testing\n */\nexport const processActivatable = (\n navigationInstruction: NavigationInstruction,\n callbackName: 'canActivate' | 'activate',\n next: Next,\n ignoreResult?: boolean\n): Promise<any> => {\n let infos = findActivatable(navigationInstruction, callbackName);\n let length = infos.length;\n let i = -1; // query from top down\n\n function inspect(val: any, router: Router): Promise<any> {\n if (ignoreResult || shouldContinue(val, router)) {\n return iterate();\n }\n\n return next.cancel(val);\n }\n\n function iterate(): Promise<any> {\n i++;\n\n if (i < length) {\n try {\n let current = infos[i];\n let result = current.viewModel[callbackName](...current.lifecycleArgs);\n return processPotential(result, (val: any) => inspect(val, current.router), next.cancel);\n } catch (error) {\n return next.cancel(error);\n }\n }\n\n return next();\n }\n\n return iterate();\n};\n\ninterface IActivatableInfo {\n viewModel: any;\n lifecycleArgs: LifecycleArguments;\n router: Router;\n}\n\n/**\n * Find list of activatable view model and add to list (3rd parameter)\n * @internal exported for unit testing\n */\nexport const findActivatable = (\n navigationInstruction: NavigationInstruction,\n callbackName: 'canActivate' | 'activate',\n list: IActivatableInfo[] = [],\n router?: Router\n): IActivatableInfo[] => {\n let plan: Record<string, ViewPortPlan> = navigationInstruction.plan;\n\n Object\n .keys(plan)\n .forEach((viewPortName) => {\n let viewPortPlan = plan[viewPortName];\n let viewPortInstruction = navigationInstruction.viewPortInstructions[viewPortName] as ViewPortInstruction;\n let viewPortComponent = viewPortInstruction.component;\n let viewModel = viewPortComponent.viewModel;\n\n if (\n (viewPortPlan.strategy === activationStrategy.invokeLifecycle\n || viewPortPlan.strategy === activationStrategy.replace\n )\n && callbackName in viewModel\n ) {\n list.push({\n viewModel,\n lifecycleArgs: viewPortInstruction.lifecycleArgs,\n router\n });\n }\n\n let childNavInstruction = viewPortPlan.childNavigationInstruction;\n\n if (childNavInstruction) {\n findActivatable(\n childNavInstruction,\n callbackName,\n list,\n viewPortComponent.childRouter || router\n );\n }\n });\n\n return list;\n};\n\nconst shouldContinue = <T = any>(output: T, router?: Router): boolean | T => {\n if (output instanceof Error) {\n return false;\n }\n\n if (isNavigationCommand(output)) {\n if (typeof output.setRouter === 'function') {\n output.setRouter(router);\n }\n\n return !!output.shouldContinueProcessing;\n }\n\n if (output === undefined) {\n return true;\n }\n\n return output;\n};\n\n/**\n * A basic interface for an Observable type\n */\nexport interface IObservable {\n subscribe(sub?: IObservableConfig): ISubscription;\n}\n\nexport interface IObservableConfig {\n next(): void;\n error(err?: any): void;\n complete(): void;\n}\n\n/**\n * A basic interface for a Subscription to an Observable\n */\ninterface ISubscription {\n unsubscribe(): void;\n}\n\ntype SafeSubscriptionFunc = (sub: SafeSubscription) => ISubscription;\n\n/**\n * wraps a subscription, allowing unsubscribe calls even if\n * the first value comes synchronously\n */\nclass SafeSubscription {\n\n private _subscribed: boolean;\n private _subscription: ISubscription;\n\n constructor(subscriptionFunc: SafeSubscriptionFunc) {\n this._subscribed = true;\n this._subscription = subscriptionFunc(this);\n\n if (!this._subscribed) {\n this.unsubscribe();\n }\n }\n\n get subscribed(): boolean {\n return this._subscribed;\n }\n\n unsubscribe(): void {\n if (this._subscribed && this._subscription) {\n this._subscription.unsubscribe();\n }\n\n this._subscribed = false;\n }\n}\n\n/**\n * A function to process return value from `activate`/`canActivate` steps\n * Supports observable/promise\n *\n * For observable, resolve at first next() or on complete()\n */\nconst processPotential = (obj: any, resolve: (val?: any) => any, reject: (err?: any) => any): any => {\n // if promise like\n if (obj && typeof obj.then === 'function') {\n return Promise.resolve(obj).then(resolve).catch(reject);\n }\n\n // if observable\n if (obj && typeof obj.subscribe === 'function') {\n let obs: IObservable = obj;\n return new SafeSubscription(sub => obs.subscribe({\n next() {\n if (sub.subscribed) {\n sub.unsubscribe();\n resolve(obj);\n }\n },\n error(error) {\n if (sub.subscribed) {\n sub.unsubscribe();\n reject(error);\n }\n },\n complete() {\n if (sub.subscribed) {\n sub.unsubscribe();\n resolve(obj);\n }\n }\n }));\n }\n\n // else just resolve\n try {\n return resolve(obj);\n } catch (error) {\n return reject(error);\n }\n};\n","import { Next } from './interfaces';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { processDeactivatable, processActivatable } from './utilities-activation';\n\n/**\n * A pipeline step responsible for finding and activating method `canDeactivate` on a view model of a route\n */\nexport class CanDeactivatePreviousStep {\n run(navigationInstruction: NavigationInstruction, next: Next): Promise<any> {\n return processDeactivatable(navigationInstruction, 'canDeactivate', next);\n }\n}\n\n/**\n * A pipeline step responsible for finding and activating method `canActivate` on a view model of a route\n */\nexport class CanActivateNextStep {\n run(navigationInstruction: NavigationInstruction, next: Next): Promise<any> {\n return processActivatable(navigationInstruction, 'canActivate', next);\n }\n}\n\n/**\n * A pipeline step responsible for finding and activating method `deactivate` on a view model of a route\n */\nexport class DeactivatePreviousStep {\n run(navigationInstruction: NavigationInstruction, next: Next): Promise<any> {\n return processDeactivatable(navigationInstruction, 'deactivate', next, true);\n }\n}\n\n/**\n * A pipeline step responsible for finding and activating method `activate` on a view model of a route\n */\nexport class ActivateNextStep {\n run(navigationInstruction: NavigationInstruction, next: Next): Promise<any> {\n return processActivatable(navigationInstruction, 'activate', next, true);\n }\n}\n","import { Container } from 'aurelia-dependency-injection';\nimport { Pipeline } from './pipeline';\nimport { BuildNavigationPlanStep } from './step-build-navigation-plan';\nimport { LoadRouteStep } from './step-load-route';\nimport { CommitChangesStep } from './step-commit-changes';\nimport { CanDeactivatePreviousStep, CanActivateNextStep, DeactivatePreviousStep, ActivateNextStep } from './step-activation';\nimport { PipelineStep, StepRunnerFunction, IPipelineSlot } from './interfaces';\nimport { PipelineSlotName } from './pipeline-slot-name';\n\n/**\n * A multi-slots Pipeline Placeholder Step for hooking into a pipeline execution\n */\nclass PipelineSlot implements IPipelineSlot {\n\n /**@internal */\n container: Container;\n /**@internal */\n slotName: string;\n /**@internal */\n slotAlias?: string;\n\n steps: (Function | PipelineStep)[] = [];\n\n constructor(container: Container, name: string, alias?: string) {\n this.container = container;\n this.slotName = name;\n this.slotAlias = alias;\n }\n\n getSteps(): (StepRunnerFunction | IPipelineSlot | PipelineStep)[] {\n return this.steps.map(x => this.container.get(x));\n }\n}\n\n/**\n * Class responsible for creating the navigation pipeline.\n */\nexport class PipelineProvider {\n\n /**@internal */\n static inject() { return [Container]; }\n /**@internal */\n container: Container;\n /**@internal */\n steps: (Function | PipelineSlot)[];\n\n constructor(container: Container) {\n this.container = container;\n this.steps = [\n BuildNavigationPlanStep,\n CanDeactivatePreviousStep, // optional\n LoadRouteStep,\n createPipelineSlot(container, PipelineSlotName.Authorize),\n CanActivateNextStep, // optional\n createPipelineSlot(container, PipelineSlotName.PreActivate, 'modelbind'),\n // NOTE: app state changes start below - point of no return\n DeactivatePreviousStep, // optional\n ActivateNextStep, // optional\n createPipelineSlot(container, PipelineSlotName.PreRender, 'precommit'),\n CommitChangesStep,\n createPipelineSlot(container, PipelineSlotName.PostRender, 'postcomplete')\n ];\n }\n\n /**\n * Create the navigation pipeline.\n */\n createPipeline(useCanDeactivateStep: boolean = true): Pipeline {\n let pipeline = new Pipeline();\n this.steps.forEach(step => {\n if (useCanDeactivateStep || step !== CanDeactivatePreviousStep) {\n pipeline.addStep(this.container.get(step));\n }\n });\n return pipeline;\n }\n\n /**@internal */\n _findStep(name: string): PipelineSlot {\n // Steps that are not PipelineSlots are constructor functions, and they will automatically fail. Probably.\n return this.steps.find(x => (x as PipelineSlot).slotName === name || (x as PipelineSlot).slotAlias === name) as PipelineSlot;\n }\n\n /**\n * Adds a step into the pipeline at a known slot location.\n */\n addStep(name: string, step: PipelineStep | Function): void {\n let found = this._findStep(name);\n if (found) {\n let slotSteps = found.steps;\n // prevent duplicates\n if (!slotSteps.includes(step)) {\n slotSteps.push(step);\n }\n } else {\n throw new Error(`Invalid pipeline slot name: ${name}.`);\n }\n }\n\n /**\n * Removes a step from a slot in the pipeline\n */\n removeStep(name: string, step: PipelineStep): void {\n let slot = this._findStep(name);\n if (slot) {\n let slotSteps = slot.steps;\n slotSteps.splice(slotSteps.indexOf(step), 1);\n }\n }\n\n /**\n * Clears all steps from a slot in the pipeline\n * @internal\n */\n _clearSteps(name: string = ''): void {\n let slot = this._findStep(name);\n if (slot) {\n slot.steps = [];\n }\n }\n\n /**\n * Resets all pipeline slots\n */\n reset(): void {\n this._clearSteps(PipelineSlotName.Authorize);\n this._clearSteps(PipelineSlotName.PreActivate);\n this._clearSteps(PipelineSlotName.PreRender);\n this._clearSteps(PipelineSlotName.PostRender);\n }\n}\n\n/**@internal */\nconst createPipelineSlot = (container: Container, name: PipelineSlotName, alias?: string): PipelineSlot => {\n return new PipelineSlot(container, name, alias);\n};\n","import * as LogManager from 'aurelia-logging';\nimport { Container } from 'aurelia-dependency-injection';\nimport { History, NavigationOptions } from 'aurelia-history';\nimport { Router } from './router';\nimport { PipelineProvider } from './pipeline-provider';\nimport { isNavigationCommand } from './navigation-commands';\nimport { EventAggregator } from 'aurelia-event-aggregator';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { ViewPort, ConfiguresRouter, PipelineResult } from './interfaces';\nimport { RouterEvent } from './router-event';\nimport { RouterConfiguration } from './router-configuration';\n\n/**@internal */\ndeclare module 'aurelia-dependency-injection' {\n interface Container {\n viewModel?: any;\n }\n}\n\nconst logger = LogManager.getLogger('app-router');\n\n/**\n * The main application router.\n */\nexport class AppRouter extends Router {\n\n /**@internal */\n static inject() { return [Container, History, PipelineProvider, EventAggregator]; }\n\n events: EventAggregator;\n /**@internal */\n maxInstructionCount: number;\n /**@internal */\n _queue: NavigationInstruction[];\n /**@internal */\n isActive: boolean;\n\n constructor(container: Container, history: History, pipelineProvider: PipelineProvider, events: EventAggregator) {\n super(container, history); // Note the super will call reset internally.\n this.pipelineProvider = pipelineProvider;\n this.events = events;\n }\n\n /**\n * Fully resets the router's internal state. Primarily used internally by the framework when multiple calls to setRoot are made.\n * Use with caution (actually, avoid using this). Do not use this to simply change your navigation model.\n */\n reset(): void {\n super.reset();\n this.maxInstructionCount = 10;\n if (!this._queue) {\n this._queue = [];\n } else {\n this._queue.length = 0;\n }\n }\n\n /**\n * Loads the specified URL.\n *\n * @param url The URL fragment to load.\n */\n loadUrl(url: string): Promise<NavigationInstruction> {\n return this\n ._createNavigationInstruction(url)\n .then(instruction => this._queueInstruction(instruction))\n .catch(error => {\n logger.error(error);\n restorePreviousLocation(this);\n });\n }\n\n /**\n * Registers a viewPort to be used as a rendering target for activated routes.\n *\n * @param viewPort The viewPort. This is typically a <router-view/> element in Aurelia default impl\n * @param name The name of the viewPort. 'default' if unspecified.\n */\n registerViewPort(viewPort: /*ViewPort*/ any, name?: string): Promise<any> {\n // having strong typing without changing public API\n const $viewPort: ViewPort = viewPort;\n super.registerViewPort($viewPort, name);\n\n // beside adding viewport to the registry of this instance\n // AppRouter also configure routing/history to start routing functionality\n // There are situation where there are more than 1 <router-view/> element at root view\n // in that case, still only activate once via the following guard\n if (!this.isActive) {\n const viewModel = this._findViewModel($viewPort);\n if ('configureRouter' in viewModel) {\n // If there are more than one <router-view/> element at root view\n // use this flag to guard against configure method being invoked multiple times\n // this flag is set inside method configure\n if (!this.isConfigured) {\n // replace the real resolve with a noop to guarantee that any action in base class Router\n // won't resolve the configurePromise prematurely\n const resolveConfiguredPromise = this._resolveConfiguredPromise;\n this._resolveConfiguredPromise = () => {/**/};\n return this\n .configure(config =>\n Promise\n .resolve(viewModel.configureRouter(config, this))\n // an issue with configure interface. Should be fixed there\n // todo: fix this via configure interface in router\n .then(() => config) as any\n )\n .then(() => {\n this.activate();\n resolveConfiguredPromise();\n });\n }\n } else {\n this.activate();\n }\n }\n // when a viewport is added dynamically to a root view that is already activated\n // just process the navigation instruction\n else {\n this._dequeueInstruction();\n }\n\n return Promise.resolve();\n }\n\n /**\n * Activates the router. This instructs the router to begin listening for history changes and processing instructions.\n *\n * @params options The set of options to activate the router with.\n */\n activate(options?: NavigationOptions): void {\n if (this.isActive) {\n return;\n }\n\n this.isActive = true;\n // route handler property is responsible for handling url change\n // the interface of aurelia-history isn't clear on this perspective\n this.options = Object.assign({ routeHandler: this.loadUrl.bind(this) }, this.options, options);\n this.history.activate(this.options);\n this._dequeueInstruction();\n }\n\n /**\n * Deactivates the router.\n */\n deactivate(): void {\n this.isActive = false;\n this.history.deactivate();\n }\n\n /**@internal */\n _queueInstruction(instruction: NavigationInstruction): Promise<any> {\n return new Promise((resolve) => {\n instruction.resolve = resolve;\n this._queue.unshift(instruction);\n this._dequeueInstruction();\n });\n }\n\n /**@internal */\n _dequeueInstruction(instructionCount: number = 0): Promise<PipelineResult | void> {\n return Promise.resolve().then(() => {\n if (this.isNavigating && !instructionCount) {\n // ts complains about inconsistent returns without void 0\n return void 0;\n }\n\n let instruction = this._queue.shift();\n this._queue.length = 0;\n\n if (!instruction) {\n // ts complains about inconsistent returns without void 0\n return void 0;\n }\n\n this.isNavigating = true;\n\n let navtracker: number = this.history.getState('NavigationTracker');\n let currentNavTracker = this.currentNavigationTracker;\n\n if (!navtracker && !currentNavTracker) {\n this.isNavigatingFirst = true;\n this.isNavigatingNew = true;\n } else if (!navtracker) {\n this.isNavigatingNew = true;\n } else if (!currentNavTracker) {\n this.isNavigatingRefresh = true;\n } else if (currentNavTracker < navtracker) {\n this.isNavigatingForward = true;\n } else if (currentNavTracker > navtracker) {\n this.isNavigatingBack = true;\n } if (!navtracker) {\n navtracker = Date.now();\n this.history.setState('NavigationTracker', navtracker);\n }\n this.currentNavigationTracker = navtracker;\n\n instruction.previousInstruction = this.currentInstruction;\n\n let maxInstructionCount = this.maxInstructionCount;\n\n if (!instructionCount) {\n this.events.publish(RouterEvent.Processing, { instruction });\n } else if (instructionCount === maxInstructionCount - 1) {\n logger.error(`${instructionCount + 1} navigation instructions have been attempted without success. Restoring last known good location.`);\n restorePreviousLocation(this);\n return this._dequeueInstruction(instructionCount + 1);\n } else if (instructionCount > maxInstructionCount) {\n throw new Error('Maximum navigation attempts exceeded. Giving up.');\n }\n\n let pipeline = this.pipelineProvider.createPipeline(!this.couldDeactivate);\n\n return pipeline\n .run(instruction)\n .then(result => processResult(instruction, result, instructionCount, this))\n .catch(error => {\n return { output: error instanceof Error ? error : new Error(error) } as PipelineResult;\n })\n .then(result => resolveInstruction(instruction, result, !!instructionCount, this));\n });\n }\n\n /**@internal */\n _findViewModel(viewPort: ViewPort): ConfiguresRouter | undefined {\n if (this.container.viewModel) {\n return this.container.viewModel;\n }\n\n if (viewPort.container) {\n let container = viewPort.container;\n\n while (container) {\n if (container.viewModel) {\n this.container.viewModel = container.viewModel;\n return container.viewModel;\n }\n\n container = container.parent;\n }\n }\n\n return undefined;\n }\n}\n\nconst processResult = (\n instruction: NavigationInstruction,\n result: PipelineResult,\n instructionCount: number,\n router: AppRouter\n): Promise<PipelineResult> => {\n if (!(result && 'completed' in result && 'output' in result)) {\n result = result || {} as PipelineResult;\n result.output = new Error(`Expected router pipeline to return a navigation result, but got [${JSON.stringify(result)}] instead.`);\n }\n\n let finalResult: PipelineResult = null;\n let navigationCommandResult = null;\n if (isNavigationCommand(result.output)) {\n navigationCommandResult = result.output.navigate(router);\n } else {\n finalResult = result;\n\n if (!result.completed) {\n if (result.output instanceof Error) {\n logger.error(result.output.toString());\n }\n\n restorePreviousLocation(router);\n }\n }\n\n return Promise.resolve(navigationCommandResult)\n .then(_ => router._dequeueInstruction(instructionCount + 1))\n .then(innerResult => finalResult || innerResult || result);\n};\n\nconst resolveInstruction = (\n instruction: NavigationInstruction,\n result: PipelineResult,\n isInnerInstruction: boolean,\n router: AppRouter\n): PipelineResult => {\n instruction.resolve(result);\n\n let eventAggregator = router.events;\n let eventArgs = { instruction, result };\n if (!isInnerInstruction) {\n router.isNavigating = false;\n router.isExplicitNavigation = false;\n router.isExplicitNavigationBack = false;\n router.isNavigatingFirst = false;\n router.isNavigatingNew = false;\n router.isNavigatingRefresh = false;\n router.isNavigatingForward = false;\n router.isNavigatingBack = false;\n router.couldDeactivate = false;\n\n let eventName: string;\n\n if (result.output instanceof Error) {\n eventName = RouterEvent.Error;\n } else if (!result.completed) {\n eventName = RouterEvent.Canceled;\n } else {\n let queryString = instruction.queryString ? ('?' + instruction.queryString) : '';\n router.history.previousLocation = instruction.fragment + queryString;\n eventName = RouterEvent.Success;\n }\n\n eventAggregator.publish(eventName, eventArgs);\n eventAggregator.publish(RouterEvent.Complete, eventArgs);\n } else {\n eventAggregator.publish(RouterEvent.ChildComplete, eventArgs);\n }\n\n return result;\n};\n\nconst restorePreviousLocation = (router: AppRouter): void => {\n let previousLocation = router.history.previousLocation;\n if (previousLocation) {\n router.navigate(previousLocation, { trigger: false, replace: true });\n } else if (router.fallbackRoute) {\n router.navigate(router.fallbackRoute, { trigger: true, replace: true });\n } else {\n logger.error('Router navigation failed, and no previous location or fallbackRoute could be restored.');\n }\n};\n","/**\n* The status of a Pipeline.\n*/\nexport const enum PipelineStatus {\n Completed = 'completed',\n Canceled = 'canceled',\n Rejected = 'rejected',\n Running = 'running'\n}\n","/**\n * A list of known router events used by the Aurelia router\n * to signal the pipeline has come to a certain state\n */\n// const enum is preserved in tsconfig\nexport const enum RouterEvent {\n Processing = 'router:navigation:processing',\n Error = 'router:navigation:error',\n Canceled = 'router:navigation:canceled',\n Complete = 'router:navigation:complete',\n Success = 'router:navigation:success',\n ChildComplete = 'router:navigation:child:complete'\n}\n","/**\n * Available pipeline slot names to insert interceptor into router pipeline\n */\n// const enum is preserved in tsconfig\nexport const enum PipelineSlotName {\n /**\n * Authorization slot. Invoked early in the pipeline,\n * before `canActivate` hook of incoming route\n */\n Authorize = 'authorize',\n /**\n * Pre-activation slot. Invoked early in the pipeline,\n * Invoked timing:\n * - after Authorization slot\n * - after canActivate hook on new view model\n * - before deactivate hook on old view model\n * - before activate hook on new view model\n */\n PreActivate = 'preActivate',\n /**\n * Pre-render slot. Invoked later in the pipeline\n * Invokcation timing:\n * - after activate hook on new view model\n * - before commit step on new navigation instruction\n */\n PreRender = 'preRender',\n /**\n * Post-render slot. Invoked last in the pipeline\n */\n PostRender = 'postRender'\n}\n"],"names":["RouteRecognizer","Container","LogManager.getLogger","tslib_1.__extends","History","EventAggregator","PipelineStatus","RouterEvent","PipelineSlotName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2BA;;;AAGA;QA4DE,+BAAY,IAA+B;;;;YAT3C,SAAI,GAAwC,IAAI,CAAC;YAEjD,YAAO,GAAwB,EAAE,CAAC;YAQhC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAE1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;YAChC,IAAI,CAAC,oBAAoB,GAAG,EAAE,CAAC;YAE/B,IAAI,cAAc,GAAG,EAAE,CAAC;YACxB,IAAI,OAAO,GAA0B,IAAI,CAAC;YAC1C,GAAG;gBACD,IAAI,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;gBACtD,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE;;oBAEnD,OAAO,aAAa,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;iBACjD;gBAED,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;gBACtC,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC;aACrC,QAAQ,OAAO,EAAE;YAElB,IAAI,SAAS,GAAG,MAAM,CAAC,MAAM,OAAb,MAAM,GAAQ,EAAE,EAAE,IAAI,CAAC,WAAW,SAAK,cAAc,EAAC,CAAC;YACvE,IAAI,CAAC,aAAa,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;SACrD;;;;QAKD,kDAAkB,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