@angular/router 21.0.1 → 21.1.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @license Angular v21.0.1
2
+ * @license Angular v21.1.0-next.0
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import { DOCUMENT, Location } from '@angular/common';
8
8
  import * as i0 from '@angular/core';
9
- import { ɵisPromise as _isPromise, ɵRuntimeError as _RuntimeError, Injectable, ɵisNgModule as _isNgModule, isStandalone, createEnvironmentInjector, InjectionToken, EventEmitter, input, inject, ViewContainerRef, ChangeDetectorRef, Directive, Input, Output, reflectComponentType, Component, ɵisInjectable as _isInjectable, runInInjectionContext, makeEnvironmentProviders, Compiler, NgModuleFactory, ɵresolveComponentResources as _resolveComponentResources, afterNextRender, signal, EnvironmentInjector, DestroyRef, untracked, ɵConsole as _Console, ɵPendingTasksInternal as _PendingTasksInternal, ɵINTERNAL_APPLICATION_ERROR_HANDLER as _INTERNAL_APPLICATION_ERROR_HANDLER, ɵformatRuntimeError as _formatRuntimeError } from '@angular/core';
9
+ import { ɵisPromise as _isPromise, ɵRuntimeError as _RuntimeError, Injectable, InjectionToken, EventEmitter, input, inject, ViewContainerRef, ChangeDetectorRef, Directive, Input, Output, reflectComponentType, Component, runInInjectionContext, ɵisInjectable as _isInjectable, ɵisNgModule as _isNgModule, isStandalone, createEnvironmentInjector, makeEnvironmentProviders, Compiler, NgModuleFactory, ɵresolveComponentResources as _resolveComponentResources, afterNextRender, signal, EnvironmentInjector, DestroyRef, untracked, ɵConsole as _Console, ɵPendingTasksInternal as _PendingTasksInternal, ɵINTERNAL_APPLICATION_ERROR_HANDLER as _INTERNAL_APPLICATION_ERROR_HANDLER, ɵformatRuntimeError as _formatRuntimeError } from '@angular/core';
10
10
  import { isObservable, from, of, BehaviorSubject, combineLatest, EmptyError, Observable, concat, defer, pipe, throwError, EMPTY, Subject, Subscription } from 'rxjs';
11
11
  import { first, map, switchMap, take, startWith, filter, takeUntil, mergeMap, concatMap, tap, catchError, scan, defaultIfEmpty, last as last$1, takeLast, finalize } from 'rxjs/operators';
12
12
  import * as i1 from '@angular/platform-browser';
@@ -42,27 +42,59 @@ class ParamsAsMap {
42
42
  function convertToParamMap(params) {
43
43
  return new ParamsAsMap(params);
44
44
  }
45
+ function matchParts(routeParts, urlSegments, posParams) {
46
+ for (let i = 0; i < routeParts.length; i++) {
47
+ const part = routeParts[i];
48
+ const segment = urlSegments[i];
49
+ const isParameter = part[0] === ':';
50
+ if (isParameter) {
51
+ posParams[part.substring(1)] = segment;
52
+ } else if (part !== segment.path) {
53
+ return false;
54
+ }
55
+ }
56
+ return true;
57
+ }
45
58
  function defaultUrlMatcher(segments, segmentGroup, route) {
46
59
  const parts = route.path.split('/');
47
- if (parts.length > segments.length) {
60
+ const wildcardIndex = parts.indexOf('**');
61
+ if (wildcardIndex === -1) {
62
+ if (parts.length > segments.length) {
63
+ return null;
64
+ }
65
+ if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || parts.length < segments.length)) {
66
+ return null;
67
+ }
68
+ const posParams = {};
69
+ const consumed = segments.slice(0, parts.length);
70
+ if (!matchParts(parts, consumed, posParams)) {
71
+ return null;
72
+ }
73
+ return {
74
+ consumed,
75
+ posParams
76
+ };
77
+ }
78
+ if (wildcardIndex !== parts.lastIndexOf('**')) {
48
79
  return null;
49
80
  }
50
- if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || parts.length < segments.length)) {
81
+ const pre = parts.slice(0, wildcardIndex);
82
+ const post = parts.slice(wildcardIndex + 1);
83
+ if (pre.length + post.length > segments.length) {
84
+ return null;
85
+ }
86
+ if (route.pathMatch === 'full' && segmentGroup.hasChildren() && route.path !== '**') {
51
87
  return null;
52
88
  }
53
89
  const posParams = {};
54
- for (let index = 0; index < parts.length; index++) {
55
- const part = parts[index];
56
- const segment = segments[index];
57
- const isParameter = part[0] === ':';
58
- if (isParameter) {
59
- posParams[part.substring(1)] = segment;
60
- } else if (part !== segment.path) {
61
- return null;
62
- }
90
+ if (!matchParts(pre, segments.slice(0, pre.length), posParams)) {
91
+ return null;
92
+ }
93
+ if (!matchParts(post, segments.slice(segments.length - post.length), posParams)) {
94
+ return null;
63
95
  }
64
96
  return {
65
- consumed: segments.slice(0, parts.length),
97
+ consumed: segments,
66
98
  posParams
67
99
  };
68
100
  }
@@ -276,7 +308,7 @@ function mapChildrenIntoArray(segment, fn) {
276
308
  class UrlSerializer {
277
309
  static ɵfac = i0.ɵɵngDeclareFactory({
278
310
  minVersion: "12.0.0",
279
- version: "21.0.1",
311
+ version: "21.1.0-next.0",
280
312
  ngImport: i0,
281
313
  type: UrlSerializer,
282
314
  deps: [],
@@ -284,7 +316,7 @@ class UrlSerializer {
284
316
  });
285
317
  static ɵprov = i0.ɵɵngDeclareInjectable({
286
318
  minVersion: "12.0.0",
287
- version: "21.0.1",
319
+ version: "21.1.0-next.0",
288
320
  ngImport: i0,
289
321
  type: UrlSerializer,
290
322
  providedIn: 'root',
@@ -293,7 +325,7 @@ class UrlSerializer {
293
325
  }
294
326
  i0.ɵɵngDeclareClassMetadata({
295
327
  minVersion: "12.0.0",
296
- version: "21.0.1",
328
+ version: "21.1.0-next.0",
297
329
  ngImport: i0,
298
330
  type: UrlSerializer,
299
331
  decorators: [{
@@ -1125,11 +1157,13 @@ class Scroll {
1125
1157
  routerEvent;
1126
1158
  position;
1127
1159
  anchor;
1160
+ scrollBehavior;
1128
1161
  type = EventType.Scroll;
1129
- constructor(routerEvent, position, anchor) {
1162
+ constructor(routerEvent, position, anchor, scrollBehavior) {
1130
1163
  this.routerEvent = routerEvent;
1131
1164
  this.position = position;
1132
1165
  this.anchor = anchor;
1166
+ this.scrollBehavior = scrollBehavior;
1133
1167
  }
1134
1168
  toString() {
1135
1169
  const pos = this.position ? `${this.position[0]}, ${this.position[1]}` : null;
@@ -1188,126 +1222,6 @@ function stringifyEvent(routerEvent) {
1188
1222
  }
1189
1223
  }
1190
1224
 
1191
- function getOrCreateRouteInjectorIfNeeded(route, currentInjector) {
1192
- if (route.providers && !route._injector) {
1193
- route._injector = createEnvironmentInjector(route.providers, currentInjector, `Route: ${route.path}`);
1194
- }
1195
- return route._injector ?? currentInjector;
1196
- }
1197
- function validateConfig(config, parentPath = '', requireStandaloneComponents = false) {
1198
- for (let i = 0; i < config.length; i++) {
1199
- const route = config[i];
1200
- const fullPath = getFullPath(parentPath, route);
1201
- validateNode(route, fullPath, requireStandaloneComponents);
1202
- }
1203
- }
1204
- function assertStandalone(fullPath, component) {
1205
- if (component && _isNgModule(component)) {
1206
- throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}'. You are using 'loadComponent' with a module, ` + `but it must be used with standalone components. Use 'loadChildren' instead.`);
1207
- } else if (component && !isStandalone(component)) {
1208
- throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);
1209
- }
1210
- }
1211
- function validateNode(route, fullPath, requireStandaloneComponents) {
1212
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
1213
- if (!route) {
1214
- throw new _RuntimeError(4014, `
1215
- Invalid configuration of route '${fullPath}': Encountered undefined route.
1216
- The reason might be an extra comma.
1217
-
1218
- Example:
1219
- const routes: Routes = [
1220
- { path: '', redirectTo: '/dashboard', pathMatch: 'full' },
1221
- { path: 'dashboard', component: DashboardComponent },, << two commas
1222
- { path: 'detail/:id', component: HeroDetailComponent }
1223
- ];
1224
- `);
1225
- }
1226
- if (Array.isArray(route)) {
1227
- throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': Array cannot be specified`);
1228
- }
1229
- if (!route.redirectTo && !route.component && !route.loadComponent && !route.children && !route.loadChildren && route.outlet && route.outlet !== PRIMARY_OUTLET) {
1230
- throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);
1231
- }
1232
- if (route.redirectTo && route.children) {
1233
- throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
1234
- }
1235
- if (route.redirectTo && route.loadChildren) {
1236
- throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
1237
- }
1238
- if (route.children && route.loadChildren) {
1239
- throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
1240
- }
1241
- if (route.component && route.loadComponent) {
1242
- throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
1243
- }
1244
- if (route.redirectTo) {
1245
- if (route.component || route.loadComponent) {
1246
- throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
1247
- }
1248
- if (route.canMatch || route.canActivate) {
1249
- throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and ${route.canMatch ? 'canMatch' : 'canActivate'} cannot be used together.` + `Redirects happen before guards are executed.`);
1250
- }
1251
- }
1252
- if (route.path && route.matcher) {
1253
- throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
1254
- }
1255
- if (route.redirectTo === void 0 && !route.component && !route.loadComponent && !route.children && !route.loadChildren) {
1256
- throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren`);
1257
- }
1258
- if (route.path === void 0 && route.matcher === void 0) {
1259
- throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
1260
- }
1261
- if (typeof route.path === 'string' && route.path.charAt(0) === '/') {
1262
- throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);
1263
- }
1264
- if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {
1265
- const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;
1266
- throw new _RuntimeError(4014, `Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
1267
- }
1268
- if (requireStandaloneComponents) {
1269
- assertStandalone(fullPath, route.component);
1270
- }
1271
- }
1272
- if (route.children) {
1273
- validateConfig(route.children, fullPath, requireStandaloneComponents);
1274
- }
1275
- }
1276
- function getFullPath(parentPath, currentRoute) {
1277
- if (!currentRoute) {
1278
- return parentPath;
1279
- }
1280
- if (!parentPath && !currentRoute.path) {
1281
- return '';
1282
- } else if (parentPath && !currentRoute.path) {
1283
- return `${parentPath}/`;
1284
- } else if (!parentPath && currentRoute.path) {
1285
- return currentRoute.path;
1286
- } else {
1287
- return `${parentPath}/${currentRoute.path}`;
1288
- }
1289
- }
1290
- function getOutlet(route) {
1291
- return route.outlet || PRIMARY_OUTLET;
1292
- }
1293
- function sortByMatchingOutlets(routes, outletName) {
1294
- const sortedConfig = routes.filter(r => getOutlet(r) === outletName);
1295
- sortedConfig.push(...routes.filter(r => getOutlet(r) !== outletName));
1296
- return sortedConfig;
1297
- }
1298
- function getClosestRouteInjector(snapshot) {
1299
- if (!snapshot) return null;
1300
- if (snapshot.routeConfig?._injector) {
1301
- return snapshot.routeConfig._injector;
1302
- }
1303
- for (let s = snapshot.parent; s; s = s.parent) {
1304
- const route = s.routeConfig;
1305
- if (route?._loadedInjector) return route._loadedInjector;
1306
- if (route?._injector) return route._injector;
1307
- }
1308
- return null;
1309
- }
1310
-
1311
1225
  class OutletContext {
1312
1226
  rootInjector;
1313
1227
  outlet = null;
@@ -1315,7 +1229,7 @@ class OutletContext {
1315
1229
  children;
1316
1230
  attachRef = null;
1317
1231
  get injector() {
1318
- return getClosestRouteInjector(this.route?.snapshot) ?? this.rootInjector;
1232
+ return this.route?.snapshot._environmentInjector ?? this.rootInjector;
1319
1233
  }
1320
1234
  constructor(rootInjector) {
1321
1235
  this.rootInjector = rootInjector;
@@ -1361,7 +1275,7 @@ class ChildrenOutletContexts {
1361
1275
  }
1362
1276
  static ɵfac = i0.ɵɵngDeclareFactory({
1363
1277
  minVersion: "12.0.0",
1364
- version: "21.0.1",
1278
+ version: "21.1.0-next.0",
1365
1279
  ngImport: i0,
1366
1280
  type: ChildrenOutletContexts,
1367
1281
  deps: [{
@@ -1371,7 +1285,7 @@ class ChildrenOutletContexts {
1371
1285
  });
1372
1286
  static ɵprov = i0.ɵɵngDeclareInjectable({
1373
1287
  minVersion: "12.0.0",
1374
- version: "21.0.1",
1288
+ version: "21.1.0-next.0",
1375
1289
  ngImport: i0,
1376
1290
  type: ChildrenOutletContexts,
1377
1291
  providedIn: 'root'
@@ -1379,7 +1293,7 @@ class ChildrenOutletContexts {
1379
1293
  }
1380
1294
  i0.ɵɵngDeclareClassMetadata({
1381
1295
  minVersion: "12.0.0",
1382
- version: "21.0.1",
1296
+ version: "21.1.0-next.0",
1383
1297
  ngImport: i0,
1384
1298
  type: ChildrenOutletContexts,
1385
1299
  decorators: [{
@@ -1472,8 +1386,8 @@ class RouterState extends Tree {
1472
1386
  return this.snapshot.toString();
1473
1387
  }
1474
1388
  }
1475
- function createEmptyState(rootComponent) {
1476
- const snapshot = createEmptyStateSnapshot(rootComponent);
1389
+ function createEmptyState(rootComponent, injector) {
1390
+ const snapshot = createEmptyStateSnapshot(rootComponent, injector);
1477
1391
  const emptyUrl = new BehaviorSubject([new UrlSegment('', {})]);
1478
1392
  const emptyParams = new BehaviorSubject({});
1479
1393
  const emptyData = new BehaviorSubject({});
@@ -1483,12 +1397,12 @@ function createEmptyState(rootComponent) {
1483
1397
  activated.snapshot = snapshot.root;
1484
1398
  return new RouterState(new TreeNode(activated, []), snapshot);
1485
1399
  }
1486
- function createEmptyStateSnapshot(rootComponent) {
1400
+ function createEmptyStateSnapshot(rootComponent, injector) {
1487
1401
  const emptyParams = {};
1488
1402
  const emptyData = {};
1489
1403
  const emptyQueryParams = {};
1490
1404
  const fragment = '';
1491
- const activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, {});
1405
+ const activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, {}, injector);
1492
1406
  return new RouterStateSnapshot('', new TreeNode(activated, []));
1493
1407
  }
1494
1408
  class ActivatedRoute {
@@ -1611,10 +1525,11 @@ class ActivatedRouteSnapshot {
1611
1525
  _routerState;
1612
1526
  _paramMap;
1613
1527
  _queryParamMap;
1528
+ _environmentInjector;
1614
1529
  get title() {
1615
1530
  return this.data?.[RouteTitleKey];
1616
1531
  }
1617
- constructor(url, params, queryParams, fragment, data, outlet, component, routeConfig, resolve) {
1532
+ constructor(url, params, queryParams, fragment, data, outlet, component, routeConfig, resolve, environmentInjector) {
1618
1533
  this.url = url;
1619
1534
  this.params = params;
1620
1535
  this.queryParams = queryParams;
@@ -1624,6 +1539,7 @@ class ActivatedRouteSnapshot {
1624
1539
  this.component = component;
1625
1540
  this.routeConfig = routeConfig;
1626
1541
  this._resolve = resolve;
1542
+ this._environmentInjector = environmentInjector;
1627
1543
  }
1628
1544
  get root() {
1629
1545
  return this._routerState.root;
@@ -1836,7 +1752,7 @@ class RouterOutlet {
1836
1752
  }
1837
1753
  static ɵfac = i0.ɵɵngDeclareFactory({
1838
1754
  minVersion: "12.0.0",
1839
- version: "21.0.1",
1755
+ version: "21.1.0-next.0",
1840
1756
  ngImport: i0,
1841
1757
  type: RouterOutlet,
1842
1758
  deps: [],
@@ -1844,7 +1760,7 @@ class RouterOutlet {
1844
1760
  });
1845
1761
  static ɵdir = i0.ɵɵngDeclareDirective({
1846
1762
  minVersion: "17.1.0",
1847
- version: "21.0.1",
1763
+ version: "21.1.0-next.0",
1848
1764
  type: RouterOutlet,
1849
1765
  isStandalone: true,
1850
1766
  selector: "router-outlet",
@@ -1877,7 +1793,7 @@ class RouterOutlet {
1877
1793
  }
1878
1794
  i0.ɵɵngDeclareClassMetadata({
1879
1795
  minVersion: "12.0.0",
1880
- version: "21.0.1",
1796
+ version: "21.1.0-next.0",
1881
1797
  ngImport: i0,
1882
1798
  type: RouterOutlet,
1883
1799
  decorators: [{
@@ -1986,7 +1902,7 @@ class RoutedComponentInputBinder {
1986
1902
  }
1987
1903
  static ɵfac = i0.ɵɵngDeclareFactory({
1988
1904
  minVersion: "12.0.0",
1989
- version: "21.0.1",
1905
+ version: "21.1.0-next.0",
1990
1906
  ngImport: i0,
1991
1907
  type: RoutedComponentInputBinder,
1992
1908
  deps: [],
@@ -1994,14 +1910,14 @@ class RoutedComponentInputBinder {
1994
1910
  });
1995
1911
  static ɵprov = i0.ɵɵngDeclareInjectable({
1996
1912
  minVersion: "12.0.0",
1997
- version: "21.0.1",
1913
+ version: "21.1.0-next.0",
1998
1914
  ngImport: i0,
1999
1915
  type: RoutedComponentInputBinder
2000
1916
  });
2001
1917
  }
2002
1918
  i0.ɵɵngDeclareClassMetadata({
2003
1919
  minVersion: "12.0.0",
2004
- version: "21.0.1",
1920
+ version: "21.1.0-next.0",
2005
1921
  ngImport: i0,
2006
1922
  type: RoutedComponentInputBinder,
2007
1923
  decorators: [{
@@ -2012,7 +1928,7 @@ i0.ɵɵngDeclareClassMetadata({
2012
1928
  class ɵEmptyOutletComponent {
2013
1929
  static ɵfac = i0.ɵɵngDeclareFactory({
2014
1930
  minVersion: "12.0.0",
2015
- version: "21.0.1",
1931
+ version: "21.1.0-next.0",
2016
1932
  ngImport: i0,
2017
1933
  type: ɵEmptyOutletComponent,
2018
1934
  deps: [],
@@ -2020,7 +1936,7 @@ class ɵEmptyOutletComponent {
2020
1936
  });
2021
1937
  static ɵcmp = i0.ɵɵngDeclareComponent({
2022
1938
  minVersion: "14.0.0",
2023
- version: "21.0.1",
1939
+ version: "21.1.0-next.0",
2024
1940
  type: ɵEmptyOutletComponent,
2025
1941
  isStandalone: true,
2026
1942
  selector: "ng-component",
@@ -2040,7 +1956,7 @@ class ɵEmptyOutletComponent {
2040
1956
  }
2041
1957
  i0.ɵɵngDeclareClassMetadata({
2042
1958
  minVersion: "12.0.0",
2043
- version: "21.0.1",
1959
+ version: "21.1.0-next.0",
2044
1960
  ngImport: i0,
2045
1961
  type: ɵEmptyOutletComponent,
2046
1962
  decorators: [{
@@ -2384,7 +2300,7 @@ function getRouteGuards(futureNode, currNode, parentContexts, futurePath, checks
2384
2300
  }
2385
2301
  function shouldRunGuardsAndResolvers(curr, future, mode) {
2386
2302
  if (typeof mode === 'function') {
2387
- return mode(curr, future);
2303
+ return runInInjectionContext(future._environmentInjector, () => mode(curr, future));
2388
2304
  }
2389
2305
  switch (mode) {
2390
2306
  case 'pathParamsChange':
@@ -2484,7 +2400,7 @@ function takeUntilAbort(signal) {
2484
2400
  return takeUntil(abortSignalToObservable(signal));
2485
2401
  }
2486
2402
 
2487
- function checkGuards(injector, forwardEvent) {
2403
+ function checkGuards(forwardEvent) {
2488
2404
  return mergeMap(t => {
2489
2405
  const {
2490
2406
  targetSnapshot,
@@ -2500,22 +2416,22 @@ function checkGuards(injector, forwardEvent) {
2500
2416
  guardsResult: true
2501
2417
  });
2502
2418
  }
2503
- return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, injector).pipe(mergeMap(canDeactivate => {
2504
- return canDeactivate && isBoolean(canDeactivate) ? runCanActivateChecks(targetSnapshot, canActivateChecks, injector, forwardEvent) : of(canDeactivate);
2419
+ return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot).pipe(mergeMap(canDeactivate => {
2420
+ return canDeactivate && isBoolean(canDeactivate) ? runCanActivateChecks(targetSnapshot, canActivateChecks, forwardEvent) : of(canDeactivate);
2505
2421
  }), map(guardsResult => ({
2506
2422
  ...t,
2507
2423
  guardsResult
2508
2424
  })));
2509
2425
  });
2510
2426
  }
2511
- function runCanDeactivateChecks(checks, futureRSS, currRSS, injector) {
2512
- return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, injector)), first(result => {
2427
+ function runCanDeactivateChecks(checks, futureRSS, currRSS) {
2428
+ return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS)), first(result => {
2513
2429
  return result !== true;
2514
2430
  }, true));
2515
2431
  }
2516
- function runCanActivateChecks(futureSnapshot, checks, injector, forwardEvent) {
2432
+ function runCanActivateChecks(futureSnapshot, checks, forwardEvent) {
2517
2433
  return from(checks).pipe(concatMap(check => {
2518
- return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, injector), runCanActivate(futureSnapshot, check.route, injector));
2434
+ return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path), runCanActivate(futureSnapshot, check.route));
2519
2435
  }), first(result => {
2520
2436
  return result !== true;
2521
2437
  }, true));
@@ -2532,12 +2448,12 @@ function fireChildActivationStart(snapshot, forwardEvent) {
2532
2448
  }
2533
2449
  return of(true);
2534
2450
  }
2535
- function runCanActivate(futureRSS, futureARS, injector) {
2451
+ function runCanActivate(futureRSS, futureARS) {
2536
2452
  const canActivate = futureARS.routeConfig ? futureARS.routeConfig.canActivate : null;
2537
2453
  if (!canActivate || canActivate.length === 0) return of(true);
2538
2454
  const canActivateObservables = canActivate.map(canActivate => {
2539
2455
  return defer(() => {
2540
- const closestInjector = getClosestRouteInjector(futureARS) ?? injector;
2456
+ const closestInjector = futureARS._environmentInjector;
2541
2457
  const guard = getTokenOrFunctionIdentity(canActivate, closestInjector);
2542
2458
  const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));
2543
2459
  return wrapIntoObservable(guardVal).pipe(first());
@@ -2545,13 +2461,13 @@ function runCanActivate(futureRSS, futureARS, injector) {
2545
2461
  });
2546
2462
  return of(canActivateObservables).pipe(prioritizedGuardValue());
2547
2463
  }
2548
- function runCanActivateChild(futureRSS, path, injector) {
2464
+ function runCanActivateChild(futureRSS, path) {
2549
2465
  const futureARS = path[path.length - 1];
2550
2466
  const canActivateChildGuards = path.slice(0, path.length - 1).reverse().map(p => getCanActivateChild(p)).filter(_ => _ !== null);
2551
2467
  const canActivateChildGuardsMapped = canActivateChildGuards.map(d => {
2552
2468
  return defer(() => {
2553
2469
  const guardsMapped = d.guards.map(canActivateChild => {
2554
- const closestInjector = getClosestRouteInjector(d.node) ?? injector;
2470
+ const closestInjector = d.node._environmentInjector;
2555
2471
  const guard = getTokenOrFunctionIdentity(canActivateChild, closestInjector);
2556
2472
  const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));
2557
2473
  return wrapIntoObservable(guardVal).pipe(first());
@@ -2561,11 +2477,11 @@ function runCanActivateChild(futureRSS, path, injector) {
2561
2477
  });
2562
2478
  return of(canActivateChildGuardsMapped).pipe(prioritizedGuardValue());
2563
2479
  }
2564
- function runCanDeactivate(component, currARS, currRSS, futureRSS, injector) {
2480
+ function runCanDeactivate(component, currARS, currRSS, futureRSS) {
2565
2481
  const canDeactivate = currARS && currARS.routeConfig ? currARS.routeConfig.canDeactivate : null;
2566
2482
  if (!canDeactivate || canDeactivate.length === 0) return of(true);
2567
2483
  const canDeactivateObservables = canDeactivate.map(c => {
2568
- const closestInjector = getClosestRouteInjector(currARS) ?? injector;
2484
+ const closestInjector = currARS._environmentInjector;
2569
2485
  const guard = getTokenOrFunctionIdentity(c, closestInjector);
2570
2486
  const guardVal = isCanDeactivate(guard) ? guard.canDeactivate(component, currARS, currRSS, futureRSS) : runInInjectionContext(closestInjector, () => guard(component, currARS, currRSS, futureRSS));
2571
2487
  return wrapIntoObservable(guardVal).pipe(first());
@@ -2729,6 +2645,114 @@ function getRedirectResult$1(redirectTo, currentSnapshot, injector) {
2729
2645
  }))));
2730
2646
  }
2731
2647
 
2648
+ function getOrCreateRouteInjectorIfNeeded(route, currentInjector) {
2649
+ if (route.providers && !route._injector) {
2650
+ route._injector = createEnvironmentInjector(route.providers, currentInjector, `Route: ${route.path}`);
2651
+ }
2652
+ return route._injector ?? currentInjector;
2653
+ }
2654
+ function validateConfig(config, parentPath = '', requireStandaloneComponents = false) {
2655
+ for (let i = 0; i < config.length; i++) {
2656
+ const route = config[i];
2657
+ const fullPath = getFullPath(parentPath, route);
2658
+ validateNode(route, fullPath, requireStandaloneComponents);
2659
+ }
2660
+ }
2661
+ function assertStandalone(fullPath, component) {
2662
+ if (component && _isNgModule(component)) {
2663
+ throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}'. You are using 'loadComponent' with a module, ` + `but it must be used with standalone components. Use 'loadChildren' instead.`);
2664
+ } else if (component && !isStandalone(component)) {
2665
+ throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);
2666
+ }
2667
+ }
2668
+ function validateNode(route, fullPath, requireStandaloneComponents) {
2669
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
2670
+ if (!route) {
2671
+ throw new _RuntimeError(4014, `
2672
+ Invalid configuration of route '${fullPath}': Encountered undefined route.
2673
+ The reason might be an extra comma.
2674
+
2675
+ Example:
2676
+ const routes: Routes = [
2677
+ { path: '', redirectTo: '/dashboard', pathMatch: 'full' },
2678
+ { path: 'dashboard', component: DashboardComponent },, << two commas
2679
+ { path: 'detail/:id', component: HeroDetailComponent }
2680
+ ];
2681
+ `);
2682
+ }
2683
+ if (Array.isArray(route)) {
2684
+ throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': Array cannot be specified`);
2685
+ }
2686
+ if (!route.redirectTo && !route.component && !route.loadComponent && !route.children && !route.loadChildren && route.outlet && route.outlet !== PRIMARY_OUTLET) {
2687
+ throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);
2688
+ }
2689
+ if (route.redirectTo && route.children) {
2690
+ throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
2691
+ }
2692
+ if (route.redirectTo && route.loadChildren) {
2693
+ throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
2694
+ }
2695
+ if (route.children && route.loadChildren) {
2696
+ throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
2697
+ }
2698
+ if (route.component && route.loadComponent) {
2699
+ throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
2700
+ }
2701
+ if (route.redirectTo) {
2702
+ if (route.component || route.loadComponent) {
2703
+ throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
2704
+ }
2705
+ if (route.canMatch || route.canActivate) {
2706
+ throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and ${route.canMatch ? 'canMatch' : 'canActivate'} cannot be used together.` + `Redirects happen before guards are executed.`);
2707
+ }
2708
+ }
2709
+ if (route.path && route.matcher) {
2710
+ throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
2711
+ }
2712
+ if (route.redirectTo === void 0 && !route.component && !route.loadComponent && !route.children && !route.loadChildren) {
2713
+ throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren`);
2714
+ }
2715
+ if (route.path === void 0 && route.matcher === void 0) {
2716
+ throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
2717
+ }
2718
+ if (typeof route.path === 'string' && route.path.charAt(0) === '/') {
2719
+ throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);
2720
+ }
2721
+ if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {
2722
+ const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;
2723
+ throw new _RuntimeError(4014, `Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
2724
+ }
2725
+ if (requireStandaloneComponents) {
2726
+ assertStandalone(fullPath, route.component);
2727
+ }
2728
+ }
2729
+ if (route.children) {
2730
+ validateConfig(route.children, fullPath, requireStandaloneComponents);
2731
+ }
2732
+ }
2733
+ function getFullPath(parentPath, currentRoute) {
2734
+ if (!currentRoute) {
2735
+ return parentPath;
2736
+ }
2737
+ if (!parentPath && !currentRoute.path) {
2738
+ return '';
2739
+ } else if (parentPath && !currentRoute.path) {
2740
+ return `${parentPath}/`;
2741
+ } else if (!parentPath && currentRoute.path) {
2742
+ return currentRoute.path;
2743
+ } else {
2744
+ return `${parentPath}/${currentRoute.path}`;
2745
+ }
2746
+ }
2747
+ function getOutlet(route) {
2748
+ return route.outlet || PRIMARY_OUTLET;
2749
+ }
2750
+ function sortByMatchingOutlets(routes, outletName) {
2751
+ const sortedConfig = routes.filter(r => getOutlet(r) === outletName);
2752
+ sortedConfig.push(...routes.filter(r => getOutlet(r) !== outletName));
2753
+ return sortedConfig;
2754
+ }
2755
+
2732
2756
  const noMatch$1 = {
2733
2757
  matched: false,
2734
2758
  consumedSegments: [],
@@ -2747,9 +2771,6 @@ function matchWithChecks(segmentGroup, route, segments, injector, urlSerializer,
2747
2771
  }));
2748
2772
  }
2749
2773
  function match(segmentGroup, route, segments) {
2750
- if (route.path === '**') {
2751
- return createWildcardMatchResult(segments);
2752
- }
2753
2774
  if (route.path === '') {
2754
2775
  if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || segments.length > 0)) {
2755
2776
  return {
@@ -2785,15 +2806,6 @@ function match(segmentGroup, route, segments) {
2785
2806
  positionalParamSegments: res.posParams ?? {}
2786
2807
  };
2787
2808
  }
2788
- function createWildcardMatchResult(segments) {
2789
- return {
2790
- matched: true,
2791
- parameters: segments.length > 0 ? last(segments).parameters : {},
2792
- consumedSegments: segments,
2793
- remainingSegments: [],
2794
- positionalParamSegments: {}
2795
- };
2796
- }
2797
2809
  function split(segmentGroup, consumedSegments, slicedSegments, config) {
2798
2810
  if (slicedSegments.length > 0 && containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, config)) {
2799
2811
  const s = new UrlSegmentGroup(consumedSegments, createChildrenForEmptyPaths(config, new UrlSegmentGroup(slicedSegments, segmentGroup.children)));
@@ -2905,7 +2917,7 @@ let Recognizer$1 = class Recognizer {
2905
2917
  async match(rootSegmentGroup) {
2906
2918
  const rootSnapshot = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze({
2907
2919
  ...this.urlTree.queryParams
2908
- }), this.urlTree.fragment, Object.freeze({}), PRIMARY_OUTLET, this.rootComponentType, null, {});
2920
+ }), this.urlTree.fragment, Object.freeze({}), PRIMARY_OUTLET, this.rootComponentType, null, {}, this.injector);
2909
2921
  try {
2910
2922
  const children = await this.processSegmentGroup(this.injector, this.config, rootSegmentGroup, PRIMARY_OUTLET, rootSnapshot);
2911
2923
  return {
@@ -3001,7 +3013,7 @@ let Recognizer$1 = class Recognizer {
3001
3013
  }
3002
3014
  const currentSnapshot = new ActivatedRouteSnapshot(segments, parameters, Object.freeze({
3003
3015
  ...this.urlTree.queryParams
3004
- }), this.urlTree.fragment, getData$1(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve$1(route));
3016
+ }), this.urlTree.fragment, getData$1(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve$1(route), injector);
3005
3017
  const inherited = getInherited(currentSnapshot, parentRoute, this.paramsInheritanceStrategy);
3006
3018
  currentSnapshot.params = Object.freeze(inherited.params);
3007
3019
  currentSnapshot.data = Object.freeze(inherited.data);
@@ -3035,7 +3047,7 @@ let Recognizer$1 = class Recognizer {
3035
3047
  } = result;
3036
3048
  const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({
3037
3049
  ...this.urlTree.queryParams
3038
- }), this.urlTree.fragment, getData$1(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve$1(route));
3050
+ }), this.urlTree.fragment, getData$1(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve$1(route), injector);
3039
3051
  const inherited = getInherited(snapshot, parentRoute, this.paramsInheritanceStrategy);
3040
3052
  snapshot.params = Object.freeze(inherited.params);
3041
3053
  snapshot.data = Object.freeze(inherited.data);
@@ -3314,7 +3326,7 @@ class Recognizer {
3314
3326
  match(rootSegmentGroup) {
3315
3327
  const rootSnapshot = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze({
3316
3328
  ...this.urlTree.queryParams
3317
- }), this.urlTree.fragment, Object.freeze({}), PRIMARY_OUTLET, this.rootComponentType, null, {});
3329
+ }), this.urlTree.fragment, Object.freeze({}), PRIMARY_OUTLET, this.rootComponentType, null, {}, this.injector);
3318
3330
  return this.processSegmentGroup(this.injector, this.config, rootSegmentGroup, PRIMARY_OUTLET, rootSnapshot).pipe(map(children => {
3319
3331
  return {
3320
3332
  children,
@@ -3413,7 +3425,7 @@ class Recognizer {
3413
3425
  }
3414
3426
  const currentSnapshot = new ActivatedRouteSnapshot(segments, parameters, Object.freeze({
3415
3427
  ...this.urlTree.queryParams
3416
- }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));
3428
+ }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route), injector);
3417
3429
  const inherited = getInherited(currentSnapshot, parentRoute, this.paramsInheritanceStrategy);
3418
3430
  currentSnapshot.params = Object.freeze(inherited.params);
3419
3431
  currentSnapshot.data = Object.freeze(inherited.data);
@@ -3443,7 +3455,7 @@ class Recognizer {
3443
3455
  } = result;
3444
3456
  const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({
3445
3457
  ...this.urlTree.queryParams
3446
- }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));
3458
+ }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route), injector);
3447
3459
  const inherited = getInherited(snapshot, parentRoute, this.paramsInheritanceStrategy);
3448
3460
  snapshot.params = Object.freeze(inherited.params);
3449
3461
  snapshot.data = Object.freeze(inherited.data);
@@ -3573,7 +3585,7 @@ function recognize(injector, configLoader, rootComponentType, config, serializer
3573
3585
  })));
3574
3586
  }
3575
3587
 
3576
- function resolveData(paramsInheritanceStrategy, injector) {
3588
+ function resolveData(paramsInheritanceStrategy) {
3577
3589
  return mergeMap(t => {
3578
3590
  const {
3579
3591
  targetSnapshot,
@@ -3597,7 +3609,7 @@ function resolveData(paramsInheritanceStrategy, injector) {
3597
3609
  let routesProcessed = 0;
3598
3610
  return from(routesNeedingDataUpdates).pipe(concatMap(route => {
3599
3611
  if (routesWithResolversToRun.has(route)) {
3600
- return runResolve(route, targetSnapshot, paramsInheritanceStrategy, injector);
3612
+ return runResolve(route, targetSnapshot, paramsInheritanceStrategy);
3601
3613
  } else {
3602
3614
  route.data = getInherited(route, route.parent, paramsInheritanceStrategy).resolve;
3603
3615
  return of(void 0);
@@ -3609,7 +3621,7 @@ function flattenRouteTree(route) {
3609
3621
  const descendants = route.children.map(child => flattenRouteTree(child)).flat();
3610
3622
  return [route, ...descendants];
3611
3623
  }
3612
- function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) {
3624
+ function runResolve(futureARS, futureRSS, paramsInheritanceStrategy) {
3613
3625
  const config = futureARS.routeConfig;
3614
3626
  const resolve = futureARS._resolve;
3615
3627
  if (config?.title !== undefined && !hasStaticTitle(config)) {
@@ -3617,7 +3629,7 @@ function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) {
3617
3629
  }
3618
3630
  return defer(() => {
3619
3631
  futureARS.data = getInherited(futureARS, futureARS.parent, paramsInheritanceStrategy).resolve;
3620
- return resolveNode(resolve, futureARS, futureRSS, injector).pipe(map(resolvedData => {
3632
+ return resolveNode(resolve, futureARS, futureRSS).pipe(map(resolvedData => {
3621
3633
  futureARS._resolvedData = resolvedData;
3622
3634
  futureARS.data = {
3623
3635
  ...futureARS.data,
@@ -3627,21 +3639,21 @@ function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) {
3627
3639
  }));
3628
3640
  });
3629
3641
  }
3630
- function resolveNode(resolve, futureARS, futureRSS, injector) {
3642
+ function resolveNode(resolve, futureARS, futureRSS) {
3631
3643
  const keys = getDataKeys(resolve);
3632
3644
  if (keys.length === 0) {
3633
3645
  return of({});
3634
3646
  }
3635
3647
  const data = {};
3636
- return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, injector).pipe(first(), tap(value => {
3648
+ return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS).pipe(first(), tap(value => {
3637
3649
  if (value instanceof RedirectCommand) {
3638
3650
  throw redirectingNavigationError(new DefaultUrlSerializer(), value);
3639
3651
  }
3640
3652
  data[key] = value;
3641
3653
  }))), takeLast(1), map(() => data), catchError(e => isEmptyError(e) ? EMPTY : throwError(e)));
3642
3654
  }
3643
- function getResolver(injectionToken, futureARS, futureRSS, injector) {
3644
- const closestInjector = getClosestRouteInjector(futureARS) ?? injector;
3655
+ function getResolver(injectionToken, futureARS, futureRSS) {
3656
+ const closestInjector = futureARS._environmentInjector;
3645
3657
  const resolver = getTokenOrFunctionIdentity(injectionToken, closestInjector);
3646
3658
  const resolverValue = resolver.resolve ? resolver.resolve(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => resolver(futureARS, futureRSS));
3647
3659
  return wrapIntoObservable(resolverValue);
@@ -3672,7 +3684,7 @@ class TitleStrategy {
3672
3684
  }
3673
3685
  static ɵfac = i0.ɵɵngDeclareFactory({
3674
3686
  minVersion: "12.0.0",
3675
- version: "21.0.1",
3687
+ version: "21.1.0-next.0",
3676
3688
  ngImport: i0,
3677
3689
  type: TitleStrategy,
3678
3690
  deps: [],
@@ -3680,7 +3692,7 @@ class TitleStrategy {
3680
3692
  });
3681
3693
  static ɵprov = i0.ɵɵngDeclareInjectable({
3682
3694
  minVersion: "12.0.0",
3683
- version: "21.0.1",
3695
+ version: "21.1.0-next.0",
3684
3696
  ngImport: i0,
3685
3697
  type: TitleStrategy,
3686
3698
  providedIn: 'root',
@@ -3689,7 +3701,7 @@ class TitleStrategy {
3689
3701
  }
3690
3702
  i0.ɵɵngDeclareClassMetadata({
3691
3703
  minVersion: "12.0.0",
3692
- version: "21.0.1",
3704
+ version: "21.1.0-next.0",
3693
3705
  ngImport: i0,
3694
3706
  type: TitleStrategy,
3695
3707
  decorators: [{
@@ -3714,7 +3726,7 @@ class DefaultTitleStrategy extends TitleStrategy {
3714
3726
  }
3715
3727
  static ɵfac = i0.ɵɵngDeclareFactory({
3716
3728
  minVersion: "12.0.0",
3717
- version: "21.0.1",
3729
+ version: "21.1.0-next.0",
3718
3730
  ngImport: i0,
3719
3731
  type: DefaultTitleStrategy,
3720
3732
  deps: [{
@@ -3724,7 +3736,7 @@ class DefaultTitleStrategy extends TitleStrategy {
3724
3736
  });
3725
3737
  static ɵprov = i0.ɵɵngDeclareInjectable({
3726
3738
  minVersion: "12.0.0",
3727
- version: "21.0.1",
3739
+ version: "21.1.0-next.0",
3728
3740
  ngImport: i0,
3729
3741
  type: DefaultTitleStrategy,
3730
3742
  providedIn: 'root'
@@ -3732,7 +3744,7 @@ class DefaultTitleStrategy extends TitleStrategy {
3732
3744
  }
3733
3745
  i0.ɵɵngDeclareClassMetadata({
3734
3746
  minVersion: "12.0.0",
3735
- version: "21.0.1",
3747
+ version: "21.1.0-next.0",
3736
3748
  ngImport: i0,
3737
3749
  type: DefaultTitleStrategy,
3738
3750
  decorators: [{
@@ -3810,7 +3822,7 @@ class RouterConfigLoader {
3810
3822
  }
3811
3823
  static ɵfac = i0.ɵɵngDeclareFactory({
3812
3824
  minVersion: "12.0.0",
3813
- version: "21.0.1",
3825
+ version: "21.1.0-next.0",
3814
3826
  ngImport: i0,
3815
3827
  type: RouterConfigLoader,
3816
3828
  deps: [],
@@ -3818,7 +3830,7 @@ class RouterConfigLoader {
3818
3830
  });
3819
3831
  static ɵprov = i0.ɵɵngDeclareInjectable({
3820
3832
  minVersion: "12.0.0",
3821
- version: "21.0.1",
3833
+ version: "21.1.0-next.0",
3822
3834
  ngImport: i0,
3823
3835
  type: RouterConfigLoader,
3824
3836
  providedIn: 'root'
@@ -3826,7 +3838,7 @@ class RouterConfigLoader {
3826
3838
  }
3827
3839
  i0.ɵɵngDeclareClassMetadata({
3828
3840
  minVersion: "12.0.0",
3829
- version: "21.0.1",
3841
+ version: "21.1.0-next.0",
3830
3842
  ngImport: i0,
3831
3843
  type: RouterConfigLoader,
3832
3844
  decorators: [{
@@ -3888,7 +3900,7 @@ async function maybeResolveResources(value) {
3888
3900
  class UrlHandlingStrategy {
3889
3901
  static ɵfac = i0.ɵɵngDeclareFactory({
3890
3902
  minVersion: "12.0.0",
3891
- version: "21.0.1",
3903
+ version: "21.1.0-next.0",
3892
3904
  ngImport: i0,
3893
3905
  type: UrlHandlingStrategy,
3894
3906
  deps: [],
@@ -3896,7 +3908,7 @@ class UrlHandlingStrategy {
3896
3908
  });
3897
3909
  static ɵprov = i0.ɵɵngDeclareInjectable({
3898
3910
  minVersion: "12.0.0",
3899
- version: "21.0.1",
3911
+ version: "21.1.0-next.0",
3900
3912
  ngImport: i0,
3901
3913
  type: UrlHandlingStrategy,
3902
3914
  providedIn: 'root',
@@ -3905,7 +3917,7 @@ class UrlHandlingStrategy {
3905
3917
  }
3906
3918
  i0.ɵɵngDeclareClassMetadata({
3907
3919
  minVersion: "12.0.0",
3908
- version: "21.0.1",
3920
+ version: "21.1.0-next.0",
3909
3921
  ngImport: i0,
3910
3922
  type: UrlHandlingStrategy,
3911
3923
  decorators: [{
@@ -3928,7 +3940,7 @@ class DefaultUrlHandlingStrategy {
3928
3940
  }
3929
3941
  static ɵfac = i0.ɵɵngDeclareFactory({
3930
3942
  minVersion: "12.0.0",
3931
- version: "21.0.1",
3943
+ version: "21.1.0-next.0",
3932
3944
  ngImport: i0,
3933
3945
  type: DefaultUrlHandlingStrategy,
3934
3946
  deps: [],
@@ -3936,7 +3948,7 @@ class DefaultUrlHandlingStrategy {
3936
3948
  });
3937
3949
  static ɵprov = i0.ɵɵngDeclareInjectable({
3938
3950
  minVersion: "12.0.0",
3939
- version: "21.0.1",
3951
+ version: "21.1.0-next.0",
3940
3952
  ngImport: i0,
3941
3953
  type: DefaultUrlHandlingStrategy,
3942
3954
  providedIn: 'root'
@@ -3944,7 +3956,7 @@ class DefaultUrlHandlingStrategy {
3944
3956
  }
3945
3957
  i0.ɵɵngDeclareClassMetadata({
3946
3958
  minVersion: "12.0.0",
3947
- version: "21.0.1",
3959
+ version: "21.1.0-next.0",
3948
3960
  ngImport: i0,
3949
3961
  type: DefaultUrlHandlingStrategy,
3950
3962
  decorators: [{
@@ -4079,6 +4091,9 @@ class NavigationTransitions {
4079
4091
  return this.transitions.pipe(filter(t => t !== null), switchMap(overallTransitionState => {
4080
4092
  let completedOrAborted = false;
4081
4093
  const abortController = new AbortController();
4094
+ const shouldContinueNavigation = () => {
4095
+ return !completedOrAborted && this.currentTransition?.id === overallTransitionState.id;
4096
+ };
4082
4097
  return of(overallTransitionState).pipe(switchMap(t => {
4083
4098
  if (this.navigationId > overallTransitionState.id) {
4084
4099
  const cancellationReason = typeof ngDevMode === 'undefined' || ngDevMode ? `Navigation ID ${overallTransitionState.id} is not equal to the current navigation id ${this.navigationId}` : '';
@@ -4135,7 +4150,7 @@ class NavigationTransitions {
4135
4150
  } = t;
4136
4151
  const navStart = new NavigationStart(id, this.urlSerializer.serialize(extractedUrl), source, restoredState);
4137
4152
  this.events.next(navStart);
4138
- const targetSnapshot = createEmptyState(this.rootComponentType).snapshot;
4153
+ const targetSnapshot = createEmptyState(this.rootComponentType, this.environmentInjector).snapshot;
4139
4154
  this.currentTransition = overallTransitionState = {
4140
4155
  ...t,
4141
4156
  targetSnapshot,
@@ -4157,48 +4172,48 @@ class NavigationTransitions {
4157
4172
  t.resolve(false);
4158
4173
  return EMPTY;
4159
4174
  }
4160
- }), tap(t => {
4175
+ }), map(t => {
4161
4176
  const guardsStart = new GuardsCheckStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4162
4177
  this.events.next(guardsStart);
4163
- }), map(t => {
4164
4178
  this.currentTransition = overallTransitionState = {
4165
4179
  ...t,
4166
4180
  guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)
4167
4181
  };
4168
4182
  return overallTransitionState;
4169
- }), checkGuards(this.environmentInjector, evt => this.events.next(evt)), tap(t => {
4183
+ }), checkGuards(evt => this.events.next(evt)), switchMap(t => {
4170
4184
  overallTransitionState.guardsResult = t.guardsResult;
4171
4185
  if (t.guardsResult && typeof t.guardsResult !== 'boolean') {
4172
4186
  throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
4173
4187
  }
4174
4188
  const guardsEnd = new GuardsCheckEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
4175
4189
  this.events.next(guardsEnd);
4176
- }), filter(t => {
4190
+ if (!shouldContinueNavigation()) {
4191
+ return EMPTY;
4192
+ }
4177
4193
  if (!t.guardsResult) {
4178
4194
  this.cancelNavigationTransition(t, '', NavigationCancellationCode.GuardRejected);
4179
- return false;
4195
+ return EMPTY;
4180
4196
  }
4181
- return true;
4182
- }), switchTap(t => {
4183
4197
  if (t.guards.canActivateChecks.length === 0) {
4184
- return undefined;
4198
+ return of(t);
4185
4199
  }
4186
- return of(t).pipe(tap(t => {
4187
- const resolveStart = new ResolveStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4188
- this.events.next(resolveStart);
4189
- }), switchMap(t => {
4190
- let dataResolved = false;
4191
- return of(t).pipe(resolveData(this.paramsInheritanceStrategy, this.environmentInjector), tap({
4192
- next: () => dataResolved = true,
4193
- complete: () => {
4194
- if (!dataResolved) {
4195
- this.cancelNavigationTransition(t, typeof ngDevMode === 'undefined' || ngDevMode ? `At least one route resolver didn't emit any value.` : '', NavigationCancellationCode.NoDataFromResolver);
4196
- }
4200
+ const resolveStart = new ResolveStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4201
+ this.events.next(resolveStart);
4202
+ if (!shouldContinueNavigation()) {
4203
+ return EMPTY;
4204
+ }
4205
+ let dataResolved = false;
4206
+ return of(t).pipe(resolveData(this.paramsInheritanceStrategy), tap({
4207
+ next: () => {
4208
+ dataResolved = true;
4209
+ const resolveEnd = new ResolveEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4210
+ this.events.next(resolveEnd);
4211
+ },
4212
+ complete: () => {
4213
+ if (!dataResolved) {
4214
+ this.cancelNavigationTransition(t, typeof ngDevMode === 'undefined' || ngDevMode ? `At least one route resolver didn't emit any value.` : '', NavigationCancellationCode.NoDataFromResolver);
4197
4215
  }
4198
- }));
4199
- }), tap(t => {
4200
- const resolveEnd = new ResolveEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4201
- this.events.next(resolveEnd);
4216
+ }
4202
4217
  }));
4203
4218
  }), switchTap(t => {
4204
4219
  const loadComponents = route => {
@@ -4206,7 +4221,7 @@ class NavigationTransitions {
4206
4221
  if (route.routeConfig?._loadedComponent) {
4207
4222
  route.component = route.routeConfig?._loadedComponent;
4208
4223
  } else if (route.routeConfig?.loadComponent) {
4209
- const injector = getClosestRouteInjector(route) ?? this.environmentInjector;
4224
+ const injector = route._environmentInjector;
4210
4225
  loaders.push(this.configLoader.loadComponent(injector, route.routeConfig).then(loadedComponent => {
4211
4226
  route.component = loadedComponent;
4212
4227
  }));
@@ -4323,7 +4338,7 @@ class NavigationTransitions {
4323
4338
  }
4324
4339
  static ɵfac = i0.ɵɵngDeclareFactory({
4325
4340
  minVersion: "12.0.0",
4326
- version: "21.0.1",
4341
+ version: "21.1.0-next.0",
4327
4342
  ngImport: i0,
4328
4343
  type: NavigationTransitions,
4329
4344
  deps: [],
@@ -4331,7 +4346,7 @@ class NavigationTransitions {
4331
4346
  });
4332
4347
  static ɵprov = i0.ɵɵngDeclareInjectable({
4333
4348
  minVersion: "12.0.0",
4334
- version: "21.0.1",
4349
+ version: "21.1.0-next.0",
4335
4350
  ngImport: i0,
4336
4351
  type: NavigationTransitions,
4337
4352
  providedIn: 'root'
@@ -4339,7 +4354,7 @@ class NavigationTransitions {
4339
4354
  }
4340
4355
  i0.ɵɵngDeclareClassMetadata({
4341
4356
  minVersion: "12.0.0",
4342
- version: "21.0.1",
4357
+ version: "21.1.0-next.0",
4343
4358
  ngImport: i0,
4344
4359
  type: NavigationTransitions,
4345
4360
  decorators: [{
@@ -4357,7 +4372,7 @@ function isBrowserTriggeredNavigation(source) {
4357
4372
  class RouteReuseStrategy {
4358
4373
  static ɵfac = i0.ɵɵngDeclareFactory({
4359
4374
  minVersion: "12.0.0",
4360
- version: "21.0.1",
4375
+ version: "21.1.0-next.0",
4361
4376
  ngImport: i0,
4362
4377
  type: RouteReuseStrategy,
4363
4378
  deps: [],
@@ -4365,7 +4380,7 @@ class RouteReuseStrategy {
4365
4380
  });
4366
4381
  static ɵprov = i0.ɵɵngDeclareInjectable({
4367
4382
  minVersion: "12.0.0",
4368
- version: "21.0.1",
4383
+ version: "21.1.0-next.0",
4369
4384
  ngImport: i0,
4370
4385
  type: RouteReuseStrategy,
4371
4386
  providedIn: 'root',
@@ -4374,7 +4389,7 @@ class RouteReuseStrategy {
4374
4389
  }
4375
4390
  i0.ɵɵngDeclareClassMetadata({
4376
4391
  minVersion: "12.0.0",
4377
- version: "21.0.1",
4392
+ version: "21.1.0-next.0",
4378
4393
  ngImport: i0,
4379
4394
  type: RouteReuseStrategy,
4380
4395
  decorators: [{
@@ -4403,7 +4418,7 @@ class BaseRouteReuseStrategy {
4403
4418
  class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4404
4419
  static ɵfac = i0.ɵɵngDeclareFactory({
4405
4420
  minVersion: "12.0.0",
4406
- version: "21.0.1",
4421
+ version: "21.1.0-next.0",
4407
4422
  ngImport: i0,
4408
4423
  type: DefaultRouteReuseStrategy,
4409
4424
  deps: null,
@@ -4411,7 +4426,7 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4411
4426
  });
4412
4427
  static ɵprov = i0.ɵɵngDeclareInjectable({
4413
4428
  minVersion: "12.0.0",
4414
- version: "21.0.1",
4429
+ version: "21.1.0-next.0",
4415
4430
  ngImport: i0,
4416
4431
  type: DefaultRouteReuseStrategy,
4417
4432
  providedIn: 'root'
@@ -4419,7 +4434,7 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4419
4434
  }
4420
4435
  i0.ɵɵngDeclareClassMetadata({
4421
4436
  minVersion: "12.0.0",
4422
- version: "21.0.1",
4437
+ version: "21.1.0-next.0",
4423
4438
  ngImport: i0,
4424
4439
  type: DefaultRouteReuseStrategy,
4425
4440
  decorators: [{
@@ -4470,13 +4485,16 @@ class StateManager {
4470
4485
  this.rawUrlTree = initialUrl;
4471
4486
  }
4472
4487
  }
4473
- routerState = createEmptyState(null);
4488
+ routerState = createEmptyState(null, inject(EnvironmentInjector));
4474
4489
  getRouterState() {
4475
4490
  return this.routerState;
4476
4491
  }
4477
- stateMemento = this.createStateMemento();
4492
+ _stateMemento = this.createStateMemento();
4493
+ get stateMemento() {
4494
+ return this._stateMemento;
4495
+ }
4478
4496
  updateStateMemento() {
4479
- this.stateMemento = this.createStateMemento();
4497
+ this._stateMemento = this.createStateMemento();
4480
4498
  }
4481
4499
  createStateMemento() {
4482
4500
  return {
@@ -4485,16 +4503,12 @@ class StateManager {
4485
4503
  routerState: this.routerState
4486
4504
  };
4487
4505
  }
4488
- resetInternalState({
4489
- finalUrl
4490
- }) {
4491
- this.routerState = this.stateMemento.routerState;
4492
- this.currentUrlTree = this.stateMemento.currentUrlTree;
4493
- this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, finalUrl ?? this.rawUrlTree);
4506
+ restoredState() {
4507
+ return this.location.getState();
4494
4508
  }
4495
4509
  static ɵfac = i0.ɵɵngDeclareFactory({
4496
4510
  minVersion: "12.0.0",
4497
- version: "21.0.1",
4511
+ version: "21.1.0-next.0",
4498
4512
  ngImport: i0,
4499
4513
  type: StateManager,
4500
4514
  deps: [],
@@ -4502,7 +4516,7 @@ class StateManager {
4502
4516
  });
4503
4517
  static ɵprov = i0.ɵɵngDeclareInjectable({
4504
4518
  minVersion: "12.0.0",
4505
- version: "21.0.1",
4519
+ version: "21.1.0-next.0",
4506
4520
  ngImport: i0,
4507
4521
  type: StateManager,
4508
4522
  providedIn: 'root',
@@ -4511,7 +4525,7 @@ class StateManager {
4511
4525
  }
4512
4526
  i0.ɵɵngDeclareClassMetadata({
4513
4527
  minVersion: "12.0.0",
4514
- version: "21.0.1",
4528
+ version: "21.1.0-next.0",
4515
4529
  ngImport: i0,
4516
4530
  type: StateManager,
4517
4531
  decorators: [{
@@ -4525,9 +4539,6 @@ i0.ɵɵngDeclareClassMetadata({
4525
4539
  class HistoryStateManager extends StateManager {
4526
4540
  currentPageId = 0;
4527
4541
  lastSuccessfulId = -1;
4528
- restoredState() {
4529
- return this.location.getState();
4530
- }
4531
4542
  get browserPageId() {
4532
4543
  if (this.canceledNavigationResolution !== 'computed') {
4533
4544
  return this.currentPageId;
@@ -4608,6 +4619,13 @@ class HistoryStateManager extends StateManager {
4608
4619
  this.resetUrlToCurrentUrlTree();
4609
4620
  }
4610
4621
  }
4622
+ resetInternalState({
4623
+ finalUrl
4624
+ }) {
4625
+ this.routerState = this.stateMemento.routerState;
4626
+ this.currentUrlTree = this.stateMemento.currentUrlTree;
4627
+ this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, finalUrl ?? this.rawUrlTree);
4628
+ }
4611
4629
  resetUrlToCurrentUrlTree() {
4612
4630
  this.location.replaceState(this.urlSerializer.serialize(this.getRawUrlTree()), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
4613
4631
  }
@@ -4624,7 +4642,7 @@ class HistoryStateManager extends StateManager {
4624
4642
  }
4625
4643
  static ɵfac = i0.ɵɵngDeclareFactory({
4626
4644
  minVersion: "12.0.0",
4627
- version: "21.0.1",
4645
+ version: "21.1.0-next.0",
4628
4646
  ngImport: i0,
4629
4647
  type: HistoryStateManager,
4630
4648
  deps: null,
@@ -4632,7 +4650,7 @@ class HistoryStateManager extends StateManager {
4632
4650
  });
4633
4651
  static ɵprov = i0.ɵɵngDeclareInjectable({
4634
4652
  minVersion: "12.0.0",
4635
- version: "21.0.1",
4653
+ version: "21.1.0-next.0",
4636
4654
  ngImport: i0,
4637
4655
  type: HistoryStateManager,
4638
4656
  providedIn: 'root'
@@ -4640,7 +4658,7 @@ class HistoryStateManager extends StateManager {
4640
4658
  }
4641
4659
  i0.ɵɵngDeclareClassMetadata({
4642
4660
  minVersion: "12.0.0",
4643
- version: "21.0.1",
4661
+ version: "21.1.0-next.0",
4644
4662
  ngImport: i0,
4645
4663
  type: HistoryStateManager,
4646
4664
  decorators: [{
@@ -4738,6 +4756,7 @@ class Router {
4738
4756
  const opts = e.navigationBehaviorOptions;
4739
4757
  const mergedTree = this.urlHandlingStrategy.merge(e.url, currentTransition.currentRawUrl);
4740
4758
  const extras = {
4759
+ scroll: currentTransition.extras.scroll,
4741
4760
  browserUrl: currentTransition.extras.browserUrl,
4742
4761
  info: currentTransition.extras.info,
4743
4762
  skipLocationChange: currentTransition.extras.skipLocationChange,
@@ -4954,7 +4973,7 @@ class Router {
4954
4973
  }
4955
4974
  static ɵfac = i0.ɵɵngDeclareFactory({
4956
4975
  minVersion: "12.0.0",
4957
- version: "21.0.1",
4976
+ version: "21.1.0-next.0",
4958
4977
  ngImport: i0,
4959
4978
  type: Router,
4960
4979
  deps: [],
@@ -4962,7 +4981,7 @@ class Router {
4962
4981
  });
4963
4982
  static ɵprov = i0.ɵɵngDeclareInjectable({
4964
4983
  minVersion: "12.0.0",
4965
- version: "21.0.1",
4984
+ version: "21.1.0-next.0",
4966
4985
  ngImport: i0,
4967
4986
  type: Router,
4968
4987
  providedIn: 'root'
@@ -4970,7 +4989,7 @@ class Router {
4970
4989
  }
4971
4990
  i0.ɵɵngDeclareClassMetadata({
4972
4991
  minVersion: "12.0.0",
4973
- version: "21.0.1",
4992
+ version: "21.1.0-next.0",
4974
4993
  ngImport: i0,
4975
4994
  type: Router,
4976
4995
  decorators: [{
@@ -4990,5 +5009,5 @@ function validateCommands(commands) {
4990
5009
  }
4991
5010
  }
4992
5011
 
4993
- export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, CREATE_VIEW_TRANSITION, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, EventType, GuardsCheckEnd, GuardsCheckStart, HistoryStateManager, IMPERATIVE_NAVIGATION, INPUT_BINDER, NAVIGATION_ERROR_HANDLER, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationError, NavigationSkipped, NavigationSkippedCode, NavigationStart, NavigationTransitions, OutletContext, PRIMARY_OUTLET, ROUTER_CONFIGURATION, ROUTER_OUTLET_DATA, ROUTES, RedirectCommand, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, RoutedComponentInputBinder, Router, RouterConfigLoader, RouterEvent, RouterOutlet, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, StateManager, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VIEW_TRANSITION_OPTIONS, afterNextNavigation, convertToParamMap, createUrlTreeFromSnapshot, createViewTransition, defaultUrlMatcher, isUrlTree, loadChildren, provideSometimesSyncRecognize, stringifyEvent, ɵEmptyOutletComponent };
5012
+ export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, BeforeActivateRoutes, CREATE_VIEW_TRANSITION, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, EventType, GuardsCheckEnd, GuardsCheckStart, IMPERATIVE_NAVIGATION, INPUT_BINDER, NAVIGATION_ERROR_HANDLER, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationError, NavigationSkipped, NavigationSkippedCode, NavigationStart, NavigationTransitions, OutletContext, PRIMARY_OUTLET, ROUTER_CONFIGURATION, ROUTER_OUTLET_DATA, ROUTES, RedirectCommand, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, RoutedComponentInputBinder, Router, RouterConfigLoader, RouterEvent, RouterOutlet, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, StateManager, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VIEW_TRANSITION_OPTIONS, afterNextNavigation, convertToParamMap, createUrlTreeFromSnapshot, createViewTransition, defaultUrlMatcher, isUrlTree, loadChildren, provideSometimesSyncRecognize, stringifyEvent, ɵEmptyOutletComponent };
4994
5013
  //# sourceMappingURL=_router-chunk.mjs.map