@angular/router 15.0.1 → 15.0.2

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 (34) hide show
  1. package/esm2020/src/components/empty_outlet.mjs +3 -3
  2. package/esm2020/src/deprecated_load_children.mjs +3 -1
  3. package/esm2020/src/directives/router_link.mjs +3 -3
  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/models.mjs +1 -1
  7. package/esm2020/src/navigation_transition.mjs +138 -78
  8. package/esm2020/src/page_title_strategy.mjs +6 -6
  9. package/esm2020/src/private_export.mjs +1 -1
  10. package/esm2020/src/provide_router.mjs +6 -3
  11. package/esm2020/src/route_reuse_strategy.mjs +6 -6
  12. package/esm2020/src/router.mjs +33 -83
  13. package/esm2020/src/router_config_loader.mjs +3 -3
  14. package/esm2020/src/router_module.mjs +9 -7
  15. package/esm2020/src/router_outlet_context.mjs +3 -3
  16. package/esm2020/src/router_preloader.mjs +9 -9
  17. package/esm2020/src/router_scroller.mjs +20 -21
  18. package/esm2020/src/router_state.mjs +1 -1
  19. package/esm2020/src/url_handling_strategy.mjs +6 -6
  20. package/esm2020/src/url_tree.mjs +4 -4
  21. package/esm2020/src/version.mjs +1 -1
  22. package/esm2020/testing/src/router_testing_module.mjs +4 -4
  23. package/fesm2015/router.mjs +381 -369
  24. package/fesm2015/router.mjs.map +1 -1
  25. package/fesm2015/testing.mjs +5 -5
  26. package/fesm2015/upgrade.mjs +1 -1
  27. package/fesm2020/router.mjs +376 -368
  28. package/fesm2020/router.mjs.map +1 -1
  29. package/fesm2020/testing.mjs +5 -5
  30. package/fesm2020/upgrade.mjs +1 -1
  31. package/index.d.ts +15 -28
  32. package/package.json +4 -4
  33. package/testing/index.d.ts +1 -1
  34. package/upgrade/index.d.ts +1 -1
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Angular v15.0.1
2
+ * @license Angular v15.0.2
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import * as i0 from '@angular/core';
8
- import { ɵisObservable, ɵisPromise, ɵRuntimeError, Injectable, EventEmitter, inject, ViewContainerRef, ChangeDetectorRef, EnvironmentInjector, Directive, Input, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, ɵisInjectable, InjectionToken, InjectFlags, NgModuleFactory, Injector, Compiler, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, ɵɵsanitizeUrlOrResourceUrl, Attribute, HostBinding, HostListener, Optional, ContentChildren, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, ENVIRONMENT_INITIALIZER, ApplicationRef, APP_INITIALIZER, NgProbeToken, SkipSelf, NgModule, Inject, Version } from '@angular/core';
8
+ import { ɵisObservable, ɵisPromise, ɵRuntimeError, Injectable, EventEmitter, inject, ViewContainerRef, ChangeDetectorRef, EnvironmentInjector, Directive, Input, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, ɵisInjectable, InjectionToken, InjectFlags, NgModuleFactory, Injector, Compiler, ɵConsole, NgZone, ɵcoerceToBoolean, ɵɵsanitizeUrlOrResourceUrl, Attribute, HostBinding, HostListener, Optional, ContentChildren, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, ENVIRONMENT_INITIALIZER, ApplicationRef, APP_INITIALIZER, NgProbeToken, SkipSelf, NgModule, Inject, Version } from '@angular/core';
9
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
11
  import { Location, ViewportScroller, LOCATION_INITIALIZED, LocationStrategy, HashLocationStrategy, PathLocationStrategy } from '@angular/common';
@@ -461,9 +461,9 @@ function mapChildrenIntoArray(segment, fn) {
461
461
  */
462
462
  class UrlSerializer {
463
463
  }
464
- UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
465
- UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
466
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlSerializer, decorators: [{
464
+ UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
465
+ UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
466
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: UrlSerializer, decorators: [{
467
467
  type: Injectable,
468
468
  args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
469
469
  }] });
@@ -2380,9 +2380,9 @@ class ChildrenOutletContexts {
2380
2380
  return this.contexts.get(childName) || null;
2381
2381
  }
2382
2382
  }
2383
- ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2384
- ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2385
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2383
+ ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2384
+ ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2385
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2386
2386
  type: Injectable,
2387
2387
  args: [{ providedIn: 'root' }]
2388
2388
  }] });
@@ -2602,9 +2602,9 @@ class RouterOutlet {
2602
2602
  this.activateEvents.emit(this.activated.instance);
2603
2603
  }
2604
2604
  }
2605
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2606
- RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: RouterOutlet, isStandalone: true, selector: "router-outlet", inputs: { name: "name" }, outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], usesOnChanges: true, ngImport: i0 });
2607
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterOutlet, decorators: [{
2605
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2606
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.2", type: RouterOutlet, isStandalone: true, selector: "router-outlet", inputs: { name: "name" }, outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], usesOnChanges: true, ngImport: i0 });
2607
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterOutlet, decorators: [{
2608
2608
  type: Directive,
2609
2609
  args: [{
2610
2610
  selector: 'router-outlet',
@@ -2664,9 +2664,9 @@ function isComponentFactoryResolver(item) {
2664
2664
  */
2665
2665
  class ɵEmptyOutletComponent {
2666
2666
  }
2667
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2668
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2669
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2667
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2668
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.2", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2669
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2670
2670
  type: Component,
2671
2671
  args: [{
2672
2672
  template: `<router-outlet></router-outlet>`,
@@ -4285,6 +4285,19 @@ function switchTap(next) {
4285
4285
  });
4286
4286
  }
4287
4287
 
4288
+ /**
4289
+ * @license
4290
+ * Copyright Google LLC All Rights Reserved.
4291
+ *
4292
+ * Use of this source code is governed by an MIT-style license that can be
4293
+ * found in the LICENSE file at https://angular.io/license
4294
+ */
4295
+ // This file exists to support the legacy `loadChildren: string` behavior being patched back into
4296
+ // Angular.
4297
+ function deprecatedLoadChildrenString(injector, loadChildren) {
4298
+ return null;
4299
+ }
4300
+
4288
4301
  /**
4289
4302
  * @license
4290
4303
  * Copyright Google LLC All Rights Reserved.
@@ -4293,16 +4306,185 @@ function switchTap(next) {
4293
4306
  * found in the LICENSE file at https://angular.io/license
4294
4307
  */
4295
4308
  const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4309
+ /**
4310
+ * The [DI token](guide/glossary/#di-token) for a router configuration.
4311
+ *
4312
+ * `ROUTES` is a low level API for router configuration via dependency injection.
4313
+ *
4314
+ * We recommend that in almost all cases to use higher level APIs such as `RouterModule.forRoot()`,
4315
+ * `RouterModule.forChild()`, `provideRoutes`, or `Router.resetConfig()`.
4316
+ *
4317
+ * @publicApi
4318
+ */
4319
+ const ROUTES = new InjectionToken('ROUTES');
4320
+ class RouterConfigLoader {
4321
+ constructor(injector, compiler) {
4322
+ this.injector = injector;
4323
+ this.compiler = compiler;
4324
+ this.componentLoaders = new WeakMap();
4325
+ this.childrenLoaders = new WeakMap();
4326
+ }
4327
+ loadComponent(route) {
4328
+ if (this.componentLoaders.get(route)) {
4329
+ return this.componentLoaders.get(route);
4330
+ }
4331
+ else if (route._loadedComponent) {
4332
+ return of(route._loadedComponent);
4333
+ }
4334
+ if (this.onLoadStartListener) {
4335
+ this.onLoadStartListener(route);
4336
+ }
4337
+ const loadRunner = wrapIntoObservable(route.loadComponent())
4338
+ .pipe(map(maybeUnwrapDefaultExport), tap(component => {
4339
+ if (this.onLoadEndListener) {
4340
+ this.onLoadEndListener(route);
4341
+ }
4342
+ NG_DEV_MODE$5 && assertStandalone(route.path ?? '', component);
4343
+ route._loadedComponent = component;
4344
+ }), finalize(() => {
4345
+ this.componentLoaders.delete(route);
4346
+ }));
4347
+ // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
4348
+ const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());
4349
+ this.componentLoaders.set(route, loader);
4350
+ return loader;
4351
+ }
4352
+ loadChildren(parentInjector, route) {
4353
+ if (this.childrenLoaders.get(route)) {
4354
+ return this.childrenLoaders.get(route);
4355
+ }
4356
+ else if (route._loadedRoutes) {
4357
+ return of({ routes: route._loadedRoutes, injector: route._loadedInjector });
4358
+ }
4359
+ if (this.onLoadStartListener) {
4360
+ this.onLoadStartListener(route);
4361
+ }
4362
+ const moduleFactoryOrRoutes$ = this.loadModuleFactoryOrRoutes(route.loadChildren);
4363
+ const loadRunner = moduleFactoryOrRoutes$.pipe(map((factoryOrRoutes) => {
4364
+ if (this.onLoadEndListener) {
4365
+ this.onLoadEndListener(route);
4366
+ }
4367
+ // This injector comes from the `NgModuleRef` when lazy loading an `NgModule`. There is no
4368
+ // injector associated with lazy loading a `Route` array.
4369
+ let injector;
4370
+ let rawRoutes;
4371
+ let requireStandaloneComponents = false;
4372
+ if (Array.isArray(factoryOrRoutes)) {
4373
+ rawRoutes = factoryOrRoutes;
4374
+ requireStandaloneComponents = true;
4375
+ }
4376
+ else {
4377
+ injector = factoryOrRoutes.create(parentInjector).injector;
4378
+ // When loading a module that doesn't provide `RouterModule.forChild()` preloader
4379
+ // will get stuck in an infinite loop. The child module's Injector will look to
4380
+ // its parent `Injector` when it doesn't find any ROUTES so it will return routes
4381
+ // for it's parent module instead.
4382
+ rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
4383
+ }
4384
+ const routes = rawRoutes.map(standardizeConfig);
4385
+ NG_DEV_MODE$5 && validateConfig(routes, route.path, requireStandaloneComponents);
4386
+ return { routes, injector };
4387
+ }), finalize(() => {
4388
+ this.childrenLoaders.delete(route);
4389
+ }));
4390
+ // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
4391
+ const loader = new ConnectableObservable(loadRunner, () => new Subject())
4392
+ .pipe(refCount());
4393
+ this.childrenLoaders.set(route, loader);
4394
+ return loader;
4395
+ }
4396
+ loadModuleFactoryOrRoutes(loadChildren) {
4397
+ const deprecatedResult = deprecatedLoadChildrenString(this.injector, loadChildren);
4398
+ if (deprecatedResult) {
4399
+ return deprecatedResult;
4400
+ }
4401
+ return wrapIntoObservable(loadChildren())
4402
+ .pipe(map(maybeUnwrapDefaultExport), mergeMap((t) => {
4403
+ if (t instanceof NgModuleFactory || Array.isArray(t)) {
4404
+ return of(t);
4405
+ }
4406
+ else {
4407
+ return from(this.compiler.compileModuleAsync(t));
4408
+ }
4409
+ }));
4410
+ }
4411
+ }
4412
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4413
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4414
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterConfigLoader, decorators: [{
4415
+ type: Injectable,
4416
+ args: [{ providedIn: 'root' }]
4417
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4418
+ function isWrappedDefaultExport(value) {
4419
+ // We use `in` here with a string key `'default'`, because we expect `DefaultExport` objects to be
4420
+ // dynamically imported ES modules with a spec-mandated `default` key. Thus we don't expect that
4421
+ // `default` will be a renamed property.
4422
+ return value && typeof value === 'object' && 'default' in value;
4423
+ }
4424
+ function maybeUnwrapDefaultExport(input) {
4425
+ // As per `isWrappedDefaultExport`, the `default` key here is generated by the browser and not
4426
+ // subject to property renaming, so we reference it with bracket access.
4427
+ return isWrappedDefaultExport(input) ? input['default'] : input;
4428
+ }
4429
+
4430
+ /**
4431
+ * @license
4432
+ * Copyright Google LLC All Rights Reserved.
4433
+ *
4434
+ * Use of this source code is governed by an MIT-style license that can be
4435
+ * found in the LICENSE file at https://angular.io/license
4436
+ */
4437
+ const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4296
4438
  class NavigationTransitions {
4297
- constructor(router) {
4298
- this.router = router;
4439
+ constructor() {
4299
4440
  this.currentNavigation = null;
4441
+ this.lastSuccessfulNavigation = null;
4442
+ this.events = new Subject();
4443
+ this.configLoader = inject(RouterConfigLoader);
4444
+ this.environmentInjector = inject(EnvironmentInjector);
4445
+ this.urlSerializer = inject(UrlSerializer);
4446
+ this.rootContexts = inject(ChildrenOutletContexts);
4447
+ this.navigationId = 0;
4448
+ const onLoadStart = (r) => this.events.next(new RouteConfigLoadStart(r));
4449
+ const onLoadEnd = (r) => this.events.next(new RouteConfigLoadEnd(r));
4450
+ this.configLoader.onLoadEndListener = onLoadEnd;
4451
+ this.configLoader.onLoadStartListener = onLoadStart;
4452
+ }
4453
+ get hasRequestedNavigation() {
4454
+ return this.navigationId !== 0;
4300
4455
  }
4301
- setupNavigations(transitions) {
4302
- const eventsSubject = this.router.events;
4303
- return transitions.pipe(filter(t => t.id !== 0),
4456
+ complete() {
4457
+ this.transitions?.complete();
4458
+ }
4459
+ handleNavigationRequest(request) {
4460
+ const id = ++this.navigationId;
4461
+ this.transitions?.next({ ...this.transitions.value, ...request, id });
4462
+ }
4463
+ setupNavigations(router) {
4464
+ this.transitions = new BehaviorSubject({
4465
+ id: 0,
4466
+ targetPageId: 0,
4467
+ currentUrlTree: router.currentUrlTree,
4468
+ currentRawUrl: router.currentUrlTree,
4469
+ extractedUrl: router.urlHandlingStrategy.extract(router.currentUrlTree),
4470
+ urlAfterRedirects: router.urlHandlingStrategy.extract(router.currentUrlTree),
4471
+ rawUrl: router.currentUrlTree,
4472
+ extras: {},
4473
+ resolve: null,
4474
+ reject: null,
4475
+ promise: Promise.resolve(true),
4476
+ source: 'imperative',
4477
+ restoredState: null,
4478
+ currentSnapshot: router.routerState.snapshot,
4479
+ targetSnapshot: null,
4480
+ currentRouterState: router.routerState,
4481
+ targetRouterState: null,
4482
+ guards: { canActivateChecks: [], canDeactivateChecks: [] },
4483
+ guardsResult: null,
4484
+ });
4485
+ return this.transitions.pipe(filter(t => t.id !== 0),
4304
4486
  // Extract URL
4305
- map(t => ({ ...t, extractedUrl: this.router.urlHandlingStrategy.extract(t.rawUrl) })),
4487
+ map(t => ({ ...t, extractedUrl: router.urlHandlingStrategy.extract(t.rawUrl) })),
4306
4488
  // Using switchMap so we cancel executing navigations when a new one comes in
4307
4489
  switchMap(overallTransitionState => {
4308
4490
  let completed = false;
@@ -4317,35 +4499,34 @@ class NavigationTransitions {
4317
4499
  extractedUrl: t.extractedUrl,
4318
4500
  trigger: t.source,
4319
4501
  extras: t.extras,
4320
- previousNavigation: !this.router.lastSuccessfulNavigation ? null : {
4321
- ...this.router.lastSuccessfulNavigation,
4502
+ previousNavigation: !this.lastSuccessfulNavigation ? null : {
4503
+ ...this.lastSuccessfulNavigation,
4322
4504
  previousNavigation: null,
4323
4505
  },
4324
4506
  };
4325
4507
  }), switchMap(t => {
4326
- const browserUrlTree = this.router.browserUrlTree.toString();
4327
- const urlTransition = !this.router.navigated ||
4508
+ const browserUrlTree = router.browserUrlTree.toString();
4509
+ const urlTransition = !router.navigated ||
4328
4510
  t.extractedUrl.toString() !== browserUrlTree ||
4329
4511
  // Navigations which succeed or ones which fail and are cleaned up
4330
4512
  // correctly should result in `browserUrlTree` and `currentUrlTree`
4331
4513
  // matching. If this is not the case, assume something went wrong and
4332
4514
  // try processing the URL again.
4333
- browserUrlTree !== this.router.currentUrlTree.toString();
4334
- const processCurrentUrl = (this.router.onSameUrlNavigation === 'reload' ? true :
4335
- urlTransition) &&
4336
- this.router.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
4515
+ browserUrlTree !== router.currentUrlTree.toString();
4516
+ const processCurrentUrl = (router.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
4517
+ router.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
4337
4518
  if (processCurrentUrl) {
4338
4519
  // If the source of the navigation is from a browser event, the URL is
4339
4520
  // already updated. We already need to sync the internal state.
4340
4521
  if (isBrowserTriggeredNavigation(t.source)) {
4341
- this.router.browserUrlTree = t.extractedUrl;
4522
+ router.browserUrlTree = t.extractedUrl;
4342
4523
  }
4343
4524
  return of(t).pipe(
4344
4525
  // Fire NavigationStart event
4345
4526
  switchMap(t => {
4346
- const transition = this.router.transitions.getValue();
4347
- eventsSubject.next(new NavigationStart(t.id, this.router.serializeUrl(t.extractedUrl), t.source, t.restoredState));
4348
- if (transition !== this.router.transitions.getValue()) {
4527
+ const transition = this.transitions?.getValue();
4528
+ this.events.next(new NavigationStart(t.id, this.urlSerializer.serialize(t.extractedUrl), t.source, t.restoredState));
4529
+ if (transition !== this.transitions?.getValue()) {
4349
4530
  return EMPTY;
4350
4531
  }
4351
4532
  // This delay is required to match old behavior that forced
@@ -4353,7 +4534,7 @@ class NavigationTransitions {
4353
4534
  return Promise.resolve(t);
4354
4535
  }),
4355
4536
  // ApplyRedirects
4356
- applyRedirects(this.router.ngModule.injector, this.router.configLoader, this.router.urlSerializer, this.router.config),
4537
+ applyRedirects(this.environmentInjector, this.configLoader, this.urlSerializer, router.config),
4357
4538
  // Update the currentNavigation
4358
4539
  // `urlAfterRedirects` is guaranteed to be set after this point
4359
4540
  tap(t => {
@@ -4364,33 +4545,33 @@ class NavigationTransitions {
4364
4545
  overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
4365
4546
  }),
4366
4547
  // Recognize
4367
- recognize(this.router.ngModule.injector, this.router.rootComponentType, this.router.config, this.router.urlSerializer, this.router.paramsInheritanceStrategy),
4548
+ recognize(this.environmentInjector, router.rootComponentType, router.config, this.urlSerializer, router.paramsInheritanceStrategy),
4368
4549
  // Update URL if in `eager` update mode
4369
4550
  tap(t => {
4370
4551
  overallTransitionState.targetSnapshot = t.targetSnapshot;
4371
- if (this.router.urlUpdateStrategy === 'eager') {
4552
+ if (router.urlUpdateStrategy === 'eager') {
4372
4553
  if (!t.extras.skipLocationChange) {
4373
- const rawUrl = this.router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4374
- this.router.setBrowserUrl(rawUrl, t);
4554
+ const rawUrl = router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4555
+ router.setBrowserUrl(rawUrl, t);
4375
4556
  }
4376
- this.router.browserUrlTree = t.urlAfterRedirects;
4557
+ router.browserUrlTree = t.urlAfterRedirects;
4377
4558
  }
4378
4559
  // Fire RoutesRecognized
4379
- const routesRecognized = new RoutesRecognized(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4380
- eventsSubject.next(routesRecognized);
4560
+ const routesRecognized = new RoutesRecognized(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4561
+ this.events.next(routesRecognized);
4381
4562
  }));
4382
4563
  }
4383
4564
  else {
4384
- const processPreviousUrl = urlTransition && this.router.rawUrlTree &&
4385
- this.router.urlHandlingStrategy.shouldProcessUrl(this.router.rawUrlTree);
4565
+ const processPreviousUrl = urlTransition && router.rawUrlTree &&
4566
+ router.urlHandlingStrategy.shouldProcessUrl(router.rawUrlTree);
4386
4567
  /* When the current URL shouldn't be processed, but the previous one
4387
4568
  * was, we handle this "error condition" by navigating to the
4388
4569
  * previously successful URL, but leaving the URL intact.*/
4389
4570
  if (processPreviousUrl) {
4390
4571
  const { id, extractedUrl, source, restoredState, extras } = t;
4391
- const navStart = new NavigationStart(id, this.router.serializeUrl(extractedUrl), source, restoredState);
4392
- eventsSubject.next(navStart);
4393
- const targetSnapshot = createEmptyState(extractedUrl, this.router.rootComponentType)
4572
+ const navStart = new NavigationStart(id, this.urlSerializer.serialize(extractedUrl), source, restoredState);
4573
+ this.events.next(navStart);
4574
+ const targetSnapshot = createEmptyState(extractedUrl, router.rootComponentType)
4394
4575
  .snapshot;
4395
4576
  overallTransitionState = {
4396
4577
  ...t,
@@ -4406,7 +4587,7 @@ class NavigationTransitions {
4406
4587
  * current "settled" URL. This way the next navigation will be coming
4407
4588
  * from the current URL in the browser.
4408
4589
  */
4409
- this.router.rawUrlTree = t.rawUrl;
4590
+ router.rawUrlTree = t.rawUrl;
4410
4591
  t.resolve(null);
4411
4592
  return EMPTY;
4412
4593
  }
@@ -4414,25 +4595,25 @@ class NavigationTransitions {
4414
4595
  }),
4415
4596
  // --- GUARDS ---
4416
4597
  tap(t => {
4417
- const guardsStart = new GuardsCheckStart(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4418
- this.router.triggerEvent(guardsStart);
4598
+ const guardsStart = new GuardsCheckStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4599
+ this.events.next(guardsStart);
4419
4600
  }), map(t => {
4420
4601
  overallTransitionState = {
4421
4602
  ...t,
4422
- guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.router.rootContexts)
4603
+ guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)
4423
4604
  };
4424
4605
  return overallTransitionState;
4425
- }), checkGuards(this.router.ngModule.injector, (evt) => this.router.triggerEvent(evt)), tap(t => {
4606
+ }), checkGuards(this.environmentInjector, (evt) => this.events.next(evt)), tap(t => {
4426
4607
  overallTransitionState.guardsResult = t.guardsResult;
4427
4608
  if (isUrlTree(t.guardsResult)) {
4428
- throw redirectingNavigationError(this.router.urlSerializer, t.guardsResult);
4609
+ throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
4429
4610
  }
4430
- const guardsEnd = new GuardsCheckEnd(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
4431
- this.router.triggerEvent(guardsEnd);
4611
+ const guardsEnd = new GuardsCheckEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
4612
+ this.events.next(guardsEnd);
4432
4613
  }), filter(t => {
4433
4614
  if (!t.guardsResult) {
4434
- this.router.restoreHistory(t);
4435
- this.router.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */);
4615
+ router.restoreHistory(t);
4616
+ this.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */, router);
4436
4617
  return false;
4437
4618
  }
4438
4619
  return true;
@@ -4441,24 +4622,24 @@ class NavigationTransitions {
4441
4622
  switchTap(t => {
4442
4623
  if (t.guards.canActivateChecks.length) {
4443
4624
  return of(t).pipe(tap(t => {
4444
- const resolveStart = new ResolveStart(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4445
- this.router.triggerEvent(resolveStart);
4625
+ const resolveStart = new ResolveStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4626
+ this.events.next(resolveStart);
4446
4627
  }), switchMap(t => {
4447
4628
  let dataResolved = false;
4448
- return of(t).pipe(resolveData(this.router.paramsInheritanceStrategy, this.router.ngModule.injector), tap({
4629
+ return of(t).pipe(resolveData(router.paramsInheritanceStrategy, this.environmentInjector), tap({
4449
4630
  next: () => dataResolved = true,
4450
4631
  complete: () => {
4451
4632
  if (!dataResolved) {
4452
- this.router.restoreHistory(t);
4453
- this.router.cancelNavigationTransition(t, NG_DEV_MODE$5 ?
4633
+ router.restoreHistory(t);
4634
+ this.cancelNavigationTransition(t, NG_DEV_MODE$4 ?
4454
4635
  `At least one route resolver didn't emit any value.` :
4455
- '', 2 /* NavigationCancellationCode.NoDataFromResolver */);
4636
+ '', 2 /* NavigationCancellationCode.NoDataFromResolver */, router);
4456
4637
  }
4457
4638
  }
4458
4639
  }));
4459
4640
  }), tap(t => {
4460
- const resolveEnd = new ResolveEnd(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4461
- this.router.triggerEvent(resolveEnd);
4641
+ const resolveEnd = new ResolveEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4642
+ this.events.next(resolveEnd);
4462
4643
  }));
4463
4644
  }
4464
4645
  return undefined;
@@ -4469,7 +4650,7 @@ class NavigationTransitions {
4469
4650
  const loaders = [];
4470
4651
  if (route.routeConfig?.loadComponent &&
4471
4652
  !route.routeConfig._loadedComponent) {
4472
- loaders.push(this.router.configLoader.loadComponent(route.routeConfig)
4653
+ loaders.push(this.configLoader.loadComponent(route.routeConfig)
4473
4654
  .pipe(tap(loadedComponent => {
4474
4655
  route.component = loadedComponent;
4475
4656
  }), map(() => void 0)));
@@ -4481,8 +4662,8 @@ class NavigationTransitions {
4481
4662
  };
4482
4663
  return combineLatest(loadComponents(t.targetSnapshot.root))
4483
4664
  .pipe(defaultIfEmpty(), take(1));
4484
- }), switchTap(() => this.router.afterPreactivation()), map((t) => {
4485
- const targetRouterState = createRouterState(this.router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4665
+ }), switchTap(() => router.afterPreactivation()), map((t) => {
4666
+ const targetRouterState = createRouterState(router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4486
4667
  overallTransitionState = { ...t, targetRouterState };
4487
4668
  return (overallTransitionState);
4488
4669
  }),
@@ -4492,21 +4673,27 @@ class NavigationTransitions {
4492
4673
  the current URL and the RouterState, as well as updated the browser URL.
4493
4674
  All this should happen *before* activating. */
4494
4675
  tap((t) => {
4495
- this.router.currentUrlTree = t.urlAfterRedirects;
4496
- this.router.rawUrlTree = this.router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4497
- this.router.routerState =
4676
+ router.currentUrlTree = t.urlAfterRedirects;
4677
+ router.rawUrlTree =
4678
+ router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4679
+ router.routerState =
4498
4680
  t.targetRouterState;
4499
- if (this.router.urlUpdateStrategy === 'deferred') {
4681
+ if (router.urlUpdateStrategy === 'deferred') {
4500
4682
  if (!t.extras.skipLocationChange) {
4501
- this.router.setBrowserUrl(this.router.rawUrlTree, t);
4683
+ router.setBrowserUrl(router.rawUrlTree, t);
4502
4684
  }
4503
- this.router.browserUrlTree = t.urlAfterRedirects;
4685
+ router.browserUrlTree = t.urlAfterRedirects;
4504
4686
  }
4505
- }), activateRoutes(this.router.rootContexts, this.router.routeReuseStrategy, (evt) => this.router.triggerEvent(evt)), tap({
4506
- next() {
4687
+ }), activateRoutes(this.rootContexts, router.routeReuseStrategy, (evt) => this.events.next(evt)), tap({
4688
+ next: (t) => {
4507
4689
  completed = true;
4690
+ this.lastSuccessfulNavigation = this.currentNavigation;
4691
+ router.navigated = true;
4692
+ this.events.next(new NavigationEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(router.currentUrlTree)));
4693
+ router.titleStrategy?.updateTitle(t.targetRouterState.snapshot);
4694
+ t.resolve(true);
4508
4695
  },
4509
- complete() {
4696
+ complete: () => {
4510
4697
  completed = true;
4511
4698
  }
4512
4699
  }), finalize(() => {
@@ -4517,11 +4704,11 @@ class NavigationTransitions {
4517
4704
  * catch-all to make sure the NavigationCancel event is fired when a
4518
4705
  * navigation gets cancelled but not caught by other means. */
4519
4706
  if (!completed && !errored) {
4520
- const cancelationReason = NG_DEV_MODE$5 ?
4707
+ const cancelationReason = NG_DEV_MODE$4 ?
4521
4708
  `Navigation ID ${overallTransitionState
4522
- .id} is not equal to the current navigation id ${this.router.navigationId}` :
4709
+ .id} is not equal to the current navigation id ${this.navigationId}` :
4523
4710
  '';
4524
- this.router.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
4711
+ this.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */, router);
4525
4712
  }
4526
4713
  // Only clear current navigation if it is still set to the one that
4527
4714
  // finalized.
@@ -4540,28 +4727,28 @@ class NavigationTransitions {
4540
4727
  // navigate. This is only applicable with initial navigation, so
4541
4728
  // setting `navigated` only when not redirecting resolves this
4542
4729
  // scenario.
4543
- this.router.navigated = true;
4544
- this.router.restoreHistory(overallTransitionState, true);
4730
+ router.navigated = true;
4731
+ router.restoreHistory(overallTransitionState, true);
4545
4732
  }
4546
- const navCancel = new NavigationCancel(overallTransitionState.id, this.router.serializeUrl(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
4547
- eventsSubject.next(navCancel);
4733
+ const navCancel = new NavigationCancel(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
4734
+ this.events.next(navCancel);
4548
4735
  // When redirecting, we need to delay resolving the navigation
4549
4736
  // promise and push it to the redirect navigation
4550
4737
  if (!isRedirectingNavigationCancelingError$1(e)) {
4551
4738
  overallTransitionState.resolve(false);
4552
4739
  }
4553
4740
  else {
4554
- const mergedTree = this.router.urlHandlingStrategy.merge(e.url, this.router.rawUrlTree);
4741
+ const mergedTree = router.urlHandlingStrategy.merge(e.url, router.rawUrlTree);
4555
4742
  const extras = {
4556
4743
  skipLocationChange: overallTransitionState.extras.skipLocationChange,
4557
4744
  // The URL is already updated at this point if we have 'eager' URL
4558
4745
  // updates or if the navigation was triggered by the browser (back
4559
4746
  // button, URL bar, etc). We want to replace that item in history
4560
4747
  // if the navigation is rejected.
4561
- replaceUrl: this.router.urlUpdateStrategy === 'eager' ||
4748
+ replaceUrl: router.urlUpdateStrategy === 'eager' ||
4562
4749
  isBrowserTriggeredNavigation(overallTransitionState.source)
4563
4750
  };
4564
- this.router.scheduleNavigation(mergedTree, 'imperative', null, extras, {
4751
+ router.scheduleNavigation(mergedTree, 'imperative', null, extras, {
4565
4752
  resolve: overallTransitionState.resolve,
4566
4753
  reject: overallTransitionState.reject,
4567
4754
  promise: overallTransitionState.promise
@@ -4571,11 +4758,11 @@ class NavigationTransitions {
4571
4758
  * to the pre-error state. */
4572
4759
  }
4573
4760
  else {
4574
- this.router.restoreHistory(overallTransitionState, true);
4575
- const navError = new NavigationError(overallTransitionState.id, this.router.serializeUrl(overallTransitionState.extractedUrl), e, overallTransitionState.targetSnapshot ?? undefined);
4576
- eventsSubject.next(navError);
4761
+ router.restoreHistory(overallTransitionState, true);
4762
+ const navError = new NavigationError(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e, overallTransitionState.targetSnapshot ?? undefined);
4763
+ this.events.next(navError);
4577
4764
  try {
4578
- overallTransitionState.resolve(this.router.errorHandler(e));
4765
+ overallTransitionState.resolve(router.errorHandler(e));
4579
4766
  }
4580
4767
  catch (ee) {
4581
4768
  overallTransitionState.reject(ee);
@@ -4586,7 +4773,18 @@ class NavigationTransitions {
4586
4773
  // TODO(jasonaden): remove cast once g3 is on updated TypeScript
4587
4774
  }));
4588
4775
  }
4776
+ cancelNavigationTransition(t, reason, code, router) {
4777
+ const navCancel = new NavigationCancel(t.id, this.urlSerializer.serialize(t.extractedUrl), reason, code);
4778
+ this.events.next(navCancel);
4779
+ t.resolve(false);
4780
+ }
4589
4781
  }
4782
+ NavigationTransitions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: NavigationTransitions, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4783
+ NavigationTransitions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: NavigationTransitions, providedIn: 'root' });
4784
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: NavigationTransitions, decorators: [{
4785
+ type: Injectable,
4786
+ args: [{ providedIn: 'root' }]
4787
+ }], ctorParameters: function () { return []; } });
4590
4788
  function isBrowserTriggeredNavigation(source) {
4591
4789
  return source !== 'imperative';
4592
4790
  }
@@ -4642,9 +4840,9 @@ class TitleStrategy {
4642
4840
  return snapshot.data[RouteTitleKey];
4643
4841
  }
4644
4842
  }
4645
- TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4646
- TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4647
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TitleStrategy, decorators: [{
4843
+ TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4844
+ TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4845
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: TitleStrategy, decorators: [{
4648
4846
  type: Injectable,
4649
4847
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
4650
4848
  }] });
@@ -4668,9 +4866,9 @@ class DefaultTitleStrategy extends TitleStrategy {
4668
4866
  }
4669
4867
  }
4670
4868
  }
4671
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4672
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4673
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4869
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4870
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4871
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4674
4872
  type: Injectable,
4675
4873
  args: [{ providedIn: 'root' }]
4676
4874
  }], ctorParameters: function () { return [{ type: i1.Title }]; } });
@@ -4691,9 +4889,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImpor
4691
4889
  */
4692
4890
  class RouteReuseStrategy {
4693
4891
  }
4694
- RouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouteReuseStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4695
- RouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouteReuseStrategy, providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) });
4696
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouteReuseStrategy, decorators: [{
4892
+ RouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouteReuseStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4893
+ RouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouteReuseStrategy, providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) });
4894
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouteReuseStrategy, decorators: [{
4697
4895
  type: Injectable,
4698
4896
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) }]
4699
4897
  }] });
@@ -4745,9 +4943,9 @@ class BaseRouteReuseStrategy {
4745
4943
  }
4746
4944
  class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4747
4945
  }
4748
- DefaultRouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultRouteReuseStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
4749
- DefaultRouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultRouteReuseStrategy, providedIn: 'root' });
4750
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultRouteReuseStrategy, decorators: [{
4946
+ DefaultRouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultRouteReuseStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
4947
+ DefaultRouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultRouteReuseStrategy, providedIn: 'root' });
4948
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultRouteReuseStrategy, decorators: [{
4751
4949
  type: Injectable,
4752
4950
  args: [{ providedIn: 'root' }]
4753
4951
  }] });
@@ -4759,157 +4957,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImpor
4759
4957
  * Use of this source code is governed by an MIT-style license that can be
4760
4958
  * found in the LICENSE file at https://angular.io/license
4761
4959
  */
4762
- const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4960
+ const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4763
4961
  /**
4764
4962
  * A [DI token](guide/glossary/#di-token) for the router service.
4765
4963
  *
4766
4964
  * @publicApi
4767
4965
  */
4768
- const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$4 ? 'router config' : '', {
4966
+ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config' : '', {
4769
4967
  providedIn: 'root',
4770
4968
  factory: () => ({}),
4771
4969
  });
4772
4970
 
4773
- /**
4774
- * @license
4775
- * Copyright Google LLC All Rights Reserved.
4776
- *
4777
- * Use of this source code is governed by an MIT-style license that can be
4778
- * found in the LICENSE file at https://angular.io/license
4779
- */
4780
- function deprecatedLoadChildrenString(injector, loadChildren) {
4781
- return null;
4782
- }
4783
-
4784
- /**
4785
- * @license
4786
- * Copyright Google LLC All Rights Reserved.
4787
- *
4788
- * Use of this source code is governed by an MIT-style license that can be
4789
- * found in the LICENSE file at https://angular.io/license
4790
- */
4791
- const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4792
- /**
4793
- * The [DI token](guide/glossary/#di-token) for a router configuration.
4794
- *
4795
- * `ROUTES` is a low level API for router configuration via dependency injection.
4796
- *
4797
- * We recommend that in almost all cases to use higher level APIs such as `RouterModule.forRoot()`,
4798
- * `RouterModule.forChild()`, `provideRoutes`, or `Router.resetConfig()`.
4799
- *
4800
- * @publicApi
4801
- */
4802
- const ROUTES = new InjectionToken('ROUTES');
4803
- class RouterConfigLoader {
4804
- constructor(injector, compiler) {
4805
- this.injector = injector;
4806
- this.compiler = compiler;
4807
- this.componentLoaders = new WeakMap();
4808
- this.childrenLoaders = new WeakMap();
4809
- }
4810
- loadComponent(route) {
4811
- if (this.componentLoaders.get(route)) {
4812
- return this.componentLoaders.get(route);
4813
- }
4814
- else if (route._loadedComponent) {
4815
- return of(route._loadedComponent);
4816
- }
4817
- if (this.onLoadStartListener) {
4818
- this.onLoadStartListener(route);
4819
- }
4820
- const loadRunner = wrapIntoObservable(route.loadComponent())
4821
- .pipe(map(maybeUnwrapDefaultExport), tap(component => {
4822
- if (this.onLoadEndListener) {
4823
- this.onLoadEndListener(route);
4824
- }
4825
- NG_DEV_MODE$3 && assertStandalone(route.path ?? '', component);
4826
- route._loadedComponent = component;
4827
- }), finalize(() => {
4828
- this.componentLoaders.delete(route);
4829
- }));
4830
- // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
4831
- const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());
4832
- this.componentLoaders.set(route, loader);
4833
- return loader;
4834
- }
4835
- loadChildren(parentInjector, route) {
4836
- if (this.childrenLoaders.get(route)) {
4837
- return this.childrenLoaders.get(route);
4838
- }
4839
- else if (route._loadedRoutes) {
4840
- return of({ routes: route._loadedRoutes, injector: route._loadedInjector });
4841
- }
4842
- if (this.onLoadStartListener) {
4843
- this.onLoadStartListener(route);
4844
- }
4845
- const moduleFactoryOrRoutes$ = this.loadModuleFactoryOrRoutes(route.loadChildren);
4846
- const loadRunner = moduleFactoryOrRoutes$.pipe(map((factoryOrRoutes) => {
4847
- if (this.onLoadEndListener) {
4848
- this.onLoadEndListener(route);
4849
- }
4850
- // This injector comes from the `NgModuleRef` when lazy loading an `NgModule`. There is no
4851
- // injector associated with lazy loading a `Route` array.
4852
- let injector;
4853
- let rawRoutes;
4854
- let requireStandaloneComponents = false;
4855
- if (Array.isArray(factoryOrRoutes)) {
4856
- rawRoutes = factoryOrRoutes;
4857
- requireStandaloneComponents = true;
4858
- }
4859
- else {
4860
- injector = factoryOrRoutes.create(parentInjector).injector;
4861
- // When loading a module that doesn't provide `RouterModule.forChild()` preloader
4862
- // will get stuck in an infinite loop. The child module's Injector will look to
4863
- // its parent `Injector` when it doesn't find any ROUTES so it will return routes
4864
- // for it's parent module instead.
4865
- rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
4866
- }
4867
- const routes = rawRoutes.map(standardizeConfig);
4868
- NG_DEV_MODE$3 && validateConfig(routes, route.path, requireStandaloneComponents);
4869
- return { routes, injector };
4870
- }), finalize(() => {
4871
- this.childrenLoaders.delete(route);
4872
- }));
4873
- // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
4874
- const loader = new ConnectableObservable(loadRunner, () => new Subject())
4875
- .pipe(refCount());
4876
- this.childrenLoaders.set(route, loader);
4877
- return loader;
4878
- }
4879
- loadModuleFactoryOrRoutes(loadChildren) {
4880
- const deprecatedResult = deprecatedLoadChildrenString(this.injector, loadChildren);
4881
- if (deprecatedResult) {
4882
- return deprecatedResult;
4883
- }
4884
- return wrapIntoObservable(loadChildren())
4885
- .pipe(map(maybeUnwrapDefaultExport), mergeMap((t) => {
4886
- if (t instanceof NgModuleFactory || Array.isArray(t)) {
4887
- return of(t);
4888
- }
4889
- else {
4890
- return from(this.compiler.compileModuleAsync(t));
4891
- }
4892
- }));
4893
- }
4894
- }
4895
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4896
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4897
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterConfigLoader, decorators: [{
4898
- type: Injectable,
4899
- args: [{ providedIn: 'root' }]
4900
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4901
- function isWrappedDefaultExport(value) {
4902
- // We use `in` here with a string key `'default'`, because we expect `DefaultExport` objects to be
4903
- // dynamically imported ES modules with a spec-mandated `default` key. Thus we don't expect that
4904
- // `default` will be a renamed property.
4905
- return value && typeof value === 'object' && 'default' in value;
4906
- }
4907
- function maybeUnwrapDefaultExport(input) {
4908
- // As per `isWrappedDefaultExport`, the `default` key here is generated by the browser and not
4909
- // subject to property renaming, so we reference it with bracket access.
4910
- return isWrappedDefaultExport(input) ? input['default'] : input;
4911
- }
4912
-
4913
4971
  /**
4914
4972
  * @license
4915
4973
  * Copyright Google LLC All Rights Reserved.
@@ -4926,9 +4984,9 @@ function maybeUnwrapDefaultExport(input) {
4926
4984
  */
4927
4985
  class UrlHandlingStrategy {
4928
4986
  }
4929
- UrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4930
- UrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlHandlingStrategy, providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) });
4931
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlHandlingStrategy, decorators: [{
4987
+ UrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: UrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4988
+ UrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: UrlHandlingStrategy, providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) });
4989
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: UrlHandlingStrategy, decorators: [{
4932
4990
  type: Injectable,
4933
4991
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) }]
4934
4992
  }] });
@@ -4946,9 +5004,9 @@ class DefaultUrlHandlingStrategy {
4946
5004
  return newUrlPart;
4947
5005
  }
4948
5006
  }
4949
- DefaultUrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultUrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4950
- DefaultUrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultUrlHandlingStrategy, providedIn: 'root' });
4951
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultUrlHandlingStrategy, decorators: [{
5007
+ DefaultUrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultUrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5008
+ DefaultUrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultUrlHandlingStrategy, providedIn: 'root' });
5009
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultUrlHandlingStrategy, decorators: [{
4952
5010
  type: Injectable,
4953
5011
  args: [{ providedIn: 'root' }]
4954
5012
  }] });
@@ -5038,23 +5096,13 @@ class Router {
5038
5096
  // TODO: vsavkin make internal after the final is out.
5039
5097
  constructor(
5040
5098
  /** @internal */
5041
- rootComponentType,
5042
- /** @internal */
5043
- urlSerializer,
5044
- /** @internal */
5045
- rootContexts,
5046
- /** @internal */
5047
- location, injector, compiler, config) {
5099
+ rootComponentType, urlSerializer, rootContexts, location, injector, compiler, config) {
5048
5100
  this.rootComponentType = rootComponentType;
5049
5101
  this.urlSerializer = urlSerializer;
5050
5102
  this.rootContexts = rootContexts;
5051
5103
  this.location = location;
5052
5104
  this.config = config;
5053
- /** @internal */
5054
- this.lastSuccessfulNavigation = null;
5055
5105
  this.disposed = false;
5056
- /** @internal */
5057
- this.navigationId = 0;
5058
5106
  /**
5059
5107
  * The id of the currently active page in the router.
5060
5108
  * Updated to the transition's target id on a successful navigation.
@@ -5065,10 +5113,6 @@ class Router {
5065
5113
  */
5066
5114
  this.currentPageId = 0;
5067
5115
  this.isNgZoneEnabled = false;
5068
- /**
5069
- * An event stream for routing events in this NgModule.
5070
- */
5071
- this.events = new Subject();
5072
5116
  /**
5073
5117
  * A handler for navigation errors in this NgModule.
5074
5118
  */
@@ -5161,13 +5205,7 @@ class Router {
5161
5205
  *
5162
5206
  */
5163
5207
  this.canceledNavigationResolution = 'replace';
5164
- this.navigationTransitions = new NavigationTransitions(this);
5165
- const onLoadStart = (r) => this.triggerEvent(new RouteConfigLoadStart(r));
5166
- const onLoadEnd = (r) => this.triggerEvent(new RouteConfigLoadEnd(r));
5167
- this.configLoader = injector.get(RouterConfigLoader);
5168
- this.configLoader.onLoadEndListener = onLoadEnd;
5169
- this.configLoader.onLoadStartListener = onLoadStart;
5170
- this.ngModule = injector.get(NgModuleRef);
5208
+ this.navigationTransitions = inject(NavigationTransitions);
5171
5209
  this.console = injector.get(ɵConsole);
5172
5210
  const ngZone = injector.get(NgZone);
5173
5211
  this.isNgZoneEnabled = ngZone instanceof NgZone && NgZone.isInAngularZone();
@@ -5176,28 +5214,17 @@ class Router {
5176
5214
  this.rawUrlTree = this.currentUrlTree;
5177
5215
  this.browserUrlTree = this.currentUrlTree;
5178
5216
  this.routerState = createEmptyState(this.currentUrlTree, this.rootComponentType);
5179
- this.transitions = new BehaviorSubject({
5180
- id: 0,
5181
- targetPageId: 0,
5182
- currentUrlTree: this.currentUrlTree,
5183
- extractedUrl: this.urlHandlingStrategy.extract(this.currentUrlTree),
5184
- urlAfterRedirects: this.urlHandlingStrategy.extract(this.currentUrlTree),
5185
- rawUrl: this.currentUrlTree,
5186
- extras: {},
5187
- resolve: null,
5188
- reject: null,
5189
- promise: Promise.resolve(true),
5190
- source: 'imperative',
5191
- restoredState: null,
5192
- currentSnapshot: this.routerState.snapshot,
5193
- targetSnapshot: null,
5194
- currentRouterState: this.routerState,
5195
- targetRouterState: null,
5196
- guards: { canActivateChecks: [], canDeactivateChecks: [] },
5197
- guardsResult: null,
5217
+ this.navigationTransitions.setupNavigations(this).subscribe(t => {
5218
+ this.lastSuccessfulId = t.id;
5219
+ this.currentPageId = t.targetPageId;
5220
+ }, e => {
5221
+ this.console.warn(`Unhandled Navigation Error: ${e}`);
5198
5222
  });
5199
- this.navigations = this.navigationTransitions.setupNavigations(this.transitions);
5200
- this.processNavigations();
5223
+ }
5224
+ // TODO(b/260747083): This should not exist and navigationId should be private in
5225
+ // `NavigationTransitions`
5226
+ get navigationId() {
5227
+ return this.navigationTransitions.navigationId;
5201
5228
  }
5202
5229
  /**
5203
5230
  * The ɵrouterPageId of whatever page is currently active in the browser history. This is
@@ -5207,6 +5234,16 @@ class Router {
5207
5234
  get browserPageId() {
5208
5235
  return this.location.getState()?.ɵrouterPageId;
5209
5236
  }
5237
+ /**
5238
+ * An event stream for routing events.
5239
+ */
5240
+ get events() {
5241
+ // TODO(atscott): This _should_ be events.asObservable(). However, this change requires internal
5242
+ // cleanup: tests are doing `(route.events as Subject<Event>).next(...)`. This isn't
5243
+ // allowed/supported but we still have to fix these or file bugs against the teams before making
5244
+ // the change.
5245
+ return this.navigationTransitions.events;
5246
+ }
5210
5247
  /**
5211
5248
  * @internal
5212
5249
  * TODO: this should be removed once the constructor of the router made internal
@@ -5217,15 +5254,12 @@ class Router {
5217
5254
  // this will simplify the lifecycle of the router.
5218
5255
  this.routerState.root.component = this.rootComponentType;
5219
5256
  }
5220
- setTransition(t) {
5221
- this.transitions.next({ ...this.transitions.value, ...t });
5222
- }
5223
5257
  /**
5224
5258
  * Sets up the location change listener and performs the initial navigation.
5225
5259
  */
5226
5260
  initialNavigation() {
5227
5261
  this.setUpLocationChangeListener();
5228
- if (this.navigationId === 0) {
5262
+ if (!this.navigationTransitions.hasRequestedNavigation) {
5229
5263
  this.navigateByUrl(this.location.path(true), { replaceUrl: true });
5230
5264
  }
5231
5265
  }
@@ -5282,10 +5316,6 @@ class Router {
5282
5316
  getCurrentNavigation() {
5283
5317
  return this.navigationTransitions.currentNavigation;
5284
5318
  }
5285
- /** @internal */
5286
- triggerEvent(event) {
5287
- this.events.next(event);
5288
- }
5289
5319
  /**
5290
5320
  * Resets the route configuration used for navigation and generating links.
5291
5321
  *
@@ -5314,7 +5344,7 @@ class Router {
5314
5344
  }
5315
5345
  /** Disposes of the router. */
5316
5346
  dispose() {
5317
- this.transitions.complete();
5347
+ this.navigationTransitions.complete();
5318
5348
  if (this.locationSubscription) {
5319
5349
  this.locationSubscription.unsubscribe();
5320
5350
  this.locationSubscription = undefined;
@@ -5499,20 +5529,6 @@ class Router {
5499
5529
  return result;
5500
5530
  }, {});
5501
5531
  }
5502
- processNavigations() {
5503
- this.navigations.subscribe(t => {
5504
- this.navigated = true;
5505
- this.lastSuccessfulId = t.id;
5506
- this.currentPageId = t.targetPageId;
5507
- this.events
5508
- .next(new NavigationEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(this.currentUrlTree)));
5509
- this.lastSuccessfulNavigation = this.getCurrentNavigation();
5510
- this.titleStrategy?.updateTitle(this.routerState.snapshot);
5511
- t.resolve(true);
5512
- }, e => {
5513
- this.console.warn(`Unhandled Navigation Error: ${e}`);
5514
- });
5515
- }
5516
5532
  /** @internal */
5517
5533
  scheduleNavigation(rawUrl, source, restoredState, extras, priorPromise) {
5518
5534
  if (this.disposed) {
@@ -5532,7 +5548,6 @@ class Router {
5532
5548
  reject = rej;
5533
5549
  });
5534
5550
  }
5535
- const id = ++this.navigationId;
5536
5551
  let targetPageId;
5537
5552
  if (this.canceledNavigationResolution === 'computed') {
5538
5553
  const isInitialPage = this.currentPageId === 0;
@@ -5560,12 +5575,12 @@ class Router {
5560
5575
  // This is unused when `canceledNavigationResolution` is not computed.
5561
5576
  targetPageId = 0;
5562
5577
  }
5563
- this.setTransition({
5564
- id,
5578
+ this.navigationTransitions.handleNavigationRequest({
5565
5579
  targetPageId,
5566
5580
  source,
5567
5581
  restoredState,
5568
5582
  currentUrlTree: this.currentUrlTree,
5583
+ currentRawUrl: this.currentUrlTree,
5569
5584
  rawUrl,
5570
5585
  extras,
5571
5586
  resolve,
@@ -5652,12 +5667,6 @@ class Router {
5652
5667
  resetUrlToCurrentUrlTree() {
5653
5668
  this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
5654
5669
  }
5655
- /** @internal */
5656
- cancelNavigationTransition(transition, reason, code) {
5657
- const navCancel = new NavigationCancel(transition.id, this.serializeUrl(transition.extractedUrl), reason, code);
5658
- this.triggerEvent(navCancel);
5659
- transition.resolve(false);
5660
- }
5661
5670
  generateNgRouterState(navigationId, routerPageId) {
5662
5671
  if (this.canceledNavigationResolution === 'computed') {
5663
5672
  return { navigationId, ɵrouterPageId: routerPageId };
@@ -5665,9 +5674,9 @@ class Router {
5665
5674
  return { navigationId };
5666
5675
  }
5667
5676
  }
5668
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5669
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5670
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: Router, decorators: [{
5677
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5678
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5679
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: Router, decorators: [{
5671
5680
  type: Injectable,
5672
5681
  args: [{
5673
5682
  providedIn: 'root',
@@ -5963,9 +5972,9 @@ class RouterLink {
5963
5972
  });
5964
5973
  }
5965
5974
  }
5966
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5967
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: RouterLink, isStandalone: true, selector: "[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target" } }, usesOnChanges: true, ngImport: i0 });
5968
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterLink, decorators: [{
5975
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5976
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.2", type: RouterLink, isStandalone: true, selector: "[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target" } }, usesOnChanges: true, ngImport: i0 });
5977
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterLink, decorators: [{
5969
5978
  type: Directive,
5970
5979
  args: [{
5971
5980
  selector: '[routerLink]',
@@ -6190,9 +6199,9 @@ class RouterLinkActive {
6190
6199
  return this.link && isActiveCheckFn(this.link) || this.links.some(isActiveCheckFn);
6191
6200
  }
6192
6201
  }
6193
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6194
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
6195
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterLinkActive, decorators: [{
6202
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6203
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.2", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
6204
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterLinkActive, decorators: [{
6196
6205
  type: Directive,
6197
6206
  args: [{
6198
6207
  selector: '[routerLinkActive]',
@@ -6252,9 +6261,9 @@ class PreloadAllModules {
6252
6261
  return fn().pipe(catchError(() => of(null)));
6253
6262
  }
6254
6263
  }
6255
- PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6256
- PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6257
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: PreloadAllModules, decorators: [{
6264
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6265
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6266
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: PreloadAllModules, decorators: [{
6258
6267
  type: Injectable,
6259
6268
  args: [{ providedIn: 'root' }]
6260
6269
  }] });
@@ -6272,9 +6281,9 @@ class NoPreloading {
6272
6281
  return of(null);
6273
6282
  }
6274
6283
  }
6275
- NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6276
- NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6277
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NoPreloading, decorators: [{
6284
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6285
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6286
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: NoPreloading, decorators: [{
6278
6287
  type: Injectable,
6279
6288
  args: [{ providedIn: 'root' }]
6280
6289
  }] });
@@ -6368,9 +6377,9 @@ class RouterPreloader {
6368
6377
  });
6369
6378
  }
6370
6379
  }
6371
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6372
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
6373
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterPreloader, decorators: [{
6380
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6381
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
6382
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterPreloader, decorators: [{
6374
6383
  type: Injectable,
6375
6384
  args: [{ providedIn: 'root' }]
6376
6385
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
@@ -6384,9 +6393,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImpor
6384
6393
  */
6385
6394
  const ROUTER_SCROLLER = new InjectionToken('');
6386
6395
  class RouterScroller {
6387
- constructor(router,
6388
- /** @docsNotRequired */ viewportScroller, zone, options = {}) {
6389
- this.router = router;
6396
+ /** @nodoc */
6397
+ constructor(urlSerializer, transitions, viewportScroller, zone, options = {}) {
6398
+ this.urlSerializer = urlSerializer;
6399
+ this.transitions = transitions;
6390
6400
  this.viewportScroller = viewportScroller;
6391
6401
  this.zone = zone;
6392
6402
  this.options = options;
@@ -6409,7 +6419,7 @@ class RouterScroller {
6409
6419
  this.scrollEventsSubscription = this.consumeScrollEvents();
6410
6420
  }
6411
6421
  createScrollEvents() {
6412
- return this.router.events.subscribe(e => {
6422
+ return this.transitions.events.subscribe(e => {
6413
6423
  if (e instanceof NavigationStart) {
6414
6424
  // store the scroll position of the current stable navigations.
6415
6425
  this.store[this.lastId] = this.viewportScroller.getScrollPosition();
@@ -6418,12 +6428,12 @@ class RouterScroller {
6418
6428
  }
6419
6429
  else if (e instanceof NavigationEnd) {
6420
6430
  this.lastId = e.id;
6421
- this.scheduleScrollEvent(e, this.router.parseUrl(e.urlAfterRedirects).fragment);
6431
+ this.scheduleScrollEvent(e, this.urlSerializer.parse(e.urlAfterRedirects).fragment);
6422
6432
  }
6423
6433
  });
6424
6434
  }
6425
6435
  consumeScrollEvents() {
6426
- return this.router.events.subscribe(e => {
6436
+ return this.transitions.events.subscribe(e => {
6427
6437
  if (!(e instanceof Scroll))
6428
6438
  return;
6429
6439
  // a popstate event. The pop state event will always ignore anchor scrolling.
@@ -6453,26 +6463,22 @@ class RouterScroller {
6453
6463
  // component by executing its update block of the template function.
6454
6464
  setTimeout(() => {
6455
6465
  this.zone.run(() => {
6456
- this.router.triggerEvent(new Scroll(routerEvent, this.lastSource === 'popstate' ? this.store[this.restoredId] : null, anchor));
6466
+ this.transitions.events.next(new Scroll(routerEvent, this.lastSource === 'popstate' ? this.store[this.restoredId] : null, anchor));
6457
6467
  });
6458
6468
  }, 0);
6459
6469
  });
6460
6470
  }
6461
6471
  /** @nodoc */
6462
6472
  ngOnDestroy() {
6463
- if (this.routerEventsSubscription) {
6464
- this.routerEventsSubscription.unsubscribe();
6465
- }
6466
- if (this.scrollEventsSubscription) {
6467
- this.scrollEventsSubscription.unsubscribe();
6468
- }
6473
+ this.routerEventsSubscription?.unsubscribe();
6474
+ this.scrollEventsSubscription?.unsubscribe();
6469
6475
  }
6470
6476
  }
6471
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6472
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterScroller });
6473
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterScroller, decorators: [{
6477
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6478
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterScroller });
6479
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterScroller, decorators: [{
6474
6480
  type: Injectable
6475
- }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: i0.NgZone }, { type: undefined }]; } });
6481
+ }], ctorParameters: function () { return [{ type: UrlSerializer }, { type: NavigationTransitions }, { type: i3.ViewportScroller }, { type: i0.NgZone }, { type: undefined }]; } });
6476
6482
 
6477
6483
  /**
6478
6484
  * @license
@@ -6609,10 +6615,11 @@ function withInMemoryScrolling(options = {}) {
6609
6615
  const providers = [{
6610
6616
  provide: ROUTER_SCROLLER,
6611
6617
  useFactory: () => {
6612
- const router = inject(Router);
6613
6618
  const viewportScroller = inject(ViewportScroller);
6614
6619
  const zone = inject(NgZone);
6615
- return new RouterScroller(router, viewportScroller, zone, options);
6620
+ const transitions = inject(NavigationTransitions);
6621
+ const urlSerializer = inject(UrlSerializer);
6622
+ return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, options);
6616
6623
  },
6617
6624
  }];
6618
6625
  return routerFeature(4 /* RouterFeatureKind.InMemoryScrollingFeature */, providers);
@@ -7012,10 +7019,10 @@ class RouterModule {
7012
7019
  };
7013
7020
  }
7014
7021
  }
7015
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
7016
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] });
7017
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
7018
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterModule, decorators: [{
7022
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
7023
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.2", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] });
7024
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
7025
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterModule, decorators: [{
7019
7026
  type: NgModule,
7020
7027
  args: [{
7021
7028
  imports: ROUTER_DIRECTIVES,
@@ -7035,14 +7042,15 @@ function provideRouterScroller() {
7035
7042
  return {
7036
7043
  provide: ROUTER_SCROLLER,
7037
7044
  useFactory: () => {
7038
- const router = inject(Router);
7039
7045
  const viewportScroller = inject(ViewportScroller);
7040
7046
  const zone = inject(NgZone);
7041
7047
  const config = inject(ROUTER_CONFIGURATION);
7048
+ const transitions = inject(NavigationTransitions);
7049
+ const urlSerializer = inject(UrlSerializer);
7042
7050
  if (config.scrollOffset) {
7043
7051
  viewportScroller.setOffset(config.scrollOffset);
7044
7052
  }
7045
- return new RouterScroller(router, viewportScroller, zone, config);
7053
+ return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, config);
7046
7054
  },
7047
7055
  };
7048
7056
  }
@@ -7100,7 +7108,7 @@ function provideRouterInitializer() {
7100
7108
  /**
7101
7109
  * @publicApi
7102
7110
  */
7103
- const VERSION = new Version('15.0.1');
7111
+ const VERSION = new Version('15.0.2');
7104
7112
 
7105
7113
  /**
7106
7114
  * @license