@angular/router 14.1.0-rc.0 → 14.1.2

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 +4 -3
  2. package/esm2020/src/components/empty_outlet.mjs +3 -3
  3. package/esm2020/src/directives/router_link.mjs +6 -6
  4. package/esm2020/src/directives/router_link_active.mjs +3 -3
  5. package/esm2020/src/directives/router_outlet.mjs +3 -3
  6. package/esm2020/src/index.mjs +3 -2
  7. package/esm2020/src/operators/recognize.mjs +1 -1
  8. package/esm2020/src/operators/resolve_data.mjs +4 -3
  9. package/esm2020/src/page_title_strategy.mjs +11 -5
  10. package/esm2020/src/private_export.mjs +3 -2
  11. package/esm2020/src/recognize.mjs +4 -3
  12. package/esm2020/src/router.mjs +128 -72
  13. package/esm2020/src/router_config.mjs +19 -0
  14. package/esm2020/src/router_config_loader.mjs +6 -5
  15. package/esm2020/src/router_module.mjs +21 -78
  16. package/esm2020/src/router_outlet_context.mjs +9 -1
  17. package/esm2020/src/router_preloader.mjs +19 -11
  18. package/esm2020/src/router_scroller.mjs +3 -3
  19. package/esm2020/src/url_tree.mjs +9 -2
  20. package/esm2020/src/utils/type_guards.mjs +5 -1
  21. package/esm2020/src/version.mjs +1 -1
  22. package/esm2020/testing/src/router_testing_module.mjs +10 -12
  23. package/fesm2015/router.mjs +332 -276
  24. package/fesm2015/router.mjs.map +1 -1
  25. package/fesm2015/testing.mjs +10 -12
  26. package/fesm2015/testing.mjs.map +1 -1
  27. package/fesm2015/upgrade.mjs +1 -1
  28. package/fesm2020/router.mjs +326 -278
  29. package/fesm2020/router.mjs.map +1 -1
  30. package/fesm2020/testing.mjs +10 -12
  31. package/fesm2020/testing.mjs.map +1 -1
  32. package/fesm2020/upgrade.mjs +1 -1
  33. package/index.d.ts +10 -7
  34. package/package.json +4 -4
  35. package/testing/index.d.ts +2 -3
  36. package/upgrade/index.d.ts +1 -1
@@ -1,15 +1,15 @@
1
1
  /**
2
- * @license Angular v14.1.0-rc.0
2
+ * @license Angular v14.1.2
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, ɵ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
- import { from, of, BehaviorSubject, combineLatest, concat, defer, pipe, throwError, EmptyError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
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';
8
+ import { ɵisObservable, ɵisPromise, Injectable, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, inject, InjectionToken, InjectFlags, NgModuleFactory, Injector, Compiler, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, NgProbeToken, SkipSelf, NgModule, Inject, ApplicationRef, APP_BOOTSTRAP_LISTENER, APP_INITIALIZER, ENVIRONMENT_INITIALIZER, Version } from '@angular/core';
9
+ import { from, of, BehaviorSubject, EmptyError, combineLatest, concat, defer, pipe, throwError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
11
10
  import * as i3 from '@angular/common';
12
- import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
11
+ import { Location, ViewportScroller, LocationStrategy, HashLocationStrategy, PathLocationStrategy, LOCATION_INITIALIZED } from '@angular/common';
12
+ 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';
13
13
  import * as i1 from '@angular/platform-browser';
14
14
 
15
15
  /**
@@ -182,7 +182,7 @@ function wrapIntoObservable(value) {
182
182
  * Use of this source code is governed by an MIT-style license that can be
183
183
  * found in the LICENSE file at https://angular.io/license
184
184
  */
185
- const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
185
+ const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
186
186
  function createEmptyUrlTree() {
187
187
  return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
188
188
  }
@@ -439,6 +439,12 @@ function mapChildrenIntoArray(segment, fn) {
439
439
  */
440
440
  class UrlSerializer {
441
441
  }
442
+ UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
443
+ UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
444
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: UrlSerializer, decorators: [{
445
+ type: Injectable,
446
+ args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
447
+ }] });
442
448
  /**
443
449
  * @description
444
450
  *
@@ -647,7 +653,7 @@ class UrlParser {
647
653
  parseSegment() {
648
654
  const path = matchSegments(this.remaining);
649
655
  if (path === '' && this.peekStartsWith(';')) {
650
- throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$7 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
656
+ throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$8 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
651
657
  }
652
658
  this.capture(path);
653
659
  return new UrlSegment(decode(path), this.parseMatrixParams());
@@ -716,7 +722,7 @@ class UrlParser {
716
722
  // if is is not one of these characters, then the segment was unescaped
717
723
  // or the group was not closed
718
724
  if (next !== '/' && next !== ')' && next !== ';') {
719
- throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$7 && `Cannot parse url '${this.url}'`);
725
+ throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$8 && `Cannot parse url '${this.url}'`);
720
726
  }
721
727
  let outletName = undefined;
722
728
  if (path.indexOf(':') > -1) {
@@ -747,7 +753,7 @@ class UrlParser {
747
753
  }
748
754
  capture(str) {
749
755
  if (!this.consumeOptional(str)) {
750
- throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$7 && `Expected "${str}".`);
756
+ throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$8 && `Expected "${str}".`);
751
757
  }
752
758
  }
753
759
  }
@@ -800,7 +806,7 @@ function isUrlTree(v) {
800
806
  * Use of this source code is governed by an MIT-style license that can be
801
807
  * found in the LICENSE file at https://angular.io/license
802
808
  */
803
- const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
809
+ const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
804
810
  /**
805
811
  * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
806
812
  *
@@ -978,11 +984,11 @@ class Navigation {
978
984
  this.numberOfDoubleDots = numberOfDoubleDots;
979
985
  this.commands = commands;
980
986
  if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
981
- throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$6 && 'Root segment cannot have matrix parameters');
987
+ throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$7 && 'Root segment cannot have matrix parameters');
982
988
  }
983
989
  const cmdWithOutlet = commands.find(isCommandWithOutlets);
984
990
  if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
985
- throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$6 && '{outlets:{}} has to be the last command');
991
+ throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$7 && '{outlets:{}} has to be the last command');
986
992
  }
987
993
  }
988
994
  toRoot() {
@@ -1081,7 +1087,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
1081
1087
  dd -= ci;
1082
1088
  g = g.parent;
1083
1089
  if (!g) {
1084
- throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$6 && 'Invalid number of \'../\'');
1090
+ throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$7 && 'Invalid number of \'../\'');
1085
1091
  }
1086
1092
  ci = g.segments.length;
1087
1093
  }
@@ -2356,6 +2362,12 @@ class ChildrenOutletContexts {
2356
2362
  return this.contexts.get(childName) || null;
2357
2363
  }
2358
2364
  }
2365
+ ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2366
+ ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2367
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2368
+ type: Injectable,
2369
+ args: [{ providedIn: 'root' }]
2370
+ }] });
2359
2371
 
2360
2372
  /**
2361
2373
  * @license
@@ -2364,7 +2376,7 @@ class ChildrenOutletContexts {
2364
2376
  * Use of this source code is governed by an MIT-style license that can be
2365
2377
  * found in the LICENSE file at https://angular.io/license
2366
2378
  */
2367
- const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
2379
+ const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
2368
2380
  /**
2369
2381
  * @description
2370
2382
  *
@@ -2474,12 +2486,12 @@ class RouterOutlet {
2474
2486
  */
2475
2487
  get component() {
2476
2488
  if (!this.activated)
2477
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2489
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2478
2490
  return this.activated.instance;
2479
2491
  }
2480
2492
  get activatedRoute() {
2481
2493
  if (!this.activated)
2482
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2494
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2483
2495
  return this._activatedRoute;
2484
2496
  }
2485
2497
  get activatedRouteData() {
@@ -2493,7 +2505,7 @@ class RouterOutlet {
2493
2505
  */
2494
2506
  detach() {
2495
2507
  if (!this.activated)
2496
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2508
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2497
2509
  this.location.detach();
2498
2510
  const cmp = this.activated;
2499
2511
  this.activated = null;
@@ -2521,7 +2533,7 @@ class RouterOutlet {
2521
2533
  }
2522
2534
  activateWith(activatedRoute, resolverOrInjector) {
2523
2535
  if (this.isActivated) {
2524
- throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$5 && 'Cannot activate an already activated outlet');
2536
+ throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$6 && 'Cannot activate an already activated outlet');
2525
2537
  }
2526
2538
  this._activatedRoute = activatedRoute;
2527
2539
  const location = this.location;
@@ -2543,9 +2555,9 @@ class RouterOutlet {
2543
2555
  this.activateEvents.emit(this.activated.instance);
2544
2556
  }
2545
2557
  }
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: [{
2558
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.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 });
2559
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.2", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2560
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterOutlet, decorators: [{
2549
2561
  type: Directive,
2550
2562
  args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
2551
2563
  }], ctorParameters: function () {
@@ -2604,9 +2616,9 @@ function isComponentFactoryResolver(item) {
2604
2616
  */
2605
2617
  class ɵEmptyOutletComponent {
2606
2618
  }
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: [{
2619
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2620
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.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"] }] });
2621
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2610
2622
  type: Component,
2611
2623
  args: [{ template: `<router-outlet></router-outlet>` }]
2612
2624
  }] });
@@ -3166,6 +3178,9 @@ function isRedirectingNavigationCancelingError(error) {
3166
3178
  function isNavigationCancelingError(error) {
3167
3179
  return error && error[NAVIGATION_CANCELING_ERROR];
3168
3180
  }
3181
+ function isEmptyError(e) {
3182
+ return e instanceof EmptyError || (e === null || e === void 0 ? void 0 : e.name) === 'EmptyError';
3183
+ }
3169
3184
 
3170
3185
  /**
3171
3186
  * @license
@@ -3503,7 +3518,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
3503
3518
  * Use of this source code is governed by an MIT-style license that can be
3504
3519
  * found in the LICENSE file at https://angular.io/license
3505
3520
  */
3506
- const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || ngDevMode;
3521
+ const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
3507
3522
  class NoMatch$1 {
3508
3523
  constructor(segmentGroup) {
3509
3524
  this.segmentGroup = segmentGroup || null;
@@ -3521,11 +3536,11 @@ function absoluteRedirect(newTree) {
3521
3536
  return throwError(new AbsoluteRedirect(newTree));
3522
3537
  }
3523
3538
  function namedOutletsRedirect(redirectTo) {
3524
- return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$4 &&
3539
+ return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$5 &&
3525
3540
  `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3526
3541
  }
3527
3542
  function canLoadFails(route) {
3528
- return throwError(navigationCancelingError(NG_DEV_MODE$4 &&
3543
+ return throwError(navigationCancelingError(NG_DEV_MODE$5 &&
3529
3544
  `Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
3530
3545
  }
3531
3546
  /**
@@ -3585,7 +3600,7 @@ class ApplyRedirects {
3585
3600
  }));
3586
3601
  }
3587
3602
  noMatchError(e) {
3588
- return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$4 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3603
+ return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$5 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3589
3604
  }
3590
3605
  createUrlTree(rootCandidate, queryParams, fragment) {
3591
3606
  const root = createRoot(rootCandidate);
@@ -3635,7 +3650,7 @@ class ApplyRedirects {
3635
3650
  throw e;
3636
3651
  }));
3637
3652
  }), first((s) => !!s), catchError((e, _) => {
3638
- if (e instanceof EmptyError || e.name === 'EmptyError') {
3653
+ if (isEmptyError(e)) {
3639
3654
  if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
3640
3655
  return of(new UrlSegmentGroup([], {}));
3641
3656
  }
@@ -3802,7 +3817,7 @@ class ApplyRedirects {
3802
3817
  findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3803
3818
  const pos = posParams[redirectToUrlSegment.path.substring(1)];
3804
3819
  if (!pos)
3805
- throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$4 &&
3820
+ throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$5 &&
3806
3821
  `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3807
3822
  return pos;
3808
3823
  }
@@ -3838,7 +3853,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
3838
3853
  * Use of this source code is governed by an MIT-style license that can be
3839
3854
  * found in the LICENSE file at https://angular.io/license
3840
3855
  */
3841
- const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3856
+ const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3842
3857
  class NoMatch {
3843
3858
  }
3844
3859
  function newObservableError(e) {
@@ -3927,7 +3942,7 @@ class Recognizer {
3927
3942
  // multiple activated results for the same outlet. We should merge the children of
3928
3943
  // these results so the final return value is only one `TreeNode` per outlet.
3929
3944
  const mergedChildren = mergeEmptyPathMatches(children);
3930
- if (NG_DEV_MODE$3) {
3945
+ if (NG_DEV_MODE$4) {
3931
3946
  // This should really never happen - we are only taking the first match for each
3932
3947
  // outlet and merge the empty path matches.
3933
3948
  checkOutletNameUniqueness(mergedChildren);
@@ -3941,7 +3956,7 @@ class Recognizer {
3941
3956
  var _a;
3942
3957
  return this.processSegmentAgainstRoute((_a = r._injector) !== null && _a !== void 0 ? _a : injector, r, segmentGroup, segments, outlet);
3943
3958
  }), first((x) => !!x), catchError(e => {
3944
- if (e instanceof EmptyError) {
3959
+ if (isEmptyError(e)) {
3945
3960
  if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
3946
3961
  return of([]);
3947
3962
  }
@@ -3962,7 +3977,7 @@ class Recognizer {
3962
3977
  // NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
3963
3978
  // production bundle size. This value is intended only to surface a warning to users
3964
3979
  // depending on `relativeLinkResolution: 'legacy'` in dev mode.
3965
- (NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3980
+ (NG_DEV_MODE$4 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3966
3981
  pathIndexShift));
3967
3982
  matchResult = of({
3968
3983
  snapshot,
@@ -3979,7 +3994,7 @@ class Recognizer {
3979
3994
  return null;
3980
3995
  }
3981
3996
  const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
3982
- const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), (_b = (_a = route.component) !== null && _a !== void 0 ? _a : route._loadedComponent) !== null && _b !== void 0 ? _b : null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$3 ?
3997
+ const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), (_b = (_a = route.component) !== null && _a !== void 0 ? _a : route._loadedComponent) !== null && _b !== void 0 ? _b : null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$4 ?
3983
3998
  getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
3984
3999
  pathIndexShift));
3985
4000
  return { snapshot, consumedSegments, remainingSegments };
@@ -4093,7 +4108,7 @@ function checkOutletNameUniqueness(nodes) {
4093
4108
  if (routeWithSameOutletName) {
4094
4109
  const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
4095
4110
  const c = n.value.url.map(s => s.toString()).join('/');
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}'.`);
4111
+ throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$4 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4097
4112
  }
4098
4113
  names[n.value.outlet] = n.value;
4099
4114
  });
@@ -4193,7 +4208,7 @@ function resolveNode(resolve, futureARS, futureRSS, moduleInjector) {
4193
4208
  return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, moduleInjector)
4194
4209
  .pipe(first(), tap((value) => {
4195
4210
  data[key] = value;
4196
- }))), takeLast(1), mapTo(data), catchError((e) => e instanceof EmptyError ? EMPTY : throwError(e)));
4211
+ }))), takeLast(1), mapTo(data), catchError((e) => isEmptyError(e) ? EMPTY : throwError(e)));
4197
4212
  }
4198
4213
  function getDataKeys(obj) {
4199
4214
  return [...Object.keys(obj), ...Object.getOwnPropertySymbols(obj)];
@@ -4230,6 +4245,91 @@ function switchTap(next) {
4230
4245
  });
4231
4246
  }
4232
4247
 
4248
+ /**
4249
+ * @license
4250
+ * Copyright Google LLC All Rights Reserved.
4251
+ *
4252
+ * Use of this source code is governed by an MIT-style license that can be
4253
+ * found in the LICENSE file at https://angular.io/license
4254
+ */
4255
+ /**
4256
+ * Provides a strategy for setting the page title after a router navigation.
4257
+ *
4258
+ * The built-in implementation traverses the router state snapshot and finds the deepest primary
4259
+ * outlet with `title` property. Given the `Routes` below, navigating to
4260
+ * `/base/child(popup:aux)` would result in the document title being set to "child".
4261
+ * ```
4262
+ * [
4263
+ * {path: 'base', title: 'base', children: [
4264
+ * {path: 'child', title: 'child'},
4265
+ * ],
4266
+ * {path: 'aux', outlet: 'popup', title: 'popupTitle'}
4267
+ * ]
4268
+ * ```
4269
+ *
4270
+ * This class can be used as a base class for custom title strategies. That is, you can create your
4271
+ * own class that extends the `TitleStrategy`. Note that in the above example, the `title`
4272
+ * from the named outlet is never used. However, a custom strategy might be implemented to
4273
+ * incorporate titles in named outlets.
4274
+ *
4275
+ * @publicApi
4276
+ * @see [Page title guide](guide/router#setting-the-page-title)
4277
+ */
4278
+ class TitleStrategy {
4279
+ /**
4280
+ * @returns The `title` of the deepest primary route.
4281
+ */
4282
+ buildTitle(snapshot) {
4283
+ var _a;
4284
+ let pageTitle;
4285
+ let route = snapshot.root;
4286
+ while (route !== undefined) {
4287
+ pageTitle = (_a = this.getResolvedTitleForRoute(route)) !== null && _a !== void 0 ? _a : pageTitle;
4288
+ route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
4289
+ }
4290
+ return pageTitle;
4291
+ }
4292
+ /**
4293
+ * Given an `ActivatedRouteSnapshot`, returns the final value of the
4294
+ * `Route.title` property, which can either be a static string or a resolved value.
4295
+ */
4296
+ getResolvedTitleForRoute(snapshot) {
4297
+ return snapshot.data[RouteTitle];
4298
+ }
4299
+ }
4300
+ TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4301
+ TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4302
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: TitleStrategy, decorators: [{
4303
+ type: Injectable,
4304
+ args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
4305
+ }] });
4306
+ /**
4307
+ * The default `TitleStrategy` used by the router that updates the title using the `Title` service.
4308
+ */
4309
+ class DefaultTitleStrategy extends TitleStrategy {
4310
+ constructor(title) {
4311
+ super();
4312
+ this.title = title;
4313
+ }
4314
+ /**
4315
+ * Sets the title of the browser to the given value.
4316
+ *
4317
+ * @param title The `pageTitle` from the deepest primary route.
4318
+ */
4319
+ updateTitle(snapshot) {
4320
+ const title = this.buildTitle(snapshot);
4321
+ if (title !== undefined) {
4322
+ this.title.setTitle(title);
4323
+ }
4324
+ }
4325
+ }
4326
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4327
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4328
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4329
+ type: Injectable,
4330
+ args: [{ providedIn: 'root' }]
4331
+ }], ctorParameters: function () { return [{ type: i1.Title }]; } });
4332
+
4233
4333
  /**
4234
4334
  * @license
4235
4335
  * Copyright Google LLC All Rights Reserved.
@@ -4295,6 +4395,24 @@ class BaseRouteReuseStrategy {
4295
4395
  class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4296
4396
  }
4297
4397
 
4398
+ /**
4399
+ * @license
4400
+ * Copyright Google LLC All Rights Reserved.
4401
+ *
4402
+ * Use of this source code is governed by an MIT-style license that can be
4403
+ * found in the LICENSE file at https://angular.io/license
4404
+ */
4405
+ const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4406
+ /**
4407
+ * A [DI token](guide/glossary/#di-token) for the router service.
4408
+ *
4409
+ * @publicApi
4410
+ */
4411
+ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config' : '', {
4412
+ providedIn: 'root',
4413
+ factory: () => ({}),
4414
+ });
4415
+
4298
4416
  /**
4299
4417
  * @license
4300
4418
  * Copyright Google LLC All Rights Reserved.
@@ -4402,10 +4520,11 @@ class RouterConfigLoader {
4402
4520
  }));
4403
4521
  }
4404
4522
  }
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: [{
4408
- type: Injectable
4523
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4524
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4525
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterConfigLoader, decorators: [{
4526
+ type: Injectable,
4527
+ args: [{ providedIn: 'root' }]
4409
4528
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4410
4529
 
4411
4530
  /**
@@ -4439,6 +4558,13 @@ class DefaultUrlHandlingStrategy {
4439
4558
  }
4440
4559
  }
4441
4560
 
4561
+ /**
4562
+ * @license
4563
+ * Copyright Google LLC All Rights Reserved.
4564
+ *
4565
+ * Use of this source code is governed by an MIT-style license that can be
4566
+ * found in the LICENSE file at https://angular.io/license
4567
+ */
4442
4568
  const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4443
4569
  function defaultErrorHandler(error) {
4444
4570
  throw error;
@@ -4466,6 +4592,53 @@ const subsetMatchOptions = {
4466
4592
  matrixParams: 'ignored',
4467
4593
  queryParams: 'subset'
4468
4594
  };
4595
+ function assignExtraOptionsToRouter(opts, router) {
4596
+ if (opts.errorHandler) {
4597
+ router.errorHandler = opts.errorHandler;
4598
+ }
4599
+ if (opts.malformedUriErrorHandler) {
4600
+ router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
4601
+ }
4602
+ if (opts.onSameUrlNavigation) {
4603
+ router.onSameUrlNavigation = opts.onSameUrlNavigation;
4604
+ }
4605
+ if (opts.paramsInheritanceStrategy) {
4606
+ router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
4607
+ }
4608
+ if (opts.relativeLinkResolution) {
4609
+ router.relativeLinkResolution = opts.relativeLinkResolution;
4610
+ }
4611
+ if (opts.urlUpdateStrategy) {
4612
+ router.urlUpdateStrategy = opts.urlUpdateStrategy;
4613
+ }
4614
+ if (opts.canceledNavigationResolution) {
4615
+ router.canceledNavigationResolution = opts.canceledNavigationResolution;
4616
+ }
4617
+ }
4618
+ function setupRouter() {
4619
+ var _a, _b;
4620
+ const urlSerializer = inject(UrlSerializer);
4621
+ const contexts = inject(ChildrenOutletContexts);
4622
+ const location = inject(Location);
4623
+ const injector = inject(Injector);
4624
+ const compiler = inject(Compiler);
4625
+ const config = (_a = inject(ROUTES, { optional: true })) !== null && _a !== void 0 ? _a : [];
4626
+ const opts = (_b = inject(ROUTER_CONFIGURATION, { optional: true })) !== null && _b !== void 0 ? _b : {};
4627
+ const defaultTitleStrategy = inject(DefaultTitleStrategy);
4628
+ const titleStrategy = inject(TitleStrategy, { optional: true });
4629
+ const urlHandlingStrategy = inject(UrlHandlingStrategy, { optional: true });
4630
+ const routeReuseStrategy = inject(RouteReuseStrategy, { optional: true });
4631
+ const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
4632
+ if (urlHandlingStrategy) {
4633
+ router.urlHandlingStrategy = urlHandlingStrategy;
4634
+ }
4635
+ if (routeReuseStrategy) {
4636
+ router.routeReuseStrategy = routeReuseStrategy;
4637
+ }
4638
+ router.titleStrategy = titleStrategy !== null && titleStrategy !== void 0 ? titleStrategy : defaultTitleStrategy;
4639
+ assignExtraOptionsToRouter(opts, router);
4640
+ return router;
4641
+ }
4469
4642
  /**
4470
4643
  * @description
4471
4644
  *
@@ -4655,10 +4828,11 @@ class Router {
4655
4828
  // Extract URL
4656
4829
  map(t => (Object.assign(Object.assign({}, t), { extractedUrl: this.urlHandlingStrategy.extract(t.rawUrl) }))),
4657
4830
  // Using switchMap so we cancel executing navigations when a new one comes in
4658
- switchMap(t => {
4831
+ switchMap(overallTransitionState => {
4659
4832
  let completed = false;
4660
4833
  let errored = false;
4661
- return of(t).pipe(
4834
+ return of(overallTransitionState)
4835
+ .pipe(
4662
4836
  // Store the Navigation object
4663
4837
  tap(t => {
4664
4838
  this.currentNavigation = {
@@ -4676,8 +4850,8 @@ class Router {
4676
4850
  t.extractedUrl.toString() !== browserUrlTree ||
4677
4851
  // Navigations which succeed or ones which fail and are cleaned up
4678
4852
  // correctly should result in `browserUrlTree` and `currentUrlTree`
4679
- // matching. If this is not the case, assume something went wrong and try
4680
- // processing the URL again.
4853
+ // matching. If this is not the case, assume something went wrong and
4854
+ // try processing the URL again.
4681
4855
  browserUrlTree !== this.currentUrlTree.toString();
4682
4856
  const processCurrentUrl = (this.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
4683
4857
  this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
@@ -4705,11 +4879,13 @@ class Router {
4705
4879
  // `urlAfterRedirects` is guaranteed to be set after this point
4706
4880
  tap(t => {
4707
4881
  this.currentNavigation = Object.assign(Object.assign({}, this.currentNavigation), { finalUrl: t.urlAfterRedirects });
4882
+ overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
4708
4883
  }),
4709
4884
  // Recognize
4710
4885
  recognize(this.ngModule.injector, this.rootComponentType, this.config, this.urlSerializer, this.paramsInheritanceStrategy, this.relativeLinkResolution),
4711
4886
  // Update URL if in `eager` update mode
4712
4887
  tap(t => {
4888
+ overallTransitionState.targetSnapshot = t.targetSnapshot;
4713
4889
  if (this.urlUpdateStrategy === 'eager') {
4714
4890
  if (!t.extras.skipLocationChange) {
4715
4891
  const rawUrl = this.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
@@ -4725,21 +4901,22 @@ class Router {
4725
4901
  else {
4726
4902
  const processPreviousUrl = urlTransition && this.rawUrlTree &&
4727
4903
  this.urlHandlingStrategy.shouldProcessUrl(this.rawUrlTree);
4728
- /* When the current URL shouldn't be processed, but the previous one was,
4729
- * we handle this "error condition" by navigating to the previously
4730
- * successful URL, but leaving the URL intact.*/
4904
+ /* When the current URL shouldn't be processed, but the previous one
4905
+ * was, we handle this "error condition" by navigating to the
4906
+ * previously successful URL, but leaving the URL intact.*/
4731
4907
  if (processPreviousUrl) {
4732
4908
  const { id, extractedUrl, source, restoredState, extras } = t;
4733
4909
  const navStart = new NavigationStart(id, this.serializeUrl(extractedUrl), source, restoredState);
4734
4910
  eventsSubject.next(navStart);
4735
4911
  const targetSnapshot = createEmptyState(extractedUrl, this.rootComponentType).snapshot;
4736
- return of(Object.assign(Object.assign({}, t), { targetSnapshot, urlAfterRedirects: extractedUrl, extras: Object.assign(Object.assign({}, extras), { skipLocationChange: false, replaceUrl: false }) }));
4912
+ overallTransitionState = Object.assign(Object.assign({}, t), { targetSnapshot, urlAfterRedirects: extractedUrl, extras: Object.assign(Object.assign({}, extras), { skipLocationChange: false, replaceUrl: false }) });
4913
+ return of(overallTransitionState);
4737
4914
  }
4738
4915
  else {
4739
- /* When neither the current or previous URL can be processed, do nothing
4740
- * other than update router's internal reference to the current "settled"
4741
- * URL. This way the next navigation will be coming from the current URL
4742
- * in the browser.
4916
+ /* When neither the current or previous URL can be processed, do
4917
+ * nothing other than update router's internal reference to the
4918
+ * current "settled" URL. This way the next navigation will be coming
4919
+ * from the current URL in the browser.
4743
4920
  */
4744
4921
  this.rawUrlTree = t.rawUrl;
4745
4922
  t.resolve(null);
@@ -4751,7 +4928,11 @@ class Router {
4751
4928
  tap(t => {
4752
4929
  const guardsStart = new GuardsCheckStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4753
4930
  this.triggerEvent(guardsStart);
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 => {
4931
+ }), map(t => {
4932
+ overallTransitionState = Object.assign(Object.assign({}, t), { guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts) });
4933
+ return overallTransitionState;
4934
+ }), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
4935
+ overallTransitionState.guardsResult = t.guardsResult;
4755
4936
  if (isUrlTree(t.guardsResult)) {
4756
4937
  throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
4757
4938
  }
@@ -4812,13 +4993,14 @@ class Router {
4812
4993
  .pipe(defaultIfEmpty(), take(1));
4813
4994
  }), switchTap(() => this.afterPreactivation()), map((t) => {
4814
4995
  const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4815
- return (Object.assign(Object.assign({}, t), { targetRouterState }));
4996
+ overallTransitionState = Object.assign(Object.assign({}, t), { targetRouterState });
4997
+ return (overallTransitionState);
4816
4998
  }),
4817
- /* Once here, we are about to activate synchronously. The assumption is this
4818
- will succeed, and user code may read from the Router service. Therefore
4819
- before activation, we need to update router properties storing the current
4820
- URL and the RouterState, as well as updated the browser URL. All this should
4821
- happen *before* activating. */
4999
+ /* Once here, we are about to activate synchronously. The assumption is
5000
+ this will succeed, and user code may read from the Router service.
5001
+ Therefore before activation, we need to update router properties storing
5002
+ the current URL and the RouterState, as well as updated the browser URL.
5003
+ All this should happen *before* activating. */
4822
5004
  tap((t) => {
4823
5005
  this.currentUrlTree = t.urlAfterRedirects;
4824
5006
  this.rawUrlTree =
@@ -4839,82 +5021,76 @@ class Router {
4839
5021
  }
4840
5022
  }), finalize(() => {
4841
5023
  var _a;
4842
- /* When the navigation stream finishes either through error or success, we
4843
- * set the `completed` or `errored` flag. However, there are some situations
4844
- * where we could get here without either of those being set. For instance, a
4845
- * redirect during NavigationStart. Therefore, this is a catch-all to make
4846
- * sure the NavigationCancel
4847
- * event is fired when a navigation gets cancelled but not caught by other
4848
- * means. */
5024
+ /* When the navigation stream finishes either through error or success,
5025
+ * we set the `completed` or `errored` flag. However, there are some
5026
+ * situations where we could get here without either of those being set.
5027
+ * For instance, a redirect during NavigationStart. Therefore, this is a
5028
+ * catch-all to make sure the NavigationCancel event is fired when a
5029
+ * navigation gets cancelled but not caught by other means. */
4849
5030
  if (!completed && !errored) {
4850
5031
  const cancelationReason = NG_DEV_MODE$1 ?
4851
- `Navigation ID ${t.id} is not equal to the current navigation id ${this.navigationId}` :
5032
+ `Navigation ID ${overallTransitionState
5033
+ .id} is not equal to the current navigation id ${this.navigationId}` :
4852
5034
  '';
4853
- this.cancelNavigationTransition(t, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
5035
+ this.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
4854
5036
  }
4855
5037
  // Only clear current navigation if it is still set to the one that
4856
5038
  // finalized.
4857
- if (((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.id) === t.id) {
5039
+ if (((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.id) === overallTransitionState.id) {
4858
5040
  this.currentNavigation = null;
4859
5041
  }
4860
5042
  }), catchError((e) => {
4861
5043
  var _a;
4862
- // TODO(atscott): The NavigationTransition `t` used here does not accurately
4863
- // reflect the current state of the whole transition because some operations
4864
- // return a new object rather than modifying the one in the outermost
4865
- // `switchMap`.
4866
- // The fix can likely be to:
4867
- // 1. Rename the outer `t` variable so it's not shadowed all the time and
4868
- // confusing
4869
- // 2. Keep reassigning to the outer variable after each stage to ensure it
4870
- // gets updated. Or change the implementations to not return a copy.
4871
- // Not changed yet because it affects existing code and would need to be
4872
- // tested more thoroughly.
4873
5044
  errored = true;
4874
5045
  /* This error type is issued during Redirect, and is handled as a
4875
5046
  * cancellation rather than an error. */
4876
5047
  if (isNavigationCancelingError$1(e)) {
4877
5048
  if (!isRedirectingNavigationCancelingError$1(e)) {
4878
- // Set property only if we're not redirecting. If we landed on a page and
4879
- // redirect to `/` route, the new navigation is going to see the `/`
4880
- // isn't a change from the default currentUrlTree and won't navigate.
4881
- // This is only applicable with initial navigation, so setting
4882
- // `navigated` only when not redirecting resolves this scenario.
5049
+ // Set property only if we're not redirecting. If we landed on a page
5050
+ // and redirect to `/` route, the new navigation is going to see the
5051
+ // `/` isn't a change from the default currentUrlTree and won't
5052
+ // navigate. This is only applicable with initial navigation, so
5053
+ // setting `navigated` only when not redirecting resolves this
5054
+ // scenario.
4883
5055
  this.navigated = true;
4884
- this.restoreHistory(t, true);
5056
+ this.restoreHistory(overallTransitionState, true);
4885
5057
  }
4886
- const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message, e.cancellationCode);
5058
+ const navCancel = new NavigationCancel(overallTransitionState.id, this.serializeUrl(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
4887
5059
  eventsSubject.next(navCancel);
4888
5060
  // When redirecting, we need to delay resolving the navigation
4889
5061
  // promise and push it to the redirect navigation
4890
5062
  if (!isRedirectingNavigationCancelingError$1(e)) {
4891
- t.resolve(false);
5063
+ overallTransitionState.resolve(false);
4892
5064
  }
4893
5065
  else {
4894
5066
  const mergedTree = this.urlHandlingStrategy.merge(e.url, this.rawUrlTree);
4895
5067
  const extras = {
4896
- skipLocationChange: t.extras.skipLocationChange,
5068
+ skipLocationChange: overallTransitionState.extras.skipLocationChange,
4897
5069
  // The URL is already updated at this point if we have 'eager' URL
4898
5070
  // updates or if the navigation was triggered by the browser (back
4899
- // button, URL bar, etc). We want to replace that item in history if
4900
- // the navigation is rejected.
5071
+ // button, URL bar, etc). We want to replace that item in history
5072
+ // if the navigation is rejected.
4901
5073
  replaceUrl: this.urlUpdateStrategy === 'eager' ||
4902
- isBrowserTriggeredNavigation(t.source)
5074
+ isBrowserTriggeredNavigation(overallTransitionState.source)
4903
5075
  };
4904
- this.scheduleNavigation(mergedTree, 'imperative', null, extras, { resolve: t.resolve, reject: t.reject, promise: t.promise });
5076
+ this.scheduleNavigation(mergedTree, 'imperative', null, extras, {
5077
+ resolve: overallTransitionState.resolve,
5078
+ reject: overallTransitionState.reject,
5079
+ promise: overallTransitionState.promise
5080
+ });
4905
5081
  }
4906
- /* All other errors should reset to the router's internal URL reference to
4907
- * the pre-error state. */
5082
+ /* All other errors should reset to the router's internal URL reference
5083
+ * to the pre-error state. */
4908
5084
  }
4909
5085
  else {
4910
- this.restoreHistory(t, true);
4911
- const navError = new NavigationError(t.id, this.serializeUrl(t.extractedUrl), e, (_a = t.targetSnapshot) !== null && _a !== void 0 ? _a : undefined);
5086
+ this.restoreHistory(overallTransitionState, true);
5087
+ const navError = new NavigationError(overallTransitionState.id, this.serializeUrl(overallTransitionState.extractedUrl), e, (_a = overallTransitionState.targetSnapshot) !== null && _a !== void 0 ? _a : undefined);
4912
5088
  eventsSubject.next(navError);
4913
5089
  try {
4914
- t.resolve(this.errorHandler(e));
5090
+ overallTransitionState.resolve(this.errorHandler(e));
4915
5091
  }
4916
5092
  catch (ee) {
4917
- t.reject(ee);
5093
+ overallTransitionState.reject(ee);
4918
5094
  }
4919
5095
  }
4920
5096
  return EMPTY;
@@ -5370,10 +5546,14 @@ class Router {
5370
5546
  return { navigationId };
5371
5547
  }
5372
5548
  }
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: [{
5376
- type: Injectable
5549
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5550
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5551
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: Router, decorators: [{
5552
+ type: Injectable,
5553
+ args: [{
5554
+ providedIn: 'root',
5555
+ useFactory: setupRouter,
5556
+ }]
5377
5557
  }], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
5378
5558
  function validateCommands(commands) {
5379
5559
  for (let i = 0; i < commands.length; i++) {
@@ -5564,9 +5744,9 @@ class RouterLink {
5564
5744
  });
5565
5745
  }
5566
5746
  }
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: [{
5747
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5748
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.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 });
5749
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterLink, decorators: [{
5570
5750
  type: Directive,
5571
5751
  args: [{ selector: ':not(a):not(area)[routerLink]' }]
5572
5752
  }], ctorParameters: function () {
@@ -5685,9 +5865,9 @@ class RouterLinkWithHref {
5685
5865
  });
5686
5866
  }
5687
5867
  }
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: [{
5868
+ RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5869
+ RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.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 });
5870
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5691
5871
  type: Directive,
5692
5872
  args: [{ selector: 'a[routerLink],area[routerLink]' }]
5693
5873
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
@@ -5914,9 +6094,9 @@ class RouterLinkActive {
5914
6094
  this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
5915
6095
  }
5916
6096
  }
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: [{
6097
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.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 });
6098
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.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 });
6099
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterLinkActive, decorators: [{
5920
6100
  type: Directive,
5921
6101
  args: [{
5922
6102
  selector: '[routerLinkActive]',
@@ -5950,85 +6130,6 @@ function isActiveMatchOptions(options) {
5950
6130
  return !!options.paths;
5951
6131
  }
5952
6132
 
5953
- /**
5954
- * @license
5955
- * Copyright Google LLC All Rights Reserved.
5956
- *
5957
- * Use of this source code is governed by an MIT-style license that can be
5958
- * found in the LICENSE file at https://angular.io/license
5959
- */
5960
- /**
5961
- * Provides a strategy for setting the page title after a router navigation.
5962
- *
5963
- * The built-in implementation traverses the router state snapshot and finds the deepest primary
5964
- * outlet with `title` property. Given the `Routes` below, navigating to
5965
- * `/base/child(popup:aux)` would result in the document title being set to "child".
5966
- * ```
5967
- * [
5968
- * {path: 'base', title: 'base', children: [
5969
- * {path: 'child', title: 'child'},
5970
- * ],
5971
- * {path: 'aux', outlet: 'popup', title: 'popupTitle'}
5972
- * ]
5973
- * ```
5974
- *
5975
- * This class can be used as a base class for custom title strategies. That is, you can create your
5976
- * own class that extends the `TitleStrategy`. Note that in the above example, the `title`
5977
- * from the named outlet is never used. However, a custom strategy might be implemented to
5978
- * incorporate titles in named outlets.
5979
- *
5980
- * @publicApi
5981
- * @see [Page title guide](guide/router#setting-the-page-title)
5982
- */
5983
- class TitleStrategy {
5984
- /**
5985
- * @returns The `title` of the deepest primary route.
5986
- */
5987
- buildTitle(snapshot) {
5988
- var _a;
5989
- let pageTitle;
5990
- let route = snapshot.root;
5991
- while (route !== undefined) {
5992
- pageTitle = (_a = this.getResolvedTitleForRoute(route)) !== null && _a !== void 0 ? _a : pageTitle;
5993
- route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
5994
- }
5995
- return pageTitle;
5996
- }
5997
- /**
5998
- * Given an `ActivatedRouteSnapshot`, returns the final value of the
5999
- * `Route.title` property, which can either be a static string or a resolved value.
6000
- */
6001
- getResolvedTitleForRoute(snapshot) {
6002
- return snapshot.data[RouteTitle];
6003
- }
6004
- }
6005
- /**
6006
- * The default `TitleStrategy` used by the router that updates the title using the `Title` service.
6007
- */
6008
- class DefaultTitleStrategy extends TitleStrategy {
6009
- constructor(title) {
6010
- super();
6011
- this.title = title;
6012
- }
6013
- /**
6014
- * Sets the title of the browser to the given value.
6015
- *
6016
- * @param title The `pageTitle` from the deepest primary route.
6017
- */
6018
- updateTitle(snapshot) {
6019
- const title = this.buildTitle(snapshot);
6020
- if (title !== undefined) {
6021
- this.title.setTitle(title);
6022
- }
6023
- }
6024
- }
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: [{
6028
- type: Injectable,
6029
- args: [{ providedIn: 'root' }]
6030
- }], ctorParameters: function () { return [{ type: i1.Title }]; } });
6031
-
6032
6133
  /**
6033
6134
  * @license
6034
6135
  * Copyright Google LLC All Rights Reserved.
@@ -6061,9 +6162,9 @@ class PreloadAllModules {
6061
6162
  return fn().pipe(catchError(() => of(null)));
6062
6163
  }
6063
6164
  }
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: [{
6165
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6166
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6167
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: PreloadAllModules, decorators: [{
6067
6168
  type: Injectable,
6068
6169
  args: [{ providedIn: 'root' }]
6069
6170
  }] });
@@ -6081,9 +6182,9 @@ class NoPreloading {
6081
6182
  return of(null);
6082
6183
  }
6083
6184
  }
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: [{
6185
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6186
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6187
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: NoPreloading, decorators: [{
6087
6188
  type: Injectable,
6088
6189
  args: [{ providedIn: 'root' }]
6089
6190
  }] });
@@ -6131,7 +6232,15 @@ class RouterPreloader {
6131
6232
  }
6132
6233
  const injectorForCurrentRoute = (_a = route._injector) !== null && _a !== void 0 ? _a : injector;
6133
6234
  const injectorForChildren = (_b = route._loadedInjector) !== null && _b !== void 0 ? _b : injectorForCurrentRoute;
6134
- if ((route.loadChildren && !route._loadedRoutes) ||
6235
+ // Note that `canLoad` is only checked as a condition that prevents `loadChildren` and not
6236
+ // `loadComponent`. `canLoad` guards only block loading of child routes by design. This
6237
+ // happens as a consequence of needing to descend into children for route matching immediately
6238
+ // while component loading is deferred until route activation. Because `canLoad` guards can
6239
+ // have side effects, we cannot execute them here so we instead skip preloading altogether
6240
+ // when present. Lastly, it remains to be decided whether `canLoad` should behave this way
6241
+ // at all. Code splitting and lazy loading is separate from client-side authorization checks
6242
+ // and should not be used as a security measure to prevent loading of code.
6243
+ if ((route.loadChildren && !route._loadedRoutes && route.canLoad === undefined) ||
6135
6244
  (route.loadComponent && !route._loadedComponent)) {
6136
6245
  res.push(this.preloadConfig(injectorForCurrentRoute, route));
6137
6246
  }
@@ -6171,9 +6280,9 @@ class RouterPreloader {
6171
6280
  });
6172
6281
  }
6173
6282
  }
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: [{
6283
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6284
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterPreloader });
6285
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterPreloader, decorators: [{
6177
6286
  type: Injectable
6178
6287
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
6179
6288
 
@@ -6253,9 +6362,9 @@ class RouterScroller {
6253
6362
  }
6254
6363
  }
6255
6364
  }
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: [{
6365
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6366
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterScroller });
6367
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterScroller, decorators: [{
6259
6368
  type: Injectable
6260
6369
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
6261
6370
 
@@ -6271,36 +6380,26 @@ const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
6271
6380
  * The directives defined in the `RouterModule`.
6272
6381
  */
6273
6382
  const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent];
6274
- /**
6275
- * A [DI token](guide/glossary/#di-token) for the router service.
6276
- *
6277
- * @publicApi
6278
- */
6279
- const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE ? 'router config' : 'ROUTER_CONFIGURATION', {
6280
- providedIn: 'root',
6281
- factory: () => ({}),
6282
- });
6283
6383
  /**
6284
6384
  * @docsNotRequired
6285
6385
  */
6286
6386
  const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
6287
6387
  const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
6388
+ // TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept
6389
+ // here to avoid a breaking change whereby the provider order matters based on where the
6390
+ // `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a "breaking"
6391
+ // change in a major version.
6288
6392
  const ROUTER_PROVIDERS = [
6289
6393
  Location,
6290
6394
  { provide: UrlSerializer, useClass: DefaultUrlSerializer },
6291
- {
6292
- provide: Router,
6293
- useFactory: setupRouter,
6294
- deps: [
6295
- UrlSerializer, ChildrenOutletContexts, Location, Injector, Compiler, ROUTES,
6296
- ROUTER_CONFIGURATION, DefaultTitleStrategy, [TitleStrategy, new Optional()],
6297
- [UrlHandlingStrategy, new Optional()], [RouteReuseStrategy, new Optional()]
6298
- ]
6299
- },
6395
+ { provide: Router, useFactory: setupRouter },
6300
6396
  ChildrenOutletContexts,
6301
6397
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6302
6398
  RouterConfigLoader,
6303
6399
  ];
6400
+ function rootRoute(router) {
6401
+ return router.routerState.root;
6402
+ }
6304
6403
  function routerNgProbeToken() {
6305
6404
  return new NgProbeToken('Router', Router);
6306
6405
  }
@@ -6326,8 +6425,7 @@ function routerNgProbeToken() {
6326
6425
  * @publicApi
6327
6426
  */
6328
6427
  class RouterModule {
6329
- // Note: We are injecting the Router so it gets created eagerly...
6330
- constructor(guard, router) { }
6428
+ constructor(guard) { }
6331
6429
  /**
6332
6430
  * Creates and configures a module with all the router providers and directives.
6333
6431
  * Optionally sets up an application listener to perform an initial navigation.
@@ -6388,10 +6486,10 @@ class RouterModule {
6388
6486
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
6389
6487
  }
6390
6488
  }
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: [{
6489
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6490
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6491
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterModule });
6492
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterModule, decorators: [{
6395
6493
  type: NgModule,
6396
6494
  args: [{
6397
6495
  declarations: ROUTER_DIRECTIVES,
@@ -6403,8 +6501,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ng
6403
6501
  }, {
6404
6502
  type: Inject,
6405
6503
  args: [ROUTER_FORROOT_GUARD]
6406
- }] }, { type: Router, decorators: [{
6407
- type: Optional
6408
6504
  }] }];
6409
6505
  } });
6410
6506
  function provideRouterScroller() {
@@ -6451,48 +6547,9 @@ function provideForRootGuard(router) {
6451
6547
  */
6452
6548
  function provideRoutes(routes) {
6453
6549
  return [
6454
- { provide: ANALYZE_FOR_ENTRY_COMPONENTS, multi: true, useValue: routes },
6455
6550
  { provide: ROUTES, multi: true, useValue: routes },
6456
6551
  ];
6457
6552
  }
6458
- function setupRouter(urlSerializer, contexts, location, injector, compiler, config, opts = {}, defaultTitleStrategy, titleStrategy, urlHandlingStrategy, routeReuseStrategy) {
6459
- const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
6460
- if (urlHandlingStrategy) {
6461
- router.urlHandlingStrategy = urlHandlingStrategy;
6462
- }
6463
- if (routeReuseStrategy) {
6464
- router.routeReuseStrategy = routeReuseStrategy;
6465
- }
6466
- router.titleStrategy = titleStrategy !== null && titleStrategy !== void 0 ? titleStrategy : defaultTitleStrategy;
6467
- assignExtraOptionsToRouter(opts, router);
6468
- return router;
6469
- }
6470
- function assignExtraOptionsToRouter(opts, router) {
6471
- if (opts.errorHandler) {
6472
- router.errorHandler = opts.errorHandler;
6473
- }
6474
- if (opts.malformedUriErrorHandler) {
6475
- router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
6476
- }
6477
- if (opts.onSameUrlNavigation) {
6478
- router.onSameUrlNavigation = opts.onSameUrlNavigation;
6479
- }
6480
- if (opts.paramsInheritanceStrategy) {
6481
- router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
6482
- }
6483
- if (opts.relativeLinkResolution) {
6484
- router.relativeLinkResolution = opts.relativeLinkResolution;
6485
- }
6486
- if (opts.urlUpdateStrategy) {
6487
- router.urlUpdateStrategy = opts.urlUpdateStrategy;
6488
- }
6489
- if (opts.canceledNavigationResolution) {
6490
- router.canceledNavigationResolution = opts.canceledNavigationResolution;
6491
- }
6492
- }
6493
- function rootRoute(router) {
6494
- return router.routerState.root;
6495
- }
6496
6553
  function getBootstrapListener() {
6497
6554
  const injector = inject(Injector);
6498
6555
  return (bootstrappedComponentRef) => {
@@ -6503,8 +6560,7 @@ function getBootstrapListener() {
6503
6560
  }
6504
6561
  const router = injector.get(Router);
6505
6562
  const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6506
- // Default case
6507
- if (injector.get(INITIAL_NAVIGATION, null, InjectFlags.Optional) === null) {
6563
+ if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
6508
6564
  router.initialNavigation();
6509
6565
  }
6510
6566
  (_a = injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)) === null || _a === void 0 ? void 0 : _a.setUpPreloading();
@@ -6548,7 +6604,7 @@ const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicato
6548
6604
  });
6549
6605
  function provideEnabledBlockingInitialNavigation() {
6550
6606
  return [
6551
- { provide: INITIAL_NAVIGATION, useValue: 'enabledBlocking' },
6607
+ { provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
6552
6608
  {
6553
6609
  provide: APP_INITIALIZER,
6554
6610
  multi: true,
@@ -6614,7 +6670,7 @@ function provideEnabledBlockingInitialNavigation() {
6614
6670
  },
6615
6671
  ];
6616
6672
  }
6617
- const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '');
6673
+ const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
6618
6674
  function provideDisabledInitialNavigation() {
6619
6675
  return [
6620
6676
  {
@@ -6627,7 +6683,7 @@ function provideDisabledInitialNavigation() {
6627
6683
  };
6628
6684
  }
6629
6685
  },
6630
- { provide: INITIAL_NAVIGATION, useValue: 'disabled' }
6686
+ { provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
6631
6687
  ];
6632
6688
  }
6633
6689
  function provideTracing() {
@@ -6671,7 +6727,7 @@ function providePreloading(preloadingStrategy) {
6671
6727
  /**
6672
6728
  * @publicApi
6673
6729
  */
6674
- const VERSION = new Version('14.1.0-rc.0');
6730
+ const VERSION = new Version('14.1.2');
6675
6731
 
6676
6732
  /**
6677
6733
  * @license