@angular/router 14.1.0-rc.0 → 14.2.0-next.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 (35) hide show
  1. package/esm2020/src/components/empty_outlet.mjs +10 -6
  2. package/esm2020/src/directives/router_link.mjs +12 -9
  3. package/esm2020/src/directives/router_link_active.mjs +5 -4
  4. package/esm2020/src/directives/router_outlet.mjs +9 -5
  5. package/esm2020/src/index.mjs +4 -3
  6. package/esm2020/src/operators/recognize.mjs +1 -1
  7. package/esm2020/src/operators/resolve_data.mjs +4 -9
  8. package/esm2020/src/page_title_strategy.mjs +13 -8
  9. package/esm2020/src/private_export.mjs +3 -2
  10. package/esm2020/src/router.mjs +128 -72
  11. package/esm2020/src/router_config.mjs +19 -0
  12. package/esm2020/src/router_config_loader.mjs +6 -5
  13. package/esm2020/src/router_module.mjs +22 -79
  14. package/esm2020/src/router_outlet_context.mjs +9 -1
  15. package/esm2020/src/router_preloader.mjs +19 -11
  16. package/esm2020/src/router_scroller.mjs +3 -3
  17. package/esm2020/src/router_state.mjs +7 -3
  18. package/esm2020/src/shared.mjs +22 -2
  19. package/esm2020/src/url_tree.mjs +9 -2
  20. package/esm2020/src/version.mjs +1 -1
  21. package/esm2020/testing/src/router_testing_module.mjs +10 -12
  22. package/fesm2015/router.mjs +371 -286
  23. package/fesm2015/router.mjs.map +1 -1
  24. package/fesm2015/testing.mjs +10 -12
  25. package/fesm2015/testing.mjs.map +1 -1
  26. package/fesm2015/upgrade.mjs +1 -1
  27. package/fesm2020/router.mjs +363 -288
  28. package/fesm2020/router.mjs.map +1 -1
  29. package/fesm2020/testing.mjs +10 -12
  30. package/fesm2020/testing.mjs.map +1 -1
  31. package/fesm2020/upgrade.mjs +1 -1
  32. package/index.d.ts +37 -13
  33. package/package.json +4 -4
  34. package/testing/index.d.ts +2 -3
  35. 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.2.0-next.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, ɵ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';
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, 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, filter, mergeMap, first, concatMap, tap, catchError, scan, last as last$1, takeWhile, defaultIfEmpty, takeLast, mapTo, finalize, refCount, mergeAll } from 'rxjs/operators';
11
10
  import * as i3 from '@angular/common';
12
11
  import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, 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
  /**
@@ -25,6 +25,12 @@ import * as i1 from '@angular/platform-browser';
25
25
  * @publicApi
26
26
  */
27
27
  const PRIMARY_OUTLET = 'primary';
28
+ /**
29
+ * A private symbol used to store the value of `Route.title` inside the `Route.data` if it is a
30
+ * static string or `Route.resolve` if anything else. This allows us to reuse the existing route
31
+ * data/resolvers to support the title feature without new instrumentation in the `Router` pipeline.
32
+ */
33
+ const RouteTitleKey = Symbol('RouteTitle');
28
34
  class ParamsAsMap {
29
35
  constructor(params) {
30
36
  this.params = params || {};
@@ -60,7 +66,21 @@ class ParamsAsMap {
60
66
  function convertToParamMap(params) {
61
67
  return new ParamsAsMap(params);
62
68
  }
63
- // Matches the route configuration (`route`) against the actual URL (`segments`).
69
+ /**
70
+ * Matches the route configuration (`route`) against the actual URL (`segments`).
71
+ *
72
+ * When no matcher is defined on a `Route`, this is the matcher used by the Router by default.
73
+ *
74
+ * @param segments The remaining unmatched segments in the current navigation
75
+ * @param segmentGroup The current segment group being matched
76
+ * @param route The `Route` to match against.
77
+ *
78
+ * @see UrlMatchResult
79
+ * @see Route
80
+ *
81
+ * @returns The resulting match information or `null` if the `route` should not match.
82
+ * @publicApi
83
+ */
64
84
  function defaultUrlMatcher(segments, segmentGroup, route) {
65
85
  const parts = route.path.split('/');
66
86
  if (parts.length > segments.length) {
@@ -182,7 +202,7 @@ function wrapIntoObservable(value) {
182
202
  * Use of this source code is governed by an MIT-style license that can be
183
203
  * found in the LICENSE file at https://angular.io/license
184
204
  */
185
- const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
205
+ const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
186
206
  function createEmptyUrlTree() {
187
207
  return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
188
208
  }
@@ -439,6 +459,12 @@ function mapChildrenIntoArray(segment, fn) {
439
459
  */
440
460
  class UrlSerializer {
441
461
  }
462
+ UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
463
+ UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: UrlSerializer, decorators: [{
465
+ type: Injectable,
466
+ args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
467
+ }] });
442
468
  /**
443
469
  * @description
444
470
  *
@@ -647,7 +673,7 @@ class UrlParser {
647
673
  parseSegment() {
648
674
  const path = matchSegments(this.remaining);
649
675
  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}'.`);
676
+ throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$8 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
651
677
  }
652
678
  this.capture(path);
653
679
  return new UrlSegment(decode(path), this.parseMatrixParams());
@@ -716,7 +742,7 @@ class UrlParser {
716
742
  // if is is not one of these characters, then the segment was unescaped
717
743
  // or the group was not closed
718
744
  if (next !== '/' && next !== ')' && next !== ';') {
719
- throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$7 && `Cannot parse url '${this.url}'`);
745
+ throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$8 && `Cannot parse url '${this.url}'`);
720
746
  }
721
747
  let outletName = undefined;
722
748
  if (path.indexOf(':') > -1) {
@@ -747,7 +773,7 @@ class UrlParser {
747
773
  }
748
774
  capture(str) {
749
775
  if (!this.consumeOptional(str)) {
750
- throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$7 && `Expected "${str}".`);
776
+ throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$8 && `Expected "${str}".`);
751
777
  }
752
778
  }
753
779
  }
@@ -800,7 +826,7 @@ function isUrlTree(v) {
800
826
  * Use of this source code is governed by an MIT-style license that can be
801
827
  * found in the LICENSE file at https://angular.io/license
802
828
  */
803
- const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
829
+ const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
804
830
  /**
805
831
  * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
806
832
  *
@@ -978,11 +1004,11 @@ class Navigation {
978
1004
  this.numberOfDoubleDots = numberOfDoubleDots;
979
1005
  this.commands = commands;
980
1006
  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');
1007
+ throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$7 && 'Root segment cannot have matrix parameters');
982
1008
  }
983
1009
  const cmdWithOutlet = commands.find(isCommandWithOutlets);
984
1010
  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');
1011
+ throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$7 && '{outlets:{}} has to be the last command');
986
1012
  }
987
1013
  }
988
1014
  toRoot() {
@@ -1081,7 +1107,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
1081
1107
  dd -= ci;
1082
1108
  g = g.parent;
1083
1109
  if (!g) {
1084
- throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$6 && 'Invalid number of \'../\'');
1110
+ throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$7 && 'Invalid number of \'../\'');
1085
1111
  }
1086
1112
  ci = g.segments.length;
1087
1113
  }
@@ -1905,6 +1931,7 @@ class ActivatedRoute {
1905
1931
  outlet,
1906
1932
  /** The component of the route, a constant. */
1907
1933
  component, futureSnapshot) {
1934
+ var _a, _b;
1908
1935
  this.url = url;
1909
1936
  this.params = params;
1910
1937
  this.queryParams = queryParams;
@@ -1912,6 +1939,8 @@ class ActivatedRoute {
1912
1939
  this.data = data;
1913
1940
  this.outlet = outlet;
1914
1941
  this.component = component;
1942
+ /** An Observable of the resolved route title */
1943
+ this.title = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.pipe(map((d) => d[RouteTitleKey]))) !== null && _b !== void 0 ? _b : of(undefined);
1915
1944
  this._futureSnapshot = futureSnapshot;
1916
1945
  }
1917
1946
  /** The configuration used to match this route. */
@@ -2060,6 +2089,7 @@ class ActivatedRouteSnapshot {
2060
2089
  outlet,
2061
2090
  /** The component of the route */
2062
2091
  component, routeConfig, urlSegment, lastPathIndex, resolve, correctedLastPathIndex) {
2092
+ var _a;
2063
2093
  this.url = url;
2064
2094
  this.params = params;
2065
2095
  this.queryParams = queryParams;
@@ -2067,6 +2097,8 @@ class ActivatedRouteSnapshot {
2067
2097
  this.data = data;
2068
2098
  this.outlet = outlet;
2069
2099
  this.component = component;
2100
+ /** The resolved route title */
2101
+ this.title = (_a = this.data) === null || _a === void 0 ? void 0 : _a[RouteTitleKey];
2070
2102
  this.routeConfig = routeConfig;
2071
2103
  this._urlSegment = urlSegment;
2072
2104
  this._lastPathIndex = lastPathIndex;
@@ -2356,6 +2388,12 @@ class ChildrenOutletContexts {
2356
2388
  return this.contexts.get(childName) || null;
2357
2389
  }
2358
2390
  }
2391
+ ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2392
+ ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2393
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2394
+ type: Injectable,
2395
+ args: [{ providedIn: 'root' }]
2396
+ }] });
2359
2397
 
2360
2398
  /**
2361
2399
  * @license
@@ -2364,7 +2402,7 @@ class ChildrenOutletContexts {
2364
2402
  * Use of this source code is governed by an MIT-style license that can be
2365
2403
  * found in the LICENSE file at https://angular.io/license
2366
2404
  */
2367
- const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
2405
+ const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
2368
2406
  /**
2369
2407
  * @description
2370
2408
  *
@@ -2474,12 +2512,12 @@ class RouterOutlet {
2474
2512
  */
2475
2513
  get component() {
2476
2514
  if (!this.activated)
2477
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2515
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2478
2516
  return this.activated.instance;
2479
2517
  }
2480
2518
  get activatedRoute() {
2481
2519
  if (!this.activated)
2482
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2520
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2483
2521
  return this._activatedRoute;
2484
2522
  }
2485
2523
  get activatedRouteData() {
@@ -2493,7 +2531,7 @@ class RouterOutlet {
2493
2531
  */
2494
2532
  detach() {
2495
2533
  if (!this.activated)
2496
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2534
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2497
2535
  this.location.detach();
2498
2536
  const cmp = this.activated;
2499
2537
  this.activated = null;
@@ -2521,7 +2559,7 @@ class RouterOutlet {
2521
2559
  }
2522
2560
  activateWith(activatedRoute, resolverOrInjector) {
2523
2561
  if (this.isActivated) {
2524
- throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$5 && 'Cannot activate an already activated outlet');
2562
+ throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$6 && 'Cannot activate an already activated outlet');
2525
2563
  }
2526
2564
  this._activatedRoute = activatedRoute;
2527
2565
  const location = this.location;
@@ -2543,11 +2581,15 @@ class RouterOutlet {
2543
2581
  this.activateEvents.emit(this.activated.instance);
2544
2582
  }
2545
2583
  }
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: [{
2584
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.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 });
2585
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.0", type: RouterOutlet, isStandalone: true, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2586
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterOutlet, decorators: [{
2549
2587
  type: Directive,
2550
- args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
2588
+ args: [{
2589
+ selector: 'router-outlet',
2590
+ exportAs: 'outlet',
2591
+ standalone: true,
2592
+ }]
2551
2593
  }], ctorParameters: function () {
2552
2594
  return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
2553
2595
  type: Attribute,
@@ -2604,11 +2646,15 @@ function isComponentFactoryResolver(item) {
2604
2646
  */
2605
2647
  class ɵEmptyOutletComponent {
2606
2648
  }
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: [{
2649
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2650
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0-next.0", type: ɵEmptyOutletComponent, isStandalone: true, 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"] }] });
2651
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2610
2652
  type: Component,
2611
- args: [{ template: `<router-outlet></router-outlet>` }]
2653
+ args: [{
2654
+ template: `<router-outlet></router-outlet>`,
2655
+ imports: [RouterOutlet],
2656
+ standalone: true,
2657
+ }]
2612
2658
  }] });
2613
2659
 
2614
2660
  /**
@@ -3503,7 +3549,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
3503
3549
  * Use of this source code is governed by an MIT-style license that can be
3504
3550
  * found in the LICENSE file at https://angular.io/license
3505
3551
  */
3506
- const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || ngDevMode;
3552
+ const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
3507
3553
  class NoMatch$1 {
3508
3554
  constructor(segmentGroup) {
3509
3555
  this.segmentGroup = segmentGroup || null;
@@ -3521,11 +3567,11 @@ function absoluteRedirect(newTree) {
3521
3567
  return throwError(new AbsoluteRedirect(newTree));
3522
3568
  }
3523
3569
  function namedOutletsRedirect(redirectTo) {
3524
- return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$4 &&
3570
+ return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$5 &&
3525
3571
  `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3526
3572
  }
3527
3573
  function canLoadFails(route) {
3528
- return throwError(navigationCancelingError(NG_DEV_MODE$4 &&
3574
+ return throwError(navigationCancelingError(NG_DEV_MODE$5 &&
3529
3575
  `Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
3530
3576
  }
3531
3577
  /**
@@ -3585,7 +3631,7 @@ class ApplyRedirects {
3585
3631
  }));
3586
3632
  }
3587
3633
  noMatchError(e) {
3588
- return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$4 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3634
+ return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$5 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3589
3635
  }
3590
3636
  createUrlTree(rootCandidate, queryParams, fragment) {
3591
3637
  const root = createRoot(rootCandidate);
@@ -3802,7 +3848,7 @@ class ApplyRedirects {
3802
3848
  findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3803
3849
  const pos = posParams[redirectToUrlSegment.path.substring(1)];
3804
3850
  if (!pos)
3805
- throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$4 &&
3851
+ throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$5 &&
3806
3852
  `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3807
3853
  return pos;
3808
3854
  }
@@ -3838,7 +3884,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
3838
3884
  * Use of this source code is governed by an MIT-style license that can be
3839
3885
  * found in the LICENSE file at https://angular.io/license
3840
3886
  */
3841
- const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3887
+ const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3842
3888
  class NoMatch {
3843
3889
  }
3844
3890
  function newObservableError(e) {
@@ -3927,7 +3973,7 @@ class Recognizer {
3927
3973
  // multiple activated results for the same outlet. We should merge the children of
3928
3974
  // these results so the final return value is only one `TreeNode` per outlet.
3929
3975
  const mergedChildren = mergeEmptyPathMatches(children);
3930
- if (NG_DEV_MODE$3) {
3976
+ if (NG_DEV_MODE$4) {
3931
3977
  // This should really never happen - we are only taking the first match for each
3932
3978
  // outlet and merge the empty path matches.
3933
3979
  checkOutletNameUniqueness(mergedChildren);
@@ -3962,7 +4008,7 @@ class Recognizer {
3962
4008
  // NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
3963
4009
  // production bundle size. This value is intended only to surface a warning to users
3964
4010
  // depending on `relativeLinkResolution: 'legacy'` in dev mode.
3965
- (NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
4011
+ (NG_DEV_MODE$4 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3966
4012
  pathIndexShift));
3967
4013
  matchResult = of({
3968
4014
  snapshot,
@@ -3979,7 +4025,7 @@ class Recognizer {
3979
4025
  return null;
3980
4026
  }
3981
4027
  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 ?
4028
+ 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
4029
  getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
3984
4030
  pathIndexShift));
3985
4031
  return { snapshot, consumedSegments, remainingSegments };
@@ -4093,7 +4139,7 @@ function checkOutletNameUniqueness(nodes) {
4093
4139
  if (routeWithSameOutletName) {
4094
4140
  const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
4095
4141
  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}'.`);
4142
+ 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
4143
  }
4098
4144
  names[n.value.outlet] = n.value;
4099
4145
  });
@@ -4151,12 +4197,6 @@ function recognize(injector, rootComponentType, config, serializer, paramsInheri
4151
4197
  * Use of this source code is governed by an MIT-style license that can be
4152
4198
  * found in the LICENSE file at https://angular.io/license
4153
4199
  */
4154
- /**
4155
- * A private symbol used to store the value of `Route.title` inside the `Route.data` if it is a
4156
- * static string or `Route.resolve` if anything else. This allows us to reuse the existing route
4157
- * data/resolvers to support the title feature without new instrumentation in the `Router` pipeline.
4158
- */
4159
- const RouteTitle = Symbol('RouteTitle');
4160
4200
  function resolveData(paramsInheritanceStrategy, moduleInjector) {
4161
4201
  return mergeMap(t => {
4162
4202
  const { targetSnapshot, guards: { canActivateChecks } } = t;
@@ -4172,14 +4212,14 @@ function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, moduleInjec
4172
4212
  const config = futureARS.routeConfig;
4173
4213
  const resolve = futureARS._resolve;
4174
4214
  if ((config === null || config === void 0 ? void 0 : config.title) !== undefined && !hasStaticTitle(config)) {
4175
- resolve[RouteTitle] = config.title;
4215
+ resolve[RouteTitleKey] = config.title;
4176
4216
  }
4177
4217
  return resolveNode(resolve, futureARS, futureRSS, moduleInjector)
4178
4218
  .pipe(map((resolvedData) => {
4179
4219
  futureARS._resolvedData = resolvedData;
4180
4220
  futureARS.data = inheritedParamsDataResolve(futureARS, paramsInheritanceStrategy).resolve;
4181
4221
  if (config && hasStaticTitle(config)) {
4182
- futureARS.data[RouteTitle] = config.title;
4222
+ futureARS.data[RouteTitleKey] = config.title;
4183
4223
  }
4184
4224
  return null;
4185
4225
  }));
@@ -4230,6 +4270,91 @@ function switchTap(next) {
4230
4270
  });
4231
4271
  }
4232
4272
 
4273
+ /**
4274
+ * @license
4275
+ * Copyright Google LLC All Rights Reserved.
4276
+ *
4277
+ * Use of this source code is governed by an MIT-style license that can be
4278
+ * found in the LICENSE file at https://angular.io/license
4279
+ */
4280
+ /**
4281
+ * Provides a strategy for setting the page title after a router navigation.
4282
+ *
4283
+ * The built-in implementation traverses the router state snapshot and finds the deepest primary
4284
+ * outlet with `title` property. Given the `Routes` below, navigating to
4285
+ * `/base/child(popup:aux)` would result in the document title being set to "child".
4286
+ * ```
4287
+ * [
4288
+ * {path: 'base', title: 'base', children: [
4289
+ * {path: 'child', title: 'child'},
4290
+ * ],
4291
+ * {path: 'aux', outlet: 'popup', title: 'popupTitle'}
4292
+ * ]
4293
+ * ```
4294
+ *
4295
+ * This class can be used as a base class for custom title strategies. That is, you can create your
4296
+ * own class that extends the `TitleStrategy`. Note that in the above example, the `title`
4297
+ * from the named outlet is never used. However, a custom strategy might be implemented to
4298
+ * incorporate titles in named outlets.
4299
+ *
4300
+ * @publicApi
4301
+ * @see [Page title guide](guide/router#setting-the-page-title)
4302
+ */
4303
+ class TitleStrategy {
4304
+ /**
4305
+ * @returns The `title` of the deepest primary route.
4306
+ */
4307
+ buildTitle(snapshot) {
4308
+ var _a;
4309
+ let pageTitle;
4310
+ let route = snapshot.root;
4311
+ while (route !== undefined) {
4312
+ pageTitle = (_a = this.getResolvedTitleForRoute(route)) !== null && _a !== void 0 ? _a : pageTitle;
4313
+ route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
4314
+ }
4315
+ return pageTitle;
4316
+ }
4317
+ /**
4318
+ * Given an `ActivatedRouteSnapshot`, returns the final value of the
4319
+ * `Route.title` property, which can either be a static string or a resolved value.
4320
+ */
4321
+ getResolvedTitleForRoute(snapshot) {
4322
+ return snapshot.data[RouteTitleKey];
4323
+ }
4324
+ }
4325
+ TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4326
+ TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4327
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: TitleStrategy, decorators: [{
4328
+ type: Injectable,
4329
+ args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
4330
+ }] });
4331
+ /**
4332
+ * The default `TitleStrategy` used by the router that updates the title using the `Title` service.
4333
+ */
4334
+ class DefaultTitleStrategy extends TitleStrategy {
4335
+ constructor(title) {
4336
+ super();
4337
+ this.title = title;
4338
+ }
4339
+ /**
4340
+ * Sets the title of the browser to the given value.
4341
+ *
4342
+ * @param title The `pageTitle` from the deepest primary route.
4343
+ */
4344
+ updateTitle(snapshot) {
4345
+ const title = this.buildTitle(snapshot);
4346
+ if (title !== undefined) {
4347
+ this.title.setTitle(title);
4348
+ }
4349
+ }
4350
+ }
4351
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4352
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4353
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4354
+ type: Injectable,
4355
+ args: [{ providedIn: 'root' }]
4356
+ }], ctorParameters: function () { return [{ type: i1.Title }]; } });
4357
+
4233
4358
  /**
4234
4359
  * @license
4235
4360
  * Copyright Google LLC All Rights Reserved.
@@ -4295,6 +4420,24 @@ class BaseRouteReuseStrategy {
4295
4420
  class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4296
4421
  }
4297
4422
 
4423
+ /**
4424
+ * @license
4425
+ * Copyright Google LLC All Rights Reserved.
4426
+ *
4427
+ * Use of this source code is governed by an MIT-style license that can be
4428
+ * found in the LICENSE file at https://angular.io/license
4429
+ */
4430
+ const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4431
+ /**
4432
+ * A [DI token](guide/glossary/#di-token) for the router service.
4433
+ *
4434
+ * @publicApi
4435
+ */
4436
+ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config' : '', {
4437
+ providedIn: 'root',
4438
+ factory: () => ({}),
4439
+ });
4440
+
4298
4441
  /**
4299
4442
  * @license
4300
4443
  * Copyright Google LLC All Rights Reserved.
@@ -4402,10 +4545,11 @@ class RouterConfigLoader {
4402
4545
  }));
4403
4546
  }
4404
4547
  }
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
4548
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4549
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4550
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
4551
+ type: Injectable,
4552
+ args: [{ providedIn: 'root' }]
4409
4553
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4410
4554
 
4411
4555
  /**
@@ -4439,6 +4583,13 @@ class DefaultUrlHandlingStrategy {
4439
4583
  }
4440
4584
  }
4441
4585
 
4586
+ /**
4587
+ * @license
4588
+ * Copyright Google LLC All Rights Reserved.
4589
+ *
4590
+ * Use of this source code is governed by an MIT-style license that can be
4591
+ * found in the LICENSE file at https://angular.io/license
4592
+ */
4442
4593
  const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4443
4594
  function defaultErrorHandler(error) {
4444
4595
  throw error;
@@ -4466,6 +4617,53 @@ const subsetMatchOptions = {
4466
4617
  matrixParams: 'ignored',
4467
4618
  queryParams: 'subset'
4468
4619
  };
4620
+ function assignExtraOptionsToRouter(opts, router) {
4621
+ if (opts.errorHandler) {
4622
+ router.errorHandler = opts.errorHandler;
4623
+ }
4624
+ if (opts.malformedUriErrorHandler) {
4625
+ router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
4626
+ }
4627
+ if (opts.onSameUrlNavigation) {
4628
+ router.onSameUrlNavigation = opts.onSameUrlNavigation;
4629
+ }
4630
+ if (opts.paramsInheritanceStrategy) {
4631
+ router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
4632
+ }
4633
+ if (opts.relativeLinkResolution) {
4634
+ router.relativeLinkResolution = opts.relativeLinkResolution;
4635
+ }
4636
+ if (opts.urlUpdateStrategy) {
4637
+ router.urlUpdateStrategy = opts.urlUpdateStrategy;
4638
+ }
4639
+ if (opts.canceledNavigationResolution) {
4640
+ router.canceledNavigationResolution = opts.canceledNavigationResolution;
4641
+ }
4642
+ }
4643
+ function setupRouter() {
4644
+ var _a, _b;
4645
+ const urlSerializer = inject(UrlSerializer);
4646
+ const contexts = inject(ChildrenOutletContexts);
4647
+ const location = inject(Location);
4648
+ const injector = inject(Injector);
4649
+ const compiler = inject(Compiler);
4650
+ const config = (_a = inject(ROUTES, { optional: true })) !== null && _a !== void 0 ? _a : [];
4651
+ const opts = (_b = inject(ROUTER_CONFIGURATION, { optional: true })) !== null && _b !== void 0 ? _b : {};
4652
+ const defaultTitleStrategy = inject(DefaultTitleStrategy);
4653
+ const titleStrategy = inject(TitleStrategy, { optional: true });
4654
+ const urlHandlingStrategy = inject(UrlHandlingStrategy, { optional: true });
4655
+ const routeReuseStrategy = inject(RouteReuseStrategy, { optional: true });
4656
+ const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
4657
+ if (urlHandlingStrategy) {
4658
+ router.urlHandlingStrategy = urlHandlingStrategy;
4659
+ }
4660
+ if (routeReuseStrategy) {
4661
+ router.routeReuseStrategy = routeReuseStrategy;
4662
+ }
4663
+ router.titleStrategy = titleStrategy !== null && titleStrategy !== void 0 ? titleStrategy : defaultTitleStrategy;
4664
+ assignExtraOptionsToRouter(opts, router);
4665
+ return router;
4666
+ }
4469
4667
  /**
4470
4668
  * @description
4471
4669
  *
@@ -4655,10 +4853,11 @@ class Router {
4655
4853
  // Extract URL
4656
4854
  map(t => (Object.assign(Object.assign({}, t), { extractedUrl: this.urlHandlingStrategy.extract(t.rawUrl) }))),
4657
4855
  // Using switchMap so we cancel executing navigations when a new one comes in
4658
- switchMap(t => {
4856
+ switchMap(overallTransitionState => {
4659
4857
  let completed = false;
4660
4858
  let errored = false;
4661
- return of(t).pipe(
4859
+ return of(overallTransitionState)
4860
+ .pipe(
4662
4861
  // Store the Navigation object
4663
4862
  tap(t => {
4664
4863
  this.currentNavigation = {
@@ -4676,8 +4875,8 @@ class Router {
4676
4875
  t.extractedUrl.toString() !== browserUrlTree ||
4677
4876
  // Navigations which succeed or ones which fail and are cleaned up
4678
4877
  // 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.
4878
+ // matching. If this is not the case, assume something went wrong and
4879
+ // try processing the URL again.
4681
4880
  browserUrlTree !== this.currentUrlTree.toString();
4682
4881
  const processCurrentUrl = (this.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
4683
4882
  this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
@@ -4705,11 +4904,13 @@ class Router {
4705
4904
  // `urlAfterRedirects` is guaranteed to be set after this point
4706
4905
  tap(t => {
4707
4906
  this.currentNavigation = Object.assign(Object.assign({}, this.currentNavigation), { finalUrl: t.urlAfterRedirects });
4907
+ overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
4708
4908
  }),
4709
4909
  // Recognize
4710
4910
  recognize(this.ngModule.injector, this.rootComponentType, this.config, this.urlSerializer, this.paramsInheritanceStrategy, this.relativeLinkResolution),
4711
4911
  // Update URL if in `eager` update mode
4712
4912
  tap(t => {
4913
+ overallTransitionState.targetSnapshot = t.targetSnapshot;
4713
4914
  if (this.urlUpdateStrategy === 'eager') {
4714
4915
  if (!t.extras.skipLocationChange) {
4715
4916
  const rawUrl = this.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
@@ -4725,21 +4926,22 @@ class Router {
4725
4926
  else {
4726
4927
  const processPreviousUrl = urlTransition && this.rawUrlTree &&
4727
4928
  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.*/
4929
+ /* When the current URL shouldn't be processed, but the previous one
4930
+ * was, we handle this "error condition" by navigating to the
4931
+ * previously successful URL, but leaving the URL intact.*/
4731
4932
  if (processPreviousUrl) {
4732
4933
  const { id, extractedUrl, source, restoredState, extras } = t;
4733
4934
  const navStart = new NavigationStart(id, this.serializeUrl(extractedUrl), source, restoredState);
4734
4935
  eventsSubject.next(navStart);
4735
4936
  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 }) }));
4937
+ overallTransitionState = Object.assign(Object.assign({}, t), { targetSnapshot, urlAfterRedirects: extractedUrl, extras: Object.assign(Object.assign({}, extras), { skipLocationChange: false, replaceUrl: false }) });
4938
+ return of(overallTransitionState);
4737
4939
  }
4738
4940
  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.
4941
+ /* When neither the current or previous URL can be processed, do
4942
+ * nothing other than update router's internal reference to the
4943
+ * current "settled" URL. This way the next navigation will be coming
4944
+ * from the current URL in the browser.
4743
4945
  */
4744
4946
  this.rawUrlTree = t.rawUrl;
4745
4947
  t.resolve(null);
@@ -4751,7 +4953,11 @@ class Router {
4751
4953
  tap(t => {
4752
4954
  const guardsStart = new GuardsCheckStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4753
4955
  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 => {
4956
+ }), map(t => {
4957
+ overallTransitionState = Object.assign(Object.assign({}, t), { guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts) });
4958
+ return overallTransitionState;
4959
+ }), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
4960
+ overallTransitionState.guardsResult = t.guardsResult;
4755
4961
  if (isUrlTree(t.guardsResult)) {
4756
4962
  throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
4757
4963
  }
@@ -4812,13 +5018,14 @@ class Router {
4812
5018
  .pipe(defaultIfEmpty(), take(1));
4813
5019
  }), switchTap(() => this.afterPreactivation()), map((t) => {
4814
5020
  const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4815
- return (Object.assign(Object.assign({}, t), { targetRouterState }));
5021
+ overallTransitionState = Object.assign(Object.assign({}, t), { targetRouterState });
5022
+ return (overallTransitionState);
4816
5023
  }),
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. */
5024
+ /* Once here, we are about to activate synchronously. The assumption is
5025
+ this will succeed, and user code may read from the Router service.
5026
+ Therefore before activation, we need to update router properties storing
5027
+ the current URL and the RouterState, as well as updated the browser URL.
5028
+ All this should happen *before* activating. */
4822
5029
  tap((t) => {
4823
5030
  this.currentUrlTree = t.urlAfterRedirects;
4824
5031
  this.rawUrlTree =
@@ -4839,82 +5046,76 @@ class Router {
4839
5046
  }
4840
5047
  }), finalize(() => {
4841
5048
  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. */
5049
+ /* When the navigation stream finishes either through error or success,
5050
+ * we set the `completed` or `errored` flag. However, there are some
5051
+ * situations where we could get here without either of those being set.
5052
+ * For instance, a redirect during NavigationStart. Therefore, this is a
5053
+ * catch-all to make sure the NavigationCancel event is fired when a
5054
+ * navigation gets cancelled but not caught by other means. */
4849
5055
  if (!completed && !errored) {
4850
5056
  const cancelationReason = NG_DEV_MODE$1 ?
4851
- `Navigation ID ${t.id} is not equal to the current navigation id ${this.navigationId}` :
5057
+ `Navigation ID ${overallTransitionState
5058
+ .id} is not equal to the current navigation id ${this.navigationId}` :
4852
5059
  '';
4853
- this.cancelNavigationTransition(t, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
5060
+ this.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
4854
5061
  }
4855
5062
  // Only clear current navigation if it is still set to the one that
4856
5063
  // finalized.
4857
- if (((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.id) === t.id) {
5064
+ if (((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.id) === overallTransitionState.id) {
4858
5065
  this.currentNavigation = null;
4859
5066
  }
4860
5067
  }), catchError((e) => {
4861
5068
  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
5069
  errored = true;
4874
5070
  /* This error type is issued during Redirect, and is handled as a
4875
5071
  * cancellation rather than an error. */
4876
5072
  if (isNavigationCancelingError$1(e)) {
4877
5073
  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.
5074
+ // Set property only if we're not redirecting. If we landed on a page
5075
+ // and redirect to `/` route, the new navigation is going to see the
5076
+ // `/` isn't a change from the default currentUrlTree and won't
5077
+ // navigate. This is only applicable with initial navigation, so
5078
+ // setting `navigated` only when not redirecting resolves this
5079
+ // scenario.
4883
5080
  this.navigated = true;
4884
- this.restoreHistory(t, true);
5081
+ this.restoreHistory(overallTransitionState, true);
4885
5082
  }
4886
- const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message, e.cancellationCode);
5083
+ const navCancel = new NavigationCancel(overallTransitionState.id, this.serializeUrl(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
4887
5084
  eventsSubject.next(navCancel);
4888
5085
  // When redirecting, we need to delay resolving the navigation
4889
5086
  // promise and push it to the redirect navigation
4890
5087
  if (!isRedirectingNavigationCancelingError$1(e)) {
4891
- t.resolve(false);
5088
+ overallTransitionState.resolve(false);
4892
5089
  }
4893
5090
  else {
4894
5091
  const mergedTree = this.urlHandlingStrategy.merge(e.url, this.rawUrlTree);
4895
5092
  const extras = {
4896
- skipLocationChange: t.extras.skipLocationChange,
5093
+ skipLocationChange: overallTransitionState.extras.skipLocationChange,
4897
5094
  // The URL is already updated at this point if we have 'eager' URL
4898
5095
  // 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.
5096
+ // button, URL bar, etc). We want to replace that item in history
5097
+ // if the navigation is rejected.
4901
5098
  replaceUrl: this.urlUpdateStrategy === 'eager' ||
4902
- isBrowserTriggeredNavigation(t.source)
5099
+ isBrowserTriggeredNavigation(overallTransitionState.source)
4903
5100
  };
4904
- this.scheduleNavigation(mergedTree, 'imperative', null, extras, { resolve: t.resolve, reject: t.reject, promise: t.promise });
5101
+ this.scheduleNavigation(mergedTree, 'imperative', null, extras, {
5102
+ resolve: overallTransitionState.resolve,
5103
+ reject: overallTransitionState.reject,
5104
+ promise: overallTransitionState.promise
5105
+ });
4905
5106
  }
4906
- /* All other errors should reset to the router's internal URL reference to
4907
- * the pre-error state. */
5107
+ /* All other errors should reset to the router's internal URL reference
5108
+ * to the pre-error state. */
4908
5109
  }
4909
5110
  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);
5111
+ this.restoreHistory(overallTransitionState, true);
5112
+ const navError = new NavigationError(overallTransitionState.id, this.serializeUrl(overallTransitionState.extractedUrl), e, (_a = overallTransitionState.targetSnapshot) !== null && _a !== void 0 ? _a : undefined);
4912
5113
  eventsSubject.next(navError);
4913
5114
  try {
4914
- t.resolve(this.errorHandler(e));
5115
+ overallTransitionState.resolve(this.errorHandler(e));
4915
5116
  }
4916
5117
  catch (ee) {
4917
- t.reject(ee);
5118
+ overallTransitionState.reject(ee);
4918
5119
  }
4919
5120
  }
4920
5121
  return EMPTY;
@@ -5370,10 +5571,14 @@ class Router {
5370
5571
  return { navigationId };
5371
5572
  }
5372
5573
  }
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
5574
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5575
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5576
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: Router, decorators: [{
5577
+ type: Injectable,
5578
+ args: [{
5579
+ providedIn: 'root',
5580
+ useFactory: setupRouter,
5581
+ }]
5377
5582
  }], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
5378
5583
  function validateCommands(commands) {
5379
5584
  for (let i = 0; i < commands.length; i++) {
@@ -5564,11 +5769,14 @@ class RouterLink {
5564
5769
  });
5565
5770
  }
5566
5771
  }
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: [{
5772
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5773
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.0", type: RouterLink, isStandalone: true, 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 });
5774
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLink, decorators: [{
5570
5775
  type: Directive,
5571
- args: [{ selector: ':not(a):not(area)[routerLink]' }]
5776
+ args: [{
5777
+ selector: ':not(a):not(area)[routerLink]',
5778
+ standalone: true,
5779
+ }]
5572
5780
  }], ctorParameters: function () {
5573
5781
  return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
5574
5782
  type: Attribute,
@@ -5685,11 +5893,11 @@ class RouterLinkWithHref {
5685
5893
  });
5686
5894
  }
5687
5895
  }
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: [{
5896
+ RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5897
+ RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.0", type: RouterLinkWithHref, isStandalone: true, 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 });
5898
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5691
5899
  type: Directive,
5692
- args: [{ selector: 'a[routerLink],area[routerLink]' }]
5900
+ args: [{ selector: 'a[routerLink],area[routerLink]', standalone: true }]
5693
5901
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
5694
5902
  type: HostBinding,
5695
5903
  args: ['attr.target']
@@ -5914,13 +6122,14 @@ class RouterLinkActive {
5914
6122
  this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
5915
6123
  }
5916
6124
  }
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: [{
6125
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.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 });
6126
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.0", type: RouterLinkActive, isStandalone: true, 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 });
6127
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLinkActive, decorators: [{
5920
6128
  type: Directive,
5921
6129
  args: [{
5922
6130
  selector: '[routerLinkActive]',
5923
6131
  exportAs: 'routerLinkActive',
6132
+ standalone: true,
5924
6133
  }]
5925
6134
  }], ctorParameters: function () {
5926
6135
  return [{ type: Router }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: RouterLink, decorators: [{
@@ -5950,85 +6159,6 @@ function isActiveMatchOptions(options) {
5950
6159
  return !!options.paths;
5951
6160
  }
5952
6161
 
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
6162
  /**
6033
6163
  * @license
6034
6164
  * Copyright Google LLC All Rights Reserved.
@@ -6061,9 +6191,9 @@ class PreloadAllModules {
6061
6191
  return fn().pipe(catchError(() => of(null)));
6062
6192
  }
6063
6193
  }
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: [{
6194
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6195
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6196
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: PreloadAllModules, decorators: [{
6067
6197
  type: Injectable,
6068
6198
  args: [{ providedIn: 'root' }]
6069
6199
  }] });
@@ -6081,9 +6211,9 @@ class NoPreloading {
6081
6211
  return of(null);
6082
6212
  }
6083
6213
  }
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: [{
6214
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6215
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: NoPreloading, decorators: [{
6087
6217
  type: Injectable,
6088
6218
  args: [{ providedIn: 'root' }]
6089
6219
  }] });
@@ -6131,7 +6261,15 @@ class RouterPreloader {
6131
6261
  }
6132
6262
  const injectorForCurrentRoute = (_a = route._injector) !== null && _a !== void 0 ? _a : injector;
6133
6263
  const injectorForChildren = (_b = route._loadedInjector) !== null && _b !== void 0 ? _b : injectorForCurrentRoute;
6134
- if ((route.loadChildren && !route._loadedRoutes) ||
6264
+ // Note that `canLoad` is only checked as a condition that prevents `loadChildren` and not
6265
+ // `loadComponent`. `canLoad` guards only block loading of child routes by design. This
6266
+ // happens as a consequence of needing to descend into children for route matching immediately
6267
+ // while component loading is deferred until route activation. Because `canLoad` guards can
6268
+ // have side effects, we cannot execute them here so we instead skip preloading altogether
6269
+ // when present. Lastly, it remains to be decided whether `canLoad` should behave this way
6270
+ // at all. Code splitting and lazy loading is separate from client-side authorization checks
6271
+ // and should not be used as a security measure to prevent loading of code.
6272
+ if ((route.loadChildren && !route._loadedRoutes && route.canLoad === undefined) ||
6135
6273
  (route.loadComponent && !route._loadedComponent)) {
6136
6274
  res.push(this.preloadConfig(injectorForCurrentRoute, route));
6137
6275
  }
@@ -6171,9 +6309,9 @@ class RouterPreloader {
6171
6309
  });
6172
6310
  }
6173
6311
  }
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: [{
6312
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6313
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterPreloader });
6314
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterPreloader, decorators: [{
6177
6315
  type: Injectable
6178
6316
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
6179
6317
 
@@ -6253,9 +6391,9 @@ class RouterScroller {
6253
6391
  }
6254
6392
  }
6255
6393
  }
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: [{
6394
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6395
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterScroller });
6396
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterScroller, decorators: [{
6259
6397
  type: Injectable
6260
6398
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
6261
6399
 
@@ -6271,36 +6409,26 @@ const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
6271
6409
  * The directives defined in the `RouterModule`.
6272
6410
  */
6273
6411
  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
6412
  /**
6284
6413
  * @docsNotRequired
6285
6414
  */
6286
6415
  const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
6287
6416
  const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
6417
+ // TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept
6418
+ // here to avoid a breaking change whereby the provider order matters based on where the
6419
+ // `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a "breaking"
6420
+ // change in a major version.
6288
6421
  const ROUTER_PROVIDERS = [
6289
6422
  Location,
6290
6423
  { 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
- },
6424
+ { provide: Router, useFactory: setupRouter },
6300
6425
  ChildrenOutletContexts,
6301
6426
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6302
6427
  RouterConfigLoader,
6303
6428
  ];
6429
+ function rootRoute(router) {
6430
+ return router.routerState.root;
6431
+ }
6304
6432
  function routerNgProbeToken() {
6305
6433
  return new NgProbeToken('Router', Router);
6306
6434
  }
@@ -6326,8 +6454,7 @@ function routerNgProbeToken() {
6326
6454
  * @publicApi
6327
6455
  */
6328
6456
  class RouterModule {
6329
- // Note: We are injecting the Router so it gets created eagerly...
6330
- constructor(guard, router) { }
6457
+ constructor(guard) { }
6331
6458
  /**
6332
6459
  * Creates and configures a module with all the router providers and directives.
6333
6460
  * Optionally sets up an application listener to perform an initial navigation.
@@ -6388,13 +6515,13 @@ class RouterModule {
6388
6515
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
6389
6516
  }
6390
6517
  }
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: [{
6518
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6519
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6520
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
6521
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterModule, decorators: [{
6395
6522
  type: NgModule,
6396
6523
  args: [{
6397
- declarations: ROUTER_DIRECTIVES,
6524
+ imports: ROUTER_DIRECTIVES,
6398
6525
  exports: ROUTER_DIRECTIVES,
6399
6526
  }]
6400
6527
  }], ctorParameters: function () {
@@ -6403,8 +6530,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ng
6403
6530
  }, {
6404
6531
  type: Inject,
6405
6532
  args: [ROUTER_FORROOT_GUARD]
6406
- }] }, { type: Router, decorators: [{
6407
- type: Optional
6408
6533
  }] }];
6409
6534
  } });
6410
6535
  function provideRouterScroller() {
@@ -6451,48 +6576,9 @@ function provideForRootGuard(router) {
6451
6576
  */
6452
6577
  function provideRoutes(routes) {
6453
6578
  return [
6454
- { provide: ANALYZE_FOR_ENTRY_COMPONENTS, multi: true, useValue: routes },
6455
6579
  { provide: ROUTES, multi: true, useValue: routes },
6456
6580
  ];
6457
6581
  }
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
6582
  function getBootstrapListener() {
6497
6583
  const injector = inject(Injector);
6498
6584
  return (bootstrappedComponentRef) => {
@@ -6503,8 +6589,7 @@ function getBootstrapListener() {
6503
6589
  }
6504
6590
  const router = injector.get(Router);
6505
6591
  const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6506
- // Default case
6507
- if (injector.get(INITIAL_NAVIGATION, null, InjectFlags.Optional) === null) {
6592
+ if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
6508
6593
  router.initialNavigation();
6509
6594
  }
6510
6595
  (_a = injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)) === null || _a === void 0 ? void 0 : _a.setUpPreloading();
@@ -6548,7 +6633,7 @@ const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicato
6548
6633
  });
6549
6634
  function provideEnabledBlockingInitialNavigation() {
6550
6635
  return [
6551
- { provide: INITIAL_NAVIGATION, useValue: 'enabledBlocking' },
6636
+ { provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
6552
6637
  {
6553
6638
  provide: APP_INITIALIZER,
6554
6639
  multi: true,
@@ -6614,7 +6699,7 @@ function provideEnabledBlockingInitialNavigation() {
6614
6699
  },
6615
6700
  ];
6616
6701
  }
6617
- const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '');
6702
+ const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
6618
6703
  function provideDisabledInitialNavigation() {
6619
6704
  return [
6620
6705
  {
@@ -6627,7 +6712,7 @@ function provideDisabledInitialNavigation() {
6627
6712
  };
6628
6713
  }
6629
6714
  },
6630
- { provide: INITIAL_NAVIGATION, useValue: 'disabled' }
6715
+ { provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
6631
6716
  ];
6632
6717
  }
6633
6718
  function provideTracing() {
@@ -6671,7 +6756,7 @@ function providePreloading(preloadingStrategy) {
6671
6756
  /**
6672
6757
  * @publicApi
6673
6758
  */
6674
- const VERSION = new Version('14.1.0-rc.0');
6759
+ const VERSION = new Version('14.2.0-next.0');
6675
6760
 
6676
6761
  /**
6677
6762
  * @license
@@ -6710,5 +6795,5 @@ const VERSION = new Version('14.1.0-rc.0');
6710
6795
  * Generated bundle index. Do not edit.
6711
6796
  */
6712
6797
 
6713
- export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, providePreloading as ɵprovidePreloading };
6798
+ export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, providePreloading as ɵprovidePreloading };
6714
6799
  //# sourceMappingURL=router.mjs.map