react-router 7.14.2 → 7.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/development/{browser-I6n6wVSO.d.mts → browser-CRsXgNrY.d.mts} +2 -2
  3. package/dist/{production/browser-I6n6wVSO.d.mts → development/browser-wDl1FZEL.d.ts} +2 -2
  4. package/dist/{production/chunk-PQL4HLVQ.js → development/chunk-2D5H3HU3.js} +7 -7
  5. package/dist/development/{chunk-EVOBXE3Y.mjs → chunk-5KNZJZUH.mjs} +341 -208
  6. package/dist/development/{chunk-ZZNWZ5Q3.js → chunk-AM3XM4LS.js} +331 -205
  7. package/dist/development/{chunk-YQSHRJWW.mjs → chunk-RMD3H4O3.mjs} +80 -61
  8. package/dist/development/{chunk-YZKCRDTN.js → chunk-Z5YQYACE.js} +146 -139
  9. package/dist/{production/context-DGGUoDIu.d.mts → development/context-BQs41HrG.d.mts} +94 -42
  10. package/dist/development/{routeModules-7rtk67cd.d.ts → data-BVUf681J.d.mts} +64 -46
  11. package/dist/development/{routeModules-BW4a8k3I.d.mts → data-BqZ2x964.d.ts} +64 -46
  12. package/dist/development/dom-export.d.mts +8 -8
  13. package/dist/development/dom-export.d.ts +8 -8
  14. package/dist/development/dom-export.js +37 -40
  15. package/dist/development/dom-export.mjs +12 -15
  16. package/dist/development/{index-react-server-client-BBd0A0TL.d.ts → index-react-server-client-CSv-KZBk.d.ts} +123 -121
  17. package/dist/{production/index-react-server-client-BjhKIe3u.d.mts → development/index-react-server-client-Ck_yZ1qL.d.mts} +102 -100
  18. package/dist/development/index-react-server-client.d.mts +3 -3
  19. package/dist/development/index-react-server-client.d.ts +3 -3
  20. package/dist/development/index-react-server-client.js +4 -4
  21. package/dist/development/index-react-server-client.mjs +2 -2
  22. package/dist/development/index-react-server.d.mts +107 -36
  23. package/dist/development/index-react-server.d.ts +107 -36
  24. package/dist/development/index-react-server.js +60 -33
  25. package/dist/development/index-react-server.mjs +60 -33
  26. package/dist/development/index.d.mts +10 -10
  27. package/dist/development/index.d.ts +10 -10
  28. package/dist/development/index.js +173 -154
  29. package/dist/development/index.mjs +3 -3
  30. package/dist/{production/instrumentation-g0dG8UL0.d.ts → development/instrumentation-DlJ2QV7d.d.ts} +73 -21
  31. package/dist/development/lib/types/internal.d.mts +2 -2
  32. package/dist/development/lib/types/internal.d.ts +2 -2
  33. package/dist/development/lib/types/internal.js +1 -1
  34. package/dist/development/lib/types/internal.mjs +1 -1
  35. package/dist/development/{register-DcBltf5q.d.ts → register-Bsscfj79.d.ts} +1 -1
  36. package/dist/{production/register-DcBltf5q.d.ts → development/register-Df8okEea.d.mts} +1 -1
  37. package/dist/production/{browser-C-UvoYvi.d.ts → browser-CRsXgNrY.d.mts} +2 -2
  38. package/dist/{development/browser-C-UvoYvi.d.ts → production/browser-wDl1FZEL.d.ts} +2 -2
  39. package/dist/production/{chunk-2WLZNCK5.mjs → chunk-23ZOHYE5.mjs} +80 -61
  40. package/dist/{development/chunk-PZFPF4X7.js → production/chunk-7YXKJMLN.js} +7 -7
  41. package/dist/production/{chunk-LK6U7ULH.mjs → chunk-GM3PW4GX.mjs} +341 -208
  42. package/dist/production/{chunk-X5SKXJ4A.js → chunk-LCJTIOKZ.js} +331 -205
  43. package/dist/production/{chunk-UJQ4OJF4.js → chunk-YBQJ3ABE.js} +146 -139
  44. package/dist/{development/context-DGGUoDIu.d.mts → production/context-BQs41HrG.d.mts} +94 -42
  45. package/dist/production/{routeModules-7rtk67cd.d.ts → data-BVUf681J.d.mts} +64 -46
  46. package/dist/production/{routeModules-BW4a8k3I.d.mts → data-BqZ2x964.d.ts} +64 -46
  47. package/dist/production/dom-export.d.mts +8 -8
  48. package/dist/production/dom-export.d.ts +8 -8
  49. package/dist/production/dom-export.js +37 -40
  50. package/dist/production/dom-export.mjs +12 -15
  51. package/dist/production/{index-react-server-client-BBd0A0TL.d.ts → index-react-server-client-CSv-KZBk.d.ts} +123 -121
  52. package/dist/{development/index-react-server-client-BjhKIe3u.d.mts → production/index-react-server-client-Ck_yZ1qL.d.mts} +102 -100
  53. package/dist/production/index-react-server-client.d.mts +3 -3
  54. package/dist/production/index-react-server-client.d.ts +3 -3
  55. package/dist/production/index-react-server-client.js +4 -4
  56. package/dist/production/index-react-server-client.mjs +2 -2
  57. package/dist/production/index-react-server.d.mts +107 -36
  58. package/dist/production/index-react-server.d.ts +107 -36
  59. package/dist/production/index-react-server.js +60 -33
  60. package/dist/production/index-react-server.mjs +60 -33
  61. package/dist/production/index.d.mts +10 -10
  62. package/dist/production/index.d.ts +10 -10
  63. package/dist/production/index.js +173 -154
  64. package/dist/production/index.mjs +3 -3
  65. package/dist/{development/instrumentation-g0dG8UL0.d.ts → production/instrumentation-DlJ2QV7d.d.ts} +73 -21
  66. package/dist/production/lib/types/internal.d.mts +2 -2
  67. package/dist/production/lib/types/internal.d.ts +2 -2
  68. package/dist/production/lib/types/internal.js +1 -1
  69. package/dist/production/lib/types/internal.mjs +1 -1
  70. package/dist/{development/register-D9d2sMQ7.d.mts → production/register-Bsscfj79.d.ts} +1 -1
  71. package/dist/production/{register-D9d2sMQ7.d.mts → register-Df8okEea.d.mts} +1 -1
  72. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2
- * react-router v7.14.2
2
+ * react-router v7.15.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -14,6 +14,7 @@ var __typeError = (msg) => {
14
14
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
15
15
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
16
16
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
17
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
17
18
 
18
19
  // lib/router/history.ts
19
20
  var Action = /* @__PURE__ */ ((Action2) => {
@@ -34,7 +35,7 @@ function createMemoryHistory(options = {}) {
34
35
  entry,
35
36
  typeof entry === "string" ? null : entry.state,
36
37
  index2 === 0 ? "default" : void 0,
37
- typeof entry === "string" ? void 0 : entry.unstable_mask
38
+ typeof entry === "string" ? void 0 : entry.mask
38
39
  )
39
40
  );
40
41
  let index = clampIndex(
@@ -48,13 +49,13 @@ function createMemoryHistory(options = {}) {
48
49
  function getCurrentLocation() {
49
50
  return entries[index];
50
51
  }
51
- function createMemoryLocation(to, state = null, key, unstable_mask) {
52
+ function createMemoryLocation(to, state = null, key, mask) {
52
53
  let location = createLocation(
53
54
  entries ? getCurrentLocation().pathname : "/",
54
55
  to,
55
56
  state,
56
57
  key,
57
- unstable_mask
58
+ mask
58
59
  );
59
60
  warning(
60
61
  location.pathname.charAt(0) === "/",
@@ -216,14 +217,14 @@ function getHistoryState(location, index) {
216
217
  usr: location.state,
217
218
  key: location.key,
218
219
  idx: index,
219
- masked: location.unstable_mask ? {
220
+ masked: location.mask ? {
220
221
  pathname: location.pathname,
221
222
  search: location.search,
222
223
  hash: location.hash
223
224
  } : void 0
224
225
  };
225
226
  }
226
- function createLocation(current, to, state = null, key, unstable_mask) {
227
+ function createLocation(current, to, state = null, key, mask) {
227
228
  let location = {
228
229
  pathname: typeof current === "string" ? current : current.pathname,
229
230
  search: "",
@@ -235,7 +236,7 @@ function createLocation(current, to, state = null, key, unstable_mask) {
235
236
  // But that's a pretty big refactor to the current test suite so going to
236
237
  // keep as is for the time being and just let any incoming keys take precedence
237
238
  key: to && to.key || key || createKey(),
238
- unstable_mask
239
+ mask
239
240
  };
240
241
  return location;
241
242
  }
@@ -298,7 +299,7 @@ function getUrlBasedHistory(getLocation, createHref, validateLocation, options =
298
299
  if (validateLocation) validateLocation(location, to);
299
300
  index = getIndex() + 1;
300
301
  let historyState = getHistoryState(location, index);
301
- let url = history.createHref(location.unstable_mask || location);
302
+ let url = history.createHref(location.mask || location);
302
303
  try {
303
304
  globalHistory.pushState(historyState, "", url);
304
305
  } catch (error) {
@@ -317,7 +318,7 @@ function getUrlBasedHistory(getLocation, createHref, validateLocation, options =
317
318
  if (validateLocation) validateLocation(location, to);
318
319
  index = getIndex();
319
320
  let historyState = getHistoryState(location, index);
320
- let url = history.createHref(location.unstable_mask || location);
321
+ let url = history.createHref(location.mask || location);
321
322
  globalHistory.replaceState(historyState, "", url);
322
323
  if (v5Compat && listener) {
323
324
  listener({ action, location: history.location, delta: 0 });
@@ -515,17 +516,16 @@ function mergeRouteUpdates(route, updates) {
515
516
  function matchRoutes(routes, locationArg, basename = "/") {
516
517
  return matchRoutesImpl(routes, locationArg, basename, false);
517
518
  }
518
- function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
519
+ function matchRoutesImpl(routes, locationArg, basename, allowPartial, precomputedBranches) {
519
520
  let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
520
521
  let pathname = stripBasename(location.pathname || "/", basename);
521
522
  if (pathname == null) {
522
523
  return null;
523
524
  }
524
- let branches = flattenRoutes(routes);
525
- rankRouteBranches(branches);
525
+ let branches = _nullishCoalesce(precomputedBranches, () => ( flattenAndRankRoutes(routes)));
526
526
  let matches = null;
527
+ let decoded = decodePath(pathname);
527
528
  for (let i = 0; matches == null && i < branches.length; ++i) {
528
- let decoded = decodePath(pathname);
529
529
  matches = matchRouteBranch(
530
530
  branches[i],
531
531
  decoded,
@@ -545,6 +545,11 @@ function convertRouteMatchToUiMatch(match, loaderData) {
545
545
  handle: route.handle
546
546
  };
547
547
  }
548
+ function flattenAndRankRoutes(routes) {
549
+ let branches = flattenRoutes(routes);
550
+ rankRouteBranches(branches);
551
+ return branches;
552
+ }
548
553
  function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
549
554
  let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
550
555
  let meta = {
@@ -1252,11 +1257,11 @@ async function recurseRight(impls, info, handler, index) {
1252
1257
  };
1253
1258
  }
1254
1259
  function getHandlerInfo(args) {
1255
- let { request, context, params, unstable_pattern } = args;
1260
+ let { request, context, params, pattern } = args;
1256
1261
  return {
1257
1262
  request: getReadonlyRequest(request),
1258
1263
  params: { ...params },
1259
- unstable_pattern,
1264
+ pattern,
1260
1265
  context: getReadonlyContext(context)
1261
1266
  };
1262
1267
  }
@@ -1346,6 +1351,55 @@ var defaultMapRouteProperties = (route) => ({
1346
1351
  });
1347
1352
  var TRANSITIONS_STORAGE_KEY = "remix-router-transitions";
1348
1353
  var ResetLoaderDataSymbol = Symbol("ResetLoaderData");
1354
+ var _routes, _branches, _hmrRoutes, _hmrBranches;
1355
+ var DataRoutes = class {
1356
+ constructor(routes) {
1357
+ __privateAdd(this, _routes);
1358
+ __privateAdd(this, _branches);
1359
+ __privateAdd(this, _hmrRoutes);
1360
+ __privateAdd(this, _hmrBranches);
1361
+ __privateSet(this, _routes, routes);
1362
+ __privateSet(this, _branches, flattenAndRankRoutes(routes));
1363
+ }
1364
+ /** The stable route tree */
1365
+ get stableRoutes() {
1366
+ return __privateGet(this, _routes);
1367
+ }
1368
+ /** The in-flight route tree if one is active, otherwise the stable tree */
1369
+ get activeRoutes() {
1370
+ return _nullishCoalesce(__privateGet(this, _hmrRoutes), () => ( __privateGet(this, _routes)));
1371
+ }
1372
+ /** Pre-computed branches */
1373
+ get branches() {
1374
+ return _nullishCoalesce(__privateGet(this, _hmrBranches), () => ( __privateGet(this, _branches)));
1375
+ }
1376
+ get hasHMRRoutes() {
1377
+ return __privateGet(this, _hmrRoutes) != null;
1378
+ }
1379
+ /** Replace the stable route tree and recompute its branches */
1380
+ setRoutes(routes) {
1381
+ __privateSet(this, _routes, routes);
1382
+ __privateSet(this, _branches, flattenAndRankRoutes(routes));
1383
+ }
1384
+ /** Set a new in-flight route tree and recompute its branches */
1385
+ setHmrRoutes(routes) {
1386
+ __privateSet(this, _hmrRoutes, routes);
1387
+ __privateSet(this, _hmrBranches, flattenAndRankRoutes(routes));
1388
+ }
1389
+ /** Commit in-flight routes/branches to the stable slot and clear in-flight */
1390
+ commitHmrRoutes() {
1391
+ if (__privateGet(this, _hmrRoutes)) {
1392
+ __privateSet(this, _routes, __privateGet(this, _hmrRoutes));
1393
+ __privateSet(this, _branches, __privateGet(this, _hmrBranches));
1394
+ __privateSet(this, _hmrRoutes, void 0);
1395
+ __privateSet(this, _hmrBranches, void 0);
1396
+ }
1397
+ }
1398
+ };
1399
+ _routes = new WeakMap();
1400
+ _branches = new WeakMap();
1401
+ _hmrRoutes = new WeakMap();
1402
+ _hmrBranches = new WeakMap();
1349
1403
  function createRouter(init) {
1350
1404
  const routerWindow = init.window ? init.window : typeof window !== "undefined" ? window : void 0;
1351
1405
  const isBrowser2 = typeof routerWindow !== "undefined" && typeof routerWindow.document !== "undefined" && typeof routerWindow.document.createElement !== "undefined";
@@ -1356,8 +1410,8 @@ function createRouter(init) {
1356
1410
  let hydrationRouteProperties2 = init.hydrationRouteProperties || [];
1357
1411
  let _mapRouteProperties = init.mapRouteProperties || defaultMapRouteProperties;
1358
1412
  let mapRouteProperties2 = _mapRouteProperties;
1359
- if (init.unstable_instrumentations) {
1360
- let instrumentations = init.unstable_instrumentations;
1413
+ if (init.instrumentations) {
1414
+ let instrumentations = init.instrumentations;
1361
1415
  mapRouteProperties2 = (route) => {
1362
1416
  return {
1363
1417
  ..._mapRouteProperties(route),
@@ -1369,20 +1423,20 @@ function createRouter(init) {
1369
1423
  };
1370
1424
  }
1371
1425
  let manifest = {};
1372
- let dataRoutes = convertRoutesToDataRoutes(
1373
- init.routes,
1374
- mapRouteProperties2,
1375
- void 0,
1376
- manifest
1426
+ let dataRoutes = new DataRoutes(
1427
+ convertRoutesToDataRoutes(
1428
+ init.routes,
1429
+ mapRouteProperties2,
1430
+ void 0,
1431
+ manifest
1432
+ )
1377
1433
  );
1378
- let inFlightDataRoutes;
1379
1434
  let basename = init.basename || "/";
1380
1435
  if (!basename.startsWith("/")) {
1381
1436
  basename = `/${basename}`;
1382
1437
  }
1383
1438
  let dataStrategyImpl = init.dataStrategy || defaultDataStrategyWithMiddleware;
1384
1439
  let future = {
1385
- unstable_passThroughRequests: false,
1386
1440
  ...init.future
1387
1441
  };
1388
1442
  let unlistenHistory = null;
@@ -1391,7 +1445,13 @@ function createRouter(init) {
1391
1445
  let getScrollRestorationKey = null;
1392
1446
  let getScrollPosition = null;
1393
1447
  let initialScrollRestored = init.hydrationData != null;
1394
- let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);
1448
+ let initialMatches = matchRoutesImpl(
1449
+ dataRoutes.activeRoutes,
1450
+ init.history.location,
1451
+ basename,
1452
+ false,
1453
+ dataRoutes.branches
1454
+ );
1395
1455
  let initialMatchesIsFOW = false;
1396
1456
  let initialErrors = null;
1397
1457
  let initialized;
@@ -1400,7 +1460,7 @@ function createRouter(init) {
1400
1460
  let error = getInternalRouterError(404, {
1401
1461
  pathname: init.history.location.pathname
1402
1462
  });
1403
- let { matches, route } = getShortCircuitMatches(dataRoutes);
1463
+ let { matches, route } = getShortCircuitMatches(dataRoutes.activeRoutes);
1404
1464
  initialized = true;
1405
1465
  renderFallback = !initialized;
1406
1466
  initialMatches = matches;
@@ -1409,7 +1469,7 @@ function createRouter(init) {
1409
1469
  if (initialMatches && !init.hydrationData) {
1410
1470
  let fogOfWar = checkFogOfWar(
1411
1471
  initialMatches,
1412
- dataRoutes,
1472
+ dataRoutes.activeRoutes,
1413
1473
  init.history.location.pathname
1414
1474
  );
1415
1475
  if (fogOfWar.active) {
@@ -1422,7 +1482,7 @@ function createRouter(init) {
1422
1482
  initialMatches = [];
1423
1483
  let fogOfWar = checkFogOfWar(
1424
1484
  null,
1425
- dataRoutes,
1485
+ dataRoutes.activeRoutes,
1426
1486
  init.history.location.pathname
1427
1487
  );
1428
1488
  if (fogOfWar.active && fogOfWar.matches) {
@@ -1641,10 +1701,7 @@ function createRouter(init) {
1641
1701
  }
1642
1702
  let restoreScrollPosition = isUninterruptedRevalidation ? false : getSavedScrollPosition(location, newState.matches || state.matches);
1643
1703
  let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && _optionalChain([location, 'access', _11 => _11.state, 'optionalAccess', _12 => _12._isRedirect]) !== true;
1644
- if (inFlightDataRoutes) {
1645
- dataRoutes = inFlightDataRoutes;
1646
- inFlightDataRoutes = void 0;
1647
- }
1704
+ dataRoutes.commitHmrRoutes();
1648
1705
  if (isUninterruptedRevalidation) {
1649
1706
  } else if (pendingAction === "POP" /* Pop */) {
1650
1707
  } else if (pendingAction === "PUSH" /* Push */) {
@@ -1735,10 +1792,10 @@ function createRouter(init) {
1735
1792
  opts
1736
1793
  );
1737
1794
  let maskPath;
1738
- if (_optionalChain([opts, 'optionalAccess', _21 => _21.unstable_mask])) {
1739
- let partialPath = typeof opts.unstable_mask === "string" ? parsePath(opts.unstable_mask) : {
1740
- ...state.location.unstable_mask,
1741
- ...opts.unstable_mask
1795
+ if (_optionalChain([opts, 'optionalAccess', _21 => _21.mask])) {
1796
+ let partialPath = typeof opts.mask === "string" ? parsePath(opts.mask) : {
1797
+ ...state.location.mask,
1798
+ ...opts.mask
1742
1799
  };
1743
1800
  maskPath = {
1744
1801
  pathname: "",
@@ -1804,7 +1861,7 @@ function createRouter(init) {
1804
1861
  replace: opts && opts.replace,
1805
1862
  enableViewTransition: opts && opts.viewTransition,
1806
1863
  flushSync,
1807
- callSiteDefaultShouldRevalidate: opts && opts.unstable_defaultShouldRevalidate
1864
+ callSiteDefaultShouldRevalidate: opts && opts.defaultShouldRevalidate
1808
1865
  });
1809
1866
  }
1810
1867
  function revalidate() {
@@ -1842,12 +1899,18 @@ function createRouter(init) {
1842
1899
  saveScrollPosition(state.location, state.matches);
1843
1900
  pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;
1844
1901
  pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;
1845
- let routesToUse = inFlightDataRoutes || dataRoutes;
1902
+ let routesToUse = dataRoutes.activeRoutes;
1846
1903
  let loadingNavigation = opts && opts.overrideNavigation;
1847
1904
  let matches = _optionalChain([opts, 'optionalAccess', _22 => _22.initialHydration]) && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ? (
1848
1905
  // `matchRoutes()` has already been called if we're in here via `router.initialize()`
1849
1906
  state.matches
1850
- ) : matchRoutes(routesToUse, location, basename);
1907
+ ) : matchRoutesImpl(
1908
+ routesToUse,
1909
+ location,
1910
+ basename,
1911
+ false,
1912
+ dataRoutes.branches
1913
+ );
1851
1914
  let flushSync = (opts && opts.flushSync) === true;
1852
1915
  if (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {
1853
1916
  completeNavigation(location, { matches }, { flushSync });
@@ -1972,7 +2035,9 @@ function createRouter(init) {
1972
2035
  return { shortCircuited: true };
1973
2036
  } else if (discoverResult.type === "error") {
1974
2037
  if (discoverResult.partialMatches.length === 0) {
1975
- let { matches: matches2, route } = getShortCircuitMatches(dataRoutes);
2038
+ let { matches: matches2, route } = getShortCircuitMatches(
2039
+ dataRoutes.activeRoutes
2040
+ );
1976
2041
  return {
1977
2042
  matches: matches2,
1978
2043
  pendingActionResult: [
@@ -2119,7 +2184,9 @@ function createRouter(init) {
2119
2184
  return { shortCircuited: true };
2120
2185
  } else if (discoverResult.type === "error") {
2121
2186
  if (discoverResult.partialMatches.length === 0) {
2122
- let { matches: matches2, route } = getShortCircuitMatches(dataRoutes);
2187
+ let { matches: matches2, route } = getShortCircuitMatches(
2188
+ dataRoutes.activeRoutes
2189
+ );
2123
2190
  return {
2124
2191
  matches: matches2,
2125
2192
  loaderData: {},
@@ -2151,7 +2218,7 @@ function createRouter(init) {
2151
2218
  matches = discoverResult.matches;
2152
2219
  }
2153
2220
  }
2154
- let routesToUse = inFlightDataRoutes || dataRoutes;
2221
+ let routesToUse = dataRoutes.activeRoutes;
2155
2222
  let { dsMatches, revalidatingFetchers } = getMatchesToLoad(
2156
2223
  request,
2157
2224
  scopedContext,
@@ -2172,6 +2239,7 @@ function createRouter(init) {
2172
2239
  routesToUse,
2173
2240
  basename,
2174
2241
  init.patchRoutesOnNavigation != null,
2242
+ dataRoutes.branches,
2175
2243
  pendingActionResult,
2176
2244
  callSiteDefaultShouldRevalidate
2177
2245
  );
@@ -2301,7 +2369,7 @@ function createRouter(init) {
2301
2369
  async function fetch2(key, routeId, href, opts) {
2302
2370
  abortFetcher(key);
2303
2371
  let flushSync = (opts && opts.flushSync) === true;
2304
- let routesToUse = inFlightDataRoutes || dataRoutes;
2372
+ let routesToUse = dataRoutes.activeRoutes;
2305
2373
  let normalizedPath = normalizeTo(
2306
2374
  state.location,
2307
2375
  state.matches,
@@ -2310,7 +2378,13 @@ function createRouter(init) {
2310
2378
  routeId,
2311
2379
  _optionalChain([opts, 'optionalAccess', _23 => _23.relative])
2312
2380
  );
2313
- let matches = matchRoutes(routesToUse, normalizedPath, basename);
2381
+ let matches = matchRoutesImpl(
2382
+ routesToUse,
2383
+ normalizedPath,
2384
+ basename,
2385
+ false,
2386
+ dataRoutes.branches
2387
+ );
2314
2388
  let fogOfWar = checkFogOfWar(matches, routesToUse, normalizedPath);
2315
2389
  if (fogOfWar.active && fogOfWar.matches) {
2316
2390
  matches = fogOfWar.matches;
@@ -2346,7 +2420,7 @@ function createRouter(init) {
2346
2420
  flushSync,
2347
2421
  preventScrollReset,
2348
2422
  submission,
2349
- opts && opts.unstable_defaultShouldRevalidate
2423
+ opts && opts.defaultShouldRevalidate
2350
2424
  );
2351
2425
  return;
2352
2426
  }
@@ -2476,8 +2550,14 @@ function createRouter(init) {
2476
2550
  nextLocation,
2477
2551
  abortController.signal
2478
2552
  );
2479
- let routesToUse = inFlightDataRoutes || dataRoutes;
2480
- let matches = state.navigation.state !== "idle" ? matchRoutes(routesToUse, state.navigation.location, basename) : state.matches;
2553
+ let routesToUse = dataRoutes.activeRoutes;
2554
+ let matches = state.navigation.state !== "idle" ? matchRoutesImpl(
2555
+ routesToUse,
2556
+ state.navigation.location,
2557
+ basename,
2558
+ false,
2559
+ dataRoutes.branches
2560
+ ) : state.matches;
2481
2561
  invariant(matches, "Didn't find any matches after fetcher action");
2482
2562
  let loadId = ++incrementingLoadId;
2483
2563
  fetchReloadIds.set(key, loadId);
@@ -2503,6 +2583,7 @@ function createRouter(init) {
2503
2583
  routesToUse,
2504
2584
  basename,
2505
2585
  init.patchRoutesOnNavigation != null,
2586
+ dataRoutes.branches,
2506
2587
  [match.route.id, actionResult],
2507
2588
  callSiteDefaultShouldRevalidate
2508
2589
  );
@@ -3021,7 +3102,7 @@ function createRouter(init) {
3021
3102
  }
3022
3103
  function handleNavigational404(pathname) {
3023
3104
  let error = getInternalRouterError(404, { pathname });
3024
- let routesToUse = inFlightDataRoutes || dataRoutes;
3105
+ let routesToUse = dataRoutes.activeRoutes;
3025
3106
  let { matches, route } = getShortCircuitMatches(routesToUse);
3026
3107
  return { notFoundMatches: matches, route, error };
3027
3108
  }
@@ -3070,12 +3151,14 @@ function createRouter(init) {
3070
3151
  }
3071
3152
  function checkFogOfWar(matches, routesToUse, pathname) {
3072
3153
  if (init.patchRoutesOnNavigation) {
3154
+ let activeBranches = dataRoutes.branches;
3073
3155
  if (!matches) {
3074
3156
  let fogMatches = matchRoutesImpl(
3075
3157
  routesToUse,
3076
3158
  pathname,
3077
3159
  basename,
3078
- true
3160
+ true,
3161
+ activeBranches
3079
3162
  );
3080
3163
  return { active: true, matches: fogMatches || [] };
3081
3164
  } else {
@@ -3084,7 +3167,8 @@ function createRouter(init) {
3084
3167
  routesToUse,
3085
3168
  pathname,
3086
3169
  basename,
3087
- true
3170
+ true,
3171
+ activeBranches
3088
3172
  );
3089
3173
  return { active: true, matches: partialMatches };
3090
3174
  }
@@ -3098,8 +3182,6 @@ function createRouter(init) {
3098
3182
  }
3099
3183
  let partialMatches = matches;
3100
3184
  while (true) {
3101
- let isNonHMR = inFlightDataRoutes == null;
3102
- let routesToUse = inFlightDataRoutes || dataRoutes;
3103
3185
  let localManifest = manifest;
3104
3186
  try {
3105
3187
  await init.patchRoutesOnNavigation({
@@ -3112,7 +3194,7 @@ function createRouter(init) {
3112
3194
  patchRoutesImpl(
3113
3195
  routeId,
3114
3196
  children,
3115
- routesToUse,
3197
+ dataRoutes,
3116
3198
  localManifest,
3117
3199
  mapRouteProperties2,
3118
3200
  false
@@ -3121,25 +3203,29 @@ function createRouter(init) {
3121
3203
  });
3122
3204
  } catch (e) {
3123
3205
  return { type: "error", error: e, partialMatches };
3124
- } finally {
3125
- if (isNonHMR && !signal.aborted) {
3126
- dataRoutes = [...dataRoutes];
3127
- }
3128
3206
  }
3129
3207
  if (signal.aborted) {
3130
3208
  return { type: "aborted" };
3131
3209
  }
3132
- let newMatches = matchRoutes(routesToUse, pathname, basename);
3210
+ let activeBranches = dataRoutes.branches;
3211
+ let newMatches = matchRoutesImpl(
3212
+ dataRoutes.activeRoutes,
3213
+ pathname,
3214
+ basename,
3215
+ false,
3216
+ activeBranches
3217
+ );
3133
3218
  let newPartialMatches = null;
3134
3219
  if (newMatches) {
3135
3220
  if (Object.keys(newMatches[0].params).length === 0) {
3136
3221
  return { type: "success", matches: newMatches };
3137
3222
  } else {
3138
3223
  newPartialMatches = matchRoutesImpl(
3139
- routesToUse,
3224
+ dataRoutes.activeRoutes,
3140
3225
  pathname,
3141
3226
  basename,
3142
- true
3227
+ true,
3228
+ activeBranches
3143
3229
  );
3144
3230
  let matchedDeeper = newPartialMatches && partialMatches.length < newPartialMatches.length && compareMatches(
3145
3231
  partialMatches,
@@ -3152,10 +3238,11 @@ function createRouter(init) {
3152
3238
  }
3153
3239
  if (!newPartialMatches) {
3154
3240
  newPartialMatches = matchRoutesImpl(
3155
- routesToUse,
3241
+ dataRoutes.activeRoutes,
3156
3242
  pathname,
3157
3243
  basename,
3158
- true
3244
+ true,
3245
+ activeBranches
3159
3246
  );
3160
3247
  }
3161
3248
  if (!newPartialMatches || compareMatches(partialMatches, newPartialMatches)) {
@@ -3169,26 +3256,25 @@ function createRouter(init) {
3169
3256
  }
3170
3257
  function _internalSetRoutes(newRoutes) {
3171
3258
  manifest = {};
3172
- inFlightDataRoutes = convertRoutesToDataRoutes(
3173
- newRoutes,
3174
- mapRouteProperties2,
3175
- void 0,
3176
- manifest
3259
+ dataRoutes.setHmrRoutes(
3260
+ convertRoutesToDataRoutes(
3261
+ newRoutes,
3262
+ mapRouteProperties2,
3263
+ void 0,
3264
+ manifest
3265
+ )
3177
3266
  );
3178
3267
  }
3179
3268
  function patchRoutes(routeId, children, unstable_allowElementMutations = false) {
3180
- let isNonHMR = inFlightDataRoutes == null;
3181
- let routesToUse = inFlightDataRoutes || dataRoutes;
3182
3269
  patchRoutesImpl(
3183
3270
  routeId,
3184
3271
  children,
3185
- routesToUse,
3272
+ dataRoutes,
3186
3273
  manifest,
3187
3274
  mapRouteProperties2,
3188
3275
  unstable_allowElementMutations
3189
3276
  );
3190
- if (isNonHMR) {
3191
- dataRoutes = [...dataRoutes];
3277
+ if (!dataRoutes.hasHMRRoutes) {
3192
3278
  updateState({});
3193
3279
  }
3194
3280
  }
@@ -3203,7 +3289,13 @@ function createRouter(init) {
3203
3289
  return state;
3204
3290
  },
3205
3291
  get routes() {
3206
- return dataRoutes;
3292
+ return dataRoutes.stableRoutes;
3293
+ },
3294
+ get branches() {
3295
+ return dataRoutes.branches;
3296
+ },
3297
+ get manifest() {
3298
+ return manifest;
3207
3299
  },
3208
3300
  get window() {
3209
3301
  return routerWindow;
@@ -3233,10 +3325,10 @@ function createRouter(init) {
3233
3325
  updateState(newState);
3234
3326
  }
3235
3327
  };
3236
- if (init.unstable_instrumentations) {
3328
+ if (init.instrumentations) {
3237
3329
  router = instrumentClientSideRouter(
3238
3330
  router,
3239
- init.unstable_instrumentations.map((i) => i.router).filter(Boolean)
3331
+ init.instrumentations.map((i) => i.router).filter(Boolean)
3240
3332
  );
3241
3333
  }
3242
3334
  return router;
@@ -3251,12 +3343,10 @@ function createStaticHandler(routes, opts) {
3251
3343
  let _mapRouteProperties = _optionalChain([opts, 'optionalAccess', _29 => _29.mapRouteProperties]) || defaultMapRouteProperties;
3252
3344
  let mapRouteProperties2 = _mapRouteProperties;
3253
3345
  let future = {
3254
- unstable_passThroughRequests: false,
3255
- // unused in static handler
3256
3346
  ..._optionalChain([opts, 'optionalAccess', _30 => _30.future])
3257
3347
  };
3258
- if (_optionalChain([opts, 'optionalAccess', _31 => _31.unstable_instrumentations])) {
3259
- let instrumentations = opts.unstable_instrumentations;
3348
+ if (_optionalChain([opts, 'optionalAccess', _31 => _31.instrumentations])) {
3349
+ let instrumentations = opts.instrumentations;
3260
3350
  mapRouteProperties2 = (route) => {
3261
3351
  return {
3262
3352
  ..._mapRouteProperties(route),
@@ -3273,6 +3363,7 @@ function createStaticHandler(routes, opts) {
3273
3363
  void 0,
3274
3364
  manifest
3275
3365
  );
3366
+ let routeBranches = flattenAndRankRoutes(dataRoutes);
3276
3367
  async function query(request, {
3277
3368
  requestContext,
3278
3369
  filterMatchesToLoad,
@@ -3280,12 +3371,23 @@ function createStaticHandler(routes, opts) {
3280
3371
  skipRevalidation,
3281
3372
  dataStrategy,
3282
3373
  generateMiddlewareResponse,
3283
- unstable_normalizePath
3374
+ normalizePath
3284
3375
  } = {}) {
3285
- let normalizePath = unstable_normalizePath || defaultNormalizePath;
3376
+ let normalizePathImpl = normalizePath || defaultNormalizePath;
3286
3377
  let method = request.method;
3287
- let location = createLocation("", normalizePath(request), null, "default");
3288
- let matches = matchRoutes(dataRoutes, location, basename);
3378
+ let location = createLocation(
3379
+ "",
3380
+ normalizePathImpl(request),
3381
+ null,
3382
+ "default"
3383
+ );
3384
+ let matches = matchRoutesImpl(
3385
+ dataRoutes,
3386
+ location,
3387
+ basename,
3388
+ false,
3389
+ routeBranches
3390
+ );
3289
3391
  requestContext = requestContext != null ? requestContext : new RouterContextProvider();
3290
3392
  if (!isValidMethod(method) && method !== "HEAD") {
3291
3393
  let error = getInternalRouterError(405, { method });
@@ -3337,8 +3439,8 @@ function createStaticHandler(routes, opts) {
3337
3439
  let response = await runServerMiddlewarePipeline(
3338
3440
  {
3339
3441
  request,
3340
- unstable_url: createDataFunctionUrl(request, location),
3341
- unstable_pattern: getRoutePattern(matches),
3442
+ url: createDataFunctionUrl(request, location),
3443
+ pattern: getRoutePattern(matches),
3342
3444
  matches,
3343
3445
  params: matches[0].params,
3344
3446
  // If we're calling middleware then it must be enabled so we can cast
@@ -3455,12 +3557,23 @@ function createStaticHandler(routes, opts) {
3455
3557
  requestContext,
3456
3558
  dataStrategy,
3457
3559
  generateMiddlewareResponse,
3458
- unstable_normalizePath
3560
+ normalizePath
3459
3561
  } = {}) {
3460
- let normalizePath = unstable_normalizePath || defaultNormalizePath;
3562
+ let normalizePathImpl = normalizePath || defaultNormalizePath;
3461
3563
  let method = request.method;
3462
- let location = createLocation("", normalizePath(request), null, "default");
3463
- let matches = matchRoutes(dataRoutes, location, basename);
3564
+ let location = createLocation(
3565
+ "",
3566
+ normalizePathImpl(request),
3567
+ null,
3568
+ "default"
3569
+ );
3570
+ let matches = matchRoutesImpl(
3571
+ dataRoutes,
3572
+ location,
3573
+ basename,
3574
+ false,
3575
+ routeBranches
3576
+ );
3464
3577
  requestContext = requestContext != null ? requestContext : new RouterContextProvider();
3465
3578
  if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") {
3466
3579
  throw getInternalRouterError(405, { method });
@@ -3485,8 +3598,8 @@ function createStaticHandler(routes, opts) {
3485
3598
  let response = await runServerMiddlewarePipeline(
3486
3599
  {
3487
3600
  request,
3488
- unstable_url: createDataFunctionUrl(request, location),
3489
- unstable_pattern: getRoutePattern(matches),
3601
+ url: createDataFunctionUrl(request, location),
3602
+ pattern: getRoutePattern(matches),
3490
3603
  matches,
3491
3604
  params: matches[0].params,
3492
3605
  // If we're calling middleware then it must be enabled so we can cast
@@ -3872,6 +3985,7 @@ function createStaticHandler(routes, opts) {
3872
3985
  }
3873
3986
  return {
3874
3987
  dataRoutes,
3988
+ _internalRouteBranches: routeBranches,
3875
3989
  query,
3876
3990
  queryRoute
3877
3991
  };
@@ -4057,7 +4171,7 @@ function normalizeNavigateOptions(isFetcher, path, opts) {
4057
4171
  parsedPath.search = `?${searchParams}`;
4058
4172
  return { path: createPath(parsedPath), submission };
4059
4173
  }
4060
- function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest, history, state, matches, submission, location, lazyRoutePropertiesToSkip, initialHydration, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, hasPatchRoutesOnNavigation, pendingActionResult, callSiteDefaultShouldRevalidate) {
4174
+ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest, history, state, matches, submission, location, lazyRoutePropertiesToSkip, initialHydration, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, hasPatchRoutesOnNavigation, branches, pendingActionResult, callSiteDefaultShouldRevalidate) {
4061
4175
  let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : void 0;
4062
4176
  let currentUrl = history.createURL(state.location);
4063
4177
  let nextUrl = history.createURL(location);
@@ -4153,7 +4267,13 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
4153
4267
  }
4154
4268
  let fetcher = state.fetchers.get(key);
4155
4269
  let isMidInitialLoad = fetcher && fetcher.state !== "idle" && fetcher.data === void 0;
4156
- let fetcherMatches = matchRoutes(routesToUse, f.path, basename);
4270
+ let fetcherMatches = matchRoutesImpl(
4271
+ routesToUse,
4272
+ f.path,
4273
+ _nullishCoalesce(basename, () => ( "/")),
4274
+ false,
4275
+ branches
4276
+ );
4157
4277
  if (!fetcherMatches) {
4158
4278
  if (hasPatchRoutesOnNavigation && isMidInitialLoad) {
4159
4279
  return;
@@ -4294,7 +4414,7 @@ function shouldRevalidateLoader(loaderMatch, arg) {
4294
4414
  }
4295
4415
  return arg.defaultShouldRevalidate;
4296
4416
  }
4297
- function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties2, allowElementMutations) {
4417
+ function patchRoutesImpl(routeId, children, dataRoutes, manifest, mapRouteProperties2, allowElementMutations) {
4298
4418
  let childrenToPatch;
4299
4419
  if (routeId) {
4300
4420
  let route = manifest[routeId];
@@ -4307,7 +4427,7 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
4307
4427
  }
4308
4428
  childrenToPatch = route.children;
4309
4429
  } else {
4310
- childrenToPatch = routesToUse;
4430
+ childrenToPatch = dataRoutes.activeRoutes;
4311
4431
  }
4312
4432
  let uniqueChildren = [];
4313
4433
  let existingChildren = [];
@@ -4350,6 +4470,9 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
4350
4470
  });
4351
4471
  }
4352
4472
  }
4473
+ if (!dataRoutes.hasHMRRoutes) {
4474
+ dataRoutes.setRoutes([...dataRoutes.activeRoutes]);
4475
+ }
4353
4476
  }
4354
4477
  function isSameRoute(newRoute, existingRoute) {
4355
4478
  if ("id" in newRoute && "id" in existingRoute && newRoute.id === existingRoute.id) {
@@ -4691,7 +4814,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties2, manifest, request
4691
4814
  handler: lazyRoutePromises.lazyHandlerPromise
4692
4815
  };
4693
4816
  }
4694
- function getDataStrategyMatch(mapRouteProperties2, manifest, request, path, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
4817
+ function getDataStrategyMatch(mapRouteProperties2, manifest, request, path, pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
4695
4818
  let isUsingNewApi = false;
4696
4819
  let _lazyPromises = getDataStrategyMatchLazyPromises(
4697
4820
  mapRouteProperties2,
@@ -4732,7 +4855,7 @@ function getDataStrategyMatch(mapRouteProperties2, manifest, request, path, unst
4732
4855
  return callLoaderOrAction({
4733
4856
  request,
4734
4857
  path,
4735
- unstable_pattern,
4858
+ pattern,
4736
4859
  match,
4737
4860
  lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess', _56 => _56.handler]),
4738
4861
  lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess', _57 => _57.route]),
@@ -4782,8 +4905,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
4782
4905
  }
4783
4906
  let dataStrategyArgs = {
4784
4907
  request,
4785
- unstable_url: createDataFunctionUrl(request, path),
4786
- unstable_pattern: getRoutePattern(matches),
4908
+ url: createDataFunctionUrl(request, path),
4909
+ pattern: getRoutePattern(matches),
4787
4910
  params: matches[0].params,
4788
4911
  context: scopedContext,
4789
4912
  matches
@@ -4825,7 +4948,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
4825
4948
  async function callLoaderOrAction({
4826
4949
  request,
4827
4950
  path,
4828
- unstable_pattern,
4951
+ pattern,
4829
4952
  match,
4830
4953
  lazyHandlerPromise,
4831
4954
  lazyRoutePromise,
@@ -4852,8 +4975,8 @@ async function callLoaderOrAction({
4852
4975
  return handler(
4853
4976
  {
4854
4977
  request,
4855
- unstable_url: createDataFunctionUrl(request, path),
4856
- unstable_pattern,
4978
+ url: createDataFunctionUrl(request, path),
4979
+ pattern,
4857
4980
  params: match.params,
4858
4981
  context: scopedContext
4859
4982
  },
@@ -6375,11 +6498,9 @@ function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules
6375
6498
  (match) => {
6376
6499
  let manifestRoute = manifest.routes[match.route.id];
6377
6500
  invariant2(manifestRoute, "Route not found in manifest");
6378
- let routeModule = routeModules[match.route.id];
6379
6501
  return {
6380
6502
  hasLoader: manifestRoute.hasLoader,
6381
- hasClientLoader: manifestRoute.hasClientLoader,
6382
- hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess', _83 => _83.shouldRevalidate]))
6503
+ hasClientLoader: manifestRoute.hasClientLoader
6383
6504
  };
6384
6505
  },
6385
6506
  fetchAndDecodeViaTurboStream,
@@ -6499,13 +6620,12 @@ async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, f
6499
6620
  async (m, i) => m.resolve(async (handler) => {
6500
6621
  routeDfds[i].resolve();
6501
6622
  let routeId = m.route.id;
6502
- let { hasLoader, hasClientLoader, hasShouldRevalidate } = getRouteInfo(m);
6623
+ let { hasLoader, hasClientLoader } = getRouteInfo(m);
6503
6624
  let defaultShouldRevalidate = !m.shouldRevalidateArgs || m.shouldRevalidateArgs.actionStatus == null || m.shouldRevalidateArgs.actionStatus < 400;
6504
6625
  let shouldCall = m.shouldCallHandler(defaultShouldRevalidate);
6505
6626
  if (!shouldCall) {
6506
6627
  foundOptOutRoute || (foundOptOutRoute = m.shouldRevalidateArgs != null && // This is a revalidation,
6507
- hasLoader && // for a route with a server loader,
6508
- hasShouldRevalidate === true);
6628
+ hasLoader);
6509
6629
  return;
6510
6630
  }
6511
6631
  if (shouldAllowOptOut(m) && hasClientLoader) {
@@ -6580,7 +6700,7 @@ async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams,
6580
6700
  let routeResult = fetchedData.routes[match.route.id];
6581
6701
  if ("error" in routeResult) {
6582
6702
  middlewareError = routeResult.error;
6583
- if (_optionalChain([results, 'access', _84 => _84[match.route.id], 'optionalAccess', _85 => _85.result]) == null) {
6703
+ if (_optionalChain([results, 'access', _83 => _83[match.route.id], 'optionalAccess', _84 => _84.result]) == null) {
6584
6704
  results[match.route.id] = {
6585
6705
  type: "error",
6586
6706
  result: middlewareError
@@ -6703,7 +6823,7 @@ async function fetchAndDecodeViaTurboStream(args, basename, trailingSlashAware,
6703
6823
  }
6704
6824
  } else {
6705
6825
  let typed = decoded.value;
6706
- let routeId = _optionalChain([targetRoutes, 'optionalAccess', _86 => _86[0]]);
6826
+ let routeId = _optionalChain([targetRoutes, 'optionalAccess', _85 => _85[0]]);
6707
6827
  invariant2(routeId, "No routeId found for single fetch call decoding");
6708
6828
  if ("redirect" in typed) {
6709
6829
  data2 = { redirect: typed };
@@ -7003,7 +7123,7 @@ function useOutlet(context) {
7003
7123
  function useParams() {
7004
7124
  let { matches } = React3.useContext(RouteContext);
7005
7125
  let routeMatch = matches[matches.length - 1];
7006
- return _nullishCoalesce(_optionalChain([routeMatch, 'optionalAccess', _87 => _87.params]), () => ( {}));
7126
+ return _nullishCoalesce(_optionalChain([routeMatch, 'optionalAccess', _86 => _86.params]), () => ( {}));
7007
7127
  }
7008
7128
  function useResolvedPath(to, { relative } = {}) {
7009
7129
  let { matches } = React3.useContext(RouteContext);
@@ -7051,7 +7171,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
7051
7171
  if (locationArg) {
7052
7172
  let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
7053
7173
  invariant(
7054
- parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _88 => _88.pathname, 'optionalAccess', _89 => _89.startsWith, 'call', _90 => _90(parentPathnameBase)]),
7174
+ parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _87 => _87.pathname, 'optionalAccess', _88 => _88.startsWith, 'call', _89 => _89(parentPathnameBase)]),
7055
7175
  `When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${parentPathnameBase}" but pathname "${parsedLocationArg.pathname}" was given in the \`location\` prop.`
7056
7176
  );
7057
7177
  location = parsedLocationArg;
@@ -7065,7 +7185,15 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
7065
7185
  let segments = pathname.replace(/^\//, "").split("/");
7066
7186
  remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
7067
7187
  }
7068
- let matches = matchRoutes(routes, { pathname: remainingPathname });
7188
+ let matches = dataRouterOpts && dataRouterOpts.state.matches.length ? (
7189
+ // If we're in a data router, use the matches we've already identified but ensure
7190
+ // we have the latest route instances from the manifest in case elements have changed
7191
+ dataRouterOpts.state.matches.map(
7192
+ (m) => Object.assign(m, {
7193
+ route: dataRouterOpts.manifest[m.route.id] || m.route
7194
+ })
7195
+ )
7196
+ ) : matchRoutes(routes, { pathname: remainingPathname });
7069
7197
  if (ENABLE_DEV_WARNINGS) {
7070
7198
  warning(
7071
7199
  parentRoute || matches != null,
@@ -7116,7 +7244,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
7116
7244
  hash: "",
7117
7245
  state: null,
7118
7246
  key: "default",
7119
- unstable_mask: void 0,
7247
+ mask: void 0,
7120
7248
  ...location
7121
7249
  },
7122
7250
  navigationType: "POP" /* Pop */
@@ -7245,7 +7373,7 @@ function RenderedRoute({ routeContext, match, children }) {
7245
7373
  return /* @__PURE__ */ React3.createElement(RouteContext.Provider, { value: routeContext }, children);
7246
7374
  }
7247
7375
  function _renderMatches(matches, parentMatches = [], dataRouterOpts) {
7248
- let dataRouterState = _optionalChain([dataRouterOpts, 'optionalAccess', _91 => _91.state]);
7376
+ let dataRouterState = _optionalChain([dataRouterOpts, 'optionalAccess', _90 => _90.state]);
7249
7377
  if (matches == null) {
7250
7378
  if (!dataRouterState) {
7251
7379
  return null;
@@ -7259,10 +7387,10 @@ function _renderMatches(matches, parentMatches = [], dataRouterOpts) {
7259
7387
  }
7260
7388
  }
7261
7389
  let renderedMatches = matches;
7262
- let errors = _optionalChain([dataRouterState, 'optionalAccess', _92 => _92.errors]);
7390
+ let errors = _optionalChain([dataRouterState, 'optionalAccess', _91 => _91.errors]);
7263
7391
  if (errors != null) {
7264
7392
  let errorIndex = renderedMatches.findIndex(
7265
- (m) => m.route.id && _optionalChain([errors, 'optionalAccess', _93 => _93[m.route.id]]) !== void 0
7393
+ (m) => m.route.id && _optionalChain([errors, 'optionalAccess', _92 => _92[m.route.id]]) !== void 0
7266
7394
  );
7267
7395
  invariant(
7268
7396
  errorIndex >= 0,
@@ -7301,12 +7429,12 @@ function _renderMatches(matches, parentMatches = [], dataRouterOpts) {
7301
7429
  }
7302
7430
  }
7303
7431
  }
7304
- let onErrorHandler = _optionalChain([dataRouterOpts, 'optionalAccess', _94 => _94.onError]);
7432
+ let onErrorHandler = _optionalChain([dataRouterOpts, 'optionalAccess', _93 => _93.onError]);
7305
7433
  let onError = dataRouterState && onErrorHandler ? (error, errorInfo) => {
7306
7434
  onErrorHandler(error, {
7307
7435
  location: dataRouterState.location,
7308
- params: _nullishCoalesce(_optionalChain([dataRouterState, 'access', _95 => _95.matches, 'optionalAccess', _96 => _96[0], 'optionalAccess', _97 => _97.params]), () => ( {})),
7309
- unstable_pattern: getRoutePattern(dataRouterState.matches),
7436
+ params: _nullishCoalesce(_optionalChain([dataRouterState, 'access', _94 => _94.matches, 'optionalAccess', _95 => _95[0], 'optionalAccess', _96 => _96.params]), () => ( {})),
7437
+ pattern: getRoutePattern(dataRouterState.matches),
7310
7438
  errorInfo
7311
7439
  });
7312
7440
  } : void 0;
@@ -7452,15 +7580,15 @@ function useRouteError() {
7452
7580
  if (error !== void 0) {
7453
7581
  return error;
7454
7582
  }
7455
- return _optionalChain([state, 'access', _98 => _98.errors, 'optionalAccess', _99 => _99[routeId]]);
7583
+ return _optionalChain([state, 'access', _97 => _97.errors, 'optionalAccess', _98 => _98[routeId]]);
7456
7584
  }
7457
7585
  function useAsyncValue() {
7458
7586
  let value = React3.useContext(AwaitContext);
7459
- return _optionalChain([value, 'optionalAccess', _100 => _100._data]);
7587
+ return _optionalChain([value, 'optionalAccess', _99 => _99._data]);
7460
7588
  }
7461
7589
  function useAsyncError() {
7462
7590
  let value = React3.useContext(AwaitContext);
7463
- return _optionalChain([value, 'optionalAccess', _101 => _101._error]);
7591
+ return _optionalChain([value, 'optionalAccess', _100 => _100._error]);
7464
7592
  }
7465
7593
  var blockerId = 0;
7466
7594
  function useBlocker(shouldBlock) {
@@ -7541,7 +7669,7 @@ function useRoute(...args) {
7541
7669
  return {
7542
7670
  handle: route.route.handle,
7543
7671
  loaderData: state.loaderData[id],
7544
- actionData: _optionalChain([state, 'access', _102 => _102.actionData, 'optionalAccess', _103 => _103[id]])
7672
+ actionData: _optionalChain([state, 'access', _101 => _101.actionData, 'optionalAccess', _102 => _102[id]])
7545
7673
  };
7546
7674
  }
7547
7675
 
@@ -7586,7 +7714,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
7586
7714
  let route = manifest.routes[match.route.id];
7587
7715
  return [
7588
7716
  route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
7589
- _optionalChain([module, 'optionalAccess', _104 => _104.links, 'optionalCall', _105 => _105()]) || []
7717
+ _optionalChain([module, 'optionalAccess', _103 => _103.links, 'optionalCall', _104 => _104()]) || []
7590
7718
  ];
7591
7719
  }).flat(2);
7592
7720
  let preloads = getModuleLinkHrefs(matches, manifest);
@@ -7687,7 +7815,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
7687
7815
  // param change, /users/123 -> /users/456
7688
7816
  currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
7689
7817
  // e.g. /files/images/avatar.jpg -> files/finances.xls
7690
- _optionalChain([currentMatches, 'access', _106 => _106[index], 'access', _107 => _107.route, 'access', _108 => _108.path, 'optionalAccess', _109 => _109.endsWith, 'call', _110 => _110("*")]) && currentMatches[index].params["*"] !== match.params["*"]
7818
+ _optionalChain([currentMatches, 'access', _105 => _105[index], 'access', _106 => _106.route, 'access', _107 => _107.path, 'optionalAccess', _108 => _108.endsWith, 'call', _109 => _109("*")]) && currentMatches[index].params["*"] !== match.params["*"]
7691
7819
  );
7692
7820
  };
7693
7821
  if (mode === "assets") {
@@ -7710,7 +7838,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
7710
7838
  location.pathname + location.search + location.hash,
7711
7839
  window.origin
7712
7840
  ),
7713
- currentParams: _optionalChain([currentMatches, 'access', _111 => _111[0], 'optionalAccess', _112 => _112.params]) || {},
7841
+ currentParams: _optionalChain([currentMatches, 'access', _110 => _110[0], 'optionalAccess', _111 => _111.params]) || {},
7714
7842
  nextUrl: new URL(page, window.origin),
7715
7843
  nextParams: match.params,
7716
7844
  defaultShouldRevalidate: true
@@ -7982,17 +8110,11 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7982
8110
  )
7983
8111
  });
7984
8112
  let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
7985
- let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _113 => _113.loaderData, 'optionalAccess', _114 => _114[route.id]]) : void 0;
8113
+ let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _112 => _112.loaderData, 'optionalAccess', _113 => _113[route.id]]) : void 0;
7986
8114
  let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
7987
- let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _115 => _115.errors, 'optionalAccess', _116 => _116[route.id]]) : void 0;
7988
- let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _117 => _117.clientLoader, 'optionalAccess', _118 => _118.hydrate]) === true || !route.hasLoader);
7989
- dataRoute.loader = async ({
7990
- request,
7991
- params,
7992
- context,
7993
- unstable_pattern,
7994
- unstable_url
7995
- }, singleFetch) => {
8115
+ let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _114 => _114.errors, 'optionalAccess', _115 => _115[route.id]]) : void 0;
8116
+ let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _116 => _116.clientLoader, 'optionalAccess', _117 => _117.hydrate]) === true || !route.hasLoader);
8117
+ dataRoute.loader = async ({ request, params, context, pattern, url }, singleFetch) => {
7996
8118
  try {
7997
8119
  let result = await prefetchStylesAndCallHandler(async () => {
7998
8120
  invariant2(
@@ -8006,8 +8128,8 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
8006
8128
  request,
8007
8129
  params,
8008
8130
  context,
8009
- unstable_pattern,
8010
- unstable_url,
8131
+ pattern,
8132
+ url,
8011
8133
  async serverLoader() {
8012
8134
  preventInvalidServerHandlerCall("loader", route);
8013
8135
  if (isHydrationRequest) {
@@ -8033,13 +8155,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
8033
8155
  route.hasLoader,
8034
8156
  isSpaMode
8035
8157
  );
8036
- dataRoute.action = ({
8037
- request,
8038
- params,
8039
- context,
8040
- unstable_pattern,
8041
- unstable_url
8042
- }, singleFetch) => {
8158
+ dataRoute.action = ({ request, params, context, pattern, url }, singleFetch) => {
8043
8159
  return prefetchStylesAndCallHandler(async () => {
8044
8160
  invariant2(
8045
8161
  routeModule,
@@ -8055,8 +8171,8 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
8055
8171
  request,
8056
8172
  params,
8057
8173
  context,
8058
- unstable_pattern,
8059
- unstable_url,
8174
+ pattern,
8175
+ url,
8060
8176
  async serverAction() {
8061
8177
  preventInvalidServerHandlerCall("action", route);
8062
8178
  return fetchServerAction(singleFetch);
@@ -8251,7 +8367,13 @@ function getPartialManifest({ sri, ...manifest }, router) {
8251
8367
  segments.pop();
8252
8368
  }
8253
8369
  paths.forEach((path) => {
8254
- let matches = matchRoutes(router.routes, path, router.basename);
8370
+ let matches = matchRoutesImpl(
8371
+ router.routes,
8372
+ path,
8373
+ router.basename || "/",
8374
+ false,
8375
+ router.branches
8376
+ );
8255
8377
  if (matches) {
8256
8378
  matches.forEach((m) => routeIds.add(m.route.id));
8257
8379
  }
@@ -8294,7 +8416,7 @@ function getPatchRoutesOnNavigationFunction(getRouter, manifest, routeModules, s
8294
8416
  function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
8295
8417
  React6.useEffect(() => {
8296
8418
  if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
8297
- _optionalChain([window, 'access', _119 => _119.navigator, 'optionalAccess', _120 => _120.connection, 'optionalAccess', _121 => _121.saveData]) === true) {
8419
+ _optionalChain([window, 'access', _118 => _118.navigator, 'optionalAccess', _119 => _119.connection, 'optionalAccess', _120 => _120.saveData]) === true) {
8298
8420
  return;
8299
8421
  }
8300
8422
  function registerElement(el) {
@@ -8400,7 +8522,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
8400
8522
  }
8401
8523
  serverPatches = await res.json();
8402
8524
  } catch (e) {
8403
- if (_optionalChain([signal, 'optionalAccess', _122 => _122.aborted])) return;
8525
+ if (_optionalChain([signal, 'optionalAccess', _121 => _121.aborted])) return;
8404
8526
  throw e;
8405
8527
  }
8406
8528
  let knownRoutes = new Set(Object.keys(manifest.routes));
@@ -8703,7 +8825,7 @@ function PrefetchPageLinksImpl({
8703
8825
  if (!manifestRoute || !manifestRoute.hasLoader) {
8704
8826
  return;
8705
8827
  }
8706
- if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _123 => _123[m.route.id], 'optionalAccess', _124 => _124.shouldRevalidate])) {
8828
+ if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _122 => _122[m.route.id], 'optionalAccess', _123 => _123.shouldRevalidate])) {
8707
8829
  foundOptOutRoute = true;
8708
8830
  } else if (manifestRoute.hasClientLoader) {
8709
8831
  foundOptOutRoute = true;
@@ -8791,7 +8913,7 @@ function Meta() {
8791
8913
  error
8792
8914
  };
8793
8915
  matches[i] = match;
8794
- if (_optionalChain([routeModule, 'optionalAccess', _125 => _125.meta])) {
8916
+ if (_optionalChain([routeModule, 'optionalAccess', _124 => _124.meta])) {
8795
8917
  routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
8796
8918
  data: data2,
8797
8919
  loaderData: data2,
@@ -8890,7 +9012,7 @@ function Scripts(scriptProps) {
8890
9012
  }
8891
9013
  let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
8892
9014
  let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
8893
- let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _126 => _126.hmr, 'optionalAccess', _127 => _127.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
9015
+ let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _125 => _125.hmr, 'optionalAccess', _126 => _126.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
8894
9016
  ${matches.map((match, routeIndex) => {
8895
9017
  let routeVarName = `route${routeIndex}`;
8896
9018
  let manifestEntry = manifest.routes[match.route.id];
@@ -8998,6 +9120,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
8998
9120
  href: manifest.url,
8999
9121
  crossOrigin: scriptProps.crossOrigin,
9000
9122
  integrity: sri[manifest.url],
9123
+ nonce: scriptProps.nonce,
9001
9124
  suppressHydrationWarning: true
9002
9125
  }
9003
9126
  ) : null, /* @__PURE__ */ React7.createElement(
@@ -9007,6 +9130,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
9007
9130
  href: manifest.entry.module,
9008
9131
  crossOrigin: scriptProps.crossOrigin,
9009
9132
  integrity: sri[manifest.entry.module],
9133
+ nonce: scriptProps.nonce,
9010
9134
  suppressHydrationWarning: true
9011
9135
  }
9012
9136
  ), preloads.map((path) => /* @__PURE__ */ React7.createElement(
@@ -9017,6 +9141,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
9017
9141
  href: path,
9018
9142
  crossOrigin: scriptProps.crossOrigin,
9019
9143
  integrity: sri[path],
9144
+ nonce: scriptProps.nonce,
9020
9145
  suppressHydrationWarning: true
9021
9146
  }
9022
9147
  )), initialScripts);
@@ -9121,7 +9246,7 @@ function BoundaryShell({
9121
9246
  children
9122
9247
  }) {
9123
9248
  let { routeModules } = useFrameworkContext();
9124
- if (_optionalChain([routeModules, 'access', _128 => _128.root, 'optionalAccess', _129 => _129.Layout]) && !isOutsideRemixApp) {
9249
+ if (_optionalChain([routeModules, 'access', _127 => _127.root, 'optionalAccess', _128 => _128.Layout]) && !isOutsideRemixApp) {
9125
9250
  return children;
9126
9251
  }
9127
9252
  return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(
@@ -9201,20 +9326,20 @@ var hydrationRouteProperties = [
9201
9326
  ];
9202
9327
  function createMemoryRouter(routes, opts) {
9203
9328
  return createRouter({
9204
- basename: _optionalChain([opts, 'optionalAccess', _130 => _130.basename]),
9205
- getContext: _optionalChain([opts, 'optionalAccess', _131 => _131.getContext]),
9206
- future: _optionalChain([opts, 'optionalAccess', _132 => _132.future]),
9329
+ basename: _optionalChain([opts, 'optionalAccess', _129 => _129.basename]),
9330
+ getContext: _optionalChain([opts, 'optionalAccess', _130 => _130.getContext]),
9331
+ future: _optionalChain([opts, 'optionalAccess', _131 => _131.future]),
9207
9332
  history: createMemoryHistory({
9208
- initialEntries: _optionalChain([opts, 'optionalAccess', _133 => _133.initialEntries]),
9209
- initialIndex: _optionalChain([opts, 'optionalAccess', _134 => _134.initialIndex])
9333
+ initialEntries: _optionalChain([opts, 'optionalAccess', _132 => _132.initialEntries]),
9334
+ initialIndex: _optionalChain([opts, 'optionalAccess', _133 => _133.initialIndex])
9210
9335
  }),
9211
- hydrationData: _optionalChain([opts, 'optionalAccess', _135 => _135.hydrationData]),
9336
+ hydrationData: _optionalChain([opts, 'optionalAccess', _134 => _134.hydrationData]),
9212
9337
  routes,
9213
9338
  hydrationRouteProperties,
9214
9339
  mapRouteProperties,
9215
- dataStrategy: _optionalChain([opts, 'optionalAccess', _136 => _136.dataStrategy]),
9216
- patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _137 => _137.patchRoutesOnNavigation]),
9217
- unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _138 => _138.unstable_instrumentations])
9340
+ dataStrategy: _optionalChain([opts, 'optionalAccess', _135 => _135.dataStrategy]),
9341
+ patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _136 => _136.patchRoutesOnNavigation]),
9342
+ instrumentations: _optionalChain([opts, 'optionalAccess', _137 => _137.instrumentations])
9218
9343
  }).initialize();
9219
9344
  }
9220
9345
  var Deferred2 = class {
@@ -9240,10 +9365,10 @@ function RouterProvider({
9240
9365
  router,
9241
9366
  flushSync: reactDomFlushSyncImpl,
9242
9367
  onError,
9243
- unstable_useTransitions
9368
+ useTransitions
9244
9369
  }) {
9245
9370
  let unstable_rsc = useIsRSCRouterContext();
9246
- unstable_useTransitions = unstable_rsc || unstable_useTransitions;
9371
+ useTransitions = unstable_rsc || useTransitions;
9247
9372
  let [_state, setStateImpl] = React9.useState(router.state);
9248
9373
  let [state, setOptimisticState] = useOptimisticSafe(_state);
9249
9374
  let [pendingState, setPendingState] = React9.useState();
@@ -9260,8 +9385,8 @@ function RouterProvider({
9260
9385
  Object.values(newErrors).forEach(
9261
9386
  (error) => onError(error, {
9262
9387
  location: newState.location,
9263
- params: _nullishCoalesce(_optionalChain([newState, 'access', _139 => _139.matches, 'access', _140 => _140[0], 'optionalAccess', _141 => _141.params]), () => ( {})),
9264
- unstable_pattern: getRoutePattern(newState.matches)
9388
+ params: _nullishCoalesce(_optionalChain([newState, 'access', _138 => _138.matches, 'access', _139 => _139[0], 'optionalAccess', _140 => _140.params]), () => ( {})),
9389
+ pattern: getRoutePattern(newState.matches)
9265
9390
  })
9266
9391
  );
9267
9392
  }
@@ -9283,11 +9408,11 @@ function RouterProvider({
9283
9408
  if (!viewTransitionOpts || !isViewTransitionAvailable) {
9284
9409
  if (reactDomFlushSyncImpl && flushSync) {
9285
9410
  reactDomFlushSyncImpl(() => setStateImpl(newState));
9286
- } else if (unstable_useTransitions === false) {
9411
+ } else if (useTransitions === false) {
9287
9412
  setStateImpl(newState);
9288
9413
  } else {
9289
9414
  React9.startTransition(() => {
9290
- if (unstable_useTransitions === true) {
9415
+ if (useTransitions === true) {
9291
9416
  setOptimisticState((s) => getOptimisticRouterState(s, newState));
9292
9417
  }
9293
9418
  setStateImpl(newState);
@@ -9298,7 +9423,7 @@ function RouterProvider({
9298
9423
  if (reactDomFlushSyncImpl && flushSync) {
9299
9424
  reactDomFlushSyncImpl(() => {
9300
9425
  if (transition) {
9301
- _optionalChain([renderDfd, 'optionalAccess', _142 => _142.resolve, 'call', _143 => _143()]);
9426
+ _optionalChain([renderDfd, 'optionalAccess', _141 => _141.resolve, 'call', _142 => _142()]);
9302
9427
  transition.skipTransition();
9303
9428
  }
9304
9429
  setVtContext({
@@ -9323,7 +9448,7 @@ function RouterProvider({
9323
9448
  return;
9324
9449
  }
9325
9450
  if (transition) {
9326
- _optionalChain([renderDfd, 'optionalAccess', _144 => _144.resolve, 'call', _145 => _145()]);
9451
+ _optionalChain([renderDfd, 'optionalAccess', _143 => _143.resolve, 'call', _144 => _144()]);
9327
9452
  transition.skipTransition();
9328
9453
  setInterruption({
9329
9454
  state: newState,
@@ -9345,7 +9470,7 @@ function RouterProvider({
9345
9470
  reactDomFlushSyncImpl,
9346
9471
  transition,
9347
9472
  renderDfd,
9348
- unstable_useTransitions,
9473
+ useTransitions,
9349
9474
  setOptimisticState,
9350
9475
  onError
9351
9476
  ]
@@ -9371,11 +9496,11 @@ function RouterProvider({
9371
9496
  let newState = pendingState;
9372
9497
  let renderPromise = renderDfd.promise;
9373
9498
  let transition2 = router.window.document.startViewTransition(async () => {
9374
- if (unstable_useTransitions === false) {
9499
+ if (useTransitions === false) {
9375
9500
  setStateImpl(newState);
9376
9501
  } else {
9377
9502
  React9.startTransition(() => {
9378
- if (unstable_useTransitions === true) {
9503
+ if (useTransitions === true) {
9379
9504
  setOptimisticState((s) => getOptimisticRouterState(s, newState));
9380
9505
  }
9381
9506
  setStateImpl(newState);
@@ -9395,7 +9520,7 @@ function RouterProvider({
9395
9520
  pendingState,
9396
9521
  renderDfd,
9397
9522
  router.window,
9398
- unstable_useTransitions,
9523
+ useTransitions,
9399
9524
  setOptimisticState
9400
9525
  ]);
9401
9526
  React9.useEffect(() => {
@@ -9422,12 +9547,12 @@ function RouterProvider({
9422
9547
  go: (n) => router.navigate(n),
9423
9548
  push: (to, state2, opts) => router.navigate(to, {
9424
9549
  state: state2,
9425
- preventScrollReset: _optionalChain([opts, 'optionalAccess', _146 => _146.preventScrollReset])
9550
+ preventScrollReset: _optionalChain([opts, 'optionalAccess', _145 => _145.preventScrollReset])
9426
9551
  }),
9427
9552
  replace: (to, state2, opts) => router.navigate(to, {
9428
9553
  replace: true,
9429
9554
  state: state2,
9430
- preventScrollReset: _optionalChain([opts, 'optionalAccess', _147 => _147.preventScrollReset])
9555
+ preventScrollReset: _optionalChain([opts, 'optionalAccess', _146 => _146.preventScrollReset])
9431
9556
  })
9432
9557
  };
9433
9558
  }, [router]);
@@ -9449,12 +9574,13 @@ function RouterProvider({
9449
9574
  location: state.location,
9450
9575
  navigationType: state.historyAction,
9451
9576
  navigator,
9452
- unstable_useTransitions
9577
+ useTransitions
9453
9578
  },
9454
9579
  /* @__PURE__ */ React9.createElement(
9455
9580
  MemoizedDataRoutes,
9456
9581
  {
9457
9582
  routes: router.routes,
9583
+ manifest: router.manifest,
9458
9584
  future: router.future,
9459
9585
  state,
9460
9586
  isStatic: false,
@@ -9477,22 +9603,29 @@ function getOptimisticRouterState(currentState, newState) {
9477
9603
  fetchers: newState.fetchers
9478
9604
  };
9479
9605
  }
9480
- var MemoizedDataRoutes = React9.memo(DataRoutes);
9481
- function DataRoutes({
9606
+ var MemoizedDataRoutes = React9.memo(DataRoutes2);
9607
+ function DataRoutes2({
9482
9608
  routes,
9609
+ manifest,
9483
9610
  future,
9484
9611
  state,
9485
9612
  isStatic,
9486
9613
  onError
9487
9614
  }) {
9488
- return useRoutesImpl(routes, void 0, { state, isStatic, onError, future });
9615
+ return useRoutesImpl(routes, void 0, {
9616
+ manifest,
9617
+ state,
9618
+ isStatic,
9619
+ onError,
9620
+ future
9621
+ });
9489
9622
  }
9490
9623
  function MemoryRouter({
9491
9624
  basename,
9492
9625
  children,
9493
9626
  initialEntries,
9494
9627
  initialIndex,
9495
- unstable_useTransitions
9628
+ useTransitions
9496
9629
  }) {
9497
9630
  let historyRef = React9.useRef();
9498
9631
  if (historyRef.current == null) {
@@ -9509,13 +9642,13 @@ function MemoryRouter({
9509
9642
  });
9510
9643
  let setState = React9.useCallback(
9511
9644
  (newState) => {
9512
- if (unstable_useTransitions === false) {
9645
+ if (useTransitions === false) {
9513
9646
  setStateImpl(newState);
9514
9647
  } else {
9515
9648
  React9.startTransition(() => setStateImpl(newState));
9516
9649
  }
9517
9650
  },
9518
- [unstable_useTransitions]
9651
+ [useTransitions]
9519
9652
  );
9520
9653
  React9.useLayoutEffect(() => history.listen(setState), [history, setState]);
9521
9654
  return /* @__PURE__ */ React9.createElement(
@@ -9526,7 +9659,7 @@ function MemoryRouter({
9526
9659
  location: state.location,
9527
9660
  navigationType: state.action,
9528
9661
  navigator: history,
9529
- unstable_useTransitions
9662
+ useTransitions
9530
9663
  }
9531
9664
  );
9532
9665
  }
@@ -9578,7 +9711,7 @@ function Router({
9578
9711
  navigationType = "POP" /* Pop */,
9579
9712
  navigator,
9580
9713
  static: staticProp = false,
9581
- unstable_useTransitions
9714
+ useTransitions
9582
9715
  }) {
9583
9716
  invariant(
9584
9717
  !useInRouterContext(),
@@ -9590,10 +9723,10 @@ function Router({
9590
9723
  basename,
9591
9724
  navigator,
9592
9725
  static: staticProp,
9593
- unstable_useTransitions,
9726
+ useTransitions,
9594
9727
  future: {}
9595
9728
  }),
9596
- [basename, navigator, staticProp, unstable_useTransitions]
9729
+ [basename, navigator, staticProp, useTransitions]
9597
9730
  );
9598
9731
  if (typeof locationProp === "string") {
9599
9732
  locationProp = parsePath(locationProp);
@@ -9604,7 +9737,7 @@ function Router({
9604
9737
  hash = "",
9605
9738
  state = null,
9606
9739
  key = "default",
9607
- unstable_mask
9740
+ mask
9608
9741
  } = locationProp;
9609
9742
  let locationContext = React9.useMemo(() => {
9610
9743
  let trailingPathname = stripBasename(pathname, basename);
@@ -9618,20 +9751,11 @@ function Router({
9618
9751
  hash,
9619
9752
  state,
9620
9753
  key,
9621
- unstable_mask
9754
+ mask
9622
9755
  },
9623
9756
  navigationType
9624
9757
  };
9625
- }, [
9626
- basename,
9627
- pathname,
9628
- search,
9629
- hash,
9630
- state,
9631
- key,
9632
- navigationType,
9633
- unstable_mask
9634
- ]);
9758
+ }, [basename, pathname, search, hash, state, key, navigationType, mask]);
9635
9759
  warning(
9636
9760
  locationContext != null,
9637
9761
  `<Router basename="${basename}"> is not able to match the URL "${pathname}${search}${hash}" because it does not start with the basename, so the <Router> won't render anything.`
@@ -9659,8 +9783,8 @@ function Await({
9659
9783
  if (dataRouterContext && dataRouterContext.onError && dataRouterStateContext) {
9660
9784
  dataRouterContext.onError(error, {
9661
9785
  location: dataRouterStateContext.location,
9662
- params: _optionalChain([dataRouterStateContext, 'access', _148 => _148.matches, 'access', _149 => _149[0], 'optionalAccess', _150 => _150.params]) || {},
9663
- unstable_pattern: getRoutePattern(dataRouterStateContext.matches),
9786
+ params: _optionalChain([dataRouterStateContext, 'access', _147 => _147.matches, 'access', _148 => _148[0], 'optionalAccess', _149 => _149.params]) || {},
9787
+ pattern: getRoutePattern(dataRouterStateContext.matches),
9664
9788
  errorInfo
9665
9789
  });
9666
9790
  }
@@ -9721,7 +9845,7 @@ var AwaitErrorBoundary = class extends React9.Component {
9721
9845
  promise = resolve.then(
9722
9846
  (data2) => Object.defineProperty(resolve, "_data", { get: () => data2 }),
9723
9847
  (error) => {
9724
- _optionalChain([this, 'access', _151 => _151.props, 'access', _152 => _152.onError, 'optionalCall', _153 => _153(error)]);
9848
+ _optionalChain([this, 'access', _150 => _150.props, 'access', _151 => _151.onError, 'optionalCall', _152 => _152(error)]);
9725
9849
  Object.defineProperty(resolve, "_error", { get: () => error });
9726
9850
  }
9727
9851
  );
@@ -9986,4 +10110,6 @@ function withErrorBoundaryProps(ErrorBoundary) {
9986
10110
 
9987
10111
 
9988
10112
 
9989
- exports.Action = Action; exports.createMemoryHistory = createMemoryHistory; exports.createBrowserHistory = createBrowserHistory; exports.createHashHistory = createHashHistory; exports.invariant = invariant; exports.warning = warning; exports.createPath = createPath; exports.parsePath = parsePath; exports.createContext = createContext; exports.RouterContextProvider = RouterContextProvider; exports.convertRoutesToDataRoutes = convertRoutesToDataRoutes; exports.matchRoutes = matchRoutes; exports.generatePath = generatePath; exports.matchPath = matchPath; exports.stripBasename = stripBasename; exports.resolvePath = resolvePath; exports.resolveTo = resolveTo; exports.joinPaths = joinPaths; exports.data = data; exports.redirect = redirect; exports.redirectDocument = redirectDocument; exports.replace = replace; exports.ErrorResponseImpl = ErrorResponseImpl; exports.isRouteErrorResponse = isRouteErrorResponse; exports.parseToInfo = parseToInfo; exports.escapeHtml = escapeHtml; exports.encode = encode; exports.instrumentHandler = instrumentHandler; exports.IDLE_NAVIGATION = IDLE_NAVIGATION; exports.IDLE_FETCHER = IDLE_FETCHER; exports.IDLE_BLOCKER = IDLE_BLOCKER; exports.createRouter = createRouter; exports.createStaticHandler = createStaticHandler; exports.getStaticContextFromError = getStaticContextFromError; exports.invalidProtocols = invalidProtocols; exports.isDataWithResponseInit = isDataWithResponseInit; exports.isResponse = isResponse; exports.isRedirectStatusCode = isRedirectStatusCode; exports.isRedirectResponse = isRedirectResponse; exports.isMutationMethod = isMutationMethod; exports.createRequestInit = createRequestInit; exports.SingleFetchRedirectSymbol = SingleFetchRedirectSymbol; exports.SINGLE_FETCH_REDIRECT_STATUS = SINGLE_FETCH_REDIRECT_STATUS; exports.NO_BODY_STATUS_CODES = NO_BODY_STATUS_CODES; exports.StreamTransfer = StreamTransfer; exports.getTurboStreamSingleFetchDataStrategy = getTurboStreamSingleFetchDataStrategy; exports.getSingleFetchDataStrategyImpl = getSingleFetchDataStrategyImpl; exports.stripIndexParam = stripIndexParam; exports.singleFetchUrl = singleFetchUrl; exports.decodeViaTurboStream = decodeViaTurboStream; exports.DataRouterContext = DataRouterContext; exports.DataRouterStateContext = DataRouterStateContext; exports.RSCRouterContext = RSCRouterContext; exports.ViewTransitionContext = ViewTransitionContext; exports.FetchersContext = FetchersContext; exports.AwaitContextProvider = AwaitContextProvider; exports.NavigationContext = NavigationContext; exports.LocationContext = LocationContext; exports.RouteContext = RouteContext; exports.ENABLE_DEV_WARNINGS = ENABLE_DEV_WARNINGS; exports.warnOnce = warnOnce; exports.decodeRedirectErrorDigest = decodeRedirectErrorDigest; exports.decodeRouteErrorResponseDigest = decodeRouteErrorResponseDigest; exports.useHref = useHref; exports.useInRouterContext = useInRouterContext; exports.useLocation = useLocation; exports.useNavigationType = useNavigationType; exports.useMatch = useMatch; exports.useNavigate = useNavigate; exports.useOutletContext = useOutletContext; exports.useOutlet = useOutlet; exports.useParams = useParams; exports.useResolvedPath = useResolvedPath; exports.useRoutes = useRoutes; exports.useRouteId = useRouteId; exports.useNavigation = useNavigation; exports.useRevalidator = useRevalidator; exports.useMatches = useMatches; exports.useLoaderData = useLoaderData; exports.useRouteLoaderData = useRouteLoaderData; exports.useActionData = useActionData; exports.useRouteError = useRouteError; exports.useAsyncValue = useAsyncValue; exports.useAsyncError = useAsyncError; exports.useBlocker = useBlocker; exports.useRoute = useRoute; exports.RemixErrorBoundary = RemixErrorBoundary; exports.createServerRoutes = createServerRoutes; exports.createClientRoutesWithHMRRevalidationOptOut = createClientRoutesWithHMRRevalidationOptOut; exports.noActionDefinedError = noActionDefinedError; exports.createClientRoutes = createClientRoutes; exports.shouldHydrateRouteLoader = shouldHydrateRouteLoader; exports.getPatchRoutesOnNavigationFunction = getPatchRoutesOnNavigationFunction; exports.useFogOFWarDiscovery = useFogOFWarDiscovery; exports.getManifestPath = getManifestPath; exports.FrameworkContext = FrameworkContext; exports.usePrefetchBehavior = usePrefetchBehavior; exports.CRITICAL_CSS_DATA_ATTRIBUTE = CRITICAL_CSS_DATA_ATTRIBUTE; exports.Links = Links; exports.PrefetchPageLinks = PrefetchPageLinks; exports.Meta = Meta; exports.setIsHydrated = setIsHydrated; exports.Scripts = Scripts; exports.mergeRefs = mergeRefs; exports.mapRouteProperties = mapRouteProperties; exports.hydrationRouteProperties = hydrationRouteProperties; exports.createMemoryRouter = createMemoryRouter; exports.RouterProvider = RouterProvider; exports.DataRoutes = DataRoutes; exports.MemoryRouter = MemoryRouter; exports.Navigate = Navigate; exports.Outlet = Outlet; exports.Route = Route; exports.Router = Router; exports.Routes = Routes; exports.Await = Await; exports.createRoutesFromChildren = createRoutesFromChildren; exports.createRoutesFromElements = createRoutesFromElements; exports.renderMatches = renderMatches; exports.WithComponentProps = WithComponentProps; exports.withComponentProps = withComponentProps; exports.WithHydrateFallbackProps = WithHydrateFallbackProps; exports.withHydrateFallbackProps = withHydrateFallbackProps; exports.WithErrorBoundaryProps = WithErrorBoundaryProps; exports.withErrorBoundaryProps = withErrorBoundaryProps;
10113
+
10114
+
10115
+ exports.Action = Action; exports.createMemoryHistory = createMemoryHistory; exports.createBrowserHistory = createBrowserHistory; exports.createHashHistory = createHashHistory; exports.invariant = invariant; exports.warning = warning; exports.createPath = createPath; exports.parsePath = parsePath; exports.createContext = createContext; exports.RouterContextProvider = RouterContextProvider; exports.convertRoutesToDataRoutes = convertRoutesToDataRoutes; exports.matchRoutes = matchRoutes; exports.matchRoutesImpl = matchRoutesImpl; exports.generatePath = generatePath; exports.matchPath = matchPath; exports.stripBasename = stripBasename; exports.resolvePath = resolvePath; exports.resolveTo = resolveTo; exports.joinPaths = joinPaths; exports.data = data; exports.redirect = redirect; exports.redirectDocument = redirectDocument; exports.replace = replace; exports.ErrorResponseImpl = ErrorResponseImpl; exports.isRouteErrorResponse = isRouteErrorResponse; exports.parseToInfo = parseToInfo; exports.escapeHtml = escapeHtml; exports.encode = encode; exports.instrumentHandler = instrumentHandler; exports.IDLE_NAVIGATION = IDLE_NAVIGATION; exports.IDLE_FETCHER = IDLE_FETCHER; exports.IDLE_BLOCKER = IDLE_BLOCKER; exports.createRouter = createRouter; exports.createStaticHandler = createStaticHandler; exports.getStaticContextFromError = getStaticContextFromError; exports.invalidProtocols = invalidProtocols; exports.isDataWithResponseInit = isDataWithResponseInit; exports.isResponse = isResponse; exports.isRedirectStatusCode = isRedirectStatusCode; exports.isRedirectResponse = isRedirectResponse; exports.isMutationMethod = isMutationMethod; exports.createRequestInit = createRequestInit; exports.SingleFetchRedirectSymbol = SingleFetchRedirectSymbol; exports.SINGLE_FETCH_REDIRECT_STATUS = SINGLE_FETCH_REDIRECT_STATUS; exports.NO_BODY_STATUS_CODES = NO_BODY_STATUS_CODES; exports.StreamTransfer = StreamTransfer; exports.getTurboStreamSingleFetchDataStrategy = getTurboStreamSingleFetchDataStrategy; exports.getSingleFetchDataStrategyImpl = getSingleFetchDataStrategyImpl; exports.stripIndexParam = stripIndexParam; exports.singleFetchUrl = singleFetchUrl; exports.decodeViaTurboStream = decodeViaTurboStream; exports.DataRouterContext = DataRouterContext; exports.DataRouterStateContext = DataRouterStateContext; exports.RSCRouterContext = RSCRouterContext; exports.ViewTransitionContext = ViewTransitionContext; exports.FetchersContext = FetchersContext; exports.AwaitContextProvider = AwaitContextProvider; exports.NavigationContext = NavigationContext; exports.LocationContext = LocationContext; exports.RouteContext = RouteContext; exports.ENABLE_DEV_WARNINGS = ENABLE_DEV_WARNINGS; exports.warnOnce = warnOnce; exports.decodeRedirectErrorDigest = decodeRedirectErrorDigest; exports.decodeRouteErrorResponseDigest = decodeRouteErrorResponseDigest; exports.useHref = useHref; exports.useInRouterContext = useInRouterContext; exports.useLocation = useLocation; exports.useNavigationType = useNavigationType; exports.useMatch = useMatch; exports.useNavigate = useNavigate; exports.useOutletContext = useOutletContext; exports.useOutlet = useOutlet; exports.useParams = useParams; exports.useResolvedPath = useResolvedPath; exports.useRoutes = useRoutes; exports.useRouteId = useRouteId; exports.useNavigation = useNavigation; exports.useRevalidator = useRevalidator; exports.useMatches = useMatches; exports.useLoaderData = useLoaderData; exports.useRouteLoaderData = useRouteLoaderData; exports.useActionData = useActionData; exports.useRouteError = useRouteError; exports.useAsyncValue = useAsyncValue; exports.useAsyncError = useAsyncError; exports.useBlocker = useBlocker; exports.useRoute = useRoute; exports.RemixErrorBoundary = RemixErrorBoundary; exports.createServerRoutes = createServerRoutes; exports.createClientRoutesWithHMRRevalidationOptOut = createClientRoutesWithHMRRevalidationOptOut; exports.noActionDefinedError = noActionDefinedError; exports.createClientRoutes = createClientRoutes; exports.shouldHydrateRouteLoader = shouldHydrateRouteLoader; exports.URL_LIMIT = URL_LIMIT; exports.getPatchRoutesOnNavigationFunction = getPatchRoutesOnNavigationFunction; exports.useFogOFWarDiscovery = useFogOFWarDiscovery; exports.getManifestPath = getManifestPath; exports.FrameworkContext = FrameworkContext; exports.usePrefetchBehavior = usePrefetchBehavior; exports.CRITICAL_CSS_DATA_ATTRIBUTE = CRITICAL_CSS_DATA_ATTRIBUTE; exports.Links = Links; exports.PrefetchPageLinks = PrefetchPageLinks; exports.Meta = Meta; exports.setIsHydrated = setIsHydrated; exports.Scripts = Scripts; exports.mergeRefs = mergeRefs; exports.mapRouteProperties = mapRouteProperties; exports.hydrationRouteProperties = hydrationRouteProperties; exports.createMemoryRouter = createMemoryRouter; exports.RouterProvider = RouterProvider; exports.DataRoutes = DataRoutes2; exports.MemoryRouter = MemoryRouter; exports.Navigate = Navigate; exports.Outlet = Outlet; exports.Route = Route; exports.Router = Router; exports.Routes = Routes; exports.Await = Await; exports.createRoutesFromChildren = createRoutesFromChildren; exports.createRoutesFromElements = createRoutesFromElements; exports.renderMatches = renderMatches; exports.WithComponentProps = WithComponentProps; exports.withComponentProps = withComponentProps; exports.WithHydrateFallbackProps = WithHydrateFallbackProps; exports.withHydrateFallbackProps = withHydrateFallbackProps; exports.WithErrorBoundaryProps = WithErrorBoundaryProps; exports.withErrorBoundaryProps = withErrorBoundaryProps;