@angular/router 14.2.0-next.0 → 14.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/esm2020/src/apply_redirects.mjs +4 -3
  2. package/esm2020/src/components/empty_outlet.mjs +3 -3
  3. package/esm2020/src/directives/router_link.mjs +101 -23
  4. package/esm2020/src/directives/router_link_active.mjs +3 -3
  5. package/esm2020/src/directives/router_outlet.mjs +3 -3
  6. package/esm2020/src/index.mjs +3 -2
  7. package/esm2020/src/models.mjs +1 -1
  8. package/esm2020/src/operators/check_guards.mjs +36 -26
  9. package/esm2020/src/operators/resolve_data.mjs +19 -15
  10. package/esm2020/src/page_title_strategy.mjs +6 -6
  11. package/esm2020/src/patchable_relative_link_resolution.mjs +12 -0
  12. package/esm2020/src/private_export.mjs +3 -2
  13. package/esm2020/src/provide_router.mjs +420 -0
  14. package/esm2020/src/recognize.mjs +4 -3
  15. package/esm2020/src/router.mjs +6 -4
  16. package/esm2020/src/router_config.mjs +1 -1
  17. package/esm2020/src/router_config_loader.mjs +3 -3
  18. package/esm2020/src/router_module.mjs +28 -185
  19. package/esm2020/src/router_outlet_context.mjs +3 -3
  20. package/esm2020/src/router_preloader.mjs +12 -11
  21. package/esm2020/src/router_scroller.mjs +3 -3
  22. package/esm2020/src/url_tree.mjs +3 -3
  23. package/esm2020/src/utils/preactivation.mjs +16 -6
  24. package/esm2020/src/utils/type_guards.mjs +5 -1
  25. package/esm2020/src/version.mjs +1 -1
  26. package/esm2020/testing/src/provide_router_for_testing.mjs +51 -0
  27. package/esm2020/testing/src/router_testing_module.mjs +8 -8
  28. package/fesm2015/router.mjs +697 -322
  29. package/fesm2015/router.mjs.map +1 -1
  30. package/fesm2015/testing.mjs +8 -8
  31. package/fesm2015/testing.mjs.map +1 -1
  32. package/fesm2015/upgrade.mjs +1 -1
  33. package/fesm2020/router.mjs +691 -320
  34. package/fesm2020/router.mjs.map +1 -1
  35. package/fesm2020/testing.mjs +8 -8
  36. package/fesm2020/testing.mjs.map +1 -1
  37. package/fesm2020/upgrade.mjs +1 -1
  38. package/index.d.ts +589 -211
  39. package/package.json +4 -4
  40. package/testing/index.d.ts +1 -1
  41. package/upgrade/index.d.ts +1 -1
@@ -1,14 +1,14 @@
1
1
  /**
2
- * @license Angular v14.2.0-next.0
2
+ * @license Angular v14.2.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import * as i0 from '@angular/core';
8
- import { ɵisObservable, ɵisPromise, Injectable, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, inject, InjectionToken, InjectFlags, NgModuleFactory, Injector, Compiler, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, NgProbeToken, SkipSelf, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, Inject, ApplicationRef, ENVIRONMENT_INITIALIZER, Version } from '@angular/core';
9
- import { from, of, BehaviorSubject, combineLatest, concat, defer, pipe, throwError, EmptyError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
8
+ import { ɵisObservable, ɵisPromise, Injectable, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, ɵisInjectable, inject, InjectionToken, InjectFlags, NgModuleFactory, Injector, Compiler, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, APP_BOOTSTRAP_LISTENER, ApplicationRef, APP_INITIALIZER, ENVIRONMENT_INITIALIZER, NgProbeToken, SkipSelf, NgModule, Inject, Version } from '@angular/core';
9
+ import { from, of, BehaviorSubject, EmptyError, combineLatest, concat, defer, pipe, throwError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
10
10
  import * as i3 from '@angular/common';
11
- import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
11
+ import { Location, ViewportScroller, LOCATION_INITIALIZED, LocationStrategy, HashLocationStrategy, PathLocationStrategy } from '@angular/common';
12
12
  import { map, switchMap, take, startWith, filter, mergeMap, first, concatMap, tap, catchError, scan, last as last$1, takeWhile, defaultIfEmpty, takeLast, mapTo, finalize, refCount, mergeAll } from 'rxjs/operators';
13
13
  import * as i1 from '@angular/platform-browser';
14
14
 
@@ -202,7 +202,7 @@ function wrapIntoObservable(value) {
202
202
  * Use of this source code is governed by an MIT-style license that can be
203
203
  * found in the LICENSE file at https://angular.io/license
204
204
  */
205
- const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
205
+ const NG_DEV_MODE$9 = typeof ngDevMode === 'undefined' || ngDevMode;
206
206
  function createEmptyUrlTree() {
207
207
  return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
208
208
  }
@@ -459,9 +459,9 @@ function mapChildrenIntoArray(segment, fn) {
459
459
  */
460
460
  class UrlSerializer {
461
461
  }
462
- UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
463
- UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
464
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: UrlSerializer, decorators: [{
462
+ UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
463
+ UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: UrlSerializer, decorators: [{
465
465
  type: Injectable,
466
466
  args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
467
467
  }] });
@@ -673,7 +673,7 @@ class UrlParser {
673
673
  parseSegment() {
674
674
  const path = matchSegments(this.remaining);
675
675
  if (path === '' && this.peekStartsWith(';')) {
676
- throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$8 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
676
+ throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$9 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
677
677
  }
678
678
  this.capture(path);
679
679
  return new UrlSegment(decode(path), this.parseMatrixParams());
@@ -742,7 +742,7 @@ class UrlParser {
742
742
  // if is is not one of these characters, then the segment was unescaped
743
743
  // or the group was not closed
744
744
  if (next !== '/' && next !== ')' && next !== ';') {
745
- throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$8 && `Cannot parse url '${this.url}'`);
745
+ throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$9 && `Cannot parse url '${this.url}'`);
746
746
  }
747
747
  let outletName = undefined;
748
748
  if (path.indexOf(':') > -1) {
@@ -773,7 +773,7 @@ class UrlParser {
773
773
  }
774
774
  capture(str) {
775
775
  if (!this.consumeOptional(str)) {
776
- throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$8 && `Expected "${str}".`);
776
+ throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$9 && `Expected "${str}".`);
777
777
  }
778
778
  }
779
779
  }
@@ -826,7 +826,7 @@ function isUrlTree(v) {
826
826
  * Use of this source code is governed by an MIT-style license that can be
827
827
  * found in the LICENSE file at https://angular.io/license
828
828
  */
829
- const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
829
+ const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
830
830
  /**
831
831
  * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
832
832
  *
@@ -1004,11 +1004,11 @@ class Navigation {
1004
1004
  this.numberOfDoubleDots = numberOfDoubleDots;
1005
1005
  this.commands = commands;
1006
1006
  if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
1007
- throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$7 && 'Root segment cannot have matrix parameters');
1007
+ throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$8 && 'Root segment cannot have matrix parameters');
1008
1008
  }
1009
1009
  const cmdWithOutlet = commands.find(isCommandWithOutlets);
1010
1010
  if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
1011
- throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$7 && '{outlets:{}} has to be the last command');
1011
+ throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$8 && '{outlets:{}} has to be the last command');
1012
1012
  }
1013
1013
  }
1014
1014
  toRoot() {
@@ -1107,7 +1107,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
1107
1107
  dd -= ci;
1108
1108
  g = g.parent;
1109
1109
  if (!g) {
1110
- throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$7 && 'Invalid number of \'../\'');
1110
+ throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$8 && 'Invalid number of \'../\'');
1111
1111
  }
1112
1112
  ci = g.segments.length;
1113
1113
  }
@@ -2388,9 +2388,9 @@ class ChildrenOutletContexts {
2388
2388
  return this.contexts.get(childName) || null;
2389
2389
  }
2390
2390
  }
2391
- ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2392
- ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2393
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2391
+ ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2392
+ ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2393
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2394
2394
  type: Injectable,
2395
2395
  args: [{ providedIn: 'root' }]
2396
2396
  }] });
@@ -2402,7 +2402,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0",
2402
2402
  * Use of this source code is governed by an MIT-style license that can be
2403
2403
  * found in the LICENSE file at https://angular.io/license
2404
2404
  */
2405
- const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
2405
+ const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
2406
2406
  /**
2407
2407
  * @description
2408
2408
  *
@@ -2512,12 +2512,12 @@ class RouterOutlet {
2512
2512
  */
2513
2513
  get component() {
2514
2514
  if (!this.activated)
2515
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2515
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
2516
2516
  return this.activated.instance;
2517
2517
  }
2518
2518
  get activatedRoute() {
2519
2519
  if (!this.activated)
2520
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2520
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
2521
2521
  return this._activatedRoute;
2522
2522
  }
2523
2523
  get activatedRouteData() {
@@ -2531,7 +2531,7 @@ class RouterOutlet {
2531
2531
  */
2532
2532
  detach() {
2533
2533
  if (!this.activated)
2534
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2534
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
2535
2535
  this.location.detach();
2536
2536
  const cmp = this.activated;
2537
2537
  this.activated = null;
@@ -2559,7 +2559,7 @@ class RouterOutlet {
2559
2559
  }
2560
2560
  activateWith(activatedRoute, resolverOrInjector) {
2561
2561
  if (this.isActivated) {
2562
- throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$6 && 'Cannot activate an already activated outlet');
2562
+ throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$7 && 'Cannot activate an already activated outlet');
2563
2563
  }
2564
2564
  this._activatedRoute = activatedRoute;
2565
2565
  const location = this.location;
@@ -2581,9 +2581,9 @@ class RouterOutlet {
2581
2581
  this.activateEvents.emit(this.activated.instance);
2582
2582
  }
2583
2583
  }
2584
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
2585
- RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.0", type: RouterOutlet, isStandalone: true, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2586
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterOutlet, decorators: [{
2584
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
2585
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: RouterOutlet, isStandalone: true, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2586
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterOutlet, decorators: [{
2587
2587
  type: Directive,
2588
2588
  args: [{
2589
2589
  selector: 'router-outlet',
@@ -2646,9 +2646,9 @@ function isComponentFactoryResolver(item) {
2646
2646
  */
2647
2647
  class ɵEmptyOutletComponent {
2648
2648
  }
2649
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2650
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0-next.0", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2651
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2649
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2650
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2651
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2652
2652
  type: Component,
2653
2653
  args: [{
2654
2654
  template: `<router-outlet></router-outlet>`,
@@ -3055,10 +3055,20 @@ function getCanActivateChild(p) {
3055
3055
  return null;
3056
3056
  return { node: p, guards: canActivateChild };
3057
3057
  }
3058
- function getToken(token, snapshot, fallbackInjector) {
3059
- const routeInjector = getClosestRouteInjector(snapshot);
3060
- const injector = routeInjector !== null && routeInjector !== void 0 ? routeInjector : fallbackInjector;
3061
- return injector.get(token);
3058
+ function getTokenOrFunctionIdentity(tokenOrFunction, injector) {
3059
+ const NOT_FOUND = Symbol();
3060
+ const result = injector.get(tokenOrFunction, NOT_FOUND);
3061
+ if (result === NOT_FOUND) {
3062
+ if (typeof tokenOrFunction === 'function' && !ɵisInjectable(tokenOrFunction)) {
3063
+ // We think the token is just a function so return it as-is
3064
+ return tokenOrFunction;
3065
+ }
3066
+ else {
3067
+ // This will throw the not found error
3068
+ return injector.get(tokenOrFunction);
3069
+ }
3070
+ }
3071
+ return result;
3062
3072
  }
3063
3073
  function getChildRouteGuards(futureNode, currNode, contexts, futurePath, checks = {
3064
3074
  canDeactivateChecks: [],
@@ -3212,6 +3222,9 @@ function isRedirectingNavigationCancelingError(error) {
3212
3222
  function isNavigationCancelingError(error) {
3213
3223
  return error && error[NAVIGATION_CANCELING_ERROR];
3214
3224
  }
3225
+ function isEmptyError(e) {
3226
+ return e instanceof EmptyError || (e === null || e === void 0 ? void 0 : e.name) === 'EmptyError';
3227
+ }
3215
3228
 
3216
3229
  /**
3217
3230
  * @license
@@ -3254,28 +3267,28 @@ function prioritizedGuardValue() {
3254
3267
  * Use of this source code is governed by an MIT-style license that can be
3255
3268
  * found in the LICENSE file at https://angular.io/license
3256
3269
  */
3257
- function checkGuards(moduleInjector, forwardEvent) {
3270
+ function checkGuards(injector, forwardEvent) {
3258
3271
  return mergeMap(t => {
3259
3272
  const { targetSnapshot, currentSnapshot, guards: { canActivateChecks, canDeactivateChecks } } = t;
3260
3273
  if (canDeactivateChecks.length === 0 && canActivateChecks.length === 0) {
3261
3274
  return of(Object.assign(Object.assign({}, t), { guardsResult: true }));
3262
3275
  }
3263
- return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, moduleInjector)
3276
+ return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, injector)
3264
3277
  .pipe(mergeMap(canDeactivate => {
3265
3278
  return canDeactivate && isBoolean(canDeactivate) ?
3266
- runCanActivateChecks(targetSnapshot, canActivateChecks, moduleInjector, forwardEvent) :
3279
+ runCanActivateChecks(targetSnapshot, canActivateChecks, injector, forwardEvent) :
3267
3280
  of(canDeactivate);
3268
3281
  }), map(guardsResult => (Object.assign(Object.assign({}, t), { guardsResult }))));
3269
3282
  });
3270
3283
  }
3271
- function runCanDeactivateChecks(checks, futureRSS, currRSS, moduleInjector) {
3272
- return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, moduleInjector)), first(result => {
3284
+ function runCanDeactivateChecks(checks, futureRSS, currRSS, injector) {
3285
+ return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, injector)), first(result => {
3273
3286
  return result !== true;
3274
3287
  }, true));
3275
3288
  }
3276
- function runCanActivateChecks(futureSnapshot, checks, moduleInjector, forwardEvent) {
3289
+ function runCanActivateChecks(futureSnapshot, checks, injector, forwardEvent) {
3277
3290
  return from(checks).pipe(concatMap((check) => {
3278
- return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, moduleInjector), runCanActivate(futureSnapshot, check.route, moduleInjector));
3291
+ return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, injector), runCanActivate(futureSnapshot, check.route, injector));
3279
3292
  }), first(result => {
3280
3293
  return result !== true;
3281
3294
  }, true));
@@ -3308,21 +3321,24 @@ function fireChildActivationStart(snapshot, forwardEvent) {
3308
3321
  }
3309
3322
  return of(true);
3310
3323
  }
3311
- function runCanActivate(futureRSS, futureARS, moduleInjector) {
3324
+ function runCanActivate(futureRSS, futureARS, injector) {
3312
3325
  const canActivate = futureARS.routeConfig ? futureARS.routeConfig.canActivate : null;
3313
3326
  if (!canActivate || canActivate.length === 0)
3314
3327
  return of(true);
3315
- const canActivateObservables = canActivate.map((c) => {
3328
+ const canActivateObservables = canActivate.map((canActivate) => {
3316
3329
  return defer(() => {
3317
- const guard = getToken(c, futureARS, moduleInjector);
3318
- const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) :
3319
- guard(futureARS, futureRSS);
3330
+ var _a;
3331
+ const closestInjector = (_a = getClosestRouteInjector(futureARS)) !== null && _a !== void 0 ? _a : injector;
3332
+ const guard = getTokenOrFunctionIdentity(canActivate, closestInjector);
3333
+ const guardVal = isCanActivate(guard) ?
3334
+ guard.canActivate(futureARS, futureRSS) :
3335
+ closestInjector.runInContext(() => guard(futureARS, futureRSS));
3320
3336
  return wrapIntoObservable(guardVal).pipe(first());
3321
3337
  });
3322
3338
  });
3323
3339
  return of(canActivateObservables).pipe(prioritizedGuardValue());
3324
3340
  }
3325
- function runCanActivateChild(futureRSS, path, moduleInjector) {
3341
+ function runCanActivateChild(futureRSS, path, injector) {
3326
3342
  const futureARS = path[path.length - 1];
3327
3343
  const canActivateChildGuards = path.slice(0, path.length - 1)
3328
3344
  .reverse()
@@ -3330,10 +3346,13 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
3330
3346
  .filter(_ => _ !== null);
3331
3347
  const canActivateChildGuardsMapped = canActivateChildGuards.map((d) => {
3332
3348
  return defer(() => {
3333
- const guardsMapped = d.guards.map((c) => {
3334
- const guard = getToken(c, d.node, moduleInjector);
3335
- const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) :
3336
- guard(futureARS, futureRSS);
3349
+ const guardsMapped = d.guards.map((canActivateChild) => {
3350
+ var _a;
3351
+ const closestInjector = (_a = getClosestRouteInjector(d.node)) !== null && _a !== void 0 ? _a : injector;
3352
+ const guard = getTokenOrFunctionIdentity(canActivateChild, closestInjector);
3353
+ const guardVal = isCanActivateChild(guard) ?
3354
+ guard.canActivateChild(futureARS, futureRSS) :
3355
+ closestInjector.runInContext(() => guard(futureARS, futureRSS));
3337
3356
  return wrapIntoObservable(guardVal).pipe(first());
3338
3357
  });
3339
3358
  return of(guardsMapped).pipe(prioritizedGuardValue());
@@ -3341,15 +3360,17 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
3341
3360
  });
3342
3361
  return of(canActivateChildGuardsMapped).pipe(prioritizedGuardValue());
3343
3362
  }
3344
- function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector) {
3363
+ function runCanDeactivate(component, currARS, currRSS, futureRSS, injector) {
3345
3364
  const canDeactivate = currARS && currARS.routeConfig ? currARS.routeConfig.canDeactivate : null;
3346
3365
  if (!canDeactivate || canDeactivate.length === 0)
3347
3366
  return of(true);
3348
3367
  const canDeactivateObservables = canDeactivate.map((c) => {
3349
- const guard = getToken(c, currARS, moduleInjector);
3368
+ var _a;
3369
+ const closestInjector = (_a = getClosestRouteInjector(currARS)) !== null && _a !== void 0 ? _a : injector;
3370
+ const guard = getTokenOrFunctionIdentity(c, closestInjector);
3350
3371
  const guardVal = isCanDeactivate(guard) ?
3351
3372
  guard.canDeactivate(component, currARS, currRSS, futureRSS) :
3352
- guard(component, currARS, currRSS, futureRSS);
3373
+ closestInjector.runInContext(() => guard(component, currARS, currRSS, futureRSS));
3353
3374
  return wrapIntoObservable(guardVal).pipe(first());
3354
3375
  });
3355
3376
  return of(canDeactivateObservables).pipe(prioritizedGuardValue());
@@ -3360,8 +3381,10 @@ function runCanLoadGuards(injector, route, segments, urlSerializer) {
3360
3381
  return of(true);
3361
3382
  }
3362
3383
  const canLoadObservables = canLoad.map((injectionToken) => {
3363
- const guard = injector.get(injectionToken);
3364
- const guardVal = isCanLoad(guard) ? guard.canLoad(route, segments) : guard(route, segments);
3384
+ const guard = getTokenOrFunctionIdentity(injectionToken, injector);
3385
+ const guardVal = isCanLoad(guard) ?
3386
+ guard.canLoad(route, segments) :
3387
+ injector.runInContext(() => guard(route, segments));
3365
3388
  return wrapIntoObservable(guardVal);
3366
3389
  });
3367
3390
  return of(canLoadObservables)
@@ -3379,8 +3402,10 @@ function runCanMatchGuards(injector, route, segments, urlSerializer) {
3379
3402
  if (!canMatch || canMatch.length === 0)
3380
3403
  return of(true);
3381
3404
  const canMatchObservables = canMatch.map(injectionToken => {
3382
- const guard = injector.get(injectionToken);
3383
- const guardVal = isCanMatch(guard) ? guard.canMatch(route, segments) : guard(route, segments);
3405
+ const guard = getTokenOrFunctionIdentity(injectionToken, injector);
3406
+ const guardVal = isCanMatch(guard) ?
3407
+ guard.canMatch(route, segments) :
3408
+ injector.runInContext(() => guard(route, segments));
3384
3409
  return wrapIntoObservable(guardVal);
3385
3410
  });
3386
3411
  return of(canMatchObservables)
@@ -3549,7 +3574,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
3549
3574
  * Use of this source code is governed by an MIT-style license that can be
3550
3575
  * found in the LICENSE file at https://angular.io/license
3551
3576
  */
3552
- const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
3577
+ const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
3553
3578
  class NoMatch$1 {
3554
3579
  constructor(segmentGroup) {
3555
3580
  this.segmentGroup = segmentGroup || null;
@@ -3567,11 +3592,11 @@ function absoluteRedirect(newTree) {
3567
3592
  return throwError(new AbsoluteRedirect(newTree));
3568
3593
  }
3569
3594
  function namedOutletsRedirect(redirectTo) {
3570
- return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$5 &&
3595
+ return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$6 &&
3571
3596
  `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3572
3597
  }
3573
3598
  function canLoadFails(route) {
3574
- return throwError(navigationCancelingError(NG_DEV_MODE$5 &&
3599
+ return throwError(navigationCancelingError(NG_DEV_MODE$6 &&
3575
3600
  `Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
3576
3601
  }
3577
3602
  /**
@@ -3631,7 +3656,7 @@ class ApplyRedirects {
3631
3656
  }));
3632
3657
  }
3633
3658
  noMatchError(e) {
3634
- return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$5 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3659
+ return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$6 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3635
3660
  }
3636
3661
  createUrlTree(rootCandidate, queryParams, fragment) {
3637
3662
  const root = createRoot(rootCandidate);
@@ -3681,7 +3706,7 @@ class ApplyRedirects {
3681
3706
  throw e;
3682
3707
  }));
3683
3708
  }), first((s) => !!s), catchError((e, _) => {
3684
- if (e instanceof EmptyError || e.name === 'EmptyError') {
3709
+ if (isEmptyError(e)) {
3685
3710
  if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
3686
3711
  return of(new UrlSegmentGroup([], {}));
3687
3712
  }
@@ -3848,7 +3873,7 @@ class ApplyRedirects {
3848
3873
  findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3849
3874
  const pos = posParams[redirectToUrlSegment.path.substring(1)];
3850
3875
  if (!pos)
3851
- throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$5 &&
3876
+ throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$6 &&
3852
3877
  `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3853
3878
  return pos;
3854
3879
  }
@@ -3884,7 +3909,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
3884
3909
  * Use of this source code is governed by an MIT-style license that can be
3885
3910
  * found in the LICENSE file at https://angular.io/license
3886
3911
  */
3887
- const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3912
+ const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3888
3913
  class NoMatch {
3889
3914
  }
3890
3915
  function newObservableError(e) {
@@ -3973,7 +3998,7 @@ class Recognizer {
3973
3998
  // multiple activated results for the same outlet. We should merge the children of
3974
3999
  // these results so the final return value is only one `TreeNode` per outlet.
3975
4000
  const mergedChildren = mergeEmptyPathMatches(children);
3976
- if (NG_DEV_MODE$4) {
4001
+ if (NG_DEV_MODE$5) {
3977
4002
  // This should really never happen - we are only taking the first match for each
3978
4003
  // outlet and merge the empty path matches.
3979
4004
  checkOutletNameUniqueness(mergedChildren);
@@ -3987,7 +4012,7 @@ class Recognizer {
3987
4012
  var _a;
3988
4013
  return this.processSegmentAgainstRoute((_a = r._injector) !== null && _a !== void 0 ? _a : injector, r, segmentGroup, segments, outlet);
3989
4014
  }), first((x) => !!x), catchError(e => {
3990
- if (e instanceof EmptyError) {
4015
+ if (isEmptyError(e)) {
3991
4016
  if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
3992
4017
  return of([]);
3993
4018
  }
@@ -4008,7 +4033,7 @@ class Recognizer {
4008
4033
  // NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
4009
4034
  // production bundle size. This value is intended only to surface a warning to users
4010
4035
  // depending on `relativeLinkResolution: 'legacy'` in dev mode.
4011
- (NG_DEV_MODE$4 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
4036
+ (NG_DEV_MODE$5 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
4012
4037
  pathIndexShift));
4013
4038
  matchResult = of({
4014
4039
  snapshot,
@@ -4025,7 +4050,7 @@ class Recognizer {
4025
4050
  return null;
4026
4051
  }
4027
4052
  const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
4028
- const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), (_b = (_a = route.component) !== null && _a !== void 0 ? _a : route._loadedComponent) !== null && _b !== void 0 ? _b : null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$4 ?
4053
+ const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), (_b = (_a = route.component) !== null && _a !== void 0 ? _a : route._loadedComponent) !== null && _b !== void 0 ? _b : null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$5 ?
4029
4054
  getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
4030
4055
  pathIndexShift));
4031
4056
  return { snapshot, consumedSegments, remainingSegments };
@@ -4139,7 +4164,7 @@ function checkOutletNameUniqueness(nodes) {
4139
4164
  if (routeWithSameOutletName) {
4140
4165
  const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
4141
4166
  const c = n.value.url.map(s => s.toString()).join('/');
4142
- throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$4 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4167
+ throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$5 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4143
4168
  }
4144
4169
  names[n.value.outlet] = n.value;
4145
4170
  });
@@ -4197,7 +4222,7 @@ function recognize(injector, rootComponentType, config, serializer, paramsInheri
4197
4222
  * Use of this source code is governed by an MIT-style license that can be
4198
4223
  * found in the LICENSE file at https://angular.io/license
4199
4224
  */
4200
- function resolveData(paramsInheritanceStrategy, moduleInjector) {
4225
+ function resolveData(paramsInheritanceStrategy, injector) {
4201
4226
  return mergeMap(t => {
4202
4227
  const { targetSnapshot, guards: { canActivateChecks } } = t;
4203
4228
  if (!canActivateChecks.length) {
@@ -4205,17 +4230,16 @@ function resolveData(paramsInheritanceStrategy, moduleInjector) {
4205
4230
  }
4206
4231
  let canActivateChecksResolved = 0;
4207
4232
  return from(canActivateChecks)
4208
- .pipe(concatMap(check => runResolve(check.route, targetSnapshot, paramsInheritanceStrategy, moduleInjector)), tap(() => canActivateChecksResolved++), takeLast(1), mergeMap(_ => canActivateChecksResolved === canActivateChecks.length ? of(t) : EMPTY));
4233
+ .pipe(concatMap(check => runResolve(check.route, targetSnapshot, paramsInheritanceStrategy, injector)), tap(() => canActivateChecksResolved++), takeLast(1), mergeMap(_ => canActivateChecksResolved === canActivateChecks.length ? of(t) : EMPTY));
4209
4234
  });
4210
4235
  }
4211
- function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, moduleInjector) {
4236
+ function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) {
4212
4237
  const config = futureARS.routeConfig;
4213
4238
  const resolve = futureARS._resolve;
4214
4239
  if ((config === null || config === void 0 ? void 0 : config.title) !== undefined && !hasStaticTitle(config)) {
4215
4240
  resolve[RouteTitleKey] = config.title;
4216
4241
  }
4217
- return resolveNode(resolve, futureARS, futureRSS, moduleInjector)
4218
- .pipe(map((resolvedData) => {
4242
+ return resolveNode(resolve, futureARS, futureRSS, injector).pipe(map((resolvedData) => {
4219
4243
  futureARS._resolvedData = resolvedData;
4220
4244
  futureARS.data = inheritedParamsDataResolve(futureARS, paramsInheritanceStrategy).resolve;
4221
4245
  if (config && hasStaticTitle(config)) {
@@ -4224,24 +4248,28 @@ function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, moduleInjec
4224
4248
  return null;
4225
4249
  }));
4226
4250
  }
4227
- function resolveNode(resolve, futureARS, futureRSS, moduleInjector) {
4251
+ function resolveNode(resolve, futureARS, futureRSS, injector) {
4228
4252
  const keys = getDataKeys(resolve);
4229
4253
  if (keys.length === 0) {
4230
4254
  return of({});
4231
4255
  }
4232
4256
  const data = {};
4233
- return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, moduleInjector)
4257
+ return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, injector)
4234
4258
  .pipe(first(), tap((value) => {
4235
4259
  data[key] = value;
4236
- }))), takeLast(1), mapTo(data), catchError((e) => e instanceof EmptyError ? EMPTY : throwError(e)));
4260
+ }))), takeLast(1), mapTo(data), catchError((e) => isEmptyError(e) ? EMPTY : throwError(e)));
4237
4261
  }
4238
4262
  function getDataKeys(obj) {
4239
4263
  return [...Object.keys(obj), ...Object.getOwnPropertySymbols(obj)];
4240
4264
  }
4241
- function getResolver(injectionToken, futureARS, futureRSS, moduleInjector) {
4242
- const resolver = getToken(injectionToken, futureARS, moduleInjector);
4243
- return resolver.resolve ? wrapIntoObservable(resolver.resolve(futureARS, futureRSS)) :
4244
- wrapIntoObservable(resolver(futureARS, futureRSS));
4265
+ function getResolver(injectionToken, futureARS, futureRSS, injector) {
4266
+ var _a;
4267
+ const closestInjector = (_a = getClosestRouteInjector(futureARS)) !== null && _a !== void 0 ? _a : injector;
4268
+ const resolver = getTokenOrFunctionIdentity(injectionToken, closestInjector);
4269
+ const resolverValue = resolver.resolve ?
4270
+ resolver.resolve(futureARS, futureRSS) :
4271
+ closestInjector.runInContext(() => resolver(futureARS, futureRSS));
4272
+ return wrapIntoObservable(resolverValue);
4245
4273
  }
4246
4274
  function hasStaticTitle(config) {
4247
4275
  return typeof config.title === 'string' || config.title === null;
@@ -4322,9 +4350,9 @@ class TitleStrategy {
4322
4350
  return snapshot.data[RouteTitleKey];
4323
4351
  }
4324
4352
  }
4325
- TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4326
- TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4327
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: TitleStrategy, decorators: [{
4353
+ TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4354
+ TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4355
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TitleStrategy, decorators: [{
4328
4356
  type: Injectable,
4329
4357
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
4330
4358
  }] });
@@ -4348,13 +4376,25 @@ class DefaultTitleStrategy extends TitleStrategy {
4348
4376
  }
4349
4377
  }
4350
4378
  }
4351
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4352
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4353
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4379
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4380
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4381
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4354
4382
  type: Injectable,
4355
4383
  args: [{ providedIn: 'root' }]
4356
4384
  }], ctorParameters: function () { return [{ type: i1.Title }]; } });
4357
4385
 
4386
+ /**
4387
+ * @license
4388
+ * Copyright Google LLC All Rights Reserved.
4389
+ *
4390
+ * Use of this source code is governed by an MIT-style license that can be
4391
+ * found in the LICENSE file at https://angular.io/license
4392
+ */
4393
+ /**
4394
+ * Exists to aid internal migration off of the deprecated relativeLinkResolution option.
4395
+ */
4396
+ function assignRelativeLinkResolution(router) { }
4397
+
4358
4398
  /**
4359
4399
  * @license
4360
4400
  * Copyright Google LLC All Rights Reserved.
@@ -4427,13 +4467,13 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4427
4467
  * Use of this source code is governed by an MIT-style license that can be
4428
4468
  * found in the LICENSE file at https://angular.io/license
4429
4469
  */
4430
- const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4470
+ const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4431
4471
  /**
4432
4472
  * A [DI token](guide/glossary/#di-token) for the router service.
4433
4473
  *
4434
4474
  * @publicApi
4435
4475
  */
4436
- const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config' : '', {
4476
+ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$4 ? 'router config' : '', {
4437
4477
  providedIn: 'root',
4438
4478
  factory: () => ({}),
4439
4479
  });
@@ -4445,7 +4485,7 @@ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config'
4445
4485
  * Use of this source code is governed by an MIT-style license that can be
4446
4486
  * found in the LICENSE file at https://angular.io/license
4447
4487
  */
4448
- const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4488
+ const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4449
4489
  /**
4450
4490
  * The [DI token](guide/glossary/#di-token) for a router configuration.
4451
4491
  *
@@ -4480,7 +4520,7 @@ class RouterConfigLoader {
4480
4520
  if (this.onLoadEndListener) {
4481
4521
  this.onLoadEndListener(route);
4482
4522
  }
4483
- NG_DEV_MODE$2 && assertStandalone((_a = route.path) !== null && _a !== void 0 ? _a : '', component);
4523
+ NG_DEV_MODE$3 && assertStandalone((_a = route.path) !== null && _a !== void 0 ? _a : '', component);
4484
4524
  route._loadedComponent = component;
4485
4525
  }), finalize(() => {
4486
4526
  this.componentLoaders.delete(route);
@@ -4523,7 +4563,7 @@ class RouterConfigLoader {
4523
4563
  rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
4524
4564
  }
4525
4565
  const routes = rawRoutes.map(standardizeConfig);
4526
- NG_DEV_MODE$2 && validateConfig(routes, route.path, requireStandaloneComponents);
4566
+ NG_DEV_MODE$3 && validateConfig(routes, route.path, requireStandaloneComponents);
4527
4567
  return { routes, injector };
4528
4568
  }), finalize(() => {
4529
4569
  this.childrenLoaders.delete(route);
@@ -4545,9 +4585,9 @@ class RouterConfigLoader {
4545
4585
  }));
4546
4586
  }
4547
4587
  }
4548
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4549
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4550
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
4588
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4589
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4590
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
4551
4591
  type: Injectable,
4552
4592
  args: [{ providedIn: 'root' }]
4553
4593
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
@@ -4590,7 +4630,7 @@ class DefaultUrlHandlingStrategy {
4590
4630
  * Use of this source code is governed by an MIT-style license that can be
4591
4631
  * found in the LICENSE file at https://angular.io/license
4592
4632
  */
4593
- const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4633
+ const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4594
4634
  function defaultErrorHandler(error) {
4595
4635
  throw error;
4596
4636
  }
@@ -4662,6 +4702,7 @@ function setupRouter() {
4662
4702
  }
4663
4703
  router.titleStrategy = titleStrategy !== null && titleStrategy !== void 0 ? titleStrategy : defaultTitleStrategy;
4664
4704
  assignExtraOptionsToRouter(opts, router);
4705
+ assignRelativeLinkResolution(router);
4665
4706
  return router;
4666
4707
  }
4667
4708
  /**
@@ -4984,7 +5025,7 @@ class Router {
4984
5025
  complete: () => {
4985
5026
  if (!dataResolved) {
4986
5027
  this.restoreHistory(t);
4987
- this.cancelNavigationTransition(t, NG_DEV_MODE$1 ?
5028
+ this.cancelNavigationTransition(t, NG_DEV_MODE$2 ?
4988
5029
  `At least one route resolver didn't emit any value.` :
4989
5030
  '', 2 /* NavigationCancellationCode.NoDataFromResolver */);
4990
5031
  }
@@ -5053,7 +5094,7 @@ class Router {
5053
5094
  * catch-all to make sure the NavigationCancel event is fired when a
5054
5095
  * navigation gets cancelled but not caught by other means. */
5055
5096
  if (!completed && !errored) {
5056
- const cancelationReason = NG_DEV_MODE$1 ?
5097
+ const cancelationReason = NG_DEV_MODE$2 ?
5057
5098
  `Navigation ID ${overallTransitionState
5058
5099
  .id} is not equal to the current navigation id ${this.navigationId}` :
5059
5100
  '';
@@ -5213,7 +5254,7 @@ class Router {
5213
5254
  * ```
5214
5255
  */
5215
5256
  resetConfig(config) {
5216
- NG_DEV_MODE$1 && validateConfig(config);
5257
+ NG_DEV_MODE$2 && validateConfig(config);
5217
5258
  this.config = config.map(standardizeConfig);
5218
5259
  this.navigated = false;
5219
5260
  this.lastSuccessfulId = -1;
@@ -5571,9 +5612,9 @@ class Router {
5571
5612
  return { navigationId };
5572
5613
  }
5573
5614
  }
5574
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5575
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5576
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: Router, decorators: [{
5615
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5616
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5617
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Router, decorators: [{
5577
5618
  type: Injectable,
5578
5619
  args: [{
5579
5620
  providedIn: 'root',
@@ -5584,7 +5625,7 @@ function validateCommands(commands) {
5584
5625
  for (let i = 0; i < commands.length; i++) {
5585
5626
  const cmd = commands[i];
5586
5627
  if (cmd == null) {
5587
- throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$1 && `The requested path contains ${cmd} segment at index ${i}`);
5628
+ throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$2 && `The requested path contains ${cmd} segment at index ${i}`);
5588
5629
  }
5589
5630
  }
5590
5631
  }
@@ -5696,11 +5737,50 @@ class RouterLink {
5696
5737
  this.tabIndexAttribute = tabIndexAttribute;
5697
5738
  this.renderer = renderer;
5698
5739
  this.el = el;
5740
+ this._preserveFragment = false;
5741
+ this._skipLocationChange = false;
5742
+ this._replaceUrl = false;
5699
5743
  this.commands = null;
5700
5744
  /** @internal */
5701
5745
  this.onChanges = new Subject();
5702
5746
  this.setTabIndexIfNotOnNativeEl('0');
5703
5747
  }
5748
+ /**
5749
+ * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
5750
+ * `UrlCreationOptions`.
5751
+ * @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
5752
+ * @see {@link Router#createUrlTree Router#createUrlTree}
5753
+ */
5754
+ set preserveFragment(preserveFragment) {
5755
+ this._preserveFragment = ɵcoerceToBoolean(preserveFragment);
5756
+ }
5757
+ get preserveFragment() {
5758
+ return this._preserveFragment;
5759
+ }
5760
+ /**
5761
+ * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
5762
+ * `NavigationBehaviorOptions`.
5763
+ * @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
5764
+ * @see {@link Router#navigateByUrl Router#navigateByUrl}
5765
+ */
5766
+ set skipLocationChange(skipLocationChange) {
5767
+ this._skipLocationChange = ɵcoerceToBoolean(skipLocationChange);
5768
+ }
5769
+ get skipLocationChange() {
5770
+ return this._skipLocationChange;
5771
+ }
5772
+ /**
5773
+ * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
5774
+ * `NavigationBehaviorOptions`.
5775
+ * @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
5776
+ * @see {@link Router#navigateByUrl Router#navigateByUrl}
5777
+ */
5778
+ set replaceUrl(replaceUrl) {
5779
+ this._replaceUrl = ɵcoerceToBoolean(replaceUrl);
5780
+ }
5781
+ get replaceUrl() {
5782
+ return this._replaceUrl;
5783
+ }
5704
5784
  /**
5705
5785
  * Modifies the tab index if there was not a tabindex attribute on the element during
5706
5786
  * instantiation.
@@ -5747,8 +5827,8 @@ class RouterLink {
5747
5827
  return true;
5748
5828
  }
5749
5829
  const extras = {
5750
- skipLocationChange: ɵcoerceToBoolean(this.skipLocationChange),
5751
- replaceUrl: ɵcoerceToBoolean(this.replaceUrl),
5830
+ skipLocationChange: this.skipLocationChange,
5831
+ replaceUrl: this.replaceUrl,
5752
5832
  state: this.state,
5753
5833
  };
5754
5834
  this.router.navigateByUrl(this.urlTree, extras);
@@ -5765,13 +5845,13 @@ class RouterLink {
5765
5845
  queryParams: this.queryParams,
5766
5846
  fragment: this.fragment,
5767
5847
  queryParamsHandling: this.queryParamsHandling,
5768
- preserveFragment: ɵcoerceToBoolean(this.preserveFragment),
5848
+ preserveFragment: this.preserveFragment,
5769
5849
  });
5770
5850
  }
5771
5851
  }
5772
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5773
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.0", type: RouterLink, isStandalone: true, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5774
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLink, decorators: [{
5852
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5853
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: RouterLink, isStandalone: true, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5854
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterLink, decorators: [{
5775
5855
  type: Directive,
5776
5856
  args: [{
5777
5857
  selector: ':not(a):not(area)[routerLink]',
@@ -5788,16 +5868,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0",
5788
5868
  type: Input
5789
5869
  }], queryParamsHandling: [{
5790
5870
  type: Input
5871
+ }], state: [{
5872
+ type: Input
5873
+ }], relativeTo: [{
5874
+ type: Input
5791
5875
  }], preserveFragment: [{
5792
5876
  type: Input
5793
5877
  }], skipLocationChange: [{
5794
5878
  type: Input
5795
5879
  }], replaceUrl: [{
5796
5880
  type: Input
5797
- }], state: [{
5798
- type: Input
5799
- }], relativeTo: [{
5800
- type: Input
5801
5881
  }], routerLink: [{
5802
5882
  type: Input
5803
5883
  }], onClick: [{
@@ -5820,6 +5900,9 @@ class RouterLinkWithHref {
5820
5900
  this.router = router;
5821
5901
  this.route = route;
5822
5902
  this.locationStrategy = locationStrategy;
5903
+ this._preserveFragment = false;
5904
+ this._skipLocationChange = false;
5905
+ this._replaceUrl = false;
5823
5906
  this.commands = null;
5824
5907
  // the url displayed on the anchor element.
5825
5908
  // @HostBinding('attr.href') is used rather than @HostBinding() because it removes the
@@ -5833,6 +5916,42 @@ class RouterLinkWithHref {
5833
5916
  }
5834
5917
  });
5835
5918
  }
5919
+ /**
5920
+ * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
5921
+ * `UrlCreationOptions`.
5922
+ * @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
5923
+ * @see {@link Router#createUrlTree Router#createUrlTree}
5924
+ */
5925
+ set preserveFragment(preserveFragment) {
5926
+ this._preserveFragment = ɵcoerceToBoolean(preserveFragment);
5927
+ }
5928
+ get preserveFragment() {
5929
+ return this._preserveFragment;
5930
+ }
5931
+ /**
5932
+ * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
5933
+ * `NavigationBehaviorOptions`.
5934
+ * @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
5935
+ * @see {@link Router#navigateByUrl Router#navigateByUrl}
5936
+ */
5937
+ set skipLocationChange(skipLocationChange) {
5938
+ this._skipLocationChange = ɵcoerceToBoolean(skipLocationChange);
5939
+ }
5940
+ get skipLocationChange() {
5941
+ return this._skipLocationChange;
5942
+ }
5943
+ /**
5944
+ * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
5945
+ * `NavigationBehaviorOptions`.
5946
+ * @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
5947
+ * @see {@link Router#navigateByUrl Router#navigateByUrl}
5948
+ */
5949
+ set replaceUrl(replaceUrl) {
5950
+ this._replaceUrl = ɵcoerceToBoolean(replaceUrl);
5951
+ }
5952
+ get replaceUrl() {
5953
+ return this._replaceUrl;
5954
+ }
5836
5955
  /**
5837
5956
  * Commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
5838
5957
  * - **array**: commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
@@ -5866,8 +5985,8 @@ class RouterLinkWithHref {
5866
5985
  return true;
5867
5986
  }
5868
5987
  const extras = {
5869
- skipLocationChange: ɵcoerceToBoolean(this.skipLocationChange),
5870
- replaceUrl: ɵcoerceToBoolean(this.replaceUrl),
5988
+ skipLocationChange: this.skipLocationChange,
5989
+ replaceUrl: this.replaceUrl,
5871
5990
  state: this.state
5872
5991
  };
5873
5992
  this.router.navigateByUrl(this.urlTree, extras);
@@ -5889,13 +6008,13 @@ class RouterLinkWithHref {
5889
6008
  queryParams: this.queryParams,
5890
6009
  fragment: this.fragment,
5891
6010
  queryParamsHandling: this.queryParamsHandling,
5892
- preserveFragment: ɵcoerceToBoolean(this.preserveFragment),
6011
+ preserveFragment: this.preserveFragment,
5893
6012
  });
5894
6013
  }
5895
6014
  }
5896
- RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5897
- RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.0", type: RouterLinkWithHref, isStandalone: true, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
5898
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLinkWithHref, decorators: [{
6015
+ RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
6016
+ RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: RouterLinkWithHref, isStandalone: true, selector: "a[routerLink],area[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", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
6017
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5899
6018
  type: Directive,
5900
6019
  args: [{ selector: 'a[routerLink],area[routerLink]', standalone: true }]
5901
6020
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
@@ -5909,12 +6028,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0",
5909
6028
  type: Input
5910
6029
  }], queryParamsHandling: [{
5911
6030
  type: Input
5912
- }], preserveFragment: [{
5913
- type: Input
5914
- }], skipLocationChange: [{
5915
- type: Input
5916
- }], replaceUrl: [{
5917
- type: Input
5918
6031
  }], state: [{
5919
6032
  type: Input
5920
6033
  }], relativeTo: [{
@@ -5922,6 +6035,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0",
5922
6035
  }], href: [{
5923
6036
  type: HostBinding,
5924
6037
  args: ['attr.href']
6038
+ }], preserveFragment: [{
6039
+ type: Input
6040
+ }], skipLocationChange: [{
6041
+ type: Input
6042
+ }], replaceUrl: [{
6043
+ type: Input
5925
6044
  }], routerLink: [{
5926
6045
  type: Input
5927
6046
  }], onClick: [{
@@ -6122,9 +6241,9 @@ class RouterLinkActive {
6122
6241
  this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
6123
6242
  }
6124
6243
  }
6125
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6126
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.0", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
6127
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLinkActive, decorators: [{
6244
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6245
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
6246
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterLinkActive, decorators: [{
6128
6247
  type: Directive,
6129
6248
  args: [{
6130
6249
  selector: '[routerLinkActive]',
@@ -6191,9 +6310,9 @@ class PreloadAllModules {
6191
6310
  return fn().pipe(catchError(() => of(null)));
6192
6311
  }
6193
6312
  }
6194
- PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6195
- PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6196
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: PreloadAllModules, decorators: [{
6313
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6314
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6315
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PreloadAllModules, decorators: [{
6197
6316
  type: Injectable,
6198
6317
  args: [{ providedIn: 'root' }]
6199
6318
  }] });
@@ -6211,9 +6330,9 @@ class NoPreloading {
6211
6330
  return of(null);
6212
6331
  }
6213
6332
  }
6214
- NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6215
- NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6216
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: NoPreloading, decorators: [{
6333
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6334
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6335
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: NoPreloading, decorators: [{
6217
6336
  type: Injectable,
6218
6337
  args: [{ providedIn: 'root' }]
6219
6338
  }] });
@@ -6309,10 +6428,11 @@ class RouterPreloader {
6309
6428
  });
6310
6429
  }
6311
6430
  }
6312
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6313
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterPreloader });
6314
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterPreloader, decorators: [{
6315
- type: Injectable
6431
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6432
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
6433
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterPreloader, decorators: [{
6434
+ type: Injectable,
6435
+ args: [{ providedIn: 'root' }]
6316
6436
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
6317
6437
 
6318
6438
  const ROUTER_SCROLLER = new InjectionToken('');
@@ -6391,12 +6511,423 @@ class RouterScroller {
6391
6511
  }
6392
6512
  }
6393
6513
  }
6394
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6395
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterScroller });
6396
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterScroller, decorators: [{
6514
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6515
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterScroller });
6516
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterScroller, decorators: [{
6397
6517
  type: Injectable
6398
6518
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
6399
6519
 
6520
+ /**
6521
+ * @license
6522
+ * Copyright Google LLC All Rights Reserved.
6523
+ *
6524
+ * Use of this source code is governed by an MIT-style license that can be
6525
+ * found in the LICENSE file at https://angular.io/license
6526
+ */
6527
+ const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || ngDevMode;
6528
+ /**
6529
+ * Sets up providers necessary to enable `Router` functionality for the application.
6530
+ * Allows to configure a set of routes as well as extra features that should be enabled.
6531
+ *
6532
+ * @usageNotes
6533
+ *
6534
+ * Basic example of how you can add a Router to your application:
6535
+ * ```
6536
+ * const appRoutes: Routes = [];
6537
+ * bootstrapApplication(AppComponent, {
6538
+ * providers: [provideRouter(appRoutes)]
6539
+ * });
6540
+ * ```
6541
+ *
6542
+ * You can also enable optional features in the Router by adding functions from the `RouterFeatures`
6543
+ * type:
6544
+ * ```
6545
+ * const appRoutes: Routes = [];
6546
+ * bootstrapApplication(AppComponent,
6547
+ * {
6548
+ * providers: [
6549
+ * provideRouter(appRoutes,
6550
+ * withDebugTracing(),
6551
+ * withRouterConfig({paramsInheritanceStrategy: 'always'}))
6552
+ * ]
6553
+ * }
6554
+ * );
6555
+ * ```
6556
+ *
6557
+ * @see `RouterFeatures`
6558
+ *
6559
+ * @publicApi
6560
+ * @developerPreview
6561
+ * @param routes A set of `Route`s to use for the application routing table.
6562
+ * @param features Optional features to configure additional router behaviors.
6563
+ * @returns A set of providers to setup a Router.
6564
+ */
6565
+ function provideRouter(routes, ...features) {
6566
+ return [
6567
+ provideRoutes(routes), { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6568
+ { provide: APP_BOOTSTRAP_LISTENER, multi: true, useFactory: getBootstrapListener },
6569
+ features.map(feature => feature.ɵproviders),
6570
+ // TODO: All options used by the `assignExtraOptionsToRouter` factory need to be reviewed for
6571
+ // how we want them to be configured. This API doesn't currently have a way to configure them
6572
+ // and we should decide what the _best_ way to do that is rather than just sticking with the
6573
+ // status quo of how it's done today.
6574
+ ];
6575
+ }
6576
+ function rootRoute(router) {
6577
+ return router.routerState.root;
6578
+ }
6579
+ /**
6580
+ * Helper function to create an object that represents a Router feature.
6581
+ */
6582
+ function routerFeature(kind, providers) {
6583
+ return { ɵkind: kind, ɵproviders: providers };
6584
+ }
6585
+ /**
6586
+ * Registers a [DI provider](guide/glossary#provider) for a set of routes.
6587
+ * @param routes The route configuration to provide.
6588
+ *
6589
+ * @usageNotes
6590
+ *
6591
+ * ```
6592
+ * @NgModule({
6593
+ * providers: [provideRoutes(ROUTES)]
6594
+ * })
6595
+ * class LazyLoadedChildModule {}
6596
+ * ```
6597
+ *
6598
+ * @publicApi
6599
+ */
6600
+ function provideRoutes(routes) {
6601
+ return [
6602
+ { provide: ROUTES, multi: true, useValue: routes },
6603
+ ];
6604
+ }
6605
+ /**
6606
+ * Enables customizable scrolling behavior for router navigations.
6607
+ *
6608
+ * @usageNotes
6609
+ *
6610
+ * Basic example of how you can enable scrolling feature:
6611
+ * ```
6612
+ * const appRoutes: Routes = [];
6613
+ * bootstrapApplication(AppComponent,
6614
+ * {
6615
+ * providers: [
6616
+ * provideRouter(appRoutes, withInMemoryScrolling())
6617
+ * ]
6618
+ * }
6619
+ * );
6620
+ * ```
6621
+ *
6622
+ * @see `provideRouter`
6623
+ * @see `ViewportScroller`
6624
+ *
6625
+ * @publicApi
6626
+ * @developerPreview
6627
+ * @param options Set of configuration parameters to customize scrolling behavior, see
6628
+ * `InMemoryScrollingOptions` for additional information.
6629
+ * @returns A set of providers for use with `provideRouter`.
6630
+ */
6631
+ function withInMemoryScrolling(options = {}) {
6632
+ const providers = [{
6633
+ provide: ROUTER_SCROLLER,
6634
+ useFactory: () => {
6635
+ const router = inject(Router);
6636
+ const viewportScroller = inject(ViewportScroller);
6637
+ return new RouterScroller(router, viewportScroller, options);
6638
+ },
6639
+ }];
6640
+ return routerFeature(4 /* RouterFeatureKind.InMemoryScrollingFeature */, providers);
6641
+ }
6642
+ function getBootstrapListener() {
6643
+ const injector = inject(Injector);
6644
+ return (bootstrappedComponentRef) => {
6645
+ var _a, _b;
6646
+ const ref = injector.get(ApplicationRef);
6647
+ if (bootstrappedComponentRef !== ref.components[0]) {
6648
+ return;
6649
+ }
6650
+ const router = injector.get(Router);
6651
+ const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6652
+ if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
6653
+ router.initialNavigation();
6654
+ }
6655
+ (_a = injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)) === null || _a === void 0 ? void 0 : _a.setUpPreloading();
6656
+ (_b = injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)) === null || _b === void 0 ? void 0 : _b.init();
6657
+ router.resetRootComponentType(ref.componentTypes[0]);
6658
+ bootstrapDone.next();
6659
+ bootstrapDone.complete();
6660
+ };
6661
+ }
6662
+ /**
6663
+ * A subject used to indicate that the bootstrapping phase is done. When initial navigation is
6664
+ * `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
6665
+ * to the activation phase.
6666
+ */
6667
+ const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE$1 ? 'bootstrap done indicator' : '', {
6668
+ factory: () => {
6669
+ return new Subject();
6670
+ }
6671
+ });
6672
+ const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE$1 ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
6673
+ /**
6674
+ * Configures initial navigation to start before the root component is created.
6675
+ *
6676
+ * The bootstrap is blocked until the initial navigation is complete. This value is required for
6677
+ * [server-side rendering](guide/universal) to work.
6678
+ *
6679
+ * @usageNotes
6680
+ *
6681
+ * Basic example of how you can enable this navigation behavior:
6682
+ * ```
6683
+ * const appRoutes: Routes = [];
6684
+ * bootstrapApplication(AppComponent,
6685
+ * {
6686
+ * providers: [
6687
+ * provideRouter(appRoutes, withEnabledBlockingInitialNavigation())
6688
+ * ]
6689
+ * }
6690
+ * );
6691
+ * ```
6692
+ *
6693
+ * @see `provideRouter`
6694
+ *
6695
+ * @publicApi
6696
+ * @developerPreview
6697
+ * @returns A set of providers for use with `provideRouter`.
6698
+ */
6699
+ function withEnabledBlockingInitialNavigation() {
6700
+ const providers = [
6701
+ { provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
6702
+ {
6703
+ provide: APP_INITIALIZER,
6704
+ multi: true,
6705
+ deps: [Injector],
6706
+ useFactory: (injector) => {
6707
+ const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
6708
+ let initNavigation = false;
6709
+ /**
6710
+ * Performs the given action once the router finishes its next/current navigation.
6711
+ *
6712
+ * If the navigation is canceled or errors without a redirect, the navigation is considered
6713
+ * complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
6714
+ */
6715
+ function afterNextNavigation(action) {
6716
+ const router = injector.get(Router);
6717
+ router.events
6718
+ .pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
6719
+ e instanceof NavigationError), map(e => {
6720
+ if (e instanceof NavigationEnd) {
6721
+ // Navigation assumed to succeed if we get `ActivationStart`
6722
+ return true;
6723
+ }
6724
+ const redirecting = e instanceof NavigationCancel ?
6725
+ (e.code === 0 /* NavigationCancellationCode.Redirect */ ||
6726
+ e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
6727
+ false;
6728
+ return redirecting ? null : false;
6729
+ }), filter((result) => result !== null), take(1))
6730
+ .subscribe(() => {
6731
+ action();
6732
+ });
6733
+ }
6734
+ return () => {
6735
+ return locationInitialized.then(() => {
6736
+ return new Promise(resolve => {
6737
+ const router = injector.get(Router);
6738
+ const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6739
+ afterNextNavigation(() => {
6740
+ // Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
6741
+ // without a redirect.
6742
+ resolve(true);
6743
+ initNavigation = true;
6744
+ });
6745
+ router.afterPreactivation = () => {
6746
+ // Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
6747
+ // assume activation will complete successfully (even though this is not
6748
+ // guaranteed).
6749
+ resolve(true);
6750
+ // only the initial navigation should be delayed until bootstrapping is done.
6751
+ if (!initNavigation) {
6752
+ return bootstrapDone.closed ? of(void 0) : bootstrapDone;
6753
+ // subsequent navigations should not be delayed
6754
+ }
6755
+ else {
6756
+ return of(void 0);
6757
+ }
6758
+ };
6759
+ router.initialNavigation();
6760
+ });
6761
+ });
6762
+ };
6763
+ }
6764
+ },
6765
+ ];
6766
+ return routerFeature(2 /* RouterFeatureKind.EnabledBlockingInitialNavigationFeature */, providers);
6767
+ }
6768
+ /**
6769
+ * Disables initial navigation.
6770
+ *
6771
+ * Use if there is a reason to have more control over when the router starts its initial navigation
6772
+ * due to some complex initialization logic.
6773
+ *
6774
+ * @usageNotes
6775
+ *
6776
+ * Basic example of how you can disable initial navigation:
6777
+ * ```
6778
+ * const appRoutes: Routes = [];
6779
+ * bootstrapApplication(AppComponent,
6780
+ * {
6781
+ * providers: [
6782
+ * provideRouter(appRoutes, withDisabledInitialNavigation())
6783
+ * ]
6784
+ * }
6785
+ * );
6786
+ * ```
6787
+ *
6788
+ * @see `provideRouter`
6789
+ *
6790
+ * @returns A set of providers for use with `provideRouter`.
6791
+ *
6792
+ * @publicApi
6793
+ * @developerPreview
6794
+ */
6795
+ function withDisabledInitialNavigation() {
6796
+ const providers = [
6797
+ {
6798
+ provide: APP_INITIALIZER,
6799
+ multi: true,
6800
+ useFactory: () => {
6801
+ const router = inject(Router);
6802
+ return () => {
6803
+ router.setUpLocationChangeListener();
6804
+ };
6805
+ }
6806
+ },
6807
+ { provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
6808
+ ];
6809
+ return routerFeature(3 /* RouterFeatureKind.DisabledInitialNavigationFeature */, providers);
6810
+ }
6811
+ /**
6812
+ * Enables logging of all internal navigation events to the console.
6813
+ * Extra logging might be useful for debugging purposes to inspect Router event sequence.
6814
+ *
6815
+ * @usageNotes
6816
+ *
6817
+ * Basic example of how you can enable debug tracing:
6818
+ * ```
6819
+ * const appRoutes: Routes = [];
6820
+ * bootstrapApplication(AppComponent,
6821
+ * {
6822
+ * providers: [
6823
+ * provideRouter(appRoutes, withDebugTracing())
6824
+ * ]
6825
+ * }
6826
+ * );
6827
+ * ```
6828
+ *
6829
+ * @see `provideRouter`
6830
+ *
6831
+ * @returns A set of providers for use with `provideRouter`.
6832
+ *
6833
+ * @publicApi
6834
+ * @developerPreview
6835
+ */
6836
+ function withDebugTracing() {
6837
+ let providers = [];
6838
+ if (NG_DEV_MODE$1) {
6839
+ providers = [{
6840
+ provide: ENVIRONMENT_INITIALIZER,
6841
+ multi: true,
6842
+ useFactory: () => {
6843
+ const router = inject(Router);
6844
+ return () => router.events.subscribe((e) => {
6845
+ var _a, _b;
6846
+ // tslint:disable:no-console
6847
+ (_a = console.group) === null || _a === void 0 ? void 0 : _a.call(console, `Router Event: ${e.constructor.name}`);
6848
+ console.log(stringifyEvent(e));
6849
+ console.log(e);
6850
+ (_b = console.groupEnd) === null || _b === void 0 ? void 0 : _b.call(console);
6851
+ // tslint:enable:no-console
6852
+ });
6853
+ }
6854
+ }];
6855
+ }
6856
+ else {
6857
+ providers = [];
6858
+ }
6859
+ return routerFeature(1 /* RouterFeatureKind.DebugTracingFeature */, providers);
6860
+ }
6861
+ const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE$1 ? 'router preloader' : '');
6862
+ /**
6863
+ * Allows to configure a preloading strategy to use. The strategy is configured by providing a
6864
+ * reference to a class that implements a `PreloadingStrategy`.
6865
+ *
6866
+ * @usageNotes
6867
+ *
6868
+ * Basic example of how you can configure preloading:
6869
+ * ```
6870
+ * const appRoutes: Routes = [];
6871
+ * bootstrapApplication(AppComponent,
6872
+ * {
6873
+ * providers: [
6874
+ * provideRouter(appRoutes, withPreloading(PreloadAllModules))
6875
+ * ]
6876
+ * }
6877
+ * );
6878
+ * ```
6879
+ *
6880
+ * @see `provideRouter`
6881
+ *
6882
+ * @param preloadingStrategy A reference to a class that implements a `PreloadingStrategy` that
6883
+ * should be used.
6884
+ * @returns A set of providers for use with `provideRouter`.
6885
+ *
6886
+ * @publicApi
6887
+ * @developerPreview
6888
+ */
6889
+ function withPreloading(preloadingStrategy) {
6890
+ const providers = [
6891
+ { provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
6892
+ { provide: PreloadingStrategy, useExisting: preloadingStrategy },
6893
+ ];
6894
+ return routerFeature(0 /* RouterFeatureKind.PreloadingFeature */, providers);
6895
+ }
6896
+ /**
6897
+ * Allows to provide extra parameters to configure Router.
6898
+ *
6899
+ * @usageNotes
6900
+ *
6901
+ * Basic example of how you can provide extra configuration options:
6902
+ * ```
6903
+ * const appRoutes: Routes = [];
6904
+ * bootstrapApplication(AppComponent,
6905
+ * {
6906
+ * providers: [
6907
+ * provideRouter(appRoutes, withRouterConfig({
6908
+ * onSameUrlNavigation: 'reload'
6909
+ * }))
6910
+ * ]
6911
+ * }
6912
+ * );
6913
+ * ```
6914
+ *
6915
+ * @see `provideRouter`
6916
+ *
6917
+ * @param options A set of parameters to configure Router, see `RouterConfigOptions` for
6918
+ * additional information.
6919
+ * @returns A set of providers for use with `provideRouter`.
6920
+ *
6921
+ * @publicApi
6922
+ * @developerPreview
6923
+ */
6924
+ function withRouterConfig(options) {
6925
+ const providers = [
6926
+ { provide: ROUTER_CONFIGURATION, useValue: options },
6927
+ ];
6928
+ return routerFeature(5 /* RouterFeatureKind.RouterConfigurationFeature */, providers);
6929
+ }
6930
+
6400
6931
  /**
6401
6932
  * @license
6402
6933
  * Copyright Google LLC All Rights Reserved.
@@ -6413,7 +6944,6 @@ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterL
6413
6944
  * @docsNotRequired
6414
6945
  */
6415
6946
  const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
6416
- const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
6417
6947
  // TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept
6418
6948
  // here to avoid a breaking change whereby the provider order matters based on where the
6419
6949
  // `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a "breaking"
@@ -6426,9 +6956,6 @@ const ROUTER_PROVIDERS = [
6426
6956
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6427
6957
  RouterConfigLoader,
6428
6958
  ];
6429
- function rootRoute(router) {
6430
- return router.routerState.root;
6431
- }
6432
6959
  function routerNgProbeToken() {
6433
6960
  return new NgProbeToken('Router', Router);
6434
6961
  }
@@ -6478,7 +7005,7 @@ class RouterModule {
6478
7005
  ngModule: RouterModule,
6479
7006
  providers: [
6480
7007
  ROUTER_PROVIDERS,
6481
- NG_DEV_MODE ? ((config === null || config === void 0 ? void 0 : config.enableTracing) ? provideTracing() : []) : [],
7008
+ NG_DEV_MODE ? ((config === null || config === void 0 ? void 0 : config.enableTracing) ? withDebugTracing().ɵproviders : []) : [],
6482
7009
  provideRoutes(routes),
6483
7010
  {
6484
7011
  provide: ROUTER_FORROOT_GUARD,
@@ -6488,7 +7015,7 @@ class RouterModule {
6488
7015
  { provide: ROUTER_CONFIGURATION, useValue: config ? config : {} },
6489
7016
  (config === null || config === void 0 ? void 0 : config.useHash) ? provideHashLocationStrategy() : providePathLocationStrategy(),
6490
7017
  provideRouterScroller(),
6491
- (config === null || config === void 0 ? void 0 : config.preloadingStrategy) ? providePreloading(config.preloadingStrategy) : [],
7018
+ (config === null || config === void 0 ? void 0 : config.preloadingStrategy) ? withPreloading(config.preloadingStrategy).ɵproviders : [],
6492
7019
  { provide: NgProbeToken, multi: true, useFactory: routerNgProbeToken },
6493
7020
  (config === null || config === void 0 ? void 0 : config.initialNavigation) ? provideInitialNavigation(config) : [],
6494
7021
  provideRouterInitializer(),
@@ -6515,10 +7042,10 @@ class RouterModule {
6515
7042
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
6516
7043
  }
6517
7044
  }
6518
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6519
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6520
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
6521
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterModule, decorators: [{
7045
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
7046
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
7047
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
7048
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterModule, decorators: [{
6522
7049
  type: NgModule,
6523
7050
  args: [{
6524
7051
  imports: ROUTER_DIRECTIVES,
@@ -6532,6 +7059,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0",
6532
7059
  args: [ROUTER_FORROOT_GUARD]
6533
7060
  }] }];
6534
7061
  } });
7062
+ /**
7063
+ * For internal use by `RouterModule` only. Note that this differs from `withInMemoryRouterScroller`
7064
+ * because it reads from the `ExtraOptions` which should not be used in the standalone world.
7065
+ */
6535
7066
  function provideRouterScroller() {
6536
7067
  return {
6537
7068
  provide: ROUTER_SCROLLER,
@@ -6546,59 +7077,33 @@ function provideRouterScroller() {
6546
7077
  },
6547
7078
  };
6548
7079
  }
7080
+ // Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` should
7081
+ // provide hash location directly via `{provide: LocationStrategy, useClass: HashLocationStrategy}`.
6549
7082
  function provideHashLocationStrategy() {
6550
7083
  return { provide: LocationStrategy, useClass: HashLocationStrategy };
6551
7084
  }
7085
+ // Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` does not
7086
+ // need this at all because `PathLocationStrategy` is the default factory for `LocationStrategy`.
6552
7087
  function providePathLocationStrategy() {
6553
7088
  return { provide: LocationStrategy, useClass: PathLocationStrategy };
6554
7089
  }
6555
7090
  function provideForRootGuard(router) {
6556
7091
  if (NG_DEV_MODE && router) {
6557
- throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
7092
+ 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.` +
7093
+ ` Lazy loaded modules should use RouterModule.forChild() instead.`);
6558
7094
  }
6559
7095
  return 'guarded';
6560
7096
  }
6561
- /**
6562
- * Registers a [DI provider](guide/glossary#provider) for a set of routes.
6563
- * @param routes The route configuration to provide.
6564
- *
6565
- * @usageNotes
6566
- *
6567
- * ```
6568
- * @NgModule({
6569
- * imports: [RouterModule.forChild(ROUTES)],
6570
- * providers: [provideRoutes(EXTRA_ROUTES)]
6571
- * })
6572
- * class MyNgModule {}
6573
- * ```
6574
- *
6575
- * @publicApi
6576
- */
6577
- function provideRoutes(routes) {
7097
+ // Note: For internal use only with `RouterModule`. Standalone router setup with `provideRouter`
7098
+ // users call `withXInitialNavigation` directly.
7099
+ function provideInitialNavigation(config) {
6578
7100
  return [
6579
- { provide: ROUTES, multi: true, useValue: routes },
7101
+ config.initialNavigation === 'disabled' ? withDisabledInitialNavigation().ɵproviders : [],
7102
+ config.initialNavigation === 'enabledBlocking' ?
7103
+ withEnabledBlockingInitialNavigation().ɵproviders :
7104
+ [],
6580
7105
  ];
6581
7106
  }
6582
- function getBootstrapListener() {
6583
- const injector = inject(Injector);
6584
- return (bootstrappedComponentRef) => {
6585
- var _a, _b;
6586
- const ref = injector.get(ApplicationRef);
6587
- if (bootstrappedComponentRef !== ref.components[0]) {
6588
- return;
6589
- }
6590
- const router = injector.get(Router);
6591
- const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6592
- if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
6593
- router.initialNavigation();
6594
- }
6595
- (_a = injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)) === null || _a === void 0 ? void 0 : _a.setUpPreloading();
6596
- (_b = injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)) === null || _b === void 0 ? void 0 : _b.init();
6597
- router.resetRootComponentType(ref.componentTypes[0]);
6598
- bootstrapDone.next();
6599
- bootstrapDone.complete();
6600
- };
6601
- }
6602
7107
  // TODO(atscott): This should not be in the public API
6603
7108
  /**
6604
7109
  * A [DI token](guide/glossary/#di-token) for the router initializer that
@@ -6607,12 +7112,6 @@ function getBootstrapListener() {
6607
7112
  * @publicApi
6608
7113
  */
6609
7114
  const ROUTER_INITIALIZER = new InjectionToken(NG_DEV_MODE ? 'Router Initializer' : '');
6610
- function provideInitialNavigation(config) {
6611
- return [
6612
- config.initialNavigation === 'disabled' ? provideDisabledInitialNavigation() : [],
6613
- config.initialNavigation === 'enabledBlocking' ? provideEnabledBlockingInitialNavigation() : [],
6614
- ];
6615
- }
6616
7115
  function provideRouterInitializer() {
6617
7116
  return [
6618
7117
  // ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
@@ -6621,130 +7120,6 @@ function provideRouterInitializer() {
6621
7120
  { provide: APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
6622
7121
  ];
6623
7122
  }
6624
- /**
6625
- * A subject used to indicate that the bootstrapping phase is done. When initial navigation is
6626
- * `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
6627
- * to the activation phase.
6628
- */
6629
- const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicator' : '', {
6630
- factory: () => {
6631
- return new Subject();
6632
- }
6633
- });
6634
- function provideEnabledBlockingInitialNavigation() {
6635
- return [
6636
- { provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
6637
- {
6638
- provide: APP_INITIALIZER,
6639
- multi: true,
6640
- deps: [Injector],
6641
- useFactory: (injector) => {
6642
- const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
6643
- let initNavigation = false;
6644
- /**
6645
- * Performs the given action once the router finishes its next/current navigation.
6646
- *
6647
- * If the navigation is canceled or errors without a redirect, the navigation is considered
6648
- * complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
6649
- */
6650
- function afterNextNavigation(action) {
6651
- const router = injector.get(Router);
6652
- router.events
6653
- .pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
6654
- e instanceof NavigationError), map(e => {
6655
- if (e instanceof NavigationEnd) {
6656
- // Navigation assumed to succeed if we get `ActivationStart`
6657
- return true;
6658
- }
6659
- const redirecting = e instanceof NavigationCancel ?
6660
- (e.code === 0 /* NavigationCancellationCode.Redirect */ ||
6661
- e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
6662
- false;
6663
- return redirecting ? null : false;
6664
- }), filter((result) => result !== null), take(1))
6665
- .subscribe(() => {
6666
- action();
6667
- });
6668
- }
6669
- return () => {
6670
- return locationInitialized.then(() => {
6671
- return new Promise(resolve => {
6672
- const router = injector.get(Router);
6673
- const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6674
- afterNextNavigation(() => {
6675
- // Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
6676
- // without a redirect.
6677
- resolve(true);
6678
- initNavigation = true;
6679
- });
6680
- router.afterPreactivation = () => {
6681
- // Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
6682
- // assume activation will complete successfully (even though this is not
6683
- // guaranteed).
6684
- resolve(true);
6685
- // only the initial navigation should be delayed until bootstrapping is done.
6686
- if (!initNavigation) {
6687
- return bootstrapDone.closed ? of(void 0) : bootstrapDone;
6688
- // subsequent navigations should not be delayed
6689
- }
6690
- else {
6691
- return of(void 0);
6692
- }
6693
- };
6694
- router.initialNavigation();
6695
- });
6696
- });
6697
- };
6698
- }
6699
- },
6700
- ];
6701
- }
6702
- const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
6703
- function provideDisabledInitialNavigation() {
6704
- return [
6705
- {
6706
- provide: APP_INITIALIZER,
6707
- multi: true,
6708
- useFactory: () => {
6709
- const router = inject(Router);
6710
- return () => {
6711
- router.setUpLocationChangeListener();
6712
- };
6713
- }
6714
- },
6715
- { provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
6716
- ];
6717
- }
6718
- function provideTracing() {
6719
- if (NG_DEV_MODE) {
6720
- return [{
6721
- provide: ENVIRONMENT_INITIALIZER,
6722
- multi: true,
6723
- useFactory: () => {
6724
- const router = inject(Router);
6725
- return () => router.events.subscribe((e) => {
6726
- var _a, _b;
6727
- // tslint:disable:no-console
6728
- (_a = console.group) === null || _a === void 0 ? void 0 : _a.call(console, `Router Event: ${e.constructor.name}`);
6729
- console.log(stringifyEvent(e));
6730
- console.log(e);
6731
- (_b = console.groupEnd) === null || _b === void 0 ? void 0 : _b.call(console);
6732
- // tslint:enable:no-console
6733
- });
6734
- }
6735
- }];
6736
- }
6737
- else {
6738
- return [];
6739
- }
6740
- }
6741
- function providePreloading(preloadingStrategy) {
6742
- return [
6743
- RouterPreloader,
6744
- { provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
6745
- { provide: PreloadingStrategy, useExisting: preloadingStrategy },
6746
- ];
6747
- }
6748
7123
 
6749
7124
  /**
6750
7125
  * @license
@@ -6756,7 +7131,7 @@ function providePreloading(preloadingStrategy) {
6756
7131
  /**
6757
7132
  * @publicApi
6758
7133
  */
6759
- const VERSION = new Version('14.2.0-next.0');
7134
+ const VERSION = new Version('14.2.0');
6760
7135
 
6761
7136
  /**
6762
7137
  * @license
@@ -6795,5 +7170,5 @@ const VERSION = new Version('14.2.0-next.0');
6795
7170
  * Generated bundle index. Do not edit.
6796
7171
  */
6797
7172
 
6798
- export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, providePreloading as ɵprovidePreloading };
7173
+ export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRouter, provideRoutes, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withInMemoryScrolling, withPreloading, withRouterConfig, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, withPreloading as ɵwithPreloading };
6799
7174
  //# sourceMappingURL=router.mjs.map