{"version":3,"sources":["node_modules/@angular/router/fesm2022/router.mjs","node_modules/@microsoft/signalr/dist/esm/Errors.js","node_modules/@microsoft/signalr/dist/esm/HttpClient.js","node_modules/@microsoft/signalr/dist/esm/ILogger.js","node_modules/@microsoft/signalr/dist/esm/Loggers.js","node_modules/@microsoft/signalr/dist/esm/Utils.js","node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js","node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js","node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js","node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js","node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js","node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js","node_modules/@microsoft/signalr/dist/esm/Subject.js","node_modules/@microsoft/signalr/dist/esm/HubConnection.js","node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js","node_modules/@microsoft/signalr/src/HeaderNames.ts","node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js","node_modules/@microsoft/signalr/dist/esm/ITransport.js","node_modules/@microsoft/signalr/dist/esm/AbortController.js","node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js","node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js","node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js","node_modules/@microsoft/signalr/dist/esm/HttpConnection.js","node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js","node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js","src/app/_services/message-hub.service.ts","src/app/_models/preferences/site-theme.ts","src/app/_pipes/safe-html.pipe.ts","src/app/shared/confirm-dialog/confirm-dialog.component.ts","src/app/shared/confirm-dialog/confirm-dialog.component.html","src/app/shared/confirm-dialog/_models/confirm-config.ts","src/app/shared/confirm.service.ts","src/app/_services/theme.service.ts","src/app/_services/account.service.ts"],"sourcesContent":["/**\n * @license Angular v17.3.4\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport * as i0 from '@angular/core';\nimport { ɵisPromise, ɵRuntimeError, Injectable, EventEmitter, inject, ViewContainerRef, ChangeDetectorRef, EnvironmentInjector, Directive, Input, Output, InjectionToken, reflectComponentType, Component, createEnvironmentInjector, ɵisNgModule, isStandalone, ɵisInjectable, runInInjectionContext, Compiler, NgModuleFactory, NgZone, afterNextRender, ɵConsole, ɵPendingTasks, ɵɵsanitizeUrlOrResourceUrl, booleanAttribute, Attribute, HostBinding, HostListener, Optional, ContentChildren, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, ENVIRONMENT_INITIALIZER, Injector, ApplicationRef, InjectFlags, APP_INITIALIZER, SkipSelf, NgModule, Inject, Version } from '@angular/core';\nimport { isObservable, from, of, BehaviorSubject, combineLatest, EmptyError, concat, defer, pipe, throwError, EMPTY, ConnectableObservable, Subject, Subscription } from 'rxjs';\nimport * as i3 from '@angular/common';\nimport { DOCUMENT, Location, ViewportScroller, LOCATION_INITIALIZED, LocationStrategy, HashLocationStrategy, PathLocationStrategy } from '@angular/common';\nimport { map, switchMap, take, startWith, filter, mergeMap, first, concatMap, tap, catchError, scan, defaultIfEmpty, last as last$1, takeLast, mapTo, finalize, refCount, takeUntil, mergeAll } from 'rxjs/operators';\nimport * as i1 from '@angular/platform-browser';\n\n/**\n * The primary routing outlet.\n *\n * @publicApi\n */\nconst PRIMARY_OUTLET = 'primary';\n/**\n * A private symbol used to store the value of `Route.title` inside the `Route.data` if it is a\n * static string or `Route.resolve` if anything else. This allows us to reuse the existing route\n * data/resolvers to support the title feature without new instrumentation in the `Router` pipeline.\n */\nconst RouteTitleKey = /* @__PURE__ */Symbol('RouteTitle');\nclass ParamsAsMap {\n constructor(params) {\n this.params = params || {};\n }\n has(name) {\n return Object.prototype.hasOwnProperty.call(this.params, name);\n }\n get(name) {\n if (this.has(name)) {\n const v = this.params[name];\n return Array.isArray(v) ? v[0] : v;\n }\n return null;\n }\n getAll(name) {\n if (this.has(name)) {\n const v = this.params[name];\n return Array.isArray(v) ? v : [v];\n }\n return [];\n }\n get keys() {\n return Object.keys(this.params);\n }\n}\n/**\n * Converts a `Params` instance to a `ParamMap`.\n * @param params The instance to convert.\n * @returns The new map instance.\n *\n * @publicApi\n */\nfunction convertToParamMap(params) {\n return new ParamsAsMap(params);\n}\n/**\n * Matches the route configuration (`route`) against the actual URL (`segments`).\n *\n * When no matcher is defined on a `Route`, this is the matcher used by the Router by default.\n *\n * @param segments The remaining unmatched segments in the current navigation\n * @param segmentGroup The current segment group being matched\n * @param route The `Route` to match against.\n *\n * @see {@link UrlMatchResult}\n * @see {@link Route}\n *\n * @returns The resulting match information or `null` if the `route` should not match.\n * @publicApi\n */\nfunction defaultUrlMatcher(segments, segmentGroup, route) {\n const parts = route.path.split('/');\n if (parts.length > segments.length) {\n // The actual URL is shorter than the config, no match\n return null;\n }\n if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || parts.length < segments.length)) {\n // The config is longer than the actual URL but we are looking for a full match, return null\n return null;\n }\n const posParams = {};\n // Check each config part against the actual URL\n for (let index = 0; index < parts.length; index++) {\n const part = parts[index];\n const segment = segments[index];\n const isParameter = part.startsWith(':');\n if (isParameter) {\n posParams[part.substring(1)] = segment;\n } else if (part !== segment.path) {\n // The actual URL part does not match the config, no match\n return null;\n }\n }\n return {\n consumed: segments.slice(0, parts.length),\n posParams\n };\n}\nfunction shallowEqualArrays(a, b) {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; ++i) {\n if (!shallowEqual(a[i], b[i])) return false;\n }\n return true;\n}\nfunction shallowEqual(a, b) {\n // While `undefined` should never be possible, it would sometimes be the case in IE 11\n // and pre-chromium Edge. The check below accounts for this edge case.\n const k1 = a ? getDataKeys(a) : undefined;\n const k2 = b ? getDataKeys(b) : undefined;\n if (!k1 || !k2 || k1.length != k2.length) {\n return false;\n }\n let key;\n for (let i = 0; i < k1.length; i++) {\n key = k1[i];\n if (!equalArraysOrString(a[key], b[key])) {\n return false;\n }\n }\n return true;\n}\n/**\n * Gets the keys of an object, including `symbol` keys.\n */\nfunction getDataKeys(obj) {\n return [...Object.keys(obj), ...Object.getOwnPropertySymbols(obj)];\n}\n/**\n * Test equality for arrays of strings or a string.\n */\nfunction equalArraysOrString(a, b) {\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) return false;\n const aSorted = [...a].sort();\n const bSorted = [...b].sort();\n return aSorted.every((val, index) => bSorted[index] === val);\n } else {\n return a === b;\n }\n}\n/**\n * Return the last element of an array.\n */\nfunction last(a) {\n return a.length > 0 ? a[a.length - 1] : null;\n}\nfunction wrapIntoObservable(value) {\n if (isObservable(value)) {\n return value;\n }\n if (ɵisPromise(value)) {\n // Use `Promise.resolve()` to wrap promise-like instances.\n // Required ie when a Resolver returns a AngularJS `$q` promise to correctly trigger the\n // change detection.\n return from(Promise.resolve(value));\n }\n return of(value);\n}\nconst pathCompareMap = {\n 'exact': equalSegmentGroups,\n 'subset': containsSegmentGroup\n};\nconst paramCompareMap = {\n 'exact': equalParams,\n 'subset': containsParams,\n 'ignored': () => true\n};\nfunction containsTree(container, containee, options) {\n return pathCompareMap[options.paths](container.root, containee.root, options.matrixParams) && paramCompareMap[options.queryParams](container.queryParams, containee.queryParams) && !(options.fragment === 'exact' && container.fragment !== containee.fragment);\n}\nfunction equalParams(container, containee) {\n // TODO: This does not handle array params correctly.\n return shallowEqual(container, containee);\n}\nfunction equalSegmentGroups(container, containee, matrixParams) {\n if (!equalPath(container.segments, containee.segments)) return false;\n if (!matrixParamsMatch(container.segments, containee.segments, matrixParams)) {\n return false;\n }\n if (container.numberOfChildren !== containee.numberOfChildren) return false;\n for (const c in containee.children) {\n if (!container.children[c]) return false;\n if (!equalSegmentGroups(container.children[c], containee.children[c], matrixParams)) return false;\n }\n return true;\n}\nfunction containsParams(container, containee) {\n return Object.keys(containee).length <= Object.keys(container).length && Object.keys(containee).every(key => equalArraysOrString(container[key], containee[key]));\n}\nfunction containsSegmentGroup(container, containee, matrixParams) {\n return containsSegmentGroupHelper(container, containee, containee.segments, matrixParams);\n}\nfunction containsSegmentGroupHelper(container, containee, containeePaths, matrixParams) {\n if (container.segments.length > containeePaths.length) {\n const current = container.segments.slice(0, containeePaths.length);\n if (!equalPath(current, containeePaths)) return false;\n if (containee.hasChildren()) return false;\n if (!matrixParamsMatch(current, containeePaths, matrixParams)) return false;\n return true;\n } else if (container.segments.length === containeePaths.length) {\n if (!equalPath(container.segments, containeePaths)) return false;\n if (!matrixParamsMatch(container.segments, containeePaths, matrixParams)) return false;\n for (const c in containee.children) {\n if (!container.children[c]) return false;\n if (!containsSegmentGroup(container.children[c], containee.children[c], matrixParams)) {\n return false;\n }\n }\n return true;\n } else {\n const current = containeePaths.slice(0, container.segments.length);\n const next = containeePaths.slice(container.segments.length);\n if (!equalPath(container.segments, current)) return false;\n if (!matrixParamsMatch(container.segments, current, matrixParams)) return false;\n if (!container.children[PRIMARY_OUTLET]) return false;\n return containsSegmentGroupHelper(container.children[PRIMARY_OUTLET], containee, next, matrixParams);\n }\n}\nfunction matrixParamsMatch(containerPaths, containeePaths, options) {\n return containeePaths.every((containeeSegment, i) => {\n return paramCompareMap[options](containerPaths[i].parameters, containeeSegment.parameters);\n });\n}\n/**\n * @description\n *\n * Represents the parsed URL.\n *\n * Since a router state is a tree, and the URL is nothing but a serialized state, the URL is a\n * serialized tree.\n * UrlTree is a data structure that provides a lot of affordances in dealing with URLs\n *\n * @usageNotes\n * ### Example\n *\n * ```\n * @Component({templateUrl:'template.html'})\n * class MyComponent {\n * constructor(router: Router) {\n * const tree: UrlTree =\n * router.parseUrl('/team/33/(user/victor//support:help)?debug=true#fragment');\n * const f = tree.fragment; // return 'fragment'\n * const q = tree.queryParams; // returns {debug: 'true'}\n * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];\n * const s: UrlSegment[] = g.segments; // returns 2 segments 'team' and '33'\n * g.children[PRIMARY_OUTLET].segments; // returns 2 segments 'user' and 'victor'\n * g.children['support'].segments; // return 1 segment 'help'\n * }\n * }\n * ```\n *\n * @publicApi\n */\nclass UrlTree {\n constructor( /** The root segment group of the URL tree */\n root = new UrlSegmentGroup([], {}), /** The query params of the URL */\n queryParams = {}, /** The fragment of the URL */\n fragment = null) {\n this.root = root;\n this.queryParams = queryParams;\n this.fragment = fragment;\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (root.segments.length > 0) {\n throw new ɵRuntimeError(4015 /* RuntimeErrorCode.INVALID_ROOT_URL_SEGMENT */, 'The root `UrlSegmentGroup` should not contain `segments`. ' + 'Instead, these segments belong in the `children` so they can be associated with a named outlet.');\n }\n }\n }\n get queryParamMap() {\n this._queryParamMap ??= convertToParamMap(this.queryParams);\n return this._queryParamMap;\n }\n /** @docsNotRequired */\n toString() {\n return DEFAULT_SERIALIZER.serialize(this);\n }\n}\n/**\n * @description\n *\n * Represents the parsed URL segment group.\n *\n * See `UrlTree` for more information.\n *\n * @publicApi\n */\nclass UrlSegmentGroup {\n constructor( /** The URL segments of this group. See `UrlSegment` for more information */\n segments, /** The list of children of this group */\n children) {\n this.segments = segments;\n this.children = children;\n /** The parent node in the url tree */\n this.parent = null;\n Object.values(children).forEach(v => v.parent = this);\n }\n /** Whether the segment has child segments */\n hasChildren() {\n return this.numberOfChildren > 0;\n }\n /** Number of child segments */\n get numberOfChildren() {\n return Object.keys(this.children).length;\n }\n /** @docsNotRequired */\n toString() {\n return serializePaths(this);\n }\n}\n/**\n * @description\n *\n * Represents a single URL segment.\n *\n * A UrlSegment is a part of a URL between the two slashes. It contains a path and the matrix\n * parameters associated with the segment.\n *\n * @usageNotes\n * ### Example\n *\n * ```\n * @Component({templateUrl:'template.html'})\n * class MyComponent {\n * constructor(router: Router) {\n * const tree: UrlTree = router.parseUrl('/team;id=33');\n * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];\n * const s: UrlSegment[] = g.segments;\n * s[0].path; // returns 'team'\n * s[0].parameters; // returns {id: 33}\n * }\n * }\n * ```\n *\n * @publicApi\n */\nclass UrlSegment {\n constructor( /** The path part of a URL segment */\n path, /** The matrix parameters associated with a segment */\n parameters) {\n this.path = path;\n this.parameters = parameters;\n }\n get parameterMap() {\n this._parameterMap ??= convertToParamMap(this.parameters);\n return this._parameterMap;\n }\n /** @docsNotRequired */\n toString() {\n return serializePath(this);\n }\n}\nfunction equalSegments(as, bs) {\n return equalPath(as, bs) && as.every((a, i) => shallowEqual(a.parameters, bs[i].parameters));\n}\nfunction equalPath(as, bs) {\n if (as.length !== bs.length) return false;\n return as.every((a, i) => a.path === bs[i].path);\n}\nfunction mapChildrenIntoArray(segment, fn) {\n let res = [];\n Object.entries(segment.children).forEach(([childOutlet, child]) => {\n if (childOutlet === PRIMARY_OUTLET) {\n res = res.concat(fn(child, childOutlet));\n }\n });\n Object.entries(segment.children).forEach(([childOutlet, child]) => {\n if (childOutlet !== PRIMARY_OUTLET) {\n res = res.concat(fn(child, childOutlet));\n }\n });\n return res;\n}\n/**\n * @description\n *\n * Serializes and deserializes a URL string into a URL tree.\n *\n * The url serialization strategy is customizable. You can\n * make all URLs case insensitive by providing a custom UrlSerializer.\n *\n * See `DefaultUrlSerializer` for an example of a URL serializer.\n *\n * @publicApi\n */\nlet UrlSerializer = /*#__PURE__*/(() => {\n class UrlSerializer {\n static {\n this.ɵfac = function UrlSerializer_Factory(t) {\n return new (t || UrlSerializer)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: UrlSerializer,\n factory: () => (() => new DefaultUrlSerializer())(),\n providedIn: 'root'\n });\n }\n }\n return UrlSerializer;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * @description\n *\n * A default implementation of the `UrlSerializer`.\n *\n * Example URLs:\n *\n * ```\n * /inbox/33(popup:compose)\n * /inbox/33;open=true/messages/44\n * ```\n *\n * DefaultUrlSerializer uses parentheses to serialize secondary segments (e.g., popup:compose), the\n * colon syntax to specify the outlet, and the ';parameter=value' syntax (e.g., open=true) to\n * specify route specific parameters.\n *\n * @publicApi\n */\nclass DefaultUrlSerializer {\n /** Parses a url into a `UrlTree` */\n parse(url) {\n const p = new UrlParser(url);\n return new UrlTree(p.parseRootSegment(), p.parseQueryParams(), p.parseFragment());\n }\n /** Converts a `UrlTree` into a url */\n serialize(tree) {\n const segment = `/${serializeSegment(tree.root, true)}`;\n const query = serializeQueryParams(tree.queryParams);\n const fragment = typeof tree.fragment === `string` ? `#${encodeUriFragment(tree.fragment)}` : '';\n return `${segment}${query}${fragment}`;\n }\n}\nconst DEFAULT_SERIALIZER = /*#__PURE__*/new DefaultUrlSerializer();\nfunction serializePaths(segment) {\n return segment.segments.map(p => serializePath(p)).join('/');\n}\nfunction serializeSegment(segment, root) {\n if (!segment.hasChildren()) {\n return serializePaths(segment);\n }\n if (root) {\n const primary = segment.children[PRIMARY_OUTLET] ? serializeSegment(segment.children[PRIMARY_OUTLET], false) : '';\n const children = [];\n Object.entries(segment.children).forEach(([k, v]) => {\n if (k !== PRIMARY_OUTLET) {\n children.push(`${k}:${serializeSegment(v, false)}`);\n }\n });\n return children.length > 0 ? `${primary}(${children.join('//')})` : primary;\n } else {\n const children = mapChildrenIntoArray(segment, (v, k) => {\n if (k === PRIMARY_OUTLET) {\n return [serializeSegment(segment.children[PRIMARY_OUTLET], false)];\n }\n return [`${k}:${serializeSegment(v, false)}`];\n });\n // use no parenthesis if the only child is a primary outlet route\n if (Object.keys(segment.children).length === 1 && segment.children[PRIMARY_OUTLET] != null) {\n return `${serializePaths(segment)}/${children[0]}`;\n }\n return `${serializePaths(segment)}/(${children.join('//')})`;\n }\n}\n/**\n * Encodes a URI string with the default encoding. This function will only ever be called from\n * `encodeUriQuery` or `encodeUriSegment` as it's the base set of encodings to be used. We need\n * a custom encoding because encodeURIComponent is too aggressive and encodes stuff that doesn't\n * have to be encoded per https://url.spec.whatwg.org.\n */\nfunction encodeUriString(s) {\n return encodeURIComponent(s).replace(/%40/g, '@').replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',');\n}\n/**\n * This function should be used to encode both keys and values in a query string key/value. In\n * the following URL, you need to call encodeUriQuery on \"k\" and \"v\":\n *\n * http://www.site.org/html;mk=mv?k=v#f\n */\nfunction encodeUriQuery(s) {\n return encodeUriString(s).replace(/%3B/gi, ';');\n}\n/**\n * This function should be used to encode a URL fragment. In the following URL, you need to call\n * encodeUriFragment on \"f\":\n *\n * http://www.site.org/html;mk=mv?k=v#f\n */\nfunction encodeUriFragment(s) {\n return encodeURI(s);\n}\n/**\n * This function should be run on any URI segment as well as the key and value in a key/value\n * pair for matrix params. In the following URL, you need to call encodeUriSegment on \"html\",\n * \"mk\", and \"mv\":\n *\n * http://www.site.org/html;mk=mv?k=v#f\n */\nfunction encodeUriSegment(s) {\n return encodeUriString(s).replace(/\\(/g, '%28').replace(/\\)/g, '%29').replace(/%26/gi, '&');\n}\nfunction decode(s) {\n return decodeURIComponent(s);\n}\n// Query keys/values should have the \"+\" replaced first, as \"+\" in a query string is \" \".\n// decodeURIComponent function will not decode \"+\" as a space.\nfunction decodeQuery(s) {\n return decode(s.replace(/\\+/g, '%20'));\n}\nfunction serializePath(path) {\n return `${encodeUriSegment(path.path)}${serializeMatrixParams(path.parameters)}`;\n}\nfunction serializeMatrixParams(params) {\n return Object.entries(params).map(([key, value]) => `;${encodeUriSegment(key)}=${encodeUriSegment(value)}`).join('');\n}\nfunction serializeQueryParams(params) {\n const strParams = Object.entries(params).map(([name, value]) => {\n return Array.isArray(value) ? value.map(v => `${encodeUriQuery(name)}=${encodeUriQuery(v)}`).join('&') : `${encodeUriQuery(name)}=${encodeUriQuery(value)}`;\n }).filter(s => s);\n return strParams.length ? `?${strParams.join('&')}` : '';\n}\nconst SEGMENT_RE = /^[^\\/()?;#]+/;\nfunction matchSegments(str) {\n const match = str.match(SEGMENT_RE);\n return match ? match[0] : '';\n}\nconst MATRIX_PARAM_SEGMENT_RE = /^[^\\/()?;=#]+/;\nfunction matchMatrixKeySegments(str) {\n const match = str.match(MATRIX_PARAM_SEGMENT_RE);\n return match ? match[0] : '';\n}\nconst QUERY_PARAM_RE = /^[^=?&#]+/;\n// Return the name of the query param at the start of the string or an empty string\nfunction matchQueryParams(str) {\n const match = str.match(QUERY_PARAM_RE);\n return match ? match[0] : '';\n}\nconst QUERY_PARAM_VALUE_RE = /^[^&#]+/;\n// Return the value of the query param at the start of the string or an empty string\nfunction matchUrlQueryParamValue(str) {\n const match = str.match(QUERY_PARAM_VALUE_RE);\n return match ? match[0] : '';\n}\nclass UrlParser {\n constructor(url) {\n this.url = url;\n this.remaining = url;\n }\n parseRootSegment() {\n this.consumeOptional('/');\n if (this.remaining === '' || this.peekStartsWith('?') || this.peekStartsWith('#')) {\n return new UrlSegmentGroup([], {});\n }\n // The root segment group never has segments\n return new UrlSegmentGroup([], this.parseChildren());\n }\n parseQueryParams() {\n const params = {};\n if (this.consumeOptional('?')) {\n do {\n this.parseQueryParam(params);\n } while (this.consumeOptional('&'));\n }\n return params;\n }\n parseFragment() {\n return this.consumeOptional('#') ? decodeURIComponent(this.remaining) : null;\n }\n parseChildren() {\n if (this.remaining === '') {\n return {};\n }\n this.consumeOptional('/');\n const segments = [];\n if (!this.peekStartsWith('(')) {\n segments.push(this.parseSegment());\n }\n while (this.peekStartsWith('/') && !this.peekStartsWith('//') && !this.peekStartsWith('/(')) {\n this.capture('/');\n segments.push(this.parseSegment());\n }\n let children = {};\n if (this.peekStartsWith('/(')) {\n this.capture('/');\n children = this.parseParens(true);\n }\n let res = {};\n if (this.peekStartsWith('(')) {\n res = this.parseParens(false);\n }\n if (segments.length > 0 || Object.keys(children).length > 0) {\n res[PRIMARY_OUTLET] = new UrlSegmentGroup(segments, children);\n }\n return res;\n }\n // parse a segment with its matrix parameters\n // ie `name;k1=v1;k2`\n parseSegment() {\n const path = matchSegments(this.remaining);\n if (path === '' && this.peekStartsWith(';')) {\n throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Empty path url segment cannot have parameters: '${this.remaining}'.`);\n }\n this.capture(path);\n return new UrlSegment(decode(path), this.parseMatrixParams());\n }\n parseMatrixParams() {\n const params = {};\n while (this.consumeOptional(';')) {\n this.parseParam(params);\n }\n return params;\n }\n parseParam(params) {\n const key = matchMatrixKeySegments(this.remaining);\n if (!key) {\n return;\n }\n this.capture(key);\n let value = '';\n if (this.consumeOptional('=')) {\n const valueMatch = matchSegments(this.remaining);\n if (valueMatch) {\n value = valueMatch;\n this.capture(value);\n }\n }\n params[decode(key)] = decode(value);\n }\n // Parse a single query parameter `name[=value]`\n parseQueryParam(params) {\n const key = matchQueryParams(this.remaining);\n if (!key) {\n return;\n }\n this.capture(key);\n let value = '';\n if (this.consumeOptional('=')) {\n const valueMatch = matchUrlQueryParamValue(this.remaining);\n if (valueMatch) {\n value = valueMatch;\n this.capture(value);\n }\n }\n const decodedKey = decodeQuery(key);\n const decodedVal = decodeQuery(value);\n if (params.hasOwnProperty(decodedKey)) {\n // Append to existing values\n let currentVal = params[decodedKey];\n if (!Array.isArray(currentVal)) {\n currentVal = [currentVal];\n params[decodedKey] = currentVal;\n }\n currentVal.push(decodedVal);\n } else {\n // Create a new value\n params[decodedKey] = decodedVal;\n }\n }\n // parse `(a/b//outlet_name:c/d)`\n parseParens(allowPrimary) {\n const segments = {};\n this.capture('(');\n while (!this.consumeOptional(')') && this.remaining.length > 0) {\n const path = matchSegments(this.remaining);\n const next = this.remaining[path.length];\n // if is is not one of these characters, then the segment was unescaped\n // or the group was not closed\n if (next !== '/' && next !== ')' && next !== ';') {\n throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Cannot parse url '${this.url}'`);\n }\n let outletName = undefined;\n if (path.indexOf(':') > -1) {\n outletName = path.slice(0, path.indexOf(':'));\n this.capture(outletName);\n this.capture(':');\n } else if (allowPrimary) {\n outletName = PRIMARY_OUTLET;\n }\n const children = this.parseChildren();\n segments[outletName] = Object.keys(children).length === 1 ? children[PRIMARY_OUTLET] : new UrlSegmentGroup([], children);\n this.consumeOptional('//');\n }\n return segments;\n }\n peekStartsWith(str) {\n return this.remaining.startsWith(str);\n }\n // Consumes the prefix when it is present and returns whether it has been consumed\n consumeOptional(str) {\n if (this.peekStartsWith(str)) {\n this.remaining = this.remaining.substring(str.length);\n return true;\n }\n return false;\n }\n capture(str) {\n if (!this.consumeOptional(str)) {\n throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Expected \"${str}\".`);\n }\n }\n}\nfunction createRoot(rootCandidate) {\n return rootCandidate.segments.length > 0 ? new UrlSegmentGroup([], {\n [PRIMARY_OUTLET]: rootCandidate\n }) : rootCandidate;\n}\n/**\n * Recursively\n * - merges primary segment children into their parents\n * - drops empty children (those which have no segments and no children themselves). This latter\n * prevents serializing a group into something like `/a(aux:)`, where `aux` is an empty child\n * segment.\n * - merges named outlets without a primary segment sibling into the children. This prevents\n * serializing a URL like `//(a:a)(b:b) instead of `/(a:a//b:b)` when the aux b route lives on the\n * root but the `a` route lives under an empty path primary route.\n */\nfunction squashSegmentGroup(segmentGroup) {\n const newChildren = {};\n for (const [childOutlet, child] of Object.entries(segmentGroup.children)) {\n const childCandidate = squashSegmentGroup(child);\n // moves named children in an empty path primary child into this group\n if (childOutlet === PRIMARY_OUTLET && childCandidate.segments.length === 0 && childCandidate.hasChildren()) {\n for (const [grandChildOutlet, grandChild] of Object.entries(childCandidate.children)) {\n newChildren[grandChildOutlet] = grandChild;\n }\n } // don't add empty children\n else if (childCandidate.segments.length > 0 || childCandidate.hasChildren()) {\n newChildren[childOutlet] = childCandidate;\n }\n }\n const s = new UrlSegmentGroup(segmentGroup.segments, newChildren);\n return mergeTrivialChildren(s);\n}\n/**\n * When possible, merges the primary outlet child into the parent `UrlSegmentGroup`.\n *\n * When a segment group has only one child which is a primary outlet, merges that child into the\n * parent. That is, the child segment group's segments are merged into the `s` and the child's\n * children become the children of `s`. Think of this like a 'squash', merging the child segment\n * group into the parent.\n */\nfunction mergeTrivialChildren(s) {\n if (s.numberOfChildren === 1 && s.children[PRIMARY_OUTLET]) {\n const c = s.children[PRIMARY_OUTLET];\n return new UrlSegmentGroup(s.segments.concat(c.segments), c.children);\n }\n return s;\n}\nfunction isUrlTree(v) {\n return v instanceof UrlTree;\n}\n\n/**\n * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.\n *\n * @publicApi\n *\n *\n * @param relativeTo The `ActivatedRouteSnapshot` to apply the commands to\n * @param commands An array of URL fragments with which to construct the new URL tree.\n * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path\n * segments, followed by the parameters for each segment.\n * The fragments are applied to the one provided in the `relativeTo` parameter.\n * @param queryParams The query parameters for the `UrlTree`. `null` if the `UrlTree` does not have\n * any query parameters.\n * @param fragment The fragment for the `UrlTree`. `null` if the `UrlTree` does not have a fragment.\n *\n * @usageNotes\n *\n * ```\n * // create /team/33/user/11\n * createUrlTreeFromSnapshot(snapshot, ['/team', 33, 'user', 11]);\n *\n * // create /team/33;expand=true/user/11\n * createUrlTreeFromSnapshot(snapshot, ['/team', 33, {expand: true}, 'user', 11]);\n *\n * // you can collapse static segments like this (this works only with the first passed-in value):\n * createUrlTreeFromSnapshot(snapshot, ['/team/33/user', userId]);\n *\n * // If the first segment can contain slashes, and you do not want the router to split it,\n * // you can do the following:\n * createUrlTreeFromSnapshot(snapshot, [{segmentPath: '/one/two'}]);\n *\n * // create /team/33/(user/11//right:chat)\n * createUrlTreeFromSnapshot(snapshot, ['/team', 33, {outlets: {primary: 'user/11', right:\n * 'chat'}}], null, null);\n *\n * // remove the right secondary node\n * createUrlTreeFromSnapshot(snapshot, ['/team', 33, {outlets: {primary: 'user/11', right: null}}]);\n *\n * // For the examples below, assume the current URL is for the `/team/33/user/11` and the\n * `ActivatedRouteSnapshot` points to `user/11`:\n *\n * // navigate to /team/33/user/11/details\n * createUrlTreeFromSnapshot(snapshot, ['details']);\n *\n * // navigate to /team/33/user/22\n * createUrlTreeFromSnapshot(snapshot, ['../22']);\n *\n * // navigate to /team/44/user/22\n * createUrlTreeFromSnapshot(snapshot, ['../../team/44/user/22']);\n * ```\n */\nfunction createUrlTreeFromSnapshot(relativeTo, commands, queryParams = null, fragment = null) {\n const relativeToUrlSegmentGroup = createSegmentGroupFromRoute(relativeTo);\n return createUrlTreeFromSegmentGroup(relativeToUrlSegmentGroup, commands, queryParams, fragment);\n}\nfunction createSegmentGroupFromRoute(route) {\n let targetGroup;\n function createSegmentGroupFromRouteRecursive(currentRoute) {\n const childOutlets = {};\n for (const childSnapshot of currentRoute.children) {\n const root = createSegmentGroupFromRouteRecursive(childSnapshot);\n childOutlets[childSnapshot.outlet] = root;\n }\n const segmentGroup = new UrlSegmentGroup(currentRoute.url, childOutlets);\n if (currentRoute === route) {\n targetGroup = segmentGroup;\n }\n return segmentGroup;\n }\n const rootCandidate = createSegmentGroupFromRouteRecursive(route.root);\n const rootSegmentGroup = createRoot(rootCandidate);\n return targetGroup ?? rootSegmentGroup;\n}\nfunction createUrlTreeFromSegmentGroup(relativeTo, commands, queryParams, fragment) {\n let root = relativeTo;\n while (root.parent) {\n root = root.parent;\n }\n // There are no commands so the `UrlTree` goes to the same path as the one created from the\n // `UrlSegmentGroup`. All we need to do is update the `queryParams` and `fragment` without\n // applying any other logic.\n if (commands.length === 0) {\n return tree(root, root, root, queryParams, fragment);\n }\n const nav = computeNavigation(commands);\n if (nav.toRoot()) {\n return tree(root, root, new UrlSegmentGroup([], {}), queryParams, fragment);\n }\n const position = findStartingPositionForTargetGroup(nav, root, relativeTo);\n const newSegmentGroup = position.processChildren ? updateSegmentGroupChildren(position.segmentGroup, position.index, nav.commands) : updateSegmentGroup(position.segmentGroup, position.index, nav.commands);\n return tree(root, position.segmentGroup, newSegmentGroup, queryParams, fragment);\n}\nfunction isMatrixParams(command) {\n return typeof command === 'object' && command != null && !command.outlets && !command.segmentPath;\n}\n/**\n * Determines if a given command has an `outlets` map. When we encounter a command\n * with an outlets k/v map, we need to apply each outlet individually to the existing segment.\n */\nfunction isCommandWithOutlets(command) {\n return typeof command === 'object' && command != null && command.outlets;\n}\nfunction tree(oldRoot, oldSegmentGroup, newSegmentGroup, queryParams, fragment) {\n let qp = {};\n if (queryParams) {\n Object.entries(queryParams).forEach(([name, value]) => {\n qp[name] = Array.isArray(value) ? value.map(v => `${v}`) : `${value}`;\n });\n }\n let rootCandidate;\n if (oldRoot === oldSegmentGroup) {\n rootCandidate = newSegmentGroup;\n } else {\n rootCandidate = replaceSegment(oldRoot, oldSegmentGroup, newSegmentGroup);\n }\n const newRoot = createRoot(squashSegmentGroup(rootCandidate));\n return new UrlTree(newRoot, qp, fragment);\n}\n/**\n * Replaces the `oldSegment` which is located in some child of the `current` with the `newSegment`.\n * This also has the effect of creating new `UrlSegmentGroup` copies to update references. This\n * shouldn't be necessary but the fallback logic for an invalid ActivatedRoute in the creation uses\n * the Router's current url tree. If we don't create new segment groups, we end up modifying that\n * value.\n */\nfunction replaceSegment(current, oldSegment, newSegment) {\n const children = {};\n Object.entries(current.children).forEach(([outletName, c]) => {\n if (c === oldSegment) {\n children[outletName] = newSegment;\n } else {\n children[outletName] = replaceSegment(c, oldSegment, newSegment);\n }\n });\n return new UrlSegmentGroup(current.segments, children);\n}\nclass Navigation {\n constructor(isAbsolute, numberOfDoubleDots, commands) {\n this.isAbsolute = isAbsolute;\n this.numberOfDoubleDots = numberOfDoubleDots;\n this.commands = commands;\n if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {\n throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Root segment cannot have matrix parameters');\n }\n const cmdWithOutlet = commands.find(isCommandWithOutlets);\n if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {\n throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, (typeof ngDevMode === 'undefined' || ngDevMode) && '{outlets:{}} has to be the last command');\n }\n }\n toRoot() {\n return this.isAbsolute && this.commands.length === 1 && this.commands[0] == '/';\n }\n}\n/** Transforms commands to a normalized `Navigation` */\nfunction computeNavigation(commands) {\n if (typeof commands[0] === 'string' && commands.length === 1 && commands[0] === '/') {\n return new Navigation(true, 0, commands);\n }\n let numberOfDoubleDots = 0;\n let isAbsolute = false;\n const res = commands.reduce((res, cmd, cmdIdx) => {\n if (typeof cmd === 'object' && cmd != null) {\n if (cmd.outlets) {\n const outlets = {};\n Object.entries(cmd.outlets).forEach(([name, commands]) => {\n outlets[name] = typeof commands === 'string' ? commands.split('/') : commands;\n });\n return [...res, {\n outlets\n }];\n }\n if (cmd.segmentPath) {\n return [...res, cmd.segmentPath];\n }\n }\n if (!(typeof cmd === 'string')) {\n return [...res, cmd];\n }\n if (cmdIdx === 0) {\n cmd.split('/').forEach((urlPart, partIndex) => {\n if (partIndex == 0 && urlPart === '.') {\n // skip './a'\n } else if (partIndex == 0 && urlPart === '') {\n // '/a'\n isAbsolute = true;\n } else if (urlPart === '..') {\n // '../a'\n numberOfDoubleDots++;\n } else if (urlPart != '') {\n res.push(urlPart);\n }\n });\n return res;\n }\n return [...res, cmd];\n }, []);\n return new Navigation(isAbsolute, numberOfDoubleDots, res);\n}\nclass Position {\n constructor(segmentGroup, processChildren, index) {\n this.segmentGroup = segmentGroup;\n this.processChildren = processChildren;\n this.index = index;\n }\n}\nfunction findStartingPositionForTargetGroup(nav, root, target) {\n if (nav.isAbsolute) {\n return new Position(root, true, 0);\n }\n if (!target) {\n // `NaN` is used only to maintain backwards compatibility with incorrectly mocked\n // `ActivatedRouteSnapshot` in tests. In prior versions of this code, the position here was\n // determined based on an internal property that was rarely mocked, resulting in `NaN`. In\n // reality, this code path should _never_ be touched since `target` is not allowed to be falsey.\n return new Position(root, false, NaN);\n }\n if (target.parent === null) {\n return new Position(target, true, 0);\n }\n const modifier = isMatrixParams(nav.commands[0]) ? 0 : 1;\n const index = target.segments.length - 1 + modifier;\n return createPositionApplyingDoubleDots(target, index, nav.numberOfDoubleDots);\n}\nfunction createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {\n let g = group;\n let ci = index;\n let dd = numberOfDoubleDots;\n while (dd > ci) {\n dd -= ci;\n g = g.parent;\n if (!g) {\n throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, (typeof ngDevMode === 'undefined' || ngDevMode) && \"Invalid number of '../'\");\n }\n ci = g.segments.length;\n }\n return new Position(g, false, ci - dd);\n}\nfunction getOutlets(commands) {\n if (isCommandWithOutlets(commands[0])) {\n return commands[0].outlets;\n }\n return {\n [PRIMARY_OUTLET]: commands\n };\n}\nfunction updateSegmentGroup(segmentGroup, startIndex, commands) {\n segmentGroup ??= new UrlSegmentGroup([], {});\n if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {\n return updateSegmentGroupChildren(segmentGroup, startIndex, commands);\n }\n const m = prefixedWith(segmentGroup, startIndex, commands);\n const slicedCommands = commands.slice(m.commandIndex);\n if (m.match && m.pathIndex < segmentGroup.segments.length) {\n const g = new UrlSegmentGroup(segmentGroup.segments.slice(0, m.pathIndex), {});\n g.children[PRIMARY_OUTLET] = new UrlSegmentGroup(segmentGroup.segments.slice(m.pathIndex), segmentGroup.children);\n return updateSegmentGroupChildren(g, 0, slicedCommands);\n } else if (m.match && slicedCommands.length === 0) {\n return new UrlSegmentGroup(segmentGroup.segments, {});\n } else if (m.match && !segmentGroup.hasChildren()) {\n return createNewSegmentGroup(segmentGroup, startIndex, commands);\n } else if (m.match) {\n return updateSegmentGroupChildren(segmentGroup, 0, slicedCommands);\n } else {\n return createNewSegmentGroup(segmentGroup, startIndex, commands);\n }\n}\nfunction updateSegmentGroupChildren(segmentGroup, startIndex, commands) {\n if (commands.length === 0) {\n return new UrlSegmentGroup(segmentGroup.segments, {});\n } else {\n const outlets = getOutlets(commands);\n const children = {};\n // If the set of commands applies to anything other than the primary outlet and the child\n // segment is an empty path primary segment on its own, we want to apply the commands to the\n // empty child path rather than here. The outcome is that the empty primary child is effectively\n // removed from the final output UrlTree. Imagine the following config:\n //\n // {path: '', children: [{path: '**', outlet: 'popup'}]}.\n //\n // Navigation to /(popup:a) will activate the child outlet correctly Given a follow-up\n // navigation with commands\n // ['/', {outlets: {'popup': 'b'}}], we _would not_ want to apply the outlet commands to the\n // root segment because that would result in\n // //(popup:a)(popup:b) since the outlet command got applied one level above where it appears in\n // the `ActivatedRoute` rather than updating the existing one.\n //\n // Because empty paths do not appear in the URL segments and the fact that the segments used in\n // the output `UrlTree` are squashed to eliminate these empty paths where possible\n // https://github.com/angular/angular/blob/13f10de40e25c6900ca55bd83b36bd533dacfa9e/packages/router/src/url_tree.ts#L755\n // it can be hard to determine what is the right thing to do when applying commands to a\n // `UrlSegmentGroup` that is created from an \"unsquashed\"/expanded `ActivatedRoute` tree.\n // This code effectively \"squashes\" empty path primary routes when they have no siblings on\n // the same level of the tree.\n if (Object.keys(outlets).some(o => o !== PRIMARY_OUTLET) && segmentGroup.children[PRIMARY_OUTLET] && segmentGroup.numberOfChildren === 1 && segmentGroup.children[PRIMARY_OUTLET].segments.length === 0) {\n const childrenOfEmptyChild = updateSegmentGroupChildren(segmentGroup.children[PRIMARY_OUTLET], startIndex, commands);\n return new UrlSegmentGroup(segmentGroup.segments, childrenOfEmptyChild.children);\n }\n Object.entries(outlets).forEach(([outlet, commands]) => {\n if (typeof commands === 'string') {\n commands = [commands];\n }\n if (commands !== null) {\n children[outlet] = updateSegmentGroup(segmentGroup.children[outlet], startIndex, commands);\n }\n });\n Object.entries(segmentGroup.children).forEach(([childOutlet, child]) => {\n if (outlets[childOutlet] === undefined) {\n children[childOutlet] = child;\n }\n });\n return new UrlSegmentGroup(segmentGroup.segments, children);\n }\n}\nfunction prefixedWith(segmentGroup, startIndex, commands) {\n let currentCommandIndex = 0;\n let currentPathIndex = startIndex;\n const noMatch = {\n match: false,\n pathIndex: 0,\n commandIndex: 0\n };\n while (currentPathIndex < segmentGroup.segments.length) {\n if (currentCommandIndex >= commands.length) return noMatch;\n const path = segmentGroup.segments[currentPathIndex];\n const command = commands[currentCommandIndex];\n // Do not try to consume command as part of the prefixing if it has outlets because it can\n // contain outlets other than the one being processed. Consuming the outlets command would\n // result in other outlets being ignored.\n if (isCommandWithOutlets(command)) {\n break;\n }\n const curr = `${command}`;\n const next = currentCommandIndex < commands.length - 1 ? commands[currentCommandIndex + 1] : null;\n if (currentPathIndex > 0 && curr === undefined) break;\n if (curr && next && typeof next === 'object' && next.outlets === undefined) {\n if (!compare(curr, next, path)) return noMatch;\n currentCommandIndex += 2;\n } else {\n if (!compare(curr, {}, path)) return noMatch;\n currentCommandIndex++;\n }\n currentPathIndex++;\n }\n return {\n match: true,\n pathIndex: currentPathIndex,\n commandIndex: currentCommandIndex\n };\n}\nfunction createNewSegmentGroup(segmentGroup, startIndex, commands) {\n const paths = segmentGroup.segments.slice(0, startIndex);\n let i = 0;\n while (i < commands.length) {\n const command = commands[i];\n if (isCommandWithOutlets(command)) {\n const children = createNewSegmentChildren(command.outlets);\n return new UrlSegmentGroup(paths, children);\n }\n // if we start with an object literal, we need to reuse the path part from the segment\n if (i === 0 && isMatrixParams(commands[0])) {\n const p = segmentGroup.segments[startIndex];\n paths.push(new UrlSegment(p.path, stringify(commands[0])));\n i++;\n continue;\n }\n const curr = isCommandWithOutlets(command) ? command.outlets[PRIMARY_OUTLET] : `${command}`;\n const next = i < commands.length - 1 ? commands[i + 1] : null;\n if (curr && next && isMatrixParams(next)) {\n paths.push(new UrlSegment(curr, stringify(next)));\n i += 2;\n } else {\n paths.push(new UrlSegment(curr, {}));\n i++;\n }\n }\n return new UrlSegmentGroup(paths, {});\n}\nfunction createNewSegmentChildren(outlets) {\n const children = {};\n Object.entries(outlets).forEach(([outlet, commands]) => {\n if (typeof commands === 'string') {\n commands = [commands];\n }\n if (commands !== null) {\n children[outlet] = createNewSegmentGroup(new UrlSegmentGroup([], {}), 0, commands);\n }\n });\n return children;\n}\nfunction stringify(params) {\n const res = {};\n Object.entries(params).forEach(([k, v]) => res[k] = `${v}`);\n return res;\n}\nfunction compare(path, params, segment) {\n return path == segment.path && shallowEqual(params, segment.parameters);\n}\nconst IMPERATIVE_NAVIGATION = 'imperative';\n/**\n * Identifies the type of a router event.\n *\n * @publicApi\n */\nvar EventType = /*#__PURE__*/function (EventType) {\n EventType[EventType[\"NavigationStart\"] = 0] = \"NavigationStart\";\n EventType[EventType[\"NavigationEnd\"] = 1] = \"NavigationEnd\";\n EventType[EventType[\"NavigationCancel\"] = 2] = \"NavigationCancel\";\n EventType[EventType[\"NavigationError\"] = 3] = \"NavigationError\";\n EventType[EventType[\"RoutesRecognized\"] = 4] = \"RoutesRecognized\";\n EventType[EventType[\"ResolveStart\"] = 5] = \"ResolveStart\";\n EventType[EventType[\"ResolveEnd\"] = 6] = \"ResolveEnd\";\n EventType[EventType[\"GuardsCheckStart\"] = 7] = \"GuardsCheckStart\";\n EventType[EventType[\"GuardsCheckEnd\"] = 8] = \"GuardsCheckEnd\";\n EventType[EventType[\"RouteConfigLoadStart\"] = 9] = \"RouteConfigLoadStart\";\n EventType[EventType[\"RouteConfigLoadEnd\"] = 10] = \"RouteConfigLoadEnd\";\n EventType[EventType[\"ChildActivationStart\"] = 11] = \"ChildActivationStart\";\n EventType[EventType[\"ChildActivationEnd\"] = 12] = \"ChildActivationEnd\";\n EventType[EventType[\"ActivationStart\"] = 13] = \"ActivationStart\";\n EventType[EventType[\"ActivationEnd\"] = 14] = \"ActivationEnd\";\n EventType[EventType[\"Scroll\"] = 15] = \"Scroll\";\n EventType[EventType[\"NavigationSkipped\"] = 16] = \"NavigationSkipped\";\n return EventType;\n}(EventType || {});\n/**\n * Base for events the router goes through, as opposed to events tied to a specific\n * route. Fired one time for any given navigation.\n *\n * The following code shows how a class subscribes to router events.\n *\n * ```ts\n * import {Event, RouterEvent, Router} from '@angular/router';\n *\n * class MyService {\n * constructor(public router: Router) {\n * router.events.pipe(\n * filter((e: Event | RouterEvent): e is RouterEvent => e instanceof RouterEvent)\n * ).subscribe((e: RouterEvent) => {\n * // Do something\n * });\n * }\n * }\n * ```\n *\n * @see {@link Event}\n * @see [Router events summary](guide/router-reference#router-events)\n * @publicApi\n */\nclass RouterEvent {\n constructor( /** A unique ID that the router assigns to every router navigation. */\n id, /** The URL that is the destination for this navigation. */\n url) {\n this.id = id;\n this.url = url;\n }\n}\n/**\n * An event triggered when a navigation starts.\n *\n * @publicApi\n */\nclass NavigationStart extends RouterEvent {\n constructor( /** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n navigationTrigger = 'imperative', /** @docsNotRequired */\n restoredState = null) {\n super(id, url);\n this.type = EventType.NavigationStart;\n this.navigationTrigger = navigationTrigger;\n this.restoredState = restoredState;\n }\n /** @docsNotRequired */\n toString() {\n return `NavigationStart(id: ${this.id}, url: '${this.url}')`;\n }\n}\n/**\n * An event triggered when a navigation ends successfully.\n *\n * @see {@link NavigationStart}\n * @see {@link NavigationCancel}\n * @see {@link NavigationError}\n *\n * @publicApi\n */\nclass NavigationEnd extends RouterEvent {\n constructor( /** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n this.type = EventType.NavigationEnd;\n }\n /** @docsNotRequired */\n toString() {\n return `NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`;\n }\n}\n/**\n * A code for the `NavigationCancel` event of the `Router` to indicate the\n * reason a navigation failed.\n *\n * @publicApi\n */\nvar NavigationCancellationCode = /*#__PURE__*/function (NavigationCancellationCode) {\n /**\n * A navigation failed because a guard returned a `UrlTree` to redirect.\n */\n NavigationCancellationCode[NavigationCancellationCode[\"Redirect\"] = 0] = \"Redirect\";\n /**\n * A navigation failed because a more recent navigation started.\n */\n NavigationCancellationCode[NavigationCancellationCode[\"SupersededByNewNavigation\"] = 1] = \"SupersededByNewNavigation\";\n /**\n * A navigation failed because one of the resolvers completed without emitting a value.\n */\n NavigationCancellationCode[NavigationCancellationCode[\"NoDataFromResolver\"] = 2] = \"NoDataFromResolver\";\n /**\n * A navigation failed because a guard returned `false`.\n */\n NavigationCancellationCode[NavigationCancellationCode[\"GuardRejected\"] = 3] = \"GuardRejected\";\n return NavigationCancellationCode;\n}(NavigationCancellationCode || {});\n/**\n * A code for the `NavigationSkipped` event of the `Router` to indicate the\n * reason a navigation was skipped.\n *\n * @publicApi\n */\nvar NavigationSkippedCode = /*#__PURE__*/function (NavigationSkippedCode) {\n /**\n * A navigation was skipped because the navigation URL was the same as the current Router URL.\n */\n NavigationSkippedCode[NavigationSkippedCode[\"IgnoredSameUrlNavigation\"] = 0] = \"IgnoredSameUrlNavigation\";\n /**\n * A navigation was skipped because the configured `UrlHandlingStrategy` return `false` for both\n * the current Router URL and the target of the navigation.\n *\n * @see {@link UrlHandlingStrategy}\n */\n NavigationSkippedCode[NavigationSkippedCode[\"IgnoredByUrlHandlingStrategy\"] = 1] = \"IgnoredByUrlHandlingStrategy\";\n return NavigationSkippedCode;\n}(NavigationSkippedCode || {});\n/**\n * An event triggered when a navigation is canceled, directly or indirectly.\n * This can happen for several reasons including when a route guard\n * returns `false` or initiates a redirect by returning a `UrlTree`.\n *\n * @see {@link NavigationStart}\n * @see {@link NavigationEnd}\n * @see {@link NavigationError}\n *\n * @publicApi\n */\nclass NavigationCancel extends RouterEvent {\n constructor( /** @docsNotRequired */\n id, /** @docsNotRequired */\n url,\n /**\n * A description of why the navigation was cancelled. For debug purposes only. Use `code`\n * instead for a stable cancellation reason that can be used in production.\n */\n reason,\n /**\n * A code to indicate why the navigation was canceled. This cancellation code is stable for\n * the reason and can be relied on whereas the `reason` string could change and should not be\n * used in production.\n */\n code) {\n super(id, url);\n this.reason = reason;\n this.code = code;\n this.type = EventType.NavigationCancel;\n }\n /** @docsNotRequired */\n toString() {\n return `NavigationCancel(id: ${this.id}, url: '${this.url}')`;\n }\n}\n/**\n * An event triggered when a navigation is skipped.\n * This can happen for a couple reasons including onSameUrlHandling\n * is set to `ignore` and the navigation URL is not different than the\n * current state.\n *\n * @publicApi\n */\nclass NavigationSkipped extends RouterEvent {\n constructor( /** @docsNotRequired */\n id, /** @docsNotRequired */\n url,\n /**\n * A description of why the navigation was skipped. For debug purposes only. Use `code`\n * instead for a stable skipped reason that can be used in production.\n */\n reason,\n /**\n * A code to indicate why the navigation was skipped. This code is stable for\n * the reason and can be relied on whereas the `reason` string could change and should not be\n * used in production.\n */\n code) {\n super(id, url);\n this.reason = reason;\n this.code = code;\n this.type = EventType.NavigationSkipped;\n }\n}\n/**\n * An event triggered when a navigation fails due to an unexpected error.\n *\n * @see {@link NavigationStart}\n * @see {@link NavigationEnd}\n * @see {@link NavigationCancel}\n *\n * @publicApi\n */\nclass NavigationError extends RouterEvent {\n constructor( /** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n error,\n /**\n * The target of the navigation when the error occurred.\n *\n * Note that this can be `undefined` because an error could have occurred before the\n * `RouterStateSnapshot` was created for the navigation.\n */\n target) {\n super(id, url);\n this.error = error;\n this.target = target;\n this.type = EventType.NavigationError;\n }\n /** @docsNotRequired */\n toString() {\n return `NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`;\n }\n}\n/**\n * An event triggered when routes are recognized.\n *\n * @publicApi\n */\nclass RoutesRecognized extends RouterEvent {\n constructor( /** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects, /** @docsNotRequired */\n state) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n this.state = state;\n this.type = EventType.RoutesRecognized;\n }\n /** @docsNotRequired */\n toString() {\n return `RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;\n }\n}\n/**\n * An event triggered at the start of the Guard phase of routing.\n *\n * @see {@link GuardsCheckEnd}\n *\n * @publicApi\n */\nclass GuardsCheckStart extends RouterEvent {\n constructor( /** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects, /** @docsNotRequired */\n state) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n this.state = state;\n this.type = EventType.GuardsCheckStart;\n }\n toString() {\n return `GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;\n }\n}\n/**\n * An event triggered at the end of the Guard phase of routing.\n *\n * @see {@link GuardsCheckStart}\n *\n * @publicApi\n */\nclass GuardsCheckEnd extends RouterEvent {\n constructor( /** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects, /** @docsNotRequired */\n state, /** @docsNotRequired */\n shouldActivate) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n this.state = state;\n this.shouldActivate = shouldActivate;\n this.type = EventType.GuardsCheckEnd;\n }\n toString() {\n return `GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`;\n }\n}\n/**\n * An event triggered at the start of the Resolve phase of routing.\n *\n * Runs in the \"resolve\" phase whether or not there is anything to resolve.\n * In future, may change to only run when there are things to be resolved.\n *\n * @see {@link ResolveEnd}\n *\n * @publicApi\n */\nclass ResolveStart extends RouterEvent {\n constructor( /** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects, /** @docsNotRequired */\n state) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n this.state = state;\n this.type = EventType.ResolveStart;\n }\n toString() {\n return `ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;\n }\n}\n/**\n * An event triggered at the end of the Resolve phase of routing.\n * @see {@link ResolveStart}\n *\n * @publicApi\n */\nclass ResolveEnd extends RouterEvent {\n constructor( /** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects, /** @docsNotRequired */\n state) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n this.state = state;\n this.type = EventType.ResolveEnd;\n }\n toString() {\n return `ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;\n }\n}\n/**\n * An event triggered before lazy loading a route configuration.\n *\n * @see {@link RouteConfigLoadEnd}\n *\n * @publicApi\n */\nclass RouteConfigLoadStart {\n constructor( /** @docsNotRequired */\n route) {\n this.route = route;\n this.type = EventType.RouteConfigLoadStart;\n }\n toString() {\n return `RouteConfigLoadStart(path: ${this.route.path})`;\n }\n}\n/**\n * An event triggered when a route has been lazy loaded.\n *\n * @see {@link RouteConfigLoadStart}\n *\n * @publicApi\n */\nclass RouteConfigLoadEnd {\n constructor( /** @docsNotRequired */\n route) {\n this.route = route;\n this.type = EventType.RouteConfigLoadEnd;\n }\n toString() {\n return `RouteConfigLoadEnd(path: ${this.route.path})`;\n }\n}\n/**\n * An event triggered at the start of the child-activation\n * part of the Resolve phase of routing.\n * @see {@link ChildActivationEnd}\n * @see {@link ResolveStart}\n *\n * @publicApi\n */\nclass ChildActivationStart {\n constructor( /** @docsNotRequired */\n snapshot) {\n this.snapshot = snapshot;\n this.type = EventType.ChildActivationStart;\n }\n toString() {\n const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';\n return `ChildActivationStart(path: '${path}')`;\n }\n}\n/**\n * An event triggered at the end of the child-activation part\n * of the Resolve phase of routing.\n * @see {@link ChildActivationStart}\n * @see {@link ResolveStart}\n * @publicApi\n */\nclass ChildActivationEnd {\n constructor( /** @docsNotRequired */\n snapshot) {\n this.snapshot = snapshot;\n this.type = EventType.ChildActivationEnd;\n }\n toString() {\n const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';\n return `ChildActivationEnd(path: '${path}')`;\n }\n}\n/**\n * An event triggered at the start of the activation part\n * of the Resolve phase of routing.\n * @see {@link ActivationEnd}\n * @see {@link ResolveStart}\n *\n * @publicApi\n */\nclass ActivationStart {\n constructor( /** @docsNotRequired */\n snapshot) {\n this.snapshot = snapshot;\n this.type = EventType.ActivationStart;\n }\n toString() {\n const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';\n return `ActivationStart(path: '${path}')`;\n }\n}\n/**\n * An event triggered at the end of the activation part\n * of the Resolve phase of routing.\n * @see {@link ActivationStart}\n * @see {@link ResolveStart}\n *\n * @publicApi\n */\nclass ActivationEnd {\n constructor( /** @docsNotRequired */\n snapshot) {\n this.snapshot = snapshot;\n this.type = EventType.ActivationEnd;\n }\n toString() {\n const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';\n return `ActivationEnd(path: '${path}')`;\n }\n}\n/**\n * An event triggered by scrolling.\n *\n * @publicApi\n */\nclass Scroll {\n constructor( /** @docsNotRequired */\n routerEvent, /** @docsNotRequired */\n position, /** @docsNotRequired */\n anchor) {\n this.routerEvent = routerEvent;\n this.position = position;\n this.anchor = anchor;\n this.type = EventType.Scroll;\n }\n toString() {\n const pos = this.position ? `${this.position[0]}, ${this.position[1]}` : null;\n return `Scroll(anchor: '${this.anchor}', position: '${pos}')`;\n }\n}\nclass BeforeActivateRoutes {}\nclass RedirectRequest {\n constructor(url) {\n this.url = url;\n }\n}\nfunction stringifyEvent(routerEvent) {\n switch (routerEvent.type) {\n case EventType.ActivationEnd:\n return `ActivationEnd(path: '${routerEvent.snapshot.routeConfig?.path || ''}')`;\n case EventType.ActivationStart:\n return `ActivationStart(path: '${routerEvent.snapshot.routeConfig?.path || ''}')`;\n case EventType.ChildActivationEnd:\n return `ChildActivationEnd(path: '${routerEvent.snapshot.routeConfig?.path || ''}')`;\n case EventType.ChildActivationStart:\n return `ChildActivationStart(path: '${routerEvent.snapshot.routeConfig?.path || ''}')`;\n case EventType.GuardsCheckEnd:\n return `GuardsCheckEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state}, shouldActivate: ${routerEvent.shouldActivate})`;\n case EventType.GuardsCheckStart:\n return `GuardsCheckStart(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;\n case EventType.NavigationCancel:\n return `NavigationCancel(id: ${routerEvent.id}, url: '${routerEvent.url}')`;\n case EventType.NavigationSkipped:\n return `NavigationSkipped(id: ${routerEvent.id}, url: '${routerEvent.url}')`;\n case EventType.NavigationEnd:\n return `NavigationEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}')`;\n case EventType.NavigationError:\n return `NavigationError(id: ${routerEvent.id}, url: '${routerEvent.url}', error: ${routerEvent.error})`;\n case EventType.NavigationStart:\n return `NavigationStart(id: ${routerEvent.id}, url: '${routerEvent.url}')`;\n case EventType.ResolveEnd:\n return `ResolveEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;\n case EventType.ResolveStart:\n return `ResolveStart(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;\n case EventType.RouteConfigLoadEnd:\n return `RouteConfigLoadEnd(path: ${routerEvent.route.path})`;\n case EventType.RouteConfigLoadStart:\n return `RouteConfigLoadStart(path: ${routerEvent.route.path})`;\n case EventType.RoutesRecognized:\n return `RoutesRecognized(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;\n case EventType.Scroll:\n const pos = routerEvent.position ? `${routerEvent.position[0]}, ${routerEvent.position[1]}` : null;\n return `Scroll(anchor: '${routerEvent.anchor}', position: '${pos}')`;\n }\n}\n\n/**\n * Store contextual information about a `RouterOutlet`\n *\n * @publicApi\n */\nclass OutletContext {\n constructor() {\n this.outlet = null;\n this.route = null;\n this.injector = null;\n this.children = new ChildrenOutletContexts();\n this.attachRef = null;\n }\n}\n/**\n * Store contextual information about the children (= nested) `RouterOutlet`\n *\n * @publicApi\n */\nlet ChildrenOutletContexts = /*#__PURE__*/(() => {\n class ChildrenOutletContexts {\n constructor() {\n // contexts for child outlets, by name.\n this.contexts = new Map();\n }\n /** Called when a `RouterOutlet` directive is instantiated */\n onChildOutletCreated(childName, outlet) {\n const context = this.getOrCreateContext(childName);\n context.outlet = outlet;\n this.contexts.set(childName, context);\n }\n /**\n * Called when a `RouterOutlet` directive is destroyed.\n * We need to keep the context as the outlet could be destroyed inside a NgIf and might be\n * re-created later.\n */\n onChildOutletDestroyed(childName) {\n const context = this.getContext(childName);\n if (context) {\n context.outlet = null;\n context.attachRef = null;\n }\n }\n /**\n * Called when the corresponding route is deactivated during navigation.\n * Because the component get destroyed, all children outlet are destroyed.\n */\n onOutletDeactivated() {\n const contexts = this.contexts;\n this.contexts = new Map();\n return contexts;\n }\n onOutletReAttached(contexts) {\n this.contexts = contexts;\n }\n getOrCreateContext(childName) {\n let context = this.getContext(childName);\n if (!context) {\n context = new OutletContext();\n this.contexts.set(childName, context);\n }\n return context;\n }\n getContext(childName) {\n return this.contexts.get(childName) || null;\n }\n static {\n this.ɵfac = function ChildrenOutletContexts_Factory(t) {\n return new (t || ChildrenOutletContexts)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ChildrenOutletContexts,\n factory: ChildrenOutletContexts.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return ChildrenOutletContexts;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass Tree {\n constructor(root) {\n this._root = root;\n }\n get root() {\n return this._root.value;\n }\n /**\n * @internal\n */\n parent(t) {\n const p = this.pathFromRoot(t);\n return p.length > 1 ? p[p.length - 2] : null;\n }\n /**\n * @internal\n */\n children(t) {\n const n = findNode(t, this._root);\n return n ? n.children.map(t => t.value) : [];\n }\n /**\n * @internal\n */\n firstChild(t) {\n const n = findNode(t, this._root);\n return n && n.children.length > 0 ? n.children[0].value : null;\n }\n /**\n * @internal\n */\n siblings(t) {\n const p = findPath(t, this._root);\n if (p.length < 2) return [];\n const c = p[p.length - 2].children.map(c => c.value);\n return c.filter(cc => cc !== t);\n }\n /**\n * @internal\n */\n pathFromRoot(t) {\n return findPath(t, this._root).map(s => s.value);\n }\n}\n// DFS for the node matching the value\nfunction findNode(value, node) {\n if (value === node.value) return node;\n for (const child of node.children) {\n const node = findNode(value, child);\n if (node) return node;\n }\n return null;\n}\n// Return the path to the node with the given value using DFS\nfunction findPath(value, node) {\n if (value === node.value) return [node];\n for (const child of node.children) {\n const path = findPath(value, child);\n if (path.length) {\n path.unshift(node);\n return path;\n }\n }\n return [];\n}\nclass TreeNode {\n constructor(value, children) {\n this.value = value;\n this.children = children;\n }\n toString() {\n return `TreeNode(${this.value})`;\n }\n}\n// Return the list of T indexed by outlet name\nfunction nodeChildrenAsMap(node) {\n const map = {};\n if (node) {\n node.children.forEach(child => map[child.value.outlet] = child);\n }\n return map;\n}\n\n/**\n * Represents the state of the router as a tree of activated routes.\n *\n * @usageNotes\n *\n * Every node in the route tree is an `ActivatedRoute` instance\n * that knows about the \"consumed\" URL segments, the extracted parameters,\n * and the resolved data.\n * Use the `ActivatedRoute` properties to traverse the tree from any node.\n *\n * The following fragment shows how a component gets the root node\n * of the current state to establish its own route tree:\n *\n * ```\n * @Component({templateUrl:'template.html'})\n * class MyComponent {\n * constructor(router: Router) {\n * const state: RouterState = router.routerState;\n * const root: ActivatedRoute = state.root;\n * const child = root.firstChild;\n * const id: Observable = child.params.map(p => p.id);\n * //...\n * }\n * }\n * ```\n *\n * @see {@link ActivatedRoute}\n * @see [Getting route information](guide/router#getting-route-information)\n *\n * @publicApi\n */\nclass RouterState extends Tree {\n /** @internal */\n constructor(root, /** The current snapshot of the router state */\n snapshot) {\n super(root);\n this.snapshot = snapshot;\n setRouterState(this, root);\n }\n toString() {\n return this.snapshot.toString();\n }\n}\nfunction createEmptyState(rootComponent) {\n const snapshot = createEmptyStateSnapshot(rootComponent);\n const emptyUrl = new BehaviorSubject([new UrlSegment('', {})]);\n const emptyParams = new BehaviorSubject({});\n const emptyData = new BehaviorSubject({});\n const emptyQueryParams = new BehaviorSubject({});\n const fragment = new BehaviorSubject('');\n const activated = new ActivatedRoute(emptyUrl, emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, snapshot.root);\n activated.snapshot = snapshot.root;\n return new RouterState(new TreeNode(activated, []), snapshot);\n}\nfunction createEmptyStateSnapshot(rootComponent) {\n const emptyParams = {};\n const emptyData = {};\n const emptyQueryParams = {};\n const fragment = '';\n const activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, {});\n return new RouterStateSnapshot('', new TreeNode(activated, []));\n}\n/**\n * Provides access to information about a route associated with a component\n * that is loaded in an outlet.\n * Use to traverse the `RouterState` tree and extract information from nodes.\n *\n * The following example shows how to construct a component using information from a\n * currently activated route.\n *\n * Note: the observables in this class only emit when the current and previous values differ based\n * on shallow equality. For example, changing deeply nested properties in resolved `data` will not\n * cause the `ActivatedRoute.data` `Observable` to emit a new value.\n *\n * {@example router/activated-route/module.ts region=\"activated-route\"\n * header=\"activated-route.component.ts\"}\n *\n * @see [Getting route information](guide/router#getting-route-information)\n *\n * @publicApi\n */\nclass ActivatedRoute {\n /** @internal */\n constructor( /** @internal */\n urlSubject, /** @internal */\n paramsSubject, /** @internal */\n queryParamsSubject, /** @internal */\n fragmentSubject, /** @internal */\n dataSubject, /** The outlet name of the route, a constant. */\n outlet, /** The component of the route, a constant. */\n component, futureSnapshot) {\n this.urlSubject = urlSubject;\n this.paramsSubject = paramsSubject;\n this.queryParamsSubject = queryParamsSubject;\n this.fragmentSubject = fragmentSubject;\n this.dataSubject = dataSubject;\n this.outlet = outlet;\n this.component = component;\n this._futureSnapshot = futureSnapshot;\n this.title = this.dataSubject?.pipe(map(d => d[RouteTitleKey])) ?? of(undefined);\n // TODO(atscott): Verify that these can be changed to `.asObservable()` with TGP.\n this.url = urlSubject;\n this.params = paramsSubject;\n this.queryParams = queryParamsSubject;\n this.fragment = fragmentSubject;\n this.data = dataSubject;\n }\n /** The configuration used to match this route. */\n get routeConfig() {\n return this._futureSnapshot.routeConfig;\n }\n /** The root of the router state. */\n get root() {\n return this._routerState.root;\n }\n /** The parent of this route in the router state tree. */\n get parent() {\n return this._routerState.parent(this);\n }\n /** The first child of this route in the router state tree. */\n get firstChild() {\n return this._routerState.firstChild(this);\n }\n /** The children of this route in the router state tree. */\n get children() {\n return this._routerState.children(this);\n }\n /** The path from the root of the router state tree to this route. */\n get pathFromRoot() {\n return this._routerState.pathFromRoot(this);\n }\n /**\n * An Observable that contains a map of the required and optional parameters\n * specific to the route.\n * The map supports retrieving single and multiple values from the same parameter.\n */\n get paramMap() {\n this._paramMap ??= this.params.pipe(map(p => convertToParamMap(p)));\n return this._paramMap;\n }\n /**\n * An Observable that contains a map of the query parameters available to all routes.\n * The map supports retrieving single and multiple values from the query parameter.\n */\n get queryParamMap() {\n this._queryParamMap ??= this.queryParams.pipe(map(p => convertToParamMap(p)));\n return this._queryParamMap;\n }\n toString() {\n return this.snapshot ? this.snapshot.toString() : `Future(${this._futureSnapshot})`;\n }\n}\n/**\n * Returns the inherited params, data, and resolve for a given route.\n *\n * By default, we do not inherit parent data unless the current route is path-less or the parent\n * route is component-less.\n */\nfunction getInherited(route, parent, paramsInheritanceStrategy = 'emptyOnly') {\n let inherited;\n const {\n routeConfig\n } = route;\n if (parent !== null && (paramsInheritanceStrategy === 'always' ||\n // inherit parent data if route is empty path\n routeConfig?.path === '' ||\n // inherit parent data if parent was componentless\n !parent.component && !parent.routeConfig?.loadComponent)) {\n inherited = {\n params: {\n ...parent.params,\n ...route.params\n },\n data: {\n ...parent.data,\n ...route.data\n },\n resolve: {\n // Snapshots are created with data inherited from parent and guards (i.e. canActivate) can\n // change data because it's not frozen...\n // This first line could be deleted chose to break/disallow mutating the `data` object in\n // guards.\n // Note that data from parents still override this mutated data so anyone relying on this\n // might be surprised that it doesn't work if parent data is inherited but otherwise does.\n ...route.data,\n // Ensure inherited resolved data overrides inherited static data\n ...parent.data,\n // static data from the current route overrides any inherited data\n ...routeConfig?.data,\n // resolved data from current route overrides everything\n ...route._resolvedData\n }\n };\n } else {\n inherited = {\n params: {\n ...route.params\n },\n data: {\n ...route.data\n },\n resolve: {\n ...route.data,\n ...(route._resolvedData ?? {})\n }\n };\n }\n if (routeConfig && hasStaticTitle(routeConfig)) {\n inherited.resolve[RouteTitleKey] = routeConfig.title;\n }\n return inherited;\n}\n/**\n * @description\n *\n * Contains the information about a route associated with a component loaded in an\n * outlet at a particular moment in time. ActivatedRouteSnapshot can also be used to\n * traverse the router state tree.\n *\n * The following example initializes a component with route information extracted\n * from the snapshot of the root node at the time of creation.\n *\n * ```\n * @Component({templateUrl:'./my-component.html'})\n * class MyComponent {\n * constructor(route: ActivatedRoute) {\n * const id: string = route.snapshot.params.id;\n * const url: string = route.snapshot.url.join('');\n * const user = route.snapshot.data.user;\n * }\n * }\n * ```\n *\n * @publicApi\n */\nclass ActivatedRouteSnapshot {\n /** The resolved route title */\n get title() {\n // Note: This _must_ be a getter because the data is mutated in the resolvers. Title will not be\n // available at the time of class instantiation.\n return this.data?.[RouteTitleKey];\n }\n /** @internal */\n constructor( /** The URL segments matched by this route */\n url,\n /**\n * The matrix parameters scoped to this route.\n *\n * You can compute all params (or data) in the router state or to get params outside\n * of an activated component by traversing the `RouterState` tree as in the following\n * example:\n * ```\n * collectRouteParams(router: Router) {\n * let params = {};\n * let stack: ActivatedRouteSnapshot[] = [router.routerState.snapshot.root];\n * while (stack.length > 0) {\n * const route = stack.pop()!;\n * params = {...params, ...route.params};\n * stack.push(...route.children);\n * }\n * return params;\n * }\n * ```\n */\n params, /** The query parameters shared by all the routes */\n queryParams, /** The URL fragment shared by all the routes */\n fragment, /** The static and resolved data of this route */\n data, /** The outlet name of the route */\n outlet, /** The component of the route */\n component, routeConfig, resolve) {\n this.url = url;\n this.params = params;\n this.queryParams = queryParams;\n this.fragment = fragment;\n this.data = data;\n this.outlet = outlet;\n this.component = component;\n this.routeConfig = routeConfig;\n this._resolve = resolve;\n }\n /** The root of the router state */\n get root() {\n return this._routerState.root;\n }\n /** The parent of this route in the router state tree */\n get parent() {\n return this._routerState.parent(this);\n }\n /** The first child of this route in the router state tree */\n get firstChild() {\n return this._routerState.firstChild(this);\n }\n /** The children of this route in the router state tree */\n get children() {\n return this._routerState.children(this);\n }\n /** The path from the root of the router state tree to this route */\n get pathFromRoot() {\n return this._routerState.pathFromRoot(this);\n }\n get paramMap() {\n this._paramMap ??= convertToParamMap(this.params);\n return this._paramMap;\n }\n get queryParamMap() {\n this._queryParamMap ??= convertToParamMap(this.queryParams);\n return this._queryParamMap;\n }\n toString() {\n const url = this.url.map(segment => segment.toString()).join('/');\n const matched = this.routeConfig ? this.routeConfig.path : '';\n return `Route(url:'${url}', path:'${matched}')`;\n }\n}\n/**\n * @description\n *\n * Represents the state of the router at a moment in time.\n *\n * This is a tree of activated route snapshots. Every node in this tree knows about\n * the \"consumed\" URL segments, the extracted parameters, and the resolved data.\n *\n * The following example shows how a component is initialized with information\n * from the snapshot of the root node's state at the time of creation.\n *\n * ```\n * @Component({templateUrl:'template.html'})\n * class MyComponent {\n * constructor(router: Router) {\n * const state: RouterState = router.routerState;\n * const snapshot: RouterStateSnapshot = state.snapshot;\n * const root: ActivatedRouteSnapshot = snapshot.root;\n * const child = root.firstChild;\n * const id: Observable = child.params.map(p => p.id);\n * //...\n * }\n * }\n * ```\n *\n * @publicApi\n */\nclass RouterStateSnapshot extends Tree {\n /** @internal */\n constructor( /** The url from which this snapshot was created */\n url, root) {\n super(root);\n this.url = url;\n setRouterState(this, root);\n }\n toString() {\n return serializeNode(this._root);\n }\n}\nfunction setRouterState(state, node) {\n node.value._routerState = state;\n node.children.forEach(c => setRouterState(state, c));\n}\nfunction serializeNode(node) {\n const c = node.children.length > 0 ? ` { ${node.children.map(serializeNode).join(', ')} } ` : '';\n return `${node.value}${c}`;\n}\n/**\n * The expectation is that the activate route is created with the right set of parameters.\n * So we push new values into the observables only when they are not the initial values.\n * And we detect that by checking if the snapshot field is set.\n */\nfunction advanceActivatedRoute(route) {\n if (route.snapshot) {\n const currentSnapshot = route.snapshot;\n const nextSnapshot = route._futureSnapshot;\n route.snapshot = nextSnapshot;\n if (!shallowEqual(currentSnapshot.queryParams, nextSnapshot.queryParams)) {\n route.queryParamsSubject.next(nextSnapshot.queryParams);\n }\n if (currentSnapshot.fragment !== nextSnapshot.fragment) {\n route.fragmentSubject.next(nextSnapshot.fragment);\n }\n if (!shallowEqual(currentSnapshot.params, nextSnapshot.params)) {\n route.paramsSubject.next(nextSnapshot.params);\n }\n if (!shallowEqualArrays(currentSnapshot.url, nextSnapshot.url)) {\n route.urlSubject.next(nextSnapshot.url);\n }\n if (!shallowEqual(currentSnapshot.data, nextSnapshot.data)) {\n route.dataSubject.next(nextSnapshot.data);\n }\n } else {\n route.snapshot = route._futureSnapshot;\n // this is for resolved data\n route.dataSubject.next(route._futureSnapshot.data);\n }\n}\nfunction equalParamsAndUrlSegments(a, b) {\n const equalUrlParams = shallowEqual(a.params, b.params) && equalSegments(a.url, b.url);\n const parentsMismatch = !a.parent !== !b.parent;\n return equalUrlParams && !parentsMismatch && (!a.parent || equalParamsAndUrlSegments(a.parent, b.parent));\n}\nfunction hasStaticTitle(config) {\n return typeof config.title === 'string' || config.title === null;\n}\n\n/**\n * @description\n *\n * Acts as a placeholder that Angular dynamically fills based on the current router state.\n *\n * Each outlet can have a unique name, determined by the optional `name` attribute.\n * The name cannot be set or changed dynamically. If not set, default value is \"primary\".\n *\n * ```\n * \n * \n * \n * ```\n *\n * Named outlets can be the targets of secondary routes.\n * The `Route` object for a secondary route has an `outlet` property to identify the target outlet:\n *\n * `{path: , component: , outlet: }`\n *\n * Using named outlets and secondary routes, you can target multiple outlets in\n * the same `RouterLink` directive.\n *\n * The router keeps track of separate branches in a navigation tree for each named outlet and\n * generates a representation of that tree in the URL.\n * The URL for a secondary route uses the following syntax to specify both the primary and secondary\n * routes at the same time:\n *\n * `http://base-path/primary-route-path(outlet-name:route-path)`\n *\n * A router outlet emits an activate event when a new component is instantiated,\n * deactivate event when a component is destroyed.\n * An attached event emits when the `RouteReuseStrategy` instructs the outlet to reattach the\n * subtree, and the detached event emits when the `RouteReuseStrategy` instructs the outlet to\n * detach the subtree.\n *\n * ```\n * \n * ```\n *\n * @see [Routing tutorial](guide/router-tutorial-toh#named-outlets \"Example of a named\n * outlet and secondary route configuration\").\n * @see {@link RouterLink}\n * @see {@link Route}\n * @ngModule RouterModule\n *\n * @publicApi\n */\nlet RouterOutlet = /*#__PURE__*/(() => {\n class RouterOutlet {\n constructor() {\n this.activated = null;\n this._activatedRoute = null;\n /**\n * The name of the outlet\n *\n * @see [named outlets](guide/router-tutorial-toh#displaying-multiple-routes-in-named-outlets)\n */\n this.name = PRIMARY_OUTLET;\n this.activateEvents = new EventEmitter();\n this.deactivateEvents = new EventEmitter();\n /**\n * Emits an attached component instance when the `RouteReuseStrategy` instructs to re-attach a\n * previously detached subtree.\n **/\n this.attachEvents = new EventEmitter();\n /**\n * Emits a detached component instance when the `RouteReuseStrategy` instructs to detach the\n * subtree.\n */\n this.detachEvents = new EventEmitter();\n this.parentContexts = inject(ChildrenOutletContexts);\n this.location = inject(ViewContainerRef);\n this.changeDetector = inject(ChangeDetectorRef);\n this.environmentInjector = inject(EnvironmentInjector);\n this.inputBinder = inject(INPUT_BINDER, {\n optional: true\n });\n /** @nodoc */\n this.supportsBindingToComponentInputs = true;\n }\n /** @internal */\n get activatedComponentRef() {\n return this.activated;\n }\n /** @nodoc */\n ngOnChanges(changes) {\n if (changes['name']) {\n const {\n firstChange,\n previousValue\n } = changes['name'];\n if (firstChange) {\n // The first change is handled by ngOnInit. Because ngOnChanges doesn't get called when no\n // input is set at all, we need to centrally handle the first change there.\n return;\n }\n // unregister with the old name\n if (this.isTrackedInParentContexts(previousValue)) {\n this.deactivate();\n this.parentContexts.onChildOutletDestroyed(previousValue);\n }\n // register the new name\n this.initializeOutletWithName();\n }\n }\n /** @nodoc */\n ngOnDestroy() {\n // Ensure that the registered outlet is this one before removing it on the context.\n if (this.isTrackedInParentContexts(this.name)) {\n this.parentContexts.onChildOutletDestroyed(this.name);\n }\n this.inputBinder?.unsubscribeFromRouteData(this);\n }\n isTrackedInParentContexts(outletName) {\n return this.parentContexts.getContext(outletName)?.outlet === this;\n }\n /** @nodoc */\n ngOnInit() {\n this.initializeOutletWithName();\n }\n initializeOutletWithName() {\n this.parentContexts.onChildOutletCreated(this.name, this);\n if (this.activated) {\n return;\n }\n // If the outlet was not instantiated at the time the route got activated we need to populate\n // the outlet when it is initialized (ie inside a NgIf)\n const context = this.parentContexts.getContext(this.name);\n if (context?.route) {\n if (context.attachRef) {\n // `attachRef` is populated when there is an existing component to mount\n this.attach(context.attachRef, context.route);\n } else {\n // otherwise the component defined in the configuration is created\n this.activateWith(context.route, context.injector);\n }\n }\n }\n get isActivated() {\n return !!this.activated;\n }\n /**\n * @returns The currently activated component instance.\n * @throws An error if the outlet is not activated.\n */\n get component() {\n if (!this.activated) throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Outlet is not activated');\n return this.activated.instance;\n }\n get activatedRoute() {\n if (!this.activated) throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Outlet is not activated');\n return this._activatedRoute;\n }\n get activatedRouteData() {\n if (this._activatedRoute) {\n return this._activatedRoute.snapshot.data;\n }\n return {};\n }\n /**\n * Called when the `RouteReuseStrategy` instructs to detach the subtree\n */\n detach() {\n if (!this.activated) throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Outlet is not activated');\n this.location.detach();\n const cmp = this.activated;\n this.activated = null;\n this._activatedRoute = null;\n this.detachEvents.emit(cmp.instance);\n return cmp;\n }\n /**\n * Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree\n */\n attach(ref, activatedRoute) {\n this.activated = ref;\n this._activatedRoute = activatedRoute;\n this.location.insert(ref.hostView);\n this.inputBinder?.bindActivatedRouteToOutletComponent(this);\n this.attachEvents.emit(ref.instance);\n }\n deactivate() {\n if (this.activated) {\n const c = this.component;\n this.activated.destroy();\n this.activated = null;\n this._activatedRoute = null;\n this.deactivateEvents.emit(c);\n }\n }\n activateWith(activatedRoute, environmentInjector) {\n if (this.isActivated) {\n throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Cannot activate an already activated outlet');\n }\n this._activatedRoute = activatedRoute;\n const location = this.location;\n const snapshot = activatedRoute.snapshot;\n const component = snapshot.component;\n const childContexts = this.parentContexts.getOrCreateContext(this.name).children;\n const injector = new OutletInjector(activatedRoute, childContexts, location.injector);\n this.activated = location.createComponent(component, {\n index: location.length,\n injector,\n environmentInjector: environmentInjector ?? this.environmentInjector\n });\n // Calling `markForCheck` to make sure we will run the change detection when the\n // `RouterOutlet` is inside a `ChangeDetectionStrategy.OnPush` component.\n this.changeDetector.markForCheck();\n this.inputBinder?.bindActivatedRouteToOutletComponent(this);\n this.activateEvents.emit(this.activated.instance);\n }\n static {\n this.ɵfac = function RouterOutlet_Factory(t) {\n return new (t || RouterOutlet)();\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: RouterOutlet,\n selectors: [[\"router-outlet\"]],\n inputs: {\n name: \"name\"\n },\n outputs: {\n activateEvents: \"activate\",\n deactivateEvents: \"deactivate\",\n attachEvents: \"attach\",\n detachEvents: \"detach\"\n },\n exportAs: [\"outlet\"],\n standalone: true,\n features: [i0.ɵɵNgOnChangesFeature]\n });\n }\n }\n return RouterOutlet;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass OutletInjector {\n constructor(route, childContexts, parent) {\n this.route = route;\n this.childContexts = childContexts;\n this.parent = parent;\n /**\n * A special flag that allows to identify the `OutletInjector` without\n * referring to the class itself. This is required as a temporary solution,\n * to have a special handling for this injector in core. Eventually, this\n * injector should just become an `EnvironmentInjector` without special logic.\n */\n this.__ngOutletInjector = true;\n }\n get(token, notFoundValue) {\n if (token === ActivatedRoute) {\n return this.route;\n }\n if (token === ChildrenOutletContexts) {\n return this.childContexts;\n }\n return this.parent.get(token, notFoundValue);\n }\n}\nconst INPUT_BINDER = /*#__PURE__*/new InjectionToken('');\n/**\n * Injectable used as a tree-shakable provider for opting in to binding router data to component\n * inputs.\n *\n * The RouterOutlet registers itself with this service when an `ActivatedRoute` is attached or\n * activated. When this happens, the service subscribes to the `ActivatedRoute` observables (params,\n * queryParams, data) and sets the inputs of the component using `ComponentRef.setInput`.\n * Importantly, when an input does not have an item in the route data with a matching key, this\n * input is set to `undefined`. If it were not done this way, the previous information would be\n * retained if the data got removed from the route (i.e. if a query parameter is removed).\n *\n * The `RouterOutlet` should unregister itself when destroyed via `unsubscribeFromRouteData` so that\n * the subscriptions are cleaned up.\n */\nlet RoutedComponentInputBinder = /*#__PURE__*/(() => {\n class RoutedComponentInputBinder {\n constructor() {\n this.outletDataSubscriptions = new Map();\n }\n bindActivatedRouteToOutletComponent(outlet) {\n this.unsubscribeFromRouteData(outlet);\n this.subscribeToRouteData(outlet);\n }\n unsubscribeFromRouteData(outlet) {\n this.outletDataSubscriptions.get(outlet)?.unsubscribe();\n this.outletDataSubscriptions.delete(outlet);\n }\n subscribeToRouteData(outlet) {\n const {\n activatedRoute\n } = outlet;\n const dataSubscription = combineLatest([activatedRoute.queryParams, activatedRoute.params, activatedRoute.data]).pipe(switchMap(([queryParams, params, data], index) => {\n data = {\n ...queryParams,\n ...params,\n ...data\n };\n // Get the first result from the data subscription synchronously so it's available to\n // the component as soon as possible (and doesn't require a second change detection).\n if (index === 0) {\n return of(data);\n }\n // Promise.resolve is used to avoid synchronously writing the wrong data when\n // two of the Observables in the `combineLatest` stream emit one after\n // another.\n return Promise.resolve(data);\n })).subscribe(data => {\n // Outlet may have been deactivated or changed names to be associated with a different\n // route\n if (!outlet.isActivated || !outlet.activatedComponentRef || outlet.activatedRoute !== activatedRoute || activatedRoute.component === null) {\n this.unsubscribeFromRouteData(outlet);\n return;\n }\n const mirror = reflectComponentType(activatedRoute.component);\n if (!mirror) {\n this.unsubscribeFromRouteData(outlet);\n return;\n }\n for (const {\n templateName\n } of mirror.inputs) {\n outlet.activatedComponentRef.setInput(templateName, data[templateName]);\n }\n });\n this.outletDataSubscriptions.set(outlet, dataSubscription);\n }\n static {\n this.ɵfac = function RoutedComponentInputBinder_Factory(t) {\n return new (t || RoutedComponentInputBinder)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RoutedComponentInputBinder,\n factory: RoutedComponentInputBinder.ɵfac\n });\n }\n }\n return RoutedComponentInputBinder;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction createRouterState(routeReuseStrategy, curr, prevState) {\n const root = createNode(routeReuseStrategy, curr._root, prevState ? prevState._root : undefined);\n return new RouterState(root, curr);\n}\nfunction createNode(routeReuseStrategy, curr, prevState) {\n // reuse an activated route that is currently displayed on the screen\n if (prevState && routeReuseStrategy.shouldReuseRoute(curr.value, prevState.value.snapshot)) {\n const value = prevState.value;\n value._futureSnapshot = curr.value;\n const children = createOrReuseChildren(routeReuseStrategy, curr, prevState);\n return new TreeNode(value, children);\n } else {\n if (routeReuseStrategy.shouldAttach(curr.value)) {\n // retrieve an activated route that is used to be displayed, but is not currently displayed\n const detachedRouteHandle = routeReuseStrategy.retrieve(curr.value);\n if (detachedRouteHandle !== null) {\n const tree = detachedRouteHandle.route;\n tree.value._futureSnapshot = curr.value;\n tree.children = curr.children.map(c => createNode(routeReuseStrategy, c));\n return tree;\n }\n }\n const value = createActivatedRoute(curr.value);\n const children = curr.children.map(c => createNode(routeReuseStrategy, c));\n return new TreeNode(value, children);\n }\n}\nfunction createOrReuseChildren(routeReuseStrategy, curr, prevState) {\n return curr.children.map(child => {\n for (const p of prevState.children) {\n if (routeReuseStrategy.shouldReuseRoute(child.value, p.value.snapshot)) {\n return createNode(routeReuseStrategy, child, p);\n }\n }\n return createNode(routeReuseStrategy, child);\n });\n}\nfunction createActivatedRoute(c) {\n return new ActivatedRoute(new BehaviorSubject(c.url), new BehaviorSubject(c.params), new BehaviorSubject(c.queryParams), new BehaviorSubject(c.fragment), new BehaviorSubject(c.data), c.outlet, c.component, c);\n}\nconst NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';\nfunction redirectingNavigationError(urlSerializer, redirect) {\n const {\n redirectTo,\n navigationBehaviorOptions\n } = isUrlTree(redirect) ? {\n redirectTo: redirect,\n navigationBehaviorOptions: undefined\n } : redirect;\n const error = navigationCancelingError(ngDevMode && `Redirecting to \"${urlSerializer.serialize(redirectTo)}\"`, NavigationCancellationCode.Redirect);\n error.url = redirectTo;\n error.navigationBehaviorOptions = navigationBehaviorOptions;\n return error;\n}\nfunction navigationCancelingError(message, code) {\n const error = new Error(`NavigationCancelingError: ${message || ''}`);\n error[NAVIGATION_CANCELING_ERROR] = true;\n error.cancellationCode = code;\n return error;\n}\nfunction isRedirectingNavigationCancelingError(error) {\n return isNavigationCancelingError(error) && isUrlTree(error.url);\n}\nfunction isNavigationCancelingError(error) {\n return !!error && error[NAVIGATION_CANCELING_ERROR];\n}\n\n/**\n * This component is used internally within the router to be a placeholder when an empty\n * router-outlet is needed. For example, with a config such as:\n *\n * `{path: 'parent', outlet: 'nav', children: [...]}`\n *\n * In order to render, there needs to be a component on this config, which will default\n * to this `EmptyOutletComponent`.\n */\nlet ɵEmptyOutletComponent = /*#__PURE__*/(() => {\n class ɵEmptyOutletComponent {\n static {\n this.ɵfac = function ɵEmptyOutletComponent_Factory(t) {\n return new (t || ɵEmptyOutletComponent)();\n };\n }\n static {\n this.ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: ɵEmptyOutletComponent,\n selectors: [[\"ng-component\"]],\n standalone: true,\n features: [i0.ɵɵStandaloneFeature],\n decls: 1,\n vars: 0,\n template: function _EmptyOutletComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"router-outlet\");\n }\n },\n dependencies: [RouterOutlet],\n encapsulation: 2\n });\n }\n }\n return ɵEmptyOutletComponent;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Creates an `EnvironmentInjector` if the `Route` has providers and one does not already exist\n * and returns the injector. Otherwise, if the `Route` does not have `providers`, returns the\n * `currentInjector`.\n *\n * @param route The route that might have providers\n * @param currentInjector The parent injector of the `Route`\n */\nfunction getOrCreateRouteInjectorIfNeeded(route, currentInjector) {\n if (route.providers && !route._injector) {\n route._injector = createEnvironmentInjector(route.providers, currentInjector, `Route: ${route.path}`);\n }\n return route._injector ?? currentInjector;\n}\nfunction getLoadedRoutes(route) {\n return route._loadedRoutes;\n}\nfunction getLoadedInjector(route) {\n return route._loadedInjector;\n}\nfunction getLoadedComponent(route) {\n return route._loadedComponent;\n}\nfunction getProvidersInjector(route) {\n return route._injector;\n}\nfunction validateConfig(config, parentPath = '', requireStandaloneComponents = false) {\n // forEach doesn't iterate undefined values\n for (let i = 0; i < config.length; i++) {\n const route = config[i];\n const fullPath = getFullPath(parentPath, route);\n validateNode(route, fullPath, requireStandaloneComponents);\n }\n}\nfunction assertStandalone(fullPath, component) {\n if (component && ɵisNgModule(component)) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. You are using 'loadComponent' with a module, ` + `but it must be used with standalone components. Use 'loadChildren' instead.`);\n } else if (component && !isStandalone(component)) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);\n }\n}\nfunction validateNode(route, fullPath, requireStandaloneComponents) {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (!route) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `\n Invalid configuration of route '${fullPath}': Encountered undefined route.\n The reason might be an extra comma.\n\n Example:\n const routes: Routes = [\n { path: '', redirectTo: '/dashboard', pathMatch: 'full' },\n { path: 'dashboard', component: DashboardComponent },, << two commas\n { path: 'detail/:id', component: HeroDetailComponent }\n ];\n `);\n }\n if (Array.isArray(route)) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': Array cannot be specified`);\n }\n if (!route.redirectTo && !route.component && !route.loadComponent && !route.children && !route.loadChildren && route.outlet && route.outlet !== PRIMARY_OUTLET) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);\n }\n if (route.redirectTo && route.children) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);\n }\n if (route.redirectTo && route.loadChildren) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);\n }\n if (route.children && route.loadChildren) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);\n }\n if (route.redirectTo && (route.component || route.loadComponent)) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);\n }\n if (route.component && route.loadComponent) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);\n }\n if (route.redirectTo && route.canActivate) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and canActivate cannot be used together. Redirects happen before activation ` + `so canActivate will never be executed.`);\n }\n if (route.path && route.matcher) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);\n }\n if (route.redirectTo === void 0 && !route.component && !route.loadComponent && !route.children && !route.loadChildren) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren`);\n }\n if (route.path === void 0 && route.matcher === void 0) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);\n }\n if (typeof route.path === 'string' && route.path.charAt(0) === '/') {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);\n }\n if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {\n const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '{path: \"${fullPath}\", redirectTo: \"${route.redirectTo}\"}': please provide 'pathMatch'. ${exp}`);\n }\n if (requireStandaloneComponents) {\n assertStandalone(fullPath, route.component);\n }\n }\n if (route.children) {\n validateConfig(route.children, fullPath, requireStandaloneComponents);\n }\n}\nfunction getFullPath(parentPath, currentRoute) {\n if (!currentRoute) {\n return parentPath;\n }\n if (!parentPath && !currentRoute.path) {\n return '';\n } else if (parentPath && !currentRoute.path) {\n return `${parentPath}/`;\n } else if (!parentPath && currentRoute.path) {\n return currentRoute.path;\n } else {\n return `${parentPath}/${currentRoute.path}`;\n }\n}\n/**\n * Makes a copy of the config and adds any default required properties.\n */\nfunction standardizeConfig(r) {\n const children = r.children && r.children.map(standardizeConfig);\n const c = children ? {\n ...r,\n children\n } : {\n ...r\n };\n if (!c.component && !c.loadComponent && (children || c.loadChildren) && c.outlet && c.outlet !== PRIMARY_OUTLET) {\n c.component = ɵEmptyOutletComponent;\n }\n return c;\n}\n/** Returns the `route.outlet` or PRIMARY_OUTLET if none exists. */\nfunction getOutlet(route) {\n return route.outlet || PRIMARY_OUTLET;\n}\n/**\n * Sorts the `routes` such that the ones with an outlet matching `outletName` come first.\n * The order of the configs is otherwise preserved.\n */\nfunction sortByMatchingOutlets(routes, outletName) {\n const sortedConfig = routes.filter(r => getOutlet(r) === outletName);\n sortedConfig.push(...routes.filter(r => getOutlet(r) !== outletName));\n return sortedConfig;\n}\n/**\n * Gets the first injector in the snapshot's parent tree.\n *\n * If the `Route` has a static list of providers, the returned injector will be the one created from\n * those. If it does not exist, the returned injector may come from the parents, which may be from a\n * loaded config or their static providers.\n *\n * Returns `null` if there is neither this nor any parents have a stored injector.\n *\n * Generally used for retrieving the injector to use for getting tokens for guards/resolvers and\n * also used for getting the correct injector to use for creating components.\n */\nfunction getClosestRouteInjector(snapshot) {\n if (!snapshot) return null;\n // If the current route has its own injector, which is created from the static providers on the\n // route itself, we should use that. Otherwise, we start at the parent since we do not want to\n // include the lazy loaded injector from this route.\n if (snapshot.routeConfig?._injector) {\n return snapshot.routeConfig._injector;\n }\n for (let s = snapshot.parent; s; s = s.parent) {\n const route = s.routeConfig;\n // Note that the order here is important. `_loadedInjector` stored on the route with\n // `loadChildren: () => NgModule` so it applies to child routes with priority. The `_injector`\n // is created from the static providers on that parent route, so it applies to the children as\n // well, but only if there is no lazy loaded NgModuleRef injector.\n if (route?._loadedInjector) return route._loadedInjector;\n if (route?._injector) return route._injector;\n }\n return null;\n}\nlet warnedAboutUnsupportedInputBinding = false;\nconst activateRoutes = (rootContexts, routeReuseStrategy, forwardEvent, inputBindingEnabled) => map(t => {\n new ActivateRoutes(routeReuseStrategy, t.targetRouterState, t.currentRouterState, forwardEvent, inputBindingEnabled).activate(rootContexts);\n return t;\n});\nclass ActivateRoutes {\n constructor(routeReuseStrategy, futureState, currState, forwardEvent, inputBindingEnabled) {\n this.routeReuseStrategy = routeReuseStrategy;\n this.futureState = futureState;\n this.currState = currState;\n this.forwardEvent = forwardEvent;\n this.inputBindingEnabled = inputBindingEnabled;\n }\n activate(parentContexts) {\n const futureRoot = this.futureState._root;\n const currRoot = this.currState ? this.currState._root : null;\n this.deactivateChildRoutes(futureRoot, currRoot, parentContexts);\n advanceActivatedRoute(this.futureState.root);\n this.activateChildRoutes(futureRoot, currRoot, parentContexts);\n }\n // De-activate the child route that are not re-used for the future state\n deactivateChildRoutes(futureNode, currNode, contexts) {\n const children = nodeChildrenAsMap(currNode);\n // Recurse on the routes active in the future state to de-activate deeper children\n futureNode.children.forEach(futureChild => {\n const childOutletName = futureChild.value.outlet;\n this.deactivateRoutes(futureChild, children[childOutletName], contexts);\n delete children[childOutletName];\n });\n // De-activate the routes that will not be re-used\n Object.values(children).forEach(v => {\n this.deactivateRouteAndItsChildren(v, contexts);\n });\n }\n deactivateRoutes(futureNode, currNode, parentContext) {\n const future = futureNode.value;\n const curr = currNode ? currNode.value : null;\n if (future === curr) {\n // Reusing the node, check to see if the children need to be de-activated\n if (future.component) {\n // If we have a normal route, we need to go through an outlet.\n const context = parentContext.getContext(future.outlet);\n if (context) {\n this.deactivateChildRoutes(futureNode, currNode, context.children);\n }\n } else {\n // if we have a componentless route, we recurse but keep the same outlet map.\n this.deactivateChildRoutes(futureNode, currNode, parentContext);\n }\n } else {\n if (curr) {\n // Deactivate the current route which will not be re-used\n this.deactivateRouteAndItsChildren(currNode, parentContext);\n }\n }\n }\n deactivateRouteAndItsChildren(route, parentContexts) {\n // If there is no component, the Route is never attached to an outlet (because there is no\n // component to attach).\n if (route.value.component && this.routeReuseStrategy.shouldDetach(route.value.snapshot)) {\n this.detachAndStoreRouteSubtree(route, parentContexts);\n } else {\n this.deactivateRouteAndOutlet(route, parentContexts);\n }\n }\n detachAndStoreRouteSubtree(route, parentContexts) {\n const context = parentContexts.getContext(route.value.outlet);\n const contexts = context && route.value.component ? context.children : parentContexts;\n const children = nodeChildrenAsMap(route);\n for (const treeNode of Object.values(children)) {\n this.deactivateRouteAndItsChildren(treeNode, contexts);\n }\n if (context && context.outlet) {\n const componentRef = context.outlet.detach();\n const contexts = context.children.onOutletDeactivated();\n this.routeReuseStrategy.store(route.value.snapshot, {\n componentRef,\n route,\n contexts\n });\n }\n }\n deactivateRouteAndOutlet(route, parentContexts) {\n const context = parentContexts.getContext(route.value.outlet);\n // The context could be `null` if we are on a componentless route but there may still be\n // children that need deactivating.\n const contexts = context && route.value.component ? context.children : parentContexts;\n const children = nodeChildrenAsMap(route);\n for (const treeNode of Object.values(children)) {\n this.deactivateRouteAndItsChildren(treeNode, contexts);\n }\n if (context) {\n if (context.outlet) {\n // Destroy the component\n context.outlet.deactivate();\n // Destroy the contexts for all the outlets that were in the component\n context.children.onOutletDeactivated();\n }\n // Clear the information about the attached component on the context but keep the reference to\n // the outlet. Clear even if outlet was not yet activated to avoid activating later with old\n // info\n context.attachRef = null;\n context.route = null;\n }\n }\n activateChildRoutes(futureNode, currNode, contexts) {\n const children = nodeChildrenAsMap(currNode);\n futureNode.children.forEach(c => {\n this.activateRoutes(c, children[c.value.outlet], contexts);\n this.forwardEvent(new ActivationEnd(c.value.snapshot));\n });\n if (futureNode.children.length) {\n this.forwardEvent(new ChildActivationEnd(futureNode.value.snapshot));\n }\n }\n activateRoutes(futureNode, currNode, parentContexts) {\n const future = futureNode.value;\n const curr = currNode ? currNode.value : null;\n advanceActivatedRoute(future);\n // reusing the node\n if (future === curr) {\n if (future.component) {\n // If we have a normal route, we need to go through an outlet.\n const context = parentContexts.getOrCreateContext(future.outlet);\n this.activateChildRoutes(futureNode, currNode, context.children);\n } else {\n // if we have a componentless route, we recurse but keep the same outlet map.\n this.activateChildRoutes(futureNode, currNode, parentContexts);\n }\n } else {\n if (future.component) {\n // if we have a normal route, we need to place the component into the outlet and recurse.\n const context = parentContexts.getOrCreateContext(future.outlet);\n if (this.routeReuseStrategy.shouldAttach(future.snapshot)) {\n const stored = this.routeReuseStrategy.retrieve(future.snapshot);\n this.routeReuseStrategy.store(future.snapshot, null);\n context.children.onOutletReAttached(stored.contexts);\n context.attachRef = stored.componentRef;\n context.route = stored.route.value;\n if (context.outlet) {\n // Attach right away when the outlet has already been instantiated\n // Otherwise attach from `RouterOutlet.ngOnInit` when it is instantiated\n context.outlet.attach(stored.componentRef, stored.route.value);\n }\n advanceActivatedRoute(stored.route.value);\n this.activateChildRoutes(futureNode, null, context.children);\n } else {\n const injector = getClosestRouteInjector(future.snapshot);\n context.attachRef = null;\n context.route = future;\n context.injector = injector;\n if (context.outlet) {\n // Activate the outlet when it has already been instantiated\n // Otherwise it will get activated from its `ngOnInit` when instantiated\n context.outlet.activateWith(future, context.injector);\n }\n this.activateChildRoutes(futureNode, null, context.children);\n }\n } else {\n // if we have a componentless route, we recurse but keep the same outlet map.\n this.activateChildRoutes(futureNode, null, parentContexts);\n }\n }\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const context = parentContexts.getOrCreateContext(future.outlet);\n const outlet = context.outlet;\n if (outlet && this.inputBindingEnabled && !outlet.supportsBindingToComponentInputs && !warnedAboutUnsupportedInputBinding) {\n console.warn(`'withComponentInputBinding' feature is enabled but ` + `this application is using an outlet that may not support binding to component inputs.`);\n warnedAboutUnsupportedInputBinding = true;\n }\n }\n }\n}\nclass CanActivate {\n constructor(path) {\n this.path = path;\n this.route = this.path[this.path.length - 1];\n }\n}\nclass CanDeactivate {\n constructor(component, route) {\n this.component = component;\n this.route = route;\n }\n}\nfunction getAllRouteGuards(future, curr, parentContexts) {\n const futureRoot = future._root;\n const currRoot = curr ? curr._root : null;\n return getChildRouteGuards(futureRoot, currRoot, parentContexts, [futureRoot.value]);\n}\nfunction getCanActivateChild(p) {\n const canActivateChild = p.routeConfig ? p.routeConfig.canActivateChild : null;\n if (!canActivateChild || canActivateChild.length === 0) return null;\n return {\n node: p,\n guards: canActivateChild\n };\n}\nfunction getTokenOrFunctionIdentity(tokenOrFunction, injector) {\n const NOT_FOUND = Symbol();\n const result = injector.get(tokenOrFunction, NOT_FOUND);\n if (result === NOT_FOUND) {\n if (typeof tokenOrFunction === 'function' && !ɵisInjectable(tokenOrFunction)) {\n // We think the token is just a function so return it as-is\n return tokenOrFunction;\n } else {\n // This will throw the not found error\n return injector.get(tokenOrFunction);\n }\n }\n return result;\n}\nfunction getChildRouteGuards(futureNode, currNode, contexts, futurePath, checks = {\n canDeactivateChecks: [],\n canActivateChecks: []\n}) {\n const prevChildren = nodeChildrenAsMap(currNode);\n // Process the children of the future route\n futureNode.children.forEach(c => {\n getRouteGuards(c, prevChildren[c.value.outlet], contexts, futurePath.concat([c.value]), checks);\n delete prevChildren[c.value.outlet];\n });\n // Process any children left from the current route (not active for the future route)\n Object.entries(prevChildren).forEach(([k, v]) => deactivateRouteAndItsChildren(v, contexts.getContext(k), checks));\n return checks;\n}\nfunction getRouteGuards(futureNode, currNode, parentContexts, futurePath, checks = {\n canDeactivateChecks: [],\n canActivateChecks: []\n}) {\n const future = futureNode.value;\n const curr = currNode ? currNode.value : null;\n const context = parentContexts ? parentContexts.getContext(futureNode.value.outlet) : null;\n // reusing the node\n if (curr && future.routeConfig === curr.routeConfig) {\n const shouldRun = shouldRunGuardsAndResolvers(curr, future, future.routeConfig.runGuardsAndResolvers);\n if (shouldRun) {\n checks.canActivateChecks.push(new CanActivate(futurePath));\n } else {\n // we need to set the data\n future.data = curr.data;\n future._resolvedData = curr._resolvedData;\n }\n // If we have a component, we need to go through an outlet.\n if (future.component) {\n getChildRouteGuards(futureNode, currNode, context ? context.children : null, futurePath, checks);\n // if we have a componentless route, we recurse but keep the same outlet map.\n } else {\n getChildRouteGuards(futureNode, currNode, parentContexts, futurePath, checks);\n }\n if (shouldRun && context && context.outlet && context.outlet.isActivated) {\n checks.canDeactivateChecks.push(new CanDeactivate(context.outlet.component, curr));\n }\n } else {\n if (curr) {\n deactivateRouteAndItsChildren(currNode, context, checks);\n }\n checks.canActivateChecks.push(new CanActivate(futurePath));\n // If we have a component, we need to go through an outlet.\n if (future.component) {\n getChildRouteGuards(futureNode, null, context ? context.children : null, futurePath, checks);\n // if we have a componentless route, we recurse but keep the same outlet map.\n } else {\n getChildRouteGuards(futureNode, null, parentContexts, futurePath, checks);\n }\n }\n return checks;\n}\nfunction shouldRunGuardsAndResolvers(curr, future, mode) {\n if (typeof mode === 'function') {\n return mode(curr, future);\n }\n switch (mode) {\n case 'pathParamsChange':\n return !equalPath(curr.url, future.url);\n case 'pathParamsOrQueryParamsChange':\n return !equalPath(curr.url, future.url) || !shallowEqual(curr.queryParams, future.queryParams);\n case 'always':\n return true;\n case 'paramsOrQueryParamsChange':\n return !equalParamsAndUrlSegments(curr, future) || !shallowEqual(curr.queryParams, future.queryParams);\n case 'paramsChange':\n default:\n return !equalParamsAndUrlSegments(curr, future);\n }\n}\nfunction deactivateRouteAndItsChildren(route, context, checks) {\n const children = nodeChildrenAsMap(route);\n const r = route.value;\n Object.entries(children).forEach(([childName, node]) => {\n if (!r.component) {\n deactivateRouteAndItsChildren(node, context, checks);\n } else if (context) {\n deactivateRouteAndItsChildren(node, context.children.getContext(childName), checks);\n } else {\n deactivateRouteAndItsChildren(node, null, checks);\n }\n });\n if (!r.component) {\n checks.canDeactivateChecks.push(new CanDeactivate(null, r));\n } else if (context && context.outlet && context.outlet.isActivated) {\n checks.canDeactivateChecks.push(new CanDeactivate(context.outlet.component, r));\n } else {\n checks.canDeactivateChecks.push(new CanDeactivate(null, r));\n }\n}\n\n/**\n * Simple function check, but generic so type inference will flow. Example:\n *\n * function product(a: number, b: number) {\n * return a * b;\n * }\n *\n * if (isFunction(fn)) {\n * return fn(1, 2);\n * } else {\n * throw \"Must provide the `product` function\";\n * }\n */\nfunction isFunction(v) {\n return typeof v === 'function';\n}\nfunction isBoolean(v) {\n return typeof v === 'boolean';\n}\nfunction isCanLoad(guard) {\n return guard && isFunction(guard.canLoad);\n}\nfunction isCanActivate(guard) {\n return guard && isFunction(guard.canActivate);\n}\nfunction isCanActivateChild(guard) {\n return guard && isFunction(guard.canActivateChild);\n}\nfunction isCanDeactivate(guard) {\n return guard && isFunction(guard.canDeactivate);\n}\nfunction isCanMatch(guard) {\n return guard && isFunction(guard.canMatch);\n}\nfunction isEmptyError(e) {\n return e instanceof EmptyError || e?.name === 'EmptyError';\n}\nconst INITIAL_VALUE = /* @__PURE__ */Symbol('INITIAL_VALUE');\nfunction prioritizedGuardValue() {\n return switchMap(obs => {\n return combineLatest(obs.map(o => o.pipe(take(1), startWith(INITIAL_VALUE)))).pipe(map(results => {\n for (const result of results) {\n if (result === true) {\n // If result is true, check the next one\n continue;\n } else if (result === INITIAL_VALUE) {\n // If guard has not finished, we need to stop processing.\n return INITIAL_VALUE;\n } else if (result === false || result instanceof UrlTree) {\n // Result finished and was not true. Return the result.\n // Note that we only allow false/UrlTree. Other values are considered invalid and\n // ignored.\n return result;\n }\n }\n // Everything resolved to true. Return true.\n return true;\n }), filter(item => item !== INITIAL_VALUE), take(1));\n });\n}\nfunction checkGuards(injector, forwardEvent) {\n return mergeMap(t => {\n const {\n targetSnapshot,\n currentSnapshot,\n guards: {\n canActivateChecks,\n canDeactivateChecks\n }\n } = t;\n if (canDeactivateChecks.length === 0 && canActivateChecks.length === 0) {\n return of({\n ...t,\n guardsResult: true\n });\n }\n return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, injector).pipe(mergeMap(canDeactivate => {\n return canDeactivate && isBoolean(canDeactivate) ? runCanActivateChecks(targetSnapshot, canActivateChecks, injector, forwardEvent) : of(canDeactivate);\n }), map(guardsResult => ({\n ...t,\n guardsResult\n })));\n });\n}\nfunction runCanDeactivateChecks(checks, futureRSS, currRSS, injector) {\n return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, injector)), first(result => {\n return result !== true;\n }, true));\n}\nfunction runCanActivateChecks(futureSnapshot, checks, injector, forwardEvent) {\n return from(checks).pipe(concatMap(check => {\n return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, injector), runCanActivate(futureSnapshot, check.route, injector));\n }), first(result => {\n return result !== true;\n }, true));\n}\n/**\n * This should fire off `ActivationStart` events for each route being activated at this\n * level.\n * In other words, if you're activating `a` and `b` below, `path` will contain the\n * `ActivatedRouteSnapshot`s for both and we will fire `ActivationStart` for both. Always\n * return\n * `true` so checks continue to run.\n */\nfunction fireActivationStart(snapshot, forwardEvent) {\n if (snapshot !== null && forwardEvent) {\n forwardEvent(new ActivationStart(snapshot));\n }\n return of(true);\n}\n/**\n * This should fire off `ChildActivationStart` events for each route being activated at this\n * level.\n * In other words, if you're activating `a` and `b` below, `path` will contain the\n * `ActivatedRouteSnapshot`s for both and we will fire `ChildActivationStart` for both. Always\n * return\n * `true` so checks continue to run.\n */\nfunction fireChildActivationStart(snapshot, forwardEvent) {\n if (snapshot !== null && forwardEvent) {\n forwardEvent(new ChildActivationStart(snapshot));\n }\n return of(true);\n}\nfunction runCanActivate(futureRSS, futureARS, injector) {\n const canActivate = futureARS.routeConfig ? futureARS.routeConfig.canActivate : null;\n if (!canActivate || canActivate.length === 0) return of(true);\n const canActivateObservables = canActivate.map(canActivate => {\n return defer(() => {\n const closestInjector = getClosestRouteInjector(futureARS) ?? injector;\n const guard = getTokenOrFunctionIdentity(canActivate, closestInjector);\n const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));\n return wrapIntoObservable(guardVal).pipe(first());\n });\n });\n return of(canActivateObservables).pipe(prioritizedGuardValue());\n}\nfunction runCanActivateChild(futureRSS, path, injector) {\n const futureARS = path[path.length - 1];\n const canActivateChildGuards = path.slice(0, path.length - 1).reverse().map(p => getCanActivateChild(p)).filter(_ => _ !== null);\n const canActivateChildGuardsMapped = canActivateChildGuards.map(d => {\n return defer(() => {\n const guardsMapped = d.guards.map(canActivateChild => {\n const closestInjector = getClosestRouteInjector(d.node) ?? injector;\n const guard = getTokenOrFunctionIdentity(canActivateChild, closestInjector);\n const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));\n return wrapIntoObservable(guardVal).pipe(first());\n });\n return of(guardsMapped).pipe(prioritizedGuardValue());\n });\n });\n return of(canActivateChildGuardsMapped).pipe(prioritizedGuardValue());\n}\nfunction runCanDeactivate(component, currARS, currRSS, futureRSS, injector) {\n const canDeactivate = currARS && currARS.routeConfig ? currARS.routeConfig.canDeactivate : null;\n if (!canDeactivate || canDeactivate.length === 0) return of(true);\n const canDeactivateObservables = canDeactivate.map(c => {\n const closestInjector = getClosestRouteInjector(currARS) ?? injector;\n const guard = getTokenOrFunctionIdentity(c, closestInjector);\n const guardVal = isCanDeactivate(guard) ? guard.canDeactivate(component, currARS, currRSS, futureRSS) : runInInjectionContext(closestInjector, () => guard(component, currARS, currRSS, futureRSS));\n return wrapIntoObservable(guardVal).pipe(first());\n });\n return of(canDeactivateObservables).pipe(prioritizedGuardValue());\n}\nfunction runCanLoadGuards(injector, route, segments, urlSerializer) {\n const canLoad = route.canLoad;\n if (canLoad === undefined || canLoad.length === 0) {\n return of(true);\n }\n const canLoadObservables = canLoad.map(injectionToken => {\n const guard = getTokenOrFunctionIdentity(injectionToken, injector);\n const guardVal = isCanLoad(guard) ? guard.canLoad(route, segments) : runInInjectionContext(injector, () => guard(route, segments));\n return wrapIntoObservable(guardVal);\n });\n return of(canLoadObservables).pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));\n}\nfunction redirectIfUrlTree(urlSerializer) {\n return pipe(tap(result => {\n if (!isUrlTree(result)) return;\n throw redirectingNavigationError(urlSerializer, result);\n }), map(result => result === true));\n}\nfunction runCanMatchGuards(injector, route, segments, urlSerializer) {\n const canMatch = route.canMatch;\n if (!canMatch || canMatch.length === 0) return of(true);\n const canMatchObservables = canMatch.map(injectionToken => {\n const guard = getTokenOrFunctionIdentity(injectionToken, injector);\n const guardVal = isCanMatch(guard) ? guard.canMatch(route, segments) : runInInjectionContext(injector, () => guard(route, segments));\n return wrapIntoObservable(guardVal);\n });\n return of(canMatchObservables).pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));\n}\nclass NoMatch {\n constructor(segmentGroup) {\n this.segmentGroup = segmentGroup || null;\n }\n}\nclass AbsoluteRedirect extends Error {\n constructor(urlTree) {\n super();\n this.urlTree = urlTree;\n }\n}\nfunction noMatch$1(segmentGroup) {\n return throwError(new NoMatch(segmentGroup));\n}\nfunction absoluteRedirect(newTree) {\n return throwError(new AbsoluteRedirect(newTree));\n}\nfunction namedOutletsRedirect(redirectTo) {\n return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));\n}\nfunction canLoadFails(route) {\n return throwError(navigationCancelingError((typeof ngDevMode === 'undefined' || ngDevMode) && `Cannot load children because the guard of the route \"path: '${route.path}'\" returned false`, NavigationCancellationCode.GuardRejected));\n}\nclass ApplyRedirects {\n constructor(urlSerializer, urlTree) {\n this.urlSerializer = urlSerializer;\n this.urlTree = urlTree;\n }\n lineralizeSegments(route, urlTree) {\n let res = [];\n let c = urlTree.root;\n while (true) {\n res = res.concat(c.segments);\n if (c.numberOfChildren === 0) {\n return of(res);\n }\n if (c.numberOfChildren > 1 || !c.children[PRIMARY_OUTLET]) {\n return namedOutletsRedirect(route.redirectTo);\n }\n c = c.children[PRIMARY_OUTLET];\n }\n }\n applyRedirectCommands(segments, redirectTo, posParams) {\n const newTree = this.applyRedirectCreateUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams);\n if (redirectTo.startsWith('/')) {\n throw new AbsoluteRedirect(newTree);\n }\n return newTree;\n }\n applyRedirectCreateUrlTree(redirectTo, urlTree, segments, posParams) {\n const newRoot = this.createSegmentGroup(redirectTo, urlTree.root, segments, posParams);\n return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment);\n }\n createQueryParams(redirectToParams, actualParams) {\n const res = {};\n Object.entries(redirectToParams).forEach(([k, v]) => {\n const copySourceValue = typeof v === 'string' && v.startsWith(':');\n if (copySourceValue) {\n const sourceName = v.substring(1);\n res[k] = actualParams[sourceName];\n } else {\n res[k] = v;\n }\n });\n return res;\n }\n createSegmentGroup(redirectTo, group, segments, posParams) {\n const updatedSegments = this.createSegments(redirectTo, group.segments, segments, posParams);\n let children = {};\n Object.entries(group.children).forEach(([name, child]) => {\n children[name] = this.createSegmentGroup(redirectTo, child, segments, posParams);\n });\n return new UrlSegmentGroup(updatedSegments, children);\n }\n createSegments(redirectTo, redirectToSegments, actualSegments, posParams) {\n return redirectToSegments.map(s => s.path.startsWith(':') ? this.findPosParam(redirectTo, s, posParams) : this.findOrReturn(s, actualSegments));\n }\n findPosParam(redirectTo, redirectToUrlSegment, posParams) {\n const pos = posParams[redirectToUrlSegment.path.substring(1)];\n if (!pos) throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);\n return pos;\n }\n findOrReturn(redirectToUrlSegment, actualSegments) {\n let idx = 0;\n for (const s of actualSegments) {\n if (s.path === redirectToUrlSegment.path) {\n actualSegments.splice(idx);\n return s;\n }\n idx++;\n }\n return redirectToUrlSegment;\n }\n}\nconst noMatch = {\n matched: false,\n consumedSegments: [],\n remainingSegments: [],\n parameters: {},\n positionalParamSegments: {}\n};\nfunction matchWithChecks(segmentGroup, route, segments, injector, urlSerializer) {\n const result = match(segmentGroup, route, segments);\n if (!result.matched) {\n return of(result);\n }\n // Only create the Route's `EnvironmentInjector` if it matches the attempted\n // navigation\n injector = getOrCreateRouteInjectorIfNeeded(route, injector);\n return runCanMatchGuards(injector, route, segments, urlSerializer).pipe(map(v => v === true ? result : {\n ...noMatch\n }));\n}\nfunction match(segmentGroup, route, segments) {\n if (route.path === '**') {\n return createWildcardMatchResult(segments);\n }\n if (route.path === '') {\n if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || segments.length > 0)) {\n return {\n ...noMatch\n };\n }\n return {\n matched: true,\n consumedSegments: [],\n remainingSegments: segments,\n parameters: {},\n positionalParamSegments: {}\n };\n }\n const matcher = route.matcher || defaultUrlMatcher;\n const res = matcher(segments, segmentGroup, route);\n if (!res) return {\n ...noMatch\n };\n const posParams = {};\n Object.entries(res.posParams ?? {}).forEach(([k, v]) => {\n posParams[k] = v.path;\n });\n const parameters = res.consumed.length > 0 ? {\n ...posParams,\n ...res.consumed[res.consumed.length - 1].parameters\n } : posParams;\n return {\n matched: true,\n consumedSegments: res.consumed,\n remainingSegments: segments.slice(res.consumed.length),\n // TODO(atscott): investigate combining parameters and positionalParamSegments\n parameters,\n positionalParamSegments: res.posParams ?? {}\n };\n}\nfunction createWildcardMatchResult(segments) {\n return {\n matched: true,\n parameters: segments.length > 0 ? last(segments).parameters : {},\n consumedSegments: segments,\n remainingSegments: [],\n positionalParamSegments: {}\n };\n}\nfunction split(segmentGroup, consumedSegments, slicedSegments, config) {\n if (slicedSegments.length > 0 && containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, config)) {\n const s = new UrlSegmentGroup(consumedSegments, createChildrenForEmptyPaths(config, new UrlSegmentGroup(slicedSegments, segmentGroup.children)));\n return {\n segmentGroup: s,\n slicedSegments: []\n };\n }\n if (slicedSegments.length === 0 && containsEmptyPathMatches(segmentGroup, slicedSegments, config)) {\n const s = new UrlSegmentGroup(segmentGroup.segments, addEmptyPathsToChildrenIfNeeded(segmentGroup, slicedSegments, config, segmentGroup.children));\n return {\n segmentGroup: s,\n slicedSegments\n };\n }\n const s = new UrlSegmentGroup(segmentGroup.segments, segmentGroup.children);\n return {\n segmentGroup: s,\n slicedSegments\n };\n}\nfunction addEmptyPathsToChildrenIfNeeded(segmentGroup, slicedSegments, routes, children) {\n const res = {};\n for (const r of routes) {\n if (emptyPathMatch(segmentGroup, slicedSegments, r) && !children[getOutlet(r)]) {\n const s = new UrlSegmentGroup([], {});\n res[getOutlet(r)] = s;\n }\n }\n return {\n ...children,\n ...res\n };\n}\nfunction createChildrenForEmptyPaths(routes, primarySegment) {\n const res = {};\n res[PRIMARY_OUTLET] = primarySegment;\n for (const r of routes) {\n if (r.path === '' && getOutlet(r) !== PRIMARY_OUTLET) {\n const s = new UrlSegmentGroup([], {});\n res[getOutlet(r)] = s;\n }\n }\n return res;\n}\nfunction containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, routes) {\n return routes.some(r => emptyPathMatch(segmentGroup, slicedSegments, r) && getOutlet(r) !== PRIMARY_OUTLET);\n}\nfunction containsEmptyPathMatches(segmentGroup, slicedSegments, routes) {\n return routes.some(r => emptyPathMatch(segmentGroup, slicedSegments, r));\n}\nfunction emptyPathMatch(segmentGroup, slicedSegments, r) {\n if ((segmentGroup.hasChildren() || slicedSegments.length > 0) && r.pathMatch === 'full') {\n return false;\n }\n return r.path === '';\n}\n/**\n * Determines if `route` is a path match for the `rawSegment`, `segments`, and `outlet` without\n * verifying that its children are a full match for the remainder of the `rawSegment` children as\n * well.\n */\nfunction isImmediateMatch(route, rawSegment, segments, outlet) {\n // We allow matches to empty paths when the outlets differ so we can match a url like `/(b:b)` to\n // a config like\n // * `{path: '', children: [{path: 'b', outlet: 'b'}]}`\n // or even\n // * `{path: '', outlet: 'a', children: [{path: 'b', outlet: 'b'}]`\n //\n // The exception here is when the segment outlet is for the primary outlet. This would\n // result in a match inside the named outlet because all children there are written as primary\n // outlets. So we need to prevent child named outlet matches in a url like `/b` in a config like\n // * `{path: '', outlet: 'x' children: [{path: 'b'}]}`\n // This should only match if the url is `/(x:b)`.\n if (getOutlet(route) !== outlet && (outlet === PRIMARY_OUTLET || !emptyPathMatch(rawSegment, segments, route))) {\n return false;\n }\n return match(rawSegment, route, segments).matched;\n}\nfunction noLeftoversInUrl(segmentGroup, segments, outlet) {\n return segments.length === 0 && !segmentGroup.children[outlet];\n}\n\n/**\n * Class used to indicate there were no additional route config matches but that all segments of\n * the URL were consumed during matching so the route was URL matched. When this happens, we still\n * try to match child configs in case there are empty path children.\n */\nclass NoLeftoversInUrl {}\nfunction recognize$1(injector, configLoader, rootComponentType, config, urlTree, urlSerializer, paramsInheritanceStrategy = 'emptyOnly') {\n return new Recognizer(injector, configLoader, rootComponentType, config, urlTree, paramsInheritanceStrategy, urlSerializer).recognize();\n}\nconst MAX_ALLOWED_REDIRECTS = 31;\nclass Recognizer {\n constructor(injector, configLoader, rootComponentType, config, urlTree, paramsInheritanceStrategy, urlSerializer) {\n this.injector = injector;\n this.configLoader = configLoader;\n this.rootComponentType = rootComponentType;\n this.config = config;\n this.urlTree = urlTree;\n this.paramsInheritanceStrategy = paramsInheritanceStrategy;\n this.urlSerializer = urlSerializer;\n this.applyRedirects = new ApplyRedirects(this.urlSerializer, this.urlTree);\n this.absoluteRedirectCount = 0;\n this.allowRedirects = true;\n }\n noMatchError(e) {\n return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, typeof ngDevMode === 'undefined' || ngDevMode ? `Cannot match any routes. URL Segment: '${e.segmentGroup}'` : `'${e.segmentGroup}'`);\n }\n recognize() {\n const rootSegmentGroup = split(this.urlTree.root, [], [], this.config).segmentGroup;\n return this.match(rootSegmentGroup).pipe(map(children => {\n // Use Object.freeze to prevent readers of the Router state from modifying it outside\n // of a navigation, resulting in the router being out of sync with the browser.\n const root = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze({\n ...this.urlTree.queryParams\n }), this.urlTree.fragment, {}, PRIMARY_OUTLET, this.rootComponentType, null, {});\n const rootNode = new TreeNode(root, children);\n const routeState = new RouterStateSnapshot('', rootNode);\n const tree = createUrlTreeFromSnapshot(root, [], this.urlTree.queryParams, this.urlTree.fragment);\n // https://github.com/angular/angular/issues/47307\n // Creating the tree stringifies the query params\n // We don't want to do this here so reassign them to the original.\n tree.queryParams = this.urlTree.queryParams;\n routeState.url = this.urlSerializer.serialize(tree);\n this.inheritParamsAndData(routeState._root, null);\n return {\n state: routeState,\n tree\n };\n }));\n }\n match(rootSegmentGroup) {\n const expanded$ = this.processSegmentGroup(this.injector, this.config, rootSegmentGroup, PRIMARY_OUTLET);\n return expanded$.pipe(catchError(e => {\n if (e instanceof AbsoluteRedirect) {\n this.urlTree = e.urlTree;\n return this.match(e.urlTree.root);\n }\n if (e instanceof NoMatch) {\n throw this.noMatchError(e);\n }\n throw e;\n }));\n }\n inheritParamsAndData(routeNode, parent) {\n const route = routeNode.value;\n const i = getInherited(route, parent, this.paramsInheritanceStrategy);\n route.params = Object.freeze(i.params);\n route.data = Object.freeze(i.data);\n routeNode.children.forEach(n => this.inheritParamsAndData(n, route));\n }\n processSegmentGroup(injector, config, segmentGroup, outlet) {\n if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {\n return this.processChildren(injector, config, segmentGroup);\n }\n return this.processSegment(injector, config, segmentGroup, segmentGroup.segments, outlet, true).pipe(map(child => child instanceof TreeNode ? [child] : []));\n }\n /**\n * Matches every child outlet in the `segmentGroup` to a `Route` in the config. Returns `null` if\n * we cannot find a match for _any_ of the children.\n *\n * @param config - The `Routes` to match against\n * @param segmentGroup - The `UrlSegmentGroup` whose children need to be matched against the\n * config.\n */\n processChildren(injector, config, segmentGroup) {\n // Expand outlets one at a time, starting with the primary outlet. We need to do it this way\n // because an absolute redirect from the primary outlet takes precedence.\n const childOutlets = [];\n for (const child of Object.keys(segmentGroup.children)) {\n if (child === 'primary') {\n childOutlets.unshift(child);\n } else {\n childOutlets.push(child);\n }\n }\n return from(childOutlets).pipe(concatMap(childOutlet => {\n const child = segmentGroup.children[childOutlet];\n // Sort the config so that routes with outlets that match the one being activated\n // appear first, followed by routes for other outlets, which might match if they have\n // an empty path.\n const sortedConfig = sortByMatchingOutlets(config, childOutlet);\n return this.processSegmentGroup(injector, sortedConfig, child, childOutlet);\n }), scan((children, outletChildren) => {\n children.push(...outletChildren);\n return children;\n }), defaultIfEmpty(null), last$1(), mergeMap(children => {\n if (children === null) return noMatch$1(segmentGroup);\n // Because we may have matched two outlets to the same empty path segment, we can have\n // multiple activated results for the same outlet. We should merge the children of\n // these results so the final return value is only one `TreeNode` per outlet.\n const mergedChildren = mergeEmptyPathMatches(children);\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n // This should really never happen - we are only taking the first match for each\n // outlet and merge the empty path matches.\n checkOutletNameUniqueness(mergedChildren);\n }\n sortActivatedRouteSnapshots(mergedChildren);\n return of(mergedChildren);\n }));\n }\n processSegment(injector, routes, segmentGroup, segments, outlet, allowRedirects) {\n return from(routes).pipe(concatMap(r => {\n return this.processSegmentAgainstRoute(r._injector ?? injector, routes, r, segmentGroup, segments, outlet, allowRedirects).pipe(catchError(e => {\n if (e instanceof NoMatch) {\n return of(null);\n }\n throw e;\n }));\n }), first(x => !!x), catchError(e => {\n if (isEmptyError(e)) {\n if (noLeftoversInUrl(segmentGroup, segments, outlet)) {\n return of(new NoLeftoversInUrl());\n }\n return noMatch$1(segmentGroup);\n }\n throw e;\n }));\n }\n processSegmentAgainstRoute(injector, routes, route, rawSegment, segments, outlet, allowRedirects) {\n if (!isImmediateMatch(route, rawSegment, segments, outlet)) return noMatch$1(rawSegment);\n if (route.redirectTo === undefined) {\n return this.matchSegmentAgainstRoute(injector, rawSegment, route, segments, outlet);\n }\n if (this.allowRedirects && allowRedirects) {\n return this.expandSegmentAgainstRouteUsingRedirect(injector, rawSegment, routes, route, segments, outlet);\n }\n return noMatch$1(rawSegment);\n }\n expandSegmentAgainstRouteUsingRedirect(injector, segmentGroup, routes, route, segments, outlet) {\n const {\n matched,\n consumedSegments,\n positionalParamSegments,\n remainingSegments\n } = match(segmentGroup, route, segments);\n if (!matched) return noMatch$1(segmentGroup);\n // TODO(atscott): Move all of this under an if(ngDevMode) as a breaking change and allow stack\n // size exceeded in production\n if (route.redirectTo.startsWith('/')) {\n this.absoluteRedirectCount++;\n if (this.absoluteRedirectCount > MAX_ALLOWED_REDIRECTS) {\n if (ngDevMode) {\n throw new ɵRuntimeError(4016 /* RuntimeErrorCode.INFINITE_REDIRECT */, `Detected possible infinite redirect when redirecting from '${this.urlTree}' to '${route.redirectTo}'.\\n` + `This is currently a dev mode only error but will become a` + ` call stack size exceeded error in production in a future major version.`);\n }\n this.allowRedirects = false;\n }\n }\n const newTree = this.applyRedirects.applyRedirectCommands(consumedSegments, route.redirectTo, positionalParamSegments);\n return this.applyRedirects.lineralizeSegments(route, newTree).pipe(mergeMap(newSegments => {\n return this.processSegment(injector, routes, segmentGroup, newSegments.concat(remainingSegments), outlet, false);\n }));\n }\n matchSegmentAgainstRoute(injector, rawSegment, route, segments, outlet) {\n const matchResult = matchWithChecks(rawSegment, route, segments, injector, this.urlSerializer);\n if (route.path === '**') {\n // Prior versions of the route matching algorithm would stop matching at the wildcard route.\n // We should investigate a better strategy for any existing children. Otherwise, these\n // child segments are silently dropped from the navigation.\n // https://github.com/angular/angular/issues/40089\n rawSegment.children = {};\n }\n return matchResult.pipe(switchMap(result => {\n if (!result.matched) {\n return noMatch$1(rawSegment);\n }\n // If the route has an injector created from providers, we should start using that.\n injector = route._injector ?? injector;\n return this.getChildConfig(injector, route, segments).pipe(switchMap(({\n routes: childConfig\n }) => {\n const childInjector = route._loadedInjector ?? injector;\n const {\n consumedSegments,\n remainingSegments,\n parameters\n } = result;\n const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({\n ...this.urlTree.queryParams\n }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));\n const {\n segmentGroup,\n slicedSegments\n } = split(rawSegment, consumedSegments, remainingSegments, childConfig);\n if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {\n return this.processChildren(childInjector, childConfig, segmentGroup).pipe(map(children => {\n if (children === null) {\n return null;\n }\n return new TreeNode(snapshot, children);\n }));\n }\n if (childConfig.length === 0 && slicedSegments.length === 0) {\n return of(new TreeNode(snapshot, []));\n }\n const matchedOnOutlet = getOutlet(route) === outlet;\n // If we matched a config due to empty path match on a different outlet, we need to\n // continue passing the current outlet for the segment rather than switch to PRIMARY.\n // Note that we switch to primary when we have a match because outlet configs look like\n // this: {path: 'a', outlet: 'a', children: [\n // {path: 'b', component: B},\n // {path: 'c', component: C},\n // ]}\n // Notice that the children of the named outlet are configured with the primary outlet\n return this.processSegment(childInjector, childConfig, segmentGroup, slicedSegments, matchedOnOutlet ? PRIMARY_OUTLET : outlet, true).pipe(map(child => {\n return new TreeNode(snapshot, child instanceof TreeNode ? [child] : []);\n }));\n }));\n }));\n }\n getChildConfig(injector, route, segments) {\n if (route.children) {\n // The children belong to the same module\n return of({\n routes: route.children,\n injector\n });\n }\n if (route.loadChildren) {\n // lazy children belong to the loaded module\n if (route._loadedRoutes !== undefined) {\n return of({\n routes: route._loadedRoutes,\n injector: route._loadedInjector\n });\n }\n return runCanLoadGuards(injector, route, segments, this.urlSerializer).pipe(mergeMap(shouldLoadResult => {\n if (shouldLoadResult) {\n return this.configLoader.loadChildren(injector, route).pipe(tap(cfg => {\n route._loadedRoutes = cfg.routes;\n route._loadedInjector = cfg.injector;\n }));\n }\n return canLoadFails(route);\n }));\n }\n return of({\n routes: [],\n injector\n });\n }\n}\nfunction sortActivatedRouteSnapshots(nodes) {\n nodes.sort((a, b) => {\n if (a.value.outlet === PRIMARY_OUTLET) return -1;\n if (b.value.outlet === PRIMARY_OUTLET) return 1;\n return a.value.outlet.localeCompare(b.value.outlet);\n });\n}\nfunction hasEmptyPathConfig(node) {\n const config = node.value.routeConfig;\n return config && config.path === '';\n}\n/**\n * Finds `TreeNode`s with matching empty path route configs and merges them into `TreeNode` with\n * the children from each duplicate. This is necessary because different outlets can match a\n * single empty path route config and the results need to then be merged.\n */\nfunction mergeEmptyPathMatches(nodes) {\n const result = [];\n // The set of nodes which contain children that were merged from two duplicate empty path nodes.\n const mergedNodes = new Set();\n for (const node of nodes) {\n if (!hasEmptyPathConfig(node)) {\n result.push(node);\n continue;\n }\n const duplicateEmptyPathNode = result.find(resultNode => node.value.routeConfig === resultNode.value.routeConfig);\n if (duplicateEmptyPathNode !== undefined) {\n duplicateEmptyPathNode.children.push(...node.children);\n mergedNodes.add(duplicateEmptyPathNode);\n } else {\n result.push(node);\n }\n }\n // For each node which has children from multiple sources, we need to recompute a new `TreeNode`\n // by also merging those children. This is necessary when there are multiple empty path configs\n // in a row. Put another way: whenever we combine children of two nodes, we need to also check\n // if any of those children can be combined into a single node as well.\n for (const mergedNode of mergedNodes) {\n const mergedChildren = mergeEmptyPathMatches(mergedNode.children);\n result.push(new TreeNode(mergedNode.value, mergedChildren));\n }\n return result.filter(n => !mergedNodes.has(n));\n}\nfunction checkOutletNameUniqueness(nodes) {\n const names = {};\n nodes.forEach(n => {\n const routeWithSameOutletName = names[n.value.outlet];\n if (routeWithSameOutletName) {\n const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');\n const c = n.value.url.map(s => s.toString()).join('/');\n throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);\n }\n names[n.value.outlet] = n.value;\n });\n}\nfunction getData(route) {\n return route.data || {};\n}\nfunction getResolve(route) {\n return route.resolve || {};\n}\nfunction recognize(injector, configLoader, rootComponentType, config, serializer, paramsInheritanceStrategy) {\n return mergeMap(t => recognize$1(injector, configLoader, rootComponentType, config, t.extractedUrl, serializer, paramsInheritanceStrategy).pipe(map(({\n state: targetSnapshot,\n tree: urlAfterRedirects\n }) => {\n return {\n ...t,\n targetSnapshot,\n urlAfterRedirects\n };\n })));\n}\nfunction resolveData(paramsInheritanceStrategy, injector) {\n return mergeMap(t => {\n const {\n targetSnapshot,\n guards: {\n canActivateChecks\n }\n } = t;\n if (!canActivateChecks.length) {\n return of(t);\n }\n // Iterating a Set in javascript happens in insertion order so it is safe to use a `Set` to\n // preserve the correct order that the resolvers should run in.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#description\n const routesWithResolversToRun = new Set(canActivateChecks.map(check => check.route));\n const routesNeedingDataUpdates = new Set();\n for (const route of routesWithResolversToRun) {\n if (routesNeedingDataUpdates.has(route)) {\n continue;\n }\n // All children under the route with a resolver to run need to recompute inherited data.\n for (const newRoute of flattenRouteTree(route)) {\n routesNeedingDataUpdates.add(newRoute);\n }\n }\n let routesProcessed = 0;\n return from(routesNeedingDataUpdates).pipe(concatMap(route => {\n if (routesWithResolversToRun.has(route)) {\n return runResolve(route, targetSnapshot, paramsInheritanceStrategy, injector);\n } else {\n route.data = getInherited(route, route.parent, paramsInheritanceStrategy).resolve;\n return of(void 0);\n }\n }), tap(() => routesProcessed++), takeLast(1), mergeMap(_ => routesProcessed === routesNeedingDataUpdates.size ? of(t) : EMPTY));\n });\n}\n/**\n * Returns the `ActivatedRouteSnapshot` tree as an array, using DFS to traverse the route tree.\n */\nfunction flattenRouteTree(route) {\n const descendants = route.children.map(child => flattenRouteTree(child)).flat();\n return [route, ...descendants];\n}\nfunction runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) {\n const config = futureARS.routeConfig;\n const resolve = futureARS._resolve;\n if (config?.title !== undefined && !hasStaticTitle(config)) {\n resolve[RouteTitleKey] = config.title;\n }\n return resolveNode(resolve, futureARS, futureRSS, injector).pipe(map(resolvedData => {\n futureARS._resolvedData = resolvedData;\n futureARS.data = getInherited(futureARS, futureARS.parent, paramsInheritanceStrategy).resolve;\n return null;\n }));\n}\nfunction resolveNode(resolve, futureARS, futureRSS, injector) {\n const keys = getDataKeys(resolve);\n if (keys.length === 0) {\n return of({});\n }\n const data = {};\n return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, injector).pipe(first(), tap(value => {\n data[key] = value;\n }))), takeLast(1), mapTo(data), catchError(e => isEmptyError(e) ? EMPTY : throwError(e)));\n}\nfunction getResolver(injectionToken, futureARS, futureRSS, injector) {\n const closestInjector = getClosestRouteInjector(futureARS) ?? injector;\n const resolver = getTokenOrFunctionIdentity(injectionToken, closestInjector);\n const resolverValue = resolver.resolve ? resolver.resolve(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => resolver(futureARS, futureRSS));\n return wrapIntoObservable(resolverValue);\n}\n\n/**\n * Perform a side effect through a switchMap for every emission on the source Observable,\n * but return an Observable that is identical to the source. It's essentially the same as\n * the `tap` operator, but if the side effectful `next` function returns an ObservableInput,\n * it will wait before continuing with the original value.\n */\nfunction switchTap(next) {\n return switchMap(v => {\n const nextResult = next(v);\n if (nextResult) {\n return from(nextResult).pipe(map(() => v));\n }\n return of(v);\n });\n}\n\n/**\n * Provides a strategy for setting the page title after a router navigation.\n *\n * The built-in implementation traverses the router state snapshot and finds the deepest primary\n * outlet with `title` property. Given the `Routes` below, navigating to\n * `/base/child(popup:aux)` would result in the document title being set to \"child\".\n * ```\n * [\n * {path: 'base', title: 'base', children: [\n * {path: 'child', title: 'child'},\n * ],\n * {path: 'aux', outlet: 'popup', title: 'popupTitle'}\n * ]\n * ```\n *\n * This class can be used as a base class for custom title strategies. That is, you can create your\n * own class that extends the `TitleStrategy`. Note that in the above example, the `title`\n * from the named outlet is never used. However, a custom strategy might be implemented to\n * incorporate titles in named outlets.\n *\n * @publicApi\n * @see [Page title guide](guide/router#setting-the-page-title)\n */\nlet TitleStrategy = /*#__PURE__*/(() => {\n class TitleStrategy {\n /**\n * @returns The `title` of the deepest primary route.\n */\n buildTitle(snapshot) {\n let pageTitle;\n let route = snapshot.root;\n while (route !== undefined) {\n pageTitle = this.getResolvedTitleForRoute(route) ?? pageTitle;\n route = route.children.find(child => child.outlet === PRIMARY_OUTLET);\n }\n return pageTitle;\n }\n /**\n * Given an `ActivatedRouteSnapshot`, returns the final value of the\n * `Route.title` property, which can either be a static string or a resolved value.\n */\n getResolvedTitleForRoute(snapshot) {\n return snapshot.data[RouteTitleKey];\n }\n static {\n this.ɵfac = function TitleStrategy_Factory(t) {\n return new (t || TitleStrategy)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: TitleStrategy,\n factory: () => (() => inject(DefaultTitleStrategy))(),\n providedIn: 'root'\n });\n }\n }\n return TitleStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * The default `TitleStrategy` used by the router that updates the title using the `Title` service.\n */\nlet DefaultTitleStrategy = /*#__PURE__*/(() => {\n class DefaultTitleStrategy extends TitleStrategy {\n constructor(title) {\n super();\n this.title = title;\n }\n /**\n * Sets the title of the browser to the given value.\n *\n * @param title The `pageTitle` from the deepest primary route.\n */\n updateTitle(snapshot) {\n const title = this.buildTitle(snapshot);\n if (title !== undefined) {\n this.title.setTitle(title);\n }\n }\n static {\n this.ɵfac = function DefaultTitleStrategy_Factory(t) {\n return new (t || DefaultTitleStrategy)(i0.ɵɵinject(i1.Title));\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DefaultTitleStrategy,\n factory: DefaultTitleStrategy.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return DefaultTitleStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * A [DI token](guide/glossary/#di-token) for the router service.\n *\n * @publicApi\n */\nconst ROUTER_CONFIGURATION = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'router config' : '', {\n providedIn: 'root',\n factory: () => ({})\n});\n\n/**\n * The [DI token](guide/glossary/#di-token) for a router configuration.\n *\n * `ROUTES` is a low level API for router configuration via dependency injection.\n *\n * We recommend that in almost all cases to use higher level APIs such as `RouterModule.forRoot()`,\n * `provideRouter`, or `Router.resetConfig()`.\n *\n * @publicApi\n */\nconst ROUTES = /*#__PURE__*/new InjectionToken(ngDevMode ? 'ROUTES' : '');\nlet RouterConfigLoader = /*#__PURE__*/(() => {\n class RouterConfigLoader {\n constructor() {\n this.componentLoaders = new WeakMap();\n this.childrenLoaders = new WeakMap();\n this.compiler = inject(Compiler);\n }\n loadComponent(route) {\n if (this.componentLoaders.get(route)) {\n return this.componentLoaders.get(route);\n } else if (route._loadedComponent) {\n return of(route._loadedComponent);\n }\n if (this.onLoadStartListener) {\n this.onLoadStartListener(route);\n }\n const loadRunner = wrapIntoObservable(route.loadComponent()).pipe(map(maybeUnwrapDefaultExport), tap(component => {\n if (this.onLoadEndListener) {\n this.onLoadEndListener(route);\n }\n (typeof ngDevMode === 'undefined' || ngDevMode) && assertStandalone(route.path ?? '', component);\n route._loadedComponent = component;\n }), finalize(() => {\n this.componentLoaders.delete(route);\n }));\n // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much\n const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());\n this.componentLoaders.set(route, loader);\n return loader;\n }\n loadChildren(parentInjector, route) {\n if (this.childrenLoaders.get(route)) {\n return this.childrenLoaders.get(route);\n } else if (route._loadedRoutes) {\n return of({\n routes: route._loadedRoutes,\n injector: route._loadedInjector\n });\n }\n if (this.onLoadStartListener) {\n this.onLoadStartListener(route);\n }\n const moduleFactoryOrRoutes$ = loadChildren(route, this.compiler, parentInjector, this.onLoadEndListener);\n const loadRunner = moduleFactoryOrRoutes$.pipe(finalize(() => {\n this.childrenLoaders.delete(route);\n }));\n // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much\n const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());\n this.childrenLoaders.set(route, loader);\n return loader;\n }\n static {\n this.ɵfac = function RouterConfigLoader_Factory(t) {\n return new (t || RouterConfigLoader)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RouterConfigLoader,\n factory: RouterConfigLoader.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return RouterConfigLoader;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Executes a `route.loadChildren` callback and converts the result to an array of child routes and\n * an injector if that callback returned a module.\n *\n * This function is used for the route discovery during prerendering\n * in @angular-devkit/build-angular. If there are any updates to the contract here, it will require\n * an update to the extractor.\n */\nfunction loadChildren(route, compiler, parentInjector, onLoadEndListener) {\n return wrapIntoObservable(route.loadChildren()).pipe(map(maybeUnwrapDefaultExport), mergeMap(t => {\n if (t instanceof NgModuleFactory || Array.isArray(t)) {\n return of(t);\n } else {\n return from(compiler.compileModuleAsync(t));\n }\n }), map(factoryOrRoutes => {\n if (onLoadEndListener) {\n onLoadEndListener(route);\n }\n // This injector comes from the `NgModuleRef` when lazy loading an `NgModule`. There is\n // no injector associated with lazy loading a `Route` array.\n let injector;\n let rawRoutes;\n let requireStandaloneComponents = false;\n if (Array.isArray(factoryOrRoutes)) {\n rawRoutes = factoryOrRoutes;\n requireStandaloneComponents = true;\n } else {\n injector = factoryOrRoutes.create(parentInjector).injector;\n // When loading a module that doesn't provide `RouterModule.forChild()` preloader\n // will get stuck in an infinite loop. The child module's Injector will look to\n // its parent `Injector` when it doesn't find any ROUTES so it will return routes\n // for it's parent module instead.\n rawRoutes = injector.get(ROUTES, [], {\n optional: true,\n self: true\n }).flat();\n }\n const routes = rawRoutes.map(standardizeConfig);\n (typeof ngDevMode === 'undefined' || ngDevMode) && validateConfig(routes, route.path, requireStandaloneComponents);\n return {\n routes,\n injector\n };\n }));\n}\nfunction isWrappedDefaultExport(value) {\n // We use `in` here with a string key `'default'`, because we expect `DefaultExport` objects to be\n // dynamically imported ES modules with a spec-mandated `default` key. Thus we don't expect that\n // `default` will be a renamed property.\n return value && typeof value === 'object' && 'default' in value;\n}\nfunction maybeUnwrapDefaultExport(input) {\n // As per `isWrappedDefaultExport`, the `default` key here is generated by the browser and not\n // subject to property renaming, so we reference it with bracket access.\n return isWrappedDefaultExport(input) ? input['default'] : input;\n}\n\n/**\n * @description\n *\n * Provides a way to migrate AngularJS applications to Angular.\n *\n * @publicApi\n */\nlet UrlHandlingStrategy = /*#__PURE__*/(() => {\n class UrlHandlingStrategy {\n static {\n this.ɵfac = function UrlHandlingStrategy_Factory(t) {\n return new (t || UrlHandlingStrategy)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: UrlHandlingStrategy,\n factory: () => (() => inject(DefaultUrlHandlingStrategy))(),\n providedIn: 'root'\n });\n }\n }\n return UrlHandlingStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * @publicApi\n */\nlet DefaultUrlHandlingStrategy = /*#__PURE__*/(() => {\n class DefaultUrlHandlingStrategy {\n shouldProcessUrl(url) {\n return true;\n }\n extract(url) {\n return url;\n }\n merge(newUrlPart, wholeUrl) {\n return newUrlPart;\n }\n static {\n this.ɵfac = function DefaultUrlHandlingStrategy_Factory(t) {\n return new (t || DefaultUrlHandlingStrategy)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DefaultUrlHandlingStrategy,\n factory: DefaultUrlHandlingStrategy.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return DefaultUrlHandlingStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/// \nconst CREATE_VIEW_TRANSITION = /*#__PURE__*/new InjectionToken(ngDevMode ? 'view transition helper' : '');\nconst VIEW_TRANSITION_OPTIONS = /*#__PURE__*/new InjectionToken(ngDevMode ? 'view transition options' : '');\n/**\n * A helper function for using browser view transitions. This function skips the call to\n * `startViewTransition` if the browser does not support it.\n *\n * @returns A Promise that resolves when the view transition callback begins.\n */\nfunction createViewTransition(injector, from, to) {\n const transitionOptions = injector.get(VIEW_TRANSITION_OPTIONS);\n const document = injector.get(DOCUMENT);\n // Create promises outside the Angular zone to avoid causing extra change detections\n return injector.get(NgZone).runOutsideAngular(() => {\n if (!document.startViewTransition || transitionOptions.skipNextTransition) {\n transitionOptions.skipNextTransition = false;\n return Promise.resolve();\n }\n let resolveViewTransitionStarted;\n const viewTransitionStarted = new Promise(resolve => {\n resolveViewTransitionStarted = resolve;\n });\n const transition = document.startViewTransition(() => {\n resolveViewTransitionStarted();\n // We don't actually update dom within the transition callback. The resolving of the above\n // promise unblocks the Router navigation, which synchronously activates and deactivates\n // routes (the DOM update). This view transition waits for the next change detection to\n // complete (below), which includes the update phase of the routed components.\n return createRenderPromise(injector);\n });\n const {\n onViewTransitionCreated\n } = transitionOptions;\n if (onViewTransitionCreated) {\n runInInjectionContext(injector, () => onViewTransitionCreated({\n transition,\n from,\n to\n }));\n }\n return viewTransitionStarted;\n });\n}\n/**\n * Creates a promise that resolves after next render.\n */\nfunction createRenderPromise(injector) {\n return new Promise(resolve => {\n afterNextRender(resolve, {\n injector\n });\n });\n}\nlet NavigationTransitions = /*#__PURE__*/(() => {\n class NavigationTransitions {\n get hasRequestedNavigation() {\n return this.navigationId !== 0;\n }\n constructor() {\n this.currentNavigation = null;\n this.currentTransition = null;\n this.lastSuccessfulNavigation = null;\n /**\n * These events are used to communicate back to the Router about the state of the transition. The\n * Router wants to respond to these events in various ways. Because the `NavigationTransition`\n * class is not public, this event subject is not publicly exposed.\n */\n this.events = new Subject();\n /**\n * Used to abort the current transition with an error.\n */\n this.transitionAbortSubject = new Subject();\n this.configLoader = inject(RouterConfigLoader);\n this.environmentInjector = inject(EnvironmentInjector);\n this.urlSerializer = inject(UrlSerializer);\n this.rootContexts = inject(ChildrenOutletContexts);\n this.location = inject(Location);\n this.inputBindingEnabled = inject(INPUT_BINDER, {\n optional: true\n }) !== null;\n this.titleStrategy = inject(TitleStrategy);\n this.options = inject(ROUTER_CONFIGURATION, {\n optional: true\n }) || {};\n this.paramsInheritanceStrategy = this.options.paramsInheritanceStrategy || 'emptyOnly';\n this.urlHandlingStrategy = inject(UrlHandlingStrategy);\n this.createViewTransition = inject(CREATE_VIEW_TRANSITION, {\n optional: true\n });\n this.navigationId = 0;\n /**\n * Hook that enables you to pause navigation after the preactivation phase.\n * Used by `RouterModule`.\n *\n * @internal\n */\n this.afterPreactivation = () => of(void 0);\n /** @internal */\n this.rootComponentType = null;\n const onLoadStart = r => this.events.next(new RouteConfigLoadStart(r));\n const onLoadEnd = r => this.events.next(new RouteConfigLoadEnd(r));\n this.configLoader.onLoadEndListener = onLoadEnd;\n this.configLoader.onLoadStartListener = onLoadStart;\n }\n complete() {\n this.transitions?.complete();\n }\n handleNavigationRequest(request) {\n const id = ++this.navigationId;\n this.transitions?.next({\n ...this.transitions.value,\n ...request,\n id\n });\n }\n setupNavigations(router, initialUrlTree, initialRouterState) {\n this.transitions = new BehaviorSubject({\n id: 0,\n currentUrlTree: initialUrlTree,\n currentRawUrl: initialUrlTree,\n extractedUrl: this.urlHandlingStrategy.extract(initialUrlTree),\n urlAfterRedirects: this.urlHandlingStrategy.extract(initialUrlTree),\n rawUrl: initialUrlTree,\n extras: {},\n resolve: null,\n reject: null,\n promise: Promise.resolve(true),\n source: IMPERATIVE_NAVIGATION,\n restoredState: null,\n currentSnapshot: initialRouterState.snapshot,\n targetSnapshot: null,\n currentRouterState: initialRouterState,\n targetRouterState: null,\n guards: {\n canActivateChecks: [],\n canDeactivateChecks: []\n },\n guardsResult: null\n });\n return this.transitions.pipe(filter(t => t.id !== 0),\n // Extract URL\n map(t => ({\n ...t,\n extractedUrl: this.urlHandlingStrategy.extract(t.rawUrl)\n })),\n // Using switchMap so we cancel executing navigations when a new one comes in\n switchMap(overallTransitionState => {\n let completed = false;\n let errored = false;\n return of(overallTransitionState).pipe(switchMap(t => {\n // It is possible that `switchMap` fails to cancel previous navigations if a new one happens synchronously while the operator\n // is processing the `next` notification of that previous navigation. This can happen when a new navigation (say 2) cancels a\n // previous one (1) and yet another navigation (3) happens synchronously in response to the `NavigationCancel` event for (1).\n // https://github.com/ReactiveX/rxjs/issues/7455\n if (this.navigationId > overallTransitionState.id) {\n const cancellationReason = typeof ngDevMode === 'undefined' || ngDevMode ? `Navigation ID ${overallTransitionState.id} is not equal to the current navigation id ${this.navigationId}` : '';\n this.cancelNavigationTransition(overallTransitionState, cancellationReason, NavigationCancellationCode.SupersededByNewNavigation);\n return EMPTY;\n }\n this.currentTransition = overallTransitionState;\n // Store the Navigation object\n this.currentNavigation = {\n id: t.id,\n initialUrl: t.rawUrl,\n extractedUrl: t.extractedUrl,\n trigger: t.source,\n extras: t.extras,\n previousNavigation: !this.lastSuccessfulNavigation ? null : {\n ...this.lastSuccessfulNavigation,\n previousNavigation: null\n }\n };\n const urlTransition = !router.navigated || this.isUpdatingInternalState() || this.isUpdatedBrowserUrl();\n const onSameUrlNavigation = t.extras.onSameUrlNavigation ?? router.onSameUrlNavigation;\n if (!urlTransition && onSameUrlNavigation !== 'reload') {\n const reason = typeof ngDevMode === 'undefined' || ngDevMode ? `Navigation to ${t.rawUrl} was ignored because it is the same as the current Router URL.` : '';\n this.events.next(new NavigationSkipped(t.id, this.urlSerializer.serialize(t.rawUrl), reason, NavigationSkippedCode.IgnoredSameUrlNavigation));\n t.resolve(null);\n return EMPTY;\n }\n if (this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl)) {\n return of(t).pipe(\n // Fire NavigationStart event\n switchMap(t => {\n const transition = this.transitions?.getValue();\n this.events.next(new NavigationStart(t.id, this.urlSerializer.serialize(t.extractedUrl), t.source, t.restoredState));\n if (transition !== this.transitions?.getValue()) {\n return EMPTY;\n }\n // This delay is required to match old behavior that forced\n // navigation to always be async\n return Promise.resolve(t);\n }),\n // Recognize\n recognize(this.environmentInjector, this.configLoader, this.rootComponentType, router.config, this.urlSerializer, this.paramsInheritanceStrategy),\n // Update URL if in `eager` update mode\n tap(t => {\n overallTransitionState.targetSnapshot = t.targetSnapshot;\n overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;\n this.currentNavigation = {\n ...this.currentNavigation,\n finalUrl: t.urlAfterRedirects\n };\n // Fire RoutesRecognized\n const routesRecognized = new RoutesRecognized(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);\n this.events.next(routesRecognized);\n }));\n } else if (urlTransition && this.urlHandlingStrategy.shouldProcessUrl(t.currentRawUrl)) {\n /* When the current URL shouldn't be processed, but the previous one\n * was, we handle this \"error condition\" by navigating to the\n * previously successful URL, but leaving the URL intact.*/\n const {\n id,\n extractedUrl,\n source,\n restoredState,\n extras\n } = t;\n const navStart = new NavigationStart(id, this.urlSerializer.serialize(extractedUrl), source, restoredState);\n this.events.next(navStart);\n const targetSnapshot = createEmptyState(this.rootComponentType).snapshot;\n this.currentTransition = overallTransitionState = {\n ...t,\n targetSnapshot,\n urlAfterRedirects: extractedUrl,\n extras: {\n ...extras,\n skipLocationChange: false,\n replaceUrl: false\n }\n };\n this.currentNavigation.finalUrl = extractedUrl;\n return of(overallTransitionState);\n } else {\n /* When neither the current or previous URL can be processed, do\n * nothing other than update router's internal reference to the\n * current \"settled\" URL. This way the next navigation will be coming\n * from the current URL in the browser.\n */\n const reason = typeof ngDevMode === 'undefined' || ngDevMode ? `Navigation was ignored because the UrlHandlingStrategy` + ` indicated neither the current URL ${t.currentRawUrl} nor target URL ${t.rawUrl} should be processed.` : '';\n this.events.next(new NavigationSkipped(t.id, this.urlSerializer.serialize(t.extractedUrl), reason, NavigationSkippedCode.IgnoredByUrlHandlingStrategy));\n t.resolve(null);\n return EMPTY;\n }\n }),\n // --- GUARDS ---\n tap(t => {\n const guardsStart = new GuardsCheckStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);\n this.events.next(guardsStart);\n }), map(t => {\n this.currentTransition = overallTransitionState = {\n ...t,\n guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)\n };\n return overallTransitionState;\n }), checkGuards(this.environmentInjector, evt => this.events.next(evt)), tap(t => {\n overallTransitionState.guardsResult = t.guardsResult;\n if (isUrlTree(t.guardsResult)) {\n throw redirectingNavigationError(this.urlSerializer, t.guardsResult);\n }\n const guardsEnd = new GuardsCheckEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);\n this.events.next(guardsEnd);\n }), filter(t => {\n if (!t.guardsResult) {\n this.cancelNavigationTransition(t, '', NavigationCancellationCode.GuardRejected);\n return false;\n }\n return true;\n }),\n // --- RESOLVE ---\n switchTap(t => {\n if (t.guards.canActivateChecks.length) {\n return of(t).pipe(tap(t => {\n const resolveStart = new ResolveStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);\n this.events.next(resolveStart);\n }), switchMap(t => {\n let dataResolved = false;\n return of(t).pipe(resolveData(this.paramsInheritanceStrategy, this.environmentInjector), tap({\n next: () => dataResolved = true,\n complete: () => {\n if (!dataResolved) {\n this.cancelNavigationTransition(t, typeof ngDevMode === 'undefined' || ngDevMode ? `At least one route resolver didn't emit any value.` : '', NavigationCancellationCode.NoDataFromResolver);\n }\n }\n }));\n }), tap(t => {\n const resolveEnd = new ResolveEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);\n this.events.next(resolveEnd);\n }));\n }\n return undefined;\n }),\n // --- LOAD COMPONENTS ---\n switchTap(t => {\n const loadComponents = route => {\n const loaders = [];\n if (route.routeConfig?.loadComponent && !route.routeConfig._loadedComponent) {\n loaders.push(this.configLoader.loadComponent(route.routeConfig).pipe(tap(loadedComponent => {\n route.component = loadedComponent;\n }), map(() => void 0)));\n }\n for (const child of route.children) {\n loaders.push(...loadComponents(child));\n }\n return loaders;\n };\n return combineLatest(loadComponents(t.targetSnapshot.root)).pipe(defaultIfEmpty(null), take(1));\n }), switchTap(() => this.afterPreactivation()), switchMap(() => {\n const {\n currentSnapshot,\n targetSnapshot\n } = overallTransitionState;\n const viewTransitionStarted = this.createViewTransition?.(this.environmentInjector, currentSnapshot.root, targetSnapshot.root);\n // If view transitions are enabled, block the navigation until the view\n // transition callback starts. Otherwise, continue immediately.\n return viewTransitionStarted ? from(viewTransitionStarted).pipe(map(() => overallTransitionState)) : of(overallTransitionState);\n }), map(t => {\n const targetRouterState = createRouterState(router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);\n this.currentTransition = overallTransitionState = {\n ...t,\n targetRouterState\n };\n this.currentNavigation.targetRouterState = targetRouterState;\n return overallTransitionState;\n }), tap(() => {\n this.events.next(new BeforeActivateRoutes());\n }), activateRoutes(this.rootContexts, router.routeReuseStrategy, evt => this.events.next(evt), this.inputBindingEnabled),\n // Ensure that if some observable used to drive the transition doesn't\n // complete, the navigation still finalizes This should never happen, but\n // this is done as a safety measure to avoid surfacing this error (#49567).\n take(1), tap({\n next: t => {\n completed = true;\n this.lastSuccessfulNavigation = this.currentNavigation;\n this.events.next(new NavigationEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects)));\n this.titleStrategy?.updateTitle(t.targetRouterState.snapshot);\n t.resolve(true);\n },\n complete: () => {\n completed = true;\n }\n }),\n // There used to be a lot more logic happening directly within the\n // transition Observable. Some of this logic has been refactored out to\n // other places but there may still be errors that happen there. This gives\n // us a way to cancel the transition from the outside. This may also be\n // required in the future to support something like the abort signal of the\n // Navigation API where the navigation gets aborted from outside the\n // transition.\n takeUntil(this.transitionAbortSubject.pipe(tap(err => {\n throw err;\n }))), finalize(() => {\n /* When the navigation stream finishes either through error or success,\n * we set the `completed` or `errored` flag. However, there are some\n * situations where we could get here without either of those being set.\n * For instance, a redirect during NavigationStart. Therefore, this is a\n * catch-all to make sure the NavigationCancel event is fired when a\n * navigation gets cancelled but not caught by other means. */\n if (!completed && !errored) {\n const cancelationReason = typeof ngDevMode === 'undefined' || ngDevMode ? `Navigation ID ${overallTransitionState.id} is not equal to the current navigation id ${this.navigationId}` : '';\n this.cancelNavigationTransition(overallTransitionState, cancelationReason, NavigationCancellationCode.SupersededByNewNavigation);\n }\n // Only clear current navigation if it is still set to the one that\n // finalized.\n if (this.currentTransition?.id === overallTransitionState.id) {\n this.currentNavigation = null;\n this.currentTransition = null;\n }\n }), catchError(e => {\n errored = true;\n /* This error type is issued during Redirect, and is handled as a\n * cancellation rather than an error. */\n if (isNavigationCancelingError(e)) {\n this.events.next(new NavigationCancel(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e.message, e.cancellationCode));\n // When redirecting, we need to delay resolving the navigation\n // promise and push it to the redirect navigation\n if (!isRedirectingNavigationCancelingError(e)) {\n overallTransitionState.resolve(false);\n } else {\n this.events.next(new RedirectRequest(e.url));\n }\n /* All other errors should reset to the router's internal URL reference\n * to the pre-error state. */\n } else {\n this.events.next(new NavigationError(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e, overallTransitionState.targetSnapshot ?? undefined));\n try {\n overallTransitionState.resolve(router.errorHandler(e));\n } catch (ee) {\n // TODO(atscott): consider flipping the default behavior of\n // resolveNavigationPromiseOnError to be `resolve(false)` when\n // undefined. This is the most sane thing to do given that\n // applications very rarely handle the promise rejection and, as a\n // result, would get \"unhandled promise rejection\" console logs.\n // The vast majority of applications would not be affected by this\n // change so omitting a migration seems reasonable. Instead,\n // applications that rely on rejection can specifically opt-in to the\n // old behavior.\n if (this.options.resolveNavigationPromiseOnError) {\n overallTransitionState.resolve(false);\n } else {\n overallTransitionState.reject(ee);\n }\n }\n }\n return EMPTY;\n }));\n // casting because `pipe` returns observable({}) when called with 8+ arguments\n }));\n }\n cancelNavigationTransition(t, reason, code) {\n const navCancel = new NavigationCancel(t.id, this.urlSerializer.serialize(t.extractedUrl), reason, code);\n this.events.next(navCancel);\n t.resolve(false);\n }\n /**\n * @returns Whether we're navigating to somewhere that is not what the Router is\n * currently set to.\n */\n isUpdatingInternalState() {\n // TODO(atscott): The serializer should likely be used instead of\n // `UrlTree.toString()`. Custom serializers are often written to handle\n // things better than the default one (objects, for example will be\n // [Object object] with the custom serializer and be \"the same\" when they\n // aren't).\n // (Same for isUpdatedBrowserUrl)\n return this.currentTransition?.extractedUrl.toString() !== this.currentTransition?.currentUrlTree.toString();\n }\n /**\n * @returns Whether we're updating the browser URL to something new (navigation is going\n * to somewhere not displayed in the URL bar and we will update the URL\n * bar if navigation succeeds).\n */\n isUpdatedBrowserUrl() {\n // The extracted URL is the part of the URL that this application cares about. `extract` may\n // return only part of the browser URL and that part may have not changed even if some other\n // portion of the URL did.\n const extractedBrowserUrl = this.urlHandlingStrategy.extract(this.urlSerializer.parse(this.location.path(true)));\n return extractedBrowserUrl.toString() !== this.currentTransition?.extractedUrl.toString() && !this.currentTransition?.extras.skipLocationChange;\n }\n static {\n this.ɵfac = function NavigationTransitions_Factory(t) {\n return new (t || NavigationTransitions)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: NavigationTransitions,\n factory: NavigationTransitions.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return NavigationTransitions;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction isBrowserTriggeredNavigation(source) {\n return source !== IMPERATIVE_NAVIGATION;\n}\n\n/**\n * @description\n *\n * Provides a way to customize when activated routes get reused.\n *\n * @publicApi\n */\nlet RouteReuseStrategy = /*#__PURE__*/(() => {\n class RouteReuseStrategy {\n static {\n this.ɵfac = function RouteReuseStrategy_Factory(t) {\n return new (t || RouteReuseStrategy)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RouteReuseStrategy,\n factory: () => (() => inject(DefaultRouteReuseStrategy))(),\n providedIn: 'root'\n });\n }\n }\n return RouteReuseStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * @description\n *\n * This base route reuse strategy only reuses routes when the matched router configs are\n * identical. This prevents components from being destroyed and recreated\n * when just the route parameters, query parameters or fragment change\n * (that is, the existing component is _reused_).\n *\n * This strategy does not store any routes for later reuse.\n *\n * Angular uses this strategy by default.\n *\n *\n * It can be used as a base class for custom route reuse strategies, i.e. you can create your own\n * class that extends the `BaseRouteReuseStrategy` one.\n * @publicApi\n */\nclass BaseRouteReuseStrategy {\n /**\n * Whether the given route should detach for later reuse.\n * Always returns false for `BaseRouteReuseStrategy`.\n * */\n shouldDetach(route) {\n return false;\n }\n /**\n * A no-op; the route is never stored since this strategy never detaches routes for later re-use.\n */\n store(route, detachedTree) {}\n /** Returns `false`, meaning the route (and its subtree) is never reattached */\n shouldAttach(route) {\n return false;\n }\n /** Returns `null` because this strategy does not store routes for later re-use. */\n retrieve(route) {\n return null;\n }\n /**\n * Determines if a route should be reused.\n * This strategy returns `true` when the future route config and current route config are\n * identical.\n */\n shouldReuseRoute(future, curr) {\n return future.routeConfig === curr.routeConfig;\n }\n}\nlet DefaultRouteReuseStrategy = /*#__PURE__*/(() => {\n class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {\n static {\n this.ɵfac = /* @__PURE__ */(() => {\n let ɵDefaultRouteReuseStrategy_BaseFactory;\n return function DefaultRouteReuseStrategy_Factory(t) {\n return (ɵDefaultRouteReuseStrategy_BaseFactory || (ɵDefaultRouteReuseStrategy_BaseFactory = i0.ɵɵgetInheritedFactory(DefaultRouteReuseStrategy)))(t || DefaultRouteReuseStrategy);\n };\n })();\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DefaultRouteReuseStrategy,\n factory: DefaultRouteReuseStrategy.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return DefaultRouteReuseStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet StateManager = /*#__PURE__*/(() => {\n class StateManager {\n static {\n this.ɵfac = function StateManager_Factory(t) {\n return new (t || StateManager)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: StateManager,\n factory: () => (() => inject(HistoryStateManager))(),\n providedIn: 'root'\n });\n }\n }\n return StateManager;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet HistoryStateManager = /*#__PURE__*/(() => {\n class HistoryStateManager extends StateManager {\n constructor() {\n super(...arguments);\n this.location = inject(Location);\n this.urlSerializer = inject(UrlSerializer);\n this.options = inject(ROUTER_CONFIGURATION, {\n optional: true\n }) || {};\n this.canceledNavigationResolution = this.options.canceledNavigationResolution || 'replace';\n this.urlHandlingStrategy = inject(UrlHandlingStrategy);\n this.urlUpdateStrategy = this.options.urlUpdateStrategy || 'deferred';\n this.currentUrlTree = new UrlTree();\n this.rawUrlTree = this.currentUrlTree;\n /**\n * The id of the currently active page in the router.\n * Updated to the transition's target id on a successful navigation.\n *\n * This is used to track what page the router last activated. When an attempted navigation fails,\n * the router can then use this to compute how to restore the state back to the previously active\n * page.\n */\n this.currentPageId = 0;\n this.lastSuccessfulId = -1;\n this.routerState = createEmptyState(null);\n this.stateMemento = this.createStateMemento();\n }\n getCurrentUrlTree() {\n return this.currentUrlTree;\n }\n getRawUrlTree() {\n return this.rawUrlTree;\n }\n restoredState() {\n return this.location.getState();\n }\n /**\n * The ɵrouterPageId of whatever page is currently active in the browser history. This is\n * important for computing the target page id for new navigations because we need to ensure each\n * page id in the browser history is 1 more than the previous entry.\n */\n get browserPageId() {\n if (this.canceledNavigationResolution !== 'computed') {\n return this.currentPageId;\n }\n return this.restoredState()?.ɵrouterPageId ?? this.currentPageId;\n }\n getRouterState() {\n return this.routerState;\n }\n createStateMemento() {\n return {\n rawUrlTree: this.rawUrlTree,\n currentUrlTree: this.currentUrlTree,\n routerState: this.routerState\n };\n }\n registerNonRouterCurrentEntryChangeListener(listener) {\n return this.location.subscribe(event => {\n if (event['type'] === 'popstate') {\n listener(event['url'], event.state);\n }\n });\n }\n handleRouterEvent(e, currentTransition) {\n if (e instanceof NavigationStart) {\n this.stateMemento = this.createStateMemento();\n } else if (e instanceof NavigationSkipped) {\n this.rawUrlTree = currentTransition.initialUrl;\n } else if (e instanceof RoutesRecognized) {\n if (this.urlUpdateStrategy === 'eager') {\n if (!currentTransition.extras.skipLocationChange) {\n const rawUrl = this.urlHandlingStrategy.merge(currentTransition.finalUrl, currentTransition.initialUrl);\n this.setBrowserUrl(rawUrl, currentTransition);\n }\n }\n } else if (e instanceof BeforeActivateRoutes) {\n this.currentUrlTree = currentTransition.finalUrl;\n this.rawUrlTree = this.urlHandlingStrategy.merge(currentTransition.finalUrl, currentTransition.initialUrl);\n this.routerState = currentTransition.targetRouterState;\n if (this.urlUpdateStrategy === 'deferred') {\n if (!currentTransition.extras.skipLocationChange) {\n this.setBrowserUrl(this.rawUrlTree, currentTransition);\n }\n }\n } else if (e instanceof NavigationCancel && (e.code === NavigationCancellationCode.GuardRejected || e.code === NavigationCancellationCode.NoDataFromResolver)) {\n this.restoreHistory(currentTransition);\n } else if (e instanceof NavigationError) {\n this.restoreHistory(currentTransition, true);\n } else if (e instanceof NavigationEnd) {\n this.lastSuccessfulId = e.id;\n this.currentPageId = this.browserPageId;\n }\n }\n setBrowserUrl(url, transition) {\n const path = this.urlSerializer.serialize(url);\n if (this.location.isCurrentPathEqualTo(path) || !!transition.extras.replaceUrl) {\n // replacements do not update the target page\n const currentBrowserPageId = this.browserPageId;\n const state = {\n ...transition.extras.state,\n ...this.generateNgRouterState(transition.id, currentBrowserPageId)\n };\n this.location.replaceState(path, '', state);\n } else {\n const state = {\n ...transition.extras.state,\n ...this.generateNgRouterState(transition.id, this.browserPageId + 1)\n };\n this.location.go(path, '', state);\n }\n }\n /**\n * Performs the necessary rollback action to restore the browser URL to the\n * state before the transition.\n */\n restoreHistory(navigation, restoringFromCaughtError = false) {\n if (this.canceledNavigationResolution === 'computed') {\n const currentBrowserPageId = this.browserPageId;\n const targetPagePosition = this.currentPageId - currentBrowserPageId;\n if (targetPagePosition !== 0) {\n this.location.historyGo(targetPagePosition);\n } else if (this.currentUrlTree === navigation.finalUrl && targetPagePosition === 0) {\n // We got to the activation stage (where currentUrlTree is set to the navigation's\n // finalUrl), but we weren't moving anywhere in history (skipLocationChange or replaceUrl).\n // We still need to reset the router state back to what it was when the navigation started.\n this.resetState(navigation);\n this.resetUrlToCurrentUrlTree();\n } else {\n // The browser URL and router state was not updated before the navigation cancelled so\n // there's no restoration needed.\n }\n } else if (this.canceledNavigationResolution === 'replace') {\n // TODO(atscott): It seems like we should _always_ reset the state here. It would be a no-op\n // for `deferred` navigations that haven't change the internal state yet because guards\n // reject. For 'eager' navigations, it seems like we also really should reset the state\n // because the navigation was cancelled. Investigate if this can be done by running TGP.\n if (restoringFromCaughtError) {\n this.resetState(navigation);\n }\n this.resetUrlToCurrentUrlTree();\n }\n }\n resetState(navigation) {\n this.routerState = this.stateMemento.routerState;\n this.currentUrlTree = this.stateMemento.currentUrlTree;\n // Note here that we use the urlHandlingStrategy to get the reset `rawUrlTree` because it may be\n // configured to handle only part of the navigation URL. This means we would only want to reset\n // the part of the navigation handled by the Angular router rather than the whole URL. In\n // addition, the URLHandlingStrategy may be configured to specifically preserve parts of the URL\n // when merging, such as the query params so they are not lost on a refresh.\n this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, navigation.finalUrl ?? this.rawUrlTree);\n }\n resetUrlToCurrentUrlTree() {\n this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));\n }\n generateNgRouterState(navigationId, routerPageId) {\n if (this.canceledNavigationResolution === 'computed') {\n return {\n navigationId,\n ɵrouterPageId: routerPageId\n };\n }\n return {\n navigationId\n };\n }\n static {\n this.ɵfac = /* @__PURE__ */(() => {\n let ɵHistoryStateManager_BaseFactory;\n return function HistoryStateManager_Factory(t) {\n return (ɵHistoryStateManager_BaseFactory || (ɵHistoryStateManager_BaseFactory = i0.ɵɵgetInheritedFactory(HistoryStateManager)))(t || HistoryStateManager);\n };\n })();\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HistoryStateManager,\n factory: HistoryStateManager.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return HistoryStateManager;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nvar NavigationResult = /*#__PURE__*/function (NavigationResult) {\n NavigationResult[NavigationResult[\"COMPLETE\"] = 0] = \"COMPLETE\";\n NavigationResult[NavigationResult[\"FAILED\"] = 1] = \"FAILED\";\n NavigationResult[NavigationResult[\"REDIRECTING\"] = 2] = \"REDIRECTING\";\n return NavigationResult;\n}(NavigationResult || {});\n/**\n * Performs the given action once the router finishes its next/current navigation.\n *\n * The navigation is considered complete under the following conditions:\n * - `NavigationCancel` event emits and the code is not `NavigationCancellationCode.Redirect` or\n * `NavigationCancellationCode.SupersededByNewNavigation`. In these cases, the\n * redirecting/superseding navigation must finish.\n * - `NavigationError`, `NavigationEnd`, or `NavigationSkipped` event emits\n */\nfunction afterNextNavigation(router, action) {\n router.events.pipe(filter(e => e instanceof NavigationEnd || e instanceof NavigationCancel || e instanceof NavigationError || e instanceof NavigationSkipped), map(e => {\n if (e instanceof NavigationEnd || e instanceof NavigationSkipped) {\n return NavigationResult.COMPLETE;\n }\n const redirecting = e instanceof NavigationCancel ? e.code === NavigationCancellationCode.Redirect || e.code === NavigationCancellationCode.SupersededByNewNavigation : false;\n return redirecting ? NavigationResult.REDIRECTING : NavigationResult.FAILED;\n }), filter(result => result !== NavigationResult.REDIRECTING), take(1)).subscribe(() => {\n action();\n });\n}\nfunction defaultErrorHandler(error) {\n throw error;\n}\n/**\n * The equivalent `IsActiveMatchOptions` options for `Router.isActive` is called with `true`\n * (exact = true).\n */\nconst exactMatchOptions = {\n paths: 'exact',\n fragment: 'ignored',\n matrixParams: 'ignored',\n queryParams: 'exact'\n};\n/**\n * The equivalent `IsActiveMatchOptions` options for `Router.isActive` is called with `false`\n * (exact = false).\n */\nconst subsetMatchOptions = {\n paths: 'subset',\n fragment: 'ignored',\n matrixParams: 'ignored',\n queryParams: 'subset'\n};\n/**\n * @description\n *\n * A service that provides navigation among views and URL manipulation capabilities.\n *\n * @see {@link Route}\n * @see [Routing and Navigation Guide](guide/router).\n *\n * @ngModule RouterModule\n *\n * @publicApi\n */\nlet Router = /*#__PURE__*/(() => {\n class Router {\n get currentUrlTree() {\n return this.stateManager.getCurrentUrlTree();\n }\n get rawUrlTree() {\n return this.stateManager.getRawUrlTree();\n }\n /**\n * An event stream for routing events.\n */\n get events() {\n // TODO(atscott): This _should_ be events.asObservable(). However, this change requires internal\n // cleanup: tests are doing `(route.events as Subject).next(...)`. This isn't\n // allowed/supported but we still have to fix these or file bugs against the teams before making\n // the change.\n return this._events;\n }\n /**\n * The current state of routing in this NgModule.\n */\n get routerState() {\n return this.stateManager.getRouterState();\n }\n constructor() {\n this.disposed = false;\n this.isNgZoneEnabled = false;\n this.console = inject(ɵConsole);\n this.stateManager = inject(StateManager);\n this.options = inject(ROUTER_CONFIGURATION, {\n optional: true\n }) || {};\n this.pendingTasks = inject(ɵPendingTasks);\n this.urlUpdateStrategy = this.options.urlUpdateStrategy || 'deferred';\n this.navigationTransitions = inject(NavigationTransitions);\n this.urlSerializer = inject(UrlSerializer);\n this.location = inject(Location);\n this.urlHandlingStrategy = inject(UrlHandlingStrategy);\n /**\n * The private `Subject` type for the public events exposed in the getter. This is used internally\n * to push events to. The separate field allows us to expose separate types in the public API\n * (i.e., an Observable rather than the Subject).\n */\n this._events = new Subject();\n /**\n * A handler for navigation errors in this NgModule.\n *\n * @deprecated Subscribe to the `Router` events and watch for `NavigationError` instead.\n * `provideRouter` has the `withNavigationErrorHandler` feature to make this easier.\n * @see {@link withNavigationErrorHandler}\n */\n this.errorHandler = this.options.errorHandler || defaultErrorHandler;\n /**\n * True if at least one navigation event has occurred,\n * false otherwise.\n */\n this.navigated = false;\n /**\n * A strategy for re-using routes.\n *\n * @deprecated Configure using `providers` instead:\n * `{provide: RouteReuseStrategy, useClass: MyStrategy}`.\n */\n this.routeReuseStrategy = inject(RouteReuseStrategy);\n /**\n * How to handle a navigation request to the current URL.\n *\n *\n * @deprecated Configure this through `provideRouter` or `RouterModule.forRoot` instead.\n * @see {@link withRouterConfig}\n * @see {@link provideRouter}\n * @see {@link RouterModule}\n */\n this.onSameUrlNavigation = this.options.onSameUrlNavigation || 'ignore';\n this.config = inject(ROUTES, {\n optional: true\n })?.flat() ?? [];\n /**\n * Indicates whether the application has opted in to binding Router data to component inputs.\n *\n * This option is enabled by the `withComponentInputBinding` feature of `provideRouter` or\n * `bindToComponentInputs` in the `ExtraOptions` of `RouterModule.forRoot`.\n */\n this.componentInputBindingEnabled = !!inject(INPUT_BINDER, {\n optional: true\n });\n this.eventsSubscription = new Subscription();\n this.isNgZoneEnabled = inject(NgZone) instanceof NgZone && NgZone.isInAngularZone();\n this.resetConfig(this.config);\n this.navigationTransitions.setupNavigations(this, this.currentUrlTree, this.routerState).subscribe({\n error: e => {\n this.console.warn(ngDevMode ? `Unhandled Navigation Error: ${e}` : e);\n }\n });\n this.subscribeToNavigationEvents();\n }\n subscribeToNavigationEvents() {\n const subscription = this.navigationTransitions.events.subscribe(e => {\n try {\n const currentTransition = this.navigationTransitions.currentTransition;\n const currentNavigation = this.navigationTransitions.currentNavigation;\n if (currentTransition !== null && currentNavigation !== null) {\n this.stateManager.handleRouterEvent(e, currentNavigation);\n if (e instanceof NavigationCancel && e.code !== NavigationCancellationCode.Redirect && e.code !== NavigationCancellationCode.SupersededByNewNavigation) {\n // It seems weird that `navigated` is set to `true` when the navigation is rejected,\n // however it's how things were written initially. Investigation would need to be done\n // to determine if this can be removed.\n this.navigated = true;\n } else if (e instanceof NavigationEnd) {\n this.navigated = true;\n } else if (e instanceof RedirectRequest) {\n const mergedTree = this.urlHandlingStrategy.merge(e.url, currentTransition.currentRawUrl);\n const extras = {\n // Persist transient navigation info from the original navigation request.\n info: currentTransition.extras.info,\n skipLocationChange: currentTransition.extras.skipLocationChange,\n // The URL is already updated at this point if we have 'eager' URL\n // updates or if the navigation was triggered by the browser (back\n // button, URL bar, etc). We want to replace that item in history\n // if the navigation is rejected.\n replaceUrl: this.urlUpdateStrategy === 'eager' || isBrowserTriggeredNavigation(currentTransition.source)\n };\n this.scheduleNavigation(mergedTree, IMPERATIVE_NAVIGATION, null, extras, {\n resolve: currentTransition.resolve,\n reject: currentTransition.reject,\n promise: currentTransition.promise\n });\n }\n }\n // Note that it's important to have the Router process the events _before_ the event is\n // pushed through the public observable. This ensures the correct router state is in place\n // before applications observe the events.\n if (isPublicRouterEvent(e)) {\n this._events.next(e);\n }\n } catch (e) {\n this.navigationTransitions.transitionAbortSubject.next(e);\n }\n });\n this.eventsSubscription.add(subscription);\n }\n /** @internal */\n resetRootComponentType(rootComponentType) {\n // TODO: vsavkin router 4.0 should make the root component set to null\n // this will simplify the lifecycle of the router.\n this.routerState.root.component = rootComponentType;\n this.navigationTransitions.rootComponentType = rootComponentType;\n }\n /**\n * Sets up the location change listener and performs the initial navigation.\n */\n initialNavigation() {\n this.setUpLocationChangeListener();\n if (!this.navigationTransitions.hasRequestedNavigation) {\n this.navigateToSyncWithBrowser(this.location.path(true), IMPERATIVE_NAVIGATION, this.stateManager.restoredState());\n }\n }\n /**\n * Sets up the location change listener. This listener detects navigations triggered from outside\n * the Router (the browser back/forward buttons, for example) and schedules a corresponding Router\n * navigation so that the correct events, guards, etc. are triggered.\n */\n setUpLocationChangeListener() {\n // Don't need to use Zone.wrap any more, because zone.js\n // already patch onPopState, so location change callback will\n // run into ngZone\n this.nonRouterCurrentEntryChangeSubscription ??= this.stateManager.registerNonRouterCurrentEntryChangeListener((url, state) => {\n // The `setTimeout` was added in #12160 and is likely to support Angular/AngularJS\n // hybrid apps.\n setTimeout(() => {\n this.navigateToSyncWithBrowser(url, 'popstate', state);\n }, 0);\n });\n }\n /**\n * Schedules a router navigation to synchronize Router state with the browser state.\n *\n * This is done as a response to a popstate event and the initial navigation. These\n * two scenarios represent times when the browser URL/state has been updated and\n * the Router needs to respond to ensure its internal state matches.\n */\n navigateToSyncWithBrowser(url, source, state) {\n const extras = {\n replaceUrl: true\n };\n // TODO: restoredState should always include the entire state, regardless\n // of navigationId. This requires a breaking change to update the type on\n // NavigationStart’s restoredState, which currently requires navigationId\n // to always be present. The Router used to only restore history state if\n // a navigationId was present.\n // The stored navigationId is used by the RouterScroller to retrieve the scroll\n // position for the page.\n const restoredState = state?.navigationId ? state : null;\n // Separate to NavigationStart.restoredState, we must also restore the state to\n // history.state and generate a new navigationId, since it will be overwritten\n if (state) {\n const stateCopy = {\n ...state\n };\n delete stateCopy.navigationId;\n delete stateCopy.ɵrouterPageId;\n if (Object.keys(stateCopy).length !== 0) {\n extras.state = stateCopy;\n }\n }\n const urlTree = this.parseUrl(url);\n this.scheduleNavigation(urlTree, source, restoredState, extras);\n }\n /** The current URL. */\n get url() {\n return this.serializeUrl(this.currentUrlTree);\n }\n /**\n * Returns the current `Navigation` object when the router is navigating,\n * and `null` when idle.\n */\n getCurrentNavigation() {\n return this.navigationTransitions.currentNavigation;\n }\n /**\n * The `Navigation` object of the most recent navigation to succeed and `null` if there\n * has not been a successful navigation yet.\n */\n get lastSuccessfulNavigation() {\n return this.navigationTransitions.lastSuccessfulNavigation;\n }\n /**\n * Resets the route configuration used for navigation and generating links.\n *\n * @param config The route array for the new configuration.\n *\n * @usageNotes\n *\n * ```\n * router.resetConfig([\n * { path: 'team/:id', component: TeamCmp, children: [\n * { path: 'simple', component: SimpleCmp },\n * { path: 'user/:name', component: UserCmp }\n * ]}\n * ]);\n * ```\n */\n resetConfig(config) {\n (typeof ngDevMode === 'undefined' || ngDevMode) && validateConfig(config);\n this.config = config.map(standardizeConfig);\n this.navigated = false;\n }\n /** @nodoc */\n ngOnDestroy() {\n this.dispose();\n }\n /** Disposes of the router. */\n dispose() {\n this.navigationTransitions.complete();\n if (this.nonRouterCurrentEntryChangeSubscription) {\n this.nonRouterCurrentEntryChangeSubscription.unsubscribe();\n this.nonRouterCurrentEntryChangeSubscription = undefined;\n }\n this.disposed = true;\n this.eventsSubscription.unsubscribe();\n }\n /**\n * Appends URL segments to the current URL tree to create a new URL tree.\n *\n * @param commands An array of URL fragments with which to construct the new URL tree.\n * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path\n * segments, followed by the parameters for each segment.\n * The fragments are applied to the current URL tree or the one provided in the `relativeTo`\n * property of the options object, if supplied.\n * @param navigationExtras Options that control the navigation strategy.\n * @returns The new URL tree.\n *\n * @usageNotes\n *\n * ```\n * // create /team/33/user/11\n * router.createUrlTree(['/team', 33, 'user', 11]);\n *\n * // create /team/33;expand=true/user/11\n * router.createUrlTree(['/team', 33, {expand: true}, 'user', 11]);\n *\n * // you can collapse static segments like this (this works only with the first passed-in value):\n * router.createUrlTree(['/team/33/user', userId]);\n *\n * // If the first segment can contain slashes, and you do not want the router to split it,\n * // you can do the following:\n * router.createUrlTree([{segmentPath: '/one/two'}]);\n *\n * // create /team/33/(user/11//right:chat)\n * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: 'chat'}}]);\n *\n * // remove the right secondary node\n * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: null}}]);\n *\n * // assuming the current url is `/team/33/user/11` and the route points to `user/11`\n *\n * // navigate to /team/33/user/11/details\n * router.createUrlTree(['details'], {relativeTo: route});\n *\n * // navigate to /team/33/user/22\n * router.createUrlTree(['../22'], {relativeTo: route});\n *\n * // navigate to /team/44/user/22\n * router.createUrlTree(['../../team/44/user/22'], {relativeTo: route});\n *\n * Note that a value of `null` or `undefined` for `relativeTo` indicates that the\n * tree should be created relative to the root.\n * ```\n */\n createUrlTree(commands, navigationExtras = {}) {\n const {\n relativeTo,\n queryParams,\n fragment,\n queryParamsHandling,\n preserveFragment\n } = navigationExtras;\n const f = preserveFragment ? this.currentUrlTree.fragment : fragment;\n let q = null;\n switch (queryParamsHandling) {\n case 'merge':\n q = {\n ...this.currentUrlTree.queryParams,\n ...queryParams\n };\n break;\n case 'preserve':\n q = this.currentUrlTree.queryParams;\n break;\n default:\n q = queryParams || null;\n }\n if (q !== null) {\n q = this.removeEmptyProps(q);\n }\n let relativeToUrlSegmentGroup;\n try {\n const relativeToSnapshot = relativeTo ? relativeTo.snapshot : this.routerState.snapshot.root;\n relativeToUrlSegmentGroup = createSegmentGroupFromRoute(relativeToSnapshot);\n } catch (e) {\n // This is strictly for backwards compatibility with tests that create\n // invalid `ActivatedRoute` mocks.\n // Note: the difference between having this fallback for invalid `ActivatedRoute` setups and\n // just throwing is ~500 test failures. Fixing all of those tests by hand is not feasible at\n // the moment.\n if (typeof commands[0] !== 'string' || !commands[0].startsWith('/')) {\n // Navigations that were absolute in the old way of creating UrlTrees\n // would still work because they wouldn't attempt to match the\n // segments in the `ActivatedRoute` to the `currentUrlTree` but\n // instead just replace the root segment with the navigation result.\n // Non-absolute navigations would fail to apply the commands because\n // the logic could not find the segment to replace (so they'd act like there were no\n // commands).\n commands = [];\n }\n relativeToUrlSegmentGroup = this.currentUrlTree.root;\n }\n return createUrlTreeFromSegmentGroup(relativeToUrlSegmentGroup, commands, q, f ?? null);\n }\n /**\n * Navigates to a view using an absolute route path.\n *\n * @param url An absolute path for a defined route. The function does not apply any delta to the\n * current URL.\n * @param extras An object containing properties that modify the navigation strategy.\n *\n * @returns A Promise that resolves to 'true' when navigation succeeds,\n * to 'false' when navigation fails, or is rejected on error.\n *\n * @usageNotes\n *\n * The following calls request navigation to an absolute path.\n *\n * ```\n * router.navigateByUrl(\"/team/33/user/11\");\n *\n * // Navigate without updating the URL\n * router.navigateByUrl(\"/team/33/user/11\", { skipLocationChange: true });\n * ```\n *\n * @see [Routing and Navigation guide](guide/router)\n *\n */\n navigateByUrl(url, extras = {\n skipLocationChange: false\n }) {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (this.isNgZoneEnabled && !NgZone.isInAngularZone()) {\n this.console.warn(`Navigation triggered outside Angular zone, did you forget to call 'ngZone.run()'?`);\n }\n }\n const urlTree = isUrlTree(url) ? url : this.parseUrl(url);\n const mergedTree = this.urlHandlingStrategy.merge(urlTree, this.rawUrlTree);\n return this.scheduleNavigation(mergedTree, IMPERATIVE_NAVIGATION, null, extras);\n }\n /**\n * Navigate based on the provided array of commands and a starting point.\n * If no starting route is provided, the navigation is absolute.\n *\n * @param commands An array of URL fragments with which to construct the target URL.\n * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path\n * segments, followed by the parameters for each segment.\n * The fragments are applied to the current URL or the one provided in the `relativeTo` property\n * of the options object, if supplied.\n * @param extras An options object that determines how the URL should be constructed or\n * interpreted.\n *\n * @returns A Promise that resolves to `true` when navigation succeeds, or `false` when navigation\n * fails. The Promise is rejected when an error occurs if `resolveNavigationPromiseOnError` is\n * not `true`.\n *\n * @usageNotes\n *\n * The following calls request navigation to a dynamic route path relative to the current URL.\n *\n * ```\n * router.navigate(['team', 33, 'user', 11], {relativeTo: route});\n *\n * // Navigate without updating the URL, overriding the default behavior\n * router.navigate(['team', 33, 'user', 11], {relativeTo: route, skipLocationChange: true});\n * ```\n *\n * @see [Routing and Navigation guide](guide/router)\n *\n */\n navigate(commands, extras = {\n skipLocationChange: false\n }) {\n validateCommands(commands);\n return this.navigateByUrl(this.createUrlTree(commands, extras), extras);\n }\n /** Serializes a `UrlTree` into a string */\n serializeUrl(url) {\n return this.urlSerializer.serialize(url);\n }\n /** Parses a string into a `UrlTree` */\n parseUrl(url) {\n try {\n return this.urlSerializer.parse(url);\n } catch {\n return this.urlSerializer.parse('/');\n }\n }\n isActive(url, matchOptions) {\n let options;\n if (matchOptions === true) {\n options = {\n ...exactMatchOptions\n };\n } else if (matchOptions === false) {\n options = {\n ...subsetMatchOptions\n };\n } else {\n options = matchOptions;\n }\n if (isUrlTree(url)) {\n return containsTree(this.currentUrlTree, url, options);\n }\n const urlTree = this.parseUrl(url);\n return containsTree(this.currentUrlTree, urlTree, options);\n }\n removeEmptyProps(params) {\n return Object.entries(params).reduce((result, [key, value]) => {\n if (value !== null && value !== undefined) {\n result[key] = value;\n }\n return result;\n }, {});\n }\n scheduleNavigation(rawUrl, source, restoredState, extras, priorPromise) {\n if (this.disposed) {\n return Promise.resolve(false);\n }\n let resolve;\n let reject;\n let promise;\n if (priorPromise) {\n resolve = priorPromise.resolve;\n reject = priorPromise.reject;\n promise = priorPromise.promise;\n } else {\n promise = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n }\n // Indicate that the navigation is happening.\n const taskId = this.pendingTasks.add();\n afterNextNavigation(this, () => {\n // Remove pending task in a microtask to allow for cancelled\n // initial navigations and redirects within the same task.\n queueMicrotask(() => this.pendingTasks.remove(taskId));\n });\n this.navigationTransitions.handleNavigationRequest({\n source,\n restoredState,\n currentUrlTree: this.currentUrlTree,\n currentRawUrl: this.currentUrlTree,\n rawUrl,\n extras,\n resolve,\n reject,\n promise,\n currentSnapshot: this.routerState.snapshot,\n currentRouterState: this.routerState\n });\n // Make sure that the error is propagated even though `processNavigations` catch\n // handler does not rethrow\n return promise.catch(e => {\n return Promise.reject(e);\n });\n }\n static {\n this.ɵfac = function Router_Factory(t) {\n return new (t || Router)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Router,\n factory: Router.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return Router;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction validateCommands(commands) {\n for (let i = 0; i < commands.length; i++) {\n const cmd = commands[i];\n if (cmd == null) {\n throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, (typeof ngDevMode === 'undefined' || ngDevMode) && `The requested path contains ${cmd} segment at index ${i}`);\n }\n }\n}\nfunction isPublicRouterEvent(e) {\n return !(e instanceof BeforeActivateRoutes) && !(e instanceof RedirectRequest);\n}\n\n/**\n * @description\n *\n * When applied to an element in a template, makes that element a link\n * that initiates navigation to a route. Navigation opens one or more routed components\n * in one or more `` locations on the page.\n *\n * Given a route configuration `[{ path: 'user/:name', component: UserCmp }]`,\n * the following creates a static link to the route:\n * `link to user component`\n *\n * You can use dynamic values to generate the link.\n * For a dynamic link, pass an array of path segments,\n * followed by the params for each segment.\n * For example, `['/team', teamId, 'user', userName, {details: true}]`\n * generates a link to `/team/11/user/bob;details=true`.\n *\n * Multiple static segments can be merged into one term and combined with dynamic segments.\n * For example, `['/team/11/user', userName, {details: true}]`\n *\n * The input that you provide to the link is treated as a delta to the current URL.\n * For instance, suppose the current URL is `/user/(box//aux:team)`.\n * The link `Jim` creates the URL\n * `/user/(jim//aux:team)`.\n * See {@link Router#createUrlTree} for more information.\n *\n * @usageNotes\n *\n * You can use absolute or relative paths in a link, set query parameters,\n * control how parameters are handled, and keep a history of navigation states.\n *\n * ### Relative link paths\n *\n * The first segment name can be prepended with `/`, `./`, or `../`.\n * * If the first segment begins with `/`, the router looks up the route from the root of the\n * app.\n * * If the first segment begins with `./`, or doesn't begin with a slash, the router\n * looks in the children of the current activated route.\n * * If the first segment begins with `../`, the router goes up one level in the route tree.\n *\n * ### Setting and handling query params and fragments\n *\n * The following link adds a query parameter and a fragment to the generated URL:\n *\n * ```\n * \n * link to user component\n * \n * ```\n * By default, the directive constructs the new URL using the given query parameters.\n * The example generates the link: `/user/bob?debug=true#education`.\n *\n * You can instruct the directive to handle query parameters differently\n * by specifying the `queryParamsHandling` option in the link.\n * Allowed values are:\n *\n * - `'merge'`: Merge the given `queryParams` into the current query params.\n * - `'preserve'`: Preserve the current query params.\n *\n * For example:\n *\n * ```\n * \n * link to user component\n * \n * ```\n *\n * See {@link UrlCreationOptions#queryParamsHandling}.\n *\n * ### Preserving navigation history\n *\n * You can provide a `state` value to be persisted to the browser's\n * [`History.state` property](https://developer.mozilla.org/en-US/docs/Web/API/History#Properties).\n * For example:\n *\n * ```\n * \n * link to user component\n * \n * ```\n *\n * Use {@link Router#getCurrentNavigation} to retrieve a saved\n * navigation-state value. For example, to capture the `tracingId` during the `NavigationStart`\n * event:\n *\n * ```\n * // Get NavigationStart events\n * router.events.pipe(filter(e => e instanceof NavigationStart)).subscribe(e => {\n * const navigation = router.getCurrentNavigation();\n * tracingService.trace({id: navigation.extras.state.tracingId});\n * });\n * ```\n *\n * @ngModule RouterModule\n *\n * @publicApi\n */\nlet RouterLink = /*#__PURE__*/(() => {\n class RouterLink {\n constructor(router, route, tabIndexAttribute, renderer, el, locationStrategy) {\n this.router = router;\n this.route = route;\n this.tabIndexAttribute = tabIndexAttribute;\n this.renderer = renderer;\n this.el = el;\n this.locationStrategy = locationStrategy;\n /**\n * Represents an `href` attribute value applied to a host element,\n * when a host element is ``. For other tags, the value is `null`.\n */\n this.href = null;\n this.commands = null;\n /** @internal */\n this.onChanges = new Subject();\n /**\n * Passed to {@link Router#createUrlTree} as part of the\n * `UrlCreationOptions`.\n * @see {@link UrlCreationOptions#preserveFragment}\n * @see {@link Router#createUrlTree}\n */\n this.preserveFragment = false;\n /**\n * Passed to {@link Router#navigateByUrl} as part of the\n * `NavigationBehaviorOptions`.\n * @see {@link NavigationBehaviorOptions#skipLocationChange}\n * @see {@link Router#navigateByUrl}\n */\n this.skipLocationChange = false;\n /**\n * Passed to {@link Router#navigateByUrl} as part of the\n * `NavigationBehaviorOptions`.\n * @see {@link NavigationBehaviorOptions#replaceUrl}\n * @see {@link Router#navigateByUrl}\n */\n this.replaceUrl = false;\n const tagName = el.nativeElement.tagName?.toLowerCase();\n this.isAnchorElement = tagName === 'a' || tagName === 'area';\n if (this.isAnchorElement) {\n this.subscription = router.events.subscribe(s => {\n if (s instanceof NavigationEnd) {\n this.updateHref();\n }\n });\n } else {\n this.setTabIndexIfNotOnNativeEl('0');\n }\n }\n /**\n * Modifies the tab index if there was not a tabindex attribute on the element during\n * instantiation.\n */\n setTabIndexIfNotOnNativeEl(newTabIndex) {\n if (this.tabIndexAttribute != null /* both `null` and `undefined` */ || this.isAnchorElement) {\n return;\n }\n this.applyAttributeValue('tabindex', newTabIndex);\n }\n /** @nodoc */\n ngOnChanges(changes) {\n if (this.isAnchorElement) {\n this.updateHref();\n }\n // This is subscribed to by `RouterLinkActive` so that it knows to update when there are changes\n // to the RouterLinks it's tracking.\n this.onChanges.next(this);\n }\n /**\n * Commands to pass to {@link Router#createUrlTree}.\n * - **array**: commands to pass to {@link Router#createUrlTree}.\n * - **string**: shorthand for array of commands with just the string, i.e. `['/route']`\n * - **null|undefined**: effectively disables the `routerLink`\n * @see {@link Router#createUrlTree}\n */\n set routerLink(commands) {\n if (commands != null) {\n this.commands = Array.isArray(commands) ? commands : [commands];\n this.setTabIndexIfNotOnNativeEl('0');\n } else {\n this.commands = null;\n this.setTabIndexIfNotOnNativeEl(null);\n }\n }\n /** @nodoc */\n onClick(button, ctrlKey, shiftKey, altKey, metaKey) {\n const urlTree = this.urlTree;\n if (urlTree === null) {\n return true;\n }\n if (this.isAnchorElement) {\n if (button !== 0 || ctrlKey || shiftKey || altKey || metaKey) {\n return true;\n }\n if (typeof this.target === 'string' && this.target != '_self') {\n return true;\n }\n }\n const extras = {\n skipLocationChange: this.skipLocationChange,\n replaceUrl: this.replaceUrl,\n state: this.state,\n info: this.info\n };\n this.router.navigateByUrl(urlTree, extras);\n // Return `false` for `` elements to prevent default action\n // and cancel the native behavior, since the navigation is handled\n // by the Router.\n return !this.isAnchorElement;\n }\n /** @nodoc */\n ngOnDestroy() {\n this.subscription?.unsubscribe();\n }\n updateHref() {\n const urlTree = this.urlTree;\n this.href = urlTree !== null && this.locationStrategy ? this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(urlTree)) : null;\n const sanitizedValue = this.href === null ? null :\n // This class represents a directive that can be added to both `` elements,\n // as well as other elements. As a result, we can't define security context at\n // compile time. So the security context is deferred to runtime.\n // The `ɵɵsanitizeUrlOrResourceUrl` selects the necessary sanitizer function\n // based on the tag and property names. The logic mimics the one from\n // `packages/compiler/src/schema/dom_security_schema.ts`, which is used at compile time.\n //\n // Note: we should investigate whether we can switch to using `@HostBinding('attr.href')`\n // instead of applying a value via a renderer, after a final merge of the\n // `RouterLinkWithHref` directive.\n ɵɵsanitizeUrlOrResourceUrl(this.href, this.el.nativeElement.tagName.toLowerCase(), 'href');\n this.applyAttributeValue('href', sanitizedValue);\n }\n applyAttributeValue(attrName, attrValue) {\n const renderer = this.renderer;\n const nativeElement = this.el.nativeElement;\n if (attrValue !== null) {\n renderer.setAttribute(nativeElement, attrName, attrValue);\n } else {\n renderer.removeAttribute(nativeElement, attrName);\n }\n }\n get urlTree() {\n if (this.commands === null) {\n return null;\n }\n return this.router.createUrlTree(this.commands, {\n // If the `relativeTo` input is not defined, we want to use `this.route` by default.\n // Otherwise, we should use the value provided by the user in the input.\n relativeTo: this.relativeTo !== undefined ? this.relativeTo : this.route,\n queryParams: this.queryParams,\n fragment: this.fragment,\n queryParamsHandling: this.queryParamsHandling,\n preserveFragment: this.preserveFragment\n });\n }\n static {\n this.ɵfac = function RouterLink_Factory(t) {\n return new (t || RouterLink)(i0.ɵɵdirectiveInject(Router), i0.ɵɵdirectiveInject(ActivatedRoute), i0.ɵɵinjectAttribute('tabindex'), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i3.LocationStrategy));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: RouterLink,\n selectors: [[\"\", \"routerLink\", \"\"]],\n hostVars: 1,\n hostBindings: function RouterLink_HostBindings(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵlistener(\"click\", function RouterLink_click_HostBindingHandler($event) {\n return ctx.onClick($event.button, $event.ctrlKey, $event.shiftKey, $event.altKey, $event.metaKey);\n });\n }\n if (rf & 2) {\n i0.ɵɵattribute(\"target\", ctx.target);\n }\n },\n inputs: {\n target: \"target\",\n queryParams: \"queryParams\",\n fragment: \"fragment\",\n queryParamsHandling: \"queryParamsHandling\",\n state: \"state\",\n info: \"info\",\n relativeTo: \"relativeTo\",\n preserveFragment: [i0.ɵɵInputFlags.HasDecoratorInputTransform, \"preserveFragment\", \"preserveFragment\", booleanAttribute],\n skipLocationChange: [i0.ɵɵInputFlags.HasDecoratorInputTransform, \"skipLocationChange\", \"skipLocationChange\", booleanAttribute],\n replaceUrl: [i0.ɵɵInputFlags.HasDecoratorInputTransform, \"replaceUrl\", \"replaceUrl\", booleanAttribute],\n routerLink: \"routerLink\"\n },\n standalone: true,\n features: [i0.ɵɵInputTransformsFeature, i0.ɵɵNgOnChangesFeature]\n });\n }\n }\n return RouterLink;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n *\n * @description\n *\n * Tracks whether the linked route of an element is currently active, and allows you\n * to specify one or more CSS classes to add to the element when the linked route\n * is active.\n *\n * Use this directive to create a visual distinction for elements associated with an active route.\n * For example, the following code highlights the word \"Bob\" when the router\n * activates the associated route:\n *\n * ```\n * Bob\n * ```\n *\n * Whenever the URL is either '/user' or '/user/bob', the \"active-link\" class is\n * added to the anchor tag. If the URL changes, the class is removed.\n *\n * You can set more than one class using a space-separated string or an array.\n * For example:\n *\n * ```\n * Bob\n * Bob\n * ```\n *\n * To add the classes only when the URL matches the link exactly, add the option `exact: true`:\n *\n * ```\n * Bob\n * ```\n *\n * To directly check the `isActive` status of the link, assign the `RouterLinkActive`\n * instance to a template variable.\n * For example, the following checks the status without assigning any CSS classes:\n *\n * ```\n * \n * Bob {{ rla.isActive ? '(already open)' : ''}}\n * \n * ```\n *\n * You can apply the `RouterLinkActive` directive to an ancestor of linked elements.\n * For example, the following sets the active-link class on the `
` parent tag\n * when the URL is either '/user/jim' or '/user/bob'.\n *\n * ```\n *
\n * Jim\n * Bob\n *
\n * ```\n *\n * The `RouterLinkActive` directive can also be used to set the aria-current attribute\n * to provide an alternative distinction for active elements to visually impaired users.\n *\n * For example, the following code adds the 'active' class to the Home Page link when it is\n * indeed active and in such case also sets its aria-current attribute to 'page':\n *\n * ```\n * Home Page\n * ```\n *\n * @ngModule RouterModule\n *\n * @publicApi\n */\nlet RouterLinkActive = /*#__PURE__*/(() => {\n class RouterLinkActive {\n get isActive() {\n return this._isActive;\n }\n constructor(router, element, renderer, cdr, link) {\n this.router = router;\n this.element = element;\n this.renderer = renderer;\n this.cdr = cdr;\n this.link = link;\n this.classes = [];\n this._isActive = false;\n /**\n * Options to configure how to determine if the router link is active.\n *\n * These options are passed to the `Router.isActive()` function.\n *\n * @see {@link Router#isActive}\n */\n this.routerLinkActiveOptions = {\n exact: false\n };\n /**\n *\n * You can use the output `isActiveChange` to get notified each time the link becomes\n * active or inactive.\n *\n * Emits:\n * true -> Route is active\n * false -> Route is inactive\n *\n * ```\n * Bob\n * ```\n */\n this.isActiveChange = new EventEmitter();\n this.routerEventsSubscription = router.events.subscribe(s => {\n if (s instanceof NavigationEnd) {\n this.update();\n }\n });\n }\n /** @nodoc */\n ngAfterContentInit() {\n // `of(null)` is used to force subscribe body to execute once immediately (like `startWith`).\n of(this.links.changes, of(null)).pipe(mergeAll()).subscribe(_ => {\n this.update();\n this.subscribeToEachLinkOnChanges();\n });\n }\n subscribeToEachLinkOnChanges() {\n this.linkInputChangesSubscription?.unsubscribe();\n const allLinkChanges = [...this.links.toArray(), this.link].filter(link => !!link).map(link => link.onChanges);\n this.linkInputChangesSubscription = from(allLinkChanges).pipe(mergeAll()).subscribe(link => {\n if (this._isActive !== this.isLinkActive(this.router)(link)) {\n this.update();\n }\n });\n }\n set routerLinkActive(data) {\n const classes = Array.isArray(data) ? data : data.split(' ');\n this.classes = classes.filter(c => !!c);\n }\n /** @nodoc */\n ngOnChanges(changes) {\n this.update();\n }\n /** @nodoc */\n ngOnDestroy() {\n this.routerEventsSubscription.unsubscribe();\n this.linkInputChangesSubscription?.unsubscribe();\n }\n update() {\n if (!this.links || !this.router.navigated) return;\n queueMicrotask(() => {\n const hasActiveLinks = this.hasActiveLinks();\n this.classes.forEach(c => {\n if (hasActiveLinks) {\n this.renderer.addClass(this.element.nativeElement, c);\n } else {\n this.renderer.removeClass(this.element.nativeElement, c);\n }\n });\n if (hasActiveLinks && this.ariaCurrentWhenActive !== undefined) {\n this.renderer.setAttribute(this.element.nativeElement, 'aria-current', this.ariaCurrentWhenActive.toString());\n } else {\n this.renderer.removeAttribute(this.element.nativeElement, 'aria-current');\n }\n // Only emit change if the active state changed.\n if (this._isActive !== hasActiveLinks) {\n this._isActive = hasActiveLinks;\n this.cdr.markForCheck();\n // Emit on isActiveChange after classes are updated\n this.isActiveChange.emit(hasActiveLinks);\n }\n });\n }\n isLinkActive(router) {\n const options = isActiveMatchOptions(this.routerLinkActiveOptions) ? this.routerLinkActiveOptions :\n // While the types should disallow `undefined` here, it's possible without strict inputs\n this.routerLinkActiveOptions.exact || false;\n return link => {\n const urlTree = link.urlTree;\n return urlTree ? router.isActive(urlTree, options) : false;\n };\n }\n hasActiveLinks() {\n const isActiveCheckFn = this.isLinkActive(this.router);\n return this.link && isActiveCheckFn(this.link) || this.links.some(isActiveCheckFn);\n }\n static {\n this.ɵfac = function RouterLinkActive_Factory(t) {\n return new (t || RouterLinkActive)(i0.ɵɵdirectiveInject(Router), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(RouterLink, 8));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: RouterLinkActive,\n selectors: [[\"\", \"routerLinkActive\", \"\"]],\n contentQueries: function RouterLinkActive_ContentQueries(rf, ctx, dirIndex) {\n if (rf & 1) {\n i0.ɵɵcontentQuery(dirIndex, RouterLink, 5);\n }\n if (rf & 2) {\n let _t;\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.links = _t);\n }\n },\n inputs: {\n routerLinkActiveOptions: \"routerLinkActiveOptions\",\n ariaCurrentWhenActive: \"ariaCurrentWhenActive\",\n routerLinkActive: \"routerLinkActive\"\n },\n outputs: {\n isActiveChange: \"isActiveChange\"\n },\n exportAs: [\"routerLinkActive\"],\n standalone: true,\n features: [i0.ɵɵNgOnChangesFeature]\n });\n }\n }\n return RouterLinkActive;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Use instead of `'paths' in options` to be compatible with property renaming\n */\nfunction isActiveMatchOptions(options) {\n return !!options.paths;\n}\n\n/**\n * @description\n *\n * Provides a preloading strategy.\n *\n * @publicApi\n */\nclass PreloadingStrategy {}\n/**\n * @description\n *\n * Provides a preloading strategy that preloads all modules as quickly as possible.\n *\n * ```\n * RouterModule.forRoot(ROUTES, {preloadingStrategy: PreloadAllModules})\n * ```\n *\n * @publicApi\n */\nlet PreloadAllModules = /*#__PURE__*/(() => {\n class PreloadAllModules {\n preload(route, fn) {\n return fn().pipe(catchError(() => of(null)));\n }\n static {\n this.ɵfac = function PreloadAllModules_Factory(t) {\n return new (t || PreloadAllModules)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: PreloadAllModules,\n factory: PreloadAllModules.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return PreloadAllModules;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * @description\n *\n * Provides a preloading strategy that does not preload any modules.\n *\n * This strategy is enabled by default.\n *\n * @publicApi\n */\nlet NoPreloading = /*#__PURE__*/(() => {\n class NoPreloading {\n preload(route, fn) {\n return of(null);\n }\n static {\n this.ɵfac = function NoPreloading_Factory(t) {\n return new (t || NoPreloading)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: NoPreloading,\n factory: NoPreloading.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return NoPreloading;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * The preloader optimistically loads all router configurations to\n * make navigations into lazily-loaded sections of the application faster.\n *\n * The preloader runs in the background. When the router bootstraps, the preloader\n * starts listening to all navigation events. After every such event, the preloader\n * will check if any configurations can be loaded lazily.\n *\n * If a route is protected by `canLoad` guards, the preloaded will not load it.\n *\n * @publicApi\n */\nlet RouterPreloader = /*#__PURE__*/(() => {\n class RouterPreloader {\n constructor(router, compiler, injector, preloadingStrategy, loader) {\n this.router = router;\n this.injector = injector;\n this.preloadingStrategy = preloadingStrategy;\n this.loader = loader;\n }\n setUpPreloading() {\n this.subscription = this.router.events.pipe(filter(e => e instanceof NavigationEnd), concatMap(() => this.preload())).subscribe(() => {});\n }\n preload() {\n return this.processRoutes(this.injector, this.router.config);\n }\n /** @nodoc */\n ngOnDestroy() {\n if (this.subscription) {\n this.subscription.unsubscribe();\n }\n }\n processRoutes(injector, routes) {\n const res = [];\n for (const route of routes) {\n if (route.providers && !route._injector) {\n route._injector = createEnvironmentInjector(route.providers, injector, `Route: ${route.path}`);\n }\n const injectorForCurrentRoute = route._injector ?? injector;\n const injectorForChildren = route._loadedInjector ?? injectorForCurrentRoute;\n // Note that `canLoad` is only checked as a condition that prevents `loadChildren` and not\n // `loadComponent`. `canLoad` guards only block loading of child routes by design. This\n // happens as a consequence of needing to descend into children for route matching immediately\n // while component loading is deferred until route activation. Because `canLoad` guards can\n // have side effects, we cannot execute them here so we instead skip preloading altogether\n // when present. Lastly, it remains to be decided whether `canLoad` should behave this way\n // at all. Code splitting and lazy loading is separate from client-side authorization checks\n // and should not be used as a security measure to prevent loading of code.\n if (route.loadChildren && !route._loadedRoutes && route.canLoad === undefined || route.loadComponent && !route._loadedComponent) {\n res.push(this.preloadConfig(injectorForCurrentRoute, route));\n }\n if (route.children || route._loadedRoutes) {\n res.push(this.processRoutes(injectorForChildren, route.children ?? route._loadedRoutes));\n }\n }\n return from(res).pipe(mergeAll());\n }\n preloadConfig(injector, route) {\n return this.preloadingStrategy.preload(route, () => {\n let loadedChildren$;\n if (route.loadChildren && route.canLoad === undefined) {\n loadedChildren$ = this.loader.loadChildren(injector, route);\n } else {\n loadedChildren$ = of(null);\n }\n const recursiveLoadChildren$ = loadedChildren$.pipe(mergeMap(config => {\n if (config === null) {\n return of(void 0);\n }\n route._loadedRoutes = config.routes;\n route._loadedInjector = config.injector;\n // If the loaded config was a module, use that as the module/module injector going\n // forward. Otherwise, continue using the current module/module injector.\n return this.processRoutes(config.injector ?? injector, config.routes);\n }));\n if (route.loadComponent && !route._loadedComponent) {\n const loadComponent$ = this.loader.loadComponent(route);\n return from([recursiveLoadChildren$, loadComponent$]).pipe(mergeAll());\n } else {\n return recursiveLoadChildren$;\n }\n });\n }\n static {\n this.ɵfac = function RouterPreloader_Factory(t) {\n return new (t || RouterPreloader)(i0.ɵɵinject(Router), i0.ɵɵinject(i0.Compiler), i0.ɵɵinject(i0.EnvironmentInjector), i0.ɵɵinject(PreloadingStrategy), i0.ɵɵinject(RouterConfigLoader));\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RouterPreloader,\n factory: RouterPreloader.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return RouterPreloader;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst ROUTER_SCROLLER = /*#__PURE__*/new InjectionToken('');\nlet RouterScroller = /*#__PURE__*/(() => {\n class RouterScroller {\n /** @nodoc */\n constructor(urlSerializer, transitions, viewportScroller, zone, options = {}) {\n this.urlSerializer = urlSerializer;\n this.transitions = transitions;\n this.viewportScroller = viewportScroller;\n this.zone = zone;\n this.options = options;\n this.lastId = 0;\n this.lastSource = 'imperative';\n this.restoredId = 0;\n this.store = {};\n // Default both options to 'disabled'\n options.scrollPositionRestoration ||= 'disabled';\n options.anchorScrolling ||= 'disabled';\n }\n init() {\n // we want to disable the automatic scrolling because having two places\n // responsible for scrolling results race conditions, especially given\n // that browser don't implement this behavior consistently\n if (this.options.scrollPositionRestoration !== 'disabled') {\n this.viewportScroller.setHistoryScrollRestoration('manual');\n }\n this.routerEventsSubscription = this.createScrollEvents();\n this.scrollEventsSubscription = this.consumeScrollEvents();\n }\n createScrollEvents() {\n return this.transitions.events.subscribe(e => {\n if (e instanceof NavigationStart) {\n // store the scroll position of the current stable navigations.\n this.store[this.lastId] = this.viewportScroller.getScrollPosition();\n this.lastSource = e.navigationTrigger;\n this.restoredId = e.restoredState ? e.restoredState.navigationId : 0;\n } else if (e instanceof NavigationEnd) {\n this.lastId = e.id;\n this.scheduleScrollEvent(e, this.urlSerializer.parse(e.urlAfterRedirects).fragment);\n } else if (e instanceof NavigationSkipped && e.code === NavigationSkippedCode.IgnoredSameUrlNavigation) {\n this.lastSource = undefined;\n this.restoredId = 0;\n this.scheduleScrollEvent(e, this.urlSerializer.parse(e.url).fragment);\n }\n });\n }\n consumeScrollEvents() {\n return this.transitions.events.subscribe(e => {\n if (!(e instanceof Scroll)) return;\n // a popstate event. The pop state event will always ignore anchor scrolling.\n if (e.position) {\n if (this.options.scrollPositionRestoration === 'top') {\n this.viewportScroller.scrollToPosition([0, 0]);\n } else if (this.options.scrollPositionRestoration === 'enabled') {\n this.viewportScroller.scrollToPosition(e.position);\n }\n // imperative navigation \"forward\"\n } else {\n if (e.anchor && this.options.anchorScrolling === 'enabled') {\n this.viewportScroller.scrollToAnchor(e.anchor);\n } else if (this.options.scrollPositionRestoration !== 'disabled') {\n this.viewportScroller.scrollToPosition([0, 0]);\n }\n }\n });\n }\n scheduleScrollEvent(routerEvent, anchor) {\n this.zone.runOutsideAngular(() => {\n // The scroll event needs to be delayed until after change detection. Otherwise, we may\n // attempt to restore the scroll position before the router outlet has fully rendered the\n // component by executing its update block of the template function.\n setTimeout(() => {\n this.zone.run(() => {\n this.transitions.events.next(new Scroll(routerEvent, this.lastSource === 'popstate' ? this.store[this.restoredId] : null, anchor));\n });\n }, 0);\n });\n }\n /** @nodoc */\n ngOnDestroy() {\n this.routerEventsSubscription?.unsubscribe();\n this.scrollEventsSubscription?.unsubscribe();\n }\n static {\n this.ɵfac = function RouterScroller_Factory(t) {\n i0.ɵɵinvalidFactory();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RouterScroller,\n factory: RouterScroller.ɵfac\n });\n }\n }\n return RouterScroller;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Sets up providers necessary to enable `Router` functionality for the application.\n * Allows to configure a set of routes as well as extra features that should be enabled.\n *\n * @usageNotes\n *\n * Basic example of how you can add a Router to your application:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent, {\n * providers: [provideRouter(appRoutes)]\n * });\n * ```\n *\n * You can also enable optional features in the Router by adding functions from the `RouterFeatures`\n * type:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes,\n * withDebugTracing(),\n * withRouterConfig({paramsInheritanceStrategy: 'always'}))\n * ]\n * }\n * );\n * ```\n *\n * @see {@link RouterFeatures}\n *\n * @publicApi\n * @param routes A set of `Route`s to use for the application routing table.\n * @param features Optional features to configure additional router behaviors.\n * @returns A set of providers to setup a Router.\n */\nfunction provideRouter(routes, ...features) {\n return makeEnvironmentProviders([{\n provide: ROUTES,\n multi: true,\n useValue: routes\n }, typeof ngDevMode === 'undefined' || ngDevMode ? {\n provide: ROUTER_IS_PROVIDED,\n useValue: true\n } : [], {\n provide: ActivatedRoute,\n useFactory: rootRoute,\n deps: [Router]\n }, {\n provide: APP_BOOTSTRAP_LISTENER,\n multi: true,\n useFactory: getBootstrapListener\n }, features.map(feature => feature.ɵproviders)]);\n}\nfunction rootRoute(router) {\n return router.routerState.root;\n}\n/**\n * Helper function to create an object that represents a Router feature.\n */\nfunction routerFeature(kind, providers) {\n return {\n ɵkind: kind,\n ɵproviders: providers\n };\n}\n/**\n * An Injection token used to indicate whether `provideRouter` or `RouterModule.forRoot` was ever\n * called.\n */\nconst ROUTER_IS_PROVIDED = /*#__PURE__*/new InjectionToken('', {\n providedIn: 'root',\n factory: () => false\n});\nconst routerIsProvidedDevModeCheck = {\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useFactory() {\n return () => {\n if (!inject(ROUTER_IS_PROVIDED)) {\n console.warn('`provideRoutes` was called without `provideRouter` or `RouterModule.forRoot`. ' + 'This is likely a mistake.');\n }\n };\n }\n};\n/**\n * Registers a [DI provider](guide/glossary#provider) for a set of routes.\n * @param routes The route configuration to provide.\n *\n * @usageNotes\n *\n * ```\n * @NgModule({\n * providers: [provideRoutes(ROUTES)]\n * })\n * class LazyLoadedChildModule {}\n * ```\n *\n * @deprecated If necessary, provide routes using the `ROUTES` `InjectionToken`.\n * @see {@link ROUTES}\n * @publicApi\n */\nfunction provideRoutes(routes) {\n return [{\n provide: ROUTES,\n multi: true,\n useValue: routes\n }, typeof ngDevMode === 'undefined' || ngDevMode ? routerIsProvidedDevModeCheck : []];\n}\n/**\n * Enables customizable scrolling behavior for router navigations.\n *\n * @usageNotes\n *\n * Basic example of how you can enable scrolling feature:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withInMemoryScrolling())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n * @see {@link ViewportScroller}\n *\n * @publicApi\n * @param options Set of configuration parameters to customize scrolling behavior, see\n * `InMemoryScrollingOptions` for additional information.\n * @returns A set of providers for use with `provideRouter`.\n */\nfunction withInMemoryScrolling(options = {}) {\n const providers = [{\n provide: ROUTER_SCROLLER,\n useFactory: () => {\n const viewportScroller = inject(ViewportScroller);\n const zone = inject(NgZone);\n const transitions = inject(NavigationTransitions);\n const urlSerializer = inject(UrlSerializer);\n return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, options);\n }\n }];\n return routerFeature(4 /* RouterFeatureKind.InMemoryScrollingFeature */, providers);\n}\nfunction getBootstrapListener() {\n const injector = inject(Injector);\n return bootstrappedComponentRef => {\n const ref = injector.get(ApplicationRef);\n if (bootstrappedComponentRef !== ref.components[0]) {\n return;\n }\n const router = injector.get(Router);\n const bootstrapDone = injector.get(BOOTSTRAP_DONE);\n if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {\n router.initialNavigation();\n }\n injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();\n injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)?.init();\n router.resetRootComponentType(ref.componentTypes[0]);\n if (!bootstrapDone.closed) {\n bootstrapDone.next();\n bootstrapDone.complete();\n bootstrapDone.unsubscribe();\n }\n };\n}\n/**\n * A subject used to indicate that the bootstrapping phase is done. When initial navigation is\n * `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing\n * to the activation phase.\n */\nconst BOOTSTRAP_DONE = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'bootstrap done indicator' : '', {\n factory: () => {\n return new Subject();\n }\n});\nconst INITIAL_NAVIGATION = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'initial navigation' : '', {\n providedIn: 'root',\n factory: () => 1 /* InitialNavigation.EnabledNonBlocking */\n});\n/**\n * Configures initial navigation to start before the root component is created.\n *\n * The bootstrap is blocked until the initial navigation is complete. This value is required for\n * [server-side rendering](guide/ssr) to work.\n *\n * @usageNotes\n *\n * Basic example of how you can enable this navigation behavior:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withEnabledBlockingInitialNavigation())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @publicApi\n * @returns A set of providers for use with `provideRouter`.\n */\nfunction withEnabledBlockingInitialNavigation() {\n const providers = [{\n provide: INITIAL_NAVIGATION,\n useValue: 0 /* InitialNavigation.EnabledBlocking */\n }, {\n provide: APP_INITIALIZER,\n multi: true,\n deps: [Injector],\n useFactory: injector => {\n const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve());\n return () => {\n return locationInitialized.then(() => {\n return new Promise(resolve => {\n const router = injector.get(Router);\n const bootstrapDone = injector.get(BOOTSTRAP_DONE);\n afterNextNavigation(router, () => {\n // Unblock APP_INITIALIZER in case the initial navigation was canceled or errored\n // without a redirect.\n resolve(true);\n });\n injector.get(NavigationTransitions).afterPreactivation = () => {\n // Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we\n // assume activation will complete successfully (even though this is not\n // guaranteed).\n resolve(true);\n return bootstrapDone.closed ? of(void 0) : bootstrapDone;\n };\n router.initialNavigation();\n });\n });\n };\n }\n }];\n return routerFeature(2 /* RouterFeatureKind.EnabledBlockingInitialNavigationFeature */, providers);\n}\n/**\n * Disables initial navigation.\n *\n * Use if there is a reason to have more control over when the router starts its initial navigation\n * due to some complex initialization logic.\n *\n * @usageNotes\n *\n * Basic example of how you can disable initial navigation:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withDisabledInitialNavigation())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withDisabledInitialNavigation() {\n const providers = [{\n provide: APP_INITIALIZER,\n multi: true,\n useFactory: () => {\n const router = inject(Router);\n return () => {\n router.setUpLocationChangeListener();\n };\n }\n }, {\n provide: INITIAL_NAVIGATION,\n useValue: 2 /* InitialNavigation.Disabled */\n }];\n return routerFeature(3 /* RouterFeatureKind.DisabledInitialNavigationFeature */, providers);\n}\n/**\n * Enables logging of all internal navigation events to the console.\n * Extra logging might be useful for debugging purposes to inspect Router event sequence.\n *\n * @usageNotes\n *\n * Basic example of how you can enable debug tracing:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withDebugTracing())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withDebugTracing() {\n let providers = [];\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n providers = [{\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useFactory: () => {\n const router = inject(Router);\n return () => router.events.subscribe(e => {\n // tslint:disable:no-console\n console.group?.(`Router Event: ${e.constructor.name}`);\n console.log(stringifyEvent(e));\n console.log(e);\n console.groupEnd?.();\n // tslint:enable:no-console\n });\n }\n }];\n } else {\n providers = [];\n }\n return routerFeature(1 /* RouterFeatureKind.DebugTracingFeature */, providers);\n}\nconst ROUTER_PRELOADER = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'router preloader' : '');\n/**\n * Allows to configure a preloading strategy to use. The strategy is configured by providing a\n * reference to a class that implements a `PreloadingStrategy`.\n *\n * @usageNotes\n *\n * Basic example of how you can configure preloading:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withPreloading(PreloadAllModules))\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @param preloadingStrategy A reference to a class that implements a `PreloadingStrategy` that\n * should be used.\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withPreloading(preloadingStrategy) {\n const providers = [{\n provide: ROUTER_PRELOADER,\n useExisting: RouterPreloader\n }, {\n provide: PreloadingStrategy,\n useExisting: preloadingStrategy\n }];\n return routerFeature(0 /* RouterFeatureKind.PreloadingFeature */, providers);\n}\n/**\n * Allows to provide extra parameters to configure Router.\n *\n * @usageNotes\n *\n * Basic example of how you can provide extra configuration options:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withRouterConfig({\n * onSameUrlNavigation: 'reload'\n * }))\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @param options A set of parameters to configure Router, see `RouterConfigOptions` for\n * additional information.\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withRouterConfig(options) {\n const providers = [{\n provide: ROUTER_CONFIGURATION,\n useValue: options\n }];\n return routerFeature(5 /* RouterFeatureKind.RouterConfigurationFeature */, providers);\n}\n/**\n * Provides the location strategy that uses the URL fragment instead of the history API.\n *\n * @usageNotes\n *\n * Basic example of how you can use the hash location option:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withHashLocation())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n * @see {@link HashLocationStrategy}\n *\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withHashLocation() {\n const providers = [{\n provide: LocationStrategy,\n useClass: HashLocationStrategy\n }];\n return routerFeature(6 /* RouterFeatureKind.RouterHashLocationFeature */, providers);\n}\n/**\n * Subscribes to the Router's navigation events and calls the given function when a\n * `NavigationError` happens.\n *\n * This function is run inside application's [injection context](guide/dependency-injection-context)\n * so you can use the [`inject`](api/core/inject) function.\n *\n * @usageNotes\n *\n * Basic example of how you can use the error handler option:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withNavigationErrorHandler((e: NavigationError) =>\n * inject(MyErrorTracker).trackError(e)))\n * ]\n * }\n * );\n * ```\n *\n * @see {@link NavigationError}\n * @see {@link core/inject}\n * @see {@link runInInjectionContext}\n *\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withNavigationErrorHandler(fn) {\n const providers = [{\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useValue: () => {\n const injector = inject(EnvironmentInjector);\n inject(Router).events.subscribe(e => {\n if (e instanceof NavigationError) {\n runInInjectionContext(injector, () => fn(e));\n }\n });\n }\n }];\n return routerFeature(7 /* RouterFeatureKind.NavigationErrorHandlerFeature */, providers);\n}\n/**\n * Enables binding information from the `Router` state directly to the inputs of the component in\n * `Route` configurations.\n *\n * @usageNotes\n *\n * Basic example of how you can enable the feature:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withComponentInputBinding())\n * ]\n * }\n * );\n * ```\n *\n * @returns A set of providers for use with `provideRouter`.\n */\nfunction withComponentInputBinding() {\n const providers = [RoutedComponentInputBinder, {\n provide: INPUT_BINDER,\n useExisting: RoutedComponentInputBinder\n }];\n return routerFeature(8 /* RouterFeatureKind.ComponentInputBindingFeature */, providers);\n}\n/**\n * Enables view transitions in the Router by running the route activation and deactivation inside of\n * `document.startViewTransition`.\n *\n * Note: The View Transitions API is not available in all browsers. If the browser does not support\n * view transitions, the Router will not attempt to start a view transition and continue processing\n * the navigation as usual.\n *\n * @usageNotes\n *\n * Basic example of how you can enable the feature:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withViewTransitions())\n * ]\n * }\n * );\n * ```\n *\n * @returns A set of providers for use with `provideRouter`.\n * @see https://developer.chrome.com/docs/web-platform/view-transitions/\n * @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API\n * @experimental\n */\nfunction withViewTransitions(options) {\n const providers = [{\n provide: CREATE_VIEW_TRANSITION,\n useValue: createViewTransition\n }, {\n provide: VIEW_TRANSITION_OPTIONS,\n useValue: {\n skipNextTransition: !!options?.skipInitialTransition,\n ...options\n }\n }];\n return routerFeature(9 /* RouterFeatureKind.ViewTransitionsFeature */, providers);\n}\n\n/**\n * The directives defined in the `RouterModule`.\n */\nconst ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent];\n/**\n * @docsNotRequired\n */\nconst ROUTER_FORROOT_GUARD = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');\n// TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept\n// here to avoid a breaking change whereby the provider order matters based on where the\n// `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a \"breaking\"\n// change in a major version.\nconst ROUTER_PROVIDERS = [Location, {\n provide: UrlSerializer,\n useClass: DefaultUrlSerializer\n}, Router, ChildrenOutletContexts, {\n provide: ActivatedRoute,\n useFactory: rootRoute,\n deps: [Router]\n}, RouterConfigLoader,\n// Only used to warn when `provideRoutes` is used without `RouterModule` or `provideRouter`. Can\n// be removed when `provideRoutes` is removed.\ntypeof ngDevMode === 'undefined' || ngDevMode ? {\n provide: ROUTER_IS_PROVIDED,\n useValue: true\n} : []];\n/**\n * @description\n *\n * Adds directives and providers for in-app navigation among views defined in an application.\n * Use the Angular `Router` service to declaratively specify application states and manage state\n * transitions.\n *\n * You can import this NgModule multiple times, once for each lazy-loaded bundle.\n * However, only one `Router` service can be active.\n * To ensure this, there are two ways to register routes when importing this module:\n *\n * * The `forRoot()` method creates an `NgModule` that contains all the directives, the given\n * routes, and the `Router` service itself.\n * * The `forChild()` method creates an `NgModule` that contains all the directives and the given\n * routes, but does not include the `Router` service.\n *\n * @see [Routing and Navigation guide](guide/router) for an\n * overview of how the `Router` service should be used.\n *\n * @publicApi\n */\nlet RouterModule = /*#__PURE__*/(() => {\n class RouterModule {\n constructor(guard) {}\n /**\n * Creates and configures a module with all the router providers and directives.\n * Optionally sets up an application listener to perform an initial navigation.\n *\n * When registering the NgModule at the root, import as follows:\n *\n * ```\n * @NgModule({\n * imports: [RouterModule.forRoot(ROUTES)]\n * })\n * class MyNgModule {}\n * ```\n *\n * @param routes An array of `Route` objects that define the navigation paths for the application.\n * @param config An `ExtraOptions` configuration object that controls how navigation is performed.\n * @return The new `NgModule`.\n *\n */\n static forRoot(routes, config) {\n return {\n ngModule: RouterModule,\n providers: [ROUTER_PROVIDERS, typeof ngDevMode === 'undefined' || ngDevMode ? config?.enableTracing ? withDebugTracing().ɵproviders : [] : [], {\n provide: ROUTES,\n multi: true,\n useValue: routes\n }, {\n provide: ROUTER_FORROOT_GUARD,\n useFactory: provideForRootGuard,\n deps: [[Router, new Optional(), new SkipSelf()]]\n }, {\n provide: ROUTER_CONFIGURATION,\n useValue: config ? config : {}\n }, config?.useHash ? provideHashLocationStrategy() : providePathLocationStrategy(), provideRouterScroller(), config?.preloadingStrategy ? withPreloading(config.preloadingStrategy).ɵproviders : [], config?.initialNavigation ? provideInitialNavigation(config) : [], config?.bindToComponentInputs ? withComponentInputBinding().ɵproviders : [], config?.enableViewTransitions ? withViewTransitions().ɵproviders : [], provideRouterInitializer()]\n };\n }\n /**\n * Creates a module with all the router directives and a provider registering routes,\n * without creating a new Router service.\n * When registering for submodules and lazy-loaded submodules, create the NgModule as follows:\n *\n * ```\n * @NgModule({\n * imports: [RouterModule.forChild(ROUTES)]\n * })\n * class MyNgModule {}\n * ```\n *\n * @param routes An array of `Route` objects that define the navigation paths for the submodule.\n * @return The new NgModule.\n *\n */\n static forChild(routes) {\n return {\n ngModule: RouterModule,\n providers: [{\n provide: ROUTES,\n multi: true,\n useValue: routes\n }]\n };\n }\n static {\n this.ɵfac = function RouterModule_Factory(t) {\n return new (t || RouterModule)(i0.ɵɵinject(ROUTER_FORROOT_GUARD, 8));\n };\n }\n static {\n this.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: RouterModule\n });\n }\n static {\n this.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n }\n }\n return RouterModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * For internal use by `RouterModule` only. Note that this differs from `withInMemoryRouterScroller`\n * because it reads from the `ExtraOptions` which should not be used in the standalone world.\n */\nfunction provideRouterScroller() {\n return {\n provide: ROUTER_SCROLLER,\n useFactory: () => {\n const viewportScroller = inject(ViewportScroller);\n const zone = inject(NgZone);\n const config = inject(ROUTER_CONFIGURATION);\n const transitions = inject(NavigationTransitions);\n const urlSerializer = inject(UrlSerializer);\n if (config.scrollOffset) {\n viewportScroller.setOffset(config.scrollOffset);\n }\n return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, config);\n }\n };\n}\n// Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` should\n// provide hash location directly via `{provide: LocationStrategy, useClass: HashLocationStrategy}`.\nfunction provideHashLocationStrategy() {\n return {\n provide: LocationStrategy,\n useClass: HashLocationStrategy\n };\n}\n// Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` does not\n// need this at all because `PathLocationStrategy` is the default factory for `LocationStrategy`.\nfunction providePathLocationStrategy() {\n return {\n provide: LocationStrategy,\n useClass: PathLocationStrategy\n };\n}\nfunction provideForRootGuard(router) {\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && router) {\n throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `The Router was provided more than once. This can happen if 'forRoot' is used outside of the root injector.` + ` Lazy loaded modules should use RouterModule.forChild() instead.`);\n }\n return 'guarded';\n}\n// Note: For internal use only with `RouterModule`. Standalone router setup with `provideRouter`\n// users call `withXInitialNavigation` directly.\nfunction provideInitialNavigation(config) {\n return [config.initialNavigation === 'disabled' ? withDisabledInitialNavigation().ɵproviders : [], config.initialNavigation === 'enabledBlocking' ? withEnabledBlockingInitialNavigation().ɵproviders : []];\n}\n// TODO(atscott): This should not be in the public API\n/**\n * A [DI token](guide/glossary/#di-token) for the router initializer that\n * is called after the app is bootstrapped.\n *\n * @publicApi\n */\nconst ROUTER_INITIALIZER = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'Router Initializer' : '');\nfunction provideRouterInitializer() {\n return [\n // ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just\n // have `getBootstrapListener` directly attached to APP_BOOTSTRAP_LISTENER.\n {\n provide: ROUTER_INITIALIZER,\n useFactory: getBootstrapListener\n }, {\n provide: APP_BOOTSTRAP_LISTENER,\n multi: true,\n useExisting: ROUTER_INITIALIZER\n }];\n}\n\n/**\n * Maps an array of injectable classes with canMatch functions to an array of equivalent\n * `CanMatchFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nfunction mapToCanMatch(providers) {\n return providers.map(provider => (...params) => inject(provider).canMatch(...params));\n}\n/**\n * Maps an array of injectable classes with canActivate functions to an array of equivalent\n * `CanActivateFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nfunction mapToCanActivate(providers) {\n return providers.map(provider => (...params) => inject(provider).canActivate(...params));\n}\n/**\n * Maps an array of injectable classes with canActivateChild functions to an array of equivalent\n * `CanActivateChildFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nfunction mapToCanActivateChild(providers) {\n return providers.map(provider => (...params) => inject(provider).canActivateChild(...params));\n}\n/**\n * Maps an array of injectable classes with canDeactivate functions to an array of equivalent\n * `CanDeactivateFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nfunction mapToCanDeactivate(providers) {\n return providers.map(provider => (...params) => inject(provider).canDeactivate(...params));\n}\n/**\n * Maps an injectable class with a resolve function to an equivalent `ResolveFn`\n * for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='Resolve'}\n *\n * @publicApi\n * @see {@link Route}\n */\nfunction mapToResolve(provider) {\n return (...params) => inject(provider).resolve(...params);\n}\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of the router package.\n */\n/**\n * @publicApi\n */\nconst VERSION = /*#__PURE__*/new Version('17.3.4');\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\n// This file only reexports content of the `src` folder. Keep it that way.\n\n// This file is not used to build this module. It is only used during editing\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, EventType, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationError, NavigationSkipped, NavigationSkippedCode, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, mapToCanActivate, mapToCanActivateChild, mapToCanDeactivate, mapToCanMatch, mapToResolve, provideRouter, provideRoutes, withComponentInputBinding, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withHashLocation, withInMemoryScrolling, withNavigationErrorHandler, withPreloading, withRouterConfig, withViewTransitions, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, afterNextNavigation as ɵafterNextNavigation, loadChildren as ɵloadChildren };\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n/** Error thrown when an HTTP request fails. */\nexport class HttpError extends Error {\n /** Constructs a new instance of {@link @microsoft/signalr.HttpError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n * @param {number} statusCode The HTTP status code represented by this error.\r\n */\n constructor(errorMessage, statusCode) {\n const trueProto = new.target.prototype;\n super(`${errorMessage}: Status code '${statusCode}'`);\n this.statusCode = statusCode;\n // Workaround issue in Typescript compiler\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\n this.__proto__ = trueProto;\n }\n}\n/** Error thrown when a timeout elapses. */\nexport class TimeoutError extends Error {\n /** Constructs a new instance of {@link @microsoft/signalr.TimeoutError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n */\n constructor(errorMessage = \"A timeout occurred.\") {\n const trueProto = new.target.prototype;\n super(errorMessage);\n // Workaround issue in Typescript compiler\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\n this.__proto__ = trueProto;\n }\n}\n/** Error thrown when an action is aborted. */\nexport class AbortError extends Error {\n /** Constructs a new instance of {@link AbortError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n */\n constructor(errorMessage = \"An abort occurred.\") {\n const trueProto = new.target.prototype;\n super(errorMessage);\n // Workaround issue in Typescript compiler\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\n this.__proto__ = trueProto;\n }\n}\n/** Error thrown when the selected transport is unsupported by the browser. */\n/** @private */\nexport class UnsupportedTransportError extends Error {\n /** Constructs a new instance of {@link @microsoft/signalr.UnsupportedTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\n constructor(message, transport) {\n const trueProto = new.target.prototype;\n super(message);\n this.transport = transport;\n this.errorType = 'UnsupportedTransportError';\n // Workaround issue in Typescript compiler\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\n this.__proto__ = trueProto;\n }\n}\n/** Error thrown when the selected transport is disabled by the browser. */\n/** @private */\nexport class DisabledTransportError extends Error {\n /** Constructs a new instance of {@link @microsoft/signalr.DisabledTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\n constructor(message, transport) {\n const trueProto = new.target.prototype;\n super(message);\n this.transport = transport;\n this.errorType = 'DisabledTransportError';\n // Workaround issue in Typescript compiler\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\n this.__proto__ = trueProto;\n }\n}\n/** Error thrown when the selected transport cannot be started. */\n/** @private */\nexport class FailedToStartTransportError extends Error {\n /** Constructs a new instance of {@link @microsoft/signalr.FailedToStartTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\n constructor(message, transport) {\n const trueProto = new.target.prototype;\n super(message);\n this.transport = transport;\n this.errorType = 'FailedToStartTransportError';\n // Workaround issue in Typescript compiler\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\n this.__proto__ = trueProto;\n }\n}\n/** Error thrown when the negotiation with the server failed to complete. */\n/** @private */\nexport class FailedToNegotiateWithServerError extends Error {\n /** Constructs a new instance of {@link @microsoft/signalr.FailedToNegotiateWithServerError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n */\n constructor(message) {\n const trueProto = new.target.prototype;\n super(message);\n this.errorType = 'FailedToNegotiateWithServerError';\n // Workaround issue in Typescript compiler\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\n this.__proto__ = trueProto;\n }\n}\n/** Error thrown when multiple errors have occurred. */\n/** @private */\nexport class AggregateErrors extends Error {\n /** Constructs a new instance of {@link @microsoft/signalr.AggregateErrors}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {Error[]} innerErrors The collection of errors this error is aggregating.\r\n */\n constructor(message, innerErrors) {\n const trueProto = new.target.prototype;\n super(message);\n this.innerErrors = innerErrors;\n // Workaround issue in Typescript compiler\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\n this.__proto__ = trueProto;\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n/** Represents an HTTP response. */\nexport class HttpResponse {\n constructor(statusCode, statusText, content) {\n this.statusCode = statusCode;\n this.statusText = statusText;\n this.content = content;\n }\n}\n/** Abstraction over an HTTP client.\r\n *\r\n * This class provides an abstraction over an HTTP client so that a different implementation can be provided on different platforms.\r\n */\nexport class HttpClient {\n get(url, options) {\n return this.send({\n ...options,\n method: \"GET\",\n url\n });\n }\n post(url, options) {\n return this.send({\n ...options,\n method: \"POST\",\n url\n });\n }\n delete(url, options) {\n return this.send({\n ...options,\n method: \"DELETE\",\n url\n });\n }\n /** Gets all cookies that apply to the specified URL.\r\n *\r\n * @param url The URL that the cookies are valid for.\r\n * @returns {string} A string containing all the key-value cookie pairs for the specified URL.\r\n */\n // @ts-ignore\n getCookieString(url) {\n return \"\";\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here.\n/** Indicates the severity of a log message.\r\n *\r\n * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.\r\n */\nexport var LogLevel = /*#__PURE__*/function (LogLevel) {\n /** Log level for very low severity diagnostic messages. */\n LogLevel[LogLevel[\"Trace\"] = 0] = \"Trace\";\n /** Log level for low severity diagnostic messages. */\n LogLevel[LogLevel[\"Debug\"] = 1] = \"Debug\";\n /** Log level for informational diagnostic messages. */\n LogLevel[LogLevel[\"Information\"] = 2] = \"Information\";\n /** Log level for diagnostic messages that indicate a non-fatal problem. */\n LogLevel[LogLevel[\"Warning\"] = 3] = \"Warning\";\n /** Log level for diagnostic messages that indicate a failure in the current operation. */\n LogLevel[LogLevel[\"Error\"] = 4] = \"Error\";\n /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */\n LogLevel[LogLevel[\"Critical\"] = 5] = \"Critical\";\n /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */\n LogLevel[LogLevel[\"None\"] = 6] = \"None\";\n return LogLevel;\n}(LogLevel || {});\n\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n/** A logger that does nothing when log messages are sent to it. */\nexport class NullLogger {\n constructor() {}\n /** @inheritDoc */\n // eslint-disable-next-line\n log(_logLevel, _message) {}\n}\n/** The singleton instance of the {@link @microsoft/signalr.NullLogger}. */\nNullLogger.instance = new NullLogger();\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { LogLevel } from \"./ILogger\";\nimport { NullLogger } from \"./Loggers\";\n// Version token that will be replaced by the prepack command\n/** The version of the SignalR client. */\nexport const VERSION = \"7.0.14\";\n/** @private */\nexport class Arg {\n static isRequired(val, name) {\n if (val === null || val === undefined) {\n throw new Error(`The '${name}' argument is required.`);\n }\n }\n static isNotEmpty(val, name) {\n if (!val || val.match(/^\\s*$/)) {\n throw new Error(`The '${name}' argument should not be empty.`);\n }\n }\n static isIn(val, values, name) {\n // TypeScript enums have keys for **both** the name and the value of each enum member on the type itself.\n if (!(val in values)) {\n throw new Error(`Unknown ${name} value: ${val}.`);\n }\n }\n}\n/** @private */\nexport class Platform {\n // react-native has a window but no document so we should check both\n static get isBrowser() {\n return typeof window === \"object\" && typeof window.document === \"object\";\n }\n // WebWorkers don't have a window object so the isBrowser check would fail\n static get isWebWorker() {\n return typeof self === \"object\" && \"importScripts\" in self;\n }\n // react-native has a window but no document\n static get isReactNative() {\n return typeof window === \"object\" && typeof window.document === \"undefined\";\n }\n // Node apps shouldn't have a window object, but WebWorkers don't either\n // so we need to check for both WebWorker and window\n static get isNode() {\n return !this.isBrowser && !this.isWebWorker && !this.isReactNative;\n }\n}\n/** @private */\nexport function getDataDetail(data, includeContent) {\n let detail = \"\";\n if (isArrayBuffer(data)) {\n detail = `Binary data of length ${data.byteLength}`;\n if (includeContent) {\n detail += `. Content: '${formatArrayBuffer(data)}'`;\n }\n } else if (typeof data === \"string\") {\n detail = `String data of length ${data.length}`;\n if (includeContent) {\n detail += `. Content: '${data}'`;\n }\n }\n return detail;\n}\n/** @private */\nexport function formatArrayBuffer(data) {\n const view = new Uint8Array(data);\n // Uint8Array.map only supports returning another Uint8Array?\n let str = \"\";\n view.forEach(num => {\n const pad = num < 16 ? \"0\" : \"\";\n str += `0x${pad}${num.toString(16)} `;\n });\n // Trim of trailing space.\n return str.substr(0, str.length - 1);\n}\n// Also in signalr-protocol-msgpack/Utils.ts\n/** @private */\nexport function isArrayBuffer(val) {\n return val && typeof ArrayBuffer !== \"undefined\" && (val instanceof ArrayBuffer ||\n // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof\n val.constructor && val.constructor.name === \"ArrayBuffer\");\n}\n/** @private */\nexport async function sendMessage(logger, transportName, httpClient, url, content, options) {\n const headers = {};\n const [name, value] = getUserAgentHeader();\n headers[name] = value;\n logger.log(LogLevel.Trace, `(${transportName} transport) sending data. ${getDataDetail(content, options.logMessageContent)}.`);\n const responseType = isArrayBuffer(content) ? \"arraybuffer\" : \"text\";\n const response = await httpClient.post(url, {\n content,\n headers: {\n ...headers,\n ...options.headers\n },\n responseType,\n timeout: options.timeout,\n withCredentials: options.withCredentials\n });\n logger.log(LogLevel.Trace, `(${transportName} transport) request complete. Response status: ${response.statusCode}.`);\n}\n/** @private */\nexport function createLogger(logger) {\n if (logger === undefined) {\n return new ConsoleLogger(LogLevel.Information);\n }\n if (logger === null) {\n return NullLogger.instance;\n }\n if (logger.log !== undefined) {\n return logger;\n }\n return new ConsoleLogger(logger);\n}\n/** @private */\nexport class SubjectSubscription {\n constructor(subject, observer) {\n this._subject = subject;\n this._observer = observer;\n }\n dispose() {\n const index = this._subject.observers.indexOf(this._observer);\n if (index > -1) {\n this._subject.observers.splice(index, 1);\n }\n if (this._subject.observers.length === 0 && this._subject.cancelCallback) {\n this._subject.cancelCallback().catch(_ => {});\n }\n }\n}\n/** @private */\nexport class ConsoleLogger {\n constructor(minimumLogLevel) {\n this._minLevel = minimumLogLevel;\n this.out = console;\n }\n log(logLevel, message) {\n if (logLevel >= this._minLevel) {\n const msg = `[${new Date().toISOString()}] ${LogLevel[logLevel]}: ${message}`;\n switch (logLevel) {\n case LogLevel.Critical:\n case LogLevel.Error:\n this.out.error(msg);\n break;\n case LogLevel.Warning:\n this.out.warn(msg);\n break;\n case LogLevel.Information:\n this.out.info(msg);\n break;\n default:\n // console.debug only goes to attached debuggers in Node, so we use console.log for Trace and Debug\n this.out.log(msg);\n break;\n }\n }\n }\n}\n/** @private */\nexport function getUserAgentHeader() {\n let userAgentHeaderName = \"X-SignalR-User-Agent\";\n if (Platform.isNode) {\n userAgentHeaderName = \"User-Agent\";\n }\n return [userAgentHeaderName, constructUserAgent(VERSION, getOsName(), getRuntime(), getRuntimeVersion())];\n}\n/** @private */\nexport function constructUserAgent(version, os, runtime, runtimeVersion) {\n // Microsoft SignalR/[Version] ([Detailed Version]; [Operating System]; [Runtime]; [Runtime Version])\n let userAgent = \"Microsoft SignalR/\";\n const majorAndMinor = version.split(\".\");\n userAgent += `${majorAndMinor[0]}.${majorAndMinor[1]}`;\n userAgent += ` (${version}; `;\n if (os && os !== \"\") {\n userAgent += `${os}; `;\n } else {\n userAgent += \"Unknown OS; \";\n }\n userAgent += `${runtime}`;\n if (runtimeVersion) {\n userAgent += `; ${runtimeVersion}`;\n } else {\n userAgent += \"; Unknown Runtime Version\";\n }\n userAgent += \")\";\n return userAgent;\n}\n// eslint-disable-next-line spaced-comment\n/*#__PURE__*/\nfunction getOsName() {\n if (Platform.isNode) {\n switch (process.platform) {\n case \"win32\":\n return \"Windows NT\";\n case \"darwin\":\n return \"macOS\";\n case \"linux\":\n return \"Linux\";\n default:\n return process.platform;\n }\n } else {\n return \"\";\n }\n}\n// eslint-disable-next-line spaced-comment\n/*#__PURE__*/\nfunction getRuntimeVersion() {\n if (Platform.isNode) {\n return process.versions.node;\n }\n return undefined;\n}\nfunction getRuntime() {\n if (Platform.isNode) {\n return \"NodeJS\";\n } else {\n return \"Browser\";\n }\n}\n/** @private */\nexport function getErrorString(e) {\n if (e.stack) {\n return e.stack;\n } else if (e.message) {\n return e.message;\n }\n return `${e}`;\n}\n/** @private */\nexport function getGlobalThis() {\n // globalThis is semi-new and not available in Node until v12\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof global !== \"undefined\") {\n return global;\n }\n throw new Error(\"could not find global\");\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { AbortError, HttpError, TimeoutError } from \"./Errors\";\nimport { HttpClient, HttpResponse } from \"./HttpClient\";\nimport { LogLevel } from \"./ILogger\";\nimport { Platform, getGlobalThis, isArrayBuffer } from \"./Utils\";\nexport class FetchHttpClient extends HttpClient {\n constructor(logger) {\n super();\n this._logger = logger;\n if (typeof fetch === \"undefined\") {\n // In order to ignore the dynamic require in webpack builds we need to do this magic\n // @ts-ignore: TS doesn't know about these names\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\n // Cookies aren't automatically handled in Node so we need to add a CookieJar to preserve cookies across requests\n this._jar = new (requireFunc(\"tough-cookie\").CookieJar)();\n this._fetchType = requireFunc(\"node-fetch\");\n // node-fetch doesn't have a nice API for getting and setting cookies\n // fetch-cookie will wrap a fetch implementation with a default CookieJar or a provided one\n this._fetchType = requireFunc(\"fetch-cookie\")(this._fetchType, this._jar);\n } else {\n this._fetchType = fetch.bind(getGlobalThis());\n }\n if (typeof AbortController === \"undefined\") {\n // In order to ignore the dynamic require in webpack builds we need to do this magic\n // @ts-ignore: TS doesn't know about these names\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\n // Node needs EventListener methods on AbortController which our custom polyfill doesn't provide\n this._abortControllerType = requireFunc(\"abort-controller\");\n } else {\n this._abortControllerType = AbortController;\n }\n }\n /** @inheritDoc */\n async send(request) {\n // Check that abort was not signaled before calling send\n if (request.abortSignal && request.abortSignal.aborted) {\n throw new AbortError();\n }\n if (!request.method) {\n throw new Error(\"No method defined.\");\n }\n if (!request.url) {\n throw new Error(\"No url defined.\");\n }\n const abortController = new this._abortControllerType();\n let error;\n // Hook our abortSignal into the abort controller\n if (request.abortSignal) {\n request.abortSignal.onabort = () => {\n abortController.abort();\n error = new AbortError();\n };\n }\n // If a timeout has been passed in, setup a timeout to call abort\n // Type needs to be any to fit window.setTimeout and NodeJS.setTimeout\n let timeoutId = null;\n if (request.timeout) {\n const msTimeout = request.timeout;\n timeoutId = setTimeout(() => {\n abortController.abort();\n this._logger.log(LogLevel.Warning, `Timeout from HTTP request.`);\n error = new TimeoutError();\n }, msTimeout);\n }\n if (request.content === \"\") {\n request.content = undefined;\n }\n if (request.content) {\n // Explicitly setting the Content-Type header for React Native on Android platform.\n request.headers = request.headers || {};\n if (isArrayBuffer(request.content)) {\n request.headers[\"Content-Type\"] = \"application/octet-stream\";\n } else {\n request.headers[\"Content-Type\"] = \"text/plain;charset=UTF-8\";\n }\n }\n let response;\n try {\n response = await this._fetchType(request.url, {\n body: request.content,\n cache: \"no-cache\",\n credentials: request.withCredentials === true ? \"include\" : \"same-origin\",\n headers: {\n \"X-Requested-With\": \"XMLHttpRequest\",\n ...request.headers\n },\n method: request.method,\n mode: \"cors\",\n redirect: \"follow\",\n signal: abortController.signal\n });\n } catch (e) {\n if (error) {\n throw error;\n }\n this._logger.log(LogLevel.Warning, `Error from HTTP request. ${e}.`);\n throw e;\n } finally {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (request.abortSignal) {\n request.abortSignal.onabort = null;\n }\n }\n if (!response.ok) {\n const errorMessage = await deserializeContent(response, \"text\");\n throw new HttpError(errorMessage || response.statusText, response.status);\n }\n const content = deserializeContent(response, request.responseType);\n const payload = await content;\n return new HttpResponse(response.status, response.statusText, payload);\n }\n getCookieString(url) {\n let cookies = \"\";\n if (Platform.isNode && this._jar) {\n // @ts-ignore: unused variable\n this._jar.getCookies(url, (e, c) => cookies = c.join(\"; \"));\n }\n return cookies;\n }\n}\nfunction deserializeContent(response, responseType) {\n let content;\n switch (responseType) {\n case \"arraybuffer\":\n content = response.arrayBuffer();\n break;\n case \"text\":\n content = response.text();\n break;\n case \"blob\":\n case \"document\":\n case \"json\":\n throw new Error(`${responseType} is not supported.`);\n default:\n content = response.text();\n break;\n }\n return content;\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { AbortError, HttpError, TimeoutError } from \"./Errors\";\nimport { HttpClient, HttpResponse } from \"./HttpClient\";\nimport { LogLevel } from \"./ILogger\";\nimport { isArrayBuffer } from \"./Utils\";\nexport class XhrHttpClient extends HttpClient {\n constructor(logger) {\n super();\n this._logger = logger;\n }\n /** @inheritDoc */\n send(request) {\n // Check that abort was not signaled before calling send\n if (request.abortSignal && request.abortSignal.aborted) {\n return Promise.reject(new AbortError());\n }\n if (!request.method) {\n return Promise.reject(new Error(\"No method defined.\"));\n }\n if (!request.url) {\n return Promise.reject(new Error(\"No url defined.\"));\n }\n return new Promise((resolve, reject) => {\n const xhr = new XMLHttpRequest();\n xhr.open(request.method, request.url, true);\n xhr.withCredentials = request.withCredentials === undefined ? true : request.withCredentials;\n xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n if (request.content === \"\") {\n request.content = undefined;\n }\n if (request.content) {\n // Explicitly setting the Content-Type header for React Native on Android platform.\n if (isArrayBuffer(request.content)) {\n xhr.setRequestHeader(\"Content-Type\", \"application/octet-stream\");\n } else {\n xhr.setRequestHeader(\"Content-Type\", \"text/plain;charset=UTF-8\");\n }\n }\n const headers = request.headers;\n if (headers) {\n Object.keys(headers).forEach(header => {\n xhr.setRequestHeader(header, headers[header]);\n });\n }\n if (request.responseType) {\n xhr.responseType = request.responseType;\n }\n if (request.abortSignal) {\n request.abortSignal.onabort = () => {\n xhr.abort();\n reject(new AbortError());\n };\n }\n if (request.timeout) {\n xhr.timeout = request.timeout;\n }\n xhr.onload = () => {\n if (request.abortSignal) {\n request.abortSignal.onabort = null;\n }\n if (xhr.status >= 200 && xhr.status < 300) {\n resolve(new HttpResponse(xhr.status, xhr.statusText, xhr.response || xhr.responseText));\n } else {\n reject(new HttpError(xhr.response || xhr.responseText || xhr.statusText, xhr.status));\n }\n };\n xhr.onerror = () => {\n this._logger.log(LogLevel.Warning, `Error from HTTP request. ${xhr.status}: ${xhr.statusText}.`);\n reject(new HttpError(xhr.statusText, xhr.status));\n };\n xhr.ontimeout = () => {\n this._logger.log(LogLevel.Warning, `Timeout from HTTP request.`);\n reject(new TimeoutError());\n };\n xhr.send(request.content);\n });\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { AbortError } from \"./Errors\";\nimport { FetchHttpClient } from \"./FetchHttpClient\";\nimport { HttpClient } from \"./HttpClient\";\nimport { Platform } from \"./Utils\";\nimport { XhrHttpClient } from \"./XhrHttpClient\";\n/** Default implementation of {@link @microsoft/signalr.HttpClient}. */\nexport class DefaultHttpClient extends HttpClient {\n /** Creates a new instance of the {@link @microsoft/signalr.DefaultHttpClient}, using the provided {@link @microsoft/signalr.ILogger} to log messages. */\n constructor(logger) {\n super();\n if (typeof fetch !== \"undefined\" || Platform.isNode) {\n this._httpClient = new FetchHttpClient(logger);\n } else if (typeof XMLHttpRequest !== \"undefined\") {\n this._httpClient = new XhrHttpClient(logger);\n } else {\n throw new Error(\"No usable HttpClient found.\");\n }\n }\n /** @inheritDoc */\n send(request) {\n // Check that abort was not signaled before calling send\n if (request.abortSignal && request.abortSignal.aborted) {\n return Promise.reject(new AbortError());\n }\n if (!request.method) {\n return Promise.reject(new Error(\"No method defined.\"));\n }\n if (!request.url) {\n return Promise.reject(new Error(\"No url defined.\"));\n }\n return this._httpClient.send(request);\n }\n getCookieString(url) {\n return this._httpClient.getCookieString(url);\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// Not exported from index\n/** @private */\nexport class TextMessageFormat {\n static write(output) {\n return `${output}${TextMessageFormat.RecordSeparator}`;\n }\n static parse(input) {\n if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) {\n throw new Error(\"Message is incomplete.\");\n }\n const messages = input.split(TextMessageFormat.RecordSeparator);\n messages.pop();\n return messages;\n }\n}\nTextMessageFormat.RecordSeparatorCode = 0x1e;\nTextMessageFormat.RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { TextMessageFormat } from \"./TextMessageFormat\";\nimport { isArrayBuffer } from \"./Utils\";\n/** @private */\nexport class HandshakeProtocol {\n // Handshake request is always JSON\n writeHandshakeRequest(handshakeRequest) {\n return TextMessageFormat.write(JSON.stringify(handshakeRequest));\n }\n parseHandshakeResponse(data) {\n let messageData;\n let remainingData;\n if (isArrayBuffer(data)) {\n // Format is binary but still need to read JSON text from handshake response\n const binaryData = new Uint8Array(data);\n const separatorIndex = binaryData.indexOf(TextMessageFormat.RecordSeparatorCode);\n if (separatorIndex === -1) {\n throw new Error(\"Message is incomplete.\");\n }\n // content before separator is handshake response\n // optional content after is additional messages\n const responseLength = separatorIndex + 1;\n messageData = String.fromCharCode.apply(null, Array.prototype.slice.call(binaryData.slice(0, responseLength)));\n remainingData = binaryData.byteLength > responseLength ? binaryData.slice(responseLength).buffer : null;\n } else {\n const textData = data;\n const separatorIndex = textData.indexOf(TextMessageFormat.RecordSeparator);\n if (separatorIndex === -1) {\n throw new Error(\"Message is incomplete.\");\n }\n // content before separator is handshake response\n // optional content after is additional messages\n const responseLength = separatorIndex + 1;\n messageData = textData.substring(0, responseLength);\n remainingData = textData.length > responseLength ? textData.substring(responseLength) : null;\n }\n // At this point we should have just the single handshake message\n const messages = TextMessageFormat.parse(messageData);\n const response = JSON.parse(messages[0]);\n if (response.type) {\n throw new Error(\"Expected a handshake response from the server.\");\n }\n const responseMessage = response;\n // multiple messages could have arrived with handshake\n // return additional data to be parsed as usual, or null if all parsed\n return [remainingData, responseMessage];\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n/** Defines the type of a Hub Message. */\nexport var MessageType = /*#__PURE__*/function (MessageType) {\n /** Indicates the message is an Invocation message and implements the {@link @microsoft/signalr.InvocationMessage} interface. */\n MessageType[MessageType[\"Invocation\"] = 1] = \"Invocation\";\n /** Indicates the message is a StreamItem message and implements the {@link @microsoft/signalr.StreamItemMessage} interface. */\n MessageType[MessageType[\"StreamItem\"] = 2] = \"StreamItem\";\n /** Indicates the message is a Completion message and implements the {@link @microsoft/signalr.CompletionMessage} interface. */\n MessageType[MessageType[\"Completion\"] = 3] = \"Completion\";\n /** Indicates the message is a Stream Invocation message and implements the {@link @microsoft/signalr.StreamInvocationMessage} interface. */\n MessageType[MessageType[\"StreamInvocation\"] = 4] = \"StreamInvocation\";\n /** Indicates the message is a Cancel Invocation message and implements the {@link @microsoft/signalr.CancelInvocationMessage} interface. */\n MessageType[MessageType[\"CancelInvocation\"] = 5] = \"CancelInvocation\";\n /** Indicates the message is a Ping message and implements the {@link @microsoft/signalr.PingMessage} interface. */\n MessageType[MessageType[\"Ping\"] = 6] = \"Ping\";\n /** Indicates the message is a Close message and implements the {@link @microsoft/signalr.CloseMessage} interface. */\n MessageType[MessageType[\"Close\"] = 7] = \"Close\";\n return MessageType;\n}(MessageType || {});\n\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { SubjectSubscription } from \"./Utils\";\n/** Stream implementation to stream items to the server. */\nexport class Subject {\n constructor() {\n this.observers = [];\n }\n next(item) {\n for (const observer of this.observers) {\n observer.next(item);\n }\n }\n error(err) {\n for (const observer of this.observers) {\n if (observer.error) {\n observer.error(err);\n }\n }\n }\n complete() {\n for (const observer of this.observers) {\n if (observer.complete) {\n observer.complete();\n }\n }\n }\n subscribe(observer) {\n this.observers.push(observer);\n return new SubjectSubscription(this, observer);\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { HandshakeProtocol } from \"./HandshakeProtocol\";\nimport { AbortError } from \"./Errors\";\nimport { MessageType } from \"./IHubProtocol\";\nimport { LogLevel } from \"./ILogger\";\nimport { Subject } from \"./Subject\";\nimport { Arg, getErrorString, Platform } from \"./Utils\";\nconst DEFAULT_TIMEOUT_IN_MS = 30 * 1000;\nconst DEFAULT_PING_INTERVAL_IN_MS = 15 * 1000;\n/** Describes the current state of the {@link HubConnection} to the server. */\nexport var HubConnectionState = /*#__PURE__*/function (HubConnectionState) {\n /** The hub connection is disconnected. */\n HubConnectionState[\"Disconnected\"] = \"Disconnected\";\n /** The hub connection is connecting. */\n HubConnectionState[\"Connecting\"] = \"Connecting\";\n /** The hub connection is connected. */\n HubConnectionState[\"Connected\"] = \"Connected\";\n /** The hub connection is disconnecting. */\n HubConnectionState[\"Disconnecting\"] = \"Disconnecting\";\n /** The hub connection is reconnecting. */\n HubConnectionState[\"Reconnecting\"] = \"Reconnecting\";\n return HubConnectionState;\n}(HubConnectionState || {});\n/** Represents a connection to a SignalR Hub. */\nexport class HubConnection {\n constructor(connection, logger, protocol, reconnectPolicy) {\n this._nextKeepAlive = 0;\n this._freezeEventListener = () => {\n this._logger.log(LogLevel.Warning, \"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://docs.microsoft.com/aspnet/core/signalr/javascript-client#bsleep\");\n };\n Arg.isRequired(connection, \"connection\");\n Arg.isRequired(logger, \"logger\");\n Arg.isRequired(protocol, \"protocol\");\n this.serverTimeoutInMilliseconds = DEFAULT_TIMEOUT_IN_MS;\n this.keepAliveIntervalInMilliseconds = DEFAULT_PING_INTERVAL_IN_MS;\n this._logger = logger;\n this._protocol = protocol;\n this.connection = connection;\n this._reconnectPolicy = reconnectPolicy;\n this._handshakeProtocol = new HandshakeProtocol();\n this.connection.onreceive = data => this._processIncomingData(data);\n this.connection.onclose = error => this._connectionClosed(error);\n this._callbacks = {};\n this._methods = {};\n this._closedCallbacks = [];\n this._reconnectingCallbacks = [];\n this._reconnectedCallbacks = [];\n this._invocationId = 0;\n this._receivedHandshakeResponse = false;\n this._connectionState = HubConnectionState.Disconnected;\n this._connectionStarted = false;\n this._cachedPingMessage = this._protocol.writeMessage({\n type: MessageType.Ping\n });\n }\n /** @internal */\n // Using a public static factory method means we can have a private constructor and an _internal_\n // create method that can be used by HubConnectionBuilder. An \"internal\" constructor would just\n // be stripped away and the '.d.ts' file would have no constructor, which is interpreted as a\n // public parameter-less constructor.\n static create(connection, logger, protocol, reconnectPolicy) {\n return new HubConnection(connection, logger, protocol, reconnectPolicy);\n }\n /** Indicates the state of the {@link HubConnection} to the server. */\n get state() {\n return this._connectionState;\n }\n /** Represents the connection id of the {@link HubConnection} on the server. The connection id will be null when the connection is either\r\n * in the disconnected state or if the negotiation step was skipped.\r\n */\n get connectionId() {\n return this.connection ? this.connection.connectionId || null : null;\n }\n /** Indicates the url of the {@link HubConnection} to the server. */\n get baseUrl() {\n return this.connection.baseUrl || \"\";\n }\n /**\r\n * Sets a new url for the HubConnection. Note that the url can only be changed when the connection is in either the Disconnected or\r\n * Reconnecting states.\r\n * @param {string} url The url to connect to.\r\n */\n set baseUrl(url) {\n if (this._connectionState !== HubConnectionState.Disconnected && this._connectionState !== HubConnectionState.Reconnecting) {\n throw new Error(\"The HubConnection must be in the Disconnected or Reconnecting state to change the url.\");\n }\n if (!url) {\n throw new Error(\"The HubConnection url must be a valid url.\");\n }\n this.connection.baseUrl = url;\n }\n /** Starts the connection.\r\n *\r\n * @returns {Promise} A Promise that resolves when the connection has been successfully established, or rejects with an error.\r\n */\n start() {\n this._startPromise = this._startWithStateTransitions();\n return this._startPromise;\n }\n async _startWithStateTransitions() {\n if (this._connectionState !== HubConnectionState.Disconnected) {\n return Promise.reject(new Error(\"Cannot start a HubConnection that is not in the 'Disconnected' state.\"));\n }\n this._connectionState = HubConnectionState.Connecting;\n this._logger.log(LogLevel.Debug, \"Starting HubConnection.\");\n try {\n await this._startInternal();\n if (Platform.isBrowser) {\n // Log when the browser freezes the tab so users know why their connection unexpectedly stopped working\n window.document.addEventListener(\"freeze\", this._freezeEventListener);\n }\n this._connectionState = HubConnectionState.Connected;\n this._connectionStarted = true;\n this._logger.log(LogLevel.Debug, \"HubConnection connected successfully.\");\n } catch (e) {\n this._connectionState = HubConnectionState.Disconnected;\n this._logger.log(LogLevel.Debug, `HubConnection failed to start successfully because of error '${e}'.`);\n return Promise.reject(e);\n }\n }\n async _startInternal() {\n this._stopDuringStartError = undefined;\n this._receivedHandshakeResponse = false;\n // Set up the promise before any connection is (re)started otherwise it could race with received messages\n const handshakePromise = new Promise((resolve, reject) => {\n this._handshakeResolver = resolve;\n this._handshakeRejecter = reject;\n });\n await this.connection.start(this._protocol.transferFormat);\n try {\n const handshakeRequest = {\n protocol: this._protocol.name,\n version: this._protocol.version\n };\n this._logger.log(LogLevel.Debug, \"Sending handshake request.\");\n await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(handshakeRequest));\n this._logger.log(LogLevel.Information, `Using HubProtocol '${this._protocol.name}'.`);\n // defensively cleanup timeout in case we receive a message from the server before we finish start\n this._cleanupTimeout();\n this._resetTimeoutPeriod();\n this._resetKeepAliveInterval();\n await handshakePromise;\n // It's important to check the stopDuringStartError instead of just relying on the handshakePromise\n // being rejected on close, because this continuation can run after both the handshake completed successfully\n // and the connection was closed.\n if (this._stopDuringStartError) {\n // It's important to throw instead of returning a rejected promise, because we don't want to allow any state\n // transitions to occur between now and the calling code observing the exceptions. Returning a rejected promise\n // will cause the calling continuation to get scheduled to run later.\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw this._stopDuringStartError;\n }\n if (!this.connection.features.inherentKeepAlive) {\n await this._sendMessage(this._cachedPingMessage);\n }\n } catch (e) {\n this._logger.log(LogLevel.Debug, `Hub handshake failed with error '${e}' during start(). Stopping HubConnection.`);\n this._cleanupTimeout();\n this._cleanupPingTimer();\n // HttpConnection.stop() should not complete until after the onclose callback is invoked.\n // This will transition the HubConnection to the disconnected state before HttpConnection.stop() completes.\n await this.connection.stop(e);\n throw e;\n }\n }\n /** Stops the connection.\r\n *\r\n * @returns {Promise} A Promise that resolves when the connection has been successfully terminated, or rejects with an error.\r\n */\n async stop() {\n // Capture the start promise before the connection might be restarted in an onclose callback.\n const startPromise = this._startPromise;\n this._stopPromise = this._stopInternal();\n await this._stopPromise;\n try {\n // Awaiting undefined continues immediately\n await startPromise;\n } catch (e) {\n // This exception is returned to the user as a rejected Promise from the start method.\n }\n }\n _stopInternal(error) {\n if (this._connectionState === HubConnectionState.Disconnected) {\n this._logger.log(LogLevel.Debug, `Call to HubConnection.stop(${error}) ignored because it is already in the disconnected state.`);\n return Promise.resolve();\n }\n if (this._connectionState === HubConnectionState.Disconnecting) {\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnecting state.`);\n return this._stopPromise;\n }\n this._connectionState = HubConnectionState.Disconnecting;\n this._logger.log(LogLevel.Debug, \"Stopping HubConnection.\");\n if (this._reconnectDelayHandle) {\n // We're in a reconnect delay which means the underlying connection is currently already stopped.\n // Just clear the handle to stop the reconnect loop (which no one is waiting on thankfully) and\n // fire the onclose callbacks.\n this._logger.log(LogLevel.Debug, \"Connection stopped during reconnect delay. Done reconnecting.\");\n clearTimeout(this._reconnectDelayHandle);\n this._reconnectDelayHandle = undefined;\n this._completeClose();\n return Promise.resolve();\n }\n this._cleanupTimeout();\n this._cleanupPingTimer();\n this._stopDuringStartError = error || new AbortError(\"The connection was stopped before the hub handshake could complete.\");\n // HttpConnection.stop() should not complete until after either HttpConnection.start() fails\n // or the onclose callback is invoked. The onclose callback will transition the HubConnection\n // to the disconnected state if need be before HttpConnection.stop() completes.\n return this.connection.stop(error);\n }\n /** Invokes a streaming hub method on the server using the specified name and arguments.\r\n *\r\n * @typeparam T The type of the items returned by the server.\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {IStreamResult} An object that yields results from the server as they are received.\r\n */\n stream(methodName, ...args) {\n const [streams, streamIds] = this._replaceStreamingParams(args);\n const invocationDescriptor = this._createStreamInvocation(methodName, args, streamIds);\n // eslint-disable-next-line prefer-const\n let promiseQueue;\n const subject = new Subject();\n subject.cancelCallback = () => {\n const cancelInvocation = this._createCancelInvocation(invocationDescriptor.invocationId);\n delete this._callbacks[invocationDescriptor.invocationId];\n return promiseQueue.then(() => {\n return this._sendWithProtocol(cancelInvocation);\n });\n };\n this._callbacks[invocationDescriptor.invocationId] = (invocationEvent, error) => {\n if (error) {\n subject.error(error);\n return;\n } else if (invocationEvent) {\n // invocationEvent will not be null when an error is not passed to the callback\n if (invocationEvent.type === MessageType.Completion) {\n if (invocationEvent.error) {\n subject.error(new Error(invocationEvent.error));\n } else {\n subject.complete();\n }\n } else {\n subject.next(invocationEvent.item);\n }\n }\n };\n promiseQueue = this._sendWithProtocol(invocationDescriptor).catch(e => {\n subject.error(e);\n delete this._callbacks[invocationDescriptor.invocationId];\n });\n this._launchStreams(streams, promiseQueue);\n return subject;\n }\n _sendMessage(message) {\n this._resetKeepAliveInterval();\n return this.connection.send(message);\n }\n /**\r\n * Sends a js object to the server.\r\n * @param message The js object to serialize and send.\r\n */\n _sendWithProtocol(message) {\n return this._sendMessage(this._protocol.writeMessage(message));\n }\n /** Invokes a hub method on the server using the specified name and arguments. Does not wait for a response from the receiver.\r\n *\r\n * The Promise returned by this method resolves when the client has sent the invocation to the server. The server may still\r\n * be processing the invocation.\r\n *\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {Promise} A Promise that resolves when the invocation has been successfully sent, or rejects with an error.\r\n */\n send(methodName, ...args) {\n const [streams, streamIds] = this._replaceStreamingParams(args);\n const sendPromise = this._sendWithProtocol(this._createInvocation(methodName, args, true, streamIds));\n this._launchStreams(streams, sendPromise);\n return sendPromise;\n }\n /** Invokes a hub method on the server using the specified name and arguments.\r\n *\r\n * The Promise returned by this method resolves when the server indicates it has finished invoking the method. When the promise\r\n * resolves, the server has finished invoking the method. If the server method returns a result, it is produced as the result of\r\n * resolving the Promise.\r\n *\r\n * @typeparam T The expected return type.\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {Promise} A Promise that resolves with the result of the server method (if any), or rejects with an error.\r\n */\n invoke(methodName, ...args) {\n const [streams, streamIds] = this._replaceStreamingParams(args);\n const invocationDescriptor = this._createInvocation(methodName, args, false, streamIds);\n const p = new Promise((resolve, reject) => {\n // invocationId will always have a value for a non-blocking invocation\n this._callbacks[invocationDescriptor.invocationId] = (invocationEvent, error) => {\n if (error) {\n reject(error);\n return;\n } else if (invocationEvent) {\n // invocationEvent will not be null when an error is not passed to the callback\n if (invocationEvent.type === MessageType.Completion) {\n if (invocationEvent.error) {\n reject(new Error(invocationEvent.error));\n } else {\n resolve(invocationEvent.result);\n }\n } else {\n reject(new Error(`Unexpected message type: ${invocationEvent.type}`));\n }\n }\n };\n const promiseQueue = this._sendWithProtocol(invocationDescriptor).catch(e => {\n reject(e);\n // invocationId will always have a value for a non-blocking invocation\n delete this._callbacks[invocationDescriptor.invocationId];\n });\n this._launchStreams(streams, promiseQueue);\n });\n return p;\n }\n on(methodName, newMethod) {\n if (!methodName || !newMethod) {\n return;\n }\n methodName = methodName.toLowerCase();\n if (!this._methods[methodName]) {\n this._methods[methodName] = [];\n }\n // Preventing adding the same handler multiple times.\n if (this._methods[methodName].indexOf(newMethod) !== -1) {\n return;\n }\n this._methods[methodName].push(newMethod);\n }\n off(methodName, method) {\n if (!methodName) {\n return;\n }\n methodName = methodName.toLowerCase();\n const handlers = this._methods[methodName];\n if (!handlers) {\n return;\n }\n if (method) {\n const removeIdx = handlers.indexOf(method);\n if (removeIdx !== -1) {\n handlers.splice(removeIdx, 1);\n if (handlers.length === 0) {\n delete this._methods[methodName];\n }\n }\n } else {\n delete this._methods[methodName];\n }\n }\n /** Registers a handler that will be invoked when the connection is closed.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any).\r\n */\n onclose(callback) {\n if (callback) {\n this._closedCallbacks.push(callback);\n }\n }\n /** Registers a handler that will be invoked when the connection starts reconnecting.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection starts reconnecting. Optionally receives a single argument containing the error that caused the connection to start reconnecting (if any).\r\n */\n onreconnecting(callback) {\n if (callback) {\n this._reconnectingCallbacks.push(callback);\n }\n }\n /** Registers a handler that will be invoked when the connection successfully reconnects.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection successfully reconnects.\r\n */\n onreconnected(callback) {\n if (callback) {\n this._reconnectedCallbacks.push(callback);\n }\n }\n _processIncomingData(data) {\n this._cleanupTimeout();\n if (!this._receivedHandshakeResponse) {\n data = this._processHandshakeResponse(data);\n this._receivedHandshakeResponse = true;\n }\n // Data may have all been read when processing handshake response\n if (data) {\n // Parse the messages\n const messages = this._protocol.parseMessages(data, this._logger);\n for (const message of messages) {\n switch (message.type) {\n case MessageType.Invocation:\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._invokeClientMethod(message);\n break;\n case MessageType.StreamItem:\n case MessageType.Completion:\n {\n const callback = this._callbacks[message.invocationId];\n if (callback) {\n if (message.type === MessageType.Completion) {\n delete this._callbacks[message.invocationId];\n }\n try {\n callback(message);\n } catch (e) {\n this._logger.log(LogLevel.Error, `Stream callback threw error: ${getErrorString(e)}`);\n }\n }\n break;\n }\n case MessageType.Ping:\n // Don't care about pings\n break;\n case MessageType.Close:\n {\n this._logger.log(LogLevel.Information, \"Close message received from server.\");\n const error = message.error ? new Error(\"Server returned an error on close: \" + message.error) : undefined;\n if (message.allowReconnect === true) {\n // It feels wrong not to await connection.stop() here, but processIncomingData is called as part of an onreceive callback which is not async,\n // this is already the behavior for serverTimeout(), and HttpConnection.Stop() should catch and log all possible exceptions.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.connection.stop(error);\n } else {\n // We cannot await stopInternal() here, but subsequent calls to stop() will await this if stopInternal() is still ongoing.\n this._stopPromise = this._stopInternal(error);\n }\n break;\n }\n default:\n this._logger.log(LogLevel.Warning, `Invalid message type: ${message.type}.`);\n break;\n }\n }\n }\n this._resetTimeoutPeriod();\n }\n _processHandshakeResponse(data) {\n let responseMessage;\n let remainingData;\n try {\n [remainingData, responseMessage] = this._handshakeProtocol.parseHandshakeResponse(data);\n } catch (e) {\n const message = \"Error parsing handshake response: \" + e;\n this._logger.log(LogLevel.Error, message);\n const error = new Error(message);\n this._handshakeRejecter(error);\n throw error;\n }\n if (responseMessage.error) {\n const message = \"Server returned handshake error: \" + responseMessage.error;\n this._logger.log(LogLevel.Error, message);\n const error = new Error(message);\n this._handshakeRejecter(error);\n throw error;\n } else {\n this._logger.log(LogLevel.Debug, \"Server handshake complete.\");\n }\n this._handshakeResolver();\n return remainingData;\n }\n _resetKeepAliveInterval() {\n if (this.connection.features.inherentKeepAlive) {\n return;\n }\n // Set the time we want the next keep alive to be sent\n // Timer will be setup on next message receive\n this._nextKeepAlive = new Date().getTime() + this.keepAliveIntervalInMilliseconds;\n this._cleanupPingTimer();\n }\n _resetTimeoutPeriod() {\n if (!this.connection.features || !this.connection.features.inherentKeepAlive) {\n // Set the timeout timer\n this._timeoutHandle = setTimeout(() => this.serverTimeout(), this.serverTimeoutInMilliseconds);\n // Set keepAlive timer if there isn't one\n if (this._pingServerHandle === undefined) {\n let nextPing = this._nextKeepAlive - new Date().getTime();\n if (nextPing < 0) {\n nextPing = 0;\n }\n // The timer needs to be set from a networking callback to avoid Chrome timer throttling from causing timers to run once a minute\n this._pingServerHandle = setTimeout(async () => {\n if (this._connectionState === HubConnectionState.Connected) {\n try {\n await this._sendMessage(this._cachedPingMessage);\n } catch {\n // We don't care about the error. It should be seen elsewhere in the client.\n // The connection is probably in a bad or closed state now, cleanup the timer so it stops triggering\n this._cleanupPingTimer();\n }\n }\n }, nextPing);\n }\n }\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n serverTimeout() {\n // The server hasn't talked to us in a while. It doesn't like us anymore ... :(\n // Terminate the connection, but we don't need to wait on the promise. This could trigger reconnecting.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.connection.stop(new Error(\"Server timeout elapsed without receiving a message from the server.\"));\n }\n async _invokeClientMethod(invocationMessage) {\n const methodName = invocationMessage.target.toLowerCase();\n const methods = this._methods[methodName];\n if (!methods) {\n this._logger.log(LogLevel.Warning, `No client method with the name '${methodName}' found.`);\n // No handlers provided by client but the server is expecting a response still, so we send an error\n if (invocationMessage.invocationId) {\n this._logger.log(LogLevel.Warning, `No result given for '${methodName}' method and invocation ID '${invocationMessage.invocationId}'.`);\n await this._sendWithProtocol(this._createCompletionMessage(invocationMessage.invocationId, \"Client didn't provide a result.\", null));\n }\n return;\n }\n // Avoid issues with handlers removing themselves thus modifying the list while iterating through it\n const methodsCopy = methods.slice();\n // Server expects a response\n const expectsResponse = invocationMessage.invocationId ? true : false;\n // We preserve the last result or exception but still call all handlers\n let res;\n let exception;\n let completionMessage;\n for (const m of methodsCopy) {\n try {\n const prevRes = res;\n res = await m.apply(this, invocationMessage.arguments);\n if (expectsResponse && res && prevRes) {\n this._logger.log(LogLevel.Error, `Multiple results provided for '${methodName}'. Sending error to server.`);\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, `Client provided multiple results.`, null);\n }\n // Ignore exception if we got a result after, the exception will be logged\n exception = undefined;\n } catch (e) {\n exception = e;\n this._logger.log(LogLevel.Error, `A callback for the method '${methodName}' threw error '${e}'.`);\n }\n }\n if (completionMessage) {\n await this._sendWithProtocol(completionMessage);\n } else if (expectsResponse) {\n // If there is an exception that means either no result was given or a handler after a result threw\n if (exception) {\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, `${exception}`, null);\n } else if (res !== undefined) {\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, null, res);\n } else {\n this._logger.log(LogLevel.Warning, `No result given for '${methodName}' method and invocation ID '${invocationMessage.invocationId}'.`);\n // Client didn't provide a result or throw from a handler, server expects a response so we send an error\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, \"Client didn't provide a result.\", null);\n }\n await this._sendWithProtocol(completionMessage);\n } else {\n if (res) {\n this._logger.log(LogLevel.Error, `Result given for '${methodName}' method but server is not expecting a result.`);\n }\n }\n }\n _connectionClosed(error) {\n this._logger.log(LogLevel.Debug, `HubConnection.connectionClosed(${error}) called while in state ${this._connectionState}.`);\n // Triggering this.handshakeRejecter is insufficient because it could already be resolved without the continuation having run yet.\n this._stopDuringStartError = this._stopDuringStartError || error || new AbortError(\"The underlying connection was closed before the hub handshake could complete.\");\n // If the handshake is in progress, start will be waiting for the handshake promise, so we complete it.\n // If it has already completed, this should just noop.\n if (this._handshakeResolver) {\n this._handshakeResolver();\n }\n this._cancelCallbacksWithError(error || new Error(\"Invocation canceled due to the underlying connection being closed.\"));\n this._cleanupTimeout();\n this._cleanupPingTimer();\n if (this._connectionState === HubConnectionState.Disconnecting) {\n this._completeClose(error);\n } else if (this._connectionState === HubConnectionState.Connected && this._reconnectPolicy) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._reconnect(error);\n } else if (this._connectionState === HubConnectionState.Connected) {\n this._completeClose(error);\n }\n // If none of the above if conditions were true were called the HubConnection must be in either:\n // 1. The Connecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail it.\n // 2. The Reconnecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail the current reconnect attempt\n // and potentially continue the reconnect() loop.\n // 3. The Disconnected state in which case we're already done.\n }\n _completeClose(error) {\n if (this._connectionStarted) {\n this._connectionState = HubConnectionState.Disconnected;\n this._connectionStarted = false;\n if (Platform.isBrowser) {\n window.document.removeEventListener(\"freeze\", this._freezeEventListener);\n }\n try {\n this._closedCallbacks.forEach(c => c.apply(this, [error]));\n } catch (e) {\n this._logger.log(LogLevel.Error, `An onclose callback called with error '${error}' threw error '${e}'.`);\n }\n }\n }\n async _reconnect(error) {\n const reconnectStartTime = Date.now();\n let previousReconnectAttempts = 0;\n let retryError = error !== undefined ? error : new Error(\"Attempting to reconnect due to a unknown error.\");\n let nextRetryDelay = this._getNextRetryDelay(previousReconnectAttempts++, 0, retryError);\n if (nextRetryDelay === null) {\n this._logger.log(LogLevel.Debug, \"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt.\");\n this._completeClose(error);\n return;\n }\n this._connectionState = HubConnectionState.Reconnecting;\n if (error) {\n this._logger.log(LogLevel.Information, `Connection reconnecting because of error '${error}'.`);\n } else {\n this._logger.log(LogLevel.Information, \"Connection reconnecting.\");\n }\n if (this._reconnectingCallbacks.length !== 0) {\n try {\n this._reconnectingCallbacks.forEach(c => c.apply(this, [error]));\n } catch (e) {\n this._logger.log(LogLevel.Error, `An onreconnecting callback called with error '${error}' threw error '${e}'.`);\n }\n // Exit early if an onreconnecting callback called connection.stop().\n if (this._connectionState !== HubConnectionState.Reconnecting) {\n this._logger.log(LogLevel.Debug, \"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.\");\n return;\n }\n }\n while (nextRetryDelay !== null) {\n this._logger.log(LogLevel.Information, `Reconnect attempt number ${previousReconnectAttempts} will start in ${nextRetryDelay} ms.`);\n await new Promise(resolve => {\n this._reconnectDelayHandle = setTimeout(resolve, nextRetryDelay);\n });\n this._reconnectDelayHandle = undefined;\n if (this._connectionState !== HubConnectionState.Reconnecting) {\n this._logger.log(LogLevel.Debug, \"Connection left the reconnecting state during reconnect delay. Done reconnecting.\");\n return;\n }\n try {\n await this._startInternal();\n this._connectionState = HubConnectionState.Connected;\n this._logger.log(LogLevel.Information, \"HubConnection reconnected successfully.\");\n if (this._reconnectedCallbacks.length !== 0) {\n try {\n this._reconnectedCallbacks.forEach(c => c.apply(this, [this.connection.connectionId]));\n } catch (e) {\n this._logger.log(LogLevel.Error, `An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`);\n }\n }\n return;\n } catch (e) {\n this._logger.log(LogLevel.Information, `Reconnect attempt failed because of error '${e}'.`);\n if (this._connectionState !== HubConnectionState.Reconnecting) {\n this._logger.log(LogLevel.Debug, `Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`);\n // The TypeScript compiler thinks that connectionState must be Connected here. The TypeScript compiler is wrong.\n if (this._connectionState === HubConnectionState.Disconnecting) {\n this._completeClose();\n }\n return;\n }\n retryError = e instanceof Error ? e : new Error(e.toString());\n nextRetryDelay = this._getNextRetryDelay(previousReconnectAttempts++, Date.now() - reconnectStartTime, retryError);\n }\n }\n this._logger.log(LogLevel.Information, `Reconnect retries have been exhausted after ${Date.now() - reconnectStartTime} ms and ${previousReconnectAttempts} failed attempts. Connection disconnecting.`);\n this._completeClose();\n }\n _getNextRetryDelay(previousRetryCount, elapsedMilliseconds, retryReason) {\n try {\n return this._reconnectPolicy.nextRetryDelayInMilliseconds({\n elapsedMilliseconds,\n previousRetryCount,\n retryReason\n });\n } catch (e) {\n this._logger.log(LogLevel.Error, `IRetryPolicy.nextRetryDelayInMilliseconds(${previousRetryCount}, ${elapsedMilliseconds}) threw error '${e}'.`);\n return null;\n }\n }\n _cancelCallbacksWithError(error) {\n const callbacks = this._callbacks;\n this._callbacks = {};\n Object.keys(callbacks).forEach(key => {\n const callback = callbacks[key];\n try {\n callback(null, error);\n } catch (e) {\n this._logger.log(LogLevel.Error, `Stream 'error' callback called with '${error}' threw error: ${getErrorString(e)}`);\n }\n });\n }\n _cleanupPingTimer() {\n if (this._pingServerHandle) {\n clearTimeout(this._pingServerHandle);\n this._pingServerHandle = undefined;\n }\n }\n _cleanupTimeout() {\n if (this._timeoutHandle) {\n clearTimeout(this._timeoutHandle);\n }\n }\n _createInvocation(methodName, args, nonblocking, streamIds) {\n if (nonblocking) {\n if (streamIds.length !== 0) {\n return {\n arguments: args,\n streamIds,\n target: methodName,\n type: MessageType.Invocation\n };\n } else {\n return {\n arguments: args,\n target: methodName,\n type: MessageType.Invocation\n };\n }\n } else {\n const invocationId = this._invocationId;\n this._invocationId++;\n if (streamIds.length !== 0) {\n return {\n arguments: args,\n invocationId: invocationId.toString(),\n streamIds,\n target: methodName,\n type: MessageType.Invocation\n };\n } else {\n return {\n arguments: args,\n invocationId: invocationId.toString(),\n target: methodName,\n type: MessageType.Invocation\n };\n }\n }\n }\n _launchStreams(streams, promiseQueue) {\n if (streams.length === 0) {\n return;\n }\n // Synchronize stream data so they arrive in-order on the server\n if (!promiseQueue) {\n promiseQueue = Promise.resolve();\n }\n // We want to iterate over the keys, since the keys are the stream ids\n // eslint-disable-next-line guard-for-in\n for (const streamId in streams) {\n streams[streamId].subscribe({\n complete: () => {\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createCompletionMessage(streamId)));\n },\n error: err => {\n let message;\n if (err instanceof Error) {\n message = err.message;\n } else if (err && err.toString) {\n message = err.toString();\n } else {\n message = \"Unknown error\";\n }\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createCompletionMessage(streamId, message)));\n },\n next: item => {\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createStreamItemMessage(streamId, item)));\n }\n });\n }\n }\n _replaceStreamingParams(args) {\n const streams = [];\n const streamIds = [];\n for (let i = 0; i < args.length; i++) {\n const argument = args[i];\n if (this._isObservable(argument)) {\n const streamId = this._invocationId;\n this._invocationId++;\n // Store the stream for later use\n streams[streamId] = argument;\n streamIds.push(streamId.toString());\n // remove stream from args\n args.splice(i, 1);\n }\n }\n return [streams, streamIds];\n }\n _isObservable(arg) {\n // This allows other stream implementations to just work (like rxjs)\n return arg && arg.subscribe && typeof arg.subscribe === \"function\";\n }\n _createStreamInvocation(methodName, args, streamIds) {\n const invocationId = this._invocationId;\n this._invocationId++;\n if (streamIds.length !== 0) {\n return {\n arguments: args,\n invocationId: invocationId.toString(),\n streamIds,\n target: methodName,\n type: MessageType.StreamInvocation\n };\n } else {\n return {\n arguments: args,\n invocationId: invocationId.toString(),\n target: methodName,\n type: MessageType.StreamInvocation\n };\n }\n }\n _createCancelInvocation(id) {\n return {\n invocationId: id,\n type: MessageType.CancelInvocation\n };\n }\n _createStreamItemMessage(id, item) {\n return {\n invocationId: id,\n item,\n type: MessageType.StreamItem\n };\n }\n _createCompletionMessage(id, error, result) {\n if (error) {\n return {\n error,\n invocationId: id,\n type: MessageType.Completion\n };\n }\n return {\n invocationId: id,\n result,\n type: MessageType.Completion\n };\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// 0, 2, 10, 30 second delays before reconnect attempts.\nconst DEFAULT_RETRY_DELAYS_IN_MILLISECONDS = [0, 2000, 10000, 30000, null];\n/** @private */\nexport class DefaultReconnectPolicy {\n constructor(retryDelays) {\n this._retryDelays = retryDelays !== undefined ? [...retryDelays, null] : DEFAULT_RETRY_DELAYS_IN_MILLISECONDS;\n }\n nextRetryDelayInMilliseconds(retryContext) {\n return this._retryDelays[retryContext.previousRetryCount];\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nexport abstract class HeaderNames {\r\n static readonly Authorization = \"Authorization\";\r\n static readonly Cookie = \"Cookie\";\r\n}\r\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { HeaderNames } from \"./HeaderNames\";\nimport { HttpClient } from \"./HttpClient\";\n/** @private */\nexport class AccessTokenHttpClient extends HttpClient {\n constructor(innerClient, accessTokenFactory) {\n super();\n this._innerClient = innerClient;\n this._accessTokenFactory = accessTokenFactory;\n }\n async send(request) {\n let allowRetry = true;\n if (this._accessTokenFactory && (!this._accessToken || request.url && request.url.indexOf(\"/negotiate?\") > 0)) {\n // don't retry if the request is a negotiate or if we just got a potentially new token from the access token factory\n allowRetry = false;\n this._accessToken = await this._accessTokenFactory();\n }\n this._setAuthorizationHeader(request);\n const response = await this._innerClient.send(request);\n if (allowRetry && response.statusCode === 401 && this._accessTokenFactory) {\n this._accessToken = await this._accessTokenFactory();\n this._setAuthorizationHeader(request);\n return await this._innerClient.send(request);\n }\n return response;\n }\n _setAuthorizationHeader(request) {\n if (!request.headers) {\n request.headers = {};\n }\n if (this._accessToken) {\n request.headers[HeaderNames.Authorization] = `Bearer ${this._accessToken}`;\n }\n // don't remove the header if there isn't an access token factory, the user manually added the header in this case\n else if (this._accessTokenFactory) {\n if (request.headers[HeaderNames.Authorization]) {\n delete request.headers[HeaderNames.Authorization];\n }\n }\n }\n getCookieString(url) {\n return this._innerClient.getCookieString(url);\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// This will be treated as a bit flag in the future, so we keep it using power-of-two values.\n/** Specifies a specific HTTP transport type. */\nexport var HttpTransportType = /*#__PURE__*/function (HttpTransportType) {\n /** Specifies no transport preference. */\n HttpTransportType[HttpTransportType[\"None\"] = 0] = \"None\";\n /** Specifies the WebSockets transport. */\n HttpTransportType[HttpTransportType[\"WebSockets\"] = 1] = \"WebSockets\";\n /** Specifies the Server-Sent Events transport. */\n HttpTransportType[HttpTransportType[\"ServerSentEvents\"] = 2] = \"ServerSentEvents\";\n /** Specifies the Long Polling transport. */\n HttpTransportType[HttpTransportType[\"LongPolling\"] = 4] = \"LongPolling\";\n return HttpTransportType;\n}(HttpTransportType || {});\n/** Specifies the transfer format for a connection. */\nexport var TransferFormat = /*#__PURE__*/function (TransferFormat) {\n /** Specifies that only text data will be transmitted over the connection. */\n TransferFormat[TransferFormat[\"Text\"] = 1] = \"Text\";\n /** Specifies that binary data will be transmitted over the connection. */\n TransferFormat[TransferFormat[\"Binary\"] = 2] = \"Binary\";\n return TransferFormat;\n}(TransferFormat || {});\n\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController\n// We don't actually ever use the API being polyfilled, we always use the polyfill because\n// it's a very new API right now.\n// Not exported from index.\n/** @private */\nexport class AbortController {\n constructor() {\n this._isAborted = false;\n this.onabort = null;\n }\n abort() {\n if (!this._isAborted) {\n this._isAborted = true;\n if (this.onabort) {\n this.onabort();\n }\n }\n }\n get signal() {\n return this;\n }\n get aborted() {\n return this._isAborted;\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { AbortController } from \"./AbortController\";\nimport { HttpError, TimeoutError } from \"./Errors\";\nimport { LogLevel } from \"./ILogger\";\nimport { TransferFormat } from \"./ITransport\";\nimport { Arg, getDataDetail, getUserAgentHeader, sendMessage } from \"./Utils\";\n// Not exported from 'index', this type is internal.\n/** @private */\nexport class LongPollingTransport {\n constructor(httpClient, logger, options) {\n this._httpClient = httpClient;\n this._logger = logger;\n this._pollAbort = new AbortController();\n this._options = options;\n this._running = false;\n this.onreceive = null;\n this.onclose = null;\n }\n // This is an internal type, not exported from 'index' so this is really just internal.\n get pollAborted() {\n return this._pollAbort.aborted;\n }\n async connect(url, transferFormat) {\n Arg.isRequired(url, \"url\");\n Arg.isRequired(transferFormat, \"transferFormat\");\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\n this._url = url;\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Connecting.\");\n // Allow binary format on Node and Browsers that support binary content (indicated by the presence of responseType property)\n if (transferFormat === TransferFormat.Binary && typeof XMLHttpRequest !== \"undefined\" && typeof new XMLHttpRequest().responseType !== \"string\") {\n throw new Error(\"Binary protocols over XmlHttpRequest not implementing advanced features are not supported.\");\n }\n const [name, value] = getUserAgentHeader();\n const headers = {\n [name]: value,\n ...this._options.headers\n };\n const pollOptions = {\n abortSignal: this._pollAbort.signal,\n headers,\n timeout: 100000,\n withCredentials: this._options.withCredentials\n };\n if (transferFormat === TransferFormat.Binary) {\n pollOptions.responseType = \"arraybuffer\";\n }\n // Make initial long polling request\n // Server uses first long polling request to finish initializing connection and it returns without data\n const pollUrl = `${url}&_=${Date.now()}`;\n this._logger.log(LogLevel.Trace, `(LongPolling transport) polling: ${pollUrl}.`);\n const response = await this._httpClient.get(pollUrl, pollOptions);\n if (response.statusCode !== 200) {\n this._logger.log(LogLevel.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);\n // Mark running as false so that the poll immediately ends and runs the close logic\n this._closeError = new HttpError(response.statusText || \"\", response.statusCode);\n this._running = false;\n } else {\n this._running = true;\n }\n this._receiving = this._poll(this._url, pollOptions);\n }\n async _poll(url, pollOptions) {\n try {\n while (this._running) {\n try {\n const pollUrl = `${url}&_=${Date.now()}`;\n this._logger.log(LogLevel.Trace, `(LongPolling transport) polling: ${pollUrl}.`);\n const response = await this._httpClient.get(pollUrl, pollOptions);\n if (response.statusCode === 204) {\n this._logger.log(LogLevel.Information, \"(LongPolling transport) Poll terminated by server.\");\n this._running = false;\n } else if (response.statusCode !== 200) {\n this._logger.log(LogLevel.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);\n // Unexpected status code\n this._closeError = new HttpError(response.statusText || \"\", response.statusCode);\n this._running = false;\n } else {\n // Process the response\n if (response.content) {\n this._logger.log(LogLevel.Trace, `(LongPolling transport) data received. ${getDataDetail(response.content, this._options.logMessageContent)}.`);\n if (this.onreceive) {\n this.onreceive(response.content);\n }\n } else {\n // This is another way timeout manifest.\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Poll timed out, reissuing.\");\n }\n }\n } catch (e) {\n if (!this._running) {\n // Log but disregard errors that occur after stopping\n this._logger.log(LogLevel.Trace, `(LongPolling transport) Poll errored after shutdown: ${e.message}`);\n } else {\n if (e instanceof TimeoutError) {\n // Ignore timeouts and reissue the poll.\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Poll timed out, reissuing.\");\n } else {\n // Close the connection with the error as the result.\n this._closeError = e;\n this._running = false;\n }\n }\n }\n }\n } finally {\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Polling complete.\");\n // We will reach here with pollAborted==false when the server returned a response causing the transport to stop.\n // If pollAborted==true then client initiated the stop and the stop method will raise the close event after DELETE is sent.\n if (!this.pollAborted) {\n this._raiseOnClose();\n }\n }\n }\n async send(data) {\n if (!this._running) {\n return Promise.reject(new Error(\"Cannot send until the transport is connected\"));\n }\n return sendMessage(this._logger, \"LongPolling\", this._httpClient, this._url, data, this._options);\n }\n async stop() {\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Stopping polling.\");\n // Tell receiving loop to stop, abort any current request, and then wait for it to finish\n this._running = false;\n this._pollAbort.abort();\n try {\n await this._receiving;\n // Send DELETE to clean up long polling on the server\n this._logger.log(LogLevel.Trace, `(LongPolling transport) sending DELETE request to ${this._url}.`);\n const headers = {};\n const [name, value] = getUserAgentHeader();\n headers[name] = value;\n const deleteOptions = {\n headers: {\n ...headers,\n ...this._options.headers\n },\n timeout: this._options.timeout,\n withCredentials: this._options.withCredentials\n };\n await this._httpClient.delete(this._url, deleteOptions);\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) DELETE request sent.\");\n } finally {\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Stop finished.\");\n // Raise close event here instead of in polling\n // It needs to happen after the DELETE request is sent\n this._raiseOnClose();\n }\n }\n _raiseOnClose() {\n if (this.onclose) {\n let logMessage = \"(LongPolling transport) Firing onclose event.\";\n if (this._closeError) {\n logMessage += \" Error: \" + this._closeError;\n }\n this._logger.log(LogLevel.Trace, logMessage);\n this.onclose(this._closeError);\n }\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { LogLevel } from \"./ILogger\";\nimport { TransferFormat } from \"./ITransport\";\nimport { Arg, getDataDetail, getUserAgentHeader, Platform, sendMessage } from \"./Utils\";\n/** @private */\nexport class ServerSentEventsTransport {\n constructor(httpClient, accessToken, logger, options) {\n this._httpClient = httpClient;\n this._accessToken = accessToken;\n this._logger = logger;\n this._options = options;\n this.onreceive = null;\n this.onclose = null;\n }\n async connect(url, transferFormat) {\n Arg.isRequired(url, \"url\");\n Arg.isRequired(transferFormat, \"transferFormat\");\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\n this._logger.log(LogLevel.Trace, \"(SSE transport) Connecting.\");\n // set url before accessTokenFactory because this._url is only for send and we set the auth header instead of the query string for send\n this._url = url;\n if (this._accessToken) {\n url += (url.indexOf(\"?\") < 0 ? \"?\" : \"&\") + `access_token=${encodeURIComponent(this._accessToken)}`;\n }\n return new Promise((resolve, reject) => {\n let opened = false;\n if (transferFormat !== TransferFormat.Text) {\n reject(new Error(\"The Server-Sent Events transport only supports the 'Text' transfer format\"));\n return;\n }\n let eventSource;\n if (Platform.isBrowser || Platform.isWebWorker) {\n eventSource = new this._options.EventSource(url, {\n withCredentials: this._options.withCredentials\n });\n } else {\n // Non-browser passes cookies via the dictionary\n const cookies = this._httpClient.getCookieString(url);\n const headers = {};\n headers.Cookie = cookies;\n const [name, value] = getUserAgentHeader();\n headers[name] = value;\n eventSource = new this._options.EventSource(url, {\n withCredentials: this._options.withCredentials,\n headers: {\n ...headers,\n ...this._options.headers\n }\n });\n }\n try {\n eventSource.onmessage = e => {\n if (this.onreceive) {\n try {\n this._logger.log(LogLevel.Trace, `(SSE transport) data received. ${getDataDetail(e.data, this._options.logMessageContent)}.`);\n this.onreceive(e.data);\n } catch (error) {\n this._close(error);\n return;\n }\n }\n };\n // @ts-ignore: not using event on purpose\n eventSource.onerror = e => {\n // EventSource doesn't give any useful information about server side closes.\n if (opened) {\n this._close();\n } else {\n reject(new Error(\"EventSource failed to connect. The connection could not be found on the server,\" + \" either the connection ID is not present on the server, or a proxy is refusing/buffering the connection.\" + \" If you have multiple servers check that sticky sessions are enabled.\"));\n }\n };\n eventSource.onopen = () => {\n this._logger.log(LogLevel.Information, `SSE connected to ${this._url}`);\n this._eventSource = eventSource;\n opened = true;\n resolve();\n };\n } catch (e) {\n reject(e);\n return;\n }\n });\n }\n async send(data) {\n if (!this._eventSource) {\n return Promise.reject(new Error(\"Cannot send until the transport is connected\"));\n }\n return sendMessage(this._logger, \"SSE\", this._httpClient, this._url, data, this._options);\n }\n stop() {\n this._close();\n return Promise.resolve();\n }\n _close(e) {\n if (this._eventSource) {\n this._eventSource.close();\n this._eventSource = undefined;\n if (this.onclose) {\n this.onclose(e);\n }\n }\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { HeaderNames } from \"./HeaderNames\";\nimport { LogLevel } from \"./ILogger\";\nimport { TransferFormat } from \"./ITransport\";\nimport { Arg, getDataDetail, getUserAgentHeader, Platform } from \"./Utils\";\n/** @private */\nexport class WebSocketTransport {\n constructor(httpClient, accessTokenFactory, logger, logMessageContent, webSocketConstructor, headers) {\n this._logger = logger;\n this._accessTokenFactory = accessTokenFactory;\n this._logMessageContent = logMessageContent;\n this._webSocketConstructor = webSocketConstructor;\n this._httpClient = httpClient;\n this.onreceive = null;\n this.onclose = null;\n this._headers = headers;\n }\n async connect(url, transferFormat) {\n Arg.isRequired(url, \"url\");\n Arg.isRequired(transferFormat, \"transferFormat\");\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\n this._logger.log(LogLevel.Trace, \"(WebSockets transport) Connecting.\");\n let token;\n if (this._accessTokenFactory) {\n token = await this._accessTokenFactory();\n }\n return new Promise((resolve, reject) => {\n url = url.replace(/^http/, \"ws\");\n let webSocket;\n const cookies = this._httpClient.getCookieString(url);\n let opened = false;\n if (Platform.isNode || Platform.isReactNative) {\n const headers = {};\n const [name, value] = getUserAgentHeader();\n headers[name] = value;\n if (token) {\n headers[HeaderNames.Authorization] = `Bearer ${token}`;\n }\n if (cookies) {\n headers[HeaderNames.Cookie] = cookies;\n }\n // Only pass headers when in non-browser environments\n webSocket = new this._webSocketConstructor(url, undefined, {\n headers: {\n ...headers,\n ...this._headers\n }\n });\n } else {\n if (token) {\n url += (url.indexOf(\"?\") < 0 ? \"?\" : \"&\") + `access_token=${encodeURIComponent(token)}`;\n }\n }\n if (!webSocket) {\n // Chrome is not happy with passing 'undefined' as protocol\n webSocket = new this._webSocketConstructor(url);\n }\n if (transferFormat === TransferFormat.Binary) {\n webSocket.binaryType = \"arraybuffer\";\n }\n webSocket.onopen = _event => {\n this._logger.log(LogLevel.Information, `WebSocket connected to ${url}.`);\n this._webSocket = webSocket;\n opened = true;\n resolve();\n };\n webSocket.onerror = event => {\n let error = null;\n // ErrorEvent is a browser only type we need to check if the type exists before using it\n if (typeof ErrorEvent !== \"undefined\" && event instanceof ErrorEvent) {\n error = event.error;\n } else {\n error = \"There was an error with the transport\";\n }\n this._logger.log(LogLevel.Information, `(WebSockets transport) ${error}.`);\n };\n webSocket.onmessage = message => {\n this._logger.log(LogLevel.Trace, `(WebSockets transport) data received. ${getDataDetail(message.data, this._logMessageContent)}.`);\n if (this.onreceive) {\n try {\n this.onreceive(message.data);\n } catch (error) {\n this._close(error);\n return;\n }\n }\n };\n webSocket.onclose = event => {\n // Don't call close handler if connection was never established\n // We'll reject the connect call instead\n if (opened) {\n this._close(event);\n } else {\n let error = null;\n // ErrorEvent is a browser only type we need to check if the type exists before using it\n if (typeof ErrorEvent !== \"undefined\" && event instanceof ErrorEvent) {\n error = event.error;\n } else {\n error = \"WebSocket failed to connect. The connection could not be found on the server,\" + \" either the endpoint may not be a SignalR endpoint,\" + \" the connection ID is not present on the server, or there is a proxy blocking WebSockets.\" + \" If you have multiple servers check that sticky sessions are enabled.\";\n }\n reject(new Error(error));\n }\n };\n });\n }\n send(data) {\n if (this._webSocket && this._webSocket.readyState === this._webSocketConstructor.OPEN) {\n this._logger.log(LogLevel.Trace, `(WebSockets transport) sending data. ${getDataDetail(data, this._logMessageContent)}.`);\n this._webSocket.send(data);\n return Promise.resolve();\n }\n return Promise.reject(\"WebSocket is not in the OPEN state\");\n }\n stop() {\n if (this._webSocket) {\n // Manually invoke onclose callback inline so we know the HttpConnection was closed properly before returning\n // This also solves an issue where websocket.onclose could take 18+ seconds to trigger during network disconnects\n this._close(undefined);\n }\n return Promise.resolve();\n }\n _close(event) {\n // webSocket will be null if the transport did not start successfully\n if (this._webSocket) {\n // Clear websocket handlers because we are considering the socket closed now\n this._webSocket.onclose = () => {};\n this._webSocket.onmessage = () => {};\n this._webSocket.onerror = () => {};\n this._webSocket.close();\n this._webSocket = undefined;\n }\n this._logger.log(LogLevel.Trace, \"(WebSockets transport) socket closed.\");\n if (this.onclose) {\n if (this._isCloseEvent(event) && (event.wasClean === false || event.code !== 1000)) {\n this.onclose(new Error(`WebSocket closed with status code: ${event.code} (${event.reason || \"no reason given\"}).`));\n } else if (event instanceof Error) {\n this.onclose(event);\n } else {\n this.onclose();\n }\n }\n }\n _isCloseEvent(event) {\n return event && typeof event.wasClean === \"boolean\" && typeof event.code === \"number\";\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { AccessTokenHttpClient } from \"./AccessTokenHttpClient\";\nimport { DefaultHttpClient } from \"./DefaultHttpClient\";\nimport { AggregateErrors, DisabledTransportError, FailedToNegotiateWithServerError, FailedToStartTransportError, HttpError, UnsupportedTransportError, AbortError } from \"./Errors\";\nimport { LogLevel } from \"./ILogger\";\nimport { HttpTransportType, TransferFormat } from \"./ITransport\";\nimport { LongPollingTransport } from \"./LongPollingTransport\";\nimport { ServerSentEventsTransport } from \"./ServerSentEventsTransport\";\nimport { Arg, createLogger, getUserAgentHeader, Platform } from \"./Utils\";\nimport { WebSocketTransport } from \"./WebSocketTransport\";\nconst MAX_REDIRECTS = 100;\n/** @private */\nexport class HttpConnection {\n constructor(url, options = {}) {\n this._stopPromiseResolver = () => {};\n this.features = {};\n this._negotiateVersion = 1;\n Arg.isRequired(url, \"url\");\n this._logger = createLogger(options.logger);\n this.baseUrl = this._resolveUrl(url);\n options = options || {};\n options.logMessageContent = options.logMessageContent === undefined ? false : options.logMessageContent;\n if (typeof options.withCredentials === \"boolean\" || options.withCredentials === undefined) {\n options.withCredentials = options.withCredentials === undefined ? true : options.withCredentials;\n } else {\n throw new Error(\"withCredentials option was not a 'boolean' or 'undefined' value\");\n }\n options.timeout = options.timeout === undefined ? 100 * 1000 : options.timeout;\n let webSocketModule = null;\n let eventSourceModule = null;\n if (Platform.isNode && typeof require !== \"undefined\") {\n // In order to ignore the dynamic require in webpack builds we need to do this magic\n // @ts-ignore: TS doesn't know about these names\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\n webSocketModule = requireFunc(\"ws\");\n eventSourceModule = requireFunc(\"eventsource\");\n }\n if (!Platform.isNode && typeof WebSocket !== \"undefined\" && !options.WebSocket) {\n options.WebSocket = WebSocket;\n } else if (Platform.isNode && !options.WebSocket) {\n if (webSocketModule) {\n options.WebSocket = webSocketModule;\n }\n }\n if (!Platform.isNode && typeof EventSource !== \"undefined\" && !options.EventSource) {\n options.EventSource = EventSource;\n } else if (Platform.isNode && !options.EventSource) {\n if (typeof eventSourceModule !== \"undefined\") {\n options.EventSource = eventSourceModule;\n }\n }\n this._httpClient = new AccessTokenHttpClient(options.httpClient || new DefaultHttpClient(this._logger), options.accessTokenFactory);\n this._connectionState = \"Disconnected\" /* Disconnected */;\n this._connectionStarted = false;\n this._options = options;\n this.onreceive = null;\n this.onclose = null;\n }\n async start(transferFormat) {\n transferFormat = transferFormat || TransferFormat.Binary;\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\n this._logger.log(LogLevel.Debug, `Starting connection with transfer format '${TransferFormat[transferFormat]}'.`);\n if (this._connectionState !== \"Disconnected\" /* Disconnected */) {\n return Promise.reject(new Error(\"Cannot start an HttpConnection that is not in the 'Disconnected' state.\"));\n }\n this._connectionState = \"Connecting\" /* Connecting */;\n this._startInternalPromise = this._startInternal(transferFormat);\n await this._startInternalPromise;\n // The TypeScript compiler thinks that connectionState must be Connecting here. The TypeScript compiler is wrong.\n if (this._connectionState === \"Disconnecting\" /* Disconnecting */) {\n // stop() was called and transitioned the client into the Disconnecting state.\n const message = \"Failed to start the HttpConnection before stop() was called.\";\n this._logger.log(LogLevel.Error, message);\n // We cannot await stopPromise inside startInternal since stopInternal awaits the startInternalPromise.\n await this._stopPromise;\n return Promise.reject(new AbortError(message));\n } else if (this._connectionState !== \"Connected\" /* Connected */) {\n // stop() was called and transitioned the client into the Disconnecting state.\n const message = \"HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!\";\n this._logger.log(LogLevel.Error, message);\n return Promise.reject(new AbortError(message));\n }\n this._connectionStarted = true;\n }\n send(data) {\n if (this._connectionState !== \"Connected\" /* Connected */) {\n return Promise.reject(new Error(\"Cannot send data if the connection is not in the 'Connected' State.\"));\n }\n if (!this._sendQueue) {\n this._sendQueue = new TransportSendQueue(this.transport);\n }\n // Transport will not be null if state is connected\n return this._sendQueue.send(data);\n }\n async stop(error) {\n if (this._connectionState === \"Disconnected\" /* Disconnected */) {\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnected state.`);\n return Promise.resolve();\n }\n if (this._connectionState === \"Disconnecting\" /* Disconnecting */) {\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnecting state.`);\n return this._stopPromise;\n }\n this._connectionState = \"Disconnecting\" /* Disconnecting */;\n this._stopPromise = new Promise(resolve => {\n // Don't complete stop() until stopConnection() completes.\n this._stopPromiseResolver = resolve;\n });\n // stopInternal should never throw so just observe it.\n await this._stopInternal(error);\n await this._stopPromise;\n }\n async _stopInternal(error) {\n // Set error as soon as possible otherwise there is a race between\n // the transport closing and providing an error and the error from a close message\n // We would prefer the close message error.\n this._stopError = error;\n try {\n await this._startInternalPromise;\n } catch (e) {\n // This exception is returned to the user as a rejected Promise from the start method.\n }\n // The transport's onclose will trigger stopConnection which will run our onclose event.\n // The transport should always be set if currently connected. If it wasn't set, it's likely because\n // stop was called during start() and start() failed.\n if (this.transport) {\n try {\n await this.transport.stop();\n } catch (e) {\n this._logger.log(LogLevel.Error, `HttpConnection.transport.stop() threw error '${e}'.`);\n this._stopConnection();\n }\n this.transport = undefined;\n } else {\n this._logger.log(LogLevel.Debug, \"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.\");\n }\n }\n async _startInternal(transferFormat) {\n // Store the original base url and the access token factory since they may change\n // as part of negotiating\n let url = this.baseUrl;\n this._accessTokenFactory = this._options.accessTokenFactory;\n this._httpClient._accessTokenFactory = this._accessTokenFactory;\n try {\n if (this._options.skipNegotiation) {\n if (this._options.transport === HttpTransportType.WebSockets) {\n // No need to add a connection ID in this case\n this.transport = this._constructTransport(HttpTransportType.WebSockets);\n // We should just call connect directly in this case.\n // No fallback or negotiate in this case.\n await this._startTransport(url, transferFormat);\n } else {\n throw new Error(\"Negotiation can only be skipped when using the WebSocket transport directly.\");\n }\n } else {\n let negotiateResponse = null;\n let redirects = 0;\n do {\n negotiateResponse = await this._getNegotiationResponse(url);\n // the user tries to stop the connection when it is being started\n if (this._connectionState === \"Disconnecting\" /* Disconnecting */ || this._connectionState === \"Disconnected\" /* Disconnected */) {\n throw new AbortError(\"The connection was stopped during negotiation.\");\n }\n if (negotiateResponse.error) {\n throw new Error(negotiateResponse.error);\n }\n if (negotiateResponse.ProtocolVersion) {\n throw new Error(\"Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.\");\n }\n if (negotiateResponse.url) {\n url = negotiateResponse.url;\n }\n if (negotiateResponse.accessToken) {\n // Replace the current access token factory with one that uses\n // the returned access token\n const accessToken = negotiateResponse.accessToken;\n this._accessTokenFactory = () => accessToken;\n // set the factory to undefined so the AccessTokenHttpClient won't retry with the same token, since we know it won't change until a connection restart\n this._httpClient._accessToken = accessToken;\n this._httpClient._accessTokenFactory = undefined;\n }\n redirects++;\n } while (negotiateResponse.url && redirects < MAX_REDIRECTS);\n if (redirects === MAX_REDIRECTS && negotiateResponse.url) {\n throw new Error(\"Negotiate redirection limit exceeded.\");\n }\n await this._createTransport(url, this._options.transport, negotiateResponse, transferFormat);\n }\n if (this.transport instanceof LongPollingTransport) {\n this.features.inherentKeepAlive = true;\n }\n if (this._connectionState === \"Connecting\" /* Connecting */) {\n // Ensure the connection transitions to the connected state prior to completing this.startInternalPromise.\n // start() will handle the case when stop was called and startInternal exits still in the disconnecting state.\n this._logger.log(LogLevel.Debug, \"The HttpConnection connected successfully.\");\n this._connectionState = \"Connected\" /* Connected */;\n }\n // stop() is waiting on us via this.startInternalPromise so keep this.transport around so it can clean up.\n // This is the only case startInternal can exit in neither the connected nor disconnected state because stopConnection()\n // will transition to the disconnected state. start() will wait for the transition using the stopPromise.\n } catch (e) {\n this._logger.log(LogLevel.Error, \"Failed to start the connection: \" + e);\n this._connectionState = \"Disconnected\" /* Disconnected */;\n this.transport = undefined;\n // if start fails, any active calls to stop assume that start will complete the stop promise\n this._stopPromiseResolver();\n return Promise.reject(e);\n }\n }\n async _getNegotiationResponse(url) {\n const headers = {};\n const [name, value] = getUserAgentHeader();\n headers[name] = value;\n const negotiateUrl = this._resolveNegotiateUrl(url);\n this._logger.log(LogLevel.Debug, `Sending negotiation request: ${negotiateUrl}.`);\n try {\n const response = await this._httpClient.post(negotiateUrl, {\n content: \"\",\n headers: {\n ...headers,\n ...this._options.headers\n },\n timeout: this._options.timeout,\n withCredentials: this._options.withCredentials\n });\n if (response.statusCode !== 200) {\n return Promise.reject(new Error(`Unexpected status code returned from negotiate '${response.statusCode}'`));\n }\n const negotiateResponse = JSON.parse(response.content);\n if (!negotiateResponse.negotiateVersion || negotiateResponse.negotiateVersion < 1) {\n // Negotiate version 0 doesn't use connectionToken\n // So we set it equal to connectionId so all our logic can use connectionToken without being aware of the negotiate version\n negotiateResponse.connectionToken = negotiateResponse.connectionId;\n }\n return negotiateResponse;\n } catch (e) {\n let errorMessage = \"Failed to complete negotiation with the server: \" + e;\n if (e instanceof HttpError) {\n if (e.statusCode === 404) {\n errorMessage = errorMessage + \" Either this is not a SignalR endpoint or there is a proxy blocking the connection.\";\n }\n }\n this._logger.log(LogLevel.Error, errorMessage);\n return Promise.reject(new FailedToNegotiateWithServerError(errorMessage));\n }\n }\n _createConnectUrl(url, connectionToken) {\n if (!connectionToken) {\n return url;\n }\n return url + (url.indexOf(\"?\") === -1 ? \"?\" : \"&\") + `id=${connectionToken}`;\n }\n async _createTransport(url, requestedTransport, negotiateResponse, requestedTransferFormat) {\n let connectUrl = this._createConnectUrl(url, negotiateResponse.connectionToken);\n if (this._isITransport(requestedTransport)) {\n this._logger.log(LogLevel.Debug, \"Connection was provided an instance of ITransport, using that directly.\");\n this.transport = requestedTransport;\n await this._startTransport(connectUrl, requestedTransferFormat);\n this.connectionId = negotiateResponse.connectionId;\n return;\n }\n const transportExceptions = [];\n const transports = negotiateResponse.availableTransports || [];\n let negotiate = negotiateResponse;\n for (const endpoint of transports) {\n const transportOrError = this._resolveTransportOrError(endpoint, requestedTransport, requestedTransferFormat);\n if (transportOrError instanceof Error) {\n // Store the error and continue, we don't want to cause a re-negotiate in these cases\n transportExceptions.push(`${endpoint.transport} failed:`);\n transportExceptions.push(transportOrError);\n } else if (this._isITransport(transportOrError)) {\n this.transport = transportOrError;\n if (!negotiate) {\n try {\n negotiate = await this._getNegotiationResponse(url);\n } catch (ex) {\n return Promise.reject(ex);\n }\n connectUrl = this._createConnectUrl(url, negotiate.connectionToken);\n }\n try {\n await this._startTransport(connectUrl, requestedTransferFormat);\n this.connectionId = negotiate.connectionId;\n return;\n } catch (ex) {\n this._logger.log(LogLevel.Error, `Failed to start the transport '${endpoint.transport}': ${ex}`);\n negotiate = undefined;\n transportExceptions.push(new FailedToStartTransportError(`${endpoint.transport} failed: ${ex}`, HttpTransportType[endpoint.transport]));\n if (this._connectionState !== \"Connecting\" /* Connecting */) {\n const message = \"Failed to select transport before stop() was called.\";\n this._logger.log(LogLevel.Debug, message);\n return Promise.reject(new AbortError(message));\n }\n }\n }\n }\n if (transportExceptions.length > 0) {\n return Promise.reject(new AggregateErrors(`Unable to connect to the server with any of the available transports. ${transportExceptions.join(\" \")}`, transportExceptions));\n }\n return Promise.reject(new Error(\"None of the transports supported by the client are supported by the server.\"));\n }\n _constructTransport(transport) {\n switch (transport) {\n case HttpTransportType.WebSockets:\n if (!this._options.WebSocket) {\n throw new Error(\"'WebSocket' is not supported in your environment.\");\n }\n return new WebSocketTransport(this._httpClient, this._accessTokenFactory, this._logger, this._options.logMessageContent, this._options.WebSocket, this._options.headers || {});\n case HttpTransportType.ServerSentEvents:\n if (!this._options.EventSource) {\n throw new Error(\"'EventSource' is not supported in your environment.\");\n }\n return new ServerSentEventsTransport(this._httpClient, this._httpClient._accessToken, this._logger, this._options);\n case HttpTransportType.LongPolling:\n return new LongPollingTransport(this._httpClient, this._logger, this._options);\n default:\n throw new Error(`Unknown transport: ${transport}.`);\n }\n }\n _startTransport(url, transferFormat) {\n this.transport.onreceive = this.onreceive;\n this.transport.onclose = e => this._stopConnection(e);\n return this.transport.connect(url, transferFormat);\n }\n _resolveTransportOrError(endpoint, requestedTransport, requestedTransferFormat) {\n const transport = HttpTransportType[endpoint.transport];\n if (transport === null || transport === undefined) {\n this._logger.log(LogLevel.Debug, `Skipping transport '${endpoint.transport}' because it is not supported by this client.`);\n return new Error(`Skipping transport '${endpoint.transport}' because it is not supported by this client.`);\n } else {\n if (transportMatches(requestedTransport, transport)) {\n const transferFormats = endpoint.transferFormats.map(s => TransferFormat[s]);\n if (transferFormats.indexOf(requestedTransferFormat) >= 0) {\n if (transport === HttpTransportType.WebSockets && !this._options.WebSocket || transport === HttpTransportType.ServerSentEvents && !this._options.EventSource) {\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it is not supported in your environment.'`);\n return new UnsupportedTransportError(`'${HttpTransportType[transport]}' is not supported in your environment.`, transport);\n } else {\n this._logger.log(LogLevel.Debug, `Selecting transport '${HttpTransportType[transport]}'.`);\n try {\n return this._constructTransport(transport);\n } catch (ex) {\n return ex;\n }\n }\n } else {\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it does not support the requested transfer format '${TransferFormat[requestedTransferFormat]}'.`);\n return new Error(`'${HttpTransportType[transport]}' does not support ${TransferFormat[requestedTransferFormat]}.`);\n }\n } else {\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it was disabled by the client.`);\n return new DisabledTransportError(`'${HttpTransportType[transport]}' is disabled by the client.`, transport);\n }\n }\n }\n _isITransport(transport) {\n return transport && typeof transport === \"object\" && \"connect\" in transport;\n }\n _stopConnection(error) {\n this._logger.log(LogLevel.Debug, `HttpConnection.stopConnection(${error}) called while in state ${this._connectionState}.`);\n this.transport = undefined;\n // If we have a stopError, it takes precedence over the error from the transport\n error = this._stopError || error;\n this._stopError = undefined;\n if (this._connectionState === \"Disconnected\" /* Disconnected */) {\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stopConnection(${error}) was ignored because the connection is already in the disconnected state.`);\n return;\n }\n if (this._connectionState === \"Connecting\" /* Connecting */) {\n this._logger.log(LogLevel.Warning, `Call to HttpConnection.stopConnection(${error}) was ignored because the connection is still in the connecting state.`);\n throw new Error(`HttpConnection.stopConnection(${error}) was called while the connection is still in the connecting state.`);\n }\n if (this._connectionState === \"Disconnecting\" /* Disconnecting */) {\n // A call to stop() induced this call to stopConnection and needs to be completed.\n // Any stop() awaiters will be scheduled to continue after the onclose callback fires.\n this._stopPromiseResolver();\n }\n if (error) {\n this._logger.log(LogLevel.Error, `Connection disconnected with error '${error}'.`);\n } else {\n this._logger.log(LogLevel.Information, \"Connection disconnected.\");\n }\n if (this._sendQueue) {\n this._sendQueue.stop().catch(e => {\n this._logger.log(LogLevel.Error, `TransportSendQueue.stop() threw error '${e}'.`);\n });\n this._sendQueue = undefined;\n }\n this.connectionId = undefined;\n this._connectionState = \"Disconnected\" /* Disconnected */;\n if (this._connectionStarted) {\n this._connectionStarted = false;\n try {\n if (this.onclose) {\n this.onclose(error);\n }\n } catch (e) {\n this._logger.log(LogLevel.Error, `HttpConnection.onclose(${error}) threw error '${e}'.`);\n }\n }\n }\n _resolveUrl(url) {\n // startsWith is not supported in IE\n if (url.lastIndexOf(\"https://\", 0) === 0 || url.lastIndexOf(\"http://\", 0) === 0) {\n return url;\n }\n if (!Platform.isBrowser) {\n throw new Error(`Cannot resolve '${url}'.`);\n }\n // Setting the url to the href propery of an anchor tag handles normalization\n // for us. There are 3 main cases.\n // 1. Relative path normalization e.g \"b\" -> \"http://localhost:5000/a/b\"\n // 2. Absolute path normalization e.g \"/a/b\" -> \"http://localhost:5000/a/b\"\n // 3. Networkpath reference normalization e.g \"//localhost:5000/a/b\" -> \"http://localhost:5000/a/b\"\n const aTag = window.document.createElement(\"a\");\n aTag.href = url;\n this._logger.log(LogLevel.Information, `Normalizing '${url}' to '${aTag.href}'.`);\n return aTag.href;\n }\n _resolveNegotiateUrl(url) {\n const index = url.indexOf(\"?\");\n let negotiateUrl = url.substring(0, index === -1 ? url.length : index);\n if (negotiateUrl[negotiateUrl.length - 1] !== \"/\") {\n negotiateUrl += \"/\";\n }\n negotiateUrl += \"negotiate\";\n negotiateUrl += index === -1 ? \"\" : url.substring(index);\n if (negotiateUrl.indexOf(\"negotiateVersion\") === -1) {\n negotiateUrl += index === -1 ? \"?\" : \"&\";\n negotiateUrl += \"negotiateVersion=\" + this._negotiateVersion;\n }\n return negotiateUrl;\n }\n}\nfunction transportMatches(requestedTransport, actualTransport) {\n return !requestedTransport || (actualTransport & requestedTransport) !== 0;\n}\n/** @private */\nexport class TransportSendQueue {\n constructor(_transport) {\n this._transport = _transport;\n this._buffer = [];\n this._executing = true;\n this._sendBufferedData = new PromiseSource();\n this._transportResult = new PromiseSource();\n this._sendLoopPromise = this._sendLoop();\n }\n send(data) {\n this._bufferData(data);\n if (!this._transportResult) {\n this._transportResult = new PromiseSource();\n }\n return this._transportResult.promise;\n }\n stop() {\n this._executing = false;\n this._sendBufferedData.resolve();\n return this._sendLoopPromise;\n }\n _bufferData(data) {\n if (this._buffer.length && typeof this._buffer[0] !== typeof data) {\n throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof data}`);\n }\n this._buffer.push(data);\n this._sendBufferedData.resolve();\n }\n async _sendLoop() {\n while (true) {\n await this._sendBufferedData.promise;\n if (!this._executing) {\n if (this._transportResult) {\n this._transportResult.reject(\"Connection stopped.\");\n }\n break;\n }\n this._sendBufferedData = new PromiseSource();\n const transportResult = this._transportResult;\n this._transportResult = undefined;\n const data = typeof this._buffer[0] === \"string\" ? this._buffer.join(\"\") : TransportSendQueue._concatBuffers(this._buffer);\n this._buffer.length = 0;\n try {\n await this._transport.send(data);\n transportResult.resolve();\n } catch (error) {\n transportResult.reject(error);\n }\n }\n }\n static _concatBuffers(arrayBuffers) {\n const totalLength = arrayBuffers.map(b => b.byteLength).reduce((a, b) => a + b);\n const result = new Uint8Array(totalLength);\n let offset = 0;\n for (const item of arrayBuffers) {\n result.set(new Uint8Array(item), offset);\n offset += item.byteLength;\n }\n return result.buffer;\n }\n}\nclass PromiseSource {\n constructor() {\n this.promise = new Promise((resolve, reject) => [this._resolver, this._rejecter] = [resolve, reject]);\n }\n resolve() {\n this._resolver();\n }\n reject(reason) {\n this._rejecter(reason);\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { MessageType } from \"./IHubProtocol\";\nimport { LogLevel } from \"./ILogger\";\nimport { TransferFormat } from \"./ITransport\";\nimport { NullLogger } from \"./Loggers\";\nimport { TextMessageFormat } from \"./TextMessageFormat\";\nconst JSON_HUB_PROTOCOL_NAME = \"json\";\n/** Implements the JSON Hub Protocol. */\nexport class JsonHubProtocol {\n constructor() {\n /** @inheritDoc */\n this.name = JSON_HUB_PROTOCOL_NAME;\n /** @inheritDoc */\n this.version = 1;\n /** @inheritDoc */\n this.transferFormat = TransferFormat.Text;\n }\n /** Creates an array of {@link @microsoft/signalr.HubMessage} objects from the specified serialized representation.\r\n *\r\n * @param {string} input A string containing the serialized representation.\r\n * @param {ILogger} logger A logger that will be used to log messages that occur during parsing.\r\n */\n parseMessages(input, logger) {\n // The interface does allow \"ArrayBuffer\" to be passed in, but this implementation does not. So let's throw a useful error.\n if (typeof input !== \"string\") {\n throw new Error(\"Invalid input for JSON hub protocol. Expected a string.\");\n }\n if (!input) {\n return [];\n }\n if (logger === null) {\n logger = NullLogger.instance;\n }\n // Parse the messages\n const messages = TextMessageFormat.parse(input);\n const hubMessages = [];\n for (const message of messages) {\n const parsedMessage = JSON.parse(message);\n if (typeof parsedMessage.type !== \"number\") {\n throw new Error(\"Invalid payload.\");\n }\n switch (parsedMessage.type) {\n case MessageType.Invocation:\n this._isInvocationMessage(parsedMessage);\n break;\n case MessageType.StreamItem:\n this._isStreamItemMessage(parsedMessage);\n break;\n case MessageType.Completion:\n this._isCompletionMessage(parsedMessage);\n break;\n case MessageType.Ping:\n // Single value, no need to validate\n break;\n case MessageType.Close:\n // All optional values, no need to validate\n break;\n default:\n // Future protocol changes can add message types, old clients can ignore them\n logger.log(LogLevel.Information, \"Unknown message type '\" + parsedMessage.type + \"' ignored.\");\n continue;\n }\n hubMessages.push(parsedMessage);\n }\n return hubMessages;\n }\n /** Writes the specified {@link @microsoft/signalr.HubMessage} to a string and returns it.\r\n *\r\n * @param {HubMessage} message The message to write.\r\n * @returns {string} A string containing the serialized representation of the message.\r\n */\n writeMessage(message) {\n return TextMessageFormat.write(JSON.stringify(message));\n }\n _isInvocationMessage(message) {\n this._assertNotEmptyString(message.target, \"Invalid payload for Invocation message.\");\n if (message.invocationId !== undefined) {\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for Invocation message.\");\n }\n }\n _isStreamItemMessage(message) {\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for StreamItem message.\");\n if (message.item === undefined) {\n throw new Error(\"Invalid payload for StreamItem message.\");\n }\n }\n _isCompletionMessage(message) {\n if (message.result && message.error) {\n throw new Error(\"Invalid payload for Completion message.\");\n }\n if (!message.result && message.error) {\n this._assertNotEmptyString(message.error, \"Invalid payload for Completion message.\");\n }\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for Completion message.\");\n }\n _assertNotEmptyString(value, errorMessage) {\n if (typeof value !== \"string\" || value === \"\") {\n throw new Error(errorMessage);\n }\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { DefaultReconnectPolicy } from \"./DefaultReconnectPolicy\";\nimport { HttpConnection } from \"./HttpConnection\";\nimport { HubConnection } from \"./HubConnection\";\nimport { LogLevel } from \"./ILogger\";\nimport { JsonHubProtocol } from \"./JsonHubProtocol\";\nimport { NullLogger } from \"./Loggers\";\nimport { Arg, ConsoleLogger } from \"./Utils\";\nconst LogLevelNameMapping = {\n trace: LogLevel.Trace,\n debug: LogLevel.Debug,\n info: LogLevel.Information,\n information: LogLevel.Information,\n warn: LogLevel.Warning,\n warning: LogLevel.Warning,\n error: LogLevel.Error,\n critical: LogLevel.Critical,\n none: LogLevel.None\n};\nfunction parseLogLevel(name) {\n // Case-insensitive matching via lower-casing\n // Yes, I know case-folding is a complicated problem in Unicode, but we only support\n // the ASCII strings defined in LogLevelNameMapping anyway, so it's fine -anurse.\n const mapping = LogLevelNameMapping[name.toLowerCase()];\n if (typeof mapping !== \"undefined\") {\n return mapping;\n } else {\n throw new Error(`Unknown log level: ${name}`);\n }\n}\n/** A builder for configuring {@link @microsoft/signalr.HubConnection} instances. */\nexport class HubConnectionBuilder {\n configureLogging(logging) {\n Arg.isRequired(logging, \"logging\");\n if (isLogger(logging)) {\n this.logger = logging;\n } else if (typeof logging === \"string\") {\n const logLevel = parseLogLevel(logging);\n this.logger = new ConsoleLogger(logLevel);\n } else {\n this.logger = new ConsoleLogger(logging);\n }\n return this;\n }\n withUrl(url, transportTypeOrOptions) {\n Arg.isRequired(url, \"url\");\n Arg.isNotEmpty(url, \"url\");\n this.url = url;\n // Flow-typing knows where it's at. Since HttpTransportType is a number and IHttpConnectionOptions is guaranteed\n // to be an object, we know (as does TypeScript) this comparison is all we need to figure out which overload was called.\n if (typeof transportTypeOrOptions === \"object\") {\n this.httpConnectionOptions = {\n ...this.httpConnectionOptions,\n ...transportTypeOrOptions\n };\n } else {\n this.httpConnectionOptions = {\n ...this.httpConnectionOptions,\n transport: transportTypeOrOptions\n };\n }\n return this;\n }\n /** Configures the {@link @microsoft/signalr.HubConnection} to use the specified Hub Protocol.\r\n *\r\n * @param {IHubProtocol} protocol The {@link @microsoft/signalr.IHubProtocol} implementation to use.\r\n */\n withHubProtocol(protocol) {\n Arg.isRequired(protocol, \"protocol\");\n this.protocol = protocol;\n return this;\n }\n withAutomaticReconnect(retryDelaysOrReconnectPolicy) {\n if (this.reconnectPolicy) {\n throw new Error(\"A reconnectPolicy has already been set.\");\n }\n if (!retryDelaysOrReconnectPolicy) {\n this.reconnectPolicy = new DefaultReconnectPolicy();\n } else if (Array.isArray(retryDelaysOrReconnectPolicy)) {\n this.reconnectPolicy = new DefaultReconnectPolicy(retryDelaysOrReconnectPolicy);\n } else {\n this.reconnectPolicy = retryDelaysOrReconnectPolicy;\n }\n return this;\n }\n /** Creates a {@link @microsoft/signalr.HubConnection} from the configuration options specified in this builder.\r\n *\r\n * @returns {HubConnection} The configured {@link @microsoft/signalr.HubConnection}.\r\n */\n build() {\n // If httpConnectionOptions has a logger, use it. Otherwise, override it with the one\n // provided to configureLogger\n const httpConnectionOptions = this.httpConnectionOptions || {};\n // If it's 'null', the user **explicitly** asked for null, don't mess with it.\n if (httpConnectionOptions.logger === undefined) {\n // If our logger is undefined or null, that's OK, the HttpConnection constructor will handle it.\n httpConnectionOptions.logger = this.logger;\n }\n // Now create the connection\n if (!this.url) {\n throw new Error(\"The 'HubConnectionBuilder.withUrl' method must be called before building the connection.\");\n }\n const connection = new HttpConnection(this.url, httpConnectionOptions);\n return HubConnection.create(connection, this.logger || NullLogger.instance, this.protocol || new JsonHubProtocol(), this.reconnectPolicy);\n }\n}\nfunction isLogger(logger) {\n return logger.log !== undefined;\n}\n","import { Injectable } from '@angular/core';\r\nimport { HubConnection, HubConnectionBuilder } from '@microsoft/signalr';\r\nimport { BehaviorSubject, ReplaySubject } from 'rxjs';\r\nimport { environment } from 'src/environments/environment';\r\nimport { LibraryModifiedEvent } from '../_models/events/library-modified-event';\r\nimport { NotificationProgressEvent } from '../_models/events/notification-progress-event';\r\nimport { ThemeProgressEvent } from '../_models/events/theme-progress-event';\r\nimport { UserUpdateEvent } from '../_models/events/user-update-event';\r\nimport { User } from '../_models/user';\r\nimport {DashboardUpdateEvent} from \"../_models/events/dashboard-update-event\";\r\nimport {SideNavUpdateEvent} from \"../_models/events/sidenav-update-event\";\r\nimport {SiteThemeUpdatedEvent} from \"../_models/events/site-theme-updated-event\";\r\n\r\nexport enum EVENTS {\r\n UpdateAvailable = 'UpdateAvailable',\r\n ScanSeries = 'ScanSeries',\r\n SeriesAdded = 'SeriesAdded',\r\n SeriesRemoved = 'SeriesRemoved',\r\n ScanLibraryProgress = 'ScanLibraryProgress',\r\n OnlineUsers = 'OnlineUsers',\r\n /**\r\n * When a Collection has been updated\r\n */\r\n CollectionUpdated = 'CollectionUpdated',\r\n /**\r\n * A generic error that occurs during operations on the server\r\n */\r\n Error = 'Error',\r\n BackupDatabaseProgress = 'BackupDatabaseProgress',\r\n /**\r\n * A subtype of NotificationProgress that represents maintenance cleanup on server-owned resources\r\n */\r\n CleanupProgress = 'CleanupProgress',\r\n /**\r\n * A subtype of NotificationProgress that represnts a user downloading a file or group of files.\r\n * Note: In v0.5.5, this is being replaced by an inbrowser experience. The message is changed and this will be moved to dashboard view once built\r\n */\r\n DownloadProgress = 'DownloadProgress',\r\n /**\r\n * A generic progress event\r\n */\r\n NotificationProgress = 'NotificationProgress',\r\n /**\r\n * A subtype of NotificationProgress that represents the underlying file being processed during a scan\r\n */\r\n FileScanProgress = 'FileScanProgress',\r\n /**\r\n * A subtype of NotificationProgress that represents a single series being processed (into the DB)\r\n */\r\n ScanProgress = 'ScanProgress',\r\n /**\r\n * A custom user site theme is added or removed during a scan\r\n */\r\n SiteThemeProgress = 'SiteThemeProgress',\r\n /**\r\n * A cover is updated\r\n */\r\n CoverUpdate = 'CoverUpdate',\r\n /**\r\n * A subtype of NotificationProgress that represents a file being processed for cover image extraction\r\n */\r\n CoverUpdateProgress = 'CoverUpdateProgress',\r\n /**\r\n * A library is created or removed from the instance\r\n */\r\n LibraryModified = 'LibraryModified',\r\n /**\r\n * A user updates an entities read progress\r\n */\r\n UserProgressUpdate = 'UserProgressUpdate',\r\n /**\r\n * A user updates account or preferences\r\n */\r\n UserUpdate = 'UserUpdate',\r\n /**\r\n * When bulk bookmarks are being converted\r\n */\r\n ConvertBookmarksProgress = 'ConvertBookmarksProgress',\r\n /**\r\n * When files are being scanned to calculate word count\r\n */\r\n WordCountAnalyzerProgress = 'WordCountAnalyzerProgress',\r\n /**\r\n * When the user needs to be informed, but it's not a big deal\r\n */\r\n Info = 'Info',\r\n /**\r\n * A user is sending files to their device\r\n */\r\n SendingToDevice = 'SendingToDevice',\r\n /**\r\n * A scrobbling token has expired\r\n */\r\n ScrobblingKeyExpired = 'ScrobblingKeyExpired',\r\n /**\r\n * User's dashboard needs to be re-rendered\r\n */\r\n DashboardUpdate = 'DashboardUpdate',\r\n /**\r\n * User's sidenav needs to be re-rendered\r\n */\r\n SideNavUpdate = 'SideNavUpdate',\r\n /**\r\n * A Theme was updated and UI should refresh to get the latest version\r\n */\r\n SiteThemeUpdated = 'SiteThemeUpdated',\r\n /**\r\n * A Progress event when a smart collection is synchronizing\r\n */\r\n SmartCollectionSync = 'SmartCollectionSync'\r\n}\r\n\r\nexport interface Message {\r\n event: EVENTS;\r\n payload: T;\r\n}\r\n\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class MessageHubService {\r\n hubUrl = environment.hubUrl;\r\n private hubConnection!: HubConnection;\r\n\r\n private messagesSource = new ReplaySubject>(1);\r\n private onlineUsersSource = new BehaviorSubject([]); // UserNames\r\n\r\n /**\r\n * Any events that come from the backend\r\n */\r\n public messages$ = this.messagesSource.asObservable();\r\n /**\r\n * Users that are online\r\n */\r\n public onlineUsers$ = this.onlineUsersSource.asObservable();\r\n\r\n constructor() {}\r\n\r\n /**\r\n * Tests that an event is of the type passed\r\n * @param event\r\n * @param eventType\r\n * @returns\r\n */\r\n public isEventType(event: Message, eventType: EVENTS) {\r\n if (event.event == EVENTS.NotificationProgress) {\r\n const notification = event.payload as NotificationProgressEvent;\r\n return notification.eventType.toLowerCase() == eventType.toLowerCase();\r\n }\r\n return event.event === eventType;\r\n }\r\n\r\n createHubConnection(user: User) {\r\n this.hubConnection = new HubConnectionBuilder()\r\n .withUrl(this.hubUrl + 'messages', {\r\n accessTokenFactory: () => user.token\r\n })\r\n .withAutomaticReconnect()\r\n //.withStatefulReconnect() // Requires signalr@8.0\r\n .build();\r\n\r\n this.hubConnection\r\n .start()\r\n .catch(err => console.error(err));\r\n\r\n this.hubConnection.on(EVENTS.OnlineUsers, (usernames: string[]) => {\r\n this.onlineUsersSource.next(usernames);\r\n });\r\n\r\n this.hubConnection.on(EVENTS.ScanSeries, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.ScanSeries,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.ScanLibraryProgress, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.ScanLibraryProgress,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.ConvertBookmarksProgress, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.ConvertBookmarksProgress,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.WordCountAnalyzerProgress, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.WordCountAnalyzerProgress,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.LibraryModified, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.LibraryModified,\r\n payload: resp.body as LibraryModifiedEvent\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.SmartCollectionSync, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.NotificationProgress,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.SiteThemeUpdated, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.SiteThemeUpdated,\r\n payload: resp.body as SiteThemeUpdatedEvent\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.DashboardUpdate, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.DashboardUpdate,\r\n payload: resp.body as DashboardUpdateEvent\r\n });\r\n });\r\n this.hubConnection.on(EVENTS.SideNavUpdate, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.SideNavUpdate,\r\n payload: resp.body as SideNavUpdateEvent\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.NotificationProgress, (resp: NotificationProgressEvent) => {\r\n this.messagesSource.next({\r\n event: EVENTS.NotificationProgress,\r\n payload: resp\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.SiteThemeProgress, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.SiteThemeProgress,\r\n payload: resp.body as ThemeProgressEvent\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.CollectionUpdated, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.CollectionUpdated,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.UserProgressUpdate, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.UserProgressUpdate,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.UserUpdate, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.UserUpdate,\r\n payload: resp.body as UserUpdateEvent\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.Error, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.Error,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.Info, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.Info,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.SeriesAdded, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.SeriesAdded,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.SeriesRemoved, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.SeriesRemoved,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.CoverUpdate, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.CoverUpdate,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.UpdateAvailable, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.UpdateAvailable,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.SendingToDevice, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.SendingToDevice,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.ScrobblingKeyExpired, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.ScrobblingKeyExpired,\r\n payload: resp.body\r\n });\r\n });\r\n }\r\n\r\n stopHubConnection() {\r\n if (this.hubConnection) {\r\n this.hubConnection.stop().catch(err => console.error(err));\r\n }\r\n }\r\n\r\n sendMessage(methodName: string, body?: any) {\r\n return this.hubConnection.invoke(methodName, body);\r\n }\r\n\r\n}\r\n","/**\r\n * Where does the theme come from\r\n */\r\n export enum ThemeProvider {\r\n System = 1,\r\n Custom = 2,\r\n }\r\n\r\n /**\r\n * Theme for the whole instance\r\n */\r\n export interface SiteTheme {\r\n id: number;\r\n name: string;\r\n normalizedName: string;\r\n filePath: string;\r\n isDefault: boolean;\r\n provider: ThemeProvider;\r\n /**\r\n * The actual class the root is defined against. It is generated at the backend.\r\n */\r\n selector: string;\r\n description: string;\r\n previewUrls: Array;\r\n author: string;\r\n\r\n }\r\n","import { inject } from '@angular/core';\r\nimport { Pipe, PipeTransform, SecurityContext } from '@angular/core';\r\nimport { DomSanitizer } from '@angular/platform-browser';\r\n\r\n@Pipe({\r\n name: 'safeHtml',\r\n pure: true,\r\n standalone: true\r\n})\r\nexport class SafeHtmlPipe implements PipeTransform {\r\n private readonly dom: DomSanitizer = inject(DomSanitizer);\r\n constructor() {}\r\n\r\n transform(value: string): string | null {\r\n return this.dom.sanitize(SecurityContext.HTML, value);\r\n }\r\n\r\n}\r\n","import { Component, OnInit } from '@angular/core';\r\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\r\nimport { ConfirmButton } from './_models/confirm-button';\r\nimport { ConfirmConfig } from './_models/confirm-config';\r\nimport {CommonModule} from \"@angular/common\";\r\nimport {SafeHtmlPipe} from \"../../_pipes/safe-html.pipe\";\r\nimport {TranslocoDirective} from \"@ngneat/transloco\";\r\n\r\n@Component({\r\n selector: 'app-confirm-dialog',\r\n standalone: true,\r\n imports: [CommonModule, SafeHtmlPipe, TranslocoDirective],\r\n templateUrl: './confirm-dialog.component.html',\r\n styleUrls: ['./confirm-dialog.component.scss']\r\n})\r\nexport class ConfirmDialogComponent implements OnInit {\r\n\r\n config!: ConfirmConfig;\r\n\r\n constructor(public modal: NgbActiveModal) {}\r\n\r\n ngOnInit(): void {\r\n if (this.config) {\r\n this.config.buttons.sort(this._button_sort);\r\n }\r\n }\r\n\r\n private _button_sort(x: ConfirmButton, y: ConfirmButton) {\r\n const xIsSecondary = x.type === 'secondary';\r\n const yIsSecondary = y.type === 'secondary';\r\n if (xIsSecondary && !yIsSecondary) {\r\n return -1;\r\n } else if (!xIsSecondary && yIsSecondary) {\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n clickButton(button: ConfirmButton) {\r\n this.modal.close(button.type === 'primary');\r\n }\r\n\r\n close() {\r\n this.modal.close(false);\r\n }\r\n\r\n}\r\n","\r\n
\r\n

{{config.header}}

\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n\r\n
\r\n","import { ConfirmButton } from './confirm-button';\r\n\r\nexport class ConfirmConfig {\r\n _type: string = 'confirm'; // internal only: confirm or alert (todo: use enum)\r\n header: string = 'Confirm';\r\n content: string = '';\r\n buttons: Array = [];\r\n /**\r\n * If the close button shouldn't be rendered\r\n */\r\n disableEscape: boolean = false;\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { NgbModal } from '@ng-bootstrap/ng-bootstrap';\r\nimport { take } from 'rxjs/operators';\r\nimport { ConfirmDialogComponent } from './confirm-dialog/confirm-dialog.component';\r\nimport { ConfirmConfig } from './confirm-dialog/_models/confirm-config';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class ConfirmService {\r\n\r\n defaultConfirm = new ConfirmConfig();\r\n defaultAlert = new ConfirmConfig();\r\n\r\n constructor(private modalService: NgbModal) {\r\n this.defaultConfirm.buttons.push({text: 'Cancel', type: 'secondary'});\r\n this.defaultConfirm.buttons.push({text: 'Confirm', type: 'primary'});\r\n\r\n this.defaultAlert._type = 'alert';\r\n this.defaultAlert.header = 'Alert';\r\n this.defaultAlert.buttons.push({text: 'Ok', type: 'primary'});\r\n\r\n }\r\n\r\n public async confirm(content?: string, config?: ConfirmConfig): Promise {\r\n\r\n return new Promise((resolve, reject) => {\r\n if (content === undefined && config === undefined) {\r\n console.error('Confirm must have either text or a config object passed');\r\n return reject(false);\r\n }\r\n\r\n if (content !== undefined && config === undefined) {\r\n config = this.defaultConfirm;\r\n config.content = content;\r\n }\r\n if (content !== undefined && content !== '' && config!.content === '') {\r\n config!.content = content;\r\n }\r\n\r\n const modalRef = this.modalService.open(ConfirmDialogComponent);\r\n modalRef.componentInstance.config = config;\r\n modalRef.closed.pipe(take(1)).subscribe(result => {\r\n return resolve(result);\r\n });\r\n modalRef.dismissed.pipe(take(1)).subscribe(() => {\r\n return resolve(false);\r\n });\r\n });\r\n\r\n }\r\n\r\n public async alert(content?: string, config?: ConfirmConfig): Promise {\r\n return new Promise((resolve, reject) => {\r\n if (content === undefined && config === undefined) {\r\n console.error('Alert must have either text or a config object passed');\r\n return reject(false);\r\n }\r\n\r\n if (content !== undefined && config === undefined) {\r\n config = this.defaultConfirm;\r\n config.content = content;\r\n }\r\n\r\n const modalRef = this.modalService.open(ConfirmDialogComponent, {size: \"lg\", fullscreen: \"md\"});\r\n modalRef.componentInstance.config = config;\r\n modalRef.closed.pipe(take(1)).subscribe(result => {\r\n return resolve(result);\r\n });\r\n modalRef.dismissed.pipe(take(1)).subscribe(() => {\r\n return resolve(false);\r\n });\r\n })\r\n }\r\n}\r\n","import {DOCUMENT} from '@angular/common';\r\nimport {HttpClient} from '@angular/common/http';\r\nimport {DestroyRef, inject, Inject, Injectable, Renderer2, RendererFactory2, SecurityContext} from '@angular/core';\r\nimport {DomSanitizer} from '@angular/platform-browser';\r\nimport {ToastrService} from 'ngx-toastr';\r\nimport {map, ReplaySubject, take} from 'rxjs';\r\nimport {environment} from 'src/environments/environment';\r\nimport {ConfirmService} from '../shared/confirm.service';\r\nimport {NotificationProgressEvent} from '../_models/events/notification-progress-event';\r\nimport {SiteTheme, ThemeProvider} from '../_models/preferences/site-theme';\r\nimport {TextResonse} from '../_types/text-response';\r\nimport {EVENTS, MessageHubService} from './message-hub.service';\r\nimport {takeUntilDestroyed} from \"@angular/core/rxjs-interop\";\r\nimport {translate} from \"@ngneat/transloco\";\r\nimport {DownloadableSiteTheme} from \"../_models/theme/downloadable-site-theme\";\r\nimport {NgxFileDropEntry} from \"ngx-file-drop\";\r\nimport {SiteThemeUpdatedEvent} from \"../_models/events/site-theme-updated-event\";\r\n\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class ThemeService {\r\n\r\n private readonly destroyRef = inject(DestroyRef);\r\n public defaultTheme: string = 'dark';\r\n public defaultBookTheme: string = 'Dark';\r\n\r\n private currentThemeSource = new ReplaySubject(1);\r\n public currentTheme$ = this.currentThemeSource.asObservable();\r\n\r\n private themesSource = new ReplaySubject(1);\r\n public themes$ = this.themesSource.asObservable();\r\n\r\n /**\r\n * Maintain a cache of themes. SignalR will inform us if we need to refresh cache\r\n */\r\n private themeCache: Array = [];\r\n\r\n private renderer: Renderer2;\r\n private baseUrl = environment.apiUrl;\r\n\r\n\r\n constructor(rendererFactory: RendererFactory2, @Inject(DOCUMENT) private document: Document, private httpClient: HttpClient,\r\n messageHub: MessageHubService, private domSanitizer: DomSanitizer, private confirmService: ConfirmService, private toastr: ToastrService) {\r\n this.renderer = rendererFactory.createRenderer(null, null);\r\n\r\n messageHub.messages$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(message => {\r\n\r\n if (message.event === EVENTS.NotificationProgress) {\r\n const notificationEvent = (message.payload as NotificationProgressEvent);\r\n if (notificationEvent.name !== EVENTS.SiteThemeProgress) return;\r\n\r\n if (notificationEvent.eventType === 'ended') {\r\n if (notificationEvent.name === EVENTS.SiteThemeProgress) this.getThemes().subscribe();\r\n }\r\n return;\r\n }\r\n\r\n if (message.event === EVENTS.SiteThemeUpdated) {\r\n const evt = (message.payload as SiteThemeUpdatedEvent);\r\n this.currentTheme$.pipe(take(1)).subscribe(currentTheme => {\r\n if (currentTheme && currentTheme.name !== EVENTS.SiteThemeProgress) return;\r\n console.log('Active theme has been updated, refreshing theme');\r\n this.setTheme(currentTheme.name);\r\n\r\n });\r\n }\r\n\r\n\r\n });\r\n }\r\n\r\n getDownloadableThemes() {\r\n return this.httpClient.get>(this.baseUrl + 'theme/browse');\r\n }\r\n\r\n downloadTheme(theme: DownloadableSiteTheme) {\r\n return this.httpClient.post(this.baseUrl + 'theme/download-theme', theme);\r\n }\r\n\r\n uploadTheme(themeFile: File, fileEntry: NgxFileDropEntry) {\r\n const formData = new FormData()\r\n formData.append('formFile', themeFile, fileEntry.relativePath);\r\n\r\n return this.httpClient.post(this.baseUrl + 'theme/upload-theme', formData);\r\n }\r\n\r\n getColorScheme() {\r\n return getComputedStyle(this.document.body).getPropertyValue('--color-scheme').trim();\r\n }\r\n\r\n /**\r\n * --theme-color from theme. Updates the meta tag\r\n * @returns\r\n */\r\n getThemeColor() {\r\n return getComputedStyle(this.document.body).getPropertyValue('--theme-color').trim();\r\n }\r\n\r\n /**\r\n * --msapplication-TileColor from theme. Updates the meta tag\r\n * @returns\r\n */\r\n getTileColor() {\r\n return getComputedStyle(this.document.body).getPropertyValue('--title-color').trim();\r\n }\r\n\r\n getCssVariable(variable: string) {\r\n return getComputedStyle(this.document.body).getPropertyValue(variable).trim();\r\n }\r\n\r\n isDarkTheme() {\r\n return this.getColorScheme().toLowerCase() === 'dark';\r\n }\r\n\r\n getThemes() {\r\n return this.httpClient.get(this.baseUrl + 'theme').pipe(map(themes => {\r\n this.themeCache = themes;\r\n this.themesSource.next(themes);\r\n this.currentTheme$.pipe(take(1)).subscribe(theme => {\r\n if (themes.filter(t => t.id === theme.id).length === 0) {\r\n this.setTheme(this.defaultTheme);\r\n this.toastr.info(translate('toasts.theme-missing'));\r\n }\r\n });\r\n return themes;\r\n }));\r\n }\r\n\r\n /**\r\n * Used in book reader to remove all themes so book reader can provide custom theming options\r\n */\r\n clearThemes() {\r\n this.unsetThemes();\r\n }\r\n\r\n deleteTheme(themeId: number) {\r\n return this.httpClient.delete(this.baseUrl + 'theme?themeId=' + themeId).pipe(map(() => {\r\n this.getThemes().subscribe(() => {});\r\n }));\r\n }\r\n\r\n setDefault(themeId: number) {\r\n return this.httpClient.post(this.baseUrl + 'theme/update-default', {themeId: themeId}).pipe(map(() => {\r\n // Refresh the cache when a default state is changed\r\n this.getThemes().subscribe(() => {});\r\n }));\r\n }\r\n\r\n scan() {\r\n return this.httpClient.post(this.baseUrl + 'theme/scan', {});\r\n }\r\n\r\n /**\r\n * Sets the book theme on the body tag so css variable overrides can take place\r\n * @param selector brtheme- prefixed string\r\n */\r\n setBookTheme(selector: string) {\r\n this.unsetBookThemes();\r\n this.renderer.addClass(this.document.querySelector('body'), selector);\r\n }\r\n\r\n clearBookTheme() {\r\n this.unsetBookThemes();\r\n }\r\n\r\n\r\n /**\r\n * Sets the theme as active. Will inject a style tag into document to load a custom theme and apply the selector to the body\r\n * @param themeName\r\n */\r\n setTheme(themeName: string) {\r\n const theme = this.themeCache.find(t => t.name.toLowerCase() === themeName.toLowerCase());\r\n if (theme) {\r\n this.unsetThemes();\r\n this.renderer.addClass(this.document.querySelector('body'), theme.selector);\r\n\r\n if (theme.provider !== ThemeProvider.System && !this.hasThemeInHead(theme.name)) {\r\n // We need to load the styles into the browser\r\n this.fetchThemeContent(theme.id).subscribe(async (content) => {\r\n if (content === null) {\r\n await this.confirmService.alert(translate('toasts.alert-bad-theme'));\r\n this.setTheme('dark');\r\n return;\r\n }\r\n const styleElem = this.document.createElement('style');\r\n styleElem.id = 'theme-' + theme.name;\r\n styleElem.appendChild(this.document.createTextNode(content));\r\n\r\n this.renderer.appendChild(this.document.head, styleElem);\r\n\r\n // Check if the theme has --theme-color and apply it to meta tag\r\n const themeColor = this.getThemeColor();\r\n if (themeColor) {\r\n this.document.querySelector('meta[name=\"theme-color\"]')?.setAttribute('content', themeColor);\r\n this.document.querySelector('meta[name=\"apple-mobile-web-app-status-bar-style\"]')?.setAttribute('content', themeColor);\r\n }\r\n\r\n const tileColor = this.getTileColor();\r\n if (tileColor) {\r\n this.document.querySelector('meta[name=\"msapplication-TileColor\"]')?.setAttribute('content', themeColor);\r\n }\r\n\r\n const colorScheme = this.getColorScheme();\r\n if (colorScheme) {\r\n this.document.querySelector('body')?.setAttribute('theme', colorScheme);\r\n }\r\n\r\n this.currentThemeSource.next(theme);\r\n });\r\n } else {\r\n this.currentThemeSource.next(theme);\r\n }\r\n } else {\r\n // Only time themes isn't already loaded is on first load\r\n this.getThemes().subscribe(themes => {\r\n this.setTheme(themeName);\r\n });\r\n }\r\n }\r\n\r\n private hasThemeInHead(themeName: string) {\r\n const id = 'theme-' + themeName.toLowerCase();\r\n return Array.from(this.document.head.children).filter(el => el.tagName === 'STYLE' && el.id.toLowerCase() === id).length > 0;\r\n }\r\n\r\n private fetchThemeContent(themeId: number) {\r\n return this.httpClient.get(this.baseUrl + 'theme/download-content?themeId=' + themeId, TextResonse).pipe(map(encodedCss => {\r\n return this.domSanitizer.sanitize(SecurityContext.STYLE, encodedCss);\r\n }));\r\n }\r\n\r\n private unsetThemes() {\r\n this.themeCache.forEach(theme => this.document.body.classList.remove(theme.selector));\r\n }\r\n\r\n private unsetBookThemes() {\r\n Array.from(this.document.body.classList).filter(cls => cls.startsWith('brtheme-')).forEach(c => this.document.body.classList.remove(c));\r\n }\r\n\r\n\r\n}\r\n","import { HttpClient } from '@angular/common/http';\r\nimport {DestroyRef, inject, Injectable } from '@angular/core';\r\nimport {catchError, of, ReplaySubject, throwError} from 'rxjs';\r\nimport {filter, map, switchMap, tap} from 'rxjs/operators';\r\nimport { environment } from 'src/environments/environment';\r\nimport { Preferences } from '../_models/preferences/preferences';\r\nimport { User } from '../_models/user';\r\nimport { Router } from '@angular/router';\r\nimport { EVENTS, MessageHubService } from './message-hub.service';\r\nimport { ThemeService } from './theme.service';\r\nimport { InviteUserResponse } from '../_models/auth/invite-user-response';\r\nimport { UserUpdateEvent } from '../_models/events/user-update-event';\r\nimport { AgeRating } from '../_models/metadata/age-rating';\r\nimport { AgeRestriction } from '../_models/metadata/age-restriction';\r\nimport { TextResonse } from '../_types/text-response';\r\nimport {takeUntilDestroyed} from \"@angular/core/rxjs-interop\";\r\n\r\nexport enum Role {\r\n Admin = 'Admin',\r\n ChangePassword = 'Change Password',\r\n Bookmark = 'Bookmark',\r\n Download = 'Download',\r\n ChangeRestriction = 'Change Restriction',\r\n ReadOnly = 'Read Only',\r\n Login = 'Login',\r\n Promote = 'Promote',\r\n}\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AccountService {\r\n\r\n private readonly destroyRef = inject(DestroyRef);\r\n\r\n baseUrl = environment.apiUrl;\r\n userKey = 'kavita-user';\r\n public static lastLoginKey = 'kavita-lastlogin';\r\n public static localeKey = 'kavita-locale';\r\n private currentUser: User | undefined;\r\n\r\n // Stores values, when someone subscribes gives (1) of last values seen.\r\n private currentUserSource = new ReplaySubject(1);\r\n public currentUser$ = this.currentUserSource.asObservable();\r\n\r\n private hasValidLicenseSource = new ReplaySubject(1);\r\n /**\r\n * Does the user have an active license\r\n */\r\n public hasValidLicense$ = this.hasValidLicenseSource.asObservable();\r\n\r\n /**\r\n * SetTimeout handler for keeping track of refresh token call\r\n */\r\n private refreshTokenTimeout: ReturnType | undefined;\r\n\r\n private isOnline: boolean = true;\r\n\r\n constructor(private httpClient: HttpClient, private router: Router,\r\n private messageHub: MessageHubService, private themeService: ThemeService) {\r\n messageHub.messages$.pipe(filter(evt => evt.event === EVENTS.UserUpdate),\r\n map(evt => evt.payload as UserUpdateEvent),\r\n filter(userUpdateEvent => userUpdateEvent.userName === this.currentUser?.username),\r\n switchMap(() => this.refreshAccount()))\r\n .subscribe(() => {});\r\n\r\n window.addEventListener(\"offline\", (e) => {\r\n this.isOnline = false;\r\n });\r\n\r\n window.addEventListener(\"online\", (e) => {\r\n this.isOnline = true;\r\n this.refreshToken().subscribe();\r\n });\r\n }\r\n\r\n hasAdminRole(user: User) {\r\n return user && user.roles.includes(Role.Admin);\r\n }\r\n\r\n hasChangePasswordRole(user: User) {\r\n return user && user.roles.includes(Role.ChangePassword);\r\n }\r\n\r\n hasChangeAgeRestrictionRole(user: User) {\r\n return user && user.roles.includes(Role.ChangeRestriction);\r\n }\r\n\r\n hasDownloadRole(user: User) {\r\n return user && user.roles.includes(Role.Download);\r\n }\r\n\r\n hasBookmarkRole(user: User) {\r\n return user && user.roles.includes(Role.Bookmark);\r\n }\r\n\r\n hasReadOnlyRole(user: User) {\r\n return user && user.roles.includes(Role.ReadOnly);\r\n }\r\n\r\n hasPromoteRole(user: User) {\r\n return user && user.roles.includes(Role.Promote) || user.roles.includes(Role.Admin);\r\n }\r\n\r\n getRoles() {\r\n return this.httpClient.get(this.baseUrl + 'account/roles');\r\n }\r\n\r\n deleteLicense() {\r\n return this.httpClient.delete(this.baseUrl + 'license', TextResonse);\r\n }\r\n\r\n resetLicense(license: string, email: string) {\r\n return this.httpClient.post(this.baseUrl + 'license/reset', {license, email}, TextResonse);\r\n }\r\n\r\n hasValidLicense(forceCheck: boolean = false) {\r\n console.log('hasValidLicense being called: ', forceCheck);\r\n return this.httpClient.get(this.baseUrl + 'license/valid-license?forceCheck=' + forceCheck, TextResonse)\r\n .pipe(\r\n map(res => res === \"true\"),\r\n tap(res => {\r\n this.hasValidLicenseSource.next(res)\r\n }),\r\n catchError(error => {\r\n this.hasValidLicenseSource.next(false);\r\n return throwError(error); // Rethrow the error to propagate it further\r\n })\r\n );\r\n }\r\n\r\n hasAnyLicense() {\r\n return this.httpClient.get(this.baseUrl + 'license/has-license', TextResonse)\r\n .pipe(\r\n map(res => res === \"true\"),\r\n );\r\n }\r\n\r\n updateUserLicense(license: string, email: string, discordId?: string) {\r\n return this.httpClient.post(this.baseUrl + 'license', {license, email, discordId}, TextResonse)\r\n .pipe(map(res => res === \"true\"));\r\n }\r\n\r\n login(model: {username: string, password: string, apiKey?: string}) {\r\n return this.httpClient.post(this.baseUrl + 'account/login', model).pipe(\r\n tap((response: User) => {\r\n const user = response;\r\n if (user) {\r\n this.setCurrentUser(user);\r\n }\r\n }),\r\n takeUntilDestroyed(this.destroyRef)\r\n );\r\n }\r\n\r\n setCurrentUser(user?: User) {\r\n if (user) {\r\n user.roles = [];\r\n const roles = this.getDecodedToken(user.token).role;\r\n Array.isArray(roles) ? user.roles = roles : user.roles.push(roles);\r\n\r\n localStorage.setItem(this.userKey, JSON.stringify(user));\r\n localStorage.setItem(AccountService.lastLoginKey, user.username);\r\n\r\n if (user.preferences && user.preferences.theme) {\r\n this.themeService.setTheme(user.preferences.theme.name);\r\n } else {\r\n this.themeService.setTheme(this.themeService.defaultTheme);\r\n }\r\n } else {\r\n this.themeService.setTheme(this.themeService.defaultTheme);\r\n }\r\n\r\n this.currentUser = user;\r\n this.currentUserSource.next(user);\r\n\r\n this.stopRefreshTokenTimer();\r\n\r\n if (this.currentUser) {\r\n // BUG: StopHubConnection has a promise in it, this needs to be async\r\n // But that really messes everything up\r\n this.messageHub.stopHubConnection();\r\n this.messageHub.createHubConnection(this.currentUser);\r\n this.hasValidLicense().subscribe();\r\n this.startRefreshTokenTimer();\r\n }\r\n }\r\n\r\n logout() {\r\n localStorage.removeItem(this.userKey);\r\n this.currentUserSource.next(undefined);\r\n this.currentUser = undefined;\r\n this.stopRefreshTokenTimer();\r\n this.messageHub.stopHubConnection();\r\n // Upon logout, perform redirection\r\n this.router.navigateByUrl('/login');\r\n }\r\n\r\n\r\n /**\r\n * Registers the first admin on the account. Only used for that. All other registrations must occur through invite\r\n * @param model\r\n * @returns\r\n */\r\n register(model: {username: string, password: string, email: string}) {\r\n return this.httpClient.post(this.baseUrl + 'account/register', model).pipe(\r\n map((user: User) => {\r\n return user;\r\n }),\r\n takeUntilDestroyed(this.destroyRef)\r\n );\r\n }\r\n\r\n isEmailConfirmed() {\r\n return this.httpClient.get(this.baseUrl + 'account/email-confirmed');\r\n }\r\n\r\n isEmailValid() {\r\n return this.httpClient.get(this.baseUrl + 'account/is-email-valid', TextResonse)\r\n .pipe(map(res => res == \"true\"));\r\n }\r\n\r\n confirmMigrationEmail(model: {email: string, token: string}) {\r\n return this.httpClient.post(this.baseUrl + 'account/confirm-migration-email', model);\r\n }\r\n\r\n resendConfirmationEmail(userId: number) {\r\n return this.httpClient.post(this.baseUrl + 'account/resend-confirmation-email?userId=' + userId, {});\r\n }\r\n\r\n inviteUser(model: {email: string, roles: Array, libraries: Array, ageRestriction: AgeRestriction}) {\r\n return this.httpClient.post(this.baseUrl + 'account/invite', model);\r\n }\r\n\r\n confirmEmail(model: {email: string, username: string, password: string, token: string}) {\r\n return this.httpClient.post(this.baseUrl + 'account/confirm-email', model);\r\n }\r\n\r\n confirmEmailUpdate(model: {email: string, token: string}) {\r\n return this.httpClient.post(this.baseUrl + 'account/confirm-email-update', model);\r\n }\r\n\r\n /**\r\n * Given a user id, returns a full url for setting up the user account\r\n * @param userId\r\n * @param withBaseUrl Should base url be included in invite url\r\n * @returns\r\n */\r\n getInviteUrl(userId: number, withBaseUrl: boolean = true) {\r\n return this.httpClient.get(this.baseUrl + 'account/invite-url?userId=' + userId + '&withBaseUrl=' + withBaseUrl, TextResonse);\r\n }\r\n\r\n getDecodedToken(token: string) {\r\n return JSON.parse(atob(token.split('.')[1]));\r\n }\r\n\r\n requestResetPasswordEmail(email: string) {\r\n return this.httpClient.post(this.baseUrl + 'account/forgot-password?email=' + encodeURIComponent(email), {}, TextResonse);\r\n }\r\n\r\n confirmResetPasswordEmail(model: {email: string, token: string, password: string}) {\r\n return this.httpClient.post(this.baseUrl + 'account/confirm-password-reset', model, TextResonse);\r\n }\r\n\r\n resetPassword(username: string, password: string, oldPassword: string) {\r\n return this.httpClient.post(this.baseUrl + 'account/reset-password', {username, password, oldPassword}, TextResonse);\r\n }\r\n\r\n update(model: {email: string, roles: Array, libraries: Array, userId: number, ageRestriction: AgeRestriction}) {\r\n return this.httpClient.post(this.baseUrl + 'account/update', model);\r\n }\r\n\r\n updateEmail(email: string, password: string) {\r\n return this.httpClient.post(this.baseUrl + 'account/update/email', {email, password});\r\n }\r\n\r\n updateAgeRestriction(ageRating: AgeRating, includeUnknowns: boolean) {\r\n return this.httpClient.post(this.baseUrl + 'account/update/age-restriction', {ageRating, includeUnknowns});\r\n }\r\n\r\n /**\r\n * This will get latest preferences for a user and cache them into user store\r\n * @returns\r\n */\r\n getPreferences() {\r\n return this.httpClient.get(this.baseUrl + 'users/get-preferences').pipe(map(pref => {\r\n if (this.currentUser !== undefined && this.currentUser !== null) {\r\n this.currentUser.preferences = pref;\r\n this.setCurrentUser(this.currentUser);\r\n }\r\n return pref;\r\n }), takeUntilDestroyed(this.destroyRef));\r\n }\r\n\r\n updatePreferences(userPreferences: Preferences) {\r\n return this.httpClient.post(this.baseUrl + 'users/update-preferences', userPreferences).pipe(map(settings => {\r\n if (this.currentUser !== undefined && this.currentUser !== null) {\r\n this.currentUser.preferences = settings;\r\n this.setCurrentUser(this.currentUser);\r\n\r\n // Update the locale on disk (for logout and compact-number pipe)\r\n localStorage.setItem(AccountService.localeKey, this.currentUser.preferences.locale);\r\n }\r\n return settings;\r\n }), takeUntilDestroyed(this.destroyRef));\r\n }\r\n\r\n getUserFromLocalStorage(): User | undefined {\r\n\r\n const userString = localStorage.getItem(this.userKey);\r\n\r\n if (userString) {\r\n return JSON.parse(userString)\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n resetApiKey() {\r\n return this.httpClient.post(this.baseUrl + 'account/reset-api-key', {}, TextResonse).pipe(map(key => {\r\n const user = this.getUserFromLocalStorage();\r\n if (user) {\r\n user.apiKey = key;\r\n\r\n localStorage.setItem(this.userKey, JSON.stringify(user));\r\n\r\n this.currentUserSource.next(user);\r\n this.currentUser = user;\r\n }\r\n return key;\r\n }));\r\n }\r\n\r\n getOpdsUrl() {\r\n return this.httpClient.get(this.baseUrl + 'account/opds-url', TextResonse);\r\n }\r\n\r\n\r\n refreshAccount() {\r\n if (this.currentUser === null || this.currentUser === undefined) return of();\r\n return this.httpClient.get(this.baseUrl + 'account/refresh-account').pipe(map((user: User) => {\r\n if (user) {\r\n this.currentUser = {...user};\r\n }\r\n\r\n this.setCurrentUser(this.currentUser);\r\n return user;\r\n }));\r\n }\r\n\r\n\r\n private refreshToken() {\r\n if (this.currentUser === null || this.currentUser === undefined || !this.isOnline) return of();\r\n return this.httpClient.post<{token: string, refreshToken: string}>(this.baseUrl + 'account/refresh-token',\r\n {token: this.currentUser.token, refreshToken: this.currentUser.refreshToken}).pipe(map(user => {\r\n if (this.currentUser) {\r\n this.currentUser.token = user.token;\r\n this.currentUser.refreshToken = user.refreshToken;\r\n }\r\n\r\n this.setCurrentUser(this.currentUser);\r\n return user;\r\n }));\r\n }\r\n\r\n /**\r\n * Every 10 mins refresh the token\r\n */\r\n private startRefreshTokenTimer() {\r\n if (this.currentUser === null || this.currentUser === undefined) {\r\n this.stopRefreshTokenTimer();\r\n return;\r\n }\r\n\r\n this.stopRefreshTokenTimer();\r\n\r\n this.refreshTokenTimeout = setInterval(() => this.refreshToken().subscribe(() => {}), (60 * 10_000));\r\n }\r\n\r\n private stopRefreshTokenTimer() {\r\n if (this.refreshTokenTimeout !== undefined) {\r\n clearInterval(this.refreshTokenTimeout);\r\n }\r\n }\r\n\r\n}\r\n"],"mappings":"mpCAmBA,IAAMA,EAAiB,UAMjBC,GAA+B,OAAO,YAAY,EAClDC,GAAN,KAAkB,CAChB,YAAYC,EAAQ,CAClB,KAAK,OAASA,GAAU,CAAC,CAC3B,CACA,IAAIC,EAAM,CACR,OAAO,OAAO,UAAU,eAAe,KAAK,KAAK,OAAQA,CAAI,CAC/D,CACA,IAAIA,EAAM,CACR,GAAI,KAAK,IAAIA,CAAI,EAAG,CAClB,IAAMC,EAAI,KAAK,OAAOD,CAAI,EAC1B,OAAO,MAAM,QAAQC,CAAC,EAAIA,EAAE,CAAC,EAAIA,CACnC,CACA,OAAO,IACT,CACA,OAAOD,EAAM,CACX,GAAI,KAAK,IAAIA,CAAI,EAAG,CAClB,IAAMC,EAAI,KAAK,OAAOD,CAAI,EAC1B,OAAO,MAA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,KAAKnD,WAAW,EAC7BU,EACR,CAAC,CACJ,CAGQF,cAAY,CAClB,OAAI,KAAKR,cAAgB,MAAQ,KAAKA,cAAgB2E,QAAa,CAAC,KAAKvF,SAAiBgI,EAAE,EACrF,KAAKjJ,WAAW+D,KAA4C,KAAKxD,QAAU,wBACjF,CAAC4E,MAAO,KAAKtD,YAAYsD,MAAO9C,aAAc,KAAKR,YAAYQ,YAAY,CAAC,EAAElB,KAAKM,EAAIc,IAClF,KAAKV,cACP,KAAKA,YAAYsD,MAAQ5C,EAAK4C,MAC9B,KAAKtD,YAAYQ,aAAeE,EAAKF,cAGvC,KAAK2C,eAAe,KAAKnD,WAAW,EAC7BU,EACR,CAAC,CACJ,CAKQ8D,wBAAsB,CAC5B,GAAI,KAAKxE,cAAgB,MAAQ,KAAKA,cAAgB2E,OAAW,CAC/D,KAAKN,sBAAqB,EAC1B,MACF,CAEA,KAAKA,sBAAqB,EAE1B,KAAKiD,oBAAsBC,YAAY,IAAM,KAAK/G,aAAY,EAAGJ,UAAU,IAAK,CAAE,CAAC,EAAI,GAAK,GAAO,CACrG,CAEQiE,uBAAqB,CACvB,KAAKiD,sBAAwB3C,QAC/B6C,cAAc,KAAKF,mBAAmB,CAE1C,GA1VcG,EAAA1D,aAAe,mBACf0D,EAAAd,UAAY,sDAPf1I,GAAcyJ,EAAAC,EAAA,EAAAD,EAAAE,CAAA,EAAAF,EAAAG,EAAA,EAAAH,EAAAI,EAAA,CAAA,CAAA,wBAAd7J,EAAc8J,QAAd9J,EAAc+J,UAAAC,WAFb,MAAM,CAAA,EAEd,IAAOhK,EAAPwJ,SAAOxJ,CAAc,GAAA","names":["PRIMARY_OUTLET","RouteTitleKey","ParamsAsMap","params","name","v","convertToParamMap","defaultUrlMatcher","segments","segmentGroup","route","parts","posParams","index","part","segment","shallowEqualArrays","a","b","shallowEqual","k1","getDataKeys","k2","key","i","equalArraysOrString","obj","aSorted","bSorted","val","last","wrapIntoObservable","value","isObservable","isPromise","from","of","pathCompareMap","equalSegmentGroups","containsSegmentGroup","paramCompareMap","equalParams","containsParams","containsTree","container","containee","options","matrixParams","equalPath","matrixParamsMatch","c","containsSegmentGroupHelper","containeePaths","current","next","containerPaths","containeeSegment","UrlTree","root","UrlSegmentGroup","queryParams","fragment","DEFAULT_SERIALIZER","children","serializePaths","UrlSegment","path","parameters","serializePath","equalSegments","as","bs","mapChildrenIntoArray","fn","res","childOutlet","child","UrlSerializer","_UrlSerializer","t","ɵɵdefineInjectable","DefaultUrlSerializer","url","p","UrlParser","tree","serializeSegment","query","serializeQueryParams","encodeUriFragment","primary","k","encodeUriString","s","encodeUriQuery","encodeUriSegment","decode","decodeQuery","serializeMatrixParams","strParams","SEGMENT_RE","matchSegments","str","match","MATRIX_PARAM_SEGMENT_RE","matchMatrixKeySegments","QUERY_PARAM_RE","matchQueryParams","QUERY_PARAM_VALUE_RE","matchUrlQueryParamValue","RuntimeError","valueMatch","decodedKey","decodedVal","currentVal","allowPrimary","outletName","createRoot","rootCandidate","squashSegmentGroup","newChildren","childCandidate","grandChildOutlet","grandChild","mergeTrivialChildren","isUrlTree","createUrlTreeFromSnapshot","relativeTo","commands","relativeToUrlSegmentGroup","createSegmentGroupFromRoute","createUrlTreeFromSegmentGroup","targetGroup","createSegmentGroupFromRouteRecursive","currentRoute","childOutlets","childSnapshot","rootSegmentGroup","nav","computeNavigation","position","findStartingPositionForTargetGroup","newSegmentGroup","updateSegmentGroupChildren","updateSegmentGroup","isMatrixParams","command","isCommandWithOutlets","oldRoot","oldSegmentGroup","qp","replaceSegment","newRoot","oldSegment","newSegment","Navigation","isAbsolute","numberOfDoubleDots","cmdWithOutlet","cmd","cmdIdx","outlets","urlPart","partIndex","Position","processChildren","target","modifier","createPositionApplyingDoubleDots","group","g","ci","dd","getOutlets","startIndex","m","prefixedWith","slicedCommands","createNewSegmentGroup","childrenOfEmptyChild","outlet","currentCommandIndex","currentPathIndex","noMatch","curr","compare","paths","createNewSegmentChildren","stringify","IMPERATIVE_NAVIGATION","EventType","RouterEvent","id","NavigationStart","navigationTrigger","restoredState","NavigationEnd","urlAfterRedirects","NavigationCancellationCode","NavigationSkippedCode","NavigationCancel","reason","code","NavigationSkipped","NavigationError","error","RoutesRecognized","state","GuardsCheckStart","GuardsCheckEnd","shouldActivate","ResolveStart","ResolveEnd","RouteConfigLoadStart","RouteConfigLoadEnd","ChildActivationStart","snapshot","ChildActivationEnd","ActivationStart","ActivationEnd","Scroll","routerEvent","anchor","pos","BeforeActivateRoutes","RedirectRequest","OutletContext","ChildrenOutletContexts","_ChildrenOutletContexts","childName","outlet","context","contexts","t","ɵɵdefineInjectable","Tree","root","p","n","findNode","findPath","c","cc","s","value","node","child","path","TreeNode","children","nodeChildrenAsMap","map","RouterState","snapshot","setRouterState","createEmptyState","rootComponent","createEmptyStateSnapshot","emptyUrl","BehaviorSubject","UrlSegment","emptyParams","emptyData","emptyQueryParams","fragment","activated","ActivatedRoute","PRIMARY_OUTLET","ActivatedRouteSnapshot","RouterStateSnapshot","urlSubject","paramsSubject","queryParamsSubject","fragmentSubject","dataSubject","component","futureSnapshot","d","RouteTitleKey","of","convertToParamMap","getInherited","route","parent","paramsInheritanceStrategy","inherited","routeConfig","__spreadValues","hasStaticTitle","url","params","queryParams","data","resolve","segment","matched","serializeNode","state","advanceActivatedRoute","currentSnapshot","nextSnapshot","shallowEqual","shallowEqualArrays","equalParamsAndUrlSegments","a","b","equalUrlParams","equalSegments","parentsMismatch","config","RouterOutlet","_RouterOutlet","EventEmitter","inject","ViewContainerRef","ChangeDetectorRef","EnvironmentInjector","INPUT_BINDER","changes","firstChange","previousValue","outletName","RuntimeError","cmp","ref","activatedRoute","environmentInjector","location","childContexts","injector","OutletInjector","ɵɵdefineDirective","ɵɵNgOnChangesFeature","token","notFoundValue","InjectionToken","RoutedComponentInputBinder","_RoutedComponentInputBinder","dataSubscription","combineLatest","switchMap","index","mirror","reflectComponentType","templateName","createRouterState","routeReuseStrategy","curr","prevState","createNode","createOrReuseChildren","detachedRouteHandle","tree","createActivatedRoute","NAVIGATION_CANCELING_ERROR","redirectingNavigationError","urlSerializer","redirect","redirectTo","navigationBehaviorOptions","isUrlTree","error","navigationCancelingError","NavigationCancellationCode","message","code","isRedirectingNavigationCancelingError","isNavigationCancelingError","ɵEmptyOutletComponent","_ɵEmptyOutletComponent","ɵɵdefineComponent","ɵɵStandaloneFeature","rf","ctx","ɵɵelement","getOrCreateRouteInjectorIfNeeded","currentInjector","createEnvironmentInjector","standardizeConfig","r","children","c","__spreadProps","__spreadValues","PRIMARY_OUTLET","ɵEmptyOutletComponent","getOutlet","route","sortByMatchingOutlets","routes","outletName","sortedConfig","getClosestRouteInjector","snapshot","s","activateRoutes","rootContexts","routeReuseStrategy","forwardEvent","inputBindingEnabled","map","t","ActivateRoutes","futureState","currState","parentContexts","futureRoot","currRoot","advanceActivatedRoute","futureNode","currNode","contexts","children","nodeChildrenAsMap","futureChild","childOutletName","v","parentContext","future","curr","context","route","treeNode","componentRef","c","ActivationEnd","ChildActivationEnd","stored","injector","getClosestRouteInjector","CanActivate","path","CanDeactivate","component","getAllRouteGuards","getChildRouteGuards","getCanActivateChild","p","canActivateChild","getTokenOrFunctionIdentity","tokenOrFunction","NOT_FOUND","result","isInjectable","futurePath","checks","prevChildren","getRouteGuards","k","deactivateRouteAndItsChildren","shouldRun","shouldRunGuardsAndResolvers","mode","equalPath","shallowEqual","equalParamsAndUrlSegments","childName","node","isFunction","isBoolean","isCanLoad","guard","isCanActivate","isCanActivateChild","isCanDeactivate","isCanMatch","isEmptyError","e","EmptyError","INITIAL_VALUE","prioritizedGuardValue","switchMap","obs","combineLatest","o","take","startWith","results","UrlTree","filter","item","checkGuards","mergeMap","targetSnapshot","currentSnapshot","canActivateChecks","canDeactivateChecks","of","__spreadProps","__spreadValues","runCanDeactivateChecks","canDeactivate","runCanActivateChecks","guardsResult","futureRSS","currRSS","from","check","runCanDeactivate","first","futureSnapshot","concatMap","concat","fireChildActivationStart","fireActivationStart","runCanActivateChild","runCanActivate","snapshot","ActivationStart","ChildActivationStart","futureARS","canActivate","canActivateObservables","defer","closestInjector","guardVal","runInInjectionContext","wrapIntoObservable","canActivateChildGuardsMapped","_","d","guardsMapped","currARS","canDeactivateObservables","runCanLoadGuards","segments","urlSerializer","canLoad","canLoadObservables","injectionToken","redirectIfUrlTree","pipe","tap","isUrlTree","redirectingNavigationError","runCanMatchGuards","canMatch","canMatchObservables","NoMatch","segmentGroup","AbsoluteRedirect","urlTree","noMatch$1","throwError","namedOutletsRedirect","redirectTo","throwError","RuntimeError","canLoadFails","route","navigationCancelingError","NavigationCancellationCode","ApplyRedirects","urlSerializer","urlTree","res","c","of","PRIMARY_OUTLET","segments","posParams","newTree","AbsoluteRedirect","newRoot","UrlTree","redirectToParams","actualParams","k","v","sourceName","group","updatedSegments","children","name","child","UrlSegmentGroup","redirectToSegments","actualSegments","s","redirectToUrlSegment","pos","idx","noMatch","matchWithChecks","segmentGroup","injector","result","match","getOrCreateRouteInjectorIfNeeded","runCanMatchGuards","map","__spreadValues","createWildcardMatchResult","defaultUrlMatcher","parameters","last","split","consumedSegments","slicedSegments","config","containsEmptyPathMatchesWithNamedOutlets","createChildrenForEmptyPaths","containsEmptyPathMatches","addEmptyPathsToChildrenIfNeeded","routes","r","emptyPathMatch","getOutlet","primarySegment","isImmediateMatch","rawSegment","outlet","noLeftoversInUrl","NoLeftoversInUrl","recognize$1","configLoader","rootComponentType","paramsInheritanceStrategy","Recognizer","MAX_ALLOWED_REDIRECTS","rootSegmentGroup","root","ActivatedRouteSnapshot","rootNode","TreeNode","routeState","RouterStateSnapshot","tree","createUrlTreeFromSnapshot","catchError","e","NoMatch","routeNode","parent","i","getInherited","n","childOutlets","from","concatMap","childOutlet","sortedConfig","sortByMatchingOutlets","scan","outletChildren","defaultIfEmpty","mergeMap","noMatch$1","mergedChildren","mergeEmptyPathMatches","sortActivatedRouteSnapshots","allowRedirects","first","x","isEmptyError","matched","positionalParamSegments","remainingSegments","newSegments","matchResult","switchMap","childConfig","childInjector","snapshot","getData","getResolve","matchedOnOutlet","runCanLoadGuards","shouldLoadResult","tap","cfg","nodes","a","b","hasEmptyPathConfig","node","mergedNodes","duplicateEmptyPathNode","resultNode","mergedNode","getData","route","getResolve","recognize","injector","configLoader","rootComponentType","config","serializer","paramsInheritanceStrategy","mergeMap","t","recognize$1","map","targetSnapshot","urlAfterRedirects","__spreadProps","__spreadValues","resolveData","canActivateChecks","of","routesWithResolversToRun","check","routesNeedingDataUpdates","newRoute","flattenRouteTree","routesProcessed","from","concatMap","runResolve","getInherited","tap","takeLast","_","EMPTY","descendants","child","futureARS","futureRSS","resolve","hasStaticTitle","RouteTitleKey","resolveNode","resolvedData","keys","getDataKeys","data","key","getResolver","first","value","mapTo","catchError","e","isEmptyError","throwError","injectionToken","closestInjector","getClosestRouteInjector","resolver","getTokenOrFunctionIdentity","resolverValue","runInInjectionContext","wrapIntoObservable","switchTap","next","switchMap","v","nextResult","TitleStrategy","_TitleStrategy","snapshot","pageTitle","PRIMARY_OUTLET","ɵɵdefineInjectable","inject","DefaultTitleStrategy","_DefaultTitleStrategy","title","ɵɵinject","Title","ROUTER_CONFIGURATION","InjectionToken","ROUTES","RouterConfigLoader","_RouterConfigLoader","Compiler","loadRunner","maybeUnwrapDefaultExport","component","finalize","loader","ConnectableObservable","Subject","refCount","parentInjector","loadChildren","compiler","onLoadEndListener","NgModuleFactory$1","factoryOrRoutes","rawRoutes","requireStandaloneComponents","standardizeConfig","isWrappedDefaultExport","input","UrlHandlingStrategy","_UrlHandlingStrategy","DefaultUrlHandlingStrategy","_DefaultUrlHandlingStrategy","url","newUrlPart","wholeUrl","CREATE_VIEW_TRANSITION","VIEW_TRANSITION_OPTIONS","createViewTransition","to","transitionOptions","document","DOCUMENT","NgZone","resolveViewTransitionStarted","viewTransitionStarted","transition","createRenderPromise","onViewTransitionCreated","afterNextRender","NavigationTransitions","_NavigationTransitions","EnvironmentInjector","UrlSerializer","ChildrenOutletContexts","Location","INPUT_BINDER","onLoadStart","r","RouteConfigLoadStart","onLoadEnd","RouteConfigLoadEnd","request","id","router","initialUrlTree","initialRouterState","BehaviorSubject","IMPERATIVE_NAVIGATION","filter","overallTransitionState","completed","errored","NavigationCancellationCode","urlTransition","onSameUrlNavigation","reason","NavigationSkipped","NavigationSkippedCode","NavigationStart","routesRecognized","RoutesRecognized","extractedUrl","source","restoredState","extras","navStart","createEmptyState","guardsStart","GuardsCheckStart","getAllRouteGuards","checkGuards","evt","isUrlTree","redirectingNavigationError","guardsEnd","GuardsCheckEnd","resolveStart","ResolveStart","dataResolved","resolveEnd","ResolveEnd","loadComponents","loaders","loadedComponent","combineLatest","defaultIfEmpty","take","currentSnapshot","targetRouterState","createRouterState","BeforeActivateRoutes","activateRoutes","NavigationEnd","takeUntil","err","isNavigationCancelingError","NavigationCancel","isRedirectingNavigationCancelingError","RedirectRequest","NavigationError","ee","code","navCancel","isBrowserTriggeredNavigation","RouteReuseStrategy","_RouteReuseStrategy","DefaultRouteReuseStrategy","BaseRouteReuseStrategy","detachedTree","future","curr","_DefaultRouteReuseStrategy","ɵDefaultRouteReuseStrategy_BaseFactory","ɵɵgetInheritedFactory","StateManager","_StateManager","HistoryStateManager","_HistoryStateManager","UrlTree","listener","event","currentTransition","rawUrl","path","currentBrowserPageId","state","navigation","restoringFromCaughtError","targetPagePosition","navigationId","routerPageId","ɵHistoryStateManager_BaseFactory","NavigationResult","afterNextNavigation","action","result","defaultErrorHandler","error","exactMatchOptions","subsetMatchOptions","Router","_Router","Console","PendingTasks","Subscription","subscription","currentNavigation","mergedTree","isPublicRouterEvent","stateCopy","urlTree","commands","navigationExtras","relativeTo","queryParams","fragment","queryParamsHandling","preserveFragment","f","q","relativeToUrlSegmentGroup","relativeToSnapshot","createSegmentGroupFromRoute","createUrlTreeFromSegmentGroup","validateCommands","matchOptions","options","containsTree","params","priorPromise","reject","promise","res","rej","taskId","i","RuntimeError","RouterLink","_RouterLink","tabIndexAttribute","renderer","el","locationStrategy","tagName","s","newTabIndex","changes","button","ctrlKey","shiftKey","altKey","metaKey","sanitizedValue","ɵɵsanitizeUrlOrResourceUrl","attrName","attrValue","nativeElement","ɵɵdirectiveInject","ActivatedRoute","ɵɵinjectAttribute","Renderer2","ElementRef","LocationStrategy","ɵɵdefineDirective","rf","ctx","ɵɵlistener","$event","ɵɵattribute","InputFlags","booleanAttribute","ɵɵInputTransformsFeature","ɵɵNgOnChangesFeature","RouterLinkActive","_RouterLinkActive","element","cdr","link","EventEmitter","mergeAll","allLinkChanges","classes","c","hasActiveLinks","isActiveMatchOptions","isActiveCheckFn","ChangeDetectorRef","dirIndex","ɵɵcontentQuery","_t","ɵɵqueryRefresh","ɵɵloadQuery","PreloadingStrategy","PreloadAllModules","_PreloadAllModules","fn","RouterPreloader","_RouterPreloader","router","compiler","injector","preloadingStrategy","loader","filter","e","NavigationEnd","concatMap","routes","res","route","createEnvironmentInjector","injectorForCurrentRoute","injectorForChildren","from","mergeAll","loadedChildren$","of","recursiveLoadChildren$","mergeMap","config","loadComponent$","t","ɵɵinject","Router","Compiler","EnvironmentInjector","PreloadingStrategy","RouterConfigLoader","ɵɵdefineInjectable","ROUTER_SCROLLER","InjectionToken","RouterScroller","_RouterScroller","urlSerializer","transitions","viewportScroller","zone","options","NavigationStart","NavigationSkipped","NavigationSkippedCode","Scroll","routerEvent","anchor","ɵɵinvalidFactory","rootRoute","router","routerFeature","kind","providers","getBootstrapListener","injector","inject","Injector","bootstrappedComponentRef","ref","ApplicationRef","router","Router","bootstrapDone","BOOTSTRAP_DONE","INITIAL_NAVIGATION","ROUTER_PRELOADER","InjectFlags","ROUTER_SCROLLER","InjectionToken","Subject","withEnabledBlockingInitialNavigation","routerFeature","APP_INITIALIZER","locationInitialized","LOCATION_INITIALIZED","resolve","afterNextNavigation","NavigationTransitions","of","withDisabledInitialNavigation","ROUTER_PRELOADER","InjectionToken","withPreloading","preloadingStrategy","routerFeature","RouterPreloader","PreloadingStrategy","withComponentInputBinding","routerFeature","RoutedComponentInputBinder","INPUT_BINDER","withViewTransitions","options","providers","CREATE_VIEW_TRANSITION","createViewTransition","VIEW_TRANSITION_OPTIONS","__spreadValues","ROUTER_FORROOT_GUARD","InjectionToken","ROUTER_PROVIDERS","Location","UrlSerializer","DefaultUrlSerializer","Router","ChildrenOutletContexts","ActivatedRoute","rootRoute","RouterConfigLoader","RouterModule","_RouterModule","guard","routes","config","ROUTES","provideForRootGuard","Optional","SkipSelf","ROUTER_CONFIGURATION","provideHashLocationStrategy","providePathLocationStrategy","provideRouterScroller","withPreloading","provideInitialNavigation","withComponentInputBinding","withViewTransitions","provideRouterInitializer","t","ɵɵinject","ɵɵdefineNgModule","ɵɵdefineInjector","ROUTER_SCROLLER","viewportScroller","inject","ViewportScroller","zone","NgZone","transitions","NavigationTransitions","urlSerializer","RouterScroller","LocationStrategy","HashLocationStrategy","PathLocationStrategy","router","withDisabledInitialNavigation","withEnabledBlockingInitialNavigation","ROUTER_INITIALIZER","getBootstrapListener","APP_BOOTSTRAP_LISTENER","HttpError","errorMessage","statusCode","trueProto","TimeoutError","AbortError","UnsupportedTransportError","message","transport","DisabledTransportError","FailedToStartTransportError","FailedToNegotiateWithServerError","AggregateErrors","innerErrors","HttpResponse","statusCode","statusText","content","HttpClient","url","options","__spreadProps","__spreadValues","LogLevel","NullLogger","_logLevel","_message","VERSION","Arg","val","name","values","Platform","getDataDetail","data","includeContent","detail","isArrayBuffer","formatArrayBuffer","view","str","num","pad","sendMessage","logger","transportName","httpClient","url","content","options","__async","headers","value","getUserAgentHeader","LogLevel","responseType","response","__spreadValues","createLogger","ConsoleLogger","NullLogger","SubjectSubscription","subject","observer","index","_","minimumLogLevel","logLevel","message","msg","userAgentHeaderName","constructUserAgent","getOsName","getRuntime","getRuntimeVersion","version","os","runtime","runtimeVersion","userAgent","majorAndMinor","getErrorString","e","getGlobalThis","FetchHttpClient","HttpClient","logger","requireFunc","__require","getGlobalThis","request","__async","AbortError","abortController","error","timeoutId","msTimeout","LogLevel","TimeoutError","isArrayBuffer","response","__spreadValues","e","errorMessage","deserializeContent","HttpError","payload","HttpResponse","url","cookies","Platform","c","responseType","content","XhrHttpClient","HttpClient","logger","request","AbortError","resolve","reject","xhr","isArrayBuffer","headers","header","HttpResponse","HttpError","LogLevel","TimeoutError","DefaultHttpClient","HttpClient","logger","Platform","FetchHttpClient","XhrHttpClient","request","AbortError","url","TextMessageFormat","_TextMessageFormat","output","input","messages","HandshakeProtocol","handshakeRequest","TextMessageFormat","data","messageData","remainingData","isArrayBuffer","binaryData","separatorIndex","responseLength","textData","messages","response","MessageType","Subject","item","observer","err","SubjectSubscription","DEFAULT_TIMEOUT_IN_MS","DEFAULT_PING_INTERVAL_IN_MS","HubConnectionState","HubConnection","_HubConnection","connection","logger","protocol","reconnectPolicy","LogLevel","Arg","HandshakeProtocol","data","error","MessageType","url","__async","Platform","handshakePromise","resolve","reject","handshakeRequest","e","startPromise","AbortError","methodName","args","streams","streamIds","invocationDescriptor","promiseQueue","subject","Subject","cancelInvocation","invocationEvent","message","sendPromise","newMethod","method","handlers","removeIdx","callback","messages","getErrorString","responseMessage","remainingData","nextPing","invocationMessage","methods","methodsCopy","expectsResponse","res","exception","completionMessage","m","prevRes","c","reconnectStartTime","previousReconnectAttempts","retryError","nextRetryDelay","previousRetryCount","elapsedMilliseconds","retryReason","callbacks","key","nonblocking","invocationId","streamId","err","item","i","argument","arg","id","result","DEFAULT_RETRY_DELAYS_IN_MILLISECONDS","DefaultReconnectPolicy","retryDelays","retryContext","HeaderNames","AccessTokenHttpClient","HttpClient","innerClient","accessTokenFactory","request","__async","allowRetry","response","HeaderNames","url","HttpTransportType","TransferFormat","AbortController","LongPollingTransport","httpClient","logger","options","AbortController","url","transferFormat","__async","Arg","TransferFormat","LogLevel","name","value","getUserAgentHeader","headers","__spreadValues","pollOptions","pollUrl","response","HttpError","getDataDetail","e","TimeoutError","data","sendMessage","deleteOptions","logMessage","ServerSentEventsTransport","httpClient","accessToken","logger","options","url","transferFormat","__async","Arg","TransferFormat","LogLevel","resolve","reject","opened","eventSource","Platform","cookies","headers","name","value","getUserAgentHeader","__spreadValues","e","getDataDetail","error","data","sendMessage","WebSocketTransport","httpClient","accessTokenFactory","logger","logMessageContent","webSocketConstructor","headers","url","transferFormat","__async","Arg","TransferFormat","LogLevel","token","resolve","reject","webSocket","cookies","opened","Platform","name","value","getUserAgentHeader","HeaderNames","__spreadValues","_event","event","error","message","getDataDetail","data","MAX_REDIRECTS","HttpConnection","url","options","Arg","createLogger","webSocketModule","eventSourceModule","Platform","__require","requireFunc","AccessTokenHttpClient","DefaultHttpClient","transferFormat","__async","TransferFormat","LogLevel","message","AbortError","data","TransportSendQueue","error","resolve","e","HttpTransportType","negotiateResponse","redirects","accessToken","LongPollingTransport","headers","name","value","getUserAgentHeader","negotiateUrl","response","__spreadValues","errorMessage","HttpError","FailedToNegotiateWithServerError","connectionToken","requestedTransport","requestedTransferFormat","connectUrl","transportExceptions","transports","negotiate","endpoint","transportOrError","ex","FailedToStartTransportError","AggregateErrors","transport","WebSocketTransport","ServerSentEventsTransport","transportMatches","UnsupportedTransportError","DisabledTransportError","aTag","index","actualTransport","_TransportSendQueue","_transport","PromiseSource","transportResult","arrayBuffers","totalLength","b","a","result","offset","item","reject","reason","JSON_HUB_PROTOCOL_NAME","JsonHubProtocol","TransferFormat","input","logger","NullLogger","messages","TextMessageFormat","hubMessages","message","parsedMessage","MessageType","LogLevel","value","errorMessage","LogLevelNameMapping","LogLevel","parseLogLevel","name","mapping","HubConnectionBuilder","logging","Arg","isLogger","logLevel","ConsoleLogger","url","transportTypeOrOptions","__spreadValues","__spreadProps","protocol","retryDelaysOrReconnectPolicy","DefaultReconnectPolicy","httpConnectionOptions","connection","HttpConnection","HubConnection","NullLogger","JsonHubProtocol","logger","EVENTS","MessageHubService","constructor","hubUrl","environment","messagesSource","ReplaySubject","onlineUsersSource","BehaviorSubject","messages$","asObservable","onlineUsers$","isEventType","event","eventType","NotificationProgress","payload","toLowerCase","createHubConnection","user","hubConnection","HubConnectionBuilder","withUrl","accessTokenFactory","token","withAutomaticReconnect","build","start","catch","err","console","error","on","OnlineUsers","usernames","next","ScanSeries","resp","body","ScanLibraryProgress","ConvertBookmarksProgress","WordCountAnalyzerProgress","LibraryModified","SmartCollectionSync","SiteThemeUpdated","DashboardUpdate","SideNavUpdate","SiteThemeProgress","CollectionUpdated","UserProgressUpdate","UserUpdate","Error","Info","SeriesAdded","SeriesRemoved","CoverUpdate","UpdateAvailable","SendingToDevice","ScrobblingKeyExpired","stopHubConnection","stop","sendMessage","methodName","invoke","factory","ɵfac","providedIn","_MessageHubService","ThemeProvider","SafeHtmlPipe","constructor","dom","inject","DomSanitizer","transform","value","sanitize","SecurityContext","HTML","pure","standalone","_SafeHtmlPipe","ɵɵelementStart","ɵɵlistener","ɵɵrestoreView","_r1","ctx_r1","ɵɵnextContext","ɵɵresetView","close","ɵɵelementEnd","btn_r5","_r4","$implicit","clickButton","ɵɵtext","ɵɵadvance","ɵɵclassMapInterpolate1","type","ɵɵtextInterpolate","text","ɵɵelementContainerStart","ɵɵtemplate","ConfirmDialogComponent_ng_container_0_button_4_Template","ɵɵelement","ConfirmDialogComponent_ng_container_0_div_8_Template","config","header","ɵɵproperty","disableEscape","ɵɵpipeBind1","content","ɵɵsanitizeHtml","buttons","ConfirmDialogComponent","constructor","modal","ngOnInit","sort","_button_sort","x","y","xIsSecondary","yIsSecondary","button","ɵɵdirectiveInject","NgbActiveModal","selectors","standalone","features","ɵɵStandaloneFeature","decls","vars","consts","template","rf","ctx","ConfirmDialogComponent_ng_container_0_Template","CommonModule","NgForOf","NgIf","SafeHtmlPipe","TranslocoDirective","_ConfirmDialogComponent","ConfirmConfig","constructor","_type","header","content","buttons","disableEscape","ConfirmService","constructor","modalService","defaultConfirm","ConfirmConfig","defaultAlert","buttons","push","text","type","_type","header","confirm","content","config","__async","Promise","resolve","reject","undefined","console","error","modalRef","open","ConfirmDialogComponent","componentInstance","closed","pipe","take","subscribe","result","dismissed","alert","size","fullscreen","ɵɵinject","NgbModal","factory","ɵfac","providedIn","_ConfirmService","ThemeService","constructor","rendererFactory","document","httpClient","messageHub","domSanitizer","confirmService","toastr","destroyRef","inject","DestroyRef","defaultTheme","defaultBookTheme","currentThemeSource","ReplaySubject","currentTheme$","asObservable","themesSource","themes$","themeCache","baseUrl","environment","apiUrl","renderer","createRenderer","messages$","pipe","takeUntilDestroyed","subscribe","message","event","EVENTS","NotificationProgress","notificationEvent","payload","name","SiteThemeProgress","eventType","getThemes","SiteThemeUpdated","evt","take","currentTheme","console","log","setTheme","getDownloadableThemes","get","downloadTheme","theme","post","uploadTheme","themeFile","fileEntry","formData","FormData","append","relativePath","getColorScheme","getComputedStyle","body","getPropertyValue","trim","getThemeColor","getTileColor","getCssVariable","variable","isDarkTheme","toLowerCase","map","themes","next","filter","t","id","length","info","translate","clearThemes","unsetThemes","deleteTheme","themeId","delete","setDefault","scan","setBookTheme","selector","unsetBookThemes","addClass","querySelector","clearBookTheme","themeName","find","provider","ThemeProvider","System","hasThemeInHead","fetchThemeContent","content","__async","alert","styleElem","createElement","appendChild","createTextNode","head","themeColor","setAttribute","colorScheme","Array","from","children","el","tagName","TextResonse","encodedCss","sanitize","SecurityContext","STYLE","forEach","classList","remove","cls","startsWith","c","ɵɵinject","RendererFactory2","DOCUMENT","HttpClient","MessageHubService","DomSanitizer","ConfirmService","ToastrService","factory","ɵfac","providedIn","_ThemeService","Role","AccountService","constructor","httpClient","router","messageHub","themeService","destroyRef","inject","DestroyRef","baseUrl","environment","apiUrl","userKey","currentUserSource","ReplaySubject","currentUser$","asObservable","hasValidLicenseSource","hasValidLicense$","isOnline","messages$","pipe","filter","evt","event","EVENTS","UserUpdate","map","payload","userUpdateEvent","userName","currentUser","username","switchMap","refreshAccount","subscribe","window","addEventListener","e","refreshToken","hasAdminRole","user","roles","includes","Admin","hasChangePasswordRole","ChangePassword","hasChangeAgeRestrictionRole","ChangeRestriction","hasDownloadRole","Download","hasBookmarkRole","Bookmark","hasReadOnlyRole","ReadOnly","hasPromoteRole","Promote","getRoles","get","deleteLicense","delete","TextResonse","resetLicense","license","email","post","hasValidLicense","forceCheck","console","log","res","tap","next","catchError","error","throwError","hasAnyLicense","updateUserLicense","discordId","login","model","response","setCurrentUser","takeUntilDestroyed","getDecodedToken","token","role","Array","isArray","push","localStorage","setItem","JSON","stringify","lastLoginKey","preferences","theme","setTheme","name","defaultTheme","stopRefreshTokenTimer","stopHubConnection","createHubConnection","startRefreshTokenTimer","logout","removeItem","undefined","navigateByUrl","register","isEmailConfirmed","isEmailValid","confirmMigrationEmail","resendConfirmationEmail","userId","inviteUser","confirmEmail","confirmEmailUpdate","getInviteUrl","withBaseUrl","parse","atob","split","requestResetPasswordEmail","encodeURIComponent","confirmResetPasswordEmail","resetPassword","password","oldPassword","update","updateEmail","updateAgeRestriction","ageRating","includeUnknowns","getPreferences","pref","updatePreferences","userPreferences","settings","localeKey","locale","getUserFromLocalStorage","userString","getItem","resetApiKey","key","apiKey","getOpdsUrl","of","__spreadValues","refreshTokenTimeout","setInterval","clearInterval","_AccountService","ɵɵinject","HttpClient","Router","MessageHubService","ThemeService","factory","ɵfac","providedIn"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]}