@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
  }] });
@@ -2386,9 +2386,9 @@ class ChildrenOutletContexts {
2386
2386
  return this.contexts.get(childName) || null;
2387
2387
  }
2388
2388
  }
2389
- ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2390
- ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2391
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2389
+ ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2390
+ ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2391
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2392
2392
  type: Injectable,
2393
2393
  args: [{ providedIn: 'root' }]
2394
2394
  }] });
@@ -2609,9 +2609,9 @@ class RouterOutlet {
2609
2609
  this.activateEvents.emit(this.activated.instance);
2610
2610
  }
2611
2611
  }
2612
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2613
- 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 });
2614
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterOutlet, decorators: [{
2612
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2613
+ 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 });
2614
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterOutlet, decorators: [{
2615
2615
  type: Directive,
2616
2616
  args: [{
2617
2617
  selector: 'router-outlet',
@@ -2671,9 +2671,9 @@ function isComponentFactoryResolver(item) {
2671
2671
  */
2672
2672
  class ɵEmptyOutletComponent {
2673
2673
  }
2674
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2675
- ɵ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"] }] });
2676
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2674
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2675
+ ɵ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"] }] });
2676
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2677
2677
  type: Component,
2678
2678
  args: [{
2679
2679
  template: `<router-outlet></router-outlet>`,
@@ -4307,6 +4307,19 @@ function switchTap(next) {
4307
4307
  });
4308
4308
  }
4309
4309
 
4310
+ /**
4311
+ * @license
4312
+ * Copyright Google LLC All Rights Reserved.
4313
+ *
4314
+ * Use of this source code is governed by an MIT-style license that can be
4315
+ * found in the LICENSE file at https://angular.io/license
4316
+ */
4317
+ // This file exists to support the legacy `loadChildren: string` behavior being patched back into
4318
+ // Angular.
4319
+ function deprecatedLoadChildrenString(injector, loadChildren) {
4320
+ return null;
4321
+ }
4322
+
4310
4323
  /**
4311
4324
  * @license
4312
4325
  * Copyright Google LLC All Rights Reserved.
@@ -4315,16 +4328,188 @@ function switchTap(next) {
4315
4328
  * found in the LICENSE file at https://angular.io/license
4316
4329
  */
4317
4330
  const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4331
+ /**
4332
+ * The [DI token](guide/glossary/#di-token) for a router configuration.
4333
+ *
4334
+ * `ROUTES` is a low level API for router configuration via dependency injection.
4335
+ *
4336
+ * We recommend that in almost all cases to use higher level APIs such as `RouterModule.forRoot()`,
4337
+ * `RouterModule.forChild()`, `provideRoutes`, or `Router.resetConfig()`.
4338
+ *
4339
+ * @publicApi
4340
+ */
4341
+ const ROUTES = new InjectionToken('ROUTES');
4342
+ class RouterConfigLoader {
4343
+ constructor(injector, compiler) {
4344
+ this.injector = injector;
4345
+ this.compiler = compiler;
4346
+ this.componentLoaders = new WeakMap();
4347
+ this.childrenLoaders = new WeakMap();
4348
+ }
4349
+ loadComponent(route) {
4350
+ if (this.componentLoaders.get(route)) {
4351
+ return this.componentLoaders.get(route);
4352
+ }
4353
+ else if (route._loadedComponent) {
4354
+ return of(route._loadedComponent);
4355
+ }
4356
+ if (this.onLoadStartListener) {
4357
+ this.onLoadStartListener(route);
4358
+ }
4359
+ const loadRunner = wrapIntoObservable(route.loadComponent())
4360
+ .pipe(map(maybeUnwrapDefaultExport), tap(component => {
4361
+ var _a;
4362
+ if (this.onLoadEndListener) {
4363
+ this.onLoadEndListener(route);
4364
+ }
4365
+ NG_DEV_MODE$5 && assertStandalone((_a = route.path) !== null && _a !== void 0 ? _a : '', component);
4366
+ route._loadedComponent = component;
4367
+ }), finalize(() => {
4368
+ this.componentLoaders.delete(route);
4369
+ }));
4370
+ // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
4371
+ const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());
4372
+ this.componentLoaders.set(route, loader);
4373
+ return loader;
4374
+ }
4375
+ loadChildren(parentInjector, route) {
4376
+ if (this.childrenLoaders.get(route)) {
4377
+ return this.childrenLoaders.get(route);
4378
+ }
4379
+ else if (route._loadedRoutes) {
4380
+ return of({ routes: route._loadedRoutes, injector: route._loadedInjector });
4381
+ }
4382
+ if (this.onLoadStartListener) {
4383
+ this.onLoadStartListener(route);
4384
+ }
4385
+ const moduleFactoryOrRoutes$ = this.loadModuleFactoryOrRoutes(route.loadChildren);
4386
+ const loadRunner = moduleFactoryOrRoutes$.pipe(map((factoryOrRoutes) => {
4387
+ if (this.onLoadEndListener) {
4388
+ this.onLoadEndListener(route);
4389
+ }
4390
+ // This injector comes from the `NgModuleRef` when lazy loading an `NgModule`. There is no
4391
+ // injector associated with lazy loading a `Route` array.
4392
+ let injector;
4393
+ let rawRoutes;
4394
+ let requireStandaloneComponents = false;
4395
+ if (Array.isArray(factoryOrRoutes)) {
4396
+ rawRoutes = factoryOrRoutes;
4397
+ requireStandaloneComponents = true;
4398
+ }
4399
+ else {
4400
+ injector = factoryOrRoutes.create(parentInjector).injector;
4401
+ // When loading a module that doesn't provide `RouterModule.forChild()` preloader
4402
+ // will get stuck in an infinite loop. The child module's Injector will look to
4403
+ // its parent `Injector` when it doesn't find any ROUTES so it will return routes
4404
+ // for it's parent module instead.
4405
+ rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
4406
+ }
4407
+ const routes = rawRoutes.map(standardizeConfig);
4408
+ NG_DEV_MODE$5 && validateConfig(routes, route.path, requireStandaloneComponents);
4409
+ return { routes, injector };
4410
+ }), finalize(() => {
4411
+ this.childrenLoaders.delete(route);
4412
+ }));
4413
+ // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
4414
+ const loader = new ConnectableObservable(loadRunner, () => new Subject())
4415
+ .pipe(refCount());
4416
+ this.childrenLoaders.set(route, loader);
4417
+ return loader;
4418
+ }
4419
+ loadModuleFactoryOrRoutes(loadChildren) {
4420
+ const deprecatedResult = deprecatedLoadChildrenString(this.injector, loadChildren);
4421
+ if (deprecatedResult) {
4422
+ return deprecatedResult;
4423
+ }
4424
+ return wrapIntoObservable(loadChildren())
4425
+ .pipe(map(maybeUnwrapDefaultExport), mergeMap((t) => {
4426
+ if (t instanceof NgModuleFactory || Array.isArray(t)) {
4427
+ return of(t);
4428
+ }
4429
+ else {
4430
+ return from(this.compiler.compileModuleAsync(t));
4431
+ }
4432
+ }));
4433
+ }
4434
+ }
4435
+ 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 });
4436
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4437
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterConfigLoader, decorators: [{
4438
+ type: Injectable,
4439
+ args: [{ providedIn: 'root' }]
4440
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4441
+ function isWrappedDefaultExport(value) {
4442
+ // We use `in` here with a string key `'default'`, because we expect `DefaultExport` objects to be
4443
+ // dynamically imported ES modules with a spec-mandated `default` key. Thus we don't expect that
4444
+ // `default` will be a renamed property.
4445
+ return value && typeof value === 'object' && 'default' in value;
4446
+ }
4447
+ function maybeUnwrapDefaultExport(input) {
4448
+ // As per `isWrappedDefaultExport`, the `default` key here is generated by the browser and not
4449
+ // subject to property renaming, so we reference it with bracket access.
4450
+ return isWrappedDefaultExport(input) ? input['default'] : input;
4451
+ }
4452
+
4453
+ /**
4454
+ * @license
4455
+ * Copyright Google LLC All Rights Reserved.
4456
+ *
4457
+ * Use of this source code is governed by an MIT-style license that can be
4458
+ * found in the LICENSE file at https://angular.io/license
4459
+ */
4460
+ const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4318
4461
  class NavigationTransitions {
4319
- constructor(router) {
4320
- this.router = router;
4462
+ constructor() {
4321
4463
  this.currentNavigation = null;
4464
+ this.lastSuccessfulNavigation = null;
4465
+ this.events = new Subject();
4466
+ this.configLoader = inject(RouterConfigLoader);
4467
+ this.environmentInjector = inject(EnvironmentInjector);
4468
+ this.urlSerializer = inject(UrlSerializer);
4469
+ this.rootContexts = inject(ChildrenOutletContexts);
4470
+ this.navigationId = 0;
4471
+ const onLoadStart = (r) => this.events.next(new RouteConfigLoadStart(r));
4472
+ const onLoadEnd = (r) => this.events.next(new RouteConfigLoadEnd(r));
4473
+ this.configLoader.onLoadEndListener = onLoadEnd;
4474
+ this.configLoader.onLoadStartListener = onLoadStart;
4475
+ }
4476
+ get hasRequestedNavigation() {
4477
+ return this.navigationId !== 0;
4322
4478
  }
4323
- setupNavigations(transitions) {
4324
- const eventsSubject = this.router.events;
4325
- return transitions.pipe(filter(t => t.id !== 0),
4479
+ complete() {
4480
+ var _a;
4481
+ (_a = this.transitions) === null || _a === void 0 ? void 0 : _a.complete();
4482
+ }
4483
+ handleNavigationRequest(request) {
4484
+ var _a;
4485
+ const id = ++this.navigationId;
4486
+ (_a = this.transitions) === null || _a === void 0 ? void 0 : _a.next(Object.assign(Object.assign(Object.assign({}, this.transitions.value), request), { id }));
4487
+ }
4488
+ setupNavigations(router) {
4489
+ this.transitions = new BehaviorSubject({
4490
+ id: 0,
4491
+ targetPageId: 0,
4492
+ currentUrlTree: router.currentUrlTree,
4493
+ currentRawUrl: router.currentUrlTree,
4494
+ extractedUrl: router.urlHandlingStrategy.extract(router.currentUrlTree),
4495
+ urlAfterRedirects: router.urlHandlingStrategy.extract(router.currentUrlTree),
4496
+ rawUrl: router.currentUrlTree,
4497
+ extras: {},
4498
+ resolve: null,
4499
+ reject: null,
4500
+ promise: Promise.resolve(true),
4501
+ source: 'imperative',
4502
+ restoredState: null,
4503
+ currentSnapshot: router.routerState.snapshot,
4504
+ targetSnapshot: null,
4505
+ currentRouterState: router.routerState,
4506
+ targetRouterState: null,
4507
+ guards: { canActivateChecks: [], canDeactivateChecks: [] },
4508
+ guardsResult: null,
4509
+ });
4510
+ return this.transitions.pipe(filter(t => t.id !== 0),
4326
4511
  // Extract URL
4327
- map(t => (Object.assign(Object.assign({}, t), { extractedUrl: this.router.urlHandlingStrategy.extract(t.rawUrl) }))),
4512
+ map(t => (Object.assign(Object.assign({}, t), { extractedUrl: router.urlHandlingStrategy.extract(t.rawUrl) }))),
4328
4513
  // Using switchMap so we cancel executing navigations when a new one comes in
4329
4514
  switchMap(overallTransitionState => {
4330
4515
  let completed = false;
@@ -4339,32 +4524,32 @@ class NavigationTransitions {
4339
4524
  extractedUrl: t.extractedUrl,
4340
4525
  trigger: t.source,
4341
4526
  extras: t.extras,
4342
- previousNavigation: !this.router.lastSuccessfulNavigation ? null : Object.assign(Object.assign({}, this.router.lastSuccessfulNavigation), { previousNavigation: null }),
4527
+ previousNavigation: !this.lastSuccessfulNavigation ? null : Object.assign(Object.assign({}, this.lastSuccessfulNavigation), { previousNavigation: null }),
4343
4528
  };
4344
4529
  }), switchMap(t => {
4345
- const browserUrlTree = this.router.browserUrlTree.toString();
4346
- const urlTransition = !this.router.navigated ||
4530
+ const browserUrlTree = router.browserUrlTree.toString();
4531
+ const urlTransition = !router.navigated ||
4347
4532
  t.extractedUrl.toString() !== browserUrlTree ||
4348
4533
  // Navigations which succeed or ones which fail and are cleaned up
4349
4534
  // correctly should result in `browserUrlTree` and `currentUrlTree`
4350
4535
  // matching. If this is not the case, assume something went wrong and
4351
4536
  // try processing the URL again.
4352
- browserUrlTree !== this.router.currentUrlTree.toString();
4353
- const processCurrentUrl = (this.router.onSameUrlNavigation === 'reload' ? true :
4354
- urlTransition) &&
4355
- this.router.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
4537
+ browserUrlTree !== router.currentUrlTree.toString();
4538
+ const processCurrentUrl = (router.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
4539
+ router.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
4356
4540
  if (processCurrentUrl) {
4357
4541
  // If the source of the navigation is from a browser event, the URL is
4358
4542
  // already updated. We already need to sync the internal state.
4359
4543
  if (isBrowserTriggeredNavigation(t.source)) {
4360
- this.router.browserUrlTree = t.extractedUrl;
4544
+ router.browserUrlTree = t.extractedUrl;
4361
4545
  }
4362
4546
  return of(t).pipe(
4363
4547
  // Fire NavigationStart event
4364
4548
  switchMap(t => {
4365
- const transition = this.router.transitions.getValue();
4366
- eventsSubject.next(new NavigationStart(t.id, this.router.serializeUrl(t.extractedUrl), t.source, t.restoredState));
4367
- if (transition !== this.router.transitions.getValue()) {
4549
+ var _a, _b;
4550
+ const transition = (_a = this.transitions) === null || _a === void 0 ? void 0 : _a.getValue();
4551
+ this.events.next(new NavigationStart(t.id, this.urlSerializer.serialize(t.extractedUrl), t.source, t.restoredState));
4552
+ if (transition !== ((_b = this.transitions) === null || _b === void 0 ? void 0 : _b.getValue())) {
4368
4553
  return EMPTY;
4369
4554
  }
4370
4555
  // This delay is required to match old behavior that forced
@@ -4372,7 +4557,7 @@ class NavigationTransitions {
4372
4557
  return Promise.resolve(t);
4373
4558
  }),
4374
4559
  // ApplyRedirects
4375
- applyRedirects(this.router.ngModule.injector, this.router.configLoader, this.router.urlSerializer, this.router.config),
4560
+ applyRedirects(this.environmentInjector, this.configLoader, this.urlSerializer, router.config),
4376
4561
  // Update the currentNavigation
4377
4562
  // `urlAfterRedirects` is guaranteed to be set after this point
4378
4563
  tap(t => {
@@ -4380,33 +4565,33 @@ class NavigationTransitions {
4380
4565
  overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
4381
4566
  }),
4382
4567
  // Recognize
4383
- recognize(this.router.ngModule.injector, this.router.rootComponentType, this.router.config, this.router.urlSerializer, this.router.paramsInheritanceStrategy),
4568
+ recognize(this.environmentInjector, router.rootComponentType, router.config, this.urlSerializer, router.paramsInheritanceStrategy),
4384
4569
  // Update URL if in `eager` update mode
4385
4570
  tap(t => {
4386
4571
  overallTransitionState.targetSnapshot = t.targetSnapshot;
4387
- if (this.router.urlUpdateStrategy === 'eager') {
4572
+ if (router.urlUpdateStrategy === 'eager') {
4388
4573
  if (!t.extras.skipLocationChange) {
4389
- const rawUrl = this.router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4390
- this.router.setBrowserUrl(rawUrl, t);
4574
+ const rawUrl = router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4575
+ router.setBrowserUrl(rawUrl, t);
4391
4576
  }
4392
- this.router.browserUrlTree = t.urlAfterRedirects;
4577
+ router.browserUrlTree = t.urlAfterRedirects;
4393
4578
  }
4394
4579
  // Fire RoutesRecognized
4395
- const routesRecognized = new RoutesRecognized(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4396
- eventsSubject.next(routesRecognized);
4580
+ const routesRecognized = new RoutesRecognized(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4581
+ this.events.next(routesRecognized);
4397
4582
  }));
4398
4583
  }
4399
4584
  else {
4400
- const processPreviousUrl = urlTransition && this.router.rawUrlTree &&
4401
- this.router.urlHandlingStrategy.shouldProcessUrl(this.router.rawUrlTree);
4585
+ const processPreviousUrl = urlTransition && router.rawUrlTree &&
4586
+ router.urlHandlingStrategy.shouldProcessUrl(router.rawUrlTree);
4402
4587
  /* When the current URL shouldn't be processed, but the previous one
4403
4588
  * was, we handle this "error condition" by navigating to the
4404
4589
  * previously successful URL, but leaving the URL intact.*/
4405
4590
  if (processPreviousUrl) {
4406
4591
  const { id, extractedUrl, source, restoredState, extras } = t;
4407
- const navStart = new NavigationStart(id, this.router.serializeUrl(extractedUrl), source, restoredState);
4408
- eventsSubject.next(navStart);
4409
- const targetSnapshot = createEmptyState(extractedUrl, this.router.rootComponentType)
4592
+ const navStart = new NavigationStart(id, this.urlSerializer.serialize(extractedUrl), source, restoredState);
4593
+ this.events.next(navStart);
4594
+ const targetSnapshot = createEmptyState(extractedUrl, router.rootComponentType)
4410
4595
  .snapshot;
4411
4596
  overallTransitionState = Object.assign(Object.assign({}, t), { targetSnapshot, urlAfterRedirects: extractedUrl, extras: Object.assign(Object.assign({}, extras), { skipLocationChange: false, replaceUrl: false }) });
4412
4597
  return of(overallTransitionState);
@@ -4417,7 +4602,7 @@ class NavigationTransitions {
4417
4602
  * current "settled" URL. This way the next navigation will be coming
4418
4603
  * from the current URL in the browser.
4419
4604
  */
4420
- this.router.rawUrlTree = t.rawUrl;
4605
+ router.rawUrlTree = t.rawUrl;
4421
4606
  t.resolve(null);
4422
4607
  return EMPTY;
4423
4608
  }
@@ -4425,22 +4610,22 @@ class NavigationTransitions {
4425
4610
  }),
4426
4611
  // --- GUARDS ---
4427
4612
  tap(t => {
4428
- const guardsStart = new GuardsCheckStart(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4429
- this.router.triggerEvent(guardsStart);
4613
+ const guardsStart = new GuardsCheckStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4614
+ this.events.next(guardsStart);
4430
4615
  }), map(t => {
4431
- overallTransitionState = Object.assign(Object.assign({}, t), { guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.router.rootContexts) });
4616
+ overallTransitionState = Object.assign(Object.assign({}, t), { guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts) });
4432
4617
  return overallTransitionState;
4433
- }), checkGuards(this.router.ngModule.injector, (evt) => this.router.triggerEvent(evt)), tap(t => {
4618
+ }), checkGuards(this.environmentInjector, (evt) => this.events.next(evt)), tap(t => {
4434
4619
  overallTransitionState.guardsResult = t.guardsResult;
4435
4620
  if (isUrlTree(t.guardsResult)) {
4436
- throw redirectingNavigationError(this.router.urlSerializer, t.guardsResult);
4621
+ throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
4437
4622
  }
4438
- const guardsEnd = new GuardsCheckEnd(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
4439
- this.router.triggerEvent(guardsEnd);
4623
+ const guardsEnd = new GuardsCheckEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
4624
+ this.events.next(guardsEnd);
4440
4625
  }), filter(t => {
4441
4626
  if (!t.guardsResult) {
4442
- this.router.restoreHistory(t);
4443
- this.router.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */);
4627
+ router.restoreHistory(t);
4628
+ this.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */, router);
4444
4629
  return false;
4445
4630
  }
4446
4631
  return true;
@@ -4449,24 +4634,24 @@ class NavigationTransitions {
4449
4634
  switchTap(t => {
4450
4635
  if (t.guards.canActivateChecks.length) {
4451
4636
  return of(t).pipe(tap(t => {
4452
- const resolveStart = new ResolveStart(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4453
- this.router.triggerEvent(resolveStart);
4637
+ const resolveStart = new ResolveStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4638
+ this.events.next(resolveStart);
4454
4639
  }), switchMap(t => {
4455
4640
  let dataResolved = false;
4456
- return of(t).pipe(resolveData(this.router.paramsInheritanceStrategy, this.router.ngModule.injector), tap({
4641
+ return of(t).pipe(resolveData(router.paramsInheritanceStrategy, this.environmentInjector), tap({
4457
4642
  next: () => dataResolved = true,
4458
4643
  complete: () => {
4459
4644
  if (!dataResolved) {
4460
- this.router.restoreHistory(t);
4461
- this.router.cancelNavigationTransition(t, NG_DEV_MODE$5 ?
4645
+ router.restoreHistory(t);
4646
+ this.cancelNavigationTransition(t, NG_DEV_MODE$4 ?
4462
4647
  `At least one route resolver didn't emit any value.` :
4463
- '', 2 /* NavigationCancellationCode.NoDataFromResolver */);
4648
+ '', 2 /* NavigationCancellationCode.NoDataFromResolver */, router);
4464
4649
  }
4465
4650
  }
4466
4651
  }));
4467
4652
  }), tap(t => {
4468
- const resolveEnd = new ResolveEnd(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4469
- this.router.triggerEvent(resolveEnd);
4653
+ const resolveEnd = new ResolveEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4654
+ this.events.next(resolveEnd);
4470
4655
  }));
4471
4656
  }
4472
4657
  return undefined;
@@ -4478,7 +4663,7 @@ class NavigationTransitions {
4478
4663
  const loaders = [];
4479
4664
  if (((_a = route.routeConfig) === null || _a === void 0 ? void 0 : _a.loadComponent) &&
4480
4665
  !route.routeConfig._loadedComponent) {
4481
- loaders.push(this.router.configLoader.loadComponent(route.routeConfig)
4666
+ loaders.push(this.configLoader.loadComponent(route.routeConfig)
4482
4667
  .pipe(tap(loadedComponent => {
4483
4668
  route.component = loadedComponent;
4484
4669
  }), map(() => void 0)));
@@ -4490,8 +4675,8 @@ class NavigationTransitions {
4490
4675
  };
4491
4676
  return combineLatest(loadComponents(t.targetSnapshot.root))
4492
4677
  .pipe(defaultIfEmpty(), take(1));
4493
- }), switchTap(() => this.router.afterPreactivation()), map((t) => {
4494
- const targetRouterState = createRouterState(this.router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4678
+ }), switchTap(() => router.afterPreactivation()), map((t) => {
4679
+ const targetRouterState = createRouterState(router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4495
4680
  overallTransitionState = Object.assign(Object.assign({}, t), { targetRouterState });
4496
4681
  return (overallTransitionState);
4497
4682
  }),
@@ -4501,21 +4686,28 @@ class NavigationTransitions {
4501
4686
  the current URL and the RouterState, as well as updated the browser URL.
4502
4687
  All this should happen *before* activating. */
4503
4688
  tap((t) => {
4504
- this.router.currentUrlTree = t.urlAfterRedirects;
4505
- this.router.rawUrlTree = this.router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4506
- this.router.routerState =
4689
+ router.currentUrlTree = t.urlAfterRedirects;
4690
+ router.rawUrlTree =
4691
+ router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4692
+ router.routerState =
4507
4693
  t.targetRouterState;
4508
- if (this.router.urlUpdateStrategy === 'deferred') {
4694
+ if (router.urlUpdateStrategy === 'deferred') {
4509
4695
  if (!t.extras.skipLocationChange) {
4510
- this.router.setBrowserUrl(this.router.rawUrlTree, t);
4696
+ router.setBrowserUrl(router.rawUrlTree, t);
4511
4697
  }
4512
- this.router.browserUrlTree = t.urlAfterRedirects;
4698
+ router.browserUrlTree = t.urlAfterRedirects;
4513
4699
  }
4514
- }), activateRoutes(this.router.rootContexts, this.router.routeReuseStrategy, (evt) => this.router.triggerEvent(evt)), tap({
4515
- next() {
4700
+ }), activateRoutes(this.rootContexts, router.routeReuseStrategy, (evt) => this.events.next(evt)), tap({
4701
+ next: (t) => {
4702
+ var _a;
4516
4703
  completed = true;
4704
+ this.lastSuccessfulNavigation = this.currentNavigation;
4705
+ router.navigated = true;
4706
+ this.events.next(new NavigationEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(router.currentUrlTree)));
4707
+ (_a = router.titleStrategy) === null || _a === void 0 ? void 0 : _a.updateTitle(t.targetRouterState.snapshot);
4708
+ t.resolve(true);
4517
4709
  },
4518
- complete() {
4710
+ complete: () => {
4519
4711
  completed = true;
4520
4712
  }
4521
4713
  }), finalize(() => {
@@ -4527,11 +4719,11 @@ class NavigationTransitions {
4527
4719
  * catch-all to make sure the NavigationCancel event is fired when a
4528
4720
  * navigation gets cancelled but not caught by other means. */
4529
4721
  if (!completed && !errored) {
4530
- const cancelationReason = NG_DEV_MODE$5 ?
4722
+ const cancelationReason = NG_DEV_MODE$4 ?
4531
4723
  `Navigation ID ${overallTransitionState
4532
- .id} is not equal to the current navigation id ${this.router.navigationId}` :
4724
+ .id} is not equal to the current navigation id ${this.navigationId}` :
4533
4725
  '';
4534
- this.router.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
4726
+ this.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */, router);
4535
4727
  }
4536
4728
  // Only clear current navigation if it is still set to the one that
4537
4729
  // finalized.
@@ -4551,28 +4743,28 @@ class NavigationTransitions {
4551
4743
  // navigate. This is only applicable with initial navigation, so
4552
4744
  // setting `navigated` only when not redirecting resolves this
4553
4745
  // scenario.
4554
- this.router.navigated = true;
4555
- this.router.restoreHistory(overallTransitionState, true);
4746
+ router.navigated = true;
4747
+ router.restoreHistory(overallTransitionState, true);
4556
4748
  }
4557
- const navCancel = new NavigationCancel(overallTransitionState.id, this.router.serializeUrl(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
4558
- eventsSubject.next(navCancel);
4749
+ const navCancel = new NavigationCancel(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
4750
+ this.events.next(navCancel);
4559
4751
  // When redirecting, we need to delay resolving the navigation
4560
4752
  // promise and push it to the redirect navigation
4561
4753
  if (!isRedirectingNavigationCancelingError$1(e)) {
4562
4754
  overallTransitionState.resolve(false);
4563
4755
  }
4564
4756
  else {
4565
- const mergedTree = this.router.urlHandlingStrategy.merge(e.url, this.router.rawUrlTree);
4757
+ const mergedTree = router.urlHandlingStrategy.merge(e.url, router.rawUrlTree);
4566
4758
  const extras = {
4567
4759
  skipLocationChange: overallTransitionState.extras.skipLocationChange,
4568
4760
  // The URL is already updated at this point if we have 'eager' URL
4569
4761
  // updates or if the navigation was triggered by the browser (back
4570
4762
  // button, URL bar, etc). We want to replace that item in history
4571
4763
  // if the navigation is rejected.
4572
- replaceUrl: this.router.urlUpdateStrategy === 'eager' ||
4764
+ replaceUrl: router.urlUpdateStrategy === 'eager' ||
4573
4765
  isBrowserTriggeredNavigation(overallTransitionState.source)
4574
4766
  };
4575
- this.router.scheduleNavigation(mergedTree, 'imperative', null, extras, {
4767
+ router.scheduleNavigation(mergedTree, 'imperative', null, extras, {
4576
4768
  resolve: overallTransitionState.resolve,
4577
4769
  reject: overallTransitionState.reject,
4578
4770
  promise: overallTransitionState.promise
@@ -4582,11 +4774,11 @@ class NavigationTransitions {
4582
4774
  * to the pre-error state. */
4583
4775
  }
4584
4776
  else {
4585
- this.router.restoreHistory(overallTransitionState, true);
4586
- const navError = new NavigationError(overallTransitionState.id, this.router.serializeUrl(overallTransitionState.extractedUrl), e, (_a = overallTransitionState.targetSnapshot) !== null && _a !== void 0 ? _a : undefined);
4587
- eventsSubject.next(navError);
4777
+ router.restoreHistory(overallTransitionState, true);
4778
+ const navError = new NavigationError(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e, (_a = overallTransitionState.targetSnapshot) !== null && _a !== void 0 ? _a : undefined);
4779
+ this.events.next(navError);
4588
4780
  try {
4589
- overallTransitionState.resolve(this.router.errorHandler(e));
4781
+ overallTransitionState.resolve(router.errorHandler(e));
4590
4782
  }
4591
4783
  catch (ee) {
4592
4784
  overallTransitionState.reject(ee);
@@ -4597,7 +4789,18 @@ class NavigationTransitions {
4597
4789
  // TODO(jasonaden): remove cast once g3 is on updated TypeScript
4598
4790
  }));
4599
4791
  }
4792
+ cancelNavigationTransition(t, reason, code, router) {
4793
+ const navCancel = new NavigationCancel(t.id, this.urlSerializer.serialize(t.extractedUrl), reason, code);
4794
+ this.events.next(navCancel);
4795
+ t.resolve(false);
4796
+ }
4600
4797
  }
4798
+ NavigationTransitions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: NavigationTransitions, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4799
+ NavigationTransitions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: NavigationTransitions, providedIn: 'root' });
4800
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: NavigationTransitions, decorators: [{
4801
+ type: Injectable,
4802
+ args: [{ providedIn: 'root' }]
4803
+ }], ctorParameters: function () { return []; } });
4601
4804
  function isBrowserTriggeredNavigation(source) {
4602
4805
  return source !== 'imperative';
4603
4806
  }
@@ -4654,9 +4857,9 @@ class TitleStrategy {
4654
4857
  return snapshot.data[RouteTitleKey];
4655
4858
  }
4656
4859
  }
4657
- TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4658
- TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4659
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TitleStrategy, decorators: [{
4860
+ TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4861
+ TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4862
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: TitleStrategy, decorators: [{
4660
4863
  type: Injectable,
4661
4864
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
4662
4865
  }] });
@@ -4680,9 +4883,9 @@ class DefaultTitleStrategy extends TitleStrategy {
4680
4883
  }
4681
4884
  }
4682
4885
  }
4683
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4684
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4685
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4886
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4887
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4888
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4686
4889
  type: Injectable,
4687
4890
  args: [{ providedIn: 'root' }]
4688
4891
  }], ctorParameters: function () { return [{ type: i1.Title }]; } });
@@ -4703,9 +4906,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImpor
4703
4906
  */
4704
4907
  class RouteReuseStrategy {
4705
4908
  }
4706
- RouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouteReuseStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4707
- RouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouteReuseStrategy, providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) });
4708
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouteReuseStrategy, decorators: [{
4909
+ RouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouteReuseStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4910
+ RouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouteReuseStrategy, providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) });
4911
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouteReuseStrategy, decorators: [{
4709
4912
  type: Injectable,
4710
4913
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) }]
4711
4914
  }] });
@@ -4757,9 +4960,9 @@ class BaseRouteReuseStrategy {
4757
4960
  }
4758
4961
  class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4759
4962
  }
4760
- DefaultRouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultRouteReuseStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
4761
- DefaultRouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultRouteReuseStrategy, providedIn: 'root' });
4762
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultRouteReuseStrategy, decorators: [{
4963
+ DefaultRouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultRouteReuseStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
4964
+ DefaultRouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultRouteReuseStrategy, providedIn: 'root' });
4965
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultRouteReuseStrategy, decorators: [{
4763
4966
  type: Injectable,
4764
4967
  args: [{ providedIn: 'root' }]
4765
4968
  }] });
@@ -4771,158 +4974,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImpor
4771
4974
  * Use of this source code is governed by an MIT-style license that can be
4772
4975
  * found in the LICENSE file at https://angular.io/license
4773
4976
  */
4774
- const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4977
+ const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4775
4978
  /**
4776
4979
  * A [DI token](guide/glossary/#di-token) for the router service.
4777
4980
  *
4778
4981
  * @publicApi
4779
4982
  */
4780
- const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$4 ? 'router config' : '', {
4983
+ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config' : '', {
4781
4984
  providedIn: 'root',
4782
4985
  factory: () => ({}),
4783
4986
  });
4784
4987
 
4785
- /**
4786
- * @license
4787
- * Copyright Google LLC All Rights Reserved.
4788
- *
4789
- * Use of this source code is governed by an MIT-style license that can be
4790
- * found in the LICENSE file at https://angular.io/license
4791
- */
4792
- function deprecatedLoadChildrenString(injector, loadChildren) {
4793
- return null;
4794
- }
4795
-
4796
- /**
4797
- * @license
4798
- * Copyright Google LLC All Rights Reserved.
4799
- *
4800
- * Use of this source code is governed by an MIT-style license that can be
4801
- * found in the LICENSE file at https://angular.io/license
4802
- */
4803
- const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4804
- /**
4805
- * The [DI token](guide/glossary/#di-token) for a router configuration.
4806
- *
4807
- * `ROUTES` is a low level API for router configuration via dependency injection.
4808
- *
4809
- * We recommend that in almost all cases to use higher level APIs such as `RouterModule.forRoot()`,
4810
- * `RouterModule.forChild()`, `provideRoutes`, or `Router.resetConfig()`.
4811
- *
4812
- * @publicApi
4813
- */
4814
- const ROUTES = new InjectionToken('ROUTES');
4815
- class RouterConfigLoader {
4816
- constructor(injector, compiler) {
4817
- this.injector = injector;
4818
- this.compiler = compiler;
4819
- this.componentLoaders = new WeakMap();
4820
- this.childrenLoaders = new WeakMap();
4821
- }
4822
- loadComponent(route) {
4823
- if (this.componentLoaders.get(route)) {
4824
- return this.componentLoaders.get(route);
4825
- }
4826
- else if (route._loadedComponent) {
4827
- return of(route._loadedComponent);
4828
- }
4829
- if (this.onLoadStartListener) {
4830
- this.onLoadStartListener(route);
4831
- }
4832
- const loadRunner = wrapIntoObservable(route.loadComponent())
4833
- .pipe(map(maybeUnwrapDefaultExport), tap(component => {
4834
- var _a;
4835
- if (this.onLoadEndListener) {
4836
- this.onLoadEndListener(route);
4837
- }
4838
- NG_DEV_MODE$3 && assertStandalone((_a = route.path) !== null && _a !== void 0 ? _a : '', component);
4839
- route._loadedComponent = component;
4840
- }), finalize(() => {
4841
- this.componentLoaders.delete(route);
4842
- }));
4843
- // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
4844
- const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());
4845
- this.componentLoaders.set(route, loader);
4846
- return loader;
4847
- }
4848
- loadChildren(parentInjector, route) {
4849
- if (this.childrenLoaders.get(route)) {
4850
- return this.childrenLoaders.get(route);
4851
- }
4852
- else if (route._loadedRoutes) {
4853
- return of({ routes: route._loadedRoutes, injector: route._loadedInjector });
4854
- }
4855
- if (this.onLoadStartListener) {
4856
- this.onLoadStartListener(route);
4857
- }
4858
- const moduleFactoryOrRoutes$ = this.loadModuleFactoryOrRoutes(route.loadChildren);
4859
- const loadRunner = moduleFactoryOrRoutes$.pipe(map((factoryOrRoutes) => {
4860
- if (this.onLoadEndListener) {
4861
- this.onLoadEndListener(route);
4862
- }
4863
- // This injector comes from the `NgModuleRef` when lazy loading an `NgModule`. There is no
4864
- // injector associated with lazy loading a `Route` array.
4865
- let injector;
4866
- let rawRoutes;
4867
- let requireStandaloneComponents = false;
4868
- if (Array.isArray(factoryOrRoutes)) {
4869
- rawRoutes = factoryOrRoutes;
4870
- requireStandaloneComponents = true;
4871
- }
4872
- else {
4873
- injector = factoryOrRoutes.create(parentInjector).injector;
4874
- // When loading a module that doesn't provide `RouterModule.forChild()` preloader
4875
- // will get stuck in an infinite loop. The child module's Injector will look to
4876
- // its parent `Injector` when it doesn't find any ROUTES so it will return routes
4877
- // for it's parent module instead.
4878
- rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
4879
- }
4880
- const routes = rawRoutes.map(standardizeConfig);
4881
- NG_DEV_MODE$3 && validateConfig(routes, route.path, requireStandaloneComponents);
4882
- return { routes, injector };
4883
- }), finalize(() => {
4884
- this.childrenLoaders.delete(route);
4885
- }));
4886
- // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
4887
- const loader = new ConnectableObservable(loadRunner, () => new Subject())
4888
- .pipe(refCount());
4889
- this.childrenLoaders.set(route, loader);
4890
- return loader;
4891
- }
4892
- loadModuleFactoryOrRoutes(loadChildren) {
4893
- const deprecatedResult = deprecatedLoadChildrenString(this.injector, loadChildren);
4894
- if (deprecatedResult) {
4895
- return deprecatedResult;
4896
- }
4897
- return wrapIntoObservable(loadChildren())
4898
- .pipe(map(maybeUnwrapDefaultExport), mergeMap((t) => {
4899
- if (t instanceof NgModuleFactory || Array.isArray(t)) {
4900
- return of(t);
4901
- }
4902
- else {
4903
- return from(this.compiler.compileModuleAsync(t));
4904
- }
4905
- }));
4906
- }
4907
- }
4908
- 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 });
4909
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4910
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterConfigLoader, decorators: [{
4911
- type: Injectable,
4912
- args: [{ providedIn: 'root' }]
4913
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4914
- function isWrappedDefaultExport(value) {
4915
- // We use `in` here with a string key `'default'`, because we expect `DefaultExport` objects to be
4916
- // dynamically imported ES modules with a spec-mandated `default` key. Thus we don't expect that
4917
- // `default` will be a renamed property.
4918
- return value && typeof value === 'object' && 'default' in value;
4919
- }
4920
- function maybeUnwrapDefaultExport(input) {
4921
- // As per `isWrappedDefaultExport`, the `default` key here is generated by the browser and not
4922
- // subject to property renaming, so we reference it with bracket access.
4923
- return isWrappedDefaultExport(input) ? input['default'] : input;
4924
- }
4925
-
4926
4988
  /**
4927
4989
  * @license
4928
4990
  * Copyright Google LLC All Rights Reserved.
@@ -4939,9 +5001,9 @@ function maybeUnwrapDefaultExport(input) {
4939
5001
  */
4940
5002
  class UrlHandlingStrategy {
4941
5003
  }
4942
- UrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4943
- UrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlHandlingStrategy, providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) });
4944
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlHandlingStrategy, decorators: [{
5004
+ UrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: UrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5005
+ UrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: UrlHandlingStrategy, providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) });
5006
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: UrlHandlingStrategy, decorators: [{
4945
5007
  type: Injectable,
4946
5008
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) }]
4947
5009
  }] });
@@ -4959,9 +5021,9 @@ class DefaultUrlHandlingStrategy {
4959
5021
  return newUrlPart;
4960
5022
  }
4961
5023
  }
4962
- DefaultUrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultUrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4963
- DefaultUrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultUrlHandlingStrategy, providedIn: 'root' });
4964
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultUrlHandlingStrategy, decorators: [{
5024
+ DefaultUrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultUrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5025
+ DefaultUrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultUrlHandlingStrategy, providedIn: 'root' });
5026
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: DefaultUrlHandlingStrategy, decorators: [{
4965
5027
  type: Injectable,
4966
5028
  args: [{ providedIn: 'root' }]
4967
5029
  }] });
@@ -5052,23 +5114,13 @@ class Router {
5052
5114
  // TODO: vsavkin make internal after the final is out.
5053
5115
  constructor(
5054
5116
  /** @internal */
5055
- rootComponentType,
5056
- /** @internal */
5057
- urlSerializer,
5058
- /** @internal */
5059
- rootContexts,
5060
- /** @internal */
5061
- location, injector, compiler, config) {
5117
+ rootComponentType, urlSerializer, rootContexts, location, injector, compiler, config) {
5062
5118
  this.rootComponentType = rootComponentType;
5063
5119
  this.urlSerializer = urlSerializer;
5064
5120
  this.rootContexts = rootContexts;
5065
5121
  this.location = location;
5066
5122
  this.config = config;
5067
- /** @internal */
5068
- this.lastSuccessfulNavigation = null;
5069
5123
  this.disposed = false;
5070
- /** @internal */
5071
- this.navigationId = 0;
5072
5124
  /**
5073
5125
  * The id of the currently active page in the router.
5074
5126
  * Updated to the transition's target id on a successful navigation.
@@ -5079,10 +5131,6 @@ class Router {
5079
5131
  */
5080
5132
  this.currentPageId = 0;
5081
5133
  this.isNgZoneEnabled = false;
5082
- /**
5083
- * An event stream for routing events in this NgModule.
5084
- */
5085
- this.events = new Subject();
5086
5134
  /**
5087
5135
  * A handler for navigation errors in this NgModule.
5088
5136
  */
@@ -5175,13 +5223,7 @@ class Router {
5175
5223
  *
5176
5224
  */
5177
5225
  this.canceledNavigationResolution = 'replace';
5178
- this.navigationTransitions = new NavigationTransitions(this);
5179
- const onLoadStart = (r) => this.triggerEvent(new RouteConfigLoadStart(r));
5180
- const onLoadEnd = (r) => this.triggerEvent(new RouteConfigLoadEnd(r));
5181
- this.configLoader = injector.get(RouterConfigLoader);
5182
- this.configLoader.onLoadEndListener = onLoadEnd;
5183
- this.configLoader.onLoadStartListener = onLoadStart;
5184
- this.ngModule = injector.get(NgModuleRef);
5226
+ this.navigationTransitions = inject(NavigationTransitions);
5185
5227
  this.console = injector.get(ɵConsole);
5186
5228
  const ngZone = injector.get(NgZone);
5187
5229
  this.isNgZoneEnabled = ngZone instanceof NgZone && NgZone.isInAngularZone();
@@ -5190,28 +5232,17 @@ class Router {
5190
5232
  this.rawUrlTree = this.currentUrlTree;
5191
5233
  this.browserUrlTree = this.currentUrlTree;
5192
5234
  this.routerState = createEmptyState(this.currentUrlTree, this.rootComponentType);
5193
- this.transitions = new BehaviorSubject({
5194
- id: 0,
5195
- targetPageId: 0,
5196
- currentUrlTree: this.currentUrlTree,
5197
- extractedUrl: this.urlHandlingStrategy.extract(this.currentUrlTree),
5198
- urlAfterRedirects: this.urlHandlingStrategy.extract(this.currentUrlTree),
5199
- rawUrl: this.currentUrlTree,
5200
- extras: {},
5201
- resolve: null,
5202
- reject: null,
5203
- promise: Promise.resolve(true),
5204
- source: 'imperative',
5205
- restoredState: null,
5206
- currentSnapshot: this.routerState.snapshot,
5207
- targetSnapshot: null,
5208
- currentRouterState: this.routerState,
5209
- targetRouterState: null,
5210
- guards: { canActivateChecks: [], canDeactivateChecks: [] },
5211
- guardsResult: null,
5235
+ this.navigationTransitions.setupNavigations(this).subscribe(t => {
5236
+ this.lastSuccessfulId = t.id;
5237
+ this.currentPageId = t.targetPageId;
5238
+ }, e => {
5239
+ this.console.warn(`Unhandled Navigation Error: ${e}`);
5212
5240
  });
5213
- this.navigations = this.navigationTransitions.setupNavigations(this.transitions);
5214
- this.processNavigations();
5241
+ }
5242
+ // TODO(b/260747083): This should not exist and navigationId should be private in
5243
+ // `NavigationTransitions`
5244
+ get navigationId() {
5245
+ return this.navigationTransitions.navigationId;
5215
5246
  }
5216
5247
  /**
5217
5248
  * The ɵrouterPageId of whatever page is currently active in the browser history. This is
@@ -5222,6 +5253,16 @@ class Router {
5222
5253
  var _a;
5223
5254
  return (_a = this.location.getState()) === null || _a === void 0 ? void 0 : _a.ɵrouterPageId;
5224
5255
  }
5256
+ /**
5257
+ * An event stream for routing events.
5258
+ */
5259
+ get events() {
5260
+ // TODO(atscott): This _should_ be events.asObservable(). However, this change requires internal
5261
+ // cleanup: tests are doing `(route.events as Subject<Event>).next(...)`. This isn't
5262
+ // allowed/supported but we still have to fix these or file bugs against the teams before making
5263
+ // the change.
5264
+ return this.navigationTransitions.events;
5265
+ }
5225
5266
  /**
5226
5267
  * @internal
5227
5268
  * TODO: this should be removed once the constructor of the router made internal
@@ -5232,15 +5273,12 @@ class Router {
5232
5273
  // this will simplify the lifecycle of the router.
5233
5274
  this.routerState.root.component = this.rootComponentType;
5234
5275
  }
5235
- setTransition(t) {
5236
- this.transitions.next(Object.assign(Object.assign({}, this.transitions.value), t));
5237
- }
5238
5276
  /**
5239
5277
  * Sets up the location change listener and performs the initial navigation.
5240
5278
  */
5241
5279
  initialNavigation() {
5242
5280
  this.setUpLocationChangeListener();
5243
- if (this.navigationId === 0) {
5281
+ if (!this.navigationTransitions.hasRequestedNavigation) {
5244
5282
  this.navigateByUrl(this.location.path(true), { replaceUrl: true });
5245
5283
  }
5246
5284
  }
@@ -5298,10 +5336,6 @@ class Router {
5298
5336
  getCurrentNavigation() {
5299
5337
  return this.navigationTransitions.currentNavigation;
5300
5338
  }
5301
- /** @internal */
5302
- triggerEvent(event) {
5303
- this.events.next(event);
5304
- }
5305
5339
  /**
5306
5340
  * Resets the route configuration used for navigation and generating links.
5307
5341
  *
@@ -5330,7 +5364,7 @@ class Router {
5330
5364
  }
5331
5365
  /** Disposes of the router. */
5332
5366
  dispose() {
5333
- this.transitions.complete();
5367
+ this.navigationTransitions.complete();
5334
5368
  if (this.locationSubscription) {
5335
5369
  this.locationSubscription.unsubscribe();
5336
5370
  this.locationSubscription = undefined;
@@ -5515,21 +5549,6 @@ class Router {
5515
5549
  return result;
5516
5550
  }, {});
5517
5551
  }
5518
- processNavigations() {
5519
- this.navigations.subscribe(t => {
5520
- var _a;
5521
- this.navigated = true;
5522
- this.lastSuccessfulId = t.id;
5523
- this.currentPageId = t.targetPageId;
5524
- this.events
5525
- .next(new NavigationEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(this.currentUrlTree)));
5526
- this.lastSuccessfulNavigation = this.getCurrentNavigation();
5527
- (_a = this.titleStrategy) === null || _a === void 0 ? void 0 : _a.updateTitle(this.routerState.snapshot);
5528
- t.resolve(true);
5529
- }, e => {
5530
- this.console.warn(`Unhandled Navigation Error: ${e}`);
5531
- });
5532
- }
5533
5552
  /** @internal */
5534
5553
  scheduleNavigation(rawUrl, source, restoredState, extras, priorPromise) {
5535
5554
  var _a, _b;
@@ -5550,7 +5569,6 @@ class Router {
5550
5569
  reject = rej;
5551
5570
  });
5552
5571
  }
5553
- const id = ++this.navigationId;
5554
5572
  let targetPageId;
5555
5573
  if (this.canceledNavigationResolution === 'computed') {
5556
5574
  const isInitialPage = this.currentPageId === 0;
@@ -5578,12 +5596,12 @@ class Router {
5578
5596
  // This is unused when `canceledNavigationResolution` is not computed.
5579
5597
  targetPageId = 0;
5580
5598
  }
5581
- this.setTransition({
5582
- id,
5599
+ this.navigationTransitions.handleNavigationRequest({
5583
5600
  targetPageId,
5584
5601
  source,
5585
5602
  restoredState,
5586
5603
  currentUrlTree: this.currentUrlTree,
5604
+ currentRawUrl: this.currentUrlTree,
5587
5605
  rawUrl,
5588
5606
  extras,
5589
5607
  resolve,
@@ -5668,12 +5686,6 @@ class Router {
5668
5686
  resetUrlToCurrentUrlTree() {
5669
5687
  this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
5670
5688
  }
5671
- /** @internal */
5672
- cancelNavigationTransition(transition, reason, code) {
5673
- const navCancel = new NavigationCancel(transition.id, this.serializeUrl(transition.extractedUrl), reason, code);
5674
- this.triggerEvent(navCancel);
5675
- transition.resolve(false);
5676
- }
5677
5689
  generateNgRouterState(navigationId, routerPageId) {
5678
5690
  if (this.canceledNavigationResolution === 'computed') {
5679
5691
  return { navigationId, ɵrouterPageId: routerPageId };
@@ -5681,9 +5693,9 @@ class Router {
5681
5693
  return { navigationId };
5682
5694
  }
5683
5695
  }
5684
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5685
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5686
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: Router, decorators: [{
5696
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5697
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5698
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: Router, decorators: [{
5687
5699
  type: Injectable,
5688
5700
  args: [{
5689
5701
  providedIn: 'root',
@@ -5974,9 +5986,9 @@ class RouterLink {
5974
5986
  });
5975
5987
  }
5976
5988
  }
5977
- 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 });
5978
- 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 });
5979
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterLink, decorators: [{
5989
+ 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 });
5990
+ 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 });
5991
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterLink, decorators: [{
5980
5992
  type: Directive,
5981
5993
  args: [{
5982
5994
  selector: '[routerLink]',
@@ -6205,9 +6217,9 @@ class RouterLinkActive {
6205
6217
  return this.link && isActiveCheckFn(this.link) || this.links.some(isActiveCheckFn);
6206
6218
  }
6207
6219
  }
6208
- 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 });
6209
- 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 });
6210
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterLinkActive, decorators: [{
6220
+ 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 });
6221
+ 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 });
6222
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterLinkActive, decorators: [{
6211
6223
  type: Directive,
6212
6224
  args: [{
6213
6225
  selector: '[routerLinkActive]',
@@ -6269,9 +6281,9 @@ class PreloadAllModules {
6269
6281
  return fn().pipe(catchError(() => of(null)));
6270
6282
  }
6271
6283
  }
6272
- PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6273
- PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6274
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: PreloadAllModules, decorators: [{
6284
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6285
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6286
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: PreloadAllModules, decorators: [{
6275
6287
  type: Injectable,
6276
6288
  args: [{ providedIn: 'root' }]
6277
6289
  }] });
@@ -6289,9 +6301,9 @@ class NoPreloading {
6289
6301
  return of(null);
6290
6302
  }
6291
6303
  }
6292
- NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6293
- NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6294
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NoPreloading, decorators: [{
6304
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6305
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6306
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: NoPreloading, decorators: [{
6295
6307
  type: Injectable,
6296
6308
  args: [{ providedIn: 'root' }]
6297
6309
  }] });
@@ -6387,18 +6399,19 @@ class RouterPreloader {
6387
6399
  });
6388
6400
  }
6389
6401
  }
6390
- 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 });
6391
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
6392
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterPreloader, decorators: [{
6402
+ 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 });
6403
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
6404
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterPreloader, decorators: [{
6393
6405
  type: Injectable,
6394
6406
  args: [{ providedIn: 'root' }]
6395
6407
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
6396
6408
 
6397
6409
  const ROUTER_SCROLLER = new InjectionToken('');
6398
6410
  class RouterScroller {
6399
- constructor(router,
6400
- /** @docsNotRequired */ viewportScroller, zone, options = {}) {
6401
- this.router = router;
6411
+ /** @nodoc */
6412
+ constructor(urlSerializer, transitions, viewportScroller, zone, options = {}) {
6413
+ this.urlSerializer = urlSerializer;
6414
+ this.transitions = transitions;
6402
6415
  this.viewportScroller = viewportScroller;
6403
6416
  this.zone = zone;
6404
6417
  this.options = options;
@@ -6421,7 +6434,7 @@ class RouterScroller {
6421
6434
  this.scrollEventsSubscription = this.consumeScrollEvents();
6422
6435
  }
6423
6436
  createScrollEvents() {
6424
- return this.router.events.subscribe(e => {
6437
+ return this.transitions.events.subscribe(e => {
6425
6438
  if (e instanceof NavigationStart) {
6426
6439
  // store the scroll position of the current stable navigations.
6427
6440
  this.store[this.lastId] = this.viewportScroller.getScrollPosition();
@@ -6430,12 +6443,12 @@ class RouterScroller {
6430
6443
  }
6431
6444
  else if (e instanceof NavigationEnd) {
6432
6445
  this.lastId = e.id;
6433
- this.scheduleScrollEvent(e, this.router.parseUrl(e.urlAfterRedirects).fragment);
6446
+ this.scheduleScrollEvent(e, this.urlSerializer.parse(e.urlAfterRedirects).fragment);
6434
6447
  }
6435
6448
  });
6436
6449
  }
6437
6450
  consumeScrollEvents() {
6438
- return this.router.events.subscribe(e => {
6451
+ return this.transitions.events.subscribe(e => {
6439
6452
  if (!(e instanceof Scroll))
6440
6453
  return;
6441
6454
  // a popstate event. The pop state event will always ignore anchor scrolling.
@@ -6465,26 +6478,23 @@ class RouterScroller {
6465
6478
  // component by executing its update block of the template function.
6466
6479
  setTimeout(() => {
6467
6480
  this.zone.run(() => {
6468
- this.router.triggerEvent(new Scroll(routerEvent, this.lastSource === 'popstate' ? this.store[this.restoredId] : null, anchor));
6481
+ this.transitions.events.next(new Scroll(routerEvent, this.lastSource === 'popstate' ? this.store[this.restoredId] : null, anchor));
6469
6482
  });
6470
6483
  }, 0);
6471
6484
  });
6472
6485
  }
6473
6486
  /** @nodoc */
6474
6487
  ngOnDestroy() {
6475
- if (this.routerEventsSubscription) {
6476
- this.routerEventsSubscription.unsubscribe();
6477
- }
6478
- if (this.scrollEventsSubscription) {
6479
- this.scrollEventsSubscription.unsubscribe();
6480
- }
6488
+ var _a, _b;
6489
+ (_a = this.routerEventsSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
6490
+ (_b = this.scrollEventsSubscription) === null || _b === void 0 ? void 0 : _b.unsubscribe();
6481
6491
  }
6482
6492
  }
6483
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6484
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterScroller });
6485
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterScroller, decorators: [{
6493
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6494
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterScroller });
6495
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterScroller, decorators: [{
6486
6496
  type: Injectable
6487
- }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: i0.NgZone }, { type: undefined }]; } });
6497
+ }], ctorParameters: function () { return [{ type: UrlSerializer }, { type: NavigationTransitions }, { type: i3.ViewportScroller }, { type: i0.NgZone }, { type: undefined }]; } });
6488
6498
 
6489
6499
  /**
6490
6500
  * @license
@@ -6621,10 +6631,11 @@ function withInMemoryScrolling(options = {}) {
6621
6631
  const providers = [{
6622
6632
  provide: ROUTER_SCROLLER,
6623
6633
  useFactory: () => {
6624
- const router = inject(Router);
6625
6634
  const viewportScroller = inject(ViewportScroller);
6626
6635
  const zone = inject(NgZone);
6627
- return new RouterScroller(router, viewportScroller, zone, options);
6636
+ const transitions = inject(NavigationTransitions);
6637
+ const urlSerializer = inject(UrlSerializer);
6638
+ return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, options);
6628
6639
  },
6629
6640
  }];
6630
6641
  return routerFeature(4 /* RouterFeatureKind.InMemoryScrollingFeature */, providers);
@@ -7026,10 +7037,10 @@ class RouterModule {
7026
7037
  };
7027
7038
  }
7028
7039
  }
7029
- 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 });
7030
- 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] });
7031
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
7032
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterModule, decorators: [{
7040
+ 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 });
7041
+ 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] });
7042
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
7043
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: RouterModule, decorators: [{
7033
7044
  type: NgModule,
7034
7045
  args: [{
7035
7046
  imports: ROUTER_DIRECTIVES,
@@ -7051,14 +7062,15 @@ function provideRouterScroller() {
7051
7062
  return {
7052
7063
  provide: ROUTER_SCROLLER,
7053
7064
  useFactory: () => {
7054
- const router = inject(Router);
7055
7065
  const viewportScroller = inject(ViewportScroller);
7056
7066
  const zone = inject(NgZone);
7057
7067
  const config = inject(ROUTER_CONFIGURATION);
7068
+ const transitions = inject(NavigationTransitions);
7069
+ const urlSerializer = inject(UrlSerializer);
7058
7070
  if (config.scrollOffset) {
7059
7071
  viewportScroller.setOffset(config.scrollOffset);
7060
7072
  }
7061
- return new RouterScroller(router, viewportScroller, zone, config);
7073
+ return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, config);
7062
7074
  },
7063
7075
  };
7064
7076
  }
@@ -7116,7 +7128,7 @@ function provideRouterInitializer() {
7116
7128
  /**
7117
7129
  * @publicApi
7118
7130
  */
7119
- const VERSION = new Version('15.0.1');
7131
+ const VERSION = new Version('15.0.2');
7120
7132
 
7121
7133
  /**
7122
7134
  * @license