@angular/router 16.0.0-next.3 → 16.0.0-next.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/esm2022/src/apply_redirects.mjs +112 -0
  2. package/{esm2020 → esm2022}/src/components/empty_outlet.mjs +4 -4
  3. package/esm2022/src/create_url_tree.mjs +418 -0
  4. package/{esm2020 → esm2022}/src/directives/router_link.mjs +4 -4
  5. package/{esm2020 → esm2022}/src/directives/router_link_active.mjs +4 -4
  6. package/esm2022/src/directives/router_outlet.mjs +259 -0
  7. package/esm2022/src/index.mjs +30 -0
  8. package/esm2022/src/models_deprecated.mjs +9 -0
  9. package/esm2022/src/navigation_transition.mjs +391 -0
  10. package/esm2022/src/operators/activate_routes.mjs +180 -0
  11. package/esm2022/src/operators/recognize.mjs +16 -0
  12. package/{esm2020 → esm2022}/src/page_title_strategy.mjs +7 -7
  13. package/esm2022/src/provide_router.mjs +478 -0
  14. package/esm2022/src/recognize.mjs +360 -0
  15. package/{esm2020 → esm2022}/src/route_reuse_strategy.mjs +7 -7
  16. package/esm2022/src/router.mjs +719 -0
  17. package/esm2022/src/router_config.mjs +18 -0
  18. package/esm2022/src/router_config_loader.mjs +132 -0
  19. package/esm2022/src/router_module.mjs +219 -0
  20. package/{esm2020 → esm2022}/src/router_outlet_context.mjs +4 -4
  21. package/esm2022/src/router_preloader.mjs +167 -0
  22. package/{esm2020 → esm2022}/src/router_scroller.mjs +4 -4
  23. package/esm2022/src/router_state.mjs +408 -0
  24. package/{esm2020 → esm2022}/src/url_handling_strategy.mjs +7 -7
  25. package/esm2022/src/url_tree.mjs +642 -0
  26. package/esm2022/src/utils/config_matching.mjs +141 -0
  27. package/esm2022/src/utils/navigations.mjs +42 -0
  28. package/{esm2020 → esm2022}/src/version.mjs +1 -1
  29. package/{esm2020 → esm2022}/testing/src/router_testing_harness.mjs +7 -7
  30. package/{esm2020 → esm2022}/testing/src/router_testing_module.mjs +10 -10
  31. package/{fesm2020 → fesm2022}/router.mjs +481 -726
  32. package/fesm2022/router.mjs.map +1 -0
  33. package/{fesm2020 → fesm2022}/testing.mjs +16 -16
  34. package/{fesm2020 → fesm2022}/testing.mjs.map +1 -1
  35. package/{fesm2020 → fesm2022}/upgrade.mjs +1 -1
  36. package/index.d.ts +9 -10
  37. package/package.json +14 -24
  38. package/testing/index.d.ts +1 -1
  39. package/upgrade/index.d.ts +1 -1
  40. package/esm2020/src/apply_redirects.mjs +0 -331
  41. package/esm2020/src/create_url_tree.mjs +0 -454
  42. package/esm2020/src/create_url_tree_strategy.mjs +0 -78
  43. package/esm2020/src/deprecated_load_children.mjs +0 -13
  44. package/esm2020/src/directives/router_outlet.mjs +0 -259
  45. package/esm2020/src/index.mjs +0 -29
  46. package/esm2020/src/navigation_transition.mjs +0 -399
  47. package/esm2020/src/operators/activate_routes.mjs +0 -177
  48. package/esm2020/src/operators/apply_redirects.mjs +0 -14
  49. package/esm2020/src/operators/recognize.mjs +0 -14
  50. package/esm2020/src/provide_router.mjs +0 -477
  51. package/esm2020/src/recognize.mjs +0 -297
  52. package/esm2020/src/router.mjs +0 -689
  53. package/esm2020/src/router_config.mjs +0 -19
  54. package/esm2020/src/router_config_loader.mjs +0 -137
  55. package/esm2020/src/router_module.mjs +0 -216
  56. package/esm2020/src/router_preloader.mjs +0 -167
  57. package/esm2020/src/router_state.mjs +0 -411
  58. package/esm2020/src/url_tree.mjs +0 -631
  59. package/esm2020/src/utils/config_matching.mjs +0 -153
  60. package/esm2020/src/utils/navigations.mjs +0 -42
  61. package/fesm2015/router.mjs +0 -7138
  62. package/fesm2015/router.mjs.map +0 -1
  63. package/fesm2015/testing.mjs +0 -270
  64. package/fesm2015/testing.mjs.map +0 -1
  65. package/fesm2015/upgrade.mjs +0 -146
  66. package/fesm2015/upgrade.mjs.map +0 -1
  67. package/fesm2020/router.mjs.map +0 -1
  68. /package/{esm2020 → esm2022}/index.mjs +0 -0
  69. /package/{esm2020 → esm2022}/public_api.mjs +0 -0
  70. /package/{esm2020 → esm2022}/router.mjs +0 -0
  71. /package/{esm2020 → esm2022}/src/create_router_state.mjs +0 -0
  72. /package/{esm2020 → esm2022}/src/errors.mjs +0 -0
  73. /package/{esm2020 → esm2022}/src/events.mjs +0 -0
  74. /package/{esm2020 → esm2022}/src/models.mjs +0 -0
  75. /package/{esm2020 → esm2022}/src/navigation_canceling_error.mjs +0 -0
  76. /package/{esm2020 → esm2022}/src/operators/check_guards.mjs +0 -0
  77. /package/{esm2020 → esm2022}/src/operators/prioritized_guard_value.mjs +0 -0
  78. /package/{esm2020 → esm2022}/src/operators/resolve_data.mjs +0 -0
  79. /package/{esm2020 → esm2022}/src/operators/switch_tap.mjs +0 -0
  80. /package/{esm2020 → esm2022}/src/private_export.mjs +0 -0
  81. /package/{esm2020 → esm2022}/src/shared.mjs +0 -0
  82. /package/{esm2020 → esm2022}/src/utils/collection.mjs +0 -0
  83. /package/{esm2020 → esm2022}/src/utils/config.mjs +0 -0
  84. /package/{esm2020 → esm2022}/src/utils/functional_guards.mjs +0 -0
  85. /package/{esm2020 → esm2022}/src/utils/preactivation.mjs +0 -0
  86. /package/{esm2020 → esm2022}/src/utils/tree.mjs +0 -0
  87. /package/{esm2020 → esm2022}/src/utils/type_guards.mjs +0 -0
  88. /package/{esm2020 → esm2022}/testing/index.mjs +0 -0
  89. /package/{esm2020 → esm2022}/testing/public_api.mjs +0 -0
  90. /package/{esm2020 → esm2022}/testing/src/testing.mjs +0 -0
  91. /package/{esm2020 → esm2022}/testing/testing.mjs +0 -0
  92. /package/{esm2020 → esm2022}/upgrade/index.mjs +0 -0
  93. /package/{esm2020 → esm2022}/upgrade/public_api.mjs +0 -0
  94. /package/{esm2020 → esm2022}/upgrade/src/upgrade.mjs +0 -0
  95. /package/{esm2020 → esm2022}/upgrade/upgrade.mjs +0 -0
  96. /package/{fesm2020 → fesm2022}/upgrade.mjs.map +0 -0
@@ -1,15 +1,15 @@
1
1
  /**
2
- * @license Angular v16.0.0-next.3
2
+ * @license Angular v16.0.0-next.5
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 { ɵisPromise, ɵRuntimeError, Injectable, EventEmitter, inject, ViewContainerRef, ChangeDetectorRef, EnvironmentInjector, Directive, Input, Output, Component, createEnvironmentInjector, ɵisNgModule, isStandalone, ɵisInjectable, InjectionToken, InjectFlags, NgModuleFactory, ɵConsole, NgZone, ɵcoerceToBoolean, ɵɵsanitizeUrlOrResourceUrl, Attribute, HostBinding, HostListener, Optional, ContentChildren, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, ENVIRONMENT_INITIALIZER, Injector, ApplicationRef, APP_INITIALIZER, NgProbeToken, SkipSelf, NgModule, Inject, Version } from '@angular/core';
9
- import { isObservable, from, of, BehaviorSubject, EmptyError, combineLatest, concat, defer, pipe, throwError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
8
+ import { ɵisPromise, ɵRuntimeError, Injectable, EventEmitter, inject, ViewContainerRef, ChangeDetectorRef, EnvironmentInjector, Directive, Input, Output, Component, createEnvironmentInjector, ɵisNgModule, isStandalone, ɵisInjectable, InjectionToken, Compiler, InjectFlags, NgModuleFactory, ɵConsole, ɵInitialRenderPendingTasks, NgZone, ɵcoerceToBoolean, ɵɵsanitizeUrlOrResourceUrl, Attribute, HostBinding, HostListener, Optional, ContentChildren, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, ENVIRONMENT_INITIALIZER, Injector, ApplicationRef, APP_INITIALIZER, NgProbeToken, SkipSelf, NgModule, Inject, Version } from '@angular/core';
9
+ import { isObservable, from, of, BehaviorSubject, EmptyError, combineLatest, concat, defer, pipe, throwError, EMPTY, ConnectableObservable, Subject } from 'rxjs';
10
10
  import * as i3 from '@angular/common';
11
11
  import { Location, ViewportScroller, LOCATION_INITIALIZED, LocationStrategy, HashLocationStrategy, PathLocationStrategy } 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';
12
+ import { map, switchMap, take, startWith, filter, mergeMap, first, concatMap, tap, catchError, scan, defaultIfEmpty, last as last$1, takeLast, mapTo, finalize, refCount, mergeAll } from 'rxjs/operators';
13
13
  import * as i1 from '@angular/platform-browser';
14
14
 
15
15
  /**
@@ -162,7 +162,6 @@ function wrapIntoObservable(value) {
162
162
  return of(value);
163
163
  }
164
164
 
165
- const NG_DEV_MODE$b = typeof ngDevMode === 'undefined' || ngDevMode;
166
165
  const pathCompareMap = {
167
166
  'exact': equalSegmentGroups,
168
167
  'subset': containsSegmentGroup,
@@ -287,7 +286,7 @@ class UrlTree {
287
286
  this.root = root;
288
287
  this.queryParams = queryParams;
289
288
  this.fragment = fragment;
290
- if (NG_DEV_MODE$b) {
289
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
291
290
  if (root.segments.length > 0) {
292
291
  throw new ɵRuntimeError(4015 /* RuntimeErrorCode.INVALID_ROOT_URL_SEGMENT */, 'The root `UrlSegmentGroup` should not contain `segments`. ' +
293
292
  'Instead, these segments belong in the `children` so they can be associated with a named outlet.');
@@ -420,10 +419,10 @@ function mapChildrenIntoArray(segment, fn) {
420
419
  * @publicApi
421
420
  */
422
421
  class UrlSerializer {
422
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
423
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }); }
423
424
  }
424
- UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
425
- UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
426
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: UrlSerializer, decorators: [{
425
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: UrlSerializer, decorators: [{
427
426
  type: Injectable,
428
427
  args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
429
428
  }] });
@@ -635,7 +634,8 @@ class UrlParser {
635
634
  parseSegment() {
636
635
  const path = matchSegments(this.remaining);
637
636
  if (path === '' && this.peekStartsWith(';')) {
638
- throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$b && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
637
+ throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
638
+ `Empty path url segment cannot have parameters: '${this.remaining}'.`);
639
639
  }
640
640
  this.capture(path);
641
641
  return new UrlSegment(decode(path), this.parseMatrixParams());
@@ -704,7 +704,7 @@ class UrlParser {
704
704
  // if is is not one of these characters, then the segment was unescaped
705
705
  // or the group was not closed
706
706
  if (next !== '/' && next !== ')' && next !== ';') {
707
- throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$b && `Cannot parse url '${this.url}'`);
707
+ throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Cannot parse url '${this.url}'`);
708
708
  }
709
709
  let outletName = undefined;
710
710
  if (path.indexOf(':') > -1) {
@@ -735,7 +735,7 @@ class UrlParser {
735
735
  }
736
736
  capture(str) {
737
737
  if (!this.consumeOptional(str)) {
738
- throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$b && `Expected "${str}".`);
738
+ throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Expected "${str}".`);
739
739
  }
740
740
  }
741
741
  }
@@ -745,17 +745,28 @@ function createRoot(rootCandidate) {
745
745
  rootCandidate;
746
746
  }
747
747
  /**
748
- * Recursively merges primary segment children into their parents and also drops empty children
749
- * (those which have no segments and no children themselves). The latter prevents serializing a
750
- * group into something like `/a(aux:)`, where `aux` is an empty child segment.
748
+ * Recursively
749
+ * - merges primary segment children into their parents
750
+ * - drops empty children (those which have no segments and no children themselves). This latter
751
+ * prevents serializing a group into something like `/a(aux:)`, where `aux` is an empty child
752
+ * segment.
753
+ * - merges named outlets without a primary segment sibling into the children. This prevents
754
+ * serializing a URL like `//(a:a)(b:b) instead of `/(a:a//b:b)` when the aux b route lives on the
755
+ * root but the `a` route lives under an empty path primary route.
751
756
  */
752
757
  function squashSegmentGroup(segmentGroup) {
753
758
  const newChildren = {};
754
759
  for (const childOutlet of Object.keys(segmentGroup.children)) {
755
760
  const child = segmentGroup.children[childOutlet];
756
761
  const childCandidate = squashSegmentGroup(child);
757
- // don't add empty children
758
- if (childCandidate.segments.length > 0 || childCandidate.hasChildren()) {
762
+ // moves named children in an empty path primary child into this group
763
+ if (childOutlet === PRIMARY_OUTLET && childCandidate.segments.length === 0 &&
764
+ childCandidate.hasChildren()) {
765
+ for (const [grandChildOutlet, grandChild] of Object.entries(childCandidate.children)) {
766
+ newChildren[grandChildOutlet] = grandChild;
767
+ }
768
+ } // don't add empty children
769
+ else if (childCandidate.segments.length > 0 || childCandidate.hasChildren()) {
759
770
  newChildren[childOutlet] = childCandidate;
760
771
  }
761
772
  }
@@ -781,7 +792,6 @@ function isUrlTree(v) {
781
792
  return v instanceof UrlTree;
782
793
  }
783
794
 
784
- const NG_DEV_MODE$a = typeof ngDevMode === 'undefined' || ngDevMode;
785
795
  /**
786
796
  * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
787
797
  *
@@ -876,28 +886,6 @@ function createUrlTreeFromSegmentGroup(relativeTo, commands, queryParams, fragme
876
886
  updateSegmentGroup(position.segmentGroup, position.index, nav.commands);
877
887
  return tree(root, position.segmentGroup, newSegmentGroup, queryParams, fragment);
878
888
  }
879
- function createUrlTree(route, urlTree, commands, queryParams, fragment) {
880
- if (commands.length === 0) {
881
- return tree(urlTree.root, urlTree.root, urlTree.root, queryParams, fragment);
882
- }
883
- const nav = computeNavigation(commands);
884
- if (nav.toRoot()) {
885
- return tree(urlTree.root, urlTree.root, new UrlSegmentGroup([], {}), queryParams, fragment);
886
- }
887
- function createTreeUsingPathIndex(lastPathIndex) {
888
- const startingPosition = findStartingPosition(nav, urlTree, route.snapshot?._urlSegment, lastPathIndex);
889
- const segmentGroup = startingPosition.processChildren ?
890
- updateSegmentGroupChildren(startingPosition.segmentGroup, startingPosition.index, nav.commands) :
891
- updateSegmentGroup(startingPosition.segmentGroup, startingPosition.index, nav.commands);
892
- return tree(urlTree.root, startingPosition.segmentGroup, segmentGroup, queryParams, fragment);
893
- }
894
- // Note: The types should disallow `snapshot` from being `undefined` but due to test mocks, this
895
- // may be the case. Since we try to access it at an earlier point before the refactor to add the
896
- // warning for `relativeLinkResolution: 'legacy'`, this may cause failures in tests where it
897
- // didn't before.
898
- const result = createTreeUsingPathIndex(route.snapshot?._lastPathIndex);
899
- return result;
900
- }
901
889
  function isMatrixParams(command) {
902
890
  return typeof command === 'object' && command != null && !command.outlets && !command.segmentPath;
903
891
  }
@@ -950,11 +938,13 @@ class Navigation {
950
938
  this.numberOfDoubleDots = numberOfDoubleDots;
951
939
  this.commands = commands;
952
940
  if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
953
- throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$a && 'Root segment cannot have matrix parameters');
941
+ throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
942
+ 'Root segment cannot have matrix parameters');
954
943
  }
955
944
  const cmdWithOutlet = commands.find(isCommandWithOutlets);
956
945
  if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
957
- throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$a && '{outlets:{}} has to be the last command');
946
+ throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
947
+ '{outlets:{}} has to be the last command');
958
948
  }
959
949
  }
960
950
  toRoot() {
@@ -1030,21 +1020,6 @@ function findStartingPositionForTargetGroup(nav, root, target) {
1030
1020
  const index = target.segments.length - 1 + modifier;
1031
1021
  return createPositionApplyingDoubleDots(target, index, nav.numberOfDoubleDots);
1032
1022
  }
1033
- function findStartingPosition(nav, tree, segmentGroup, lastPathIndex) {
1034
- if (nav.isAbsolute) {
1035
- return new Position(tree.root, true, 0);
1036
- }
1037
- if (lastPathIndex === -1) {
1038
- // Pathless ActivatedRoute has _lastPathIndex === -1 but should not process children
1039
- // see issue #26224, #13011, #35687
1040
- // However, if the ActivatedRoute is the root we should process children like above.
1041
- const processChildren = segmentGroup === tree.root;
1042
- return new Position(segmentGroup, processChildren, 0);
1043
- }
1044
- const modifier = isMatrixParams(nav.commands[0]) ? 0 : 1;
1045
- const index = lastPathIndex + modifier;
1046
- return createPositionApplyingDoubleDots(segmentGroup, index, nav.numberOfDoubleDots);
1047
- }
1048
1023
  function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
1049
1024
  let g = group;
1050
1025
  let ci = index;
@@ -1053,7 +1028,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
1053
1028
  dd -= ci;
1054
1029
  g = g.parent;
1055
1030
  if (!g) {
1056
- throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$a && 'Invalid number of \'../\'');
1031
+ throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Invalid number of \'../\'');
1057
1032
  }
1058
1033
  ci = g.segments.length;
1059
1034
  }
@@ -1725,71 +1700,6 @@ function stringifyEvent(routerEvent) {
1725
1700
  }
1726
1701
  }
1727
1702
 
1728
- const NG_DEV_MODE$9 = typeof ngDevMode === 'undefined' || ngDevMode;
1729
- class LegacyCreateUrlTree {
1730
- createUrlTree(relativeTo, currentState, currentUrlTree, commands, queryParams, fragment) {
1731
- const a = relativeTo || currentState.root;
1732
- const tree = createUrlTree(a, currentUrlTree, commands, queryParams, fragment);
1733
- if (NG_DEV_MODE$9) {
1734
- const treeFromSnapshotStrategy = new CreateUrlTreeUsingSnapshot().createUrlTree(relativeTo, currentState, currentUrlTree, commands, queryParams, fragment);
1735
- if (treeFromSnapshotStrategy.toString() !== tree.toString()) {
1736
- let warningString = `The navigation to ${tree.toString()} will instead go to ${treeFromSnapshotStrategy.toString()} in an upcoming version of Angular.`;
1737
- if (!!relativeTo) {
1738
- warningString += ' `relativeTo` might need to be removed from the `UrlCreationOptions`.';
1739
- }
1740
- tree._warnIfUsedForNavigation = warningString;
1741
- }
1742
- }
1743
- return tree;
1744
- }
1745
- }
1746
- LegacyCreateUrlTree.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: LegacyCreateUrlTree, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1747
- LegacyCreateUrlTree.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: LegacyCreateUrlTree });
1748
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: LegacyCreateUrlTree, decorators: [{
1749
- type: Injectable
1750
- }] });
1751
- class CreateUrlTreeUsingSnapshot {
1752
- createUrlTree(relativeTo, currentState, currentUrlTree, commands, queryParams, fragment) {
1753
- let relativeToUrlSegmentGroup;
1754
- try {
1755
- const relativeToSnapshot = relativeTo ? relativeTo.snapshot : currentState.snapshot.root;
1756
- relativeToUrlSegmentGroup = createSegmentGroupFromRoute(relativeToSnapshot);
1757
- }
1758
- catch (e) {
1759
- // This is strictly for backwards compatibility with tests that create
1760
- // invalid `ActivatedRoute` mocks.
1761
- // Note: the difference between having this fallback for invalid `ActivatedRoute` setups and
1762
- // just throwing is ~500 test failures. Fixing all of those tests by hand is not feasible at
1763
- // the moment.
1764
- if (typeof commands[0] !== 'string' || !commands[0].startsWith('/')) {
1765
- // Navigations that were absolute in the old way of creating UrlTrees
1766
- // would still work because they wouldn't attempt to match the
1767
- // segments in the `ActivatedRoute` to the `currentUrlTree` but
1768
- // instead just replace the root segment with the navigation result.
1769
- // Non-absolute navigations would fail to apply the commands because
1770
- // the logic could not find the segment to replace (so they'd act like there were no
1771
- // commands).
1772
- commands = [];
1773
- }
1774
- relativeToUrlSegmentGroup = currentUrlTree.root;
1775
- }
1776
- return createUrlTreeFromSegmentGroup(relativeToUrlSegmentGroup, commands, queryParams, fragment);
1777
- }
1778
- }
1779
- CreateUrlTreeUsingSnapshot.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: CreateUrlTreeUsingSnapshot, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1780
- CreateUrlTreeUsingSnapshot.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: CreateUrlTreeUsingSnapshot });
1781
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: CreateUrlTreeUsingSnapshot, decorators: [{
1782
- type: Injectable
1783
- }] });
1784
- class CreateUrlTreeStrategy {
1785
- }
1786
- CreateUrlTreeStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: CreateUrlTreeStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1787
- CreateUrlTreeStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: CreateUrlTreeStrategy, providedIn: 'root', useClass: CreateUrlTreeUsingSnapshot });
1788
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: CreateUrlTreeStrategy, decorators: [{
1789
- type: Injectable,
1790
- args: [{ providedIn: 'root', useClass: CreateUrlTreeUsingSnapshot }]
1791
- }] });
1792
-
1793
1703
  class Tree {
1794
1704
  constructor(root) {
1795
1705
  this._root = root;
@@ -1937,7 +1847,7 @@ function createEmptyStateSnapshot(urlTree, rootComponent) {
1937
1847
  const emptyData = {};
1938
1848
  const emptyQueryParams = {};
1939
1849
  const fragment = '';
1940
- const activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, urlTree.root, -1, {});
1850
+ const activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, {});
1941
1851
  return new RouterStateSnapshot('', new TreeNode(activated, []));
1942
1852
  }
1943
1853
  /**
@@ -1983,9 +1893,8 @@ class ActivatedRoute {
1983
1893
  this.data = data;
1984
1894
  this.outlet = outlet;
1985
1895
  this.component = component;
1986
- /** An Observable of the resolved route title */
1987
- this.title = this.data?.pipe(map((d) => d[RouteTitleKey])) ?? of(undefined);
1988
1896
  this._futureSnapshot = futureSnapshot;
1897
+ this.title = this.data?.pipe(map((d) => d[RouteTitleKey])) ?? of(undefined);
1989
1898
  }
1990
1899
  /** The configuration used to match this route. */
1991
1900
  get routeConfig() {
@@ -2137,7 +2046,7 @@ class ActivatedRouteSnapshot {
2137
2046
  /** The outlet name of the route */
2138
2047
  outlet,
2139
2048
  /** The component of the route */
2140
- component, routeConfig, urlSegment, lastPathIndex, resolve) {
2049
+ component, routeConfig, resolve) {
2141
2050
  this.url = url;
2142
2051
  this.params = params;
2143
2052
  this.queryParams = queryParams;
@@ -2146,8 +2055,6 @@ class ActivatedRouteSnapshot {
2146
2055
  this.outlet = outlet;
2147
2056
  this.component = component;
2148
2057
  this.routeConfig = routeConfig;
2149
- this._urlSegment = urlSegment;
2150
- this._lastPathIndex = lastPathIndex;
2151
2058
  this._resolve = resolve;
2152
2059
  }
2153
2060
  /** The root of the router state */
@@ -2406,15 +2313,14 @@ class ChildrenOutletContexts {
2406
2313
  getContext(childName) {
2407
2314
  return this.contexts.get(childName) || null;
2408
2315
  }
2316
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2317
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' }); }
2409
2318
  }
2410
- ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2411
- ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2412
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2319
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2413
2320
  type: Injectable,
2414
2321
  args: [{ providedIn: 'root' }]
2415
2322
  }] });
2416
2323
 
2417
- const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
2418
2324
  /**
2419
2325
  * @description
2420
2326
  *
@@ -2553,12 +2459,12 @@ class RouterOutlet {
2553
2459
  */
2554
2460
  get component() {
2555
2461
  if (!this.activated)
2556
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$8 && 'Outlet is not activated');
2462
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Outlet is not activated');
2557
2463
  return this.activated.instance;
2558
2464
  }
2559
2465
  get activatedRoute() {
2560
2466
  if (!this.activated)
2561
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$8 && 'Outlet is not activated');
2467
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Outlet is not activated');
2562
2468
  return this._activatedRoute;
2563
2469
  }
2564
2470
  get activatedRouteData() {
@@ -2572,7 +2478,7 @@ class RouterOutlet {
2572
2478
  */
2573
2479
  detach() {
2574
2480
  if (!this.activated)
2575
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$8 && 'Outlet is not activated');
2481
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Outlet is not activated');
2576
2482
  this.location.detach();
2577
2483
  const cmp = this.activated;
2578
2484
  this.activated = null;
@@ -2600,7 +2506,8 @@ class RouterOutlet {
2600
2506
  }
2601
2507
  activateWith(activatedRoute, environmentInjector) {
2602
2508
  if (this.isActivated) {
2603
- throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$8 && 'Cannot activate an already activated outlet');
2509
+ throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
2510
+ 'Cannot activate an already activated outlet');
2604
2511
  }
2605
2512
  this._activatedRoute = activatedRoute;
2606
2513
  const location = this.location;
@@ -2618,10 +2525,10 @@ class RouterOutlet {
2618
2525
  this.changeDetector.markForCheck();
2619
2526
  this.activateEvents.emit(this.activated.instance);
2620
2527
  }
2528
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2529
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.5", 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 }); }
2621
2530
  }
2622
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2623
- RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.3", 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 });
2624
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterOutlet, decorators: [{
2531
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterOutlet, decorators: [{
2625
2532
  type: Directive,
2626
2533
  args: [{
2627
2534
  selector: 'router-outlet',
@@ -2670,10 +2577,10 @@ class OutletInjector {
2670
2577
  * to this `EmptyOutletComponent`.
2671
2578
  */
2672
2579
  class ɵEmptyOutletComponent {
2580
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2581
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0-next.5", 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"] }] }); }
2673
2582
  }
2674
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2675
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0-next.3", 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"] }] });
2676
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2583
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2677
2584
  type: Component,
2678
2585
  args: [{
2679
2586
  template: `<router-outlet></router-outlet>`,
@@ -2958,13 +2865,16 @@ class ActivateRoutes {
2958
2865
  for (const childOutlet of Object.keys(children)) {
2959
2866
  this.deactivateRouteAndItsChildren(children[childOutlet], contexts);
2960
2867
  }
2961
- if (context && context.outlet) {
2962
- // Destroy the component
2963
- context.outlet.deactivate();
2964
- // Destroy the contexts for all the outlets that were in the component
2965
- context.children.onOutletDeactivated();
2868
+ if (context) {
2869
+ if (context.outlet) {
2870
+ // Destroy the component
2871
+ context.outlet.deactivate();
2872
+ // Destroy the contexts for all the outlets that were in the component
2873
+ context.children.onOutletDeactivated();
2874
+ }
2966
2875
  // Clear the information about the attached component on the context but keep the reference to
2967
- // the outlet.
2876
+ // the outlet. Clear even if outlet was not yet activated to avoid activating later with old
2877
+ // info
2968
2878
  context.attachRef = null;
2969
2879
  context.route = null;
2970
2880
  }
@@ -3391,7 +3301,107 @@ function runCanMatchGuards(injector, route, segments, urlSerializer) {
3391
3301
  .pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));
3392
3302
  }
3393
3303
 
3394
- const noMatch$1 = {
3304
+ class NoMatch {
3305
+ constructor(segmentGroup) {
3306
+ this.segmentGroup = segmentGroup || null;
3307
+ }
3308
+ }
3309
+ class AbsoluteRedirect {
3310
+ constructor(urlTree) {
3311
+ this.urlTree = urlTree;
3312
+ }
3313
+ }
3314
+ function noMatch$1(segmentGroup) {
3315
+ return throwError(new NoMatch(segmentGroup));
3316
+ }
3317
+ function absoluteRedirect(newTree) {
3318
+ return throwError(new AbsoluteRedirect(newTree));
3319
+ }
3320
+ function namedOutletsRedirect(redirectTo) {
3321
+ return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
3322
+ `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3323
+ }
3324
+ function canLoadFails(route) {
3325
+ return throwError(navigationCancelingError((typeof ngDevMode === 'undefined' || ngDevMode) &&
3326
+ `Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
3327
+ }
3328
+ class ApplyRedirects {
3329
+ constructor(urlSerializer, urlTree) {
3330
+ this.urlSerializer = urlSerializer;
3331
+ this.urlTree = urlTree;
3332
+ }
3333
+ noMatchError(e) {
3334
+ return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
3335
+ `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3336
+ }
3337
+ lineralizeSegments(route, urlTree) {
3338
+ let res = [];
3339
+ let c = urlTree.root;
3340
+ while (true) {
3341
+ res = res.concat(c.segments);
3342
+ if (c.numberOfChildren === 0) {
3343
+ return of(res);
3344
+ }
3345
+ if (c.numberOfChildren > 1 || !c.children[PRIMARY_OUTLET]) {
3346
+ return namedOutletsRedirect(route.redirectTo);
3347
+ }
3348
+ c = c.children[PRIMARY_OUTLET];
3349
+ }
3350
+ }
3351
+ applyRedirectCommands(segments, redirectTo, posParams) {
3352
+ return this.applyRedirectCreateUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams);
3353
+ }
3354
+ applyRedirectCreateUrlTree(redirectTo, urlTree, segments, posParams) {
3355
+ const newRoot = this.createSegmentGroup(redirectTo, urlTree.root, segments, posParams);
3356
+ return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment);
3357
+ }
3358
+ createQueryParams(redirectToParams, actualParams) {
3359
+ const res = {};
3360
+ Object.entries(redirectToParams).forEach(([k, v]) => {
3361
+ const copySourceValue = typeof v === 'string' && v.startsWith(':');
3362
+ if (copySourceValue) {
3363
+ const sourceName = v.substring(1);
3364
+ res[k] = actualParams[sourceName];
3365
+ }
3366
+ else {
3367
+ res[k] = v;
3368
+ }
3369
+ });
3370
+ return res;
3371
+ }
3372
+ createSegmentGroup(redirectTo, group, segments, posParams) {
3373
+ const updatedSegments = this.createSegments(redirectTo, group.segments, segments, posParams);
3374
+ let children = {};
3375
+ Object.entries(group.children).forEach(([name, child]) => {
3376
+ children[name] = this.createSegmentGroup(redirectTo, child, segments, posParams);
3377
+ });
3378
+ return new UrlSegmentGroup(updatedSegments, children);
3379
+ }
3380
+ createSegments(redirectTo, redirectToSegments, actualSegments, posParams) {
3381
+ return redirectToSegments.map(s => s.path.startsWith(':') ? this.findPosParam(redirectTo, s, posParams) :
3382
+ this.findOrReturn(s, actualSegments));
3383
+ }
3384
+ findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3385
+ const pos = posParams[redirectToUrlSegment.path.substring(1)];
3386
+ if (!pos)
3387
+ throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
3388
+ `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3389
+ return pos;
3390
+ }
3391
+ findOrReturn(redirectToUrlSegment, actualSegments) {
3392
+ let idx = 0;
3393
+ for (const s of actualSegments) {
3394
+ if (s.path === redirectToUrlSegment.path) {
3395
+ actualSegments.splice(idx);
3396
+ return s;
3397
+ }
3398
+ idx++;
3399
+ }
3400
+ return redirectToUrlSegment;
3401
+ }
3402
+ }
3403
+
3404
+ const noMatch = {
3395
3405
  matched: false,
3396
3406
  consumedSegments: [],
3397
3407
  remainingSegments: [],
@@ -3407,12 +3417,12 @@ function matchWithChecks(segmentGroup, route, segments, injector, urlSerializer)
3407
3417
  // navigation
3408
3418
  injector = getOrCreateRouteInjectorIfNeeded(route, injector);
3409
3419
  return runCanMatchGuards(injector, route, segments, urlSerializer)
3410
- .pipe(map((v) => v === true ? result : { ...noMatch$1 }));
3420
+ .pipe(map((v) => v === true ? result : { ...noMatch }));
3411
3421
  }
3412
3422
  function match(segmentGroup, route, segments) {
3413
3423
  if (route.path === '') {
3414
3424
  if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || segments.length > 0)) {
3415
- return { ...noMatch$1 };
3425
+ return { ...noMatch };
3416
3426
  }
3417
3427
  return {
3418
3428
  matched: true,
@@ -3425,7 +3435,7 @@ function match(segmentGroup, route, segments) {
3425
3435
  const matcher = route.matcher || defaultUrlMatcher;
3426
3436
  const res = matcher(segments, segmentGroup, route);
3427
3437
  if (!res)
3428
- return { ...noMatch$1 };
3438
+ return { ...noMatch };
3429
3439
  const posParams = {};
3430
3440
  Object.entries(res.posParams ?? {}).forEach(([k, v]) => {
3431
3441
  posParams[k] = v.path;
@@ -3445,21 +3455,15 @@ function match(segmentGroup, route, segments) {
3445
3455
  function split(segmentGroup, consumedSegments, slicedSegments, config) {
3446
3456
  if (slicedSegments.length > 0 &&
3447
3457
  containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, config)) {
3448
- const s = new UrlSegmentGroup(consumedSegments, createChildrenForEmptyPaths(segmentGroup, consumedSegments, config, new UrlSegmentGroup(slicedSegments, segmentGroup.children)));
3449
- s._sourceSegment = segmentGroup;
3450
- s._segmentIndexShift = consumedSegments.length;
3458
+ const s = new UrlSegmentGroup(consumedSegments, createChildrenForEmptyPaths(config, new UrlSegmentGroup(slicedSegments, segmentGroup.children)));
3451
3459
  return { segmentGroup: s, slicedSegments: [] };
3452
3460
  }
3453
3461
  if (slicedSegments.length === 0 &&
3454
3462
  containsEmptyPathMatches(segmentGroup, slicedSegments, config)) {
3455
3463
  const s = new UrlSegmentGroup(segmentGroup.segments, addEmptyPathsToChildrenIfNeeded(segmentGroup, consumedSegments, slicedSegments, config, segmentGroup.children));
3456
- s._sourceSegment = segmentGroup;
3457
- s._segmentIndexShift = consumedSegments.length;
3458
3464
  return { segmentGroup: s, slicedSegments };
3459
3465
  }
3460
3466
  const s = new UrlSegmentGroup(segmentGroup.segments, segmentGroup.children);
3461
- s._sourceSegment = segmentGroup;
3462
- s._segmentIndexShift = consumedSegments.length;
3463
3467
  return { segmentGroup: s, slicedSegments };
3464
3468
  }
3465
3469
  function addEmptyPathsToChildrenIfNeeded(segmentGroup, consumedSegments, slicedSegments, routes, children) {
@@ -3467,23 +3471,17 @@ function addEmptyPathsToChildrenIfNeeded(segmentGroup, consumedSegments, slicedS
3467
3471
  for (const r of routes) {
3468
3472
  if (emptyPathMatch(segmentGroup, slicedSegments, r) && !children[getOutlet(r)]) {
3469
3473
  const s = new UrlSegmentGroup([], {});
3470
- s._sourceSegment = segmentGroup;
3471
- s._segmentIndexShift = consumedSegments.length;
3472
3474
  res[getOutlet(r)] = s;
3473
3475
  }
3474
3476
  }
3475
3477
  return { ...children, ...res };
3476
3478
  }
3477
- function createChildrenForEmptyPaths(segmentGroup, consumedSegments, routes, primarySegment) {
3479
+ function createChildrenForEmptyPaths(routes, primarySegment) {
3478
3480
  const res = {};
3479
3481
  res[PRIMARY_OUTLET] = primarySegment;
3480
- primarySegment._sourceSegment = segmentGroup;
3481
- primarySegment._segmentIndexShift = consumedSegments.length;
3482
3482
  for (const r of routes) {
3483
3483
  if (r.path === '' && getOutlet(r) !== PRIMARY_OUTLET) {
3484
3484
  const s = new UrlSegmentGroup([], {});
3485
- s._sourceSegment = segmentGroup;
3486
- s._segmentIndexShift = consumedSegments.length;
3487
3485
  res[getOutlet(r)] = s;
3488
3486
  }
3489
3487
  }
@@ -3531,103 +3529,88 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
3531
3529
  return segments.length === 0 && !segmentGroup.children[outlet];
3532
3530
  }
3533
3531
 
3534
- const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
3535
- class NoMatch$1 {
3536
- constructor(segmentGroup) {
3537
- this.segmentGroup = segmentGroup || null;
3538
- }
3539
- }
3540
- class AbsoluteRedirect {
3541
- constructor(urlTree) {
3542
- this.urlTree = urlTree;
3543
- }
3544
- }
3545
- function noMatch(segmentGroup) {
3546
- return throwError(new NoMatch$1(segmentGroup));
3547
- }
3548
- function absoluteRedirect(newTree) {
3549
- return throwError(new AbsoluteRedirect(newTree));
3550
- }
3551
- function namedOutletsRedirect(redirectTo) {
3552
- return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$7 &&
3553
- `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3532
+ function recognize$1(injector, configLoader, rootComponentType, config, urlTree, urlSerializer, paramsInheritanceStrategy = 'emptyOnly') {
3533
+ return new Recognizer(injector, configLoader, rootComponentType, config, urlTree, paramsInheritanceStrategy, urlSerializer)
3534
+ .recognize();
3554
3535
  }
3555
- function canLoadFails(route) {
3556
- return throwError(navigationCancelingError(NG_DEV_MODE$7 &&
3557
- `Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
3558
- }
3559
- /**
3560
- * Returns the `UrlTree` with the redirection applied.
3561
- *
3562
- * Lazy modules are loaded along the way.
3563
- */
3564
- function applyRedirects$1(injector, configLoader, urlSerializer, urlTree, config) {
3565
- return new ApplyRedirects(injector, configLoader, urlSerializer, urlTree, config).apply();
3566
- }
3567
- class ApplyRedirects {
3568
- constructor(injector, configLoader, urlSerializer, urlTree, config) {
3536
+ class Recognizer {
3537
+ constructor(injector, configLoader, rootComponentType, config, urlTree, paramsInheritanceStrategy, urlSerializer) {
3569
3538
  this.injector = injector;
3570
3539
  this.configLoader = configLoader;
3571
- this.urlSerializer = urlSerializer;
3572
- this.urlTree = urlTree;
3540
+ this.rootComponentType = rootComponentType;
3573
3541
  this.config = config;
3542
+ this.urlTree = urlTree;
3543
+ this.paramsInheritanceStrategy = paramsInheritanceStrategy;
3544
+ this.urlSerializer = urlSerializer;
3574
3545
  this.allowRedirects = true;
3546
+ this.applyRedirects = new ApplyRedirects(this.urlSerializer, this.urlTree);
3575
3547
  }
3576
- apply() {
3577
- const splitGroup = split(this.urlTree.root, [], [], this.config).segmentGroup;
3578
- // TODO(atscott): creating a new segment removes the _sourceSegment _segmentIndexShift, which is
3579
- // only necessary to prevent failures in tests which assert exact object matches. The `split` is
3580
- // now shared between `applyRedirects` and `recognize` but only the `recognize` step needs these
3581
- // properties. Before the implementations were merged, the `applyRedirects` would not assign
3582
- // them. We should be able to remove this logic as a "breaking change" but should do some more
3583
- // investigation into the failures first.
3584
- const rootSegmentGroup = new UrlSegmentGroup(splitGroup.segments, splitGroup.children);
3585
- const expanded$ = this.expandSegmentGroup(this.injector, this.config, rootSegmentGroup, PRIMARY_OUTLET);
3586
- const urlTrees$ = expanded$.pipe(map((rootSegmentGroup) => {
3587
- return this.createUrlTree(squashSegmentGroup(rootSegmentGroup), this.urlTree.queryParams, this.urlTree.fragment);
3588
- }));
3589
- return urlTrees$.pipe(catchError((e) => {
3548
+ noMatchError(e) {
3549
+ return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
3550
+ `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3551
+ }
3552
+ recognize() {
3553
+ const rootSegmentGroup = split(this.urlTree.root, [], [], this.config).segmentGroup;
3554
+ return this.processSegmentGroup(this.injector, this.config, rootSegmentGroup, PRIMARY_OUTLET)
3555
+ .pipe(catchError((e) => {
3590
3556
  if (e instanceof AbsoluteRedirect) {
3591
3557
  // After an absolute redirect we do not apply any more redirects!
3592
3558
  // If this implementation changes, update the documentation note in `redirectTo`.
3593
3559
  this.allowRedirects = false;
3594
- // we need to run matching, so we can fetch all lazy-loaded modules
3560
+ this.urlTree = e.urlTree;
3595
3561
  return this.match(e.urlTree);
3596
3562
  }
3597
- if (e instanceof NoMatch$1) {
3563
+ if (e instanceof NoMatch) {
3598
3564
  throw this.noMatchError(e);
3599
3565
  }
3600
3566
  throw e;
3567
+ }), map(children => {
3568
+ // Use Object.freeze to prevent readers of the Router state from modifying it outside
3569
+ // of a navigation, resulting in the router being out of sync with the browser.
3570
+ const root = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, {}, PRIMARY_OUTLET, this.rootComponentType, null, {});
3571
+ const rootNode = new TreeNode(root, children);
3572
+ const routeState = new RouterStateSnapshot('', rootNode);
3573
+ const tree = createUrlTreeFromSnapshot(root, [], this.urlTree.queryParams, this.urlTree.fragment);
3574
+ // https://github.com/angular/angular/issues/47307
3575
+ // Creating the tree stringifies the query params
3576
+ // We don't want to do this here so reassign them to the original.
3577
+ tree.queryParams = this.urlTree.queryParams;
3578
+ routeState.url = this.urlSerializer.serialize(tree);
3579
+ this.inheritParamsAndData(routeState._root);
3580
+ return { state: routeState, tree };
3601
3581
  }));
3602
3582
  }
3603
3583
  match(tree) {
3604
- const expanded$ = this.expandSegmentGroup(this.injector, this.config, tree.root, PRIMARY_OUTLET);
3605
- const mapped$ = expanded$.pipe(map((rootSegmentGroup) => {
3606
- return this.createUrlTree(squashSegmentGroup(rootSegmentGroup), tree.queryParams, tree.fragment);
3607
- }));
3608
- return mapped$.pipe(catchError((e) => {
3609
- if (e instanceof NoMatch$1) {
3584
+ const expanded$ = this.processSegmentGroup(this.injector, this.config, tree.root, PRIMARY_OUTLET);
3585
+ return expanded$.pipe(catchError((e) => {
3586
+ if (e instanceof NoMatch) {
3610
3587
  throw this.noMatchError(e);
3611
3588
  }
3612
3589
  throw e;
3613
3590
  }));
3614
3591
  }
3615
- noMatchError(e) {
3616
- return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$7 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3617
- }
3618
- createUrlTree(rootCandidate, queryParams, fragment) {
3619
- const root = createRoot(rootCandidate);
3620
- return new UrlTree(root, queryParams, fragment);
3592
+ inheritParamsAndData(routeNode) {
3593
+ const route = routeNode.value;
3594
+ const i = inheritedParamsDataResolve(route, this.paramsInheritanceStrategy);
3595
+ route.params = Object.freeze(i.params);
3596
+ route.data = Object.freeze(i.data);
3597
+ routeNode.children.forEach(n => this.inheritParamsAndData(n));
3621
3598
  }
3622
- expandSegmentGroup(injector, routes, segmentGroup, outlet) {
3599
+ processSegmentGroup(injector, config, segmentGroup, outlet) {
3623
3600
  if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {
3624
- return this.expandChildren(injector, routes, segmentGroup)
3625
- .pipe(map((children) => new UrlSegmentGroup([], children)));
3601
+ return this.processChildren(injector, config, segmentGroup);
3626
3602
  }
3627
- return this.expandSegment(injector, segmentGroup, routes, segmentGroup.segments, outlet, true);
3603
+ return this.processSegment(injector, config, segmentGroup, segmentGroup.segments, outlet, true);
3628
3604
  }
3629
- // Recursively expand segment groups for all the child outlets
3630
- expandChildren(injector, routes, segmentGroup) {
3605
+ /**
3606
+ * Matches every child outlet in the `segmentGroup` to a `Route` in the config. Returns `null` if
3607
+ * we cannot find a match for _any_ of the children.
3608
+ *
3609
+ * @param config - The `Routes` to match against
3610
+ * @param segmentGroup - The `UrlSegmentGroup` whose children need to be matched against the
3611
+ * config.
3612
+ */
3613
+ processChildren(injector, config, segmentGroup) {
3631
3614
  // Expand outlets one at a time, starting with the primary outlet. We need to do it this way
3632
3615
  // because an absolute redirect from the primary outlet takes precedence.
3633
3616
  const childOutlets = [];
@@ -3642,47 +3625,60 @@ class ApplyRedirects {
3642
3625
  return from(childOutlets)
3643
3626
  .pipe(concatMap(childOutlet => {
3644
3627
  const child = segmentGroup.children[childOutlet];
3645
- // Sort the routes so routes with outlets that match the segment appear
3646
- // first, followed by routes for other outlets, which might match if they have an
3647
- // empty path.
3648
- const sortedRoutes = sortByMatchingOutlets(routes, childOutlet);
3649
- return this.expandSegmentGroup(injector, sortedRoutes, child, childOutlet)
3650
- .pipe(map(s => ({ segment: s, outlet: childOutlet })));
3651
- }), scan((children, expandedChild) => {
3652
- children[expandedChild.outlet] = expandedChild.segment;
3628
+ // Sort the config so that routes with outlets that match the one being activated
3629
+ // appear first, followed by routes for other outlets, which might match if they have
3630
+ // an empty path.
3631
+ const sortedConfig = sortByMatchingOutlets(config, childOutlet);
3632
+ return this.processSegmentGroup(injector, sortedConfig, child, childOutlet);
3633
+ }), scan((children, outletChildren) => {
3634
+ children.push(...outletChildren);
3653
3635
  return children;
3654
- }, {}), last$1());
3636
+ }), defaultIfEmpty(null), last$1(), mergeMap(children => {
3637
+ if (children === null)
3638
+ return noMatch$1(segmentGroup);
3639
+ // Because we may have matched two outlets to the same empty path segment, we can have
3640
+ // multiple activated results for the same outlet. We should merge the children of
3641
+ // these results so the final return value is only one `TreeNode` per outlet.
3642
+ const mergedChildren = mergeEmptyPathMatches(children);
3643
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
3644
+ // This should really never happen - we are only taking the first match for each
3645
+ // outlet and merge the empty path matches.
3646
+ checkOutletNameUniqueness(mergedChildren);
3647
+ }
3648
+ sortActivatedRouteSnapshots(mergedChildren);
3649
+ return of(mergedChildren);
3650
+ }));
3655
3651
  }
3656
- expandSegment(injector, segmentGroup, routes, segments, outlet, allowRedirects) {
3652
+ processSegment(injector, routes, segmentGroup, segments, outlet, allowRedirects) {
3657
3653
  return from(routes).pipe(concatMap(r => {
3658
- const expanded$ = this.expandSegmentAgainstRoute(injector, segmentGroup, routes, r, segments, outlet, allowRedirects);
3659
- return expanded$.pipe(catchError((e) => {
3660
- if (e instanceof NoMatch$1) {
3654
+ return this
3655
+ .processSegmentAgainstRoute(r._injector ?? injector, routes, r, segmentGroup, segments, outlet, allowRedirects)
3656
+ .pipe(catchError((e) => {
3657
+ if (e instanceof NoMatch) {
3661
3658
  return of(null);
3662
3659
  }
3663
3660
  throw e;
3664
3661
  }));
3665
- }), first((s) => !!s), catchError((e, _) => {
3662
+ }), first((x) => !!x), catchError(e => {
3666
3663
  if (isEmptyError(e)) {
3667
3664
  if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
3668
- return of(new UrlSegmentGroup([], {}));
3665
+ return of([]);
3669
3666
  }
3670
- return noMatch(segmentGroup);
3667
+ return noMatch$1(segmentGroup);
3671
3668
  }
3672
3669
  throw e;
3673
3670
  }));
3674
3671
  }
3675
- expandSegmentAgainstRoute(injector, segmentGroup, routes, route, paths, outlet, allowRedirects) {
3676
- if (!isImmediateMatch(route, segmentGroup, paths, outlet)) {
3677
- return noMatch(segmentGroup);
3678
- }
3672
+ processSegmentAgainstRoute(injector, routes, route, rawSegment, segments, outlet, allowRedirects) {
3673
+ if (!isImmediateMatch(route, rawSegment, segments, outlet))
3674
+ return noMatch$1(rawSegment);
3679
3675
  if (route.redirectTo === undefined) {
3680
- return this.matchSegmentAgainstRoute(injector, segmentGroup, route, paths, outlet);
3676
+ return this.matchSegmentAgainstRoute(injector, rawSegment, route, segments, outlet, allowRedirects);
3681
3677
  }
3682
3678
  if (allowRedirects && this.allowRedirects) {
3683
- return this.expandSegmentAgainstRouteUsingRedirect(injector, segmentGroup, routes, route, paths, outlet);
3679
+ return this.expandSegmentAgainstRouteUsingRedirect(injector, rawSegment, routes, route, segments, outlet);
3684
3680
  }
3685
- return noMatch(segmentGroup);
3681
+ return noMatch$1(rawSegment);
3686
3682
  }
3687
3683
  expandSegmentAgainstRouteUsingRedirect(injector, segmentGroup, routes, route, segments, outlet) {
3688
3684
  if (route.path === '**') {
@@ -3691,66 +3687,93 @@ class ApplyRedirects {
3691
3687
  return this.expandRegularSegmentAgainstRouteUsingRedirect(injector, segmentGroup, routes, route, segments, outlet);
3692
3688
  }
3693
3689
  expandWildCardWithParamsAgainstRouteUsingRedirect(injector, routes, route, outlet) {
3694
- const newTree = this.applyRedirectCommands([], route.redirectTo, {});
3690
+ const newTree = this.applyRedirects.applyRedirectCommands([], route.redirectTo, {});
3695
3691
  if (route.redirectTo.startsWith('/')) {
3696
3692
  return absoluteRedirect(newTree);
3697
3693
  }
3698
- return this.lineralizeSegments(route, newTree).pipe(mergeMap((newSegments) => {
3694
+ return this.applyRedirects.lineralizeSegments(route, newTree)
3695
+ .pipe(mergeMap((newSegments) => {
3699
3696
  const group = new UrlSegmentGroup(newSegments, {});
3700
- return this.expandSegment(injector, group, routes, newSegments, outlet, false);
3697
+ return this.processSegment(injector, routes, group, newSegments, outlet, false);
3701
3698
  }));
3702
3699
  }
3703
3700
  expandRegularSegmentAgainstRouteUsingRedirect(injector, segmentGroup, routes, route, segments, outlet) {
3704
3701
  const { matched, consumedSegments, remainingSegments, positionalParamSegments } = match(segmentGroup, route, segments);
3705
3702
  if (!matched)
3706
- return noMatch(segmentGroup);
3707
- const newTree = this.applyRedirectCommands(consumedSegments, route.redirectTo, positionalParamSegments);
3703
+ return noMatch$1(segmentGroup);
3704
+ const newTree = this.applyRedirects.applyRedirectCommands(consumedSegments, route.redirectTo, positionalParamSegments);
3708
3705
  if (route.redirectTo.startsWith('/')) {
3709
3706
  return absoluteRedirect(newTree);
3710
3707
  }
3711
- return this.lineralizeSegments(route, newTree).pipe(mergeMap((newSegments) => {
3712
- return this.expandSegment(injector, segmentGroup, routes, newSegments.concat(remainingSegments), outlet, false);
3708
+ return this.applyRedirects.lineralizeSegments(route, newTree)
3709
+ .pipe(mergeMap((newSegments) => {
3710
+ return this.processSegment(injector, routes, segmentGroup, newSegments.concat(remainingSegments), outlet, false);
3713
3711
  }));
3714
3712
  }
3715
- matchSegmentAgainstRoute(injector, rawSegmentGroup, route, segments, outlet) {
3713
+ matchSegmentAgainstRoute(injector, rawSegment, route, segments, outlet, allowRedirects) {
3714
+ let matchResult;
3716
3715
  if (route.path === '**') {
3717
- // Only create the Route's `EnvironmentInjector` if it matches the attempted navigation
3718
- injector = getOrCreateRouteInjectorIfNeeded(route, injector);
3719
- if (route.loadChildren) {
3720
- const loaded$ = route._loadedRoutes ?
3721
- of({ routes: route._loadedRoutes, injector: route._loadedInjector }) :
3722
- this.configLoader.loadChildren(injector, route);
3723
- return loaded$.pipe(map((cfg) => {
3724
- route._loadedRoutes = cfg.routes;
3725
- route._loadedInjector = cfg.injector;
3726
- return new UrlSegmentGroup(segments, {});
3716
+ const params = segments.length > 0 ? last(segments).parameters : {};
3717
+ const snapshot = new ActivatedRouteSnapshot(segments, params, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));
3718
+ matchResult = of({
3719
+ snapshot,
3720
+ consumedSegments: [],
3721
+ remainingSegments: [],
3722
+ });
3723
+ // Prior versions of the route matching algorithm would stop matching at the wildcard route.
3724
+ // We should investigate a better strategy for any existing children. Otherwise, these
3725
+ // child segments are silently dropped from the navigation.
3726
+ // https://github.com/angular/angular/issues/40089
3727
+ rawSegment.children = {};
3728
+ }
3729
+ else {
3730
+ matchResult =
3731
+ matchWithChecks(rawSegment, route, segments, injector, this.urlSerializer)
3732
+ .pipe(map(({ matched, consumedSegments, remainingSegments, parameters }) => {
3733
+ if (!matched) {
3734
+ return null;
3735
+ }
3736
+ const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));
3737
+ return { snapshot, consumedSegments, remainingSegments };
3727
3738
  }));
3728
- }
3729
- return of(new UrlSegmentGroup(segments, {}));
3730
3739
  }
3731
- return matchWithChecks(rawSegmentGroup, route, segments, injector, this.urlSerializer)
3732
- .pipe(switchMap(({ matched, consumedSegments, remainingSegments }) => {
3733
- if (!matched)
3734
- return noMatch(rawSegmentGroup);
3740
+ return matchResult.pipe(switchMap((result) => {
3741
+ if (result === null) {
3742
+ return noMatch$1(rawSegment);
3743
+ }
3735
3744
  // If the route has an injector created from providers, we should start using that.
3736
3745
  injector = route._injector ?? injector;
3737
- const childConfig$ = this.getChildConfig(injector, route, segments);
3738
- return childConfig$.pipe(mergeMap((routerConfig) => {
3739
- const childInjector = routerConfig.injector ?? injector;
3740
- const childConfig = routerConfig.routes;
3741
- const { segmentGroup: splitSegmentGroup, slicedSegments } = split(rawSegmentGroup, consumedSegments, remainingSegments, childConfig);
3742
- // See comment on the other call to `split` about why this is necessary.
3743
- const segmentGroup = new UrlSegmentGroup(splitSegmentGroup.segments, splitSegmentGroup.children);
3746
+ return this.getChildConfig(injector, route, segments)
3747
+ .pipe(switchMap(({ routes: childConfig }) => {
3748
+ const childInjector = route._loadedInjector ?? injector;
3749
+ const { snapshot, consumedSegments, remainingSegments } = result;
3750
+ const { segmentGroup, slicedSegments } = split(rawSegment, consumedSegments, remainingSegments, childConfig);
3744
3751
  if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {
3745
- const expanded$ = this.expandChildren(childInjector, childConfig, segmentGroup);
3746
- return expanded$.pipe(map((children) => new UrlSegmentGroup(consumedSegments, children)));
3752
+ return this.processChildren(childInjector, childConfig, segmentGroup)
3753
+ .pipe(map(children => {
3754
+ if (children === null) {
3755
+ return null;
3756
+ }
3757
+ return [new TreeNode(snapshot, children)];
3758
+ }));
3747
3759
  }
3748
3760
  if (childConfig.length === 0 && slicedSegments.length === 0) {
3749
- return of(new UrlSegmentGroup(consumedSegments, {}));
3761
+ return of([new TreeNode(snapshot, [])]);
3750
3762
  }
3751
3763
  const matchedOnOutlet = getOutlet(route) === outlet;
3752
- const expanded$ = this.expandSegment(childInjector, segmentGroup, childConfig, slicedSegments, matchedOnOutlet ? PRIMARY_OUTLET : outlet, true);
3753
- return expanded$.pipe(map((cs) => new UrlSegmentGroup(consumedSegments.concat(cs.segments), cs.children)));
3764
+ // If we matched a config due to empty path match on a different outlet, we need to
3765
+ // continue passing the current outlet for the segment rather than switch to PRIMARY.
3766
+ // Note that we switch to primary when we have a match because outlet configs look like
3767
+ // this: {path: 'a', outlet: 'a', children: [
3768
+ // {path: 'b', component: B},
3769
+ // {path: 'c', component: C},
3770
+ // ]}
3771
+ // Notice that the children of the named outlet are configured with the primary outlet
3772
+ return this
3773
+ .processSegment(childInjector, childConfig, segmentGroup, slicedSegments, matchedOnOutlet ? PRIMARY_OUTLET : outlet, true)
3774
+ .pipe(map(children => {
3775
+ return [new TreeNode(snapshot, children)];
3776
+ }));
3754
3777
  }));
3755
3778
  }));
3756
3779
  }
@@ -3778,258 +3801,6 @@ class ApplyRedirects {
3778
3801
  }
3779
3802
  return of({ routes: [], injector });
3780
3803
  }
3781
- lineralizeSegments(route, urlTree) {
3782
- let res = [];
3783
- let c = urlTree.root;
3784
- while (true) {
3785
- res = res.concat(c.segments);
3786
- if (c.numberOfChildren === 0) {
3787
- return of(res);
3788
- }
3789
- if (c.numberOfChildren > 1 || !c.children[PRIMARY_OUTLET]) {
3790
- return namedOutletsRedirect(route.redirectTo);
3791
- }
3792
- c = c.children[PRIMARY_OUTLET];
3793
- }
3794
- }
3795
- applyRedirectCommands(segments, redirectTo, posParams) {
3796
- return this.applyRedirectCreateUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams);
3797
- }
3798
- applyRedirectCreateUrlTree(redirectTo, urlTree, segments, posParams) {
3799
- const newRoot = this.createSegmentGroup(redirectTo, urlTree.root, segments, posParams);
3800
- return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment);
3801
- }
3802
- createQueryParams(redirectToParams, actualParams) {
3803
- const res = {};
3804
- Object.entries(redirectToParams).forEach(([k, v]) => {
3805
- const copySourceValue = typeof v === 'string' && v.startsWith(':');
3806
- if (copySourceValue) {
3807
- const sourceName = v.substring(1);
3808
- res[k] = actualParams[sourceName];
3809
- }
3810
- else {
3811
- res[k] = v;
3812
- }
3813
- });
3814
- return res;
3815
- }
3816
- createSegmentGroup(redirectTo, group, segments, posParams) {
3817
- const updatedSegments = this.createSegments(redirectTo, group.segments, segments, posParams);
3818
- let children = {};
3819
- Object.entries(group.children).forEach(([name, child]) => {
3820
- children[name] = this.createSegmentGroup(redirectTo, child, segments, posParams);
3821
- });
3822
- return new UrlSegmentGroup(updatedSegments, children);
3823
- }
3824
- createSegments(redirectTo, redirectToSegments, actualSegments, posParams) {
3825
- return redirectToSegments.map(s => s.path.startsWith(':') ? this.findPosParam(redirectTo, s, posParams) :
3826
- this.findOrReturn(s, actualSegments));
3827
- }
3828
- findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3829
- const pos = posParams[redirectToUrlSegment.path.substring(1)];
3830
- if (!pos)
3831
- throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$7 &&
3832
- `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3833
- return pos;
3834
- }
3835
- findOrReturn(redirectToUrlSegment, actualSegments) {
3836
- let idx = 0;
3837
- for (const s of actualSegments) {
3838
- if (s.path === redirectToUrlSegment.path) {
3839
- actualSegments.splice(idx);
3840
- return s;
3841
- }
3842
- idx++;
3843
- }
3844
- return redirectToUrlSegment;
3845
- }
3846
- }
3847
-
3848
- function applyRedirects(environmentInjector, configLoader, urlSerializer, config) {
3849
- return switchMap(t => applyRedirects$1(environmentInjector, configLoader, urlSerializer, t.extractedUrl, config)
3850
- .pipe(map(urlAfterRedirects => ({ ...t, urlAfterRedirects }))));
3851
- }
3852
-
3853
- const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3854
- class NoMatch {
3855
- }
3856
- function newObservableError(e) {
3857
- // TODO(atscott): This pattern is used throughout the router code and can be `throwError` instead.
3858
- return new Observable((obs) => obs.error(e));
3859
- }
3860
- function recognize$1(injector, rootComponentType, config, urlTree, url, urlSerializer, paramsInheritanceStrategy = 'emptyOnly') {
3861
- return new Recognizer(injector, rootComponentType, config, urlTree, url, paramsInheritanceStrategy, urlSerializer)
3862
- .recognize()
3863
- .pipe(switchMap(result => {
3864
- if (result === null) {
3865
- return newObservableError(new NoMatch());
3866
- }
3867
- else {
3868
- return of(result);
3869
- }
3870
- }));
3871
- }
3872
- class Recognizer {
3873
- constructor(injector, rootComponentType, config, urlTree, url, paramsInheritanceStrategy, urlSerializer) {
3874
- this.injector = injector;
3875
- this.rootComponentType = rootComponentType;
3876
- this.config = config;
3877
- this.urlTree = urlTree;
3878
- this.url = url;
3879
- this.paramsInheritanceStrategy = paramsInheritanceStrategy;
3880
- this.urlSerializer = urlSerializer;
3881
- }
3882
- recognize() {
3883
- const rootSegmentGroup = split(this.urlTree.root, [], [], this.config.filter(c => c.redirectTo === undefined))
3884
- .segmentGroup;
3885
- return this.processSegmentGroup(this.injector, this.config, rootSegmentGroup, PRIMARY_OUTLET)
3886
- .pipe(map(children => {
3887
- if (children === null) {
3888
- return null;
3889
- }
3890
- // Use Object.freeze to prevent readers of the Router state from modifying it outside of a
3891
- // navigation, resulting in the router being out of sync with the browser.
3892
- const root = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, {}, PRIMARY_OUTLET, this.rootComponentType, null, this.urlTree.root, -1, {});
3893
- const rootNode = new TreeNode(root, children);
3894
- const routeState = new RouterStateSnapshot(this.url, rootNode);
3895
- this.inheritParamsAndData(routeState._root);
3896
- return routeState;
3897
- }));
3898
- }
3899
- inheritParamsAndData(routeNode) {
3900
- const route = routeNode.value;
3901
- const i = inheritedParamsDataResolve(route, this.paramsInheritanceStrategy);
3902
- route.params = Object.freeze(i.params);
3903
- route.data = Object.freeze(i.data);
3904
- routeNode.children.forEach(n => this.inheritParamsAndData(n));
3905
- }
3906
- processSegmentGroup(injector, config, segmentGroup, outlet) {
3907
- if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {
3908
- return this.processChildren(injector, config, segmentGroup);
3909
- }
3910
- return this.processSegment(injector, config, segmentGroup, segmentGroup.segments, outlet);
3911
- }
3912
- /**
3913
- * Matches every child outlet in the `segmentGroup` to a `Route` in the config. Returns `null` if
3914
- * we cannot find a match for _any_ of the children.
3915
- *
3916
- * @param config - The `Routes` to match against
3917
- * @param segmentGroup - The `UrlSegmentGroup` whose children need to be matched against the
3918
- * config.
3919
- */
3920
- processChildren(injector, config, segmentGroup) {
3921
- return from(Object.keys(segmentGroup.children))
3922
- .pipe(concatMap(childOutlet => {
3923
- const child = segmentGroup.children[childOutlet];
3924
- // Sort the config so that routes with outlets that match the one being activated
3925
- // appear first, followed by routes for other outlets, which might match if they have
3926
- // an empty path.
3927
- const sortedConfig = sortByMatchingOutlets(config, childOutlet);
3928
- return this.processSegmentGroup(injector, sortedConfig, child, childOutlet);
3929
- }), scan((children, outletChildren) => {
3930
- if (!children || !outletChildren)
3931
- return null;
3932
- children.push(...outletChildren);
3933
- return children;
3934
- }), takeWhile(children => children !== null), defaultIfEmpty(null), last$1(), map(children => {
3935
- if (children === null)
3936
- return null;
3937
- // Because we may have matched two outlets to the same empty path segment, we can have
3938
- // multiple activated results for the same outlet. We should merge the children of
3939
- // these results so the final return value is only one `TreeNode` per outlet.
3940
- const mergedChildren = mergeEmptyPathMatches(children);
3941
- if (NG_DEV_MODE$6) {
3942
- // This should really never happen - we are only taking the first match for each
3943
- // outlet and merge the empty path matches.
3944
- checkOutletNameUniqueness(mergedChildren);
3945
- }
3946
- sortActivatedRouteSnapshots(mergedChildren);
3947
- return mergedChildren;
3948
- }));
3949
- }
3950
- processSegment(injector, routes, segmentGroup, segments, outlet) {
3951
- return from(routes).pipe(concatMap(r => {
3952
- return this.processSegmentAgainstRoute(r._injector ?? injector, r, segmentGroup, segments, outlet);
3953
- }), first((x) => !!x), catchError(e => {
3954
- if (isEmptyError(e)) {
3955
- if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
3956
- return of([]);
3957
- }
3958
- return of(null);
3959
- }
3960
- throw e;
3961
- }));
3962
- }
3963
- processSegmentAgainstRoute(injector, route, rawSegment, segments, outlet) {
3964
- if (route.redirectTo || !isImmediateMatch(route, rawSegment, segments, outlet))
3965
- return of(null);
3966
- let matchResult;
3967
- if (route.path === '**') {
3968
- const params = segments.length > 0 ? last(segments).parameters : {};
3969
- const pathIndexShift = getPathIndexShift(rawSegment) + segments.length;
3970
- const snapshot = new ActivatedRouteSnapshot(segments, params, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route));
3971
- matchResult = of({
3972
- snapshot,
3973
- consumedSegments: [],
3974
- remainingSegments: [],
3975
- });
3976
- }
3977
- else {
3978
- matchResult =
3979
- matchWithChecks(rawSegment, route, segments, injector, this.urlSerializer)
3980
- .pipe(map(({ matched, consumedSegments, remainingSegments, parameters }) => {
3981
- if (!matched) {
3982
- return null;
3983
- }
3984
- const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
3985
- const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route));
3986
- return { snapshot, consumedSegments, remainingSegments };
3987
- }));
3988
- }
3989
- return matchResult.pipe(switchMap((result) => {
3990
- if (result === null) {
3991
- return of(null);
3992
- }
3993
- const { snapshot, consumedSegments, remainingSegments } = result;
3994
- // If the route has an injector created from providers, we should start using that.
3995
- injector = route._injector ?? injector;
3996
- const childInjector = route._loadedInjector ?? injector;
3997
- const childConfig = getChildConfig(route);
3998
- const { segmentGroup, slicedSegments } = split(rawSegment, consumedSegments, remainingSegments,
3999
- // Filter out routes with redirectTo because we are trying to create activated route
4000
- // snapshots and don't handle redirects here. That should have been done in
4001
- // `applyRedirects`.
4002
- childConfig.filter(c => c.redirectTo === undefined));
4003
- if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {
4004
- return this.processChildren(childInjector, childConfig, segmentGroup).pipe(map(children => {
4005
- if (children === null) {
4006
- return null;
4007
- }
4008
- return [new TreeNode(snapshot, children)];
4009
- }));
4010
- }
4011
- if (childConfig.length === 0 && slicedSegments.length === 0) {
4012
- return of([new TreeNode(snapshot, [])]);
4013
- }
4014
- const matchedOnOutlet = getOutlet(route) === outlet;
4015
- // If we matched a config due to empty path match on a different outlet, we need to
4016
- // continue passing the current outlet for the segment rather than switch to PRIMARY.
4017
- // Note that we switch to primary when we have a match because outlet configs look like
4018
- // this: {path: 'a', outlet: 'a', children: [
4019
- // {path: 'b', component: B},
4020
- // {path: 'c', component: C},
4021
- // ]}
4022
- // Notice that the children of the named outlet are configured with the primary outlet
4023
- return this
4024
- .processSegment(childInjector, childConfig, segmentGroup, slicedSegments, matchedOnOutlet ? PRIMARY_OUTLET : outlet)
4025
- .pipe(map(children => {
4026
- if (children === null) {
4027
- return null;
4028
- }
4029
- return [new TreeNode(snapshot, children)];
4030
- }));
4031
- }));
4032
- }
4033
3804
  }
4034
3805
  function sortActivatedRouteSnapshots(nodes) {
4035
3806
  nodes.sort((a, b) => {
@@ -4040,18 +3811,9 @@ function sortActivatedRouteSnapshots(nodes) {
4040
3811
  return a.value.outlet.localeCompare(b.value.outlet);
4041
3812
  });
4042
3813
  }
4043
- function getChildConfig(route) {
4044
- if (route.children) {
4045
- return route.children;
4046
- }
4047
- if (route.loadChildren) {
4048
- return route._loadedRoutes;
4049
- }
4050
- return [];
4051
- }
4052
3814
  function hasEmptyPathConfig(node) {
4053
3815
  const config = node.value.routeConfig;
4054
- return config && config.path === '' && config.redirectTo === undefined;
3816
+ return config && config.path === '';
4055
3817
  }
4056
3818
  /**
4057
3819
  * Finds `TreeNode`s with matching empty path route configs and merges them into `TreeNode` with
@@ -4093,36 +3855,12 @@ function checkOutletNameUniqueness(nodes) {
4093
3855
  if (routeWithSameOutletName) {
4094
3856
  const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
4095
3857
  const c = n.value.url.map(s => s.toString()).join('/');
4096
- 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}'.`);
3858
+ throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
3859
+ `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4097
3860
  }
4098
3861
  names[n.value.outlet] = n.value;
4099
3862
  });
4100
3863
  }
4101
- function getSourceSegmentGroup(segmentGroup) {
4102
- let s = segmentGroup;
4103
- while (s._sourceSegment) {
4104
- s = s._sourceSegment;
4105
- }
4106
- return s;
4107
- }
4108
- function getPathIndexShift(segmentGroup) {
4109
- let s = segmentGroup;
4110
- let res = s._segmentIndexShift ?? 0;
4111
- while (s._sourceSegment) {
4112
- s = s._sourceSegment;
4113
- res += s._segmentIndexShift ?? 0;
4114
- }
4115
- return res - 1;
4116
- }
4117
- function getCorrectedPathIndexShift(segmentGroup) {
4118
- let s = segmentGroup;
4119
- let res = s._segmentIndexShiftCorrected ?? s._segmentIndexShift ?? 0;
4120
- while (s._sourceSegment) {
4121
- s = s._sourceSegment;
4122
- res += s._segmentIndexShiftCorrected ?? s._segmentIndexShift ?? 0;
4123
- }
4124
- return res - 1;
4125
- }
4126
3864
  function getData(route) {
4127
3865
  return route.data || {};
4128
3866
  }
@@ -4130,9 +3868,11 @@ function getResolve(route) {
4130
3868
  return route.resolve || {};
4131
3869
  }
4132
3870
 
4133
- function recognize(injector, rootComponentType, config, serializer, paramsInheritanceStrategy) {
4134
- return mergeMap(t => recognize$1(injector, rootComponentType, config, t.urlAfterRedirects, serializer.serialize(t.urlAfterRedirects), serializer, paramsInheritanceStrategy)
4135
- .pipe(map(targetSnapshot => ({ ...t, targetSnapshot }))));
3871
+ function recognize(injector, configLoader, rootComponentType, config, serializer, paramsInheritanceStrategy) {
3872
+ return mergeMap(t => recognize$1(injector, configLoader, rootComponentType, config, t.extractedUrl, serializer, paramsInheritanceStrategy)
3873
+ .pipe(map(({ state: targetSnapshot, tree: urlAfterRedirects }) => {
3874
+ return { ...t, targetSnapshot, urlAfterRedirects };
3875
+ })));
4136
3876
  }
4137
3877
 
4138
3878
  function resolveData(paramsInheritanceStrategy, injector) {
@@ -4203,13 +3943,6 @@ function switchTap(next) {
4203
3943
  });
4204
3944
  }
4205
3945
 
4206
- // This file exists to support the legacy `loadChildren: string` behavior being patched back into
4207
- // Angular.
4208
- function deprecatedLoadChildrenString(injector, loadChildren) {
4209
- return null;
4210
- }
4211
-
4212
- const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4213
3946
  /**
4214
3947
  * The [DI token](guide/glossary/#di-token) for a router configuration.
4215
3948
  *
@@ -4222,11 +3955,10 @@ const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4222
3955
  */
4223
3956
  const ROUTES = new InjectionToken('ROUTES');
4224
3957
  class RouterConfigLoader {
4225
- constructor(injector, compiler) {
4226
- this.injector = injector;
4227
- this.compiler = compiler;
3958
+ constructor() {
4228
3959
  this.componentLoaders = new WeakMap();
4229
3960
  this.childrenLoaders = new WeakMap();
3961
+ this.compiler = inject(Compiler);
4230
3962
  }
4231
3963
  loadComponent(route) {
4232
3964
  if (this.componentLoaders.get(route)) {
@@ -4243,7 +3975,8 @@ class RouterConfigLoader {
4243
3975
  if (this.onLoadEndListener) {
4244
3976
  this.onLoadEndListener(route);
4245
3977
  }
4246
- NG_DEV_MODE$5 && assertStandalone(route.path ?? '', component);
3978
+ (typeof ngDevMode === 'undefined' || ngDevMode) &&
3979
+ assertStandalone(route.path ?? '', component);
4247
3980
  route._loadedComponent = component;
4248
3981
  }), finalize(() => {
4249
3982
  this.componentLoaders.delete(route);
@@ -4286,7 +4019,8 @@ class RouterConfigLoader {
4286
4019
  rawRoutes = injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional).flat();
4287
4020
  }
4288
4021
  const routes = rawRoutes.map(standardizeConfig);
4289
- NG_DEV_MODE$5 && validateConfig(routes, route.path, requireStandaloneComponents);
4022
+ (typeof ngDevMode === 'undefined' || ngDevMode) &&
4023
+ validateConfig(routes, route.path, requireStandaloneComponents);
4290
4024
  return { routes, injector };
4291
4025
  }), finalize(() => {
4292
4026
  this.childrenLoaders.delete(route);
@@ -4298,10 +4032,6 @@ class RouterConfigLoader {
4298
4032
  return loader;
4299
4033
  }
4300
4034
  loadModuleFactoryOrRoutes(loadChildren) {
4301
- const deprecatedResult = deprecatedLoadChildrenString(this.injector, loadChildren);
4302
- if (deprecatedResult) {
4303
- return deprecatedResult;
4304
- }
4305
4035
  return wrapIntoObservable(loadChildren())
4306
4036
  .pipe(map(maybeUnwrapDefaultExport), mergeMap((t) => {
4307
4037
  if (t instanceof NgModuleFactory || Array.isArray(t)) {
@@ -4312,13 +4042,13 @@ class RouterConfigLoader {
4312
4042
  }
4313
4043
  }));
4314
4044
  }
4045
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterConfigLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4046
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' }); }
4315
4047
  }
4316
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4317
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4318
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterConfigLoader, decorators: [{
4048
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterConfigLoader, decorators: [{
4319
4049
  type: Injectable,
4320
4050
  args: [{ providedIn: 'root' }]
4321
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4051
+ }] });
4322
4052
  function isWrappedDefaultExport(value) {
4323
4053
  // We use `in` here with a string key `'default'`, because we expect `DefaultExport` objects to be
4324
4054
  // dynamically imported ES modules with a spec-mandated `default` key. Thus we don't expect that
@@ -4331,7 +4061,6 @@ function maybeUnwrapDefaultExport(input) {
4331
4061
  return isWrappedDefaultExport(input) ? input['default'] : input;
4332
4062
  }
4333
4063
 
4334
- const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4335
4064
  class NavigationTransitions {
4336
4065
  get hasRequestedNavigation() {
4337
4066
  return this.navigationId !== 0;
@@ -4421,7 +4150,7 @@ class NavigationTransitions {
4421
4150
  browserUrlTree !== router.currentUrlTree.toString();
4422
4151
  const onSameUrlNavigation = t.extras.onSameUrlNavigation ?? router.onSameUrlNavigation;
4423
4152
  if (!urlTransition && onSameUrlNavigation !== 'reload') {
4424
- const reason = NG_DEV_MODE$4 ?
4153
+ const reason = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4425
4154
  `Navigation to ${t.rawUrl} was ignored because it is the same as the current Router URL.` :
4426
4155
  '';
4427
4156
  this.events.next(new NavigationSkipped(t.id, router.serializeUrl(overallTransitionState.rawUrl), reason, 0 /* NavigationSkippedCode.IgnoredSameUrlNavigation */));
@@ -4447,22 +4176,16 @@ class NavigationTransitions {
4447
4176
  // navigation to always be async
4448
4177
  return Promise.resolve(t);
4449
4178
  }),
4450
- // ApplyRedirects
4451
- applyRedirects(this.environmentInjector, this.configLoader, this.urlSerializer, router.config),
4452
- // Update the currentNavigation
4453
- // `urlAfterRedirects` is guaranteed to be set after this point
4179
+ // Recognize
4180
+ recognize(this.environmentInjector, this.configLoader, this.rootComponentType, router.config, this.urlSerializer, router.paramsInheritanceStrategy),
4181
+ // Update URL if in `eager` update mode
4454
4182
  tap(t => {
4183
+ overallTransitionState.targetSnapshot = t.targetSnapshot;
4184
+ overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
4455
4185
  this.currentNavigation = {
4456
4186
  ...this.currentNavigation,
4457
4187
  finalUrl: t.urlAfterRedirects
4458
4188
  };
4459
- overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
4460
- }),
4461
- // Recognize
4462
- recognize(this.environmentInjector, this.rootComponentType, router.config, this.urlSerializer, router.paramsInheritanceStrategy),
4463
- // Update URL if in `eager` update mode
4464
- tap(t => {
4465
- overallTransitionState.targetSnapshot = t.targetSnapshot;
4466
4189
  if (router.urlUpdateStrategy === 'eager') {
4467
4190
  if (!t.extras.skipLocationChange) {
4468
4191
  const rawUrl = router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
@@ -4498,7 +4221,7 @@ class NavigationTransitions {
4498
4221
  * current "settled" URL. This way the next navigation will be coming
4499
4222
  * from the current URL in the browser.
4500
4223
  */
4501
- const reason = NG_DEV_MODE$4 ?
4224
+ const reason = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4502
4225
  `Navigation was ignored because the UrlHandlingStrategy` +
4503
4226
  ` indicated neither the current URL ${router.rawUrlTree} nor target URL ${t.rawUrl} should be processed.` :
4504
4227
  '';
@@ -4546,7 +4269,7 @@ class NavigationTransitions {
4546
4269
  complete: () => {
4547
4270
  if (!dataResolved) {
4548
4271
  router.restoreHistory(t);
4549
- this.cancelNavigationTransition(t, NG_DEV_MODE$4 ?
4272
+ this.cancelNavigationTransition(t, (typeof ngDevMode === 'undefined' || ngDevMode) ?
4550
4273
  `At least one route resolver didn't emit any value.` :
4551
4274
  '', 2 /* NavigationCancellationCode.NoDataFromResolver */);
4552
4275
  }
@@ -4619,7 +4342,7 @@ class NavigationTransitions {
4619
4342
  * catch-all to make sure the NavigationCancel event is fired when a
4620
4343
  * navigation gets cancelled but not caught by other means. */
4621
4344
  if (!completed && !errored) {
4622
- const cancelationReason = NG_DEV_MODE$4 ?
4345
+ const cancelationReason = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4623
4346
  `Navigation ID ${overallTransitionState
4624
4347
  .id} is not equal to the current navigation id ${this.navigationId}` :
4625
4348
  '';
@@ -4693,10 +4416,10 @@ class NavigationTransitions {
4693
4416
  this.events.next(navCancel);
4694
4417
  t.resolve(false);
4695
4418
  }
4419
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: NavigationTransitions, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4420
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: NavigationTransitions, providedIn: 'root' }); }
4696
4421
  }
4697
- NavigationTransitions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: NavigationTransitions, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4698
- NavigationTransitions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: NavigationTransitions, providedIn: 'root' });
4699
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: NavigationTransitions, decorators: [{
4422
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: NavigationTransitions, decorators: [{
4700
4423
  type: Injectable,
4701
4424
  args: [{ providedIn: 'root' }]
4702
4425
  }], ctorParameters: function () { return []; } });
@@ -4747,10 +4470,10 @@ class TitleStrategy {
4747
4470
  getResolvedTitleForRoute(snapshot) {
4748
4471
  return snapshot.data[RouteTitleKey];
4749
4472
  }
4473
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4474
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }); }
4750
4475
  }
4751
- TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4752
- TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4753
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: TitleStrategy, decorators: [{
4476
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: TitleStrategy, decorators: [{
4754
4477
  type: Injectable,
4755
4478
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
4756
4479
  }] });
@@ -4773,10 +4496,10 @@ class DefaultTitleStrategy extends TitleStrategy {
4773
4496
  this.title.setTitle(title);
4774
4497
  }
4775
4498
  }
4499
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable }); }
4500
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' }); }
4776
4501
  }
4777
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4778
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4779
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4502
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4780
4503
  type: Injectable,
4781
4504
  args: [{ providedIn: 'root' }]
4782
4505
  }], ctorParameters: function () { return [{ type: i1.Title }]; } });
@@ -4789,10 +4512,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3",
4789
4512
  * @publicApi
4790
4513
  */
4791
4514
  class RouteReuseStrategy {
4515
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouteReuseStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4516
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouteReuseStrategy, providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) }); }
4792
4517
  }
4793
- RouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouteReuseStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4794
- RouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouteReuseStrategy, providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) });
4795
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouteReuseStrategy, decorators: [{
4518
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouteReuseStrategy, decorators: [{
4796
4519
  type: Injectable,
4797
4520
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) }]
4798
4521
  }] });
@@ -4843,21 +4566,20 @@ class BaseRouteReuseStrategy {
4843
4566
  }
4844
4567
  }
4845
4568
  class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4569
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: DefaultRouteReuseStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
4570
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: DefaultRouteReuseStrategy, providedIn: 'root' }); }
4846
4571
  }
4847
- DefaultRouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: DefaultRouteReuseStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
4848
- DefaultRouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: DefaultRouteReuseStrategy, providedIn: 'root' });
4849
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: DefaultRouteReuseStrategy, decorators: [{
4572
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: DefaultRouteReuseStrategy, decorators: [{
4850
4573
  type: Injectable,
4851
4574
  args: [{ providedIn: 'root' }]
4852
4575
  }] });
4853
4576
 
4854
- const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4855
4577
  /**
4856
4578
  * A [DI token](guide/glossary/#di-token) for the router service.
4857
4579
  *
4858
4580
  * @publicApi
4859
4581
  */
4860
- const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config' : '', {
4582
+ const ROUTER_CONFIGURATION = new InjectionToken((typeof ngDevMode === 'undefined' || ngDevMode) ? 'router config' : '', {
4861
4583
  providedIn: 'root',
4862
4584
  factory: () => ({}),
4863
4585
  });
@@ -4870,10 +4592,10 @@ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config'
4870
4592
  * @publicApi
4871
4593
  */
4872
4594
  class UrlHandlingStrategy {
4595
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: UrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4596
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: UrlHandlingStrategy, providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) }); }
4873
4597
  }
4874
- UrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: UrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4875
- UrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: UrlHandlingStrategy, providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) });
4876
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: UrlHandlingStrategy, decorators: [{
4598
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: UrlHandlingStrategy, decorators: [{
4877
4599
  type: Injectable,
4878
4600
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) }]
4879
4601
  }] });
@@ -4890,15 +4612,47 @@ class DefaultUrlHandlingStrategy {
4890
4612
  merge(newUrlPart, wholeUrl) {
4891
4613
  return newUrlPart;
4892
4614
  }
4615
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: DefaultUrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4616
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: DefaultUrlHandlingStrategy, providedIn: 'root' }); }
4893
4617
  }
4894
- DefaultUrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: DefaultUrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4895
- DefaultUrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: DefaultUrlHandlingStrategy, providedIn: 'root' });
4896
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: DefaultUrlHandlingStrategy, decorators: [{
4618
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: DefaultUrlHandlingStrategy, decorators: [{
4897
4619
  type: Injectable,
4898
4620
  args: [{ providedIn: 'root' }]
4899
4621
  }] });
4900
4622
 
4901
- const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4623
+ var NavigationResult;
4624
+ (function (NavigationResult) {
4625
+ NavigationResult[NavigationResult["COMPLETE"] = 0] = "COMPLETE";
4626
+ NavigationResult[NavigationResult["FAILED"] = 1] = "FAILED";
4627
+ NavigationResult[NavigationResult["REDIRECTING"] = 2] = "REDIRECTING";
4628
+ })(NavigationResult || (NavigationResult = {}));
4629
+ /**
4630
+ * Performs the given action once the router finishes its next/current navigation.
4631
+ *
4632
+ * The navigation is considered complete under the following conditions:
4633
+ * - `NavigationCancel` event emits and the code is not `NavigationCancellationCode.Redirect` or
4634
+ * `NavigationCancellationCode.SupersededByNewNavigation`. In these cases, the
4635
+ * redirecting/superseding navigation must finish.
4636
+ * - `NavigationError`, `NavigationEnd`, or `NavigationSkipped` event emits
4637
+ */
4638
+ function afterNextNavigation(router, action) {
4639
+ router.events
4640
+ .pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
4641
+ e instanceof NavigationError || e instanceof NavigationSkipped), map(e => {
4642
+ if (e instanceof NavigationEnd || e instanceof NavigationSkipped) {
4643
+ return NavigationResult.COMPLETE;
4644
+ }
4645
+ const redirecting = e instanceof NavigationCancel ?
4646
+ (e.code === 0 /* NavigationCancellationCode.Redirect */ ||
4647
+ e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
4648
+ false;
4649
+ return redirecting ? NavigationResult.REDIRECTING : NavigationResult.FAILED;
4650
+ }), filter((result) => result !== NavigationResult.REDIRECTING), take(1))
4651
+ .subscribe(() => {
4652
+ action();
4653
+ });
4654
+ }
4655
+
4902
4656
  function defaultErrorHandler(error) {
4903
4657
  throw error;
4904
4658
  }
@@ -4975,6 +4729,7 @@ class Router {
4975
4729
  this.console = inject(ɵConsole);
4976
4730
  this.isNgZoneEnabled = false;
4977
4731
  this.options = inject(ROUTER_CONFIGURATION, { optional: true }) || {};
4732
+ this.pendingTasks = inject(ɵInitialRenderPendingTasks);
4978
4733
  /**
4979
4734
  * A handler for navigation errors in this NgModule.
4980
4735
  *
@@ -5015,8 +4770,6 @@ class Router {
5015
4770
  * `{provide: RouteReuseStrategy, useClass: MyStrategy}`.
5016
4771
  */
5017
4772
  this.routeReuseStrategy = inject(RouteReuseStrategy);
5018
- /** Strategy used to create a UrlTree. */
5019
- this.urlCreationStrategy = inject(CreateUrlTreeStrategy);
5020
4773
  /**
5021
4774
  * A strategy for setting the title based on the `routerState`.
5022
4775
  *
@@ -5210,7 +4963,7 @@ class Router {
5210
4963
  * ```
5211
4964
  */
5212
4965
  resetConfig(config) {
5213
- NG_DEV_MODE$2 && validateConfig(config);
4966
+ (typeof ngDevMode === 'undefined' || ngDevMode) && validateConfig(config);
5214
4967
  this.config = config.map(standardizeConfig);
5215
4968
  this.navigated = false;
5216
4969
  this.lastSuccessfulId = -1;
@@ -5293,7 +5046,30 @@ class Router {
5293
5046
  if (q !== null) {
5294
5047
  q = this.removeEmptyProps(q);
5295
5048
  }
5296
- return this.urlCreationStrategy.createUrlTree(relativeTo, this.routerState, this.currentUrlTree, commands, q, f ?? null);
5049
+ let relativeToUrlSegmentGroup;
5050
+ try {
5051
+ const relativeToSnapshot = relativeTo ? relativeTo.snapshot : this.routerState.snapshot.root;
5052
+ relativeToUrlSegmentGroup = createSegmentGroupFromRoute(relativeToSnapshot);
5053
+ }
5054
+ catch (e) {
5055
+ // This is strictly for backwards compatibility with tests that create
5056
+ // invalid `ActivatedRoute` mocks.
5057
+ // Note: the difference between having this fallback for invalid `ActivatedRoute` setups and
5058
+ // just throwing is ~500 test failures. Fixing all of those tests by hand is not feasible at
5059
+ // the moment.
5060
+ if (typeof commands[0] !== 'string' || !commands[0].startsWith('/')) {
5061
+ // Navigations that were absolute in the old way of creating UrlTrees
5062
+ // would still work because they wouldn't attempt to match the
5063
+ // segments in the `ActivatedRoute` to the `currentUrlTree` but
5064
+ // instead just replace the root segment with the navigation result.
5065
+ // Non-absolute navigations would fail to apply the commands because
5066
+ // the logic could not find the segment to replace (so they'd act like there were no
5067
+ // commands).
5068
+ commands = [];
5069
+ }
5070
+ relativeToUrlSegmentGroup = this.currentUrlTree.root;
5071
+ }
5072
+ return createUrlTreeFromSegmentGroup(relativeToUrlSegmentGroup, commands, q, f ?? null);
5297
5073
  }
5298
5074
  /**
5299
5075
  * Navigates to a view using an absolute route path.
@@ -5322,7 +5098,7 @@ class Router {
5322
5098
  navigateByUrl(url, extras = {
5323
5099
  skipLocationChange: false
5324
5100
  }) {
5325
- if (NG_DEV_MODE$2) {
5101
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
5326
5102
  if (this.isNgZoneEnabled && !NgZone.isInAngularZone()) {
5327
5103
  this.console.warn(`Navigation triggered outside Angular zone, did you forget to call 'ngZone.run()'?`);
5328
5104
  }
@@ -5451,6 +5227,13 @@ class Router {
5451
5227
  // This is unused when `canceledNavigationResolution` is not computed.
5452
5228
  targetPageId = 0;
5453
5229
  }
5230
+ // Indicate that the navigation is happening.
5231
+ const taskId = this.pendingTasks.add();
5232
+ afterNextNavigation(this, () => {
5233
+ // Remove pending task in a microtask to allow for cancelled
5234
+ // initial navigations and redirects within the same task.
5235
+ Promise.resolve().then(() => this.pendingTasks.remove(taskId));
5236
+ });
5454
5237
  this.navigationTransitions.handleNavigationRequest({
5455
5238
  targetPageId,
5456
5239
  source,
@@ -5549,10 +5332,10 @@ class Router {
5549
5332
  }
5550
5333
  return { navigationId };
5551
5334
  }
5335
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: Router, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
5336
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: Router, providedIn: 'root' }); }
5552
5337
  }
5553
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: Router, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5554
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: Router, providedIn: 'root' });
5555
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: Router, decorators: [{
5338
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: Router, decorators: [{
5556
5339
  type: Injectable,
5557
5340
  args: [{ providedIn: 'root' }]
5558
5341
  }], ctorParameters: function () { return []; } });
@@ -5560,7 +5343,8 @@ function validateCommands(commands) {
5560
5343
  for (let i = 0; i < commands.length; i++) {
5561
5344
  const cmd = commands[i];
5562
5345
  if (cmd == null) {
5563
- throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$2 && `The requested path contains ${cmd} segment at index ${i}`);
5346
+ throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
5347
+ `The requested path contains ${cmd} segment at index ${i}`);
5564
5348
  }
5565
5349
  }
5566
5350
  }
@@ -5837,10 +5621,10 @@ class RouterLink {
5837
5621
  preserveFragment: this.preserveFragment,
5838
5622
  });
5839
5623
  }
5624
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", 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 }); }
5625
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.5", 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 }); }
5840
5626
  }
5841
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", 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 });
5842
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.3", 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 });
5843
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterLink, decorators: [{
5627
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterLink, decorators: [{
5844
5628
  type: Directive,
5845
5629
  args: [{
5846
5630
  selector: '[routerLink]',
@@ -6060,10 +5844,10 @@ class RouterLinkActive {
6060
5844
  const isActiveCheckFn = this.isLinkActive(this.router);
6061
5845
  return this.link && isActiveCheckFn(this.link) || this.links.some(isActiveCheckFn);
6062
5846
  }
5847
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
5848
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.5", 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 }); }
6063
5849
  }
6064
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6065
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.3", 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 });
6066
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterLinkActive, decorators: [{
5850
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterLinkActive, decorators: [{
6067
5851
  type: Directive,
6068
5852
  args: [{
6069
5853
  selector: '[routerLinkActive]',
@@ -6115,10 +5899,10 @@ class PreloadAllModules {
6115
5899
  preload(route, fn) {
6116
5900
  return fn().pipe(catchError(() => of(null)));
6117
5901
  }
5902
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
5903
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: PreloadAllModules, providedIn: 'root' }); }
6118
5904
  }
6119
- PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6120
- PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6121
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: PreloadAllModules, decorators: [{
5905
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: PreloadAllModules, decorators: [{
6122
5906
  type: Injectable,
6123
5907
  args: [{ providedIn: 'root' }]
6124
5908
  }] });
@@ -6135,10 +5919,10 @@ class NoPreloading {
6135
5919
  preload(route, fn) {
6136
5920
  return of(null);
6137
5921
  }
5922
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
5923
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: NoPreloading, providedIn: 'root' }); }
6138
5924
  }
6139
- NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6140
- NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6141
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: NoPreloading, decorators: [{
5925
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: NoPreloading, decorators: [{
6142
5926
  type: Injectable,
6143
5927
  args: [{ providedIn: 'root' }]
6144
5928
  }] });
@@ -6197,7 +5981,7 @@ class RouterPreloader {
6197
5981
  (route.loadComponent && !route._loadedComponent)) {
6198
5982
  res.push(this.preloadConfig(injectorForCurrentRoute, route));
6199
5983
  }
6200
- else if (route.children || route._loadedRoutes) {
5984
+ if (route.children || route._loadedRoutes) {
6201
5985
  res.push(this.processRoutes(injectorForChildren, (route.children ?? route._loadedRoutes)));
6202
5986
  }
6203
5987
  }
@@ -6231,10 +6015,10 @@ class RouterPreloader {
6231
6015
  }
6232
6016
  });
6233
6017
  }
6018
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable }); }
6019
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterPreloader, providedIn: 'root' }); }
6234
6020
  }
6235
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6236
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
6237
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterPreloader, decorators: [{
6021
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterPreloader, decorators: [{
6238
6022
  type: Injectable,
6239
6023
  args: [{ providedIn: 'root' }]
6240
6024
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
@@ -6327,47 +6111,13 @@ class RouterScroller {
6327
6111
  this.routerEventsSubscription?.unsubscribe();
6328
6112
  this.scrollEventsSubscription?.unsubscribe();
6329
6113
  }
6114
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable }); }
6115
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterScroller }); }
6330
6116
  }
6331
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6332
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterScroller });
6333
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterScroller, decorators: [{
6117
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterScroller, decorators: [{
6334
6118
  type: Injectable
6335
6119
  }], ctorParameters: function () { return [{ type: UrlSerializer }, { type: NavigationTransitions }, { type: i3.ViewportScroller }, { type: i0.NgZone }, { type: undefined }]; } });
6336
6120
 
6337
- var NavigationResult;
6338
- (function (NavigationResult) {
6339
- NavigationResult[NavigationResult["COMPLETE"] = 0] = "COMPLETE";
6340
- NavigationResult[NavigationResult["FAILED"] = 1] = "FAILED";
6341
- NavigationResult[NavigationResult["REDIRECTING"] = 2] = "REDIRECTING";
6342
- })(NavigationResult || (NavigationResult = {}));
6343
- /**
6344
- * Performs the given action once the router finishes its next/current navigation.
6345
- *
6346
- * The navigation is considered complete under the following conditions:
6347
- * - `NavigationCancel` event emits and the code is not `NavigationCancellationCode.Redirect` or
6348
- * `NavigationCancellationCode.SupersededByNewNavigation`. In these cases, the
6349
- * redirecting/superseding navigation must finish.
6350
- * - `NavigationError`, `NavigationEnd`, or `NavigationSkipped` event emits
6351
- */
6352
- function afterNextNavigation(router, action) {
6353
- router.events
6354
- .pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
6355
- e instanceof NavigationError || e instanceof NavigationSkipped), map(e => {
6356
- if (e instanceof NavigationEnd || e instanceof NavigationSkipped) {
6357
- return NavigationResult.COMPLETE;
6358
- }
6359
- const redirecting = e instanceof NavigationCancel ?
6360
- (e.code === 0 /* NavigationCancellationCode.Redirect */ ||
6361
- e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
6362
- false;
6363
- return redirecting ? NavigationResult.REDIRECTING : NavigationResult.FAILED;
6364
- }), filter((result) => result !== NavigationResult.REDIRECTING), take(1))
6365
- .subscribe(() => {
6366
- action();
6367
- });
6368
- }
6369
-
6370
- const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || ngDevMode;
6371
6121
  /**
6372
6122
  * Sets up providers necessary to enable `Router` functionality for the application.
6373
6123
  * Allows to configure a set of routes as well as extra features that should be enabled.
@@ -6407,7 +6157,9 @@ const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || ngDevMode;
6407
6157
  function provideRouter(routes, ...features) {
6408
6158
  return makeEnvironmentProviders([
6409
6159
  { provide: ROUTES, multi: true, useValue: routes },
6410
- NG_DEV_MODE$1 ? { provide: ROUTER_IS_PROVIDED, useValue: true } : [],
6160
+ (typeof ngDevMode === 'undefined' || ngDevMode) ?
6161
+ { provide: ROUTER_IS_PROVIDED, useValue: true } :
6162
+ [],
6411
6163
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6412
6164
  { provide: APP_BOOTSTRAP_LISTENER, multi: true, useFactory: getBootstrapListener },
6413
6165
  features.map(feature => feature.ɵproviders),
@@ -6459,7 +6211,7 @@ const routerIsProvidedDevModeCheck = {
6459
6211
  function provideRoutes(routes) {
6460
6212
  return [
6461
6213
  { provide: ROUTES, multi: true, useValue: routes },
6462
- NG_DEV_MODE$1 ? routerIsProvidedDevModeCheck : [],
6214
+ (typeof ngDevMode === 'undefined' || ngDevMode) ? routerIsProvidedDevModeCheck : [],
6463
6215
  ];
6464
6216
  }
6465
6217
  /**
@@ -6526,12 +6278,12 @@ function getBootstrapListener() {
6526
6278
  * `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
6527
6279
  * to the activation phase.
6528
6280
  */
6529
- const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE$1 ? 'bootstrap done indicator' : '', {
6281
+ const BOOTSTRAP_DONE = new InjectionToken((typeof ngDevMode === 'undefined' || ngDevMode) ? 'bootstrap done indicator' : '', {
6530
6282
  factory: () => {
6531
6283
  return new Subject();
6532
6284
  }
6533
6285
  });
6534
- const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE$1 ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
6286
+ const INITIAL_NAVIGATION = new InjectionToken((typeof ngDevMode === 'undefined' || ngDevMode) ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
6535
6287
  /**
6536
6288
  * Configures initial navigation to start before the root component is created.
6537
6289
  *
@@ -6660,7 +6412,7 @@ function withDisabledInitialNavigation() {
6660
6412
  */
6661
6413
  function withDebugTracing() {
6662
6414
  let providers = [];
6663
- if (NG_DEV_MODE$1) {
6415
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
6664
6416
  providers = [{
6665
6417
  provide: ENVIRONMENT_INITIALIZER,
6666
6418
  multi: true,
@@ -6682,7 +6434,7 @@ function withDebugTracing() {
6682
6434
  }
6683
6435
  return routerFeature(1 /* RouterFeatureKind.DebugTracingFeature */, providers);
6684
6436
  }
6685
- const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE$1 ? 'router preloader' : '');
6437
+ const ROUTER_PRELOADER = new InjectionToken((typeof ngDevMode === 'undefined' || ngDevMode) ? 'router preloader' : '');
6686
6438
  /**
6687
6439
  * Allows to configure a preloading strategy to use. The strategy is configured by providing a
6688
6440
  * reference to a class that implements a `PreloadingStrategy`.
@@ -6824,7 +6576,6 @@ function withNavigationErrorHandler(fn) {
6824
6576
  return routerFeature(7 /* RouterFeatureKind.NavigationErrorHandlerFeature */, providers);
6825
6577
  }
6826
6578
 
6827
- const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
6828
6579
  /**
6829
6580
  * The directives defined in the `RouterModule`.
6830
6581
  */
@@ -6832,7 +6583,8 @@ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOu
6832
6583
  /**
6833
6584
  * @docsNotRequired
6834
6585
  */
6835
- const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
6586
+ const ROUTER_FORROOT_GUARD = new InjectionToken((typeof ngDevMode === 'undefined' || ngDevMode) ? 'router duplicate forRoot guard' :
6587
+ 'ROUTER_FORROOT_GUARD');
6836
6588
  // TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept
6837
6589
  // here to avoid a breaking change whereby the provider order matters based on where the
6838
6590
  // `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a "breaking"
@@ -6846,7 +6598,8 @@ const ROUTER_PROVIDERS = [
6846
6598
  RouterConfigLoader,
6847
6599
  // Only used to warn when `provideRoutes` is used without `RouterModule` or `provideRouter`. Can
6848
6600
  // be removed when `provideRoutes` is removed.
6849
- NG_DEV_MODE ? { provide: ROUTER_IS_PROVIDED, useValue: true } : [],
6601
+ (typeof ngDevMode === 'undefined' || ngDevMode) ? { provide: ROUTER_IS_PROVIDED, useValue: true } :
6602
+ [],
6850
6603
  ];
6851
6604
  function routerNgProbeToken() {
6852
6605
  return new NgProbeToken('Router', Router);
@@ -6897,7 +6650,9 @@ class RouterModule {
6897
6650
  ngModule: RouterModule,
6898
6651
  providers: [
6899
6652
  ROUTER_PROVIDERS,
6900
- NG_DEV_MODE ? (config?.enableTracing ? withDebugTracing().ɵproviders : []) : [],
6653
+ (typeof ngDevMode === 'undefined' || ngDevMode) ?
6654
+ (config?.enableTracing ? withDebugTracing().ɵproviders : []) :
6655
+ [],
6901
6656
  { provide: ROUTES, multi: true, useValue: routes },
6902
6657
  {
6903
6658
  provide: ROUTER_FORROOT_GUARD,
@@ -6936,11 +6691,11 @@ class RouterModule {
6936
6691
  providers: [{ provide: ROUTES, multi: true, useValue: routes }],
6937
6692
  };
6938
6693
  }
6694
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
6695
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] }); }
6696
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] }); }
6939
6697
  }
6940
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6941
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] });
6942
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
6943
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: RouterModule, decorators: [{
6698
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterModule, decorators: [{
6944
6699
  type: NgModule,
6945
6700
  args: [{
6946
6701
  imports: ROUTER_DIRECTIVES,
@@ -6983,7 +6738,7 @@ function providePathLocationStrategy() {
6983
6738
  return { provide: LocationStrategy, useClass: PathLocationStrategy };
6984
6739
  }
6985
6740
  function provideForRootGuard(router) {
6986
- if (NG_DEV_MODE && router) {
6741
+ if ((typeof ngDevMode === 'undefined' || ngDevMode) && router) {
6987
6742
  throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `The Router was provided more than once. This can happen if 'forRoot' is used outside of the root injector.` +
6988
6743
  ` Lazy loaded modules should use RouterModule.forChild() instead.`);
6989
6744
  }
@@ -7006,7 +6761,7 @@ function provideInitialNavigation(config) {
7006
6761
  *
7007
6762
  * @publicApi
7008
6763
  */
7009
- const ROUTER_INITIALIZER = new InjectionToken(NG_DEV_MODE ? 'Router Initializer' : '');
6764
+ const ROUTER_INITIALIZER = new InjectionToken((typeof ngDevMode === 'undefined' || ngDevMode) ? 'Router Initializer' : '');
7010
6765
  function provideRouterInitializer() {
7011
6766
  return [
7012
6767
  // ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
@@ -7085,7 +6840,7 @@ function mapToResolve(provider) {
7085
6840
  /**
7086
6841
  * @publicApi
7087
6842
  */
7088
- const VERSION = new Version('16.0.0-next.3');
6843
+ const VERSION = new Version('16.0.0-next.5');
7089
6844
 
7090
6845
  /**
7091
6846
  * @module