@angular/router 14.1.0-next.2 → 14.1.0-rc.0

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 (38) hide show
  1. package/esm2020/src/apply_redirects.mjs +14 -8
  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/events.mjs +22 -4
  9. package/esm2020/src/index.mjs +1 -1
  10. package/esm2020/src/models.mjs +1 -1
  11. package/esm2020/src/navigation_canceling_error.mjs +32 -0
  12. package/esm2020/src/operators/check_guards.mjs +16 -49
  13. package/esm2020/src/operators/prioritized_guard_value.mjs +22 -27
  14. package/esm2020/src/page_title_strategy.mjs +3 -3
  15. package/esm2020/src/recognize.mjs +4 -3
  16. package/esm2020/src/router.mjs +27 -27
  17. package/esm2020/src/router_config_loader.mjs +3 -3
  18. package/esm2020/src/router_module.mjs +46 -12
  19. package/esm2020/src/router_preloader.mjs +9 -9
  20. package/esm2020/src/router_scroller.mjs +3 -3
  21. package/esm2020/src/shared.mjs +1 -10
  22. package/esm2020/src/url_tree.mjs +9 -4
  23. package/esm2020/src/utils/config.mjs +17 -17
  24. package/esm2020/src/utils/type_guards.mjs +9 -5
  25. package/esm2020/src/version.mjs +1 -1
  26. package/esm2020/testing/src/router_testing_module.mjs +4 -4
  27. package/fesm2015/router.mjs +241 -188
  28. package/fesm2015/router.mjs.map +1 -1
  29. package/fesm2015/testing.mjs +5 -5
  30. package/fesm2015/upgrade.mjs +1 -1
  31. package/fesm2020/router.mjs +239 -188
  32. package/fesm2020/router.mjs.map +1 -1
  33. package/fesm2020/testing.mjs +5 -5
  34. package/fesm2020/upgrade.mjs +1 -1
  35. package/index.d.ts +77 -7
  36. package/package.json +4 -4
  37. package/testing/index.d.ts +1 -1
  38. package/upgrade/index.d.ts +1 -1
@@ -1,13 +1,13 @@
1
1
  /**
2
- * @license Angular v14.1.0-next.2
2
+ * @license Angular v14.1.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import * as i0 from '@angular/core';
8
- 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, Inject, ApplicationRef, ENVIRONMENT_INITIALIZER, Version } from '@angular/core';
8
+ 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';
9
9
  import { from, of, BehaviorSubject, combineLatest, concat, defer, pipe, throwError, EmptyError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
10
- import { map, switchMap, take, startWith, scan, filter, mergeMap, first, concatMap, tap, catchError, last as last$1, takeWhile, defaultIfEmpty, takeLast, mapTo, finalize, refCount, mergeAll } from 'rxjs/operators';
10
+ import { map, switchMap, take, startWith, filter, mergeMap, first, concatMap, tap, catchError, scan, last as last$1, takeWhile, defaultIfEmpty, takeLast, mapTo, finalize, refCount, mergeAll } from 'rxjs/operators';
11
11
  import * as i3 from '@angular/common';
12
12
  import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
13
13
  import * as i1 from '@angular/platform-browser';
@@ -60,15 +60,6 @@ class ParamsAsMap {
60
60
  function convertToParamMap(params) {
61
61
  return new ParamsAsMap(params);
62
62
  }
63
- const NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
64
- function navigationCancelingError(message) {
65
- const error = Error('NavigationCancelingError: ' + message);
66
- error[NAVIGATION_CANCELING_ERROR] = true;
67
- return error;
68
- }
69
- function isNavigationCancelingError(error) {
70
- return error && error[NAVIGATION_CANCELING_ERROR];
71
- }
72
63
  // Matches the route configuration (`route`) against the actual URL (`segments`).
73
64
  function defaultUrlMatcher(segments, segmentGroup, route) {
74
65
  const parts = route.path.split('/');
@@ -191,6 +182,7 @@ function wrapIntoObservable(value) {
191
182
  * Use of this source code is governed by an MIT-style license that can be
192
183
  * found in the LICENSE file at https://angular.io/license
193
184
  */
185
+ const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
194
186
  function createEmptyUrlTree() {
195
187
  return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
196
188
  }
@@ -655,7 +647,7 @@ class UrlParser {
655
647
  parseSegment() {
656
648
  const path = matchSegments(this.remaining);
657
649
  if (path === '' && this.peekStartsWith(';')) {
658
- throw new Error(`Empty path url segment cannot have parameters: '${this.remaining}'.`);
650
+ throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$7 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
659
651
  }
660
652
  this.capture(path);
661
653
  return new UrlSegment(decode(path), this.parseMatrixParams());
@@ -724,7 +716,7 @@ class UrlParser {
724
716
  // if is is not one of these characters, then the segment was unescaped
725
717
  // or the group was not closed
726
718
  if (next !== '/' && next !== ')' && next !== ';') {
727
- throw new Error(`Cannot parse url '${this.url}'`);
719
+ throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$7 && `Cannot parse url '${this.url}'`);
728
720
  }
729
721
  let outletName = undefined;
730
722
  if (path.indexOf(':') > -1) {
@@ -755,7 +747,7 @@ class UrlParser {
755
747
  }
756
748
  capture(str) {
757
749
  if (!this.consumeOptional(str)) {
758
- throw new Error(`Expected "${str}".`);
750
+ throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$7 && `Expected "${str}".`);
759
751
  }
760
752
  }
761
753
  }
@@ -797,6 +789,9 @@ function mergeTrivialChildren(s) {
797
789
  }
798
790
  return s;
799
791
  }
792
+ function isUrlTree(v) {
793
+ return v instanceof UrlTree;
794
+ }
800
795
 
801
796
  /**
802
797
  * @license
@@ -805,6 +800,7 @@ function mergeTrivialChildren(s) {
805
800
  * Use of this source code is governed by an MIT-style license that can be
806
801
  * found in the LICENSE file at https://angular.io/license
807
802
  */
803
+ const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
808
804
  /**
809
805
  * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
810
806
  *
@@ -982,11 +978,11 @@ class Navigation {
982
978
  this.numberOfDoubleDots = numberOfDoubleDots;
983
979
  this.commands = commands;
984
980
  if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
985
- throw new Error('Root segment cannot have matrix parameters');
981
+ throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$6 && 'Root segment cannot have matrix parameters');
986
982
  }
987
983
  const cmdWithOutlet = commands.find(isCommandWithOutlets);
988
984
  if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
989
- throw new Error('{outlets:{}} has to be the last command');
985
+ throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$6 && '{outlets:{}} has to be the last command');
990
986
  }
991
987
  }
992
988
  toRoot() {
@@ -1085,7 +1081,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
1085
1081
  dd -= ci;
1086
1082
  g = g.parent;
1087
1083
  if (!g) {
1088
- throw new Error('Invalid number of \'../\'');
1084
+ throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$6 && 'Invalid number of \'../\'');
1089
1085
  }
1090
1086
  ci = g.segments.length;
1091
1087
  }
@@ -1340,10 +1336,20 @@ class NavigationCancel extends RouterEvent {
1340
1336
  id,
1341
1337
  /** @docsNotRequired */
1342
1338
  url,
1343
- /** @docsNotRequired */
1344
- reason) {
1339
+ /**
1340
+ * A description of why the navigation was cancelled. For debug purposes only. Use `code`
1341
+ * instead for a stable cancellation reason that can be used in production.
1342
+ */
1343
+ reason,
1344
+ /**
1345
+ * A code to indicate why the navigation was canceled. This cancellation code is stable for
1346
+ * the reason and can be relied on whereas the `reason` string could change and should not be
1347
+ * used in production.
1348
+ */
1349
+ code) {
1345
1350
  super(id, url);
1346
1351
  this.reason = reason;
1352
+ this.code = code;
1347
1353
  this.type = 2 /* EventType.NavigationCancel */;
1348
1354
  }
1349
1355
  /** @docsNotRequired */
@@ -1367,9 +1373,17 @@ class NavigationError extends RouterEvent {
1367
1373
  /** @docsNotRequired */
1368
1374
  url,
1369
1375
  /** @docsNotRequired */
1370
- error) {
1376
+ error,
1377
+ /**
1378
+ * The target of the navigation when the error occurred.
1379
+ *
1380
+ * Note that this can be `undefined` because an error could have occurred before the
1381
+ * `RouterStateSnapshot` was created for the navigation.
1382
+ */
1383
+ target) {
1371
1384
  super(id, url);
1372
1385
  this.error = error;
1386
+ this.target = target;
1373
1387
  this.type = 3 /* EventType.NavigationError */;
1374
1388
  }
1375
1389
  /** @docsNotRequired */
@@ -2233,6 +2247,37 @@ function createActivatedRoute(c) {
2233
2247
  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);
2234
2248
  }
2235
2249
 
2250
+ /**
2251
+ * @license
2252
+ * Copyright Google LLC All Rights Reserved.
2253
+ *
2254
+ * Use of this source code is governed by an MIT-style license that can be
2255
+ * found in the LICENSE file at https://angular.io/license
2256
+ */
2257
+ const NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
2258
+ function redirectingNavigationError(urlSerializer, redirect) {
2259
+ const { redirectTo, navigationBehaviorOptions } = isUrlTree(redirect) ? { redirectTo: redirect, navigationBehaviorOptions: undefined } : redirect;
2260
+ const error = navigationCancelingError(ngDevMode && `Redirecting to "${urlSerializer.serialize(redirectTo)}"`, 0 /* NavigationCancellationCode.Redirect */, redirect);
2261
+ error.url = redirectTo;
2262
+ error.navigationBehaviorOptions = navigationBehaviorOptions;
2263
+ return error;
2264
+ }
2265
+ function navigationCancelingError(message, code, redirectUrl) {
2266
+ const error = new Error('NavigationCancelingError: ' + (message || ''));
2267
+ error[NAVIGATION_CANCELING_ERROR] = true;
2268
+ error.cancellationCode = code;
2269
+ if (redirectUrl) {
2270
+ error.url = redirectUrl;
2271
+ }
2272
+ return error;
2273
+ }
2274
+ function isRedirectingNavigationCancelingError$1(error) {
2275
+ return isNavigationCancelingError$1(error) && isUrlTree(error.url);
2276
+ }
2277
+ function isNavigationCancelingError$1(error) {
2278
+ return error && error[NAVIGATION_CANCELING_ERROR];
2279
+ }
2280
+
2236
2281
  /**
2237
2282
  * @license
2238
2283
  * Copyright Google LLC All Rights Reserved.
@@ -2319,6 +2364,7 @@ class ChildrenOutletContexts {
2319
2364
  * Use of this source code is governed by an MIT-style license that can be
2320
2365
  * found in the LICENSE file at https://angular.io/license
2321
2366
  */
2367
+ const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
2322
2368
  /**
2323
2369
  * @description
2324
2370
  *
@@ -2395,7 +2441,11 @@ class RouterOutlet {
2395
2441
  }
2396
2442
  /** @nodoc */
2397
2443
  ngOnDestroy() {
2398
- this.parentContexts.onChildOutletDestroyed(this.name);
2444
+ var _a;
2445
+ // Ensure that the registered outlet is this one before removing it on the context.
2446
+ if (((_a = this.parentContexts.getContext(this.name)) === null || _a === void 0 ? void 0 : _a.outlet) === this) {
2447
+ this.parentContexts.onChildOutletDestroyed(this.name);
2448
+ }
2399
2449
  }
2400
2450
  /** @nodoc */
2401
2451
  ngOnInit() {
@@ -2424,12 +2474,12 @@ class RouterOutlet {
2424
2474
  */
2425
2475
  get component() {
2426
2476
  if (!this.activated)
2427
- throw new Error('Outlet is not activated');
2477
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2428
2478
  return this.activated.instance;
2429
2479
  }
2430
2480
  get activatedRoute() {
2431
2481
  if (!this.activated)
2432
- throw new Error('Outlet is not activated');
2482
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2433
2483
  return this._activatedRoute;
2434
2484
  }
2435
2485
  get activatedRouteData() {
@@ -2443,7 +2493,7 @@ class RouterOutlet {
2443
2493
  */
2444
2494
  detach() {
2445
2495
  if (!this.activated)
2446
- throw new Error('Outlet is not activated');
2496
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2447
2497
  this.location.detach();
2448
2498
  const cmp = this.activated;
2449
2499
  this.activated = null;
@@ -2471,7 +2521,7 @@ class RouterOutlet {
2471
2521
  }
2472
2522
  activateWith(activatedRoute, resolverOrInjector) {
2473
2523
  if (this.isActivated) {
2474
- throw new Error('Cannot activate an already activated outlet');
2524
+ throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$5 && 'Cannot activate an already activated outlet');
2475
2525
  }
2476
2526
  this._activatedRoute = activatedRoute;
2477
2527
  const location = this.location;
@@ -2493,9 +2543,9 @@ class RouterOutlet {
2493
2543
  this.activateEvents.emit(this.activated.instance);
2494
2544
  }
2495
2545
  }
2496
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.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 });
2497
- RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.2", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2498
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterOutlet, decorators: [{
2546
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
2547
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-rc.0", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2548
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterOutlet, decorators: [{
2499
2549
  type: Directive,
2500
2550
  args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
2501
2551
  }], ctorParameters: function () {
@@ -2554,9 +2604,9 @@ function isComponentFactoryResolver(item) {
2554
2604
  */
2555
2605
  class ɵEmptyOutletComponent {
2556
2606
  }
2557
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2558
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0-next.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"] }] });
2559
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2607
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2608
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0-rc.0", 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"] }] });
2609
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2560
2610
  type: Component,
2561
2611
  args: [{ template: `<router-outlet></router-outlet>` }]
2562
2612
  }] });
@@ -2606,13 +2656,13 @@ function validateConfig(config, parentPath = '', requireStandaloneComponents = f
2606
2656
  }
2607
2657
  function assertStandalone(fullPath, component) {
2608
2658
  if (component && !ɵisStandalone(component)) {
2609
- throw new Error(`Invalid configuration of route '${fullPath}'. The component must be standalone.`);
2659
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);
2610
2660
  }
2611
2661
  }
2612
2662
  function validateNode(route, fullPath, requireStandaloneComponents) {
2613
2663
  if (typeof ngDevMode === 'undefined' || ngDevMode) {
2614
2664
  if (!route) {
2615
- throw new Error(`
2665
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `
2616
2666
  Invalid configuration of route '${fullPath}': Encountered undefined route.
2617
2667
  The reason might be an extra comma.
2618
2668
 
@@ -2625,47 +2675,47 @@ function validateNode(route, fullPath, requireStandaloneComponents) {
2625
2675
  `);
2626
2676
  }
2627
2677
  if (Array.isArray(route)) {
2628
- throw new Error(`Invalid configuration of route '${fullPath}': Array cannot be specified`);
2678
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': Array cannot be specified`);
2629
2679
  }
2630
2680
  if (!route.component && !route.loadComponent && !route.children && !route.loadChildren &&
2631
2681
  (route.outlet && route.outlet !== PRIMARY_OUTLET)) {
2632
- throw new Error(`Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);
2682
+ 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`);
2633
2683
  }
2634
2684
  if (route.redirectTo && route.children) {
2635
- throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
2685
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
2636
2686
  }
2637
2687
  if (route.redirectTo && route.loadChildren) {
2638
- throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
2688
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
2639
2689
  }
2640
2690
  if (route.children && route.loadChildren) {
2641
- throw new Error(`Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
2691
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
2642
2692
  }
2643
2693
  if (route.redirectTo && (route.component || route.loadComponent)) {
2644
- throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
2694
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
2645
2695
  }
2646
2696
  if (route.component && route.loadComponent) {
2647
- throw new Error(`Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
2697
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
2648
2698
  }
2649
2699
  if (route.redirectTo && route.canActivate) {
2650
- throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and canActivate cannot be used together. Redirects happen before activation ` +
2700
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and canActivate cannot be used together. Redirects happen before activation ` +
2651
2701
  `so canActivate will never be executed.`);
2652
2702
  }
2653
2703
  if (route.path && route.matcher) {
2654
- throw new Error(`Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
2704
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
2655
2705
  }
2656
2706
  if (route.redirectTo === void 0 && !route.component && !route.loadComponent &&
2657
2707
  !route.children && !route.loadChildren) {
2658
- throw new Error(`Invalid configuration of route '${fullPath}'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren`);
2708
+ 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`);
2659
2709
  }
2660
2710
  if (route.path === void 0 && route.matcher === void 0) {
2661
- throw new Error(`Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
2711
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
2662
2712
  }
2663
2713
  if (typeof route.path === 'string' && route.path.charAt(0) === '/') {
2664
- throw new Error(`Invalid configuration of route '${fullPath}': path cannot start with a slash`);
2714
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);
2665
2715
  }
2666
2716
  if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {
2667
2717
  const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;
2668
- throw new Error(`Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
2718
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
2669
2719
  }
2670
2720
  if (requireStandaloneComponents) {
2671
2721
  assertStandalone(fullPath, route.component);
@@ -3095,9 +3145,6 @@ function isFunction(v) {
3095
3145
  function isBoolean(v) {
3096
3146
  return typeof v === 'boolean';
3097
3147
  }
3098
- function isUrlTree(v) {
3099
- return v instanceof UrlTree;
3100
- }
3101
3148
  function isCanLoad(guard) {
3102
3149
  return guard && isFunction(guard.canLoad);
3103
3150
  }
@@ -3113,6 +3160,12 @@ function isCanDeactivate(guard) {
3113
3160
  function isCanMatch(guard) {
3114
3161
  return guard && isFunction(guard.canMatch);
3115
3162
  }
3163
+ function isRedirectingNavigationCancelingError(error) {
3164
+ return isNavigationCancelingError(error) && isUrlTree(error.url);
3165
+ }
3166
+ function isNavigationCancelingError(error) {
3167
+ return error && error[NAVIGATION_CANCELING_ERROR];
3168
+ }
3116
3169
 
3117
3170
  /**
3118
3171
  * @license
@@ -3125,31 +3178,26 @@ const INITIAL_VALUE = Symbol('INITIAL_VALUE');
3125
3178
  function prioritizedGuardValue() {
3126
3179
  return switchMap(obs => {
3127
3180
  return combineLatest(obs.map(o => o.pipe(take(1), startWith(INITIAL_VALUE))))
3128
- .pipe(scan((acc, list) => {
3129
- let isPending = false;
3130
- return list.reduce((innerAcc, val, i) => {
3131
- if (innerAcc !== INITIAL_VALUE)
3132
- return innerAcc;
3133
- // Toggle pending flag if any values haven't been set yet
3134
- if (val === INITIAL_VALUE)
3135
- isPending = true;
3136
- // Any other return values are only valid if we haven't yet hit a pending
3137
- // call. This guarantees that in the case of a guard at the bottom of the
3138
- // tree that returns a redirect, we will wait for the higher priority
3139
- // guard at the top to finish before performing the redirect.
3140
- if (!isPending) {
3141
- // Early return when we hit a `false` value as that should always
3142
- // cancel navigation
3143
- if (val === false)
3144
- return val;
3145
- if (i === list.length - 1 || isUrlTree(val)) {
3146
- return val;
3147
- }
3181
+ .pipe(map((results) => {
3182
+ for (const result of results) {
3183
+ if (result === true) {
3184
+ // If result is true, check the next one
3185
+ continue;
3186
+ }
3187
+ else if (result === INITIAL_VALUE) {
3188
+ // If guard has not finished, we need to stop processing.
3189
+ return INITIAL_VALUE;
3190
+ }
3191
+ else if (result === false || result instanceof UrlTree) {
3192
+ // Result finished and was not true. Return the result.
3193
+ // Note that we only allow false/UrlTree. Other values are considered invalid and
3194
+ // ignored.
3195
+ return result;
3148
3196
  }
3149
- return innerAcc;
3150
- }, acc);
3151
- }, INITIAL_VALUE), filter(item => item !== INITIAL_VALUE), map(item => isUrlTree(item) ? item : item === true), //
3152
- take(1));
3197
+ }
3198
+ // Everything resolved to true. Return true.
3199
+ return true;
3200
+ }), filter((item) => item !== INITIAL_VALUE), take(1));
3153
3201
  });
3154
3202
  }
3155
3203
 
@@ -3221,17 +3269,9 @@ function runCanActivate(futureRSS, futureARS, moduleInjector) {
3221
3269
  const canActivateObservables = canActivate.map((c) => {
3222
3270
  return defer(() => {
3223
3271
  const guard = getToken(c, futureARS, moduleInjector);
3224
- let observable;
3225
- if (isCanActivate(guard)) {
3226
- observable = wrapIntoObservable(guard.canActivate(futureARS, futureRSS));
3227
- }
3228
- else if (isFunction(guard)) {
3229
- observable = wrapIntoObservable(guard(futureARS, futureRSS));
3230
- }
3231
- else {
3232
- throw new Error('Invalid CanActivate guard');
3233
- }
3234
- return observable.pipe(first());
3272
+ const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) :
3273
+ guard(futureARS, futureRSS);
3274
+ return wrapIntoObservable(guardVal).pipe(first());
3235
3275
  });
3236
3276
  });
3237
3277
  return of(canActivateObservables).pipe(prioritizedGuardValue());
@@ -3246,17 +3286,9 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
3246
3286
  return defer(() => {
3247
3287
  const guardsMapped = d.guards.map((c) => {
3248
3288
  const guard = getToken(c, d.node, moduleInjector);
3249
- let observable;
3250
- if (isCanActivateChild(guard)) {
3251
- observable = wrapIntoObservable(guard.canActivateChild(futureARS, futureRSS));
3252
- }
3253
- else if (isFunction(guard)) {
3254
- observable = wrapIntoObservable(guard(futureARS, futureRSS));
3255
- }
3256
- else {
3257
- throw new Error('Invalid CanActivateChild guard');
3258
- }
3259
- return observable.pipe(first());
3289
+ const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) :
3290
+ guard(futureARS, futureRSS);
3291
+ return wrapIntoObservable(guardVal).pipe(first());
3260
3292
  });
3261
3293
  return of(guardsMapped).pipe(prioritizedGuardValue());
3262
3294
  });
@@ -3269,17 +3301,10 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
3269
3301
  return of(true);
3270
3302
  const canDeactivateObservables = canDeactivate.map((c) => {
3271
3303
  const guard = getToken(c, currARS, moduleInjector);
3272
- let observable;
3273
- if (isCanDeactivate(guard)) {
3274
- observable = wrapIntoObservable(guard.canDeactivate(component, currARS, currRSS, futureRSS));
3275
- }
3276
- else if (isFunction(guard)) {
3277
- observable = wrapIntoObservable(guard(component, currARS, currRSS, futureRSS));
3278
- }
3279
- else {
3280
- throw new Error('Invalid CanDeactivate guard');
3281
- }
3282
- return observable.pipe(first());
3304
+ const guardVal = isCanDeactivate(guard) ?
3305
+ guard.canDeactivate(component, currARS, currRSS, futureRSS) :
3306
+ guard(component, currARS, currRSS, futureRSS);
3307
+ return wrapIntoObservable(guardVal).pipe(first());
3283
3308
  });
3284
3309
  return of(canDeactivateObservables).pipe(prioritizedGuardValue());
3285
3310
  }
@@ -3290,16 +3315,7 @@ function runCanLoadGuards(injector, route, segments, urlSerializer) {
3290
3315
  }
3291
3316
  const canLoadObservables = canLoad.map((injectionToken) => {
3292
3317
  const guard = injector.get(injectionToken);
3293
- let guardVal;
3294
- if (isCanLoad(guard)) {
3295
- guardVal = guard.canLoad(route, segments);
3296
- }
3297
- else if (isFunction(guard)) {
3298
- guardVal = guard(route, segments);
3299
- }
3300
- else {
3301
- throw new Error('Invalid CanLoad guard');
3302
- }
3318
+ const guardVal = isCanLoad(guard) ? guard.canLoad(route, segments) : guard(route, segments);
3303
3319
  return wrapIntoObservable(guardVal);
3304
3320
  });
3305
3321
  return of(canLoadObservables)
@@ -3309,9 +3325,7 @@ function redirectIfUrlTree(urlSerializer) {
3309
3325
  return pipe(tap((result) => {
3310
3326
  if (!isUrlTree(result))
3311
3327
  return;
3312
- const error = navigationCancelingError(`Redirecting to "${urlSerializer.serialize(result)}"`);
3313
- error.url = result;
3314
- throw error;
3328
+ throw redirectingNavigationError(urlSerializer, result);
3315
3329
  }), map(result => result === true));
3316
3330
  }
3317
3331
  function runCanMatchGuards(injector, route, segments, urlSerializer) {
@@ -3489,6 +3503,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
3489
3503
  * Use of this source code is governed by an MIT-style license that can be
3490
3504
  * found in the LICENSE file at https://angular.io/license
3491
3505
  */
3506
+ const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || ngDevMode;
3492
3507
  class NoMatch$1 {
3493
3508
  constructor(segmentGroup) {
3494
3509
  this.segmentGroup = segmentGroup || null;
@@ -3506,10 +3521,12 @@ function absoluteRedirect(newTree) {
3506
3521
  return throwError(new AbsoluteRedirect(newTree));
3507
3522
  }
3508
3523
  function namedOutletsRedirect(redirectTo) {
3509
- return throwError(new Error(`Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3524
+ return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$4 &&
3525
+ `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3510
3526
  }
3511
3527
  function canLoadFails(route) {
3512
- return throwError(navigationCancelingError(`Cannot load children because the guard of the route "path: '${route.path}'" returned false`));
3528
+ return throwError(navigationCancelingError(NG_DEV_MODE$4 &&
3529
+ `Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
3513
3530
  }
3514
3531
  /**
3515
3532
  * Returns the `UrlTree` with the redirection applied.
@@ -3568,7 +3585,7 @@ class ApplyRedirects {
3568
3585
  }));
3569
3586
  }
3570
3587
  noMatchError(e) {
3571
- return new Error(`Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3588
+ return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$4 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3572
3589
  }
3573
3590
  createUrlTree(rootCandidate, queryParams, fragment) {
3574
3591
  const root = createRoot(rootCandidate);
@@ -3750,9 +3767,9 @@ class ApplyRedirects {
3750
3767
  }
3751
3768
  }
3752
3769
  applyRedirectCommands(segments, redirectTo, posParams) {
3753
- return this.applyRedirectCreatreUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams);
3770
+ return this.applyRedirectCreateUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams);
3754
3771
  }
3755
- applyRedirectCreatreUrlTree(redirectTo, urlTree, segments, posParams) {
3772
+ applyRedirectCreateUrlTree(redirectTo, urlTree, segments, posParams) {
3756
3773
  const newRoot = this.createSegmentGroup(redirectTo, urlTree.root, segments, posParams);
3757
3774
  return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment);
3758
3775
  }
@@ -3785,7 +3802,8 @@ class ApplyRedirects {
3785
3802
  findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3786
3803
  const pos = posParams[redirectToUrlSegment.path.substring(1)];
3787
3804
  if (!pos)
3788
- throw new Error(`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3805
+ throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$4 &&
3806
+ `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3789
3807
  return pos;
3790
3808
  }
3791
3809
  findOrReturn(redirectToUrlSegment, actualSegments) {
@@ -3909,7 +3927,7 @@ class Recognizer {
3909
3927
  // multiple activated results for the same outlet. We should merge the children of
3910
3928
  // these results so the final return value is only one `TreeNode` per outlet.
3911
3929
  const mergedChildren = mergeEmptyPathMatches(children);
3912
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
3930
+ if (NG_DEV_MODE$3) {
3913
3931
  // This should really never happen - we are only taking the first match for each
3914
3932
  // outlet and merge the empty path matches.
3915
3933
  checkOutletNameUniqueness(mergedChildren);
@@ -4075,7 +4093,7 @@ function checkOutletNameUniqueness(nodes) {
4075
4093
  if (routeWithSameOutletName) {
4076
4094
  const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
4077
4095
  const c = n.value.url.map(s => s.toString()).join('/');
4078
- throw new Error(`Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4096
+ 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}'.`);
4079
4097
  }
4080
4098
  names[n.value.outlet] = n.value;
4081
4099
  });
@@ -4384,9 +4402,9 @@ class RouterConfigLoader {
4384
4402
  }));
4385
4403
  }
4386
4404
  }
4387
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4388
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterConfigLoader });
4389
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterConfigLoader, decorators: [{
4405
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4406
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterConfigLoader });
4407
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
4390
4408
  type: Injectable
4391
4409
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4392
4410
 
@@ -4735,16 +4753,14 @@ class Router {
4735
4753
  this.triggerEvent(guardsStart);
4736
4754
  }), map(t => (Object.assign(Object.assign({}, t), { guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts) }))), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
4737
4755
  if (isUrlTree(t.guardsResult)) {
4738
- const error = navigationCancelingError(`Redirecting to "${this.serializeUrl(t.guardsResult)}"`);
4739
- error.url = t.guardsResult;
4740
- throw error;
4756
+ throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
4741
4757
  }
4742
4758
  const guardsEnd = new GuardsCheckEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
4743
4759
  this.triggerEvent(guardsEnd);
4744
4760
  }), filter(t => {
4745
4761
  if (!t.guardsResult) {
4746
4762
  this.restoreHistory(t);
4747
- this.cancelNavigationTransition(t, '');
4763
+ this.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */);
4748
4764
  return false;
4749
4765
  }
4750
4766
  return true;
@@ -4762,7 +4778,9 @@ class Router {
4762
4778
  complete: () => {
4763
4779
  if (!dataResolved) {
4764
4780
  this.restoreHistory(t);
4765
- this.cancelNavigationTransition(t, `At least one route resolver didn't emit any value.`);
4781
+ this.cancelNavigationTransition(t, NG_DEV_MODE$1 ?
4782
+ `At least one route resolver didn't emit any value.` :
4783
+ '', 2 /* NavigationCancellationCode.NoDataFromResolver */);
4766
4784
  }
4767
4785
  }
4768
4786
  }));
@@ -4772,7 +4790,7 @@ class Router {
4772
4790
  }));
4773
4791
  }
4774
4792
  return undefined;
4775
- }), switchTap(() => this.afterPreactivation()),
4793
+ }),
4776
4794
  // --- LOAD COMPONENTS ---
4777
4795
  switchTap((t) => {
4778
4796
  const loadComponents = (route) => {
@@ -4792,11 +4810,11 @@ class Router {
4792
4810
  };
4793
4811
  return combineLatest(loadComponents(t.targetSnapshot.root))
4794
4812
  .pipe(defaultIfEmpty(), take(1));
4795
- }), map((t) => {
4813
+ }), switchTap(() => this.afterPreactivation()), map((t) => {
4796
4814
  const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4797
4815
  return (Object.assign(Object.assign({}, t), { targetRouterState }));
4798
4816
  }),
4799
- /* Once here, we are about to activate syncronously. The assumption is this
4817
+ /* Once here, we are about to activate synchronously. The assumption is this
4800
4818
  will succeed, and user code may read from the Router service. Therefore
4801
4819
  before activation, we need to update router properties storing the current
4802
4820
  URL and the RouterState, as well as updated the browser URL. All this should
@@ -4829,8 +4847,10 @@ class Router {
4829
4847
  * event is fired when a navigation gets cancelled but not caught by other
4830
4848
  * means. */
4831
4849
  if (!completed && !errored) {
4832
- const cancelationReason = `Navigation ID ${t.id} is not equal to the current navigation id ${this.navigationId}`;
4833
- this.cancelNavigationTransition(t, cancelationReason);
4850
+ const cancelationReason = NG_DEV_MODE$1 ?
4851
+ `Navigation ID ${t.id} is not equal to the current navigation id ${this.navigationId}` :
4852
+ '';
4853
+ this.cancelNavigationTransition(t, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
4834
4854
  }
4835
4855
  // Only clear current navigation if it is still set to the one that
4836
4856
  // finalized.
@@ -4838,6 +4858,7 @@ class Router {
4838
4858
  this.currentNavigation = null;
4839
4859
  }
4840
4860
  }), catchError((e) => {
4861
+ var _a;
4841
4862
  // TODO(atscott): The NavigationTransition `t` used here does not accurately
4842
4863
  // reflect the current state of the whole transition because some operations
4843
4864
  // return a new object rather than modifying the one in the outermost
@@ -4852,9 +4873,8 @@ class Router {
4852
4873
  errored = true;
4853
4874
  /* This error type is issued during Redirect, and is handled as a
4854
4875
  * cancellation rather than an error. */
4855
- if (isNavigationCancelingError(e)) {
4856
- const redirecting = isUrlTree(e.url);
4857
- if (!redirecting) {
4876
+ if (isNavigationCancelingError$1(e)) {
4877
+ if (!isRedirectingNavigationCancelingError$1(e)) {
4858
4878
  // Set property only if we're not redirecting. If we landed on a page and
4859
4879
  // redirect to `/` route, the new navigation is going to see the `/`
4860
4880
  // isn't a change from the default currentUrlTree and won't navigate.
@@ -4863,11 +4883,11 @@ class Router {
4863
4883
  this.navigated = true;
4864
4884
  this.restoreHistory(t, true);
4865
4885
  }
4866
- const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message);
4886
+ const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message, e.cancellationCode);
4867
4887
  eventsSubject.next(navCancel);
4868
4888
  // When redirecting, we need to delay resolving the navigation
4869
4889
  // promise and push it to the redirect navigation
4870
- if (!redirecting) {
4890
+ if (!isRedirectingNavigationCancelingError$1(e)) {
4871
4891
  t.resolve(false);
4872
4892
  }
4873
4893
  else {
@@ -4888,7 +4908,7 @@ class Router {
4888
4908
  }
4889
4909
  else {
4890
4910
  this.restoreHistory(t, true);
4891
- const navError = new NavigationError(t.id, this.serializeUrl(t.extractedUrl), e);
4911
+ const navError = new NavigationError(t.id, this.serializeUrl(t.extractedUrl), e, (_a = t.targetSnapshot) !== null && _a !== void 0 ? _a : undefined);
4892
4912
  eventsSubject.next(navError);
4893
4913
  try {
4894
4914
  t.resolve(this.errorHandler(e));
@@ -5292,7 +5312,7 @@ class Router {
5292
5312
  // The navigator change the location before triggered the browser event,
5293
5313
  // so we need to go back to the current url if the navigation is canceled.
5294
5314
  // Also, when navigation gets cancelled while using url update strategy eager, then we need to
5295
- // go back. Because, when `urlUpdateSrategy` is `eager`; `setBrowserUrl` method is called
5315
+ // go back. Because, when `urlUpdateStrategy` is `eager`; `setBrowserUrl` method is called
5296
5316
  // before any verification.
5297
5317
  const browserUrlUpdateOccurred = (t.source === 'popstate' || this.urlUpdateStrategy === 'eager' ||
5298
5318
  this.currentUrlTree === ((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.finalUrl));
@@ -5338,8 +5358,8 @@ class Router {
5338
5358
  resetUrlToCurrentUrlTree() {
5339
5359
  this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
5340
5360
  }
5341
- cancelNavigationTransition(t, reason) {
5342
- const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), reason);
5361
+ cancelNavigationTransition(t, reason, code) {
5362
+ const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), reason, code);
5343
5363
  this.triggerEvent(navCancel);
5344
5364
  t.resolve(false);
5345
5365
  }
@@ -5350,16 +5370,16 @@ class Router {
5350
5370
  return { navigationId };
5351
5371
  }
5352
5372
  }
5353
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5354
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: Router });
5355
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: Router, decorators: [{
5373
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5374
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: Router });
5375
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: Router, decorators: [{
5356
5376
  type: Injectable
5357
5377
  }], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
5358
5378
  function validateCommands(commands) {
5359
5379
  for (let i = 0; i < commands.length; i++) {
5360
5380
  const cmd = commands[i];
5361
5381
  if (cmd == null) {
5362
- throw new Error(`The requested path contains ${cmd} segment at index ${i}`);
5382
+ throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$1 && `The requested path contains ${cmd} segment at index ${i}`);
5363
5383
  }
5364
5384
  }
5365
5385
  }
@@ -5544,9 +5564,9 @@ class RouterLink {
5544
5564
  });
5545
5565
  }
5546
5566
  }
5547
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5548
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.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 });
5549
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterLink, decorators: [{
5567
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5568
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-rc.0", 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 });
5569
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterLink, decorators: [{
5550
5570
  type: Directive,
5551
5571
  args: [{ selector: ':not(a):not(area)[routerLink]' }]
5552
5572
  }], ctorParameters: function () {
@@ -5665,9 +5685,9 @@ class RouterLinkWithHref {
5665
5685
  });
5666
5686
  }
5667
5687
  }
5668
- RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5669
- RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.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 });
5670
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5688
+ RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5689
+ RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-rc.0", 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 });
5690
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5671
5691
  type: Directive,
5672
5692
  args: [{ selector: 'a[routerLink],area[routerLink]' }]
5673
5693
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
@@ -5894,9 +5914,9 @@ class RouterLinkActive {
5894
5914
  this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
5895
5915
  }
5896
5916
  }
5897
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.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 });
5898
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.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 });
5899
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterLinkActive, decorators: [{
5917
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", 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 });
5918
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-rc.0", 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 });
5919
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterLinkActive, decorators: [{
5900
5920
  type: Directive,
5901
5921
  args: [{
5902
5922
  selector: '[routerLinkActive]',
@@ -6002,9 +6022,9 @@ class DefaultTitleStrategy extends TitleStrategy {
6002
6022
  }
6003
6023
  }
6004
6024
  }
6005
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
6006
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
6007
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
6025
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
6026
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
6027
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
6008
6028
  type: Injectable,
6009
6029
  args: [{ providedIn: 'root' }]
6010
6030
  }], ctorParameters: function () { return [{ type: i1.Title }]; } });
@@ -6041,9 +6061,9 @@ class PreloadAllModules {
6041
6061
  return fn().pipe(catchError(() => of(null)));
6042
6062
  }
6043
6063
  }
6044
- PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6045
- PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6046
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: PreloadAllModules, decorators: [{
6064
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6065
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6066
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: PreloadAllModules, decorators: [{
6047
6067
  type: Injectable,
6048
6068
  args: [{ providedIn: 'root' }]
6049
6069
  }] });
@@ -6061,9 +6081,9 @@ class NoPreloading {
6061
6081
  return of(null);
6062
6082
  }
6063
6083
  }
6064
- NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6065
- NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6066
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: NoPreloading, decorators: [{
6084
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6085
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6086
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: NoPreloading, decorators: [{
6067
6087
  type: Injectable,
6068
6088
  args: [{ providedIn: 'root' }]
6069
6089
  }] });
@@ -6151,9 +6171,9 @@ class RouterPreloader {
6151
6171
  });
6152
6172
  }
6153
6173
  }
6154
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6155
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterPreloader });
6156
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterPreloader, decorators: [{
6174
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6175
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterPreloader });
6176
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterPreloader, decorators: [{
6157
6177
  type: Injectable
6158
6178
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
6159
6179
 
@@ -6233,9 +6253,9 @@ class RouterScroller {
6233
6253
  }
6234
6254
  }
6235
6255
  }
6236
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6237
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterScroller });
6238
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterScroller, decorators: [{
6256
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6257
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterScroller });
6258
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterScroller, decorators: [{
6239
6259
  type: Injectable
6240
6260
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
6241
6261
 
@@ -6368,10 +6388,10 @@ class RouterModule {
6368
6388
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
6369
6389
  }
6370
6390
  }
6371
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6372
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6373
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterModule });
6374
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterModule, decorators: [{
6391
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6392
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6393
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterModule });
6394
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterModule, decorators: [{
6375
6395
  type: NgModule,
6376
6396
  args: [{
6377
6397
  declarations: ROUTER_DIRECTIVES,
@@ -6409,7 +6429,7 @@ function providePathLocationStrategy() {
6409
6429
  }
6410
6430
  function provideForRootGuard(router) {
6411
6431
  if (NG_DEV_MODE && router) {
6412
- throw new Error(`RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
6432
+ throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
6413
6433
  }
6414
6434
  return 'guarded';
6415
6435
  }
@@ -6536,17 +6556,50 @@ function provideEnabledBlockingInitialNavigation() {
6536
6556
  useFactory: (injector) => {
6537
6557
  const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
6538
6558
  let initNavigation = false;
6559
+ /**
6560
+ * Performs the given action once the router finishes its next/current navigation.
6561
+ *
6562
+ * If the navigation is canceled or errors without a redirect, the navigation is considered
6563
+ * complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
6564
+ */
6565
+ function afterNextNavigation(action) {
6566
+ const router = injector.get(Router);
6567
+ router.events
6568
+ .pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
6569
+ e instanceof NavigationError), map(e => {
6570
+ if (e instanceof NavigationEnd) {
6571
+ // Navigation assumed to succeed if we get `ActivationStart`
6572
+ return true;
6573
+ }
6574
+ const redirecting = e instanceof NavigationCancel ?
6575
+ (e.code === 0 /* NavigationCancellationCode.Redirect */ ||
6576
+ e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
6577
+ false;
6578
+ return redirecting ? null : false;
6579
+ }), filter((result) => result !== null), take(1))
6580
+ .subscribe(() => {
6581
+ action();
6582
+ });
6583
+ }
6539
6584
  return () => {
6540
6585
  return locationInitialized.then(() => {
6541
6586
  return new Promise(resolve => {
6542
6587
  const router = injector.get(Router);
6543
6588
  const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6589
+ afterNextNavigation(() => {
6590
+ // Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
6591
+ // without a redirect.
6592
+ resolve(true);
6593
+ initNavigation = true;
6594
+ });
6544
6595
  router.afterPreactivation = () => {
6545
- // only the initial navigation should be delayed
6596
+ // Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
6597
+ // assume activation will complete successfully (even though this is not
6598
+ // guaranteed).
6599
+ resolve(true);
6600
+ // only the initial navigation should be delayed until bootstrapping is done.
6546
6601
  if (!initNavigation) {
6547
- initNavigation = true;
6548
- resolve(true);
6549
- return bootstrapDone;
6602
+ return bootstrapDone.closed ? of(void 0) : bootstrapDone;
6550
6603
  // subsequent navigations should not be delayed
6551
6604
  }
6552
6605
  else {
@@ -6618,7 +6671,7 @@ function providePreloading(preloadingStrategy) {
6618
6671
  /**
6619
6672
  * @publicApi
6620
6673
  */
6621
- const VERSION = new Version('14.1.0-next.2');
6674
+ const VERSION = new Version('14.1.0-rc.0');
6622
6675
 
6623
6676
  /**
6624
6677
  * @license