@angular/router 14.0.1 → 14.0.4

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.
@@ -1,15 +1,15 @@
1
1
  /**
2
- * @license Angular v14.0.1
2
+ * @license Angular v14.0.4
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, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, InjectionToken, InjectFlags, NgModuleFactory, Injectable, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, Inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, ApplicationRef, Version } from '@angular/core';
8
+ import { ɵisObservable, ɵisPromise, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, InjectionToken, InjectFlags, NgModuleFactory, Injectable, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, Inject, ApplicationRef, ENVIRONMENT_INITIALIZER, Version } from '@angular/core';
9
9
  import { from, of, BehaviorSubject, combineLatest, throwError, EmptyError, concat, defer, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
10
10
  import { map, switchMap, take, startWith, scan, filter, catchError, concatMap, last as last$1, first, mergeMap, tap, takeLast, mapTo, finalize, refCount, defaultIfEmpty, mergeAll } from 'rxjs/operators';
11
11
  import * as i3 from '@angular/common';
12
- import { Location, LocationStrategy, PlatformLocation, APP_BASE_HREF, ViewportScroller, HashLocationStrategy, PathLocationStrategy, LOCATION_INITIALIZED } from '@angular/common';
12
+ import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
13
13
  import * as i1 from '@angular/platform-browser';
14
14
 
15
15
  /**
@@ -2234,7 +2234,11 @@ class RouterOutlet {
2234
2234
  }
2235
2235
  /** @nodoc */
2236
2236
  ngOnDestroy() {
2237
- this.parentContexts.onChildOutletDestroyed(this.name);
2237
+ var _a;
2238
+ // Ensure that the registered outlet is this one before removing it on the context.
2239
+ if (((_a = this.parentContexts.getContext(this.name)) === null || _a === void 0 ? void 0 : _a.outlet) === this) {
2240
+ this.parentContexts.onChildOutletDestroyed(this.name);
2241
+ }
2238
2242
  }
2239
2243
  /** @nodoc */
2240
2244
  ngOnInit() {
@@ -2332,9 +2336,9 @@ class RouterOutlet {
2332
2336
  this.activateEvents.emit(this.activated.instance);
2333
2337
  }
2334
2338
  }
2335
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
2336
- RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2337
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterOutlet, decorators: [{
2339
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
2340
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2341
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterOutlet, decorators: [{
2338
2342
  type: Directive,
2339
2343
  args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
2340
2344
  }], ctorParameters: function () {
@@ -2393,9 +2397,9 @@ function isComponentFactoryResolver(item) {
2393
2397
  */
2394
2398
  class ɵEmptyOutletComponent {
2395
2399
  }
2396
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2397
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2398
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2400
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2401
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2402
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2399
2403
  type: Component,
2400
2404
  args: [{ template: `<router-outlet></router-outlet>` }]
2401
2405
  }] });
@@ -3661,7 +3665,7 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
3661
3665
  * Use of this source code is governed by an MIT-style license that can be
3662
3666
  * found in the LICENSE file at https://angular.io/license
3663
3667
  */
3664
- const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3668
+ const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3665
3669
  class NoMatch {
3666
3670
  }
3667
3671
  function newObservableError(e) {
@@ -3783,7 +3787,7 @@ class Recognizer {
3783
3787
  // NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
3784
3788
  // production bundle size. This value is intended only to surface a warning to users
3785
3789
  // depending on `relativeLinkResolution: 'legacy'` in dev mode.
3786
- (NG_DEV_MODE$2 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3790
+ (NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3787
3791
  pathIndexShift));
3788
3792
  }
3789
3793
  else {
@@ -3794,7 +3798,7 @@ class Recognizer {
3794
3798
  consumedSegments = result.consumedSegments;
3795
3799
  remainingSegments = result.remainingSegments;
3796
3800
  const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
3797
- snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), (_d = (_c = route.component) !== null && _c !== void 0 ? _c : route._loadedComponent) !== null && _d !== void 0 ? _d : null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$2 ? getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
3801
+ snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), (_d = (_c = route.component) !== null && _c !== void 0 ? _c : route._loadedComponent) !== null && _d !== void 0 ? _d : null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
3798
3802
  pathIndexShift));
3799
3803
  }
3800
3804
  const childConfig = getChildConfig(route);
@@ -4100,7 +4104,7 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4100
4104
  * Use of this source code is governed by an MIT-style license that can be
4101
4105
  * found in the LICENSE file at https://angular.io/license
4102
4106
  */
4103
- const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4107
+ const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4104
4108
  /**
4105
4109
  * The [DI token](guide/glossary/#di-token) for a router configuration.
4106
4110
  *
@@ -4135,7 +4139,7 @@ class RouterConfigLoader {
4135
4139
  if (this.onLoadEndListener) {
4136
4140
  this.onLoadEndListener(route);
4137
4141
  }
4138
- NG_DEV_MODE$1 && assertStandalone((_a = route.path) !== null && _a !== void 0 ? _a : '', component);
4142
+ NG_DEV_MODE$2 && assertStandalone((_a = route.path) !== null && _a !== void 0 ? _a : '', component);
4139
4143
  route._loadedComponent = component;
4140
4144
  }), finalize(() => {
4141
4145
  this.componentLoaders.delete(route);
@@ -4178,7 +4182,7 @@ class RouterConfigLoader {
4178
4182
  rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
4179
4183
  }
4180
4184
  const routes = rawRoutes.map(standardizeConfig);
4181
- NG_DEV_MODE$1 && validateConfig(routes, route.path, requireStandaloneComponents);
4185
+ NG_DEV_MODE$2 && validateConfig(routes, route.path, requireStandaloneComponents);
4182
4186
  return { routes, injector };
4183
4187
  }), finalize(() => {
4184
4188
  this.childrenLoaders.delete(route);
@@ -4200,9 +4204,9 @@ class RouterConfigLoader {
4200
4204
  }));
4201
4205
  }
4202
4206
  }
4203
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4204
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterConfigLoader });
4205
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterConfigLoader, decorators: [{
4207
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4208
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterConfigLoader });
4209
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterConfigLoader, decorators: [{
4206
4210
  type: Injectable
4207
4211
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4208
4212
 
@@ -4237,19 +4241,13 @@ class DefaultUrlHandlingStrategy {
4237
4241
  }
4238
4242
  }
4239
4243
 
4240
- const NG_DEV_MODE = typeof ngDevMode === 'undefined' || !!ngDevMode;
4244
+ const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4241
4245
  function defaultErrorHandler(error) {
4242
4246
  throw error;
4243
4247
  }
4244
4248
  function defaultMalformedUriErrorHandler(error, urlSerializer, url) {
4245
4249
  return urlSerializer.parse('/');
4246
4250
  }
4247
- /**
4248
- * @internal
4249
- */
4250
- function defaultRouterHook(snapshot, runExtras) {
4251
- return of(null);
4252
- }
4253
4251
  /**
4254
4252
  * The equivalent `IsActiveMatchOptions` options for `Router.isActive` is called with `true`
4255
4253
  * (exact = true).
@@ -4329,13 +4327,12 @@ class Router {
4329
4327
  this.navigated = false;
4330
4328
  this.lastSuccessfulId = -1;
4331
4329
  /**
4332
- * Hooks that enable you to pause navigation,
4333
- * either before or after the preactivation phase.
4330
+ * Hook that enables you to pause navigation after the preactivation phase.
4334
4331
  * Used by `RouterModule`.
4335
4332
  *
4336
4333
  * @internal
4337
4334
  */
4338
- this.hooks = { beforePreactivation: defaultRouterHook, afterPreactivation: defaultRouterHook };
4335
+ this.afterPreactivation = () => of(void 0);
4339
4336
  /**
4340
4337
  * A strategy for extracting and merging URLs.
4341
4338
  * Used for AngularJS to Angular migrations.
@@ -4552,17 +4549,6 @@ class Router {
4552
4549
  }
4553
4550
  }
4554
4551
  }),
4555
- // Before Preactivation
4556
- switchTap(t => {
4557
- const { targetSnapshot, id: navigationId, extractedUrl: appliedUrlTree, rawUrl: rawUrlTree, extras: { skipLocationChange, replaceUrl } } = t;
4558
- return this.hooks.beforePreactivation(targetSnapshot, {
4559
- navigationId,
4560
- appliedUrlTree,
4561
- rawUrlTree,
4562
- skipLocationChange: !!skipLocationChange,
4563
- replaceUrl: !!replaceUrl,
4564
- });
4565
- }),
4566
4552
  // --- GUARDS ---
4567
4553
  tap(t => {
4568
4554
  const guardsStart = new GuardsCheckStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
@@ -4606,18 +4592,7 @@ class Router {
4606
4592
  }));
4607
4593
  }
4608
4594
  return undefined;
4609
- }),
4610
- // --- AFTER PREACTIVATION ---
4611
- switchTap((t) => {
4612
- const { targetSnapshot, id: navigationId, extractedUrl: appliedUrlTree, rawUrl: rawUrlTree, extras: { skipLocationChange, replaceUrl } } = t;
4613
- return this.hooks.afterPreactivation(targetSnapshot, {
4614
- navigationId,
4615
- appliedUrlTree,
4616
- rawUrlTree,
4617
- skipLocationChange: !!skipLocationChange,
4618
- replaceUrl: !!replaceUrl,
4619
- });
4620
- }),
4595
+ }), switchTap(() => this.afterPreactivation()),
4621
4596
  // --- LOAD COMPONENTS ---
4622
4597
  switchTap((t) => {
4623
4598
  const loadComponents = (route) => {
@@ -4837,7 +4812,7 @@ class Router {
4837
4812
  * ```
4838
4813
  */
4839
4814
  resetConfig(config) {
4840
- NG_DEV_MODE && validateConfig(config);
4815
+ NG_DEV_MODE$1 && validateConfig(config);
4841
4816
  this.config = config.map(standardizeConfig);
4842
4817
  this.navigated = false;
4843
4818
  this.lastSuccessfulId = -1;
@@ -5195,9 +5170,9 @@ class Router {
5195
5170
  return { navigationId };
5196
5171
  }
5197
5172
  }
5198
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5199
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: Router });
5200
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: Router, decorators: [{
5173
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5174
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: Router });
5175
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: Router, decorators: [{
5201
5176
  type: Injectable
5202
5177
  }], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
5203
5178
  function validateCommands(commands) {
@@ -5389,9 +5364,9 @@ class RouterLink {
5389
5364
  });
5390
5365
  }
5391
5366
  }
5392
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5393
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5394
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterLink, decorators: [{
5367
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5368
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5369
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLink, decorators: [{
5395
5370
  type: Directive,
5396
5371
  args: [{ selector: ':not(a):not(area)[routerLink]' }]
5397
5372
  }], ctorParameters: function () {
@@ -5510,9 +5485,9 @@ class RouterLinkWithHref {
5510
5485
  });
5511
5486
  }
5512
5487
  }
5513
- RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5514
- RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
5515
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5488
+ RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5489
+ RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
5490
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5516
5491
  type: Directive,
5517
5492
  args: [{ selector: 'a[routerLink],area[routerLink]' }]
5518
5493
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
@@ -5739,9 +5714,9 @@ class RouterLinkActive {
5739
5714
  this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
5740
5715
  }
5741
5716
  }
5742
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", 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 });
5743
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
5744
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterLinkActive, decorators: [{
5717
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", 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 });
5718
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
5719
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLinkActive, decorators: [{
5745
5720
  type: Directive,
5746
5721
  args: [{
5747
5722
  selector: '[routerLinkActive]',
@@ -5847,9 +5822,9 @@ class DefaultTitleStrategy extends TitleStrategy {
5847
5822
  }
5848
5823
  }
5849
5824
  }
5850
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
5851
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
5852
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
5825
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
5826
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
5827
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
5853
5828
  type: Injectable,
5854
5829
  args: [{ providedIn: 'root' }]
5855
5830
  }], ctorParameters: function () { return [{ type: i1.Title }]; } });
@@ -5886,6 +5861,12 @@ class PreloadAllModules {
5886
5861
  return fn().pipe(catchError(() => of(null)));
5887
5862
  }
5888
5863
  }
5864
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5865
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
5866
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: PreloadAllModules, decorators: [{
5867
+ type: Injectable,
5868
+ args: [{ providedIn: 'root' }]
5869
+ }] });
5889
5870
  /**
5890
5871
  * @description
5891
5872
  *
@@ -5900,6 +5881,12 @@ class NoPreloading {
5900
5881
  return of(null);
5901
5882
  }
5902
5883
  }
5884
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5885
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: NoPreloading, providedIn: 'root' });
5886
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: NoPreloading, decorators: [{
5887
+ type: Injectable,
5888
+ args: [{ providedIn: 'root' }]
5889
+ }] });
5903
5890
  /**
5904
5891
  * The preloader optimistically loads all router configurations to
5905
5892
  * make navigations into lazily-loaded sections of the application faster.
@@ -5984,12 +5971,13 @@ class RouterPreloader {
5984
5971
  });
5985
5972
  }
5986
5973
  }
5987
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
5988
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterPreloader });
5989
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterPreloader, decorators: [{
5974
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
5975
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterPreloader });
5976
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterPreloader, decorators: [{
5990
5977
  type: Injectable
5991
5978
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
5992
5979
 
5980
+ const ROUTER_SCROLLER = new InjectionToken('');
5993
5981
  class RouterScroller {
5994
5982
  constructor(router,
5995
5983
  /** @docsNotRequired */ viewportScroller, options = {}) {
@@ -6065,9 +6053,9 @@ class RouterScroller {
6065
6053
  }
6066
6054
  }
6067
6055
  }
6068
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6069
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterScroller });
6070
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterScroller, decorators: [{
6056
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6057
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterScroller });
6058
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterScroller, decorators: [{
6071
6059
  type: Injectable
6072
6060
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
6073
6061
 
@@ -6078,6 +6066,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImpor
6078
6066
  * Use of this source code is governed by an MIT-style license that can be
6079
6067
  * found in the LICENSE file at https://angular.io/license
6080
6068
  */
6069
+ const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
6081
6070
  /**
6082
6071
  * The directives defined in the `RouterModule`.
6083
6072
  */
@@ -6087,11 +6076,15 @@ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterL
6087
6076
  *
6088
6077
  * @publicApi
6089
6078
  */
6090
- const ROUTER_CONFIGURATION = new InjectionToken('ROUTER_CONFIGURATION');
6079
+ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE ? 'router config' : 'ROUTER_CONFIGURATION', {
6080
+ providedIn: 'root',
6081
+ factory: () => ({}),
6082
+ });
6091
6083
  /**
6092
6084
  * @docsNotRequired
6093
6085
  */
6094
- const ROUTER_FORROOT_GUARD = new InjectionToken('ROUTER_FORROOT_GUARD');
6086
+ const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
6087
+ const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
6095
6088
  const ROUTER_PROVIDERS = [
6096
6089
  Location,
6097
6090
  { provide: UrlSerializer, useClass: DefaultUrlSerializer },
@@ -6106,10 +6099,6 @@ const ROUTER_PROVIDERS = [
6106
6099
  },
6107
6100
  ChildrenOutletContexts,
6108
6101
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6109
- RouterPreloader,
6110
- NoPreloading,
6111
- PreloadAllModules,
6112
- { provide: ROUTER_CONFIGURATION, useValue: { enableTracing: false } },
6113
6102
  RouterConfigLoader,
6114
6103
  ];
6115
6104
  function routerNgProbeToken() {
@@ -6162,6 +6151,7 @@ class RouterModule {
6162
6151
  ngModule: RouterModule,
6163
6152
  providers: [
6164
6153
  ROUTER_PROVIDERS,
6154
+ NG_DEV_MODE ? ((config === null || config === void 0 ? void 0 : config.enableTracing) ? provideTracing() : []) : [],
6165
6155
  provideRoutes(routes),
6166
6156
  {
6167
6157
  provide: ROUTER_FORROOT_GUARD,
@@ -6169,22 +6159,11 @@ class RouterModule {
6169
6159
  deps: [[Router, new Optional(), new SkipSelf()]]
6170
6160
  },
6171
6161
  { provide: ROUTER_CONFIGURATION, useValue: config ? config : {} },
6172
- {
6173
- provide: LocationStrategy,
6174
- useFactory: provideLocationStrategy,
6175
- deps: [PlatformLocation, [new Inject(APP_BASE_HREF), new Optional()], ROUTER_CONFIGURATION]
6176
- },
6177
- {
6178
- provide: RouterScroller,
6179
- useFactory: createRouterScroller,
6180
- deps: [Router, ViewportScroller, ROUTER_CONFIGURATION]
6181
- },
6182
- {
6183
- provide: PreloadingStrategy,
6184
- useExisting: config && config.preloadingStrategy ? config.preloadingStrategy :
6185
- NoPreloading
6186
- },
6162
+ (config === null || config === void 0 ? void 0 : config.useHash) ? provideHashLocationStrategy() : providePathLocationStrategy(),
6163
+ provideRouterScroller(),
6164
+ (config === null || config === void 0 ? void 0 : config.preloadingStrategy) ? providePreloading(config.preloadingStrategy) : [],
6187
6165
  { provide: NgProbeToken, multi: true, useFactory: routerNgProbeToken },
6166
+ (config === null || config === void 0 ? void 0 : config.initialNavigation) ? provideInitialNavigation(config) : [],
6188
6167
  provideRouterInitializer(),
6189
6168
  ],
6190
6169
  };
@@ -6209,10 +6188,10 @@ class RouterModule {
6209
6188
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
6210
6189
  }
6211
6190
  }
6212
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6213
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6214
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterModule });
6215
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterModule, decorators: [{
6191
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6192
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.4", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6193
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterModule });
6194
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterModule, decorators: [{
6216
6195
  type: NgModule,
6217
6196
  args: [{
6218
6197
  declarations: ROUTER_DIRECTIVES,
@@ -6228,18 +6207,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImpor
6228
6207
  type: Optional
6229
6208
  }] }];
6230
6209
  } });
6231
- function createRouterScroller(router, viewportScroller, config) {
6232
- if (config.scrollOffset) {
6233
- viewportScroller.setOffset(config.scrollOffset);
6234
- }
6235
- return new RouterScroller(router, viewportScroller, config);
6210
+ function provideRouterScroller() {
6211
+ return {
6212
+ provide: ROUTER_SCROLLER,
6213
+ useFactory: () => {
6214
+ const router = inject(Router);
6215
+ const viewportScroller = inject(ViewportScroller);
6216
+ const config = inject(ROUTER_CONFIGURATION);
6217
+ if (config.scrollOffset) {
6218
+ viewportScroller.setOffset(config.scrollOffset);
6219
+ }
6220
+ return new RouterScroller(router, viewportScroller, config);
6221
+ },
6222
+ };
6223
+ }
6224
+ function provideHashLocationStrategy() {
6225
+ return { provide: LocationStrategy, useClass: HashLocationStrategy };
6236
6226
  }
6237
- function provideLocationStrategy(platformLocationStrategy, baseHref, options = {}) {
6238
- return options.useHash ? new HashLocationStrategy(platformLocationStrategy, baseHref) :
6239
- new PathLocationStrategy(platformLocationStrategy, baseHref);
6227
+ function providePathLocationStrategy() {
6228
+ return { provide: LocationStrategy, useClass: PathLocationStrategy };
6240
6229
  }
6241
6230
  function provideForRootGuard(router) {
6242
- if ((typeof ngDevMode === 'undefined' || ngDevMode) && router) {
6231
+ if (NG_DEV_MODE && router) {
6243
6232
  throw new Error(`RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
6244
6233
  }
6245
6234
  return 'guarded';
@@ -6276,17 +6265,6 @@ function setupRouter(urlSerializer, contexts, location, injector, compiler, conf
6276
6265
  }
6277
6266
  router.titleStrategy = titleStrategy !== null && titleStrategy !== void 0 ? titleStrategy : defaultTitleStrategy;
6278
6267
  assignExtraOptionsToRouter(opts, router);
6279
- if ((typeof ngDevMode === 'undefined' || ngDevMode) && opts.enableTracing) {
6280
- router.events.subscribe((e) => {
6281
- var _a, _b;
6282
- // tslint:disable:no-console
6283
- (_a = console.group) === null || _a === void 0 ? void 0 : _a.call(console, `Router Event: ${e.constructor.name}`);
6284
- console.log(stringifyEvent(e));
6285
- console.log(e);
6286
- (_b = console.groupEnd) === null || _b === void 0 ? void 0 : _b.call(console);
6287
- // tslint:enable:no-console
6288
- });
6289
- }
6290
6268
  return router;
6291
6269
  }
6292
6270
  function assignExtraOptionsToRouter(opts, router) {
@@ -6315,112 +6293,138 @@ function assignExtraOptionsToRouter(opts, router) {
6315
6293
  function rootRoute(router) {
6316
6294
  return router.routerState.root;
6317
6295
  }
6318
- /**
6319
- * Router initialization requires two steps:
6320
- *
6321
- * First, we start the navigation in a `APP_INITIALIZER` to block the bootstrap if
6322
- * a resolver or a guard executes asynchronously.
6323
- *
6324
- * Next, we actually run activation in a `BOOTSTRAP_LISTENER`, using the
6325
- * `afterPreactivation` hook provided by the router.
6326
- * The router navigation starts, reaches the point when preactivation is done, and then
6327
- * pauses. It waits for the hook to be resolved. We then resolve it only in a bootstrap listener.
6328
- */
6329
- class RouterInitializer {
6330
- constructor(injector) {
6331
- this.injector = injector;
6332
- this.initNavigation = false;
6333
- this.destroyed = false;
6334
- this.resultOfPreactivationDone = new Subject();
6335
- }
6336
- appInitializer() {
6337
- const p = this.injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
6338
- return p.then(() => {
6339
- // If the injector was destroyed, the DI lookups below will fail.
6340
- if (this.destroyed) {
6341
- return Promise.resolve(true);
6342
- }
6343
- let resolve = null;
6344
- const res = new Promise(r => resolve = r);
6345
- const router = this.injector.get(Router);
6346
- const opts = this.injector.get(ROUTER_CONFIGURATION);
6347
- if (opts.initialNavigation === 'disabled') {
6348
- router.setUpLocationChangeListener();
6349
- resolve(true);
6350
- }
6351
- else if (opts.initialNavigation === 'enabledBlocking') {
6352
- router.hooks.afterPreactivation = () => {
6353
- // only the initial navigation should be delayed
6354
- if (!this.initNavigation) {
6355
- this.initNavigation = true;
6356
- resolve(true);
6357
- return this.resultOfPreactivationDone;
6358
- // subsequent navigations should not be delayed
6359
- }
6360
- else {
6361
- return of(null);
6362
- }
6363
- };
6364
- router.initialNavigation();
6365
- }
6366
- else {
6367
- resolve(true);
6368
- }
6369
- return res;
6370
- });
6371
- }
6372
- bootstrapListener(bootstrappedComponentRef) {
6373
- const opts = this.injector.get(ROUTER_CONFIGURATION);
6374
- const preloader = this.injector.get(RouterPreloader);
6375
- const routerScroller = this.injector.get(RouterScroller);
6376
- const router = this.injector.get(Router);
6377
- const ref = this.injector.get(ApplicationRef);
6296
+ function getBootstrapListener() {
6297
+ const injector = inject(Injector);
6298
+ return (bootstrappedComponentRef) => {
6299
+ var _a, _b;
6300
+ const ref = injector.get(ApplicationRef);
6378
6301
  if (bootstrappedComponentRef !== ref.components[0]) {
6379
6302
  return;
6380
6303
  }
6304
+ const router = injector.get(Router);
6305
+ const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6381
6306
  // Default case
6382
- if (opts.initialNavigation === 'enabledNonBlocking' || opts.initialNavigation === undefined) {
6307
+ if (injector.get(INITIAL_NAVIGATION, null, InjectFlags.Optional) === null) {
6383
6308
  router.initialNavigation();
6384
6309
  }
6385
- preloader.setUpPreloading();
6386
- routerScroller.init();
6310
+ (_a = injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)) === null || _a === void 0 ? void 0 : _a.setUpPreloading();
6311
+ (_b = injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)) === null || _b === void 0 ? void 0 : _b.init();
6387
6312
  router.resetRootComponentType(ref.componentTypes[0]);
6388
- this.resultOfPreactivationDone.next(null);
6389
- this.resultOfPreactivationDone.complete();
6390
- }
6391
- ngOnDestroy() {
6392
- this.destroyed = true;
6393
- }
6394
- }
6395
- RouterInitializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterInitializer, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
6396
- RouterInitializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterInitializer });
6397
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterInitializer, decorators: [{
6398
- type: Injectable
6399
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
6400
- function getAppInitializer(r) {
6401
- return r.appInitializer.bind(r);
6402
- }
6403
- function getBootstrapListener(r) {
6404
- return r.bootstrapListener.bind(r);
6313
+ bootstrapDone.next();
6314
+ bootstrapDone.complete();
6315
+ };
6405
6316
  }
6317
+ // TODO(atscott): This should not be in the public API
6406
6318
  /**
6407
6319
  * A [DI token](guide/glossary/#di-token) for the router initializer that
6408
6320
  * is called after the app is bootstrapped.
6409
6321
  *
6410
6322
  * @publicApi
6411
6323
  */
6412
- const ROUTER_INITIALIZER = new InjectionToken('Router Initializer');
6324
+ const ROUTER_INITIALIZER = new InjectionToken(NG_DEV_MODE ? 'Router Initializer' : '');
6325
+ function provideInitialNavigation(config) {
6326
+ return [
6327
+ config.initialNavigation === 'disabled' ? provideDisabledInitialNavigation() : [],
6328
+ config.initialNavigation === 'enabledBlocking' ? provideEnabledBlockingInitialNavigation() : [],
6329
+ ];
6330
+ }
6413
6331
  function provideRouterInitializer() {
6414
6332
  return [
6415
- RouterInitializer,
6333
+ // ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
6334
+ // have `getBootstrapListener` directly attached to APP_BOOTSTRAP_LISTENER.
6335
+ { provide: ROUTER_INITIALIZER, useFactory: getBootstrapListener },
6336
+ { provide: APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
6337
+ ];
6338
+ }
6339
+ /**
6340
+ * A subject used to indicate that the bootstrapping phase is done. When initial navigation is
6341
+ * `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
6342
+ * to the activation phase.
6343
+ */
6344
+ const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicator' : '', {
6345
+ factory: () => {
6346
+ return new Subject();
6347
+ }
6348
+ });
6349
+ function provideEnabledBlockingInitialNavigation() {
6350
+ return [
6351
+ { provide: INITIAL_NAVIGATION, useValue: 'enabledBlocking' },
6416
6352
  {
6417
6353
  provide: APP_INITIALIZER,
6418
6354
  multi: true,
6419
- useFactory: getAppInitializer,
6420
- deps: [RouterInitializer]
6355
+ deps: [Injector],
6356
+ useFactory: (injector) => {
6357
+ const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
6358
+ let initNavigation = false;
6359
+ return () => {
6360
+ return locationInitialized.then(() => {
6361
+ return new Promise(resolve => {
6362
+ const router = injector.get(Router);
6363
+ const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6364
+ router.afterPreactivation = () => {
6365
+ // only the initial navigation should be delayed
6366
+ if (!initNavigation) {
6367
+ initNavigation = true;
6368
+ resolve(true);
6369
+ return bootstrapDone;
6370
+ // subsequent navigations should not be delayed
6371
+ }
6372
+ else {
6373
+ return of(void 0);
6374
+ }
6375
+ };
6376
+ router.initialNavigation();
6377
+ });
6378
+ });
6379
+ };
6380
+ }
6421
6381
  },
6422
- { provide: ROUTER_INITIALIZER, useFactory: getBootstrapListener, deps: [RouterInitializer] },
6423
- { provide: APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
6382
+ ];
6383
+ }
6384
+ const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '');
6385
+ function provideDisabledInitialNavigation() {
6386
+ return [
6387
+ {
6388
+ provide: APP_INITIALIZER,
6389
+ multi: true,
6390
+ useFactory: () => {
6391
+ const router = inject(Router);
6392
+ return () => {
6393
+ router.setUpLocationChangeListener();
6394
+ };
6395
+ }
6396
+ },
6397
+ { provide: INITIAL_NAVIGATION, useValue: 'disabled' }
6398
+ ];
6399
+ }
6400
+ function provideTracing() {
6401
+ if (NG_DEV_MODE) {
6402
+ return [{
6403
+ provide: ENVIRONMENT_INITIALIZER,
6404
+ multi: true,
6405
+ useFactory: () => {
6406
+ const router = inject(Router);
6407
+ return () => router.events.subscribe((e) => {
6408
+ var _a, _b;
6409
+ // tslint:disable:no-console
6410
+ (_a = console.group) === null || _a === void 0 ? void 0 : _a.call(console, `Router Event: ${e.constructor.name}`);
6411
+ console.log(stringifyEvent(e));
6412
+ console.log(e);
6413
+ (_b = console.groupEnd) === null || _b === void 0 ? void 0 : _b.call(console);
6414
+ // tslint:enable:no-console
6415
+ });
6416
+ }
6417
+ }];
6418
+ }
6419
+ else {
6420
+ return [];
6421
+ }
6422
+ }
6423
+ function providePreloading(preloadingStrategy) {
6424
+ return [
6425
+ RouterPreloader,
6426
+ { provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
6427
+ { provide: PreloadingStrategy, useExisting: preloadingStrategy },
6424
6428
  ];
6425
6429
  }
6426
6430
 
@@ -6434,7 +6438,7 @@ function provideRouterInitializer() {
6434
6438
  /**
6435
6439
  * @publicApi
6436
6440
  */
6437
- const VERSION = new Version('14.0.1');
6441
+ const VERSION = new Version('14.0.4');
6438
6442
 
6439
6443
  /**
6440
6444
  * @license
@@ -6473,5 +6477,5 @@ const VERSION = new Version('14.0.1');
6473
6477
  * Generated bundle index. Do not edit.
6474
6478
  */
6475
6479
 
6476
- 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, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten };
6480
+ 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, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, providePreloading as ɵprovidePreloading };
6477
6481
  //# sourceMappingURL=router.mjs.map