react-router 7.18.4 → 7.18.6

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 (60) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/development/{browser-eq4RgLsD.d.ts → browser-7x6a6gQP.d.ts} +1 -1
  3. package/dist/development/{browser-BR5QG7ZC.d.mts → browser-CiGxXXOl.d.mts} +1 -1
  4. package/dist/development/{chunk-LVPI3KDG.js → chunk-3QTLHDUO.js} +7 -7
  5. package/dist/{production/chunk-G2MPF4YY.mjs → development/chunk-E2PF4K4Z.mjs} +25 -7
  6. package/dist/development/{chunk-HQO5H5CC.js → chunk-QM7ETCUK.js} +109 -104
  7. package/dist/development/{chunk-GR4NQCSD.js → chunk-S47XUPN5.js} +133 -66
  8. package/dist/development/{chunk-OB3PAWPO.mjs → chunk-YDNE64FV.mjs} +135 -64
  9. package/dist/{production/context-nqAapj74.d.mts → development/context-BlYKn1tE.d.mts} +2 -0
  10. package/dist/development/dom-export.d.mts +2 -2
  11. package/dist/development/dom-export.d.ts +2 -2
  12. package/dist/development/dom-export.js +37 -35
  13. package/dist/development/dom-export.mjs +6 -4
  14. package/dist/development/{index-react-server-client-BjY-eKuf.d.ts → index-react-server-client-BaaZU3sM.d.ts} +1 -1
  15. package/dist/development/{index-react-server-client-K63fpMH4.d.mts → index-react-server-client-KK-TR-t7.d.mts} +1 -1
  16. package/dist/development/index-react-server-client.d.mts +2 -2
  17. package/dist/development/index-react-server-client.d.ts +2 -2
  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 +2 -0
  21. package/dist/development/index-react-server.d.ts +2 -0
  22. package/dist/development/index-react-server.js +109 -17
  23. package/dist/development/index-react-server.mjs +109 -17
  24. package/dist/development/index.d.mts +7 -7
  25. package/dist/development/index.d.ts +7 -7
  26. package/dist/development/index.js +121 -103
  27. package/dist/development/index.mjs +3 -3
  28. package/dist/{production/instrumentation-B7w3_Eo9.d.ts → development/instrumentation-CPkMwccd.d.ts} +2 -0
  29. package/dist/development/lib/types/internal.js +1 -1
  30. package/dist/development/lib/types/internal.mjs +1 -1
  31. package/dist/production/{browser-eq4RgLsD.d.ts → browser-7x6a6gQP.d.ts} +1 -1
  32. package/dist/production/{browser-BR5QG7ZC.d.mts → browser-CiGxXXOl.d.mts} +1 -1
  33. package/dist/production/{chunk-AOOKMWND.js → chunk-2WUBOUFU.js} +109 -104
  34. package/dist/production/{chunk-QURBR4FZ.js → chunk-3IBQ4CTZ.js} +7 -7
  35. package/dist/production/{chunk-YNGRUB6F.js → chunk-AC65NKOP.js} +133 -66
  36. package/dist/production/{chunk-Q34X6AWR.mjs → chunk-HEAXLYUI.mjs} +135 -64
  37. package/dist/{development/chunk-H4DAEOV7.mjs → production/chunk-JRCXCPLA.mjs} +25 -7
  38. package/dist/{development/context-nqAapj74.d.mts → production/context-BlYKn1tE.d.mts} +2 -0
  39. package/dist/production/dom-export.d.mts +2 -2
  40. package/dist/production/dom-export.d.ts +2 -2
  41. package/dist/production/dom-export.js +37 -35
  42. package/dist/production/dom-export.mjs +6 -4
  43. package/dist/production/{index-react-server-client-BjY-eKuf.d.ts → index-react-server-client-BaaZU3sM.d.ts} +1 -1
  44. package/dist/production/{index-react-server-client-K63fpMH4.d.mts → index-react-server-client-KK-TR-t7.d.mts} +1 -1
  45. package/dist/production/index-react-server-client.d.mts +2 -2
  46. package/dist/production/index-react-server-client.d.ts +2 -2
  47. package/dist/production/index-react-server-client.js +4 -4
  48. package/dist/production/index-react-server-client.mjs +2 -2
  49. package/dist/production/index-react-server.d.mts +2 -0
  50. package/dist/production/index-react-server.d.ts +2 -0
  51. package/dist/production/index-react-server.js +109 -17
  52. package/dist/production/index-react-server.mjs +109 -17
  53. package/dist/production/index.d.mts +7 -7
  54. package/dist/production/index.d.ts +7 -7
  55. package/dist/production/index.js +121 -103
  56. package/dist/production/index.mjs +3 -3
  57. package/dist/{development/instrumentation-B7w3_Eo9.d.ts → production/instrumentation-CPkMwccd.d.ts} +2 -0
  58. package/dist/production/lib/types/internal.js +1 -1
  59. package/dist/production/lib/types/internal.mjs +1 -1
  60. 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.18.4
2
+ * react-router v7.18.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -13,7 +13,7 @@
13
13
 
14
14
 
15
15
 
16
- var _chunkQURBR4FZjs = require('./chunk-QURBR4FZ.js');
16
+ var _chunk3IBQ4CTZjs = require('./chunk-3IBQ4CTZ.js');
17
17
 
18
18
 
19
19
 
@@ -38,7 +38,7 @@ var _chunkQURBR4FZjs = require('./chunk-QURBR4FZ.js');
38
38
 
39
39
 
40
40
 
41
- var _chunkYNGRUB6Fjs = require('./chunk-YNGRUB6F.js');
41
+ var _chunkAC65NKOPjs = require('./chunk-AC65NKOP.js');
42
42
 
43
43
  // lib/dom-export/dom-router-provider.tsx
44
44
  var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
@@ -209,12 +209,14 @@ function HydratedRouter(props) {
209
209
  );
210
210
  React2.useEffect(() => {
211
211
  if (process.env.NODE_ENV === "development") {
212
- setCriticalCss(void 0);
212
+ React2.startTransition(() => {
213
+ setCriticalCss(void 0);
214
+ });
213
215
  }
214
216
  }, []);
215
217
  React2.useEffect(() => {
216
218
  if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
217
- document.querySelectorAll(`[${_chunkYNGRUB6Fjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
219
+ document.querySelectorAll(`[${_chunkAC65NKOPjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
218
220
  }
219
221
  }, [criticalCss]);
220
222
  let [location2, setLocation] = React2.useState(router.state.location);
@@ -308,14 +310,14 @@ function createCallServer({
308
310
  Promise.resolve(payloadPromise).then(async (payload) => {
309
311
  if (payload.type === "redirect") {
310
312
  let location2 = normalizeRedirectLocation(payload.location);
311
- _chunkYNGRUB6Fjs.validateNavigationTarget.call(void 0,
313
+ _chunkAC65NKOPjs.validateNavigationTarget.call(void 0,
312
314
  payload.location,
313
315
  location2,
314
316
  new URL(window.location.href),
315
317
  "allow-explicit"
316
318
  );
317
319
  if (payload.reload || isExternalLocation(location2)) {
318
- if (_chunkYNGRUB6Fjs.hasInvalidProtocol.call(void 0, location2)) {
320
+ if (_chunkAC65NKOPjs.hasInvalidProtocol.call(void 0, location2)) {
319
321
  throw new Error("Invalid redirect location");
320
322
  }
321
323
  window.location.href = location2;
@@ -335,14 +337,14 @@ function createCallServer({
335
337
  if (rerender && landedActionId < actionId && globalVar.__routerActionID <= actionId) {
336
338
  if (rerender.type === "redirect") {
337
339
  let location2 = normalizeRedirectLocation(rerender.location);
338
- _chunkYNGRUB6Fjs.validateNavigationTarget.call(void 0,
340
+ _chunkAC65NKOPjs.validateNavigationTarget.call(void 0,
339
341
  rerender.location,
340
342
  location2,
341
343
  new URL(window.location.href),
342
344
  "allow-explicit"
343
345
  );
344
346
  if (rerender.reload || isExternalLocation(location2)) {
345
- if (_chunkYNGRUB6Fjs.hasInvalidProtocol.call(void 0, location2)) {
347
+ if (_chunkAC65NKOPjs.hasInvalidProtocol.call(void 0, location2)) {
346
348
  throw new Error("Invalid redirect location");
347
349
  }
348
350
  window.location.href = location2;
@@ -407,7 +409,7 @@ function createRouterFromPayload({
407
409
  };
408
410
  if (payload.type !== "render") throw new Error("Invalid payload type");
409
411
  globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {}));
410
- _chunkQURBR4FZjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
412
+ _chunk3IBQ4CTZjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
411
413
  let routes = payload.matches.reduceRight((previous, match) => {
412
414
  const route = createRouteFromServerManifest(
413
415
  match,
@@ -421,12 +423,12 @@ function createRouterFromPayload({
421
423
  return [route];
422
424
  }, []);
423
425
  let applyPatchesPromise;
424
- globalVar.__reactRouterDataRouter = _chunkYNGRUB6Fjs.createRouter.call(void 0, {
426
+ globalVar.__reactRouterDataRouter = _chunkAC65NKOPjs.createRouter.call(void 0, {
425
427
  routes,
426
428
  getContext,
427
429
  basename: payload.basename,
428
- history: _chunkYNGRUB6Fjs.createBrowserHistory.call(void 0, ),
429
- hydrationData: _chunkQURBR4FZjs.getHydrationData.call(void 0, {
430
+ history: _chunkAC65NKOPjs.createBrowserHistory.call(void 0, ),
431
+ hydrationData: _chunk3IBQ4CTZjs.getHydrationData.call(void 0, {
430
432
  state: {
431
433
  loaderData: payload.loaderData,
432
434
  actionData: payload.actionData,
@@ -435,7 +437,7 @@ function createRouterFromPayload({
435
437
  routes,
436
438
  getRouteInfo: (routeId) => {
437
439
  let match = payload.matches.find((m) => m.id === routeId);
438
- _chunkYNGRUB6Fjs.invariant.call(void 0, match, "Route not found in payload");
440
+ _chunkAC65NKOPjs.invariant.call(void 0, match, "Route not found in payload");
439
441
  return {
440
442
  clientLoader: match.clientLoader,
441
443
  hasLoader: match.hasLoader,
@@ -550,9 +552,9 @@ function createRouterFromPayload({
550
552
  routeModules: globalVar.__reactRouterRouteModules
551
553
  };
552
554
  }
553
- var renderedRoutesContext = _chunkYNGRUB6Fjs.createContext.call(void 0, );
555
+ var renderedRoutesContext = _chunkAC65NKOPjs.createContext.call(void 0, );
554
556
  function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
555
- let dataStrategy = _chunkYNGRUB6Fjs.getSingleFetchDataStrategyImpl.call(void 0,
557
+ let dataStrategy = _chunkAC65NKOPjs.getSingleFetchDataStrategyImpl.call(void 0,
556
558
  getRouter,
557
559
  (match) => {
558
560
  let M = match;
@@ -609,20 +611,20 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
609
611
  function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
610
612
  return async (args, basename, trailingSlashAware, targetRoutes) => {
611
613
  let { request, context } = args;
612
- let url = _chunkYNGRUB6Fjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
614
+ let url = _chunkAC65NKOPjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
613
615
  if (request.method === "GET") {
614
- url = _chunkYNGRUB6Fjs.stripIndexParam.call(void 0, url);
616
+ url = _chunkAC65NKOPjs.stripIndexParam.call(void 0, url);
615
617
  if (targetRoutes) {
616
618
  url.searchParams.set("_routes", targetRoutes.join(","));
617
619
  }
618
620
  }
619
621
  let res = await fetchImplementation(
620
- new Request(url, await _chunkYNGRUB6Fjs.createRequestInit.call(void 0, request))
622
+ new Request(url, await _chunkAC65NKOPjs.createRequestInit.call(void 0, request))
621
623
  );
622
624
  if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
623
- throw new (0, _chunkYNGRUB6Fjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
625
+ throw new (0, _chunkAC65NKOPjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
624
626
  }
625
- _chunkYNGRUB6Fjs.invariant.call(void 0, res.body, "No response body to decode");
627
+ _chunkAC65NKOPjs.invariant.call(void 0, res.body, "No response body to decode");
626
628
  try {
627
629
  const payload = await createFromReadableStream(res.body, {
628
630
  temporaryReferences: void 0
@@ -646,7 +648,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
646
648
  }
647
649
  context.get(renderedRoutesContext).push(...payload.matches);
648
650
  let results = { routes: {} };
649
- const dataKey = _chunkYNGRUB6Fjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
651
+ const dataKey = _chunkAC65NKOPjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
650
652
  for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
651
653
  results.routes[routeId] = { data };
652
654
  }
@@ -679,7 +681,7 @@ function RSCHydratedRouter({
679
681
  [createFromReadableStream, payload, fetchImplementation, getContext]
680
682
  );
681
683
  React3.useEffect(() => {
682
- _chunkYNGRUB6Fjs.setIsHydrated.call(void 0, );
684
+ _chunkAC65NKOPjs.setIsHydrated.call(void 0, );
683
685
  }, []);
684
686
  React3.useLayoutEffect(() => {
685
687
  const globalVar = window;
@@ -787,8 +789,8 @@ function RSCHydratedRouter({
787
789
  },
788
790
  routeModules
789
791
  };
790
- return /* @__PURE__ */ React3.createElement(_chunkYNGRUB6Fjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkQURBR4FZjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkYNGRUB6Fjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
791
- _chunkYNGRUB6Fjs.RouterProvider,
792
+ return /* @__PURE__ */ React3.createElement(_chunkAC65NKOPjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunk3IBQ4CTZjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkAC65NKOPjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
793
+ _chunkAC65NKOPjs.RouterProvider,
792
794
  {
793
795
  router: transitionEnabledRouter,
794
796
  flushSync: ReactDOM2.flushSync
@@ -804,8 +806,8 @@ function createRouteFromServerManifest(match, payload) {
804
806
  // the server loader flow regardless of whether the client loader calls
805
807
  // `serverLoader` or not, otherwise we'll have nothing to render.
806
808
  match.hasComponent && !match.element;
807
- _chunkYNGRUB6Fjs.invariant.call(void 0, window.__reactRouterRouteModules);
808
- _chunkQURBR4FZjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
809
+ _chunkAC65NKOPjs.invariant.call(void 0, window.__reactRouterRouteModules);
810
+ _chunk3IBQ4CTZjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
809
811
  let dataRoute = {
810
812
  id: match.id,
811
813
  element: match.element,
@@ -853,7 +855,7 @@ function createRouteFromServerManifest(match, payload) {
853
855
  return await callSingleFetch(singleFetch);
854
856
  }
855
857
  }) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
856
- throw _chunkYNGRUB6Fjs.noActionDefinedError.call(void 0, "action", match.id);
858
+ throw _chunkAC65NKOPjs.noActionDefinedError.call(void 0, "action", match.id);
857
859
  },
858
860
  path: match.path,
859
861
  shouldRevalidate: match.shouldRevalidate,
@@ -865,7 +867,7 @@ function createRouteFromServerManifest(match, payload) {
865
867
  hasClientAction: match.clientAction != null
866
868
  };
867
869
  if (typeof dataRoute.loader === "function") {
868
- dataRoute.loader.hydrate = _chunkYNGRUB6Fjs.shouldHydrateRouteLoader.call(void 0,
870
+ dataRoute.loader.hydrate = _chunkAC65NKOPjs.shouldHydrateRouteLoader.call(void 0,
869
871
  match.id,
870
872
  match.clientLoader,
871
873
  match.hasLoader,
@@ -875,7 +877,7 @@ function createRouteFromServerManifest(match, payload) {
875
877
  return dataRoute;
876
878
  }
877
879
  function callSingleFetch(singleFetch) {
878
- _chunkYNGRUB6Fjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
880
+ _chunkAC65NKOPjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
879
881
  return singleFetch();
880
882
  }
881
883
  function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
@@ -883,7 +885,7 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
883
885
  let fn = type === "action" ? "serverAction()" : "serverLoader()";
884
886
  let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
885
887
  console.error(msg);
886
- throw new (0, _chunkYNGRUB6Fjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
888
+ throw new (0, _chunkAC65NKOPjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
887
889
  }
888
890
  }
889
891
  var nextPaths = /* @__PURE__ */ new Set();
@@ -906,12 +908,12 @@ function getManifestUrl(paths) {
906
908
  return url;
907
909
  }
908
910
  async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fetchImplementation, signal) {
909
- paths = _chunkYNGRUB6Fjs.getPathsWithAncestors.call(void 0, paths);
911
+ paths = _chunkAC65NKOPjs.getPathsWithAncestors.call(void 0, paths);
910
912
  let url = getManifestUrl(paths);
911
913
  if (url == null) {
912
914
  return;
913
915
  }
914
- if (url.toString().length > _chunkYNGRUB6Fjs.URL_LIMIT) {
916
+ if (url.toString().length > _chunkAC65NKOPjs.URL_LIMIT) {
915
917
  nextPaths.clear();
916
918
  return;
917
919
  }
@@ -955,8 +957,8 @@ function isExternalLocation(location2) {
955
957
  return newLocation.origin !== window.location.origin;
956
958
  }
957
959
  function normalizeRedirectLocation(location2) {
958
- if (_chunkYNGRUB6Fjs.PROTOCOL_RELATIVE_URL_REGEX.test(location2)) {
959
- let path = _chunkYNGRUB6Fjs.resolvePath.call(void 0, location2);
960
+ if (_chunkAC65NKOPjs.PROTOCOL_RELATIVE_URL_REGEX.test(location2)) {
961
+ let path = _chunkAC65NKOPjs.resolvePath.call(void 0, location2);
960
962
  return path.pathname + path.search + path.hash;
961
963
  }
962
964
  return location2;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.18.4
2
+ * react-router v7.18.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -13,7 +13,7 @@ import {
13
13
  RSCRouterGlobalErrorBoundary,
14
14
  getHydrationData,
15
15
  populateRSCRouteModules
16
- } from "./chunk-G2MPF4YY.mjs";
16
+ } from "./chunk-JRCXCPLA.mjs";
17
17
  import {
18
18
  CRITICAL_CSS_DATA_ATTRIBUTE,
19
19
  ErrorResponseImpl,
@@ -47,7 +47,7 @@ import {
47
47
  stripIndexParam,
48
48
  useFogOFWarDiscovery,
49
49
  validateNavigationTarget
50
- } from "./chunk-Q34X6AWR.mjs";
50
+ } from "./chunk-HEAXLYUI.mjs";
51
51
 
52
52
  // lib/dom-export/dom-router-provider.tsx
53
53
  import * as React from "react";
@@ -201,7 +201,9 @@ function HydratedRouter(props) {
201
201
  );
202
202
  React2.useEffect(() => {
203
203
  if (process.env.NODE_ENV === "development") {
204
- setCriticalCss(void 0);
204
+ React2.startTransition(() => {
205
+ setCriticalCss(void 0);
206
+ });
205
207
  }
206
208
  }, []);
207
209
  React2.useEffect(() => {
@@ -1,4 +1,4 @@
1
- import { l as ServerInstrumentation, H as HydrationState, e as StaticHandlerContext, c as RelativeRoutingType, a as Router$1, g as RouterState, R as RouterInit, t as FutureConfig$1, C as ClientInstrumentation, d as GetScrollRestorationKeyFunction, F as Fetcher, B as BlockerFunction, u as CreateStaticHandlerOptions$1, S as StaticHandler } from './instrumentation-B7w3_Eo9.js';
1
+ import { l as ServerInstrumentation, H as HydrationState, e as StaticHandlerContext, c as RelativeRoutingType, a as Router$1, g as RouterState, R as RouterInit, t as FutureConfig$1, C as ClientInstrumentation, d as GetScrollRestorationKeyFunction, F as Fetcher, B as BlockerFunction, u as CreateStaticHandlerOptions$1, S as StaticHandler } from './instrumentation-CPkMwccd.js';
2
2
  import * as React from 'react';
3
3
  import { p as RouteManifest, aE as ServerRouteModule, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, s as LoaderFunctionArgs, a0 as ActionFunctionArgs, O as RouteModules, n as DataRouteObject, a as ClientLoaderFunction, o as RouteBranch, aF as TrackedPromise, f as History, T as To, L as Location, i as Action, ac as RouteMatch, Y as InitialEntry, _ as NonIndexRouteObject, a7 as LazyRouteFunction, Z as IndexRouteObject, P as Params, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, e as RouteObject, U as UIMatch, q as HTMLFormMethod, F as FormEncType, av as PageLinkDescriptor, Q as SerializeFrom } from './data-CjO11-hU.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { o as ServerInstrumentation, H as HydrationState, h as StaticHandlerContext, f as RelativeRoutingType, g as GetScrollRestorationKeyFunction, R as RouterInit, ah as FutureConfig$1, C as ClientInstrumentation, N as NavigateOptions, F as Fetcher, c as Router, B as BlockerFunction, ai as CreateStaticHandlerOptions$1, S as StaticHandler } from './context-nqAapj74.mjs';
1
+ import { o as ServerInstrumentation, H as HydrationState, h as StaticHandlerContext, f as RelativeRoutingType, g as GetScrollRestorationKeyFunction, R as RouterInit, ah as FutureConfig$1, C as ClientInstrumentation, N as NavigateOptions, F as Fetcher, c as Router, B as BlockerFunction, ai as CreateStaticHandlerOptions$1, S as StaticHandler } from './context-BlYKn1tE.mjs';
2
2
  import * as React from 'react';
3
3
  import { J as RouteManifest, aF as ServerRouteModule, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, o as LoaderFunctionArgs, a3 as ActionFunctionArgs, Z as RouteModules, E as DataRouteObject, a as ClientLoaderFunction, I as RouteBranch, m as HTMLFormMethod, n as FormEncType, aw as PageLinkDescriptor, T as To, s as History, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, r as RouteObject, _ as SerializeFrom, L as Location } from './data-DEjBmEfD.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-nqAapj74.mjs';
2
- export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-K63fpMH4.mjs';
1
+ export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-BlYKn1tE.mjs';
2
+ export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-KK-TR-t7.mjs';
3
3
  import './data-DEjBmEfD.mjs';
4
4
  import 'react';
@@ -1,4 +1,4 @@
1
- export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-BjY-eKuf.js';
2
- import './instrumentation-B7w3_Eo9.js';
1
+ export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-BaaZU3sM.js';
2
+ import './instrumentation-CPkMwccd.js';
3
3
  import './data-CjO11-hU.js';
4
4
  import 'react';
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
2
- * react-router v7.18.4
2
+ * react-router v7.18.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -19,7 +19,7 @@
19
19
 
20
20
 
21
21
 
22
- var _chunkAOOKMWNDjs = require('./chunk-AOOKMWND.js');
22
+ var _chunk2WUBOUFUjs = require('./chunk-2WUBOUFU.js');
23
23
 
24
24
 
25
25
 
@@ -34,7 +34,7 @@ var _chunkAOOKMWNDjs = require('./chunk-AOOKMWND.js');
34
34
 
35
35
 
36
36
 
37
- var _chunkYNGRUB6Fjs = require('./chunk-YNGRUB6F.js');
37
+ var _chunkAC65NKOPjs = require('./chunk-AC65NKOP.js');
38
38
 
39
39
 
40
40
 
@@ -58,4 +58,4 @@ var _chunkYNGRUB6Fjs = require('./chunk-YNGRUB6F.js');
58
58
 
59
59
 
60
60
 
61
- exports.BrowserRouter = _chunkAOOKMWNDjs.BrowserRouter; exports.Form = _chunkAOOKMWNDjs.Form; exports.HashRouter = _chunkAOOKMWNDjs.HashRouter; exports.Link = _chunkAOOKMWNDjs.Link; exports.Links = _chunkYNGRUB6Fjs.Links; exports.MemoryRouter = _chunkYNGRUB6Fjs.MemoryRouter; exports.Meta = _chunkYNGRUB6Fjs.Meta; exports.NavLink = _chunkAOOKMWNDjs.NavLink; exports.Navigate = _chunkYNGRUB6Fjs.Navigate; exports.Outlet = _chunkYNGRUB6Fjs.Outlet; exports.Route = _chunkYNGRUB6Fjs.Route; exports.Router = _chunkYNGRUB6Fjs.Router; exports.RouterProvider = _chunkYNGRUB6Fjs.RouterProvider; exports.Routes = _chunkYNGRUB6Fjs.Routes; exports.ScrollRestoration = _chunkAOOKMWNDjs.ScrollRestoration; exports.StaticRouter = _chunkAOOKMWNDjs.StaticRouter; exports.StaticRouterProvider = _chunkAOOKMWNDjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkYNGRUB6Fjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkYNGRUB6Fjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkYNGRUB6Fjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkYNGRUB6Fjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkAOOKMWNDjs.HistoryRouter;
61
+ exports.BrowserRouter = _chunk2WUBOUFUjs.BrowserRouter; exports.Form = _chunk2WUBOUFUjs.Form; exports.HashRouter = _chunk2WUBOUFUjs.HashRouter; exports.Link = _chunk2WUBOUFUjs.Link; exports.Links = _chunkAC65NKOPjs.Links; exports.MemoryRouter = _chunkAC65NKOPjs.MemoryRouter; exports.Meta = _chunkAC65NKOPjs.Meta; exports.NavLink = _chunk2WUBOUFUjs.NavLink; exports.Navigate = _chunkAC65NKOPjs.Navigate; exports.Outlet = _chunkAC65NKOPjs.Outlet; exports.Route = _chunkAC65NKOPjs.Route; exports.Router = _chunkAC65NKOPjs.Router; exports.RouterProvider = _chunkAC65NKOPjs.RouterProvider; exports.Routes = _chunkAC65NKOPjs.Routes; exports.ScrollRestoration = _chunk2WUBOUFUjs.ScrollRestoration; exports.StaticRouter = _chunk2WUBOUFUjs.StaticRouter; exports.StaticRouterProvider = _chunk2WUBOUFUjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkAC65NKOPjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkAC65NKOPjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkAC65NKOPjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkAC65NKOPjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunk2WUBOUFUjs.HistoryRouter;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.18.4
2
+ * react-router v7.18.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -32,7 +32,7 @@ import {
32
32
  WithComponentProps,
33
33
  WithErrorBoundaryProps,
34
34
  WithHydrateFallbackProps
35
- } from "./chunk-Q34X6AWR.mjs";
35
+ } from "./chunk-HEAXLYUI.mjs";
36
36
  export {
37
37
  BrowserRouter,
38
38
  Form,
@@ -1461,6 +1461,8 @@ interface StaticHandler {
1461
1461
  * The set of data routes managed by this handler
1462
1462
  */
1463
1463
  dataRoutes: DataRouteObject[];
1464
+ /** @private Estimated route metadata visits per regex match. */
1465
+ readonly _matchCost?: number;
1464
1466
  /**
1465
1467
  * @private
1466
1468
  * PRIVATE - DO NOT USE
@@ -1461,6 +1461,8 @@ interface StaticHandler {
1461
1461
  * The set of data routes managed by this handler
1462
1462
  */
1463
1463
  dataRoutes: DataRouteObject[];
1464
+ /** @private Estimated route metadata visits per regex match. */
1465
+ readonly _matchCost?: number;
1464
1466
  /**
1465
1467
  * @private
1466
1468
  * PRIVATE - DO NOT USE
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
27
27
  var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
28
28
 
29
29
  /**
30
- * react-router v7.18.4
30
+ * react-router v7.18.6
31
31
  *
32
32
  * Copyright (c) Remix Software Inc.
33
33
  *
@@ -293,6 +293,53 @@ function isPlainObject(thing) {
293
293
  return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames;
294
294
  }
295
295
 
296
+ // lib/router/navigation.ts
297
+ var DEFAULT_NAVIGATION_URL = new URL("http://localhost");
298
+ function isSameOrigin(a, b) {
299
+ return a.origin === b.origin && (a.origin !== "null" || a.protocol === b.protocol && a.host === b.host);
300
+ }
301
+ function isExplicitUrl(destination, target) {
302
+ if (destination.startsWith("//")) {
303
+ return true;
304
+ }
305
+ let protocol = target.protocol.toLowerCase();
306
+ if (!destination.toLowerCase().startsWith(protocol)) {
307
+ return false;
308
+ }
309
+ return target.host === "" || destination.slice(protocol.length).startsWith("//");
310
+ }
311
+ function validateDocumentNavigationTarget(destination) {
312
+ let normalized = destination.replace(/[\t\n\r]/g, "");
313
+ let start = 0;
314
+ while (normalized.charCodeAt(start) <= 32) start++;
315
+ normalized = normalized.slice(start);
316
+ if (!ABSOLUTE_URL_REGEX.test(normalized)) return;
317
+ let target;
318
+ try {
319
+ target = new URL(destination, DEFAULT_NAVIGATION_URL);
320
+ } catch {
321
+ return;
322
+ }
323
+ if (!isExplicitUrl(destination, target)) {
324
+ throw new Error("External navigation is not allowed");
325
+ }
326
+ }
327
+ function validateNavigationTarget(original, resolved, currentUrl, externalPolicy) {
328
+ let originalUrl = null;
329
+ try {
330
+ originalUrl = original == null ? null : new URL(original, currentUrl);
331
+ } catch {
332
+ }
333
+ let resolvedUrl = new URL(resolved, currentUrl);
334
+ originalUrl != null && !isSameOrigin(originalUrl, currentUrl);
335
+ let resolvedIsExternal = !isSameOrigin(resolvedUrl, currentUrl);
336
+ if (resolvedIsExternal) {
337
+ if (originalUrl == null || !isExplicitUrl(original, originalUrl) || !isSameOrigin(originalUrl, resolvedUrl)) {
338
+ throw new Error("External navigation is not allowed");
339
+ }
340
+ }
341
+ }
342
+
296
343
  // lib/router/utils.ts
297
344
  function createContext(defaultValue) {
298
345
  return { defaultValue };
@@ -874,6 +921,7 @@ function data(data2, init) {
874
921
  );
875
922
  }
876
923
  var redirect = (url, init = 302) => {
924
+ validateDocumentNavigationTarget(url);
877
925
  let responseInit = init;
878
926
  if (typeof responseInit === "number") {
879
927
  responseInit = { status: responseInit };
@@ -966,6 +1014,10 @@ function createStaticHandler(routes, opts) {
966
1014
  manifest
967
1015
  );
968
1016
  let routeBranches = flattenAndRankRoutes(dataRoutes);
1017
+ let matchCost = routeBranches.reduce(
1018
+ (total, branch) => total + branch.routesMeta.length,
1019
+ 0
1020
+ );
969
1021
  async function query(request, {
970
1022
  requestContext,
971
1023
  filterMatchesToLoad,
@@ -1585,6 +1637,7 @@ function createStaticHandler(routes, opts) {
1585
1637
  }
1586
1638
  return {
1587
1639
  dataRoutes,
1640
+ _matchCost: matchCost,
1588
1641
  _internalRouteBranches: routeBranches,
1589
1642
  query,
1590
1643
  queryRoute
@@ -2222,6 +2275,10 @@ function normalizeRelativeRoutingRedirectResponse(response, request, routeId, ma
2222
2275
  location,
2223
2276
  "Redirects returned/thrown from loaders/actions must have a Location header"
2224
2277
  );
2278
+ validateNavigationTarget(
2279
+ location,
2280
+ location,
2281
+ new URL(request.url));
2225
2282
  if (!isAbsoluteUrl(location)) {
2226
2283
  let trimmedMatches = matches.slice(
2227
2284
  0,
@@ -2565,6 +2622,13 @@ function getPathsWithAncestors(paths) {
2565
2622
  });
2566
2623
  return Array.from(result);
2567
2624
  }
2625
+ var MANIFEST_MATCH_COST_LIMIT = 5e4;
2626
+ var MANIFEST_MATCH_COST_SEGMENT_THRESHOLD = 10;
2627
+ function shouldUseInitialRouteDiscovery(pathname, matchCost = 0) {
2628
+ let segmentCount = pathname.split("/").length - 1;
2629
+ let ancestorCount = Math.max(segmentCount - 1, 0);
2630
+ return ancestorCount * pathname.length + 1 > URL_LIMIT || segmentCount > MANIFEST_MATCH_COST_SEGMENT_THRESHOLD && segmentCount * matchCost > MANIFEST_MATCH_COST_LIMIT;
2631
+ }
2568
2632
 
2569
2633
  // lib/actions.ts
2570
2634
  function throwIfPotentialCSRFAttack(request, allowedActionOrigins) {
@@ -2789,7 +2853,7 @@ async function matchRSCServerRequest({
2789
2853
  }
2790
2854
  const leafMatch = matches?.[matches.length - 1];
2791
2855
  if (!isDataRequest && leafMatch && !leafMatch.route.Component && !leafMatch.route.ErrorBoundary) {
2792
- return generateResourceResponse(
2856
+ let response2 = await generateResourceResponse(
2793
2857
  routerRequest,
2794
2858
  routes,
2795
2859
  basename,
@@ -2797,6 +2861,7 @@ async function matchRSCServerRequest({
2797
2861
  requestContext,
2798
2862
  onError
2799
2863
  );
2864
+ return normalizeResourceResponse(request, response2);
2800
2865
  }
2801
2866
  let response = await generateRenderResponse(
2802
2867
  routerRequest,
@@ -2817,6 +2882,20 @@ async function matchRSCServerRequest({
2817
2882
  response.headers.set("X-Remix-Response", "yes");
2818
2883
  return response;
2819
2884
  }
2885
+ function normalizeResourceResponse(request, response) {
2886
+ if (request.method === "HEAD") {
2887
+ response.body?.cancel().catch(() => {
2888
+ });
2889
+ let headers = new Headers(response.headers);
2890
+ headers.set("React-Router-Resource", "true");
2891
+ return new Response(null, {
2892
+ status: response.status,
2893
+ statusText: response.statusText,
2894
+ headers
2895
+ });
2896
+ }
2897
+ return response;
2898
+ }
2820
2899
  async function generateManifestResponse(routes, basename, request, generateResponse, temporaryReferences, routeDiscovery) {
2821
2900
  let url = new URL(request.url);
2822
2901
  if (url.toString().length > URL_LIMIT) {
@@ -3130,7 +3209,8 @@ async function generateRenderResponse(request, routes, basename, isDataRequest,
3130
3209
  temporaryReferences,
3131
3210
  skipRevalidation,
3132
3211
  ctx.redirect?.headers,
3133
- routeDiscovery
3212
+ routeDiscovery,
3213
+ staticHandler._matchCost
3134
3214
  );
3135
3215
  }
3136
3216
  })
@@ -3180,7 +3260,7 @@ function generateRedirectResponse(response, actionResult, basename, isDataReques
3180
3260
  { temporaryReferences, onError: defaultOnError }
3181
3261
  );
3182
3262
  }
3183
- async function generateStaticContextResponse(routes, basename, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, formState, staticContext, temporaryReferences, skipRevalidation, sideEffectRedirectHeaders, routeDiscovery) {
3263
+ async function generateStaticContextResponse(routes, basename, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, formState, staticContext, temporaryReferences, skipRevalidation, sideEffectRedirectHeaders, routeDiscovery, matchCost) {
3184
3264
  statusCode = staticContext.statusCode ?? statusCode;
3185
3265
  if (staticContext.errors) {
3186
3266
  staticContext.errors = Object.fromEntries(
@@ -3222,7 +3302,8 @@ async function generateStaticContextResponse(routes, basename, generateResponse,
3222
3302
  routeIdsToLoad,
3223
3303
  isDataRequest,
3224
3304
  staticContext,
3225
- routeDiscovery
3305
+ routeDiscovery,
3306
+ matchCost
3226
3307
  );
3227
3308
  let payload;
3228
3309
  if (actionResult) {
@@ -3249,7 +3330,7 @@ async function generateStaticContextResponse(routes, basename, generateResponse,
3249
3330
  { temporaryReferences, onError: defaultOnError }
3250
3331
  );
3251
3332
  }
3252
- async function getRenderPayload(baseRenderPayload, routes, basename, routeIdsToLoad, isDataRequest, staticContext, routeDiscovery) {
3333
+ async function getRenderPayload(baseRenderPayload, routes, basename, routeIdsToLoad, isDataRequest, staticContext, routeDiscovery, matchCost) {
3253
3334
  let deepestRenderedRouteIdx = staticContext.matches.length - 1;
3254
3335
  let parentIds = {};
3255
3336
  staticContext.matches.forEach((m, i) => {
@@ -3273,18 +3354,27 @@ async function getRenderPayload(baseRenderPayload, routes, basename, routeIdsToL
3273
3354
  });
3274
3355
  })
3275
3356
  );
3276
- let patches = routeDiscovery?.mode === "initial" && !isDataRequest ? getAllRoutePatches(routes).then(
3277
- (patches2) => patches2.filter(
3278
- (patch) => !staticContext.matches.some((m) => m.route.id === patch.id)
3279
- )
3280
- ) : getAdditionalRoutePatches(
3281
- getPathsWithAncestors([staticContext.location.pathname]),
3282
- routes,
3283
- basename,
3284
- staticContext.matches.map((m) => m.route.id)
3285
- );
3357
+ let pathname = staticContext.location.pathname;
3358
+ let useInitialRouteDiscovery = routeDiscovery?.mode === "initial" && !isDataRequest || shouldUseInitialRouteDiscovery(pathname, matchCost);
3359
+ let patches;
3360
+ if (useInitialRouteDiscovery) {
3361
+ patches = getAllRoutePatches(routes).then(
3362
+ (patches2) => patches2.filter(
3363
+ (patch) => !staticContext.matches.some((m) => m.route.id === patch.id)
3364
+ )
3365
+ );
3366
+ } else {
3367
+ patches = getAdditionalRoutePatches(
3368
+ // The full pathname is last and its matches are already in the payload.
3369
+ getPathsWithAncestors([pathname]).slice(0, -1),
3370
+ routes,
3371
+ basename,
3372
+ staticContext.matches.map((m) => m.route.id)
3373
+ );
3374
+ }
3286
3375
  return {
3287
3376
  ...baseRenderPayload,
3377
+ routeDiscovery: useInitialRouteDiscovery ? { mode: "initial" } : baseRenderPayload.routeDiscovery,
3288
3378
  matches: await matchesPromise,
3289
3379
  patches
3290
3380
  };
@@ -3512,7 +3602,9 @@ function href(path, ...args) {
3512
3602
  result += "/" + value;
3513
3603
  }
3514
3604
  }
3515
- return result || "/";
3605
+ result = result.replace(/^[\\/]{2,}/, "/") || "/";
3606
+ validateDocumentNavigationTarget(result);
3607
+ return result;
3516
3608
  }
3517
3609
  function trimTrailingSplat(path) {
3518
3610
  let i = path.length - 1;