@angular/router 14.0.2 → 14.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/esm2020/src/apply_redirects.mjs +14 -18
  2. package/esm2020/src/components/empty_outlet.mjs +3 -3
  3. package/esm2020/src/create_url_tree.mjs +6 -4
  4. package/esm2020/src/directives/router_link.mjs +6 -6
  5. package/esm2020/src/directives/router_link_active.mjs +3 -3
  6. package/esm2020/src/directives/router_outlet.mjs +14 -10
  7. package/esm2020/src/errors.mjs +2 -0
  8. package/esm2020/src/models.mjs +1 -1
  9. package/esm2020/src/operators/check_guards.mjs +12 -35
  10. package/esm2020/src/page_title_strategy.mjs +3 -3
  11. package/esm2020/src/private_export.mjs +2 -2
  12. package/esm2020/src/recognize.mjs +3 -2
  13. package/esm2020/src/router.mjs +12 -10
  14. package/esm2020/src/router_config_loader.mjs +3 -3
  15. package/esm2020/src/router_module.mjs +192 -138
  16. package/esm2020/src/router_preloader.mjs +16 -4
  17. package/esm2020/src/router_scroller.mjs +6 -5
  18. package/esm2020/src/shared.mjs +3 -2
  19. package/esm2020/src/url_tree.mjs +6 -4
  20. package/esm2020/src/utils/config.mjs +17 -17
  21. package/esm2020/src/version.mjs +1 -1
  22. package/esm2020/testing/src/router_testing_module.mjs +8 -8
  23. package/fesm2015/router.mjs +303 -255
  24. package/fesm2015/router.mjs.map +1 -1
  25. package/fesm2015/testing.mjs +8 -8
  26. package/fesm2015/testing.mjs.map +1 -1
  27. package/fesm2015/upgrade.mjs +1 -1
  28. package/fesm2020/router.mjs +300 -254
  29. package/fesm2020/router.mjs.map +1 -1
  30. package/fesm2020/testing.mjs +8 -8
  31. package/fesm2020/testing.mjs.map +1 -1
  32. package/fesm2020/upgrade.mjs +1 -1
  33. package/index.d.ts +21 -3
  34. package/package.json +4 -4
  35. package/testing/index.d.ts +2 -2
  36. package/upgrade/index.d.ts +1 -1
@@ -1,13 +1,13 @@
1
1
  /**
2
- * @license Angular v14.0.2
2
+ * @license Angular v14.0.5
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import * as i3 from '@angular/common';
8
- import { Location, LocationStrategy, PlatformLocation, APP_BASE_HREF, ViewportScroller, HashLocationStrategy, PathLocationStrategy, LOCATION_INITIALIZED } from '@angular/common';
8
+ import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
9
9
  import * as i0 from '@angular/core';
10
- import { ɵisObservable, ɵisPromise, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, InjectionToken, InjectFlags, NgModuleFactory, Injectable, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, Inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, ApplicationRef, Version } from '@angular/core';
10
+ import { ɵisObservable, ɵisPromise, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, InjectionToken, InjectFlags, NgModuleFactory, Injectable, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, Inject, ApplicationRef, ENVIRONMENT_INITIALIZER, Version } from '@angular/core';
11
11
  import { from, of, BehaviorSubject, combineLatest, throwError, EmptyError, concat, defer, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
12
12
  import { map, switchMap, take, startWith, scan, filter, catchError, concatMap, last as last$1, first, mergeMap, tap, takeLast, mapTo, finalize, refCount, defaultIfEmpty, mergeAll } from 'rxjs/operators';
13
13
  import * as i1 from '@angular/platform-browser';
@@ -519,9 +519,10 @@ class ParamsAsMap {
519
519
  function convertToParamMap(params) {
520
520
  return new ParamsAsMap(params);
521
521
  }
522
+ const REDIRECTING_CANCELLATION_REASON = 'Redirecting to ';
522
523
  const NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
523
524
  function navigationCancelingError(message) {
524
- const error = Error('NavigationCancelingError: ' + message);
525
+ const error = Error('NavigationCancelingError: ' + (message || ''));
525
526
  error[NAVIGATION_CANCELING_ERROR] = true;
526
527
  return error;
527
528
  }
@@ -650,6 +651,7 @@ function wrapIntoObservable(value) {
650
651
  * Use of this source code is governed by an MIT-style license that can be
651
652
  * found in the LICENSE file at https://angular.io/license
652
653
  */
654
+ const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
653
655
  function createEmptyUrlTree() {
654
656
  return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
655
657
  }
@@ -1114,7 +1116,7 @@ class UrlParser {
1114
1116
  parseSegment() {
1115
1117
  const path = matchSegments(this.remaining);
1116
1118
  if (path === '' && this.peekStartsWith(';')) {
1117
- throw new Error(`Empty path url segment cannot have parameters: '${this.remaining}'.`);
1119
+ throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$7 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
1118
1120
  }
1119
1121
  this.capture(path);
1120
1122
  return new UrlSegment(decode(path), this.parseMatrixParams());
@@ -1183,7 +1185,7 @@ class UrlParser {
1183
1185
  // if is is not one of these characters, then the segment was unescaped
1184
1186
  // or the group was not closed
1185
1187
  if (next !== '/' && next !== ')' && next !== ';') {
1186
- throw new Error(`Cannot parse url '${this.url}'`);
1188
+ throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$7 && `Cannot parse url '${this.url}'`);
1187
1189
  }
1188
1190
  let outletName = undefined;
1189
1191
  if (path.indexOf(':') > -1) {
@@ -1214,7 +1216,7 @@ class UrlParser {
1214
1216
  }
1215
1217
  capture(str) {
1216
1218
  if (!this.consumeOptional(str)) {
1217
- throw new Error(`Expected "${str}".`);
1219
+ throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$7 && `Expected "${str}".`);
1218
1220
  }
1219
1221
  }
1220
1222
  }
@@ -1767,6 +1769,7 @@ function createActivatedRoute(c) {
1767
1769
  * Use of this source code is governed by an MIT-style license that can be
1768
1770
  * found in the LICENSE file at https://angular.io/license
1769
1771
  */
1772
+ const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
1770
1773
  function createUrlTree(route, urlTree, commands, queryParams, fragment) {
1771
1774
  if (commands.length === 0) {
1772
1775
  return tree(urlTree.root, urlTree.root, urlTree.root, queryParams, fragment);
@@ -1837,11 +1840,11 @@ class Navigation {
1837
1840
  this.numberOfDoubleDots = numberOfDoubleDots;
1838
1841
  this.commands = commands;
1839
1842
  if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
1840
- throw new Error('Root segment cannot have matrix parameters');
1843
+ throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$6 && 'Root segment cannot have matrix parameters');
1841
1844
  }
1842
1845
  const cmdWithOutlet = commands.find(isCommandWithOutlets);
1843
1846
  if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
1844
- throw new Error('{outlets:{}} has to be the last command');
1847
+ throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$6 && '{outlets:{}} has to be the last command');
1845
1848
  }
1846
1849
  }
1847
1850
  toRoot() {
@@ -1922,7 +1925,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
1922
1925
  dd -= ci;
1923
1926
  g = g.parent;
1924
1927
  if (!g) {
1925
- throw new Error('Invalid number of \'../\'');
1928
+ throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$6 && 'Invalid number of \'../\'');
1926
1929
  }
1927
1930
  ci = g.segments.length;
1928
1931
  }
@@ -2154,6 +2157,7 @@ class ChildrenOutletContexts {
2154
2157
  * Use of this source code is governed by an MIT-style license that can be
2155
2158
  * found in the LICENSE file at https://angular.io/license
2156
2159
  */
2160
+ const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
2157
2161
  /**
2158
2162
  * @description
2159
2163
  *
@@ -2230,7 +2234,10 @@ class RouterOutlet {
2230
2234
  }
2231
2235
  /** @nodoc */
2232
2236
  ngOnDestroy() {
2233
- this.parentContexts.onChildOutletDestroyed(this.name);
2237
+ // Ensure that the registered outlet is this one before removing it on the context.
2238
+ if (this.parentContexts.getContext(this.name)?.outlet === this) {
2239
+ this.parentContexts.onChildOutletDestroyed(this.name);
2240
+ }
2234
2241
  }
2235
2242
  /** @nodoc */
2236
2243
  ngOnInit() {
@@ -2259,12 +2266,12 @@ class RouterOutlet {
2259
2266
  */
2260
2267
  get component() {
2261
2268
  if (!this.activated)
2262
- throw new Error('Outlet is not activated');
2269
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2263
2270
  return this.activated.instance;
2264
2271
  }
2265
2272
  get activatedRoute() {
2266
2273
  if (!this.activated)
2267
- throw new Error('Outlet is not activated');
2274
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2268
2275
  return this._activatedRoute;
2269
2276
  }
2270
2277
  get activatedRouteData() {
@@ -2278,7 +2285,7 @@ class RouterOutlet {
2278
2285
  */
2279
2286
  detach() {
2280
2287
  if (!this.activated)
2281
- throw new Error('Outlet is not activated');
2288
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2282
2289
  this.location.detach();
2283
2290
  const cmp = this.activated;
2284
2291
  this.activated = null;
@@ -2306,7 +2313,7 @@ class RouterOutlet {
2306
2313
  }
2307
2314
  activateWith(activatedRoute, resolverOrInjector) {
2308
2315
  if (this.isActivated) {
2309
- throw new Error('Cannot activate an already activated outlet');
2316
+ throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$5 && 'Cannot activate an already activated outlet');
2310
2317
  }
2311
2318
  this._activatedRoute = activatedRoute;
2312
2319
  const location = this.location;
@@ -2328,9 +2335,9 @@ class RouterOutlet {
2328
2335
  this.activateEvents.emit(this.activated.instance);
2329
2336
  }
2330
2337
  }
2331
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
2332
- RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.2", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2333
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterOutlet, decorators: [{
2338
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
2339
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.5", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2340
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterOutlet, decorators: [{
2334
2341
  type: Directive,
2335
2342
  args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
2336
2343
  }], ctorParameters: function () { return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
@@ -2387,9 +2394,9 @@ function isComponentFactoryResolver(item) {
2387
2394
  */
2388
2395
  class ɵEmptyOutletComponent {
2389
2396
  }
2390
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2391
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2392
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2397
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2398
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.5", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2399
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2393
2400
  type: Component,
2394
2401
  args: [{ template: `<router-outlet></router-outlet>` }]
2395
2402
  }] });
@@ -2438,13 +2445,13 @@ function validateConfig(config, parentPath = '', requireStandaloneComponents = f
2438
2445
  }
2439
2446
  function assertStandalone(fullPath, component) {
2440
2447
  if (component && !ɵisStandalone(component)) {
2441
- throw new Error(`Invalid configuration of route '${fullPath}'. The component must be standalone.`);
2448
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);
2442
2449
  }
2443
2450
  }
2444
2451
  function validateNode(route, fullPath, requireStandaloneComponents) {
2445
2452
  if (typeof ngDevMode === 'undefined' || ngDevMode) {
2446
2453
  if (!route) {
2447
- throw new Error(`
2454
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `
2448
2455
  Invalid configuration of route '${fullPath}': Encountered undefined route.
2449
2456
  The reason might be an extra comma.
2450
2457
 
@@ -2457,47 +2464,47 @@ function validateNode(route, fullPath, requireStandaloneComponents) {
2457
2464
  `);
2458
2465
  }
2459
2466
  if (Array.isArray(route)) {
2460
- throw new Error(`Invalid configuration of route '${fullPath}': Array cannot be specified`);
2467
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': Array cannot be specified`);
2461
2468
  }
2462
2469
  if (!route.component && !route.loadComponent && !route.children && !route.loadChildren &&
2463
2470
  (route.outlet && route.outlet !== PRIMARY_OUTLET)) {
2464
- throw new Error(`Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);
2471
+ 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`);
2465
2472
  }
2466
2473
  if (route.redirectTo && route.children) {
2467
- throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
2474
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
2468
2475
  }
2469
2476
  if (route.redirectTo && route.loadChildren) {
2470
- throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
2477
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
2471
2478
  }
2472
2479
  if (route.children && route.loadChildren) {
2473
- throw new Error(`Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
2480
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
2474
2481
  }
2475
2482
  if (route.redirectTo && (route.component || route.loadComponent)) {
2476
- throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
2483
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
2477
2484
  }
2478
2485
  if (route.component && route.loadComponent) {
2479
- throw new Error(`Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
2486
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
2480
2487
  }
2481
2488
  if (route.redirectTo && route.canActivate) {
2482
- throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and canActivate cannot be used together. Redirects happen before activation ` +
2489
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and canActivate cannot be used together. Redirects happen before activation ` +
2483
2490
  `so canActivate will never be executed.`);
2484
2491
  }
2485
2492
  if (route.path && route.matcher) {
2486
- throw new Error(`Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
2493
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
2487
2494
  }
2488
2495
  if (route.redirectTo === void 0 && !route.component && !route.loadComponent &&
2489
2496
  !route.children && !route.loadChildren) {
2490
- throw new Error(`Invalid configuration of route '${fullPath}'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren`);
2497
+ 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`);
2491
2498
  }
2492
2499
  if (route.path === void 0 && route.matcher === void 0) {
2493
- throw new Error(`Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
2500
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
2494
2501
  }
2495
2502
  if (typeof route.path === 'string' && route.path.charAt(0) === '/') {
2496
- throw new Error(`Invalid configuration of route '${fullPath}': path cannot start with a slash`);
2503
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);
2497
2504
  }
2498
2505
  if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {
2499
2506
  const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;
2500
- throw new Error(`Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
2507
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
2501
2508
  }
2502
2509
  if (requireStandaloneComponents) {
2503
2510
  assertStandalone(fullPath, route.component);
@@ -2991,6 +2998,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
2991
2998
  * Use of this source code is governed by an MIT-style license that can be
2992
2999
  * found in the LICENSE file at https://angular.io/license
2993
3000
  */
3001
+ const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || ngDevMode;
2994
3002
  class NoMatch$1 {
2995
3003
  constructor(segmentGroup) {
2996
3004
  this.segmentGroup = segmentGroup || null;
@@ -3008,10 +3016,12 @@ function absoluteRedirect(newTree) {
3008
3016
  return throwError(new AbsoluteRedirect(newTree));
3009
3017
  }
3010
3018
  function namedOutletsRedirect(redirectTo) {
3011
- return throwError(new Error(`Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3019
+ return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$4 &&
3020
+ `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3012
3021
  }
3013
3022
  function canLoadFails(route) {
3014
- return throwError(navigationCancelingError(`Cannot load children because the guard of the route "path: '${route.path}'" returned false`));
3023
+ return throwError(navigationCancelingError(NG_DEV_MODE$4 &&
3024
+ `Cannot load children because the guard of the route "path: '${route.path}'" returned false`));
3015
3025
  }
3016
3026
  /**
3017
3027
  * Returns the `UrlTree` with the redirection applied.
@@ -3070,7 +3080,7 @@ class ApplyRedirects {
3070
3080
  }));
3071
3081
  }
3072
3082
  noMatchError(e) {
3073
- return new Error(`Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3083
+ return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$4 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3074
3084
  }
3075
3085
  createUrlTree(rootCandidate, queryParams, fragment) {
3076
3086
  const root = rootCandidate.segments.length > 0 ?
@@ -3241,23 +3251,14 @@ class ApplyRedirects {
3241
3251
  return of(true);
3242
3252
  const canLoadObservables = canLoad.map((injectionToken) => {
3243
3253
  const guard = injector.get(injectionToken);
3244
- let guardVal;
3245
- if (isCanLoad(guard)) {
3246
- guardVal = guard.canLoad(route, segments);
3247
- }
3248
- else if (isFunction(guard)) {
3249
- guardVal = guard(route, segments);
3250
- }
3251
- else {
3252
- throw new Error('Invalid CanLoad guard');
3253
- }
3254
+ const guardVal = isCanLoad(guard) ? guard.canLoad(route, segments) : guard(route, segments);
3254
3255
  return wrapIntoObservable(guardVal);
3255
3256
  });
3256
3257
  return of(canLoadObservables)
3257
3258
  .pipe(prioritizedGuardValue(), tap((result) => {
3258
3259
  if (!isUrlTree(result))
3259
3260
  return;
3260
- const error = navigationCancelingError(`Redirecting to "${this.urlSerializer.serialize(result)}"`);
3261
+ const error = navigationCancelingError(REDIRECTING_CANCELLATION_REASON + this.urlSerializer.serialize(result));
3261
3262
  error.url = result;
3262
3263
  throw error;
3263
3264
  }), map(result => result === true));
@@ -3312,7 +3313,8 @@ class ApplyRedirects {
3312
3313
  findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3313
3314
  const pos = posParams[redirectToUrlSegment.path.substring(1)];
3314
3315
  if (!pos)
3315
- throw new Error(`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3316
+ throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$4 &&
3317
+ `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3316
3318
  return pos;
3317
3319
  }
3318
3320
  findOrReturn(redirectToUrlSegment, actualSegments) {
@@ -3581,17 +3583,9 @@ function runCanActivate(futureRSS, futureARS, moduleInjector) {
3581
3583
  const canActivateObservables = canActivate.map((c) => {
3582
3584
  return defer(() => {
3583
3585
  const guard = getToken(c, futureARS, moduleInjector);
3584
- let observable;
3585
- if (isCanActivate(guard)) {
3586
- observable = wrapIntoObservable(guard.canActivate(futureARS, futureRSS));
3587
- }
3588
- else if (isFunction(guard)) {
3589
- observable = wrapIntoObservable(guard(futureARS, futureRSS));
3590
- }
3591
- else {
3592
- throw new Error('Invalid CanActivate guard');
3593
- }
3594
- return observable.pipe(first());
3586
+ const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) :
3587
+ guard(futureARS, futureRSS);
3588
+ return wrapIntoObservable(guardVal).pipe(first());
3595
3589
  });
3596
3590
  });
3597
3591
  return of(canActivateObservables).pipe(prioritizedGuardValue());
@@ -3606,17 +3600,9 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
3606
3600
  return defer(() => {
3607
3601
  const guardsMapped = d.guards.map((c) => {
3608
3602
  const guard = getToken(c, d.node, moduleInjector);
3609
- let observable;
3610
- if (isCanActivateChild(guard)) {
3611
- observable = wrapIntoObservable(guard.canActivateChild(futureARS, futureRSS));
3612
- }
3613
- else if (isFunction(guard)) {
3614
- observable = wrapIntoObservable(guard(futureARS, futureRSS));
3615
- }
3616
- else {
3617
- throw new Error('Invalid CanActivateChild guard');
3618
- }
3619
- return observable.pipe(first());
3603
+ const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) :
3604
+ guard(futureARS, futureRSS);
3605
+ return wrapIntoObservable(guardVal).pipe(first());
3620
3606
  });
3621
3607
  return of(guardsMapped).pipe(prioritizedGuardValue());
3622
3608
  });
@@ -3629,17 +3615,10 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
3629
3615
  return of(true);
3630
3616
  const canDeactivateObservables = canDeactivate.map((c) => {
3631
3617
  const guard = getToken(c, currARS, moduleInjector);
3632
- let observable;
3633
- if (isCanDeactivate(guard)) {
3634
- observable = wrapIntoObservable(guard.canDeactivate(component, currARS, currRSS, futureRSS));
3635
- }
3636
- else if (isFunction(guard)) {
3637
- observable = wrapIntoObservable(guard(component, currARS, currRSS, futureRSS));
3638
- }
3639
- else {
3640
- throw new Error('Invalid CanDeactivate guard');
3641
- }
3642
- return observable.pipe(first());
3618
+ const guardVal = isCanDeactivate(guard) ?
3619
+ guard.canDeactivate(component, currARS, currRSS, futureRSS) :
3620
+ guard(component, currARS, currRSS, futureRSS);
3621
+ return wrapIntoObservable(guardVal).pipe(first());
3643
3622
  });
3644
3623
  return of(canDeactivateObservables).pipe(prioritizedGuardValue());
3645
3624
  }
@@ -3651,7 +3630,7 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
3651
3630
  * Use of this source code is governed by an MIT-style license that can be
3652
3631
  * found in the LICENSE file at https://angular.io/license
3653
3632
  */
3654
- const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3633
+ const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3655
3634
  class NoMatch {
3656
3635
  }
3657
3636
  function newObservableError(e) {
@@ -3772,7 +3751,7 @@ class Recognizer {
3772
3751
  // NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
3773
3752
  // production bundle size. This value is intended only to surface a warning to users
3774
3753
  // depending on `relativeLinkResolution: 'legacy'` in dev mode.
3775
- (NG_DEV_MODE$2 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3754
+ (NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3776
3755
  pathIndexShift));
3777
3756
  }
3778
3757
  else {
@@ -3783,7 +3762,7 @@ class Recognizer {
3783
3762
  consumedSegments = result.consumedSegments;
3784
3763
  remainingSegments = result.remainingSegments;
3785
3764
  const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
3786
- snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$2 ? getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
3765
+ snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
3787
3766
  pathIndexShift));
3788
3767
  }
3789
3768
  const childConfig = getChildConfig(route);
@@ -3880,7 +3859,7 @@ function checkOutletNameUniqueness(nodes) {
3880
3859
  if (routeWithSameOutletName) {
3881
3860
  const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
3882
3861
  const c = n.value.url.map(s => s.toString()).join('/');
3883
- throw new Error(`Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
3862
+ throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$3 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
3884
3863
  }
3885
3864
  names[n.value.outlet] = n.value;
3886
3865
  });
@@ -4087,7 +4066,7 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4087
4066
  * Use of this source code is governed by an MIT-style license that can be
4088
4067
  * found in the LICENSE file at https://angular.io/license
4089
4068
  */
4090
- const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4069
+ const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4091
4070
  /**
4092
4071
  * The [DI token](guide/glossary/#di-token) for a router configuration.
4093
4072
  *
@@ -4121,7 +4100,7 @@ class RouterConfigLoader {
4121
4100
  if (this.onLoadEndListener) {
4122
4101
  this.onLoadEndListener(route);
4123
4102
  }
4124
- NG_DEV_MODE$1 && assertStandalone(route.path ?? '', component);
4103
+ NG_DEV_MODE$2 && assertStandalone(route.path ?? '', component);
4125
4104
  route._loadedComponent = component;
4126
4105
  }), finalize(() => {
4127
4106
  this.componentLoaders.delete(route);
@@ -4164,7 +4143,7 @@ class RouterConfigLoader {
4164
4143
  rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
4165
4144
  }
4166
4145
  const routes = rawRoutes.map(standardizeConfig);
4167
- NG_DEV_MODE$1 && validateConfig(routes, route.path, requireStandaloneComponents);
4146
+ NG_DEV_MODE$2 && validateConfig(routes, route.path, requireStandaloneComponents);
4168
4147
  return { routes, injector };
4169
4148
  }), finalize(() => {
4170
4149
  this.childrenLoaders.delete(route);
@@ -4186,9 +4165,9 @@ class RouterConfigLoader {
4186
4165
  }));
4187
4166
  }
4188
4167
  }
4189
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4190
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterConfigLoader });
4191
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterConfigLoader, decorators: [{
4168
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4169
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterConfigLoader });
4170
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterConfigLoader, decorators: [{
4192
4171
  type: Injectable
4193
4172
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4194
4173
 
@@ -4230,7 +4209,7 @@ class DefaultUrlHandlingStrategy {
4230
4209
  * Use of this source code is governed by an MIT-style license that can be
4231
4210
  * found in the LICENSE file at https://angular.io/license
4232
4211
  */
4233
- const NG_DEV_MODE = typeof ngDevMode === 'undefined' || !!ngDevMode;
4212
+ const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4234
4213
  function defaultErrorHandler(error) {
4235
4214
  throw error;
4236
4215
  }
@@ -4283,6 +4262,7 @@ class Router {
4283
4262
  this.lastSuccessfulNavigation = null;
4284
4263
  this.currentNavigation = null;
4285
4264
  this.disposed = false;
4265
+ /** @internal */
4286
4266
  this.navigationId = 0;
4287
4267
  /**
4288
4268
  * The id of the currently active page in the router.
@@ -4555,7 +4535,8 @@ class Router {
4555
4535
  guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)
4556
4536
  })), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
4557
4537
  if (isUrlTree(t.guardsResult)) {
4558
- const error = navigationCancelingError(`Redirecting to "${this.serializeUrl(t.guardsResult)}"`);
4538
+ const error = navigationCancelingError(REDIRECTING_CANCELLATION_REASON +
4539
+ `"${this.serializeUrl(t.guardsResult)}"`);
4559
4540
  error.url = t.guardsResult;
4560
4541
  throw error;
4561
4542
  }
@@ -4592,7 +4573,7 @@ class Router {
4592
4573
  }));
4593
4574
  }
4594
4575
  return undefined;
4595
- }), switchTap(() => this.afterPreactivation()),
4576
+ }),
4596
4577
  // --- LOAD COMPONENTS ---
4597
4578
  switchTap((t) => {
4598
4579
  const loadComponents = (route) => {
@@ -4611,7 +4592,7 @@ class Router {
4611
4592
  };
4612
4593
  return combineLatest(loadComponents(t.targetSnapshot.root))
4613
4594
  .pipe(defaultIfEmpty(), take(1));
4614
- }), map((t) => {
4595
+ }), switchTap(() => this.afterPreactivation()), map((t) => {
4615
4596
  const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4616
4597
  return ({ ...t, targetRouterState });
4617
4598
  }),
@@ -4809,7 +4790,7 @@ class Router {
4809
4790
  * ```
4810
4791
  */
4811
4792
  resetConfig(config) {
4812
- NG_DEV_MODE && validateConfig(config);
4793
+ NG_DEV_MODE$1 && validateConfig(config);
4813
4794
  this.config = config.map(standardizeConfig);
4814
4795
  this.navigated = false;
4815
4796
  this.lastSuccessfulId = -1;
@@ -5164,16 +5145,16 @@ class Router {
5164
5145
  return { navigationId };
5165
5146
  }
5166
5147
  }
5167
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5168
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: Router });
5169
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: Router, decorators: [{
5148
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5149
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: Router });
5150
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: Router, decorators: [{
5170
5151
  type: Injectable
5171
5152
  }], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
5172
5153
  function validateCommands(commands) {
5173
5154
  for (let i = 0; i < commands.length; i++) {
5174
5155
  const cmd = commands[i];
5175
5156
  if (cmd == null) {
5176
- throw new Error(`The requested path contains ${cmd} segment at index ${i}`);
5157
+ throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$1 && `The requested path contains ${cmd} segment at index ${i}`);
5177
5158
  }
5178
5159
  }
5179
5160
  }
@@ -5365,9 +5346,9 @@ class RouterLink {
5365
5346
  });
5366
5347
  }
5367
5348
  }
5368
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5369
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.2", type: RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5370
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterLink, decorators: [{
5349
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5350
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.5", type: RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5351
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterLink, decorators: [{
5371
5352
  type: Directive,
5372
5353
  args: [{ selector: ':not(a):not(area)[routerLink]' }]
5373
5354
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
@@ -5484,9 +5465,9 @@ class RouterLinkWithHref {
5484
5465
  });
5485
5466
  }
5486
5467
  }
5487
- RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5488
- RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.2", type: RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
5489
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5468
+ RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5469
+ RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.5", type: RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
5470
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5490
5471
  type: Directive,
5491
5472
  args: [{ selector: 'a[routerLink],area[routerLink]' }]
5492
5473
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
@@ -5711,9 +5692,9 @@ class RouterLinkActive {
5711
5692
  this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
5712
5693
  }
5713
5694
  }
5714
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
5715
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.2", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
5716
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterLinkActive, decorators: [{
5695
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
5696
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.5", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
5697
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterLinkActive, decorators: [{
5717
5698
  type: Directive,
5718
5699
  args: [{
5719
5700
  selector: '[routerLinkActive]',
@@ -5816,9 +5797,9 @@ class DefaultTitleStrategy extends TitleStrategy {
5816
5797
  }
5817
5798
  }
5818
5799
  }
5819
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
5820
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
5821
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
5800
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
5801
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
5802
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
5822
5803
  type: Injectable,
5823
5804
  args: [{ providedIn: 'root' }]
5824
5805
  }], ctorParameters: function () { return [{ type: i1.Title }]; } });
@@ -5855,6 +5836,12 @@ class PreloadAllModules {
5855
5836
  return fn().pipe(catchError(() => of(null)));
5856
5837
  }
5857
5838
  }
5839
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5840
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
5841
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: PreloadAllModules, decorators: [{
5842
+ type: Injectable,
5843
+ args: [{ providedIn: 'root' }]
5844
+ }] });
5858
5845
  /**
5859
5846
  * @description
5860
5847
  *
@@ -5869,6 +5856,12 @@ class NoPreloading {
5869
5856
  return of(null);
5870
5857
  }
5871
5858
  }
5859
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5860
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: NoPreloading, providedIn: 'root' });
5861
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: NoPreloading, decorators: [{
5862
+ type: Injectable,
5863
+ args: [{ providedIn: 'root' }]
5864
+ }] });
5872
5865
  /**
5873
5866
  * The preloader optimistically loads all router configurations to
5874
5867
  * make navigations into lazily-loaded sections of the application faster.
@@ -5951,9 +5944,9 @@ class RouterPreloader {
5951
5944
  });
5952
5945
  }
5953
5946
  }
5954
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
5955
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterPreloader });
5956
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterPreloader, decorators: [{
5947
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
5948
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterPreloader });
5949
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterPreloader, decorators: [{
5957
5950
  type: Injectable
5958
5951
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
5959
5952
 
@@ -5964,6 +5957,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
5964
5957
  * Use of this source code is governed by an MIT-style license that can be
5965
5958
  * found in the LICENSE file at https://angular.io/license
5966
5959
  */
5960
+ const ROUTER_SCROLLER = new InjectionToken('');
5967
5961
  class RouterScroller {
5968
5962
  constructor(router,
5969
5963
  /** @docsNotRequired */ viewportScroller, options = {}) {
@@ -6039,9 +6033,9 @@ class RouterScroller {
6039
6033
  }
6040
6034
  }
6041
6035
  }
6042
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6043
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterScroller });
6044
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterScroller, decorators: [{
6036
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6037
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterScroller });
6038
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterScroller, decorators: [{
6045
6039
  type: Injectable
6046
6040
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
6047
6041
 
@@ -6052,6 +6046,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
6052
6046
  * Use of this source code is governed by an MIT-style license that can be
6053
6047
  * found in the LICENSE file at https://angular.io/license
6054
6048
  */
6049
+ const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
6055
6050
  /**
6056
6051
  * The directives defined in the `RouterModule`.
6057
6052
  */
@@ -6061,11 +6056,15 @@ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterL
6061
6056
  *
6062
6057
  * @publicApi
6063
6058
  */
6064
- const ROUTER_CONFIGURATION = new InjectionToken('ROUTER_CONFIGURATION');
6059
+ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE ? 'router config' : 'ROUTER_CONFIGURATION', {
6060
+ providedIn: 'root',
6061
+ factory: () => ({}),
6062
+ });
6065
6063
  /**
6066
6064
  * @docsNotRequired
6067
6065
  */
6068
- const ROUTER_FORROOT_GUARD = new InjectionToken('ROUTER_FORROOT_GUARD');
6066
+ const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
6067
+ const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
6069
6068
  const ROUTER_PROVIDERS = [
6070
6069
  Location,
6071
6070
  { provide: UrlSerializer, useClass: DefaultUrlSerializer },
@@ -6080,10 +6079,6 @@ const ROUTER_PROVIDERS = [
6080
6079
  },
6081
6080
  ChildrenOutletContexts,
6082
6081
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6083
- RouterPreloader,
6084
- NoPreloading,
6085
- PreloadAllModules,
6086
- { provide: ROUTER_CONFIGURATION, useValue: { enableTracing: false } },
6087
6082
  RouterConfigLoader,
6088
6083
  ];
6089
6084
  function routerNgProbeToken() {
@@ -6136,6 +6131,7 @@ class RouterModule {
6136
6131
  ngModule: RouterModule,
6137
6132
  providers: [
6138
6133
  ROUTER_PROVIDERS,
6134
+ NG_DEV_MODE ? (config?.enableTracing ? provideTracing() : []) : [],
6139
6135
  provideRoutes(routes),
6140
6136
  {
6141
6137
  provide: ROUTER_FORROOT_GUARD,
@@ -6143,22 +6139,11 @@ class RouterModule {
6143
6139
  deps: [[Router, new Optional(), new SkipSelf()]]
6144
6140
  },
6145
6141
  { provide: ROUTER_CONFIGURATION, useValue: config ? config : {} },
6146
- {
6147
- provide: LocationStrategy,
6148
- useFactory: provideLocationStrategy,
6149
- deps: [PlatformLocation, [new Inject(APP_BASE_HREF), new Optional()], ROUTER_CONFIGURATION]
6150
- },
6151
- {
6152
- provide: RouterScroller,
6153
- useFactory: createRouterScroller,
6154
- deps: [Router, ViewportScroller, ROUTER_CONFIGURATION]
6155
- },
6156
- {
6157
- provide: PreloadingStrategy,
6158
- useExisting: config && config.preloadingStrategy ? config.preloadingStrategy :
6159
- NoPreloading
6160
- },
6142
+ config?.useHash ? provideHashLocationStrategy() : providePathLocationStrategy(),
6143
+ provideRouterScroller(),
6144
+ config?.preloadingStrategy ? providePreloading(config.preloadingStrategy) : [],
6161
6145
  { provide: NgProbeToken, multi: true, useFactory: routerNgProbeToken },
6146
+ config?.initialNavigation ? provideInitialNavigation(config) : [],
6162
6147
  provideRouterInitializer(),
6163
6148
  ],
6164
6149
  };
@@ -6183,10 +6168,10 @@ class RouterModule {
6183
6168
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
6184
6169
  }
6185
6170
  }
6186
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6187
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6188
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterModule });
6189
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterModule, decorators: [{
6171
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6172
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.5", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6173
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterModule });
6174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterModule, decorators: [{
6190
6175
  type: NgModule,
6191
6176
  args: [{
6192
6177
  declarations: ROUTER_DIRECTIVES,
@@ -6200,19 +6185,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
6200
6185
  }] }, { type: Router, decorators: [{
6201
6186
  type: Optional
6202
6187
  }] }]; } });
6203
- function createRouterScroller(router, viewportScroller, config) {
6204
- if (config.scrollOffset) {
6205
- viewportScroller.setOffset(config.scrollOffset);
6206
- }
6207
- return new RouterScroller(router, viewportScroller, config);
6188
+ function provideRouterScroller() {
6189
+ return {
6190
+ provide: ROUTER_SCROLLER,
6191
+ useFactory: () => {
6192
+ const router = inject(Router);
6193
+ const viewportScroller = inject(ViewportScroller);
6194
+ const config = inject(ROUTER_CONFIGURATION);
6195
+ if (config.scrollOffset) {
6196
+ viewportScroller.setOffset(config.scrollOffset);
6197
+ }
6198
+ return new RouterScroller(router, viewportScroller, config);
6199
+ },
6200
+ };
6201
+ }
6202
+ function provideHashLocationStrategy() {
6203
+ return { provide: LocationStrategy, useClass: HashLocationStrategy };
6208
6204
  }
6209
- function provideLocationStrategy(platformLocationStrategy, baseHref, options = {}) {
6210
- return options.useHash ? new HashLocationStrategy(platformLocationStrategy, baseHref) :
6211
- new PathLocationStrategy(platformLocationStrategy, baseHref);
6205
+ function providePathLocationStrategy() {
6206
+ return { provide: LocationStrategy, useClass: PathLocationStrategy };
6212
6207
  }
6213
6208
  function provideForRootGuard(router) {
6214
- if ((typeof ngDevMode === 'undefined' || ngDevMode) && router) {
6215
- throw new Error(`RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
6209
+ if (NG_DEV_MODE && router) {
6210
+ throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
6216
6211
  }
6217
6212
  return 'guarded';
6218
6213
  }
@@ -6248,16 +6243,6 @@ function setupRouter(urlSerializer, contexts, location, injector, compiler, conf
6248
6243
  }
6249
6244
  router.titleStrategy = titleStrategy ?? defaultTitleStrategy;
6250
6245
  assignExtraOptionsToRouter(opts, router);
6251
- if ((typeof ngDevMode === 'undefined' || ngDevMode) && opts.enableTracing) {
6252
- router.events.subscribe((e) => {
6253
- // tslint:disable:no-console
6254
- console.group?.(`Router Event: ${e.constructor.name}`);
6255
- console.log(stringifyEvent(e));
6256
- console.log(e);
6257
- console.groupEnd?.();
6258
- // tslint:enable:no-console
6259
- });
6260
- }
6261
6246
  return router;
6262
6247
  }
6263
6248
  function assignExtraOptionsToRouter(opts, router) {
@@ -6286,112 +6271,173 @@ function assignExtraOptionsToRouter(opts, router) {
6286
6271
  function rootRoute(router) {
6287
6272
  return router.routerState.root;
6288
6273
  }
6289
- /**
6290
- * Router initialization requires two steps:
6291
- *
6292
- * First, we start the navigation in a `APP_INITIALIZER` to block the bootstrap if
6293
- * a resolver or a guard executes asynchronously.
6294
- *
6295
- * Next, we actually run activation in a `BOOTSTRAP_LISTENER`, using the
6296
- * `afterPreactivation` hook provided by the router.
6297
- * The router navigation starts, reaches the point when preactivation is done, and then
6298
- * pauses. It waits for the hook to be resolved. We then resolve it only in a bootstrap listener.
6299
- */
6300
- class RouterInitializer {
6301
- constructor(injector) {
6302
- this.injector = injector;
6303
- this.initNavigation = false;
6304
- this.destroyed = false;
6305
- this.resultOfPreactivationDone = new Subject();
6306
- }
6307
- appInitializer() {
6308
- const p = this.injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
6309
- return p.then(() => {
6310
- // If the injector was destroyed, the DI lookups below will fail.
6311
- if (this.destroyed) {
6312
- return Promise.resolve(true);
6313
- }
6314
- let resolve = null;
6315
- const res = new Promise(r => resolve = r);
6316
- const router = this.injector.get(Router);
6317
- const opts = this.injector.get(ROUTER_CONFIGURATION);
6318
- if (opts.initialNavigation === 'disabled') {
6319
- router.setUpLocationChangeListener();
6320
- resolve(true);
6321
- }
6322
- else if (opts.initialNavigation === 'enabledBlocking') {
6323
- router.afterPreactivation = () => {
6324
- // only the initial navigation should be delayed
6325
- if (!this.initNavigation) {
6326
- this.initNavigation = true;
6327
- resolve(true);
6328
- return this.resultOfPreactivationDone;
6329
- // subsequent navigations should not be delayed
6330
- }
6331
- else {
6332
- return of(void 0);
6333
- }
6334
- };
6335
- router.initialNavigation();
6336
- }
6337
- else {
6338
- resolve(true);
6339
- }
6340
- return res;
6341
- });
6342
- }
6343
- bootstrapListener(bootstrappedComponentRef) {
6344
- const opts = this.injector.get(ROUTER_CONFIGURATION);
6345
- const preloader = this.injector.get(RouterPreloader);
6346
- const routerScroller = this.injector.get(RouterScroller);
6347
- const router = this.injector.get(Router);
6348
- const ref = this.injector.get(ApplicationRef);
6274
+ function getBootstrapListener() {
6275
+ const injector = inject(Injector);
6276
+ return (bootstrappedComponentRef) => {
6277
+ const ref = injector.get(ApplicationRef);
6349
6278
  if (bootstrappedComponentRef !== ref.components[0]) {
6350
6279
  return;
6351
6280
  }
6281
+ const router = injector.get(Router);
6282
+ const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6352
6283
  // Default case
6353
- if (opts.initialNavigation === 'enabledNonBlocking' || opts.initialNavigation === undefined) {
6284
+ if (injector.get(INITIAL_NAVIGATION, null, InjectFlags.Optional) === null) {
6354
6285
  router.initialNavigation();
6355
6286
  }
6356
- preloader.setUpPreloading();
6357
- routerScroller.init();
6287
+ injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();
6288
+ injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)?.init();
6358
6289
  router.resetRootComponentType(ref.componentTypes[0]);
6359
- this.resultOfPreactivationDone.next(void 0);
6360
- this.resultOfPreactivationDone.complete();
6361
- }
6362
- ngOnDestroy() {
6363
- this.destroyed = true;
6364
- }
6365
- }
6366
- RouterInitializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterInitializer, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
6367
- RouterInitializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterInitializer });
6368
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterInitializer, decorators: [{
6369
- type: Injectable
6370
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
6371
- function getAppInitializer(r) {
6372
- return r.appInitializer.bind(r);
6373
- }
6374
- function getBootstrapListener(r) {
6375
- return r.bootstrapListener.bind(r);
6290
+ bootstrapDone.next();
6291
+ bootstrapDone.complete();
6292
+ };
6376
6293
  }
6294
+ // TODO(atscott): This should not be in the public API
6377
6295
  /**
6378
6296
  * A [DI token](guide/glossary/#di-token) for the router initializer that
6379
6297
  * is called after the app is bootstrapped.
6380
6298
  *
6381
6299
  * @publicApi
6382
6300
  */
6383
- const ROUTER_INITIALIZER = new InjectionToken('Router Initializer');
6301
+ const ROUTER_INITIALIZER = new InjectionToken(NG_DEV_MODE ? 'Router Initializer' : '');
6302
+ function provideInitialNavigation(config) {
6303
+ return [
6304
+ config.initialNavigation === 'disabled' ? provideDisabledInitialNavigation() : [],
6305
+ config.initialNavigation === 'enabledBlocking' ? provideEnabledBlockingInitialNavigation() : [],
6306
+ ];
6307
+ }
6384
6308
  function provideRouterInitializer() {
6385
6309
  return [
6386
- RouterInitializer,
6310
+ // ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
6311
+ // have `getBootstrapListener` directly attached to APP_BOOTSTRAP_LISTENER.
6312
+ { provide: ROUTER_INITIALIZER, useFactory: getBootstrapListener },
6313
+ { provide: APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
6314
+ ];
6315
+ }
6316
+ /**
6317
+ * A subject used to indicate that the bootstrapping phase is done. When initial navigation is
6318
+ * `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
6319
+ * to the activation phase.
6320
+ */
6321
+ const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicator' : '', {
6322
+ factory: () => {
6323
+ return new Subject();
6324
+ }
6325
+ });
6326
+ function provideEnabledBlockingInitialNavigation() {
6327
+ return [
6328
+ { provide: INITIAL_NAVIGATION, useValue: 'enabledBlocking' },
6387
6329
  {
6388
6330
  provide: APP_INITIALIZER,
6389
6331
  multi: true,
6390
- useFactory: getAppInitializer,
6391
- deps: [RouterInitializer]
6332
+ deps: [Injector],
6333
+ useFactory: (injector) => {
6334
+ const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
6335
+ let initNavigation = false;
6336
+ /**
6337
+ * Performs the given action once the router finishes its next/current navigation.
6338
+ *
6339
+ * If the navigation is canceled or errors without a redirect, the navigation is considered
6340
+ * complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
6341
+ */
6342
+ function afterNextNavigation(action) {
6343
+ const router = injector.get(Router);
6344
+ router.events
6345
+ .pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
6346
+ e instanceof NavigationError), map(e => {
6347
+ if (e instanceof NavigationEnd) {
6348
+ // Navigation assumed to succeed if we get `ActivationStart`
6349
+ return true;
6350
+ }
6351
+ const newNavigationStarted = router.navigationId !== e.id;
6352
+ // TODO(atscott): Do not rely on the string reason to determine if cancelation
6353
+ // is redirecting
6354
+ const redirectingWithUrlTree = e instanceof NavigationCancel ?
6355
+ e.reason.indexOf(REDIRECTING_CANCELLATION_REASON) !== -1 :
6356
+ false;
6357
+ // Navigation failed, but if we already have a new navigation, wait for the
6358
+ // result of that one instead.
6359
+ return newNavigationStarted || redirectingWithUrlTree ? null : false;
6360
+ }), filter((result) => result !== null), take(1))
6361
+ .subscribe(() => {
6362
+ action();
6363
+ });
6364
+ }
6365
+ return () => {
6366
+ return locationInitialized.then(() => {
6367
+ return new Promise(resolve => {
6368
+ const router = injector.get(Router);
6369
+ const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6370
+ afterNextNavigation(() => {
6371
+ // Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
6372
+ // without a redirect.
6373
+ resolve(true);
6374
+ initNavigation = true;
6375
+ });
6376
+ router.afterPreactivation = () => {
6377
+ // Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
6378
+ // assume activation will complete successfully (even though this is not
6379
+ // guaranteed).
6380
+ resolve(true);
6381
+ // only the initial navigation should be delayed until bootstrapping is done.
6382
+ if (!initNavigation) {
6383
+ return bootstrapDone.closed ? of(void 0) : bootstrapDone;
6384
+ // subsequent navigations should not be delayed
6385
+ }
6386
+ else {
6387
+ return of(void 0);
6388
+ }
6389
+ };
6390
+ router.initialNavigation();
6391
+ });
6392
+ });
6393
+ };
6394
+ }
6392
6395
  },
6393
- { provide: ROUTER_INITIALIZER, useFactory: getBootstrapListener, deps: [RouterInitializer] },
6394
- { provide: APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
6396
+ ];
6397
+ }
6398
+ const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '');
6399
+ function provideDisabledInitialNavigation() {
6400
+ return [
6401
+ {
6402
+ provide: APP_INITIALIZER,
6403
+ multi: true,
6404
+ useFactory: () => {
6405
+ const router = inject(Router);
6406
+ return () => {
6407
+ router.setUpLocationChangeListener();
6408
+ };
6409
+ }
6410
+ },
6411
+ { provide: INITIAL_NAVIGATION, useValue: 'disabled' }
6412
+ ];
6413
+ }
6414
+ function provideTracing() {
6415
+ if (NG_DEV_MODE) {
6416
+ return [{
6417
+ provide: ENVIRONMENT_INITIALIZER,
6418
+ multi: true,
6419
+ useFactory: () => {
6420
+ const router = inject(Router);
6421
+ return () => router.events.subscribe((e) => {
6422
+ // tslint:disable:no-console
6423
+ console.group?.(`Router Event: ${e.constructor.name}`);
6424
+ console.log(stringifyEvent(e));
6425
+ console.log(e);
6426
+ console.groupEnd?.();
6427
+ // tslint:enable:no-console
6428
+ });
6429
+ }
6430
+ }];
6431
+ }
6432
+ else {
6433
+ return [];
6434
+ }
6435
+ }
6436
+ function providePreloading(preloadingStrategy) {
6437
+ return [
6438
+ RouterPreloader,
6439
+ { provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
6440
+ { provide: PreloadingStrategy, useExisting: preloadingStrategy },
6395
6441
  ];
6396
6442
  }
6397
6443
 
@@ -6405,7 +6451,7 @@ function provideRouterInitializer() {
6405
6451
  /**
6406
6452
  * @publicApi
6407
6453
  */
6408
- const VERSION = new Version('14.0.2');
6454
+ const VERSION = new Version('14.0.5');
6409
6455
 
6410
6456
  /**
6411
6457
  * @license
@@ -6444,5 +6490,5 @@ const VERSION = new Version('14.0.2');
6444
6490
  * Generated bundle index. Do not edit.
6445
6491
  */
6446
6492
 
6447
- export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten };
6493
+ export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, providePreloading as ɵprovidePreloading };
6448
6494
  //# sourceMappingURL=router.mjs.map