react-router 7.14.0 → 7.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +63 -24
  2. package/dist/development/{browser-C9Ar1yxG.d.ts → browser-C-UvoYvi.d.ts} +2 -2
  3. package/dist/development/{browser-vtIR1Kpe.d.mts → browser-I6n6wVSO.d.mts} +2 -2
  4. package/dist/development/{chunk-QFMPRPBF.mjs → chunk-EVOBXE3Y.mjs} +45 -19
  5. package/dist/development/{chunk-WAVMRYR2.js → chunk-PZFPF4X7.js} +7 -7
  6. package/dist/{production/chunk-X5LK27NZ.mjs → development/chunk-YQSHRJWW.mjs} +3 -3
  7. package/dist/{production/chunk-FPT5DLVJ.js → development/chunk-YZKCRDTN.js} +99 -99
  8. package/dist/development/{chunk-IK6APEEG.js → chunk-ZZNWZ5Q3.js} +82 -56
  9. package/dist/{production/context-phCt_zmH.d.mts → development/context-DGGUoDIu.d.mts} +1 -1
  10. package/dist/development/dom-export.d.mts +4 -4
  11. package/dist/development/dom-export.d.ts +4 -4
  12. package/dist/development/dom-export.js +27 -27
  13. package/dist/development/dom-export.mjs +3 -3
  14. package/dist/development/{index-react-server-client-luDbagNU.d.ts → index-react-server-client-BBd0A0TL.d.ts} +2 -2
  15. package/dist/{production/index-react-server-client-BwWaHAr3.d.mts → development/index-react-server-client-BjhKIe3u.d.mts} +2 -2
  16. package/dist/development/index-react-server-client.d.mts +3 -3
  17. package/dist/development/index-react-server-client.d.ts +3 -3
  18. package/dist/development/index-react-server-client.js +4 -4
  19. package/dist/development/index-react-server-client.mjs +2 -2
  20. package/dist/development/index-react-server.d.mts +6 -0
  21. package/dist/development/index-react-server.d.ts +6 -0
  22. package/dist/development/index-react-server.js +9 -6
  23. package/dist/development/index-react-server.mjs +9 -6
  24. package/dist/development/index.d.mts +11 -11
  25. package/dist/development/index.d.ts +11 -11
  26. package/dist/development/index.js +96 -96
  27. package/dist/development/index.mjs +3 -3
  28. package/dist/{production/instrumentation-BYr6ff5D.d.ts → development/instrumentation-g0dG8UL0.d.ts} +1 -1
  29. package/dist/development/lib/types/internal.d.mts +2 -2
  30. package/dist/development/lib/types/internal.d.ts +2 -2
  31. package/dist/development/lib/types/internal.js +1 -1
  32. package/dist/development/lib/types/internal.mjs +1 -1
  33. package/dist/development/{register-CTxsJBKQ.d.mts → register-D9d2sMQ7.d.mts} +1 -1
  34. package/dist/development/{register-CkcGwv27.d.ts → register-DcBltf5q.d.ts} +1 -1
  35. package/dist/development/{routeModules-CA7kSxJJ.d.ts → routeModules-7rtk67cd.d.ts} +32 -11
  36. package/dist/development/{routeModules-BRrCYrSL.d.mts → routeModules-BW4a8k3I.d.mts} +32 -11
  37. package/dist/production/{browser-C9Ar1yxG.d.ts → browser-C-UvoYvi.d.ts} +2 -2
  38. package/dist/production/{browser-vtIR1Kpe.d.mts → browser-I6n6wVSO.d.mts} +2 -2
  39. package/dist/{development/chunk-2UH5WJXA.mjs → production/chunk-2WLZNCK5.mjs} +3 -3
  40. package/dist/production/{chunk-HZQGQD2X.mjs → chunk-LK6U7ULH.mjs} +45 -19
  41. package/dist/production/{chunk-355DUZMC.js → chunk-PQL4HLVQ.js} +7 -7
  42. package/dist/{development/chunk-NXTEWSJO.js → production/chunk-UJQ4OJF4.js} +99 -99
  43. package/dist/production/{chunk-4TJ7T2OQ.js → chunk-X5SKXJ4A.js} +82 -56
  44. package/dist/{development/context-phCt_zmH.d.mts → production/context-DGGUoDIu.d.mts} +1 -1
  45. package/dist/production/dom-export.d.mts +4 -4
  46. package/dist/production/dom-export.d.ts +4 -4
  47. package/dist/production/dom-export.js +27 -27
  48. package/dist/production/dom-export.mjs +3 -3
  49. package/dist/production/{index-react-server-client-luDbagNU.d.ts → index-react-server-client-BBd0A0TL.d.ts} +2 -2
  50. package/dist/{development/index-react-server-client-BwWaHAr3.d.mts → production/index-react-server-client-BjhKIe3u.d.mts} +2 -2
  51. package/dist/production/index-react-server-client.d.mts +3 -3
  52. package/dist/production/index-react-server-client.d.ts +3 -3
  53. package/dist/production/index-react-server-client.js +4 -4
  54. package/dist/production/index-react-server-client.mjs +2 -2
  55. package/dist/production/index-react-server.d.mts +6 -0
  56. package/dist/production/index-react-server.d.ts +6 -0
  57. package/dist/production/index-react-server.js +9 -6
  58. package/dist/production/index-react-server.mjs +9 -6
  59. package/dist/production/index.d.mts +11 -11
  60. package/dist/production/index.d.ts +11 -11
  61. package/dist/production/index.js +96 -96
  62. package/dist/production/index.mjs +3 -3
  63. package/dist/{development/instrumentation-BYr6ff5D.d.ts → production/instrumentation-g0dG8UL0.d.ts} +1 -1
  64. package/dist/production/lib/types/internal.d.mts +2 -2
  65. package/dist/production/lib/types/internal.d.ts +2 -2
  66. package/dist/production/lib/types/internal.js +1 -1
  67. package/dist/production/lib/types/internal.mjs +1 -1
  68. package/dist/production/{register-CTxsJBKQ.d.mts → register-D9d2sMQ7.d.mts} +1 -1
  69. package/dist/production/{register-CkcGwv27.d.ts → register-DcBltf5q.d.ts} +1 -1
  70. package/dist/production/{routeModules-CA7kSxJJ.d.ts → routeModules-7rtk67cd.d.ts} +32 -11
  71. package/dist/production/{routeModules-BRrCYrSL.d.mts → routeModules-BW4a8k3I.d.mts} +32 -11
  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.0
2
+ * react-router v7.14.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -723,8 +723,7 @@ function generatePath(originalPath, params = {}) {
723
723
  const segments = path.split(/\/+/).map((segment, index, array) => {
724
724
  const isLastSegment = index === array.length - 1;
725
725
  if (isLastSegment && segment === "*") {
726
- const star = "*";
727
- return stringify2(params[star]);
726
+ return stringify2(params["*"]);
728
727
  }
729
728
  const keyMatch = segment.match(/^:([\w-]+)(\??)(.*)/);
730
729
  if (keyMatch) {
@@ -845,7 +844,7 @@ function resolvePath(to, fromPathname = "/") {
845
844
  } = typeof to === "string" ? parsePath(to) : to;
846
845
  let pathname;
847
846
  if (toPathname) {
848
- toPathname = toPathname.replace(/\/\/+/g, "/");
847
+ toPathname = removeDoubleSlashes(toPathname);
849
848
  if (toPathname.startsWith("/")) {
850
849
  pathname = resolvePathname(toPathname.substring(1), "/");
851
850
  } else {
@@ -861,7 +860,7 @@ function resolvePath(to, fromPathname = "/") {
861
860
  };
862
861
  }
863
862
  function resolvePathname(relativePath, fromPathname) {
864
- let segments = fromPathname.replace(/\/+$/, "").split("/");
863
+ let segments = removeTrailingSlash(fromPathname).split("/");
865
864
  let relativeSegments = relativePath.split("/");
866
865
  relativeSegments.forEach((segment) => {
867
866
  if (segment === "..") {
@@ -932,8 +931,10 @@ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = fal
932
931
  }
933
932
  return path;
934
933
  }
935
- var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
936
- var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
934
+ var removeDoubleSlashes = (path) => path.replace(/\/\/+/g, "/");
935
+ var joinPaths = (paths) => removeDoubleSlashes(paths.join("/"));
936
+ var removeTrailingSlash = (path) => path.replace(/\/+$/, "");
937
+ var normalizePathname = (pathname) => removeTrailingSlash(pathname).replace(/^\/*/, "/");
937
938
  var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
938
939
  var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
939
940
  var DataWithResponseInit = class {
@@ -987,7 +988,8 @@ function isRouteErrorResponse(error) {
987
988
  return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
988
989
  }
989
990
  function getRoutePattern(matches) {
990
- return matches.map((m) => m.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
991
+ let parts = matches.map((m) => m.route.path).filter(Boolean);
992
+ return joinPaths(parts) || "/";
991
993
  }
992
994
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
993
995
  function parseToInfo(_to, basename) {
@@ -2656,6 +2658,14 @@ function createRouter(init) {
2656
2658
  key
2657
2659
  );
2658
2660
  let result = results[match.route.id];
2661
+ if (!result) {
2662
+ for (let match2 of matches) {
2663
+ if (results[match2.route.id]) {
2664
+ result = results[match2.route.id];
2665
+ break;
2666
+ }
2667
+ }
2668
+ }
2659
2669
  if (fetchControllers.get(key) === abortController) {
2660
2670
  fetchControllers.delete(key);
2661
2671
  }
@@ -5022,7 +5032,7 @@ function normalizeRedirectLocation(location, currentUrl, basename, historyInstan
5022
5032
  }
5023
5033
  let isSameBasename = stripBasename(url.pathname, basename) != null;
5024
5034
  if (url.origin === currentUrl.origin && isSameBasename) {
5025
- return url.pathname + url.search + url.hash;
5035
+ return removeDoubleSlashes(url.pathname) + url.search + url.hash;
5026
5036
  }
5027
5037
  }
5028
5038
  try {
@@ -5561,6 +5571,14 @@ var TYPE_SET = "S";
5561
5571
  var TYPE_SYMBOL = "Y";
5562
5572
  var TYPE_URL = "U";
5563
5573
  var TYPE_PREVIOUS_RESOLVED = "Z";
5574
+ var SUPPORTED_ERROR_TYPES = [
5575
+ "EvalError",
5576
+ "RangeError",
5577
+ "ReferenceError",
5578
+ "SyntaxError",
5579
+ "TypeError",
5580
+ "URIError"
5581
+ ];
5564
5582
  var Deferred = class {
5565
5583
  constructor() {
5566
5584
  this.promise = new Promise((resolve, reject) => {
@@ -5922,7 +5940,7 @@ function hydrate(index) {
5922
5940
  continue;
5923
5941
  case TYPE_ERROR:
5924
5942
  const [, message, errorType] = value;
5925
- let error = errorType && globalObj && globalObj[errorType] ? new globalObj[errorType](message) : new Error(message);
5943
+ let error = errorType && globalObj && SUPPORTED_ERROR_TYPES.includes(errorType) && errorType in globalObj && typeof globalObj[errorType] === "function" ? new globalObj[errorType](message) : new Error(message);
5926
5944
  hydrated[index2] = error;
5927
5945
  set(error);
5928
5946
  continue;
@@ -6628,9 +6646,9 @@ function singleFetchUrl(reqUrl, basename, trailingSlashAware, extension) {
6628
6646
  if (url.pathname === "/") {
6629
6647
  url.pathname = `_root.${extension}`;
6630
6648
  } else if (basename && stripBasename(url.pathname, basename) === "/") {
6631
- url.pathname = `${basename.replace(/\/$/, "")}/_root.${extension}`;
6649
+ url.pathname = `${removeTrailingSlash(basename)}/_root.${extension}`;
6632
6650
  } else {
6633
- url.pathname = `${url.pathname.replace(/\/$/, "")}.${extension}`;
6651
+ url.pathname = `${removeTrailingSlash(url.pathname)}.${extension}`;
6634
6652
  }
6635
6653
  }
6636
6654
  return url;
@@ -6705,7 +6723,8 @@ function decodeViaTurboStream(body, global) {
6705
6723
  if (type === "SanitizedError") {
6706
6724
  let [name, message, stack] = rest;
6707
6725
  let Constructor = Error;
6708
- if (name && name in global && typeof global[name] === "function") {
6726
+ if (name && SUPPORTED_ERROR_TYPES.includes(name) && name in global && // @ts-expect-error
6727
+ typeof global[name] === "function") {
6709
6728
  Constructor = global[name];
6710
6729
  }
6711
6730
  let error = new Constructor(message);
@@ -6984,7 +7003,7 @@ function useOutlet(context) {
6984
7003
  function useParams() {
6985
7004
  let { matches } = React3.useContext(RouteContext);
6986
7005
  let routeMatch = matches[matches.length - 1];
6987
- return routeMatch ? routeMatch.params : {};
7006
+ return _nullishCoalesce(_optionalChain([routeMatch, 'optionalAccess', _87 => _87.params]), () => ( {}));
6988
7007
  }
6989
7008
  function useResolvedPath(to, { relative } = {}) {
6990
7009
  let { matches } = React3.useContext(RouteContext);
@@ -7032,7 +7051,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
7032
7051
  if (locationArg) {
7033
7052
  let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
7034
7053
  invariant(
7035
- parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _87 => _87.pathname, 'optionalAccess', _88 => _88.startsWith, 'call', _89 => _89(parentPathnameBase)]),
7054
+ parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _88 => _88.pathname, 'optionalAccess', _89 => _89.startsWith, 'call', _90 => _90(parentPathnameBase)]),
7036
7055
  `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.`
7037
7056
  );
7038
7057
  location = parsedLocationArg;
@@ -7226,7 +7245,7 @@ function RenderedRoute({ routeContext, match, children }) {
7226
7245
  return /* @__PURE__ */ React3.createElement(RouteContext.Provider, { value: routeContext }, children);
7227
7246
  }
7228
7247
  function _renderMatches(matches, parentMatches = [], dataRouterOpts) {
7229
- let dataRouterState = _optionalChain([dataRouterOpts, 'optionalAccess', _90 => _90.state]);
7248
+ let dataRouterState = _optionalChain([dataRouterOpts, 'optionalAccess', _91 => _91.state]);
7230
7249
  if (matches == null) {
7231
7250
  if (!dataRouterState) {
7232
7251
  return null;
@@ -7240,10 +7259,10 @@ function _renderMatches(matches, parentMatches = [], dataRouterOpts) {
7240
7259
  }
7241
7260
  }
7242
7261
  let renderedMatches = matches;
7243
- let errors = _optionalChain([dataRouterState, 'optionalAccess', _91 => _91.errors]);
7262
+ let errors = _optionalChain([dataRouterState, 'optionalAccess', _92 => _92.errors]);
7244
7263
  if (errors != null) {
7245
7264
  let errorIndex = renderedMatches.findIndex(
7246
- (m) => m.route.id && _optionalChain([errors, 'optionalAccess', _92 => _92[m.route.id]]) !== void 0
7265
+ (m) => m.route.id && _optionalChain([errors, 'optionalAccess', _93 => _93[m.route.id]]) !== void 0
7247
7266
  );
7248
7267
  invariant(
7249
7268
  errorIndex >= 0,
@@ -7282,11 +7301,11 @@ function _renderMatches(matches, parentMatches = [], dataRouterOpts) {
7282
7301
  }
7283
7302
  }
7284
7303
  }
7285
- let onErrorHandler = _optionalChain([dataRouterOpts, 'optionalAccess', _93 => _93.onError]);
7304
+ let onErrorHandler = _optionalChain([dataRouterOpts, 'optionalAccess', _94 => _94.onError]);
7286
7305
  let onError = dataRouterState && onErrorHandler ? (error, errorInfo) => {
7287
7306
  onErrorHandler(error, {
7288
7307
  location: dataRouterState.location,
7289
- params: _nullishCoalesce(_optionalChain([dataRouterState, 'access', _94 => _94.matches, 'optionalAccess', _95 => _95[0], 'optionalAccess', _96 => _96.params]), () => ( {})),
7308
+ params: _nullishCoalesce(_optionalChain([dataRouterState, 'access', _95 => _95.matches, 'optionalAccess', _96 => _96[0], 'optionalAccess', _97 => _97.params]), () => ( {})),
7290
7309
  unstable_pattern: getRoutePattern(dataRouterState.matches),
7291
7310
  errorInfo
7292
7311
  });
@@ -7433,15 +7452,15 @@ function useRouteError() {
7433
7452
  if (error !== void 0) {
7434
7453
  return error;
7435
7454
  }
7436
- return _optionalChain([state, 'access', _97 => _97.errors, 'optionalAccess', _98 => _98[routeId]]);
7455
+ return _optionalChain([state, 'access', _98 => _98.errors, 'optionalAccess', _99 => _99[routeId]]);
7437
7456
  }
7438
7457
  function useAsyncValue() {
7439
7458
  let value = React3.useContext(AwaitContext);
7440
- return _optionalChain([value, 'optionalAccess', _99 => _99._data]);
7459
+ return _optionalChain([value, 'optionalAccess', _100 => _100._data]);
7441
7460
  }
7442
7461
  function useAsyncError() {
7443
7462
  let value = React3.useContext(AwaitContext);
7444
- return _optionalChain([value, 'optionalAccess', _100 => _100._error]);
7463
+ return _optionalChain([value, 'optionalAccess', _101 => _101._error]);
7445
7464
  }
7446
7465
  var blockerId = 0;
7447
7466
  function useBlocker(shouldBlock) {
@@ -7522,7 +7541,7 @@ function useRoute(...args) {
7522
7541
  return {
7523
7542
  handle: route.route.handle,
7524
7543
  loaderData: state.loaderData[id],
7525
- actionData: _optionalChain([state, 'access', _101 => _101.actionData, 'optionalAccess', _102 => _102[id]])
7544
+ actionData: _optionalChain([state, 'access', _102 => _102.actionData, 'optionalAccess', _103 => _103[id]])
7526
7545
  };
7527
7546
  }
7528
7547
 
@@ -7567,7 +7586,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
7567
7586
  let route = manifest.routes[match.route.id];
7568
7587
  return [
7569
7588
  route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
7570
- _optionalChain([module, 'optionalAccess', _103 => _103.links, 'optionalCall', _104 => _104()]) || []
7589
+ _optionalChain([module, 'optionalAccess', _104 => _104.links, 'optionalCall', _105 => _105()]) || []
7571
7590
  ];
7572
7591
  }).flat(2);
7573
7592
  let preloads = getModuleLinkHrefs(matches, manifest);
@@ -7668,7 +7687,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
7668
7687
  // param change, /users/123 -> /users/456
7669
7688
  currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
7670
7689
  // e.g. /files/images/avatar.jpg -> files/finances.xls
7671
- _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["*"]
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["*"]
7672
7691
  );
7673
7692
  };
7674
7693
  if (mode === "assets") {
@@ -7691,7 +7710,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
7691
7710
  location.pathname + location.search + location.hash,
7692
7711
  window.origin
7693
7712
  ),
7694
- currentParams: _optionalChain([currentMatches, 'access', _110 => _110[0], 'optionalAccess', _111 => _111.params]) || {},
7713
+ currentParams: _optionalChain([currentMatches, 'access', _111 => _111[0], 'optionalAccess', _112 => _112.params]) || {},
7695
7714
  nextUrl: new URL(page, window.origin),
7696
7715
  nextParams: match.params,
7697
7716
  defaultShouldRevalidate: true
@@ -7963,10 +7982,10 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7963
7982
  )
7964
7983
  });
7965
7984
  let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
7966
- let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _112 => _112.loaderData, 'optionalAccess', _113 => _113[route.id]]) : void 0;
7985
+ let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _113 => _113.loaderData, 'optionalAccess', _114 => _114[route.id]]) : void 0;
7967
7986
  let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
7968
- let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _114 => _114.errors, 'optionalAccess', _115 => _115[route.id]]) : void 0;
7969
- let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _116 => _116.clientLoader, 'optionalAccess', _117 => _117.hydrate]) === true || !route.hasLoader);
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);
7970
7989
  dataRoute.loader = async ({
7971
7990
  request,
7972
7991
  params,
@@ -8275,7 +8294,7 @@ function getPatchRoutesOnNavigationFunction(getRouter, manifest, routeModules, s
8275
8294
  function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
8276
8295
  React6.useEffect(() => {
8277
8296
  if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
8278
- _optionalChain([window, 'access', _118 => _118.navigator, 'optionalAccess', _119 => _119.connection, 'optionalAccess', _120 => _120.saveData]) === true) {
8297
+ _optionalChain([window, 'access', _119 => _119.navigator, 'optionalAccess', _120 => _120.connection, 'optionalAccess', _121 => _121.saveData]) === true) {
8279
8298
  return;
8280
8299
  }
8281
8300
  function registerElement(el) {
@@ -8330,10 +8349,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscover
8330
8349
  }
8331
8350
  function getManifestPath(_manifestPath, basename) {
8332
8351
  let manifestPath = _manifestPath || "/__manifest";
8333
- if (basename == null) {
8334
- return manifestPath;
8335
- }
8336
- return `${basename}${manifestPath}`.replace(/\/+/g, "/");
8352
+ return basename == null ? manifestPath : joinPaths([basename, manifestPath]);
8337
8353
  }
8338
8354
  var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
8339
8355
  async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, manifestPath, patchRoutes, signal) {
@@ -8384,7 +8400,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
8384
8400
  }
8385
8401
  serverPatches = await res.json();
8386
8402
  } catch (e) {
8387
- if (_optionalChain([signal, 'optionalAccess', _121 => _121.aborted])) return;
8403
+ if (_optionalChain([signal, 'optionalAccess', _122 => _122.aborted])) return;
8388
8404
  throw e;
8389
8405
  }
8390
8406
  let knownRoutes = new Set(Object.keys(manifest.routes));
@@ -8687,7 +8703,7 @@ function PrefetchPageLinksImpl({
8687
8703
  if (!manifestRoute || !manifestRoute.hasLoader) {
8688
8704
  return;
8689
8705
  }
8690
- 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])) {
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])) {
8691
8707
  foundOptOutRoute = true;
8692
8708
  } else if (manifestRoute.hasClientLoader) {
8693
8709
  foundOptOutRoute = true;
@@ -8775,7 +8791,7 @@ function Meta() {
8775
8791
  error
8776
8792
  };
8777
8793
  matches[i] = match;
8778
- if (_optionalChain([routeModule, 'optionalAccess', _124 => _124.meta])) {
8794
+ if (_optionalChain([routeModule, 'optionalAccess', _125 => _125.meta])) {
8779
8795
  routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
8780
8796
  data: data2,
8781
8797
  loaderData: data2,
@@ -8874,7 +8890,7 @@ function Scripts(scriptProps) {
8874
8890
  }
8875
8891
  let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
8876
8892
  let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
8877
- 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)}` : ""};
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)}` : ""};
8878
8894
  ${matches.map((match, routeIndex) => {
8879
8895
  let routeVarName = `route${routeIndex}`;
8880
8896
  let manifestEntry = manifest.routes[match.route.id];
@@ -9105,7 +9121,7 @@ function BoundaryShell({
9105
9121
  children
9106
9122
  }) {
9107
9123
  let { routeModules } = useFrameworkContext();
9108
- if (_optionalChain([routeModules, 'access', _127 => _127.root, 'optionalAccess', _128 => _128.Layout]) && !isOutsideRemixApp) {
9124
+ if (_optionalChain([routeModules, 'access', _128 => _128.root, 'optionalAccess', _129 => _129.Layout]) && !isOutsideRemixApp) {
9109
9125
  return children;
9110
9126
  }
9111
9127
  return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(
@@ -9185,20 +9201,20 @@ var hydrationRouteProperties = [
9185
9201
  ];
9186
9202
  function createMemoryRouter(routes, opts) {
9187
9203
  return createRouter({
9188
- basename: _optionalChain([opts, 'optionalAccess', _129 => _129.basename]),
9189
- getContext: _optionalChain([opts, 'optionalAccess', _130 => _130.getContext]),
9190
- future: _optionalChain([opts, 'optionalAccess', _131 => _131.future]),
9204
+ basename: _optionalChain([opts, 'optionalAccess', _130 => _130.basename]),
9205
+ getContext: _optionalChain([opts, 'optionalAccess', _131 => _131.getContext]),
9206
+ future: _optionalChain([opts, 'optionalAccess', _132 => _132.future]),
9191
9207
  history: createMemoryHistory({
9192
- initialEntries: _optionalChain([opts, 'optionalAccess', _132 => _132.initialEntries]),
9193
- initialIndex: _optionalChain([opts, 'optionalAccess', _133 => _133.initialIndex])
9208
+ initialEntries: _optionalChain([opts, 'optionalAccess', _133 => _133.initialEntries]),
9209
+ initialIndex: _optionalChain([opts, 'optionalAccess', _134 => _134.initialIndex])
9194
9210
  }),
9195
- hydrationData: _optionalChain([opts, 'optionalAccess', _134 => _134.hydrationData]),
9211
+ hydrationData: _optionalChain([opts, 'optionalAccess', _135 => _135.hydrationData]),
9196
9212
  routes,
9197
9213
  hydrationRouteProperties,
9198
9214
  mapRouteProperties,
9199
- dataStrategy: _optionalChain([opts, 'optionalAccess', _135 => _135.dataStrategy]),
9200
- patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _136 => _136.patchRoutesOnNavigation]),
9201
- unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _137 => _137.unstable_instrumentations])
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])
9202
9218
  }).initialize();
9203
9219
  }
9204
9220
  var Deferred2 = class {
@@ -9244,7 +9260,7 @@ function RouterProvider({
9244
9260
  Object.values(newErrors).forEach(
9245
9261
  (error) => onError(error, {
9246
9262
  location: newState.location,
9247
- params: _nullishCoalesce(_optionalChain([newState, 'access', _138 => _138.matches, 'access', _139 => _139[0], 'optionalAccess', _140 => _140.params]), () => ( {})),
9263
+ params: _nullishCoalesce(_optionalChain([newState, 'access', _139 => _139.matches, 'access', _140 => _140[0], 'optionalAccess', _141 => _141.params]), () => ( {})),
9248
9264
  unstable_pattern: getRoutePattern(newState.matches)
9249
9265
  })
9250
9266
  );
@@ -9282,7 +9298,7 @@ function RouterProvider({
9282
9298
  if (reactDomFlushSyncImpl && flushSync) {
9283
9299
  reactDomFlushSyncImpl(() => {
9284
9300
  if (transition) {
9285
- _optionalChain([renderDfd, 'optionalAccess', _141 => _141.resolve, 'call', _142 => _142()]);
9301
+ _optionalChain([renderDfd, 'optionalAccess', _142 => _142.resolve, 'call', _143 => _143()]);
9286
9302
  transition.skipTransition();
9287
9303
  }
9288
9304
  setVtContext({
@@ -9307,7 +9323,7 @@ function RouterProvider({
9307
9323
  return;
9308
9324
  }
9309
9325
  if (transition) {
9310
- _optionalChain([renderDfd, 'optionalAccess', _143 => _143.resolve, 'call', _144 => _144()]);
9326
+ _optionalChain([renderDfd, 'optionalAccess', _144 => _144.resolve, 'call', _145 => _145()]);
9311
9327
  transition.skipTransition();
9312
9328
  setInterruption({
9313
9329
  state: newState,
@@ -9335,6 +9351,16 @@ function RouterProvider({
9335
9351
  ]
9336
9352
  );
9337
9353
  React9.useLayoutEffect(() => router.subscribe(setState), [router, setState]);
9354
+ let initialized = state.initialized;
9355
+ React9.useLayoutEffect(() => {
9356
+ if (!initialized && router.state.initialized) {
9357
+ setState(router.state, {
9358
+ deletedFetchers: [],
9359
+ flushSync: false,
9360
+ newErrors: null
9361
+ });
9362
+ }
9363
+ }, [initialized, setState, router.state]);
9338
9364
  React9.useEffect(() => {
9339
9365
  if (vtContext.isTransitioning && !vtContext.flushSync) {
9340
9366
  setRenderDfd(new Deferred2());
@@ -9396,12 +9422,12 @@ function RouterProvider({
9396
9422
  go: (n) => router.navigate(n),
9397
9423
  push: (to, state2, opts) => router.navigate(to, {
9398
9424
  state: state2,
9399
- preventScrollReset: _optionalChain([opts, 'optionalAccess', _145 => _145.preventScrollReset])
9425
+ preventScrollReset: _optionalChain([opts, 'optionalAccess', _146 => _146.preventScrollReset])
9400
9426
  }),
9401
9427
  replace: (to, state2, opts) => router.navigate(to, {
9402
9428
  replace: true,
9403
9429
  state: state2,
9404
- preventScrollReset: _optionalChain([opts, 'optionalAccess', _146 => _146.preventScrollReset])
9430
+ preventScrollReset: _optionalChain([opts, 'optionalAccess', _147 => _147.preventScrollReset])
9405
9431
  })
9406
9432
  };
9407
9433
  }, [router]);
@@ -9633,7 +9659,7 @@ function Await({
9633
9659
  if (dataRouterContext && dataRouterContext.onError && dataRouterStateContext) {
9634
9660
  dataRouterContext.onError(error, {
9635
9661
  location: dataRouterStateContext.location,
9636
- params: _optionalChain([dataRouterStateContext, 'access', _147 => _147.matches, 'access', _148 => _148[0], 'optionalAccess', _149 => _149.params]) || {},
9662
+ params: _optionalChain([dataRouterStateContext, 'access', _148 => _148.matches, 'access', _149 => _149[0], 'optionalAccess', _150 => _150.params]) || {},
9637
9663
  unstable_pattern: getRoutePattern(dataRouterStateContext.matches),
9638
9664
  errorInfo
9639
9665
  });
@@ -9695,7 +9721,7 @@ var AwaitErrorBoundary = class extends React9.Component {
9695
9721
  promise = resolve.then(
9696
9722
  (data2) => Object.defineProperty(resolve, "_data", { get: () => data2 }),
9697
9723
  (error) => {
9698
- _optionalChain([this, 'access', _150 => _150.props, 'access', _151 => _151.onError, 'optionalCall', _152 => _152(error)]);
9724
+ _optionalChain([this, 'access', _151 => _151.props, 'access', _152 => _152.onError, 'optionalCall', _153 => _153(error)]);
9699
9725
  Object.defineProperty(resolve, "_error", { get: () => error });
9700
9726
  }
9701
9727
  );
@@ -1,4 +1,4 @@
1
- import { m as HTMLFormMethod, n as FormEncType, o as LoaderFunctionArgs, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, r as RouteObject, s as History, t as MaybePromise, u as MapRoutePropertiesFunction, v as Action, L as Location, w as DataRouteMatch, x as Submission, y as RouteData, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, U as UIMatch, T as To, I as Path, P as Params, J as InitialEntry, K as NonIndexRouteObject, O as LazyRouteFunction, Q as IndexRouteObject, V as RouteMatch, W as TrackedPromise } from './routeModules-BRrCYrSL.mjs';
1
+ import { m as HTMLFormMethod, n as FormEncType, o as LoaderFunctionArgs, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, r as RouteObject, s as History, t as MaybePromise, u as MapRoutePropertiesFunction, v as Action, L as Location, w as DataRouteMatch, x as Submission, y as RouteData, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, U as UIMatch, T as To, I as Path, P as Params, J as InitialEntry, K as NonIndexRouteObject, O as LazyRouteFunction, Q as IndexRouteObject, V as RouteMatch, W as TrackedPromise } from './routeModules-BW4a8k3I.mjs';
2
2
  import * as React from 'react';
3
3
 
4
4
  type unstable_ServerInstrumentation = {
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
- import { a as RouterProviderProps$1, R as RouterInit, u as unstable_ClientInstrumentation, C as ClientOnErrorFunction } from './context-phCt_zmH.mjs';
3
- export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-vtIR1Kpe.mjs';
4
- import './routeModules-BRrCYrSL.mjs';
2
+ import { a as RouterProviderProps$1, R as RouterInit, u as unstable_ClientInstrumentation, C as ClientOnErrorFunction } from './context-DGGUoDIu.mjs';
3
+ export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-I6n6wVSO.mjs';
4
+ import './routeModules-BW4a8k3I.mjs';
5
5
 
6
6
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
7
- declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
7
+ declare function RouterProvider(props: RouterProviderProps): React.JSX.Element;
8
8
 
9
9
  /**
10
10
  * Props for the {@link dom.HydratedRouter} component.
@@ -1,11 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { RouterProviderProps as RouterProviderProps$1, RouterInit, ClientOnErrorFunction } from 'react-router';
3
- import { u as unstable_ClientInstrumentation } from './instrumentation-BYr6ff5D.js';
4
- export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-C9Ar1yxG.js';
5
- import './routeModules-CA7kSxJJ.js';
3
+ import { u as unstable_ClientInstrumentation } from './instrumentation-g0dG8UL0.js';
4
+ export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-C-UvoYvi.js';
5
+ import './routeModules-7rtk67cd.js';
6
6
 
7
7
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
8
- declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
8
+ declare function RouterProvider(props: RouterProviderProps): React.JSX.Element;
9
9
 
10
10
  /**
11
11
  * Props for the {@link dom.HydratedRouter} component.