@angular/router 15.0.0 → 15.1.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 (41) hide show
  1. package/esm2020/src/components/empty_outlet.mjs +3 -3
  2. package/esm2020/src/directives/router_link.mjs +3 -3
  3. package/esm2020/src/directives/router_link_active.mjs +3 -3
  4. package/esm2020/src/directives/router_outlet.mjs +5 -5
  5. package/esm2020/src/events.mjs +34 -1
  6. package/esm2020/src/index.mjs +2 -2
  7. package/esm2020/src/models.mjs +1 -1
  8. package/esm2020/src/navigation_transition.mjs +328 -0
  9. package/esm2020/src/operators/activate_routes.mjs +1 -1
  10. package/esm2020/src/operators/apply_redirects.mjs +1 -1
  11. package/esm2020/src/operators/check_guards.mjs +1 -1
  12. package/esm2020/src/operators/recognize.mjs +1 -1
  13. package/esm2020/src/operators/resolve_data.mjs +1 -1
  14. package/esm2020/src/page_title_strategy.mjs +6 -6
  15. package/esm2020/src/private_export.mjs +1 -1
  16. package/esm2020/src/provide_router.mjs +6 -13
  17. package/esm2020/src/route_reuse_strategy.mjs +15 -1
  18. package/esm2020/src/router.mjs +100 -347
  19. package/esm2020/src/router_config_loader.mjs +3 -3
  20. package/esm2020/src/router_module.mjs +4 -4
  21. package/esm2020/src/router_outlet_context.mjs +3 -3
  22. package/esm2020/src/router_preloader.mjs +9 -9
  23. package/esm2020/src/router_scroller.mjs +3 -3
  24. package/esm2020/src/url_handling_strategy.mjs +15 -1
  25. package/esm2020/src/url_tree.mjs +3 -3
  26. package/esm2020/src/version.mjs +1 -1
  27. package/esm2020/testing/src/router_testing_module.mjs +8 -54
  28. package/fesm2015/router.mjs +524 -403
  29. package/fesm2015/router.mjs.map +1 -1
  30. package/fesm2015/testing.mjs +9 -55
  31. package/fesm2015/testing.mjs.map +1 -1
  32. package/fesm2015/upgrade.mjs +1 -1
  33. package/fesm2020/router.mjs +538 -412
  34. package/fesm2020/router.mjs.map +1 -1
  35. package/fesm2020/testing.mjs +9 -55
  36. package/fesm2020/testing.mjs.map +1 -1
  37. package/fesm2020/upgrade.mjs +1 -1
  38. package/index.d.ts +113 -62
  39. package/package.json +4 -4
  40. package/testing/index.d.ts +2 -7
  41. package/upgrade/index.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.0.0
2
+ * @license Angular v15.1.0-next.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -202,7 +202,7 @@ function wrapIntoObservable(value) {
202
202
  * Use of this source code is governed by an MIT-style license that can be
203
203
  * found in the LICENSE file at https://angular.io/license
204
204
  */
205
- const NG_DEV_MODE$9 = typeof ngDevMode === 'undefined' || ngDevMode;
205
+ const NG_DEV_MODE$a = typeof ngDevMode === 'undefined' || ngDevMode;
206
206
  const pathCompareMap = {
207
207
  'exact': equalSegmentGroups,
208
208
  'subset': containsSegmentGroup,
@@ -327,7 +327,7 @@ class UrlTree {
327
327
  this.root = root;
328
328
  this.queryParams = queryParams;
329
329
  this.fragment = fragment;
330
- if (NG_DEV_MODE$9) {
330
+ if (NG_DEV_MODE$a) {
331
331
  if (root.segments.length > 0) {
332
332
  throw new ɵRuntimeError(4015 /* RuntimeErrorCode.INVALID_ROOT_URL_SEGMENT */, 'The root `UrlSegmentGroup` should not contain `segments`. ' +
333
333
  'Instead, these segments belong in the `children` so they can be associated with a named outlet.');
@@ -461,9 +461,9 @@ function mapChildrenIntoArray(segment, fn) {
461
461
  */
462
462
  class UrlSerializer {
463
463
  }
464
- UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
465
- UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
466
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UrlSerializer, decorators: [{
464
+ UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
465
+ UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
466
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: UrlSerializer, decorators: [{
467
467
  type: Injectable,
468
468
  args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
469
469
  }] });
@@ -675,7 +675,7 @@ class UrlParser {
675
675
  parseSegment() {
676
676
  const path = matchSegments(this.remaining);
677
677
  if (path === '' && this.peekStartsWith(';')) {
678
- throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$9 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
678
+ throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$a && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
679
679
  }
680
680
  this.capture(path);
681
681
  return new UrlSegment(decode(path), this.parseMatrixParams());
@@ -744,7 +744,7 @@ class UrlParser {
744
744
  // if is is not one of these characters, then the segment was unescaped
745
745
  // or the group was not closed
746
746
  if (next !== '/' && next !== ')' && next !== ';') {
747
- throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$9 && `Cannot parse url '${this.url}'`);
747
+ throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$a && `Cannot parse url '${this.url}'`);
748
748
  }
749
749
  let outletName = undefined;
750
750
  if (path.indexOf(':') > -1) {
@@ -775,7 +775,7 @@ class UrlParser {
775
775
  }
776
776
  capture(str) {
777
777
  if (!this.consumeOptional(str)) {
778
- throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$9 && `Expected "${str}".`);
778
+ throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$a && `Expected "${str}".`);
779
779
  }
780
780
  }
781
781
  }
@@ -828,7 +828,7 @@ function isUrlTree(v) {
828
828
  * Use of this source code is governed by an MIT-style license that can be
829
829
  * found in the LICENSE file at https://angular.io/license
830
830
  */
831
- const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
831
+ const NG_DEV_MODE$9 = typeof ngDevMode === 'undefined' || ngDevMode;
832
832
  /**
833
833
  * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
834
834
  *
@@ -997,11 +997,11 @@ class Navigation {
997
997
  this.numberOfDoubleDots = numberOfDoubleDots;
998
998
  this.commands = commands;
999
999
  if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
1000
- throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$8 && 'Root segment cannot have matrix parameters');
1000
+ throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$9 && 'Root segment cannot have matrix parameters');
1001
1001
  }
1002
1002
  const cmdWithOutlet = commands.find(isCommandWithOutlets);
1003
1003
  if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
1004
- throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$8 && '{outlets:{}} has to be the last command');
1004
+ throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$9 && '{outlets:{}} has to be the last command');
1005
1005
  }
1006
1006
  }
1007
1007
  toRoot() {
@@ -1100,7 +1100,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
1100
1100
  dd -= ci;
1101
1101
  g = g.parent;
1102
1102
  if (!g) {
1103
- throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$8 && 'Invalid number of \'../\'');
1103
+ throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$9 && 'Invalid number of \'../\'');
1104
1104
  }
1105
1105
  ci = g.segments.length;
1106
1106
  }
@@ -1376,6 +1376,37 @@ class NavigationCancel extends RouterEvent {
1376
1376
  return `NavigationCancel(id: ${this.id}, url: '${this.url}')`;
1377
1377
  }
1378
1378
  }
1379
+ /**
1380
+ * An event triggered when a navigation is skipped.
1381
+ * This can happen for a couple reasons including onSameUrlHandling
1382
+ * is set to `ignore` and the navigation URL is not different than the
1383
+ * current state.
1384
+ *
1385
+ * @publicApi
1386
+ */
1387
+ class NavigationSkipped extends RouterEvent {
1388
+ constructor(
1389
+ /** @docsNotRequired */
1390
+ id,
1391
+ /** @docsNotRequired */
1392
+ url,
1393
+ /**
1394
+ * A description of why the navigation was skipped. For debug purposes only. Use `code`
1395
+ * instead for a stable skipped reason that can be used in production.
1396
+ */
1397
+ reason,
1398
+ /**
1399
+ * A code to indicate why the navigation was skipped. This code is stable for
1400
+ * the reason and can be relied on whereas the `reason` string could change and should not be
1401
+ * used in production.
1402
+ */
1403
+ code) {
1404
+ super(id, url);
1405
+ this.reason = reason;
1406
+ this.code = code;
1407
+ this.type = 16 /* EventType.NavigationSkipped */;
1408
+ }
1409
+ }
1379
1410
  /**
1380
1411
  * An event triggered when a navigation fails due to an unexpected error.
1381
1412
  *
@@ -1701,6 +1732,8 @@ function stringifyEvent(routerEvent) {
1701
1732
  return `GuardsCheckStart(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;
1702
1733
  case 2 /* EventType.NavigationCancel */:
1703
1734
  return `NavigationCancel(id: ${routerEvent.id}, url: '${routerEvent.url}')`;
1735
+ case 16 /* EventType.NavigationSkipped */:
1736
+ return `NavigationSkipped(id: ${routerEvent.id}, url: '${routerEvent.url}')`;
1704
1737
  case 1 /* EventType.NavigationEnd */:
1705
1738
  return `NavigationEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}')`;
1706
1739
  case 3 /* EventType.NavigationError */:
@@ -2380,9 +2413,9 @@ class ChildrenOutletContexts {
2380
2413
  return this.contexts.get(childName) || null;
2381
2414
  }
2382
2415
  }
2383
- ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2384
- ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2385
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2416
+ ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2417
+ ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2418
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2386
2419
  type: Injectable,
2387
2420
  args: [{ providedIn: 'root' }]
2388
2421
  }] });
@@ -2394,7 +2427,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImpor
2394
2427
  * Use of this source code is governed by an MIT-style license that can be
2395
2428
  * found in the LICENSE file at https://angular.io/license
2396
2429
  */
2397
- const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
2430
+ const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
2398
2431
  /**
2399
2432
  * @description
2400
2433
  *
@@ -2533,12 +2566,12 @@ class RouterOutlet {
2533
2566
  */
2534
2567
  get component() {
2535
2568
  if (!this.activated)
2536
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
2569
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$8 && 'Outlet is not activated');
2537
2570
  return this.activated.instance;
2538
2571
  }
2539
2572
  get activatedRoute() {
2540
2573
  if (!this.activated)
2541
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
2574
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$8 && 'Outlet is not activated');
2542
2575
  return this._activatedRoute;
2543
2576
  }
2544
2577
  get activatedRouteData() {
@@ -2552,7 +2585,7 @@ class RouterOutlet {
2552
2585
  */
2553
2586
  detach() {
2554
2587
  if (!this.activated)
2555
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
2588
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$8 && 'Outlet is not activated');
2556
2589
  this.location.detach();
2557
2590
  const cmp = this.activated;
2558
2591
  this.activated = null;
@@ -2580,11 +2613,11 @@ class RouterOutlet {
2580
2613
  }
2581
2614
  activateWith(activatedRoute, resolverOrInjector) {
2582
2615
  if (this.isActivated) {
2583
- throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$7 && 'Cannot activate an already activated outlet');
2616
+ throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$8 && 'Cannot activate an already activated outlet');
2584
2617
  }
2585
2618
  this._activatedRoute = activatedRoute;
2586
2619
  const location = this.location;
2587
- const snapshot = activatedRoute._futureSnapshot;
2620
+ const snapshot = activatedRoute.snapshot;
2588
2621
  const component = snapshot.component;
2589
2622
  const childContexts = this.parentContexts.getOrCreateContext(this.name).children;
2590
2623
  const injector = new OutletInjector(activatedRoute, childContexts, location.injector);
@@ -2602,9 +2635,9 @@ class RouterOutlet {
2602
2635
  this.activateEvents.emit(this.activated.instance);
2603
2636
  }
2604
2637
  }
2605
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2606
- RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0", type: RouterOutlet, isStandalone: true, selector: "router-outlet", inputs: { name: "name" }, outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], usesOnChanges: true, ngImport: i0 });
2607
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterOutlet, decorators: [{
2638
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2639
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0-next.0", type: RouterOutlet, isStandalone: true, selector: "router-outlet", inputs: { name: "name" }, outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], usesOnChanges: true, ngImport: i0 });
2640
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterOutlet, decorators: [{
2608
2641
  type: Directive,
2609
2642
  args: [{
2610
2643
  selector: 'router-outlet',
@@ -2664,9 +2697,9 @@ function isComponentFactoryResolver(item) {
2664
2697
  */
2665
2698
  class ɵEmptyOutletComponent {
2666
2699
  }
2667
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2668
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.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", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2669
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2700
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2701
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.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", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2702
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2670
2703
  type: Component,
2671
2704
  args: [{
2672
2705
  template: `<router-outlet></router-outlet>`,
@@ -3578,7 +3611,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
3578
3611
  * Use of this source code is governed by an MIT-style license that can be
3579
3612
  * found in the LICENSE file at https://angular.io/license
3580
3613
  */
3581
- const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
3614
+ const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
3582
3615
  class NoMatch$1 {
3583
3616
  constructor(segmentGroup) {
3584
3617
  this.segmentGroup = segmentGroup || null;
@@ -3596,11 +3629,11 @@ function absoluteRedirect(newTree) {
3596
3629
  return throwError(new AbsoluteRedirect(newTree));
3597
3630
  }
3598
3631
  function namedOutletsRedirect(redirectTo) {
3599
- return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$6 &&
3632
+ return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$7 &&
3600
3633
  `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3601
3634
  }
3602
3635
  function canLoadFails(route) {
3603
- return throwError(navigationCancelingError(NG_DEV_MODE$6 &&
3636
+ return throwError(navigationCancelingError(NG_DEV_MODE$7 &&
3604
3637
  `Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
3605
3638
  }
3606
3639
  /**
@@ -3660,7 +3693,7 @@ class ApplyRedirects {
3660
3693
  }));
3661
3694
  }
3662
3695
  noMatchError(e) {
3663
- return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$6 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3696
+ return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$7 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3664
3697
  }
3665
3698
  createUrlTree(rootCandidate, queryParams, fragment) {
3666
3699
  const root = createRoot(rootCandidate);
@@ -3875,7 +3908,7 @@ class ApplyRedirects {
3875
3908
  findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3876
3909
  const pos = posParams[redirectToUrlSegment.path.substring(1)];
3877
3910
  if (!pos)
3878
- throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$6 &&
3911
+ throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$7 &&
3879
3912
  `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3880
3913
  return pos;
3881
3914
  }
@@ -3911,7 +3944,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
3911
3944
  * Use of this source code is governed by an MIT-style license that can be
3912
3945
  * found in the LICENSE file at https://angular.io/license
3913
3946
  */
3914
- const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3947
+ const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3915
3948
  class NoMatch {
3916
3949
  }
3917
3950
  function newObservableError(e) {
@@ -3999,7 +4032,7 @@ class Recognizer {
3999
4032
  // multiple activated results for the same outlet. We should merge the children of
4000
4033
  // these results so the final return value is only one `TreeNode` per outlet.
4001
4034
  const mergedChildren = mergeEmptyPathMatches(children);
4002
- if (NG_DEV_MODE$5) {
4035
+ if (NG_DEV_MODE$6) {
4003
4036
  // This should really never happen - we are only taking the first match for each
4004
4037
  // outlet and merge the empty path matches.
4005
4038
  checkOutletNameUniqueness(mergedChildren);
@@ -4154,7 +4187,7 @@ function checkOutletNameUniqueness(nodes) {
4154
4187
  if (routeWithSameOutletName) {
4155
4188
  const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
4156
4189
  const c = n.value.url.map(s => s.toString()).join('/');
4157
- throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$5 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4190
+ throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$6 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4158
4191
  }
4159
4192
  names[n.value.outlet] = n.value;
4160
4193
  });
@@ -4285,6 +4318,320 @@ function switchTap(next) {
4285
4318
  });
4286
4319
  }
4287
4320
 
4321
+ /**
4322
+ * @license
4323
+ * Copyright Google LLC All Rights Reserved.
4324
+ *
4325
+ * Use of this source code is governed by an MIT-style license that can be
4326
+ * found in the LICENSE file at https://angular.io/license
4327
+ */
4328
+ const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4329
+ class NavigationTransitions {
4330
+ constructor(router) {
4331
+ this.router = router;
4332
+ this.currentNavigation = null;
4333
+ }
4334
+ setupNavigations(transitions) {
4335
+ const eventsSubject = this.router.events;
4336
+ return transitions.pipe(filter(t => t.id !== 0),
4337
+ // Extract URL
4338
+ map(t => ({ ...t, extractedUrl: this.router.urlHandlingStrategy.extract(t.rawUrl) })),
4339
+ // Using switchMap so we cancel executing navigations when a new one comes in
4340
+ switchMap(overallTransitionState => {
4341
+ let completed = false;
4342
+ let errored = false;
4343
+ return of(overallTransitionState)
4344
+ .pipe(
4345
+ // Store the Navigation object
4346
+ tap(t => {
4347
+ this.currentNavigation = {
4348
+ id: t.id,
4349
+ initialUrl: t.rawUrl,
4350
+ extractedUrl: t.extractedUrl,
4351
+ trigger: t.source,
4352
+ extras: t.extras,
4353
+ previousNavigation: !this.router.lastSuccessfulNavigation ? null : {
4354
+ ...this.router.lastSuccessfulNavigation,
4355
+ previousNavigation: null,
4356
+ },
4357
+ };
4358
+ }), switchMap(t => {
4359
+ const browserUrlTree = this.router.browserUrlTree.toString();
4360
+ const urlTransition = !this.router.navigated ||
4361
+ t.extractedUrl.toString() !== browserUrlTree ||
4362
+ // Navigations which succeed or ones which fail and are cleaned up
4363
+ // correctly should result in `browserUrlTree` and `currentUrlTree`
4364
+ // matching. If this is not the case, assume something went wrong and
4365
+ // try processing the URL again.
4366
+ browserUrlTree !== this.router.currentUrlTree.toString();
4367
+ if (!urlTransition && this.router.onSameUrlNavigation !== 'reload') {
4368
+ const reason = NG_DEV_MODE$5 ?
4369
+ `Navigation to ${t.rawUrl} was ignored because it is the same as the current Router URL.` :
4370
+ '';
4371
+ this.router.triggerEvent(new NavigationSkipped(t.id, this.router.serializeUrl(overallTransitionState.rawUrl), reason, 0 /* NavigationSkippedCode.IgnoredSameUrlNavigation */));
4372
+ this.router.rawUrlTree = t.rawUrl;
4373
+ t.resolve(null);
4374
+ return EMPTY;
4375
+ }
4376
+ if (this.router.urlHandlingStrategy.shouldProcessUrl(t.rawUrl)) {
4377
+ // If the source of the navigation is from a browser event, the URL is
4378
+ // already updated. We already need to sync the internal state.
4379
+ if (isBrowserTriggeredNavigation(t.source)) {
4380
+ this.router.browserUrlTree = t.extractedUrl;
4381
+ }
4382
+ return of(t).pipe(
4383
+ // Fire NavigationStart event
4384
+ switchMap(t => {
4385
+ const transition = this.router.transitions.getValue();
4386
+ eventsSubject.next(new NavigationStart(t.id, this.router.serializeUrl(t.extractedUrl), t.source, t.restoredState));
4387
+ if (transition !== this.router.transitions.getValue()) {
4388
+ return EMPTY;
4389
+ }
4390
+ // This delay is required to match old behavior that forced
4391
+ // navigation to always be async
4392
+ return Promise.resolve(t);
4393
+ }),
4394
+ // ApplyRedirects
4395
+ applyRedirects(this.router.ngModule.injector, this.router.configLoader, this.router.urlSerializer, this.router.config),
4396
+ // Update the currentNavigation
4397
+ // `urlAfterRedirects` is guaranteed to be set after this point
4398
+ tap(t => {
4399
+ this.currentNavigation = {
4400
+ ...this.currentNavigation,
4401
+ finalUrl: t.urlAfterRedirects
4402
+ };
4403
+ overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
4404
+ }),
4405
+ // Recognize
4406
+ recognize(this.router.ngModule.injector, this.router.rootComponentType, this.router.config, this.router.urlSerializer, this.router.paramsInheritanceStrategy),
4407
+ // Update URL if in `eager` update mode
4408
+ tap(t => {
4409
+ overallTransitionState.targetSnapshot = t.targetSnapshot;
4410
+ if (this.router.urlUpdateStrategy === 'eager') {
4411
+ if (!t.extras.skipLocationChange) {
4412
+ const rawUrl = this.router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4413
+ this.router.setBrowserUrl(rawUrl, t);
4414
+ }
4415
+ this.router.browserUrlTree = t.urlAfterRedirects;
4416
+ }
4417
+ // Fire RoutesRecognized
4418
+ const routesRecognized = new RoutesRecognized(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4419
+ eventsSubject.next(routesRecognized);
4420
+ }));
4421
+ }
4422
+ else if (urlTransition &&
4423
+ this.router.urlHandlingStrategy.shouldProcessUrl(this.router.rawUrlTree)) {
4424
+ // When the current URL shouldn't be processed, but the previous one
4425
+ // was, we handle this by navigating from the current URL to an empty
4426
+ // state so deactivate guards can run.
4427
+ const { id, extractedUrl, source, restoredState, extras } = t;
4428
+ const navStart = new NavigationStart(id, this.router.serializeUrl(extractedUrl), source, restoredState);
4429
+ eventsSubject.next(navStart);
4430
+ const targetSnapshot = createEmptyState(extractedUrl, this.router.rootComponentType)
4431
+ .snapshot;
4432
+ overallTransitionState = {
4433
+ ...t,
4434
+ targetSnapshot,
4435
+ urlAfterRedirects: extractedUrl,
4436
+ extras: { ...extras, skipLocationChange: false, replaceUrl: false },
4437
+ };
4438
+ return of(overallTransitionState);
4439
+ }
4440
+ else {
4441
+ /* When neither the current or previous URL can be processed, do
4442
+ * nothing other than update router's internal reference to the
4443
+ * current "settled" URL. This way the next navigation will be coming
4444
+ * from the current URL in the browser.
4445
+ */
4446
+ const reason = NG_DEV_MODE$5 ?
4447
+ `Navigation was ignored because the UrlHandlingStrategy` +
4448
+ ` indicated neither the current URL ${this.router.rawUrlTree} nor target URL ${t.rawUrl} should be processed.` :
4449
+ '';
4450
+ this.router.triggerEvent(new NavigationSkipped(t.id, this.router.serializeUrl(overallTransitionState.extractedUrl), reason, 1 /* NavigationSkippedCode.IgnoredByUrlHandlingStrategy */));
4451
+ this.router.rawUrlTree = t.rawUrl;
4452
+ t.resolve(null);
4453
+ return EMPTY;
4454
+ }
4455
+ }),
4456
+ // --- GUARDS ---
4457
+ tap(t => {
4458
+ const guardsStart = new GuardsCheckStart(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4459
+ this.router.triggerEvent(guardsStart);
4460
+ }), map(t => {
4461
+ overallTransitionState = {
4462
+ ...t,
4463
+ guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.router.rootContexts)
4464
+ };
4465
+ return overallTransitionState;
4466
+ }), checkGuards(this.router.ngModule.injector, (evt) => this.router.triggerEvent(evt)), tap(t => {
4467
+ overallTransitionState.guardsResult = t.guardsResult;
4468
+ if (isUrlTree(t.guardsResult)) {
4469
+ throw redirectingNavigationError(this.router.urlSerializer, t.guardsResult);
4470
+ }
4471
+ const guardsEnd = new GuardsCheckEnd(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
4472
+ this.router.triggerEvent(guardsEnd);
4473
+ }), filter(t => {
4474
+ if (!t.guardsResult) {
4475
+ this.router.restoreHistory(t);
4476
+ this.router.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */);
4477
+ return false;
4478
+ }
4479
+ return true;
4480
+ }),
4481
+ // --- RESOLVE ---
4482
+ switchTap(t => {
4483
+ if (t.guards.canActivateChecks.length) {
4484
+ return of(t).pipe(tap(t => {
4485
+ const resolveStart = new ResolveStart(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4486
+ this.router.triggerEvent(resolveStart);
4487
+ }), switchMap(t => {
4488
+ let dataResolved = false;
4489
+ return of(t).pipe(resolveData(this.router.paramsInheritanceStrategy, this.router.ngModule.injector), tap({
4490
+ next: () => dataResolved = true,
4491
+ complete: () => {
4492
+ if (!dataResolved) {
4493
+ this.router.restoreHistory(t);
4494
+ this.router.cancelNavigationTransition(t, NG_DEV_MODE$5 ?
4495
+ `At least one route resolver didn't emit any value.` :
4496
+ '', 2 /* NavigationCancellationCode.NoDataFromResolver */);
4497
+ }
4498
+ }
4499
+ }));
4500
+ }), tap(t => {
4501
+ const resolveEnd = new ResolveEnd(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4502
+ this.router.triggerEvent(resolveEnd);
4503
+ }));
4504
+ }
4505
+ return undefined;
4506
+ }),
4507
+ // --- LOAD COMPONENTS ---
4508
+ switchTap((t) => {
4509
+ const loadComponents = (route) => {
4510
+ const loaders = [];
4511
+ if (route.routeConfig?.loadComponent &&
4512
+ !route.routeConfig._loadedComponent) {
4513
+ loaders.push(this.router.configLoader.loadComponent(route.routeConfig)
4514
+ .pipe(tap(loadedComponent => {
4515
+ route.component = loadedComponent;
4516
+ }), map(() => void 0)));
4517
+ }
4518
+ for (const child of route.children) {
4519
+ loaders.push(...loadComponents(child));
4520
+ }
4521
+ return loaders;
4522
+ };
4523
+ return combineLatest(loadComponents(t.targetSnapshot.root))
4524
+ .pipe(defaultIfEmpty(), take(1));
4525
+ }), switchTap(() => this.router.afterPreactivation()), map((t) => {
4526
+ const targetRouterState = createRouterState(this.router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4527
+ overallTransitionState = { ...t, targetRouterState };
4528
+ return (overallTransitionState);
4529
+ }),
4530
+ /* Once here, we are about to activate synchronously. The assumption is
4531
+ this will succeed, and user code may read from the Router service.
4532
+ Therefore before activation, we need to update router properties storing
4533
+ the current URL and the RouterState, as well as updated the browser URL.
4534
+ All this should happen *before* activating. */
4535
+ tap((t) => {
4536
+ this.router.currentUrlTree = t.urlAfterRedirects;
4537
+ this.router.rawUrlTree = this.router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4538
+ this.router.routerState =
4539
+ t.targetRouterState;
4540
+ if (this.router.urlUpdateStrategy === 'deferred') {
4541
+ if (!t.extras.skipLocationChange) {
4542
+ this.router.setBrowserUrl(this.router.rawUrlTree, t);
4543
+ }
4544
+ this.router.browserUrlTree = t.urlAfterRedirects;
4545
+ }
4546
+ }), activateRoutes(this.router.rootContexts, this.router.routeReuseStrategy, (evt) => this.router.triggerEvent(evt)), tap({
4547
+ next() {
4548
+ completed = true;
4549
+ },
4550
+ complete() {
4551
+ completed = true;
4552
+ }
4553
+ }), finalize(() => {
4554
+ /* When the navigation stream finishes either through error or success,
4555
+ * we set the `completed` or `errored` flag. However, there are some
4556
+ * situations where we could get here without either of those being set.
4557
+ * For instance, a redirect during NavigationStart. Therefore, this is a
4558
+ * catch-all to make sure the NavigationCancel event is fired when a
4559
+ * navigation gets cancelled but not caught by other means. */
4560
+ if (!completed && !errored) {
4561
+ const cancelationReason = NG_DEV_MODE$5 ?
4562
+ `Navigation ID ${overallTransitionState
4563
+ .id} is not equal to the current navigation id ${this.router.navigationId}` :
4564
+ '';
4565
+ this.router.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
4566
+ }
4567
+ // Only clear current navigation if it is still set to the one that
4568
+ // finalized.
4569
+ if (this.currentNavigation?.id === overallTransitionState.id) {
4570
+ this.currentNavigation = null;
4571
+ }
4572
+ }), catchError((e) => {
4573
+ errored = true;
4574
+ /* This error type is issued during Redirect, and is handled as a
4575
+ * cancellation rather than an error. */
4576
+ if (isNavigationCancelingError$1(e)) {
4577
+ if (!isRedirectingNavigationCancelingError$1(e)) {
4578
+ // Set property only if we're not redirecting. If we landed on a page
4579
+ // and redirect to `/` route, the new navigation is going to see the
4580
+ // `/` isn't a change from the default currentUrlTree and won't
4581
+ // navigate. This is only applicable with initial navigation, so
4582
+ // setting `navigated` only when not redirecting resolves this
4583
+ // scenario.
4584
+ this.router.navigated = true;
4585
+ this.router.restoreHistory(overallTransitionState, true);
4586
+ }
4587
+ const navCancel = new NavigationCancel(overallTransitionState.id, this.router.serializeUrl(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
4588
+ eventsSubject.next(navCancel);
4589
+ // When redirecting, we need to delay resolving the navigation
4590
+ // promise and push it to the redirect navigation
4591
+ if (!isRedirectingNavigationCancelingError$1(e)) {
4592
+ overallTransitionState.resolve(false);
4593
+ }
4594
+ else {
4595
+ const mergedTree = this.router.urlHandlingStrategy.merge(e.url, this.router.rawUrlTree);
4596
+ const extras = {
4597
+ skipLocationChange: overallTransitionState.extras.skipLocationChange,
4598
+ // The URL is already updated at this point if we have 'eager' URL
4599
+ // updates or if the navigation was triggered by the browser (back
4600
+ // button, URL bar, etc). We want to replace that item in history
4601
+ // if the navigation is rejected.
4602
+ replaceUrl: this.router.urlUpdateStrategy === 'eager' ||
4603
+ isBrowserTriggeredNavigation(overallTransitionState.source)
4604
+ };
4605
+ this.router.scheduleNavigation(mergedTree, 'imperative', null, extras, {
4606
+ resolve: overallTransitionState.resolve,
4607
+ reject: overallTransitionState.reject,
4608
+ promise: overallTransitionState.promise
4609
+ });
4610
+ }
4611
+ /* All other errors should reset to the router's internal URL reference
4612
+ * to the pre-error state. */
4613
+ }
4614
+ else {
4615
+ this.router.restoreHistory(overallTransitionState, true);
4616
+ const navError = new NavigationError(overallTransitionState.id, this.router.serializeUrl(overallTransitionState.extractedUrl), e, overallTransitionState.targetSnapshot ?? undefined);
4617
+ eventsSubject.next(navError);
4618
+ try {
4619
+ overallTransitionState.resolve(this.router.errorHandler(e));
4620
+ }
4621
+ catch (ee) {
4622
+ overallTransitionState.reject(ee);
4623
+ }
4624
+ }
4625
+ return EMPTY;
4626
+ }));
4627
+ // TODO(jasonaden): remove cast once g3 is on updated TypeScript
4628
+ }));
4629
+ }
4630
+ }
4631
+ function isBrowserTriggeredNavigation(source) {
4632
+ return source !== 'imperative';
4633
+ }
4634
+
4288
4635
  /**
4289
4636
  * @license
4290
4637
  * Copyright Google LLC All Rights Reserved.
@@ -4336,9 +4683,9 @@ class TitleStrategy {
4336
4683
  return snapshot.data[RouteTitleKey];
4337
4684
  }
4338
4685
  }
4339
- TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4340
- TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4341
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: TitleStrategy, decorators: [{
4686
+ TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4687
+ TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4688
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: TitleStrategy, decorators: [{
4342
4689
  type: Injectable,
4343
4690
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
4344
4691
  }] });
@@ -4362,9 +4709,9 @@ class DefaultTitleStrategy extends TitleStrategy {
4362
4709
  }
4363
4710
  }
4364
4711
  }
4365
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4366
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4367
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4712
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4713
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4714
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4368
4715
  type: Injectable,
4369
4716
  args: [{ providedIn: 'root' }]
4370
4717
  }], ctorParameters: function () { return [{ type: i1.Title }]; } });
@@ -4385,6 +4732,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImpor
4385
4732
  */
4386
4733
  class RouteReuseStrategy {
4387
4734
  }
4735
+ RouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouteReuseStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4736
+ RouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouteReuseStrategy, providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) });
4737
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouteReuseStrategy, decorators: [{
4738
+ type: Injectable,
4739
+ args: [{ providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) }]
4740
+ }] });
4388
4741
  /**
4389
4742
  * @description
4390
4743
  *
@@ -4433,6 +4786,12 @@ class BaseRouteReuseStrategy {
4433
4786
  }
4434
4787
  class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4435
4788
  }
4789
+ DefaultRouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultRouteReuseStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
4790
+ DefaultRouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultRouteReuseStrategy, providedIn: 'root' });
4791
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultRouteReuseStrategy, decorators: [{
4792
+ type: Injectable,
4793
+ args: [{ providedIn: 'root' }]
4794
+ }] });
4436
4795
 
4437
4796
  /**
4438
4797
  * @license
@@ -4574,9 +4933,9 @@ class RouterConfigLoader {
4574
4933
  }));
4575
4934
  }
4576
4935
  }
4577
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4578
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4579
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
4936
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4937
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4938
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
4580
4939
  type: Injectable,
4581
4940
  args: [{ providedIn: 'root' }]
4582
4941
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
@@ -4608,6 +4967,12 @@ function maybeUnwrapDefaultExport(input) {
4608
4967
  */
4609
4968
  class UrlHandlingStrategy {
4610
4969
  }
4970
+ UrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: UrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4971
+ UrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: UrlHandlingStrategy, providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) });
4972
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: UrlHandlingStrategy, decorators: [{
4973
+ type: Injectable,
4974
+ args: [{ providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) }]
4975
+ }] });
4611
4976
  /**
4612
4977
  * @publicApi
4613
4978
  */
@@ -4622,6 +4987,12 @@ class DefaultUrlHandlingStrategy {
4622
4987
  return newUrlPart;
4623
4988
  }
4624
4989
  }
4990
+ DefaultUrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultUrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4991
+ DefaultUrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultUrlHandlingStrategy, providedIn: 'root' });
4992
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultUrlHandlingStrategy, decorators: [{
4993
+ type: Injectable,
4994
+ args: [{ providedIn: 'root' }]
4995
+ }] });
4625
4996
 
4626
4997
  /**
4627
4998
  * @license
@@ -4685,18 +5056,7 @@ function setupRouter() {
4685
5056
  const compiler = inject(Compiler);
4686
5057
  const config = inject(ROUTES, { optional: true }) ?? [];
4687
5058
  const opts = inject(ROUTER_CONFIGURATION, { optional: true }) ?? {};
4688
- const defaultTitleStrategy = inject(DefaultTitleStrategy);
4689
- const titleStrategy = inject(TitleStrategy, { optional: true });
4690
- const urlHandlingStrategy = inject(UrlHandlingStrategy, { optional: true });
4691
- const routeReuseStrategy = inject(RouteReuseStrategy, { optional: true });
4692
5059
  const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
4693
- if (urlHandlingStrategy) {
4694
- router.urlHandlingStrategy = urlHandlingStrategy;
4695
- }
4696
- if (routeReuseStrategy) {
4697
- router.routeReuseStrategy = routeReuseStrategy;
4698
- }
4699
- router.titleStrategy = titleStrategy ?? defaultTitleStrategy;
4700
5060
  assignExtraOptionsToRouter(opts, router);
4701
5061
  return router;
4702
5062
  }
@@ -4717,15 +5077,24 @@ class Router {
4717
5077
  * Creates the router service.
4718
5078
  */
4719
5079
  // TODO: vsavkin make internal after the final is out.
4720
- constructor(rootComponentType, urlSerializer, rootContexts, location, injector, compiler, config) {
5080
+ constructor(
5081
+ /** @internal */
5082
+ rootComponentType,
5083
+ /** @internal */
5084
+ urlSerializer,
5085
+ /** @internal */
5086
+ rootContexts,
5087
+ /** @internal */
5088
+ location, injector, compiler, config) {
4721
5089
  this.rootComponentType = rootComponentType;
4722
5090
  this.urlSerializer = urlSerializer;
4723
5091
  this.rootContexts = rootContexts;
4724
5092
  this.location = location;
4725
5093
  this.config = config;
5094
+ /** @internal */
4726
5095
  this.lastSuccessfulNavigation = null;
4727
- this.currentNavigation = null;
4728
5096
  this.disposed = false;
5097
+ /** @internal */
4729
5098
  this.navigationId = 0;
4730
5099
  /**
4731
5100
  * The id of the currently active page in the router.
@@ -4743,6 +5112,8 @@ class Router {
4743
5112
  this.events = new Subject();
4744
5113
  /**
4745
5114
  * A handler for navigation errors in this NgModule.
5115
+ *
5116
+ * @deprecated Subscribe to the `Router` events and watch for `NavigationError` instead.
4746
5117
  */
4747
5118
  this.errorHandler = defaultErrorHandler;
4748
5119
  /**
@@ -4750,6 +5121,10 @@ class Router {
4750
5121
  * when `url` contains an invalid character.
4751
5122
  * The most common case is a `%` sign
4752
5123
  * that's not encoded and is not part of a percent encoded sequence.
5124
+ *
5125
+ * @deprecated Configure this through `RouterModule.forRoot` instead:
5126
+ * `RouterModule.forRoot(routes, {malformedUriErrorHandler: myHandler})`
5127
+ * @see `RouterModule`
4753
5128
  */
4754
5129
  this.malformedUriErrorHandler = defaultMalformedUriErrorHandler;
4755
5130
  /**
@@ -4768,12 +5143,25 @@ class Router {
4768
5143
  /**
4769
5144
  * A strategy for extracting and merging URLs.
4770
5145
  * Used for AngularJS to Angular migrations.
5146
+ *
5147
+ * @deprecated Configure using `providers` instead:
5148
+ * `{provide: UrlHandlingStrategy, useClass: MyStrategy}`.
4771
5149
  */
4772
- this.urlHandlingStrategy = new DefaultUrlHandlingStrategy();
5150
+ this.urlHandlingStrategy = inject(UrlHandlingStrategy);
4773
5151
  /**
4774
5152
  * A strategy for re-using routes.
5153
+ *
5154
+ * @deprecated Configure using `providers` instead:
5155
+ * `{provide: RouteReuseStrategy, useClass: MyStrategy}`.
4775
5156
  */
4776
- this.routeReuseStrategy = new DefaultRouteReuseStrategy();
5157
+ this.routeReuseStrategy = inject(RouteReuseStrategy);
5158
+ /**
5159
+ * A strategy for setting the title based on the `routerState`.
5160
+ *
5161
+ * @deprecated Configure using `providers` instead:
5162
+ * `{provide: TitleStrategy, useClass: MyStrategy}`.
5163
+ */
5164
+ this.titleStrategy = inject(TitleStrategy);
4777
5165
  /**
4778
5166
  * How to handle a navigation request to the current URL. One of:
4779
5167
  *
@@ -4786,6 +5174,11 @@ class Router {
4786
5174
  * component first. This behavior is configured by the `RouteReuseStrategy`. In order to reload
4787
5175
  * routed components on same url navigation, you need to set `onSameUrlNavigation` to `'reload'`
4788
5176
  * _and_ provide a `RouteReuseStrategy` which returns `false` for `shouldReuseRoute`.
5177
+ *
5178
+ * @deprecated Configure this through `provideRouter` or `RouterModule.forRoot` instead.
5179
+ * @see `withRouterConfig`
5180
+ * @see `provideRouter`
5181
+ * @see `RouterModule`
4789
5182
  */
4790
5183
  this.onSameUrlNavigation = 'ignore';
4791
5184
  /**
@@ -4796,6 +5189,11 @@ class Router {
4796
5189
  * for path-less or component-less routes.
4797
5190
  * - `'always'` : Inherit parent parameters, data, and resolved data
4798
5191
  * for all child routes.
5192
+ *
5193
+ * @deprecated Configure this through `provideRouter` or `RouterModule.forRoot` instead.
5194
+ * @see `withRouterConfig`
5195
+ * @see `provideRouter`
5196
+ * @see `RouterModule`
4799
5197
  */
4800
5198
  this.paramsInheritanceStrategy = 'emptyOnly';
4801
5199
  /**
@@ -4804,6 +5202,11 @@ class Router {
4804
5202
  * Set to `'eager'` to update the browser URL at the beginning of navigation.
4805
5203
  * You can choose to update early so that, if navigation fails,
4806
5204
  * you can show an error message with the URL that failed.
5205
+ *
5206
+ * @deprecated Configure this through `provideRouter` or `RouterModule.forRoot` instead.
5207
+ * @see `withRouterConfig`
5208
+ * @see `provideRouter`
5209
+ * @see `RouterModule`
4807
5210
  */
4808
5211
  this.urlUpdateStrategy = 'deferred';
4809
5212
  /**
@@ -4827,8 +5230,13 @@ class Router {
4827
5230
  *
4828
5231
  * The default value is `replace`.
4829
5232
  *
5233
+ * @deprecated Configure this through `provideRouter` or `RouterModule.forRoot` instead.
5234
+ * @see `withRouterConfig`
5235
+ * @see `provideRouter`
5236
+ * @see `RouterModule`
4830
5237
  */
4831
5238
  this.canceledNavigationResolution = 'replace';
5239
+ this.navigationTransitions = new NavigationTransitions(this);
4832
5240
  const onLoadStart = (r) => this.triggerEvent(new RouteConfigLoadStart(r));
4833
5241
  const onLoadEnd = (r) => this.triggerEvent(new RouteConfigLoadEnd(r));
4834
5242
  this.configLoader = injector.get(RouterConfigLoader);
@@ -4847,7 +5255,6 @@ class Router {
4847
5255
  id: 0,
4848
5256
  targetPageId: 0,
4849
5257
  currentUrlTree: this.currentUrlTree,
4850
- currentRawUrl: this.currentUrlTree,
4851
5258
  extractedUrl: this.urlHandlingStrategy.extract(this.currentUrlTree),
4852
5259
  urlAfterRedirects: this.urlHandlingStrategy.extract(this.currentUrlTree),
4853
5260
  rawUrl: this.currentUrlTree,
@@ -4864,7 +5271,7 @@ class Router {
4864
5271
  guards: { canActivateChecks: [], canDeactivateChecks: [] },
4865
5272
  guardsResult: null,
4866
5273
  });
4867
- this.navigations = this.setupNavigations(this.transitions);
5274
+ this.navigations = this.navigationTransitions.setupNavigations(this.transitions);
4868
5275
  this.processNavigations();
4869
5276
  }
4870
5277
  /**
@@ -4875,291 +5282,6 @@ class Router {
4875
5282
  get browserPageId() {
4876
5283
  return this.location.getState()?.ɵrouterPageId;
4877
5284
  }
4878
- setupNavigations(transitions) {
4879
- const eventsSubject = this.events;
4880
- return transitions.pipe(filter(t => t.id !== 0),
4881
- // Extract URL
4882
- map(t => ({ ...t, extractedUrl: this.urlHandlingStrategy.extract(t.rawUrl) })),
4883
- // Using switchMap so we cancel executing navigations when a new one comes in
4884
- switchMap(overallTransitionState => {
4885
- let completed = false;
4886
- let errored = false;
4887
- return of(overallTransitionState)
4888
- .pipe(
4889
- // Store the Navigation object
4890
- tap(t => {
4891
- this.currentNavigation = {
4892
- id: t.id,
4893
- initialUrl: t.rawUrl,
4894
- extractedUrl: t.extractedUrl,
4895
- trigger: t.source,
4896
- extras: t.extras,
4897
- previousNavigation: this.lastSuccessfulNavigation ?
4898
- { ...this.lastSuccessfulNavigation, previousNavigation: null } :
4899
- null
4900
- };
4901
- }), switchMap(t => {
4902
- const browserUrlTree = this.browserUrlTree.toString();
4903
- const urlTransition = !this.navigated ||
4904
- t.extractedUrl.toString() !== browserUrlTree ||
4905
- // Navigations which succeed or ones which fail and are cleaned up
4906
- // correctly should result in `browserUrlTree` and `currentUrlTree`
4907
- // matching. If this is not the case, assume something went wrong and
4908
- // try processing the URL again.
4909
- browserUrlTree !== this.currentUrlTree.toString();
4910
- const processCurrentUrl = (this.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
4911
- this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
4912
- if (processCurrentUrl) {
4913
- // If the source of the navigation is from a browser event, the URL is
4914
- // already updated. We already need to sync the internal state.
4915
- if (isBrowserTriggeredNavigation(t.source)) {
4916
- this.browserUrlTree = t.extractedUrl;
4917
- }
4918
- return of(t).pipe(
4919
- // Fire NavigationStart event
4920
- switchMap(t => {
4921
- const transition = this.transitions.getValue();
4922
- eventsSubject.next(new NavigationStart(t.id, this.serializeUrl(t.extractedUrl), t.source, t.restoredState));
4923
- if (transition !== this.transitions.getValue()) {
4924
- return EMPTY;
4925
- }
4926
- // This delay is required to match old behavior that forced
4927
- // navigation to always be async
4928
- return Promise.resolve(t);
4929
- }),
4930
- // ApplyRedirects
4931
- applyRedirects(this.ngModule.injector, this.configLoader, this.urlSerializer, this.config),
4932
- // Update the currentNavigation
4933
- // `urlAfterRedirects` is guaranteed to be set after this point
4934
- tap(t => {
4935
- this.currentNavigation = {
4936
- ...this.currentNavigation,
4937
- finalUrl: t.urlAfterRedirects
4938
- };
4939
- overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
4940
- }),
4941
- // Recognize
4942
- recognize(this.ngModule.injector, this.rootComponentType, this.config, this.urlSerializer, this.paramsInheritanceStrategy),
4943
- // Update URL if in `eager` update mode
4944
- tap(t => {
4945
- overallTransitionState.targetSnapshot = t.targetSnapshot;
4946
- if (this.urlUpdateStrategy === 'eager') {
4947
- if (!t.extras.skipLocationChange) {
4948
- const rawUrl = this.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4949
- this.setBrowserUrl(rawUrl, t);
4950
- }
4951
- this.browserUrlTree = t.urlAfterRedirects;
4952
- }
4953
- // Fire RoutesRecognized
4954
- const routesRecognized = new RoutesRecognized(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4955
- eventsSubject.next(routesRecognized);
4956
- }));
4957
- }
4958
- else {
4959
- const processPreviousUrl = urlTransition && this.rawUrlTree &&
4960
- this.urlHandlingStrategy.shouldProcessUrl(this.rawUrlTree);
4961
- /* When the current URL shouldn't be processed, but the previous one
4962
- * was, we handle this "error condition" by navigating to the
4963
- * previously successful URL, but leaving the URL intact.*/
4964
- if (processPreviousUrl) {
4965
- const { id, extractedUrl, source, restoredState, extras } = t;
4966
- const navStart = new NavigationStart(id, this.serializeUrl(extractedUrl), source, restoredState);
4967
- eventsSubject.next(navStart);
4968
- const targetSnapshot = createEmptyState(extractedUrl, this.rootComponentType).snapshot;
4969
- overallTransitionState = {
4970
- ...t,
4971
- targetSnapshot,
4972
- urlAfterRedirects: extractedUrl,
4973
- extras: { ...extras, skipLocationChange: false, replaceUrl: false },
4974
- };
4975
- return of(overallTransitionState);
4976
- }
4977
- else {
4978
- /* When neither the current or previous URL can be processed, do
4979
- * nothing other than update router's internal reference to the
4980
- * current "settled" URL. This way the next navigation will be coming
4981
- * from the current URL in the browser.
4982
- */
4983
- this.rawUrlTree = t.rawUrl;
4984
- t.resolve(null);
4985
- return EMPTY;
4986
- }
4987
- }
4988
- }),
4989
- // --- GUARDS ---
4990
- tap(t => {
4991
- const guardsStart = new GuardsCheckStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4992
- this.triggerEvent(guardsStart);
4993
- }), map(t => {
4994
- overallTransitionState = {
4995
- ...t,
4996
- guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)
4997
- };
4998
- return overallTransitionState;
4999
- }), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
5000
- overallTransitionState.guardsResult = t.guardsResult;
5001
- if (isUrlTree(t.guardsResult)) {
5002
- throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
5003
- }
5004
- const guardsEnd = new GuardsCheckEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
5005
- this.triggerEvent(guardsEnd);
5006
- }), filter(t => {
5007
- if (!t.guardsResult) {
5008
- this.restoreHistory(t);
5009
- this.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */);
5010
- return false;
5011
- }
5012
- return true;
5013
- }),
5014
- // --- RESOLVE ---
5015
- switchTap(t => {
5016
- if (t.guards.canActivateChecks.length) {
5017
- return of(t).pipe(tap(t => {
5018
- const resolveStart = new ResolveStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
5019
- this.triggerEvent(resolveStart);
5020
- }), switchMap(t => {
5021
- let dataResolved = false;
5022
- return of(t).pipe(resolveData(this.paramsInheritanceStrategy, this.ngModule.injector), tap({
5023
- next: () => dataResolved = true,
5024
- complete: () => {
5025
- if (!dataResolved) {
5026
- this.restoreHistory(t);
5027
- this.cancelNavigationTransition(t, NG_DEV_MODE$2 ?
5028
- `At least one route resolver didn't emit any value.` :
5029
- '', 2 /* NavigationCancellationCode.NoDataFromResolver */);
5030
- }
5031
- }
5032
- }));
5033
- }), tap(t => {
5034
- const resolveEnd = new ResolveEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
5035
- this.triggerEvent(resolveEnd);
5036
- }));
5037
- }
5038
- return undefined;
5039
- }),
5040
- // --- LOAD COMPONENTS ---
5041
- switchTap((t) => {
5042
- const loadComponents = (route) => {
5043
- const loaders = [];
5044
- if (route.routeConfig?.loadComponent &&
5045
- !route.routeConfig._loadedComponent) {
5046
- loaders.push(this.configLoader.loadComponent(route.routeConfig)
5047
- .pipe(tap(loadedComponent => {
5048
- route.component = loadedComponent;
5049
- }), map(() => void 0)));
5050
- }
5051
- for (const child of route.children) {
5052
- loaders.push(...loadComponents(child));
5053
- }
5054
- return loaders;
5055
- };
5056
- return combineLatest(loadComponents(t.targetSnapshot.root))
5057
- .pipe(defaultIfEmpty(), take(1));
5058
- }), switchTap(() => this.afterPreactivation()), map((t) => {
5059
- const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
5060
- overallTransitionState = { ...t, targetRouterState };
5061
- return (overallTransitionState);
5062
- }),
5063
- /* Once here, we are about to activate synchronously. The assumption is
5064
- this will succeed, and user code may read from the Router service.
5065
- Therefore before activation, we need to update router properties storing
5066
- the current URL and the RouterState, as well as updated the browser URL.
5067
- All this should happen *before* activating. */
5068
- tap((t) => {
5069
- this.currentUrlTree = t.urlAfterRedirects;
5070
- this.rawUrlTree =
5071
- this.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
5072
- this.routerState = t.targetRouterState;
5073
- if (this.urlUpdateStrategy === 'deferred') {
5074
- if (!t.extras.skipLocationChange) {
5075
- this.setBrowserUrl(this.rawUrlTree, t);
5076
- }
5077
- this.browserUrlTree = t.urlAfterRedirects;
5078
- }
5079
- }), activateRoutes(this.rootContexts, this.routeReuseStrategy, (evt) => this.triggerEvent(evt)), tap({
5080
- next() {
5081
- completed = true;
5082
- },
5083
- complete() {
5084
- completed = true;
5085
- }
5086
- }), finalize(() => {
5087
- /* When the navigation stream finishes either through error or success,
5088
- * we set the `completed` or `errored` flag. However, there are some
5089
- * situations where we could get here without either of those being set.
5090
- * For instance, a redirect during NavigationStart. Therefore, this is a
5091
- * catch-all to make sure the NavigationCancel event is fired when a
5092
- * navigation gets cancelled but not caught by other means. */
5093
- if (!completed && !errored) {
5094
- const cancelationReason = NG_DEV_MODE$2 ?
5095
- `Navigation ID ${overallTransitionState
5096
- .id} is not equal to the current navigation id ${this.navigationId}` :
5097
- '';
5098
- this.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
5099
- }
5100
- // Only clear current navigation if it is still set to the one that
5101
- // finalized.
5102
- if (this.currentNavigation?.id === overallTransitionState.id) {
5103
- this.currentNavigation = null;
5104
- }
5105
- }), catchError((e) => {
5106
- errored = true;
5107
- /* This error type is issued during Redirect, and is handled as a
5108
- * cancellation rather than an error. */
5109
- if (isNavigationCancelingError$1(e)) {
5110
- if (!isRedirectingNavigationCancelingError$1(e)) {
5111
- // Set property only if we're not redirecting. If we landed on a page
5112
- // and redirect to `/` route, the new navigation is going to see the
5113
- // `/` isn't a change from the default currentUrlTree and won't
5114
- // navigate. This is only applicable with initial navigation, so
5115
- // setting `navigated` only when not redirecting resolves this
5116
- // scenario.
5117
- this.navigated = true;
5118
- this.restoreHistory(overallTransitionState, true);
5119
- }
5120
- const navCancel = new NavigationCancel(overallTransitionState.id, this.serializeUrl(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
5121
- eventsSubject.next(navCancel);
5122
- // When redirecting, we need to delay resolving the navigation
5123
- // promise and push it to the redirect navigation
5124
- if (!isRedirectingNavigationCancelingError$1(e)) {
5125
- overallTransitionState.resolve(false);
5126
- }
5127
- else {
5128
- const mergedTree = this.urlHandlingStrategy.merge(e.url, this.rawUrlTree);
5129
- const extras = {
5130
- skipLocationChange: overallTransitionState.extras.skipLocationChange,
5131
- // The URL is already updated at this point if we have 'eager' URL
5132
- // updates or if the navigation was triggered by the browser (back
5133
- // button, URL bar, etc). We want to replace that item in history
5134
- // if the navigation is rejected.
5135
- replaceUrl: this.urlUpdateStrategy === 'eager' ||
5136
- isBrowserTriggeredNavigation(overallTransitionState.source)
5137
- };
5138
- this.scheduleNavigation(mergedTree, 'imperative', null, extras, {
5139
- resolve: overallTransitionState.resolve,
5140
- reject: overallTransitionState.reject,
5141
- promise: overallTransitionState.promise
5142
- });
5143
- }
5144
- /* All other errors should reset to the router's internal URL reference
5145
- * to the pre-error state. */
5146
- }
5147
- else {
5148
- this.restoreHistory(overallTransitionState, true);
5149
- const navError = new NavigationError(overallTransitionState.id, this.serializeUrl(overallTransitionState.extractedUrl), e, overallTransitionState.targetSnapshot ?? undefined);
5150
- eventsSubject.next(navError);
5151
- try {
5152
- overallTransitionState.resolve(this.errorHandler(e));
5153
- }
5154
- catch (ee) {
5155
- overallTransitionState.reject(ee);
5156
- }
5157
- }
5158
- return EMPTY;
5159
- }));
5160
- // TODO(jasonaden): remove cast once g3 is on updated TypeScript
5161
- }));
5162
- }
5163
5285
  /**
5164
5286
  * @internal
5165
5287
  * TODO: this should be removed once the constructor of the router made internal
@@ -5199,11 +5321,18 @@ class Router {
5199
5321
  // hybrid apps.
5200
5322
  setTimeout(() => {
5201
5323
  const extras = { replaceUrl: true };
5202
- // Navigations coming from Angular router have a navigationId state
5203
- // property. When this exists, restore the state.
5204
- const state = event.state?.navigationId ? event.state : null;
5205
- if (state) {
5206
- const stateCopy = { ...state };
5324
+ // TODO: restoredState should always include the entire state, regardless
5325
+ // of navigationId. This requires a breaking change to update the type on
5326
+ // NavigationStart’s restoredState, which currently requires navigationId
5327
+ // to always be present. The Router used to only restore history state if
5328
+ // a navigationId was present.
5329
+ // The stored navigationId is used by the RouterScroller to retrieve the scroll
5330
+ // position for the page.
5331
+ const restoredState = event.state?.navigationId ? event.state : null;
5332
+ // Separate to NavigationStart.restoredState, we must also restore the state to
5333
+ // history.state and generate a new navigationId, since it will be overwritten
5334
+ if (event.state) {
5335
+ const stateCopy = { ...event.state };
5207
5336
  delete stateCopy.navigationId;
5208
5337
  delete stateCopy.ɵrouterPageId;
5209
5338
  if (Object.keys(stateCopy).length !== 0) {
@@ -5211,7 +5340,7 @@ class Router {
5211
5340
  }
5212
5341
  }
5213
5342
  const urlTree = this.parseUrl(event['url']);
5214
- this.scheduleNavigation(urlTree, source, state, extras);
5343
+ this.scheduleNavigation(urlTree, source, restoredState, extras);
5215
5344
  }, 0);
5216
5345
  }
5217
5346
  });
@@ -5226,7 +5355,7 @@ class Router {
5226
5355
  * and `null` when idle.
5227
5356
  */
5228
5357
  getCurrentNavigation() {
5229
- return this.currentNavigation;
5358
+ return this.navigationTransitions.currentNavigation;
5230
5359
  }
5231
5360
  /** @internal */
5232
5361
  triggerEvent(event) {
@@ -5452,13 +5581,14 @@ class Router {
5452
5581
  this.currentPageId = t.targetPageId;
5453
5582
  this.events
5454
5583
  .next(new NavigationEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(this.currentUrlTree)));
5455
- this.lastSuccessfulNavigation = this.currentNavigation;
5584
+ this.lastSuccessfulNavigation = this.getCurrentNavigation();
5456
5585
  this.titleStrategy?.updateTitle(this.routerState.snapshot);
5457
5586
  t.resolve(true);
5458
5587
  }, e => {
5459
5588
  this.console.warn(`Unhandled Navigation Error: ${e}`);
5460
5589
  });
5461
5590
  }
5591
+ /** @internal */
5462
5592
  scheduleNavigation(rawUrl, source, restoredState, extras, priorPromise) {
5463
5593
  if (this.disposed) {
5464
5594
  return Promise.resolve(false);
@@ -5511,7 +5641,6 @@ class Router {
5511
5641
  source,
5512
5642
  restoredState,
5513
5643
  currentUrlTree: this.currentUrlTree,
5514
- currentRawUrl: this.rawUrlTree,
5515
5644
  rawUrl,
5516
5645
  extras,
5517
5646
  resolve,
@@ -5526,10 +5655,14 @@ class Router {
5526
5655
  return Promise.reject(e);
5527
5656
  });
5528
5657
  }
5529
- setBrowserUrl(url, t) {
5658
+ /** @internal */
5659
+ setBrowserUrl(url, transition) {
5530
5660
  const path = this.urlSerializer.serialize(url);
5531
- const state = { ...t.extras.state, ...this.generateNgRouterState(t.id, t.targetPageId) };
5532
- if (this.location.isCurrentPathEqualTo(path) || !!t.extras.replaceUrl) {
5661
+ const state = {
5662
+ ...transition.extras.state,
5663
+ ...this.generateNgRouterState(transition.id, transition.targetPageId)
5664
+ };
5665
+ if (this.location.isCurrentPathEqualTo(path) || !!transition.extras.replaceUrl) {
5533
5666
  this.location.replaceState(path, '', state);
5534
5667
  }
5535
5668
  else {
@@ -5539,28 +5672,30 @@ class Router {
5539
5672
  /**
5540
5673
  * Performs the necessary rollback action to restore the browser URL to the
5541
5674
  * state before the transition.
5675
+ * @internal
5542
5676
  */
5543
- restoreHistory(t, restoringFromCaughtError = false) {
5677
+ restoreHistory(transition, restoringFromCaughtError = false) {
5544
5678
  if (this.canceledNavigationResolution === 'computed') {
5545
- const targetPagePosition = this.currentPageId - t.targetPageId;
5679
+ const targetPagePosition = this.currentPageId - transition.targetPageId;
5546
5680
  // The navigator change the location before triggered the browser event,
5547
5681
  // so we need to go back to the current url if the navigation is canceled.
5548
5682
  // Also, when navigation gets cancelled while using url update strategy eager, then we need to
5549
5683
  // go back. Because, when `urlUpdateStrategy` is `eager`; `setBrowserUrl` method is called
5550
5684
  // before any verification.
5551
- const browserUrlUpdateOccurred = (t.source === 'popstate' || this.urlUpdateStrategy === 'eager' ||
5552
- this.currentUrlTree === this.currentNavigation?.finalUrl);
5685
+ const browserUrlUpdateOccurred = (transition.source === 'popstate' || this.urlUpdateStrategy === 'eager' ||
5686
+ this.currentUrlTree === this.getCurrentNavigation()?.finalUrl);
5553
5687
  if (browserUrlUpdateOccurred && targetPagePosition !== 0) {
5554
5688
  this.location.historyGo(targetPagePosition);
5555
5689
  }
5556
- else if (this.currentUrlTree === this.currentNavigation?.finalUrl && targetPagePosition === 0) {
5690
+ else if (this.currentUrlTree === this.getCurrentNavigation()?.finalUrl &&
5691
+ targetPagePosition === 0) {
5557
5692
  // We got to the activation stage (where currentUrlTree is set to the navigation's
5558
5693
  // finalUrl), but we weren't moving anywhere in history (skipLocationChange or replaceUrl).
5559
5694
  // We still need to reset the router state back to what it was when the navigation started.
5560
- this.resetState(t);
5695
+ this.resetState(transition);
5561
5696
  // TODO(atscott): resetting the `browserUrlTree` should really be done in `resetState`.
5562
5697
  // Investigate if this can be done by running TGP.
5563
- this.browserUrlTree = t.currentUrlTree;
5698
+ this.browserUrlTree = transition.currentUrlTree;
5564
5699
  this.resetUrlToCurrentUrlTree();
5565
5700
  }
5566
5701
  else {
@@ -5574,7 +5709,7 @@ class Router {
5574
5709
  // reject. For 'eager' navigations, it seems like we also really should reset the state
5575
5710
  // because the navigation was cancelled. Investigate if this can be done by running TGP.
5576
5711
  if (restoringFromCaughtError) {
5577
- this.resetState(t);
5712
+ this.resetState(transition);
5578
5713
  }
5579
5714
  this.resetUrlToCurrentUrlTree();
5580
5715
  }
@@ -5592,10 +5727,11 @@ class Router {
5592
5727
  resetUrlToCurrentUrlTree() {
5593
5728
  this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
5594
5729
  }
5595
- cancelNavigationTransition(t, reason, code) {
5596
- const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), reason, code);
5730
+ /** @internal */
5731
+ cancelNavigationTransition(transition, reason, code) {
5732
+ const navCancel = new NavigationCancel(transition.id, this.serializeUrl(transition.extractedUrl), reason, code);
5597
5733
  this.triggerEvent(navCancel);
5598
- t.resolve(false);
5734
+ transition.resolve(false);
5599
5735
  }
5600
5736
  generateNgRouterState(navigationId, routerPageId) {
5601
5737
  if (this.canceledNavigationResolution === 'computed') {
@@ -5604,9 +5740,9 @@ class Router {
5604
5740
  return { navigationId };
5605
5741
  }
5606
5742
  }
5607
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5608
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5609
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: Router, decorators: [{
5743
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5744
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5745
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: Router, decorators: [{
5610
5746
  type: Injectable,
5611
5747
  args: [{
5612
5748
  providedIn: 'root',
@@ -5621,9 +5757,6 @@ function validateCommands(commands) {
5621
5757
  }
5622
5758
  }
5623
5759
  }
5624
- function isBrowserTriggeredNavigation(source) {
5625
- return source !== 'imperative';
5626
- }
5627
5760
 
5628
5761
  /**
5629
5762
  * @license
@@ -5905,9 +6038,9 @@ class RouterLink {
5905
6038
  });
5906
6039
  }
5907
6040
  }
5908
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5909
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0", type: RouterLink, isStandalone: true, selector: "[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target" } }, usesOnChanges: true, ngImport: i0 });
5910
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterLink, decorators: [{
6041
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
6042
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0-next.0", type: RouterLink, isStandalone: true, selector: "[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target" } }, usesOnChanges: true, ngImport: i0 });
6043
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterLink, decorators: [{
5911
6044
  type: Directive,
5912
6045
  args: [{
5913
6046
  selector: '[routerLink]',
@@ -6132,9 +6265,9 @@ class RouterLinkActive {
6132
6265
  return this.link && isActiveCheckFn(this.link) || this.links.some(isActiveCheckFn);
6133
6266
  }
6134
6267
  }
6135
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6136
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
6137
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterLinkActive, decorators: [{
6268
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6269
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.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 }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
6270
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterLinkActive, decorators: [{
6138
6271
  type: Directive,
6139
6272
  args: [{
6140
6273
  selector: '[routerLinkActive]',
@@ -6194,9 +6327,9 @@ class PreloadAllModules {
6194
6327
  return fn().pipe(catchError(() => of(null)));
6195
6328
  }
6196
6329
  }
6197
- PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6198
- PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6199
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: PreloadAllModules, decorators: [{
6330
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6331
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6332
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: PreloadAllModules, decorators: [{
6200
6333
  type: Injectable,
6201
6334
  args: [{ providedIn: 'root' }]
6202
6335
  }] });
@@ -6214,9 +6347,9 @@ class NoPreloading {
6214
6347
  return of(null);
6215
6348
  }
6216
6349
  }
6217
- NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6218
- NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6219
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NoPreloading, decorators: [{
6350
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6351
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6352
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: NoPreloading, decorators: [{
6220
6353
  type: Injectable,
6221
6354
  args: [{ providedIn: 'root' }]
6222
6355
  }] });
@@ -6310,9 +6443,9 @@ class RouterPreloader {
6310
6443
  });
6311
6444
  }
6312
6445
  }
6313
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6314
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
6315
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterPreloader, decorators: [{
6446
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6447
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
6448
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterPreloader, decorators: [{
6316
6449
  type: Injectable,
6317
6450
  args: [{ providedIn: 'root' }]
6318
6451
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
@@ -6410,9 +6543,9 @@ class RouterScroller {
6410
6543
  }
6411
6544
  }
6412
6545
  }
6413
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6414
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterScroller });
6415
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterScroller, decorators: [{
6546
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6547
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterScroller });
6548
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterScroller, decorators: [{
6416
6549
  type: Injectable
6417
6550
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: i0.NgZone }, { type: undefined }]; } });
6418
6551
 
@@ -6574,8 +6707,10 @@ function getBootstrapListener() {
6574
6707
  injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();
6575
6708
  injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)?.init();
6576
6709
  router.resetRootComponentType(ref.componentTypes[0]);
6577
- bootstrapDone.next();
6578
- bootstrapDone.complete();
6710
+ if (!bootstrapDone.closed) {
6711
+ bootstrapDone.next();
6712
+ bootstrapDone.unsubscribe();
6713
+ }
6579
6714
  };
6580
6715
  }
6581
6716
  /**
@@ -6623,7 +6758,6 @@ function withEnabledBlockingInitialNavigation() {
6623
6758
  deps: [Injector],
6624
6759
  useFactory: (injector) => {
6625
6760
  const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve());
6626
- let initNavigation = false;
6627
6761
  /**
6628
6762
  * Performs the given action once the router finishes its next/current navigation.
6629
6763
  *
@@ -6658,21 +6792,13 @@ function withEnabledBlockingInitialNavigation() {
6658
6792
  // Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
6659
6793
  // without a redirect.
6660
6794
  resolve(true);
6661
- initNavigation = true;
6662
6795
  });
6663
6796
  router.afterPreactivation = () => {
6664
6797
  // Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
6665
6798
  // assume activation will complete successfully (even though this is not
6666
6799
  // guaranteed).
6667
6800
  resolve(true);
6668
- // only the initial navigation should be delayed until bootstrapping is done.
6669
- if (!initNavigation) {
6670
- return bootstrapDone.closed ? of(void 0) : bootstrapDone;
6671
- // subsequent navigations should not be delayed
6672
- }
6673
- else {
6674
- return of(void 0);
6675
- }
6801
+ return bootstrapDone.closed ? of(void 0) : bootstrapDone;
6676
6802
  };
6677
6803
  router.initialNavigation();
6678
6804
  });
@@ -6961,10 +7087,10 @@ class RouterModule {
6961
7087
  };
6962
7088
  }
6963
7089
  }
6964
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6965
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.0", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] });
6966
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
6967
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterModule, decorators: [{
7090
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
7091
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] });
7092
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
7093
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterModule, decorators: [{
6968
7094
  type: NgModule,
6969
7095
  args: [{
6970
7096
  imports: ROUTER_DIRECTIVES,
@@ -7049,7 +7175,7 @@ function provideRouterInitializer() {
7049
7175
  /**
7050
7176
  * @publicApi
7051
7177
  */
7052
- const VERSION = new Version('15.0.0');
7178
+ const VERSION = new Version('15.1.0-next.0');
7053
7179
 
7054
7180
  /**
7055
7181
  * @license
@@ -7088,5 +7214,5 @@ const VERSION = new Version('15.0.0');
7088
7214
  * Generated bundle index. Do not edit.
7089
7215
  */
7090
7216
 
7091
- 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, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRouter, provideRoutes, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withInMemoryScrolling, withPreloading, withRouterConfig, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, withPreloading as ɵwithPreloading };
7217
+ export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationSkipped, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRouter, provideRoutes, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withInMemoryScrolling, withPreloading, withRouterConfig, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, withPreloading as ɵwithPreloading };
7092
7218
  //# sourceMappingURL=router.mjs.map