react-router 7.16.0 → 8.0.0-pre.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 (369) hide show
  1. package/CHANGELOG.md +0 -1
  2. package/dist/development/dom-export.d.ts +6 -172
  3. package/dist/development/dom-export.js +12 -1007
  4. package/dist/development/index-react-server-client.d.ts +7 -4
  5. package/dist/development/index-react-server-client.js +8 -52
  6. package/dist/development/index-react-server.d.ts +1645 -1635
  7. package/dist/development/index-react-server.js +2880 -3642
  8. package/dist/development/index.d.ts +43 -1475
  9. package/dist/development/index.js +37 -2621
  10. package/dist/development/lib/actions.js +62 -0
  11. package/dist/development/lib/components.d.ts +1022 -0
  12. package/dist/development/lib/components.js +835 -0
  13. package/dist/development/lib/context.d.ts +83 -0
  14. package/dist/development/lib/context.js +41 -0
  15. package/dist/development/lib/dom/dom.d.ts +119 -0
  16. package/dist/development/lib/dom/dom.js +143 -0
  17. package/dist/development/lib/dom/lib.d.ts +2042 -0
  18. package/dist/development/lib/dom/lib.js +1259 -0
  19. package/dist/development/lib/dom/server.d.ts +138 -0
  20. package/dist/development/lib/dom/server.js +301 -0
  21. package/dist/development/lib/dom/ssr/components.d.ts +196 -0
  22. package/dist/development/lib/dom/ssr/components.js +579 -0
  23. package/dist/development/lib/dom/ssr/data.js +29 -0
  24. package/dist/development/lib/dom/ssr/entry.d.ts +59 -0
  25. package/dist/development/lib/dom/ssr/errorBoundaries.d.ts +27 -0
  26. package/dist/development/lib/dom/ssr/errorBoundaries.js +83 -0
  27. package/dist/development/lib/dom/ssr/errors.d.ts +7 -0
  28. package/dist/development/lib/dom/ssr/errors.js +36 -0
  29. package/dist/development/lib/dom/ssr/fallback.js +28 -0
  30. package/dist/development/lib/dom/ssr/fog-of-war.d.ts +12 -0
  31. package/dist/development/lib/dom/ssr/fog-of-war.js +170 -0
  32. package/dist/development/lib/dom/ssr/hydration.d.ts +32 -0
  33. package/dist/development/lib/dom/ssr/hydration.js +29 -0
  34. package/dist/development/lib/dom/ssr/invariant.js +16 -0
  35. package/dist/development/lib/dom/ssr/links.js +170 -0
  36. package/dist/development/lib/dom/ssr/markup.js +24 -0
  37. package/dist/development/lib/dom/ssr/routeModules.d.ts +206 -0
  38. package/dist/development/lib/dom/ssr/routeModules.js +31 -0
  39. package/dist/development/lib/dom/ssr/routes-test-stub.d.ts +62 -0
  40. package/dist/development/lib/dom/ssr/routes-test-stub.js +108 -0
  41. package/dist/development/lib/dom/ssr/routes.d.ts +33 -0
  42. package/dist/development/lib/dom/ssr/routes.js +303 -0
  43. package/dist/development/lib/dom/ssr/server.d.ts +45 -0
  44. package/dist/development/lib/dom/ssr/server.js +68 -0
  45. package/dist/development/lib/dom/ssr/single-fetch.d.ts +14 -0
  46. package/dist/development/lib/dom/ssr/single-fetch.js +346 -0
  47. package/dist/development/lib/dom-export/dom-router-provider.d.ts +9 -0
  48. package/dist/development/lib/dom-export/dom-router-provider.js +22 -0
  49. package/dist/development/lib/dom-export/hydrated-router.d.ts +125 -0
  50. package/dist/development/lib/dom-export/hydrated-router.js +153 -0
  51. package/dist/development/lib/errors.js +29 -0
  52. package/dist/development/lib/hooks.d.ts +947 -0
  53. package/dist/development/lib/hooks.js +1386 -0
  54. package/dist/development/lib/href.d.ts +20 -0
  55. package/dist/development/lib/href.js +50 -0
  56. package/dist/development/lib/router/history.d.ts +258 -0
  57. package/dist/development/lib/router/history.js +371 -0
  58. package/dist/development/lib/router/instrumentation.d.ts +86 -0
  59. package/dist/development/lib/router/instrumentation.js +213 -0
  60. package/dist/development/lib/router/links.d.ts +113 -0
  61. package/dist/development/lib/router/router.d.ts +663 -0
  62. package/dist/development/lib/router/router.js +2981 -0
  63. package/dist/development/lib/router/utils.d.ts +942 -0
  64. package/dist/development/lib/router/utils.js +791 -0
  65. package/dist/development/lib/rsc/browser.d.ts +137 -0
  66. package/dist/development/lib/rsc/browser.js +599 -0
  67. package/dist/development/lib/rsc/errorBoundaries.d.ts +11 -0
  68. package/dist/development/lib/rsc/errorBoundaries.js +90 -0
  69. package/dist/development/lib/rsc/html-stream/browser.d.ts +48 -0
  70. package/dist/development/lib/rsc/html-stream/browser.js +74 -0
  71. package/dist/development/lib/rsc/html-stream/server.js +78 -0
  72. package/dist/development/lib/rsc/route-modules.js +27 -0
  73. package/dist/development/lib/rsc/server.rsc.d.ts +219 -0
  74. package/dist/development/lib/rsc/server.ssr.d.ts +129 -0
  75. package/dist/development/lib/rsc/server.ssr.js +388 -0
  76. package/dist/development/lib/server-runtime/build.d.ts +66 -0
  77. package/dist/development/lib/server-runtime/cookies.d.ts +66 -0
  78. package/dist/development/lib/server-runtime/cookies.js +139 -0
  79. package/dist/development/lib/server-runtime/crypto.js +43 -0
  80. package/dist/development/lib/server-runtime/data.d.ts +13 -0
  81. package/dist/development/lib/server-runtime/data.js +25 -0
  82. package/dist/development/lib/server-runtime/dev.d.ts +9 -0
  83. package/dist/development/lib/server-runtime/dev.js +26 -0
  84. package/dist/development/lib/server-runtime/entry.js +20 -0
  85. package/dist/development/lib/server-runtime/errors.js +95 -0
  86. package/dist/development/lib/server-runtime/headers.js +73 -0
  87. package/dist/development/lib/server-runtime/invariant.js +19 -0
  88. package/dist/development/lib/server-runtime/mode.d.ts +12 -0
  89. package/dist/development/lib/server-runtime/mode.js +25 -0
  90. package/dist/development/lib/server-runtime/routeMatching.js +28 -0
  91. package/dist/development/lib/server-runtime/routes.d.ts +13 -0
  92. package/dist/development/lib/server-runtime/routes.js +74 -0
  93. package/dist/development/lib/server-runtime/server.d.ts +10 -0
  94. package/dist/development/lib/server-runtime/server.js +351 -0
  95. package/dist/development/lib/server-runtime/serverHandoff.js +17 -0
  96. package/dist/development/lib/server-runtime/sessions/cookieStorage.d.ts +25 -0
  97. package/dist/development/lib/server-runtime/sessions/cookieStorage.js +45 -0
  98. package/dist/development/lib/server-runtime/sessions/memoryStorage.d.ts +23 -0
  99. package/dist/development/lib/server-runtime/sessions/memoryStorage.js +52 -0
  100. package/dist/development/lib/server-runtime/sessions.d.ts +145 -0
  101. package/dist/development/lib/server-runtime/sessions.js +98 -0
  102. package/dist/development/lib/server-runtime/single-fetch.d.ts +7 -0
  103. package/dist/development/lib/server-runtime/single-fetch.js +215 -0
  104. package/dist/development/lib/server-runtime/urls.js +31 -0
  105. package/dist/development/lib/server-runtime/warnings.js +20 -0
  106. package/dist/development/lib/types/future.d.ts +9 -0
  107. package/dist/development/lib/types/internal.d.ts +26 -177
  108. package/dist/development/lib/types/internal.js +3 -2
  109. package/dist/{production/register-CNAx3TXj.d.ts → development/lib/types/register.d.ts} +9 -15
  110. package/dist/development/lib/types/route-data.d.ts +113 -0
  111. package/dist/development/lib/types/route-module-annotations.d.ts +149 -0
  112. package/dist/development/lib/types/route-module.d.ts +19 -0
  113. package/dist/development/lib/types/serializes-to.d.ts +13 -0
  114. package/dist/development/lib/types/utils.d.ts +11 -0
  115. package/dist/development/vendor/turbo-stream-v2/flatten.js +159 -0
  116. package/dist/development/vendor/turbo-stream-v2/turbo-stream.js +178 -0
  117. package/dist/development/vendor/turbo-stream-v2/unflatten.js +198 -0
  118. package/dist/development/vendor/turbo-stream-v2/utils.js +47 -0
  119. package/dist/production/dom-export.d.ts +6 -172
  120. package/dist/production/dom-export.js +12 -1007
  121. package/dist/production/index-react-server-client.d.ts +7 -4
  122. package/dist/production/index-react-server-client.js +8 -52
  123. package/dist/production/index-react-server.d.ts +1645 -1635
  124. package/dist/production/index-react-server.js +2871 -3642
  125. package/dist/production/index.d.ts +43 -1475
  126. package/dist/production/index.js +37 -2621
  127. package/dist/production/lib/actions.js +62 -0
  128. package/dist/production/lib/components.d.ts +1022 -0
  129. package/dist/production/lib/components.js +835 -0
  130. package/dist/production/lib/context.d.ts +83 -0
  131. package/dist/production/lib/context.js +41 -0
  132. package/dist/production/lib/dom/dom.d.ts +119 -0
  133. package/dist/production/lib/dom/dom.js +143 -0
  134. package/dist/production/lib/dom/lib.d.ts +2042 -0
  135. package/dist/production/lib/dom/lib.js +1259 -0
  136. package/dist/production/lib/dom/server.d.ts +138 -0
  137. package/dist/production/lib/dom/server.js +301 -0
  138. package/dist/production/lib/dom/ssr/components.d.ts +196 -0
  139. package/dist/production/lib/dom/ssr/components.js +579 -0
  140. package/dist/production/lib/dom/ssr/data.js +29 -0
  141. package/dist/production/lib/dom/ssr/entry.d.ts +59 -0
  142. package/dist/production/lib/dom/ssr/errorBoundaries.d.ts +27 -0
  143. package/dist/production/lib/dom/ssr/errorBoundaries.js +83 -0
  144. package/dist/production/lib/dom/ssr/errors.d.ts +7 -0
  145. package/dist/production/lib/dom/ssr/errors.js +36 -0
  146. package/dist/production/lib/dom/ssr/fallback.js +21 -0
  147. package/dist/production/lib/dom/ssr/fog-of-war.d.ts +12 -0
  148. package/dist/production/lib/dom/ssr/fog-of-war.js +170 -0
  149. package/dist/production/lib/dom/ssr/hydration.d.ts +32 -0
  150. package/dist/production/lib/dom/ssr/hydration.js +29 -0
  151. package/dist/production/lib/dom/ssr/invariant.js +16 -0
  152. package/dist/production/lib/dom/ssr/links.js +170 -0
  153. package/dist/production/lib/dom/ssr/markup.js +24 -0
  154. package/dist/production/lib/dom/ssr/routeModules.d.ts +206 -0
  155. package/dist/production/lib/dom/ssr/routeModules.js +31 -0
  156. package/dist/production/lib/dom/ssr/routes-test-stub.d.ts +62 -0
  157. package/dist/production/lib/dom/ssr/routes-test-stub.js +108 -0
  158. package/dist/production/lib/dom/ssr/routes.d.ts +33 -0
  159. package/dist/production/lib/dom/ssr/routes.js +303 -0
  160. package/dist/production/lib/dom/ssr/server.d.ts +45 -0
  161. package/dist/production/lib/dom/ssr/server.js +68 -0
  162. package/dist/production/lib/dom/ssr/single-fetch.d.ts +14 -0
  163. package/dist/production/lib/dom/ssr/single-fetch.js +346 -0
  164. package/dist/production/lib/dom-export/dom-router-provider.d.ts +9 -0
  165. package/dist/production/lib/dom-export/dom-router-provider.js +22 -0
  166. package/dist/production/lib/dom-export/hydrated-router.d.ts +125 -0
  167. package/dist/production/lib/dom-export/hydrated-router.js +153 -0
  168. package/dist/production/lib/errors.js +29 -0
  169. package/dist/production/lib/hooks.d.ts +947 -0
  170. package/dist/production/lib/hooks.js +1371 -0
  171. package/dist/production/lib/href.d.ts +20 -0
  172. package/dist/production/lib/href.js +50 -0
  173. package/dist/production/lib/router/history.d.ts +258 -0
  174. package/dist/production/lib/router/history.js +371 -0
  175. package/dist/production/lib/router/instrumentation.d.ts +86 -0
  176. package/dist/production/lib/router/instrumentation.js +213 -0
  177. package/dist/production/lib/router/links.d.ts +113 -0
  178. package/dist/production/lib/router/router.d.ts +663 -0
  179. package/dist/production/lib/router/router.js +2981 -0
  180. package/dist/production/lib/router/utils.d.ts +942 -0
  181. package/dist/production/lib/router/utils.js +782 -0
  182. package/dist/production/lib/rsc/browser.d.ts +137 -0
  183. package/dist/production/lib/rsc/browser.js +599 -0
  184. package/dist/production/lib/rsc/errorBoundaries.d.ts +11 -0
  185. package/dist/production/lib/rsc/errorBoundaries.js +90 -0
  186. package/dist/production/lib/rsc/html-stream/browser.d.ts +48 -0
  187. package/dist/production/lib/rsc/html-stream/browser.js +74 -0
  188. package/dist/production/lib/rsc/html-stream/server.js +78 -0
  189. package/dist/production/lib/rsc/route-modules.js +27 -0
  190. package/dist/production/lib/rsc/server.rsc.d.ts +219 -0
  191. package/dist/production/lib/rsc/server.ssr.d.ts +129 -0
  192. package/dist/production/lib/rsc/server.ssr.js +388 -0
  193. package/dist/production/lib/server-runtime/build.d.ts +66 -0
  194. package/dist/production/lib/server-runtime/cookies.d.ts +66 -0
  195. package/dist/production/lib/server-runtime/cookies.js +139 -0
  196. package/dist/production/lib/server-runtime/crypto.js +43 -0
  197. package/dist/production/lib/server-runtime/data.d.ts +13 -0
  198. package/dist/production/lib/server-runtime/data.js +25 -0
  199. package/dist/production/lib/server-runtime/dev.d.ts +9 -0
  200. package/dist/production/lib/server-runtime/dev.js +26 -0
  201. package/dist/production/lib/server-runtime/entry.js +20 -0
  202. package/dist/production/lib/server-runtime/errors.js +95 -0
  203. package/dist/production/lib/server-runtime/headers.js +73 -0
  204. package/dist/production/lib/server-runtime/invariant.js +19 -0
  205. package/dist/production/lib/server-runtime/mode.d.ts +12 -0
  206. package/dist/production/lib/server-runtime/mode.js +25 -0
  207. package/dist/production/lib/server-runtime/routeMatching.js +28 -0
  208. package/dist/production/lib/server-runtime/routes.d.ts +13 -0
  209. package/dist/production/lib/server-runtime/routes.js +74 -0
  210. package/dist/production/lib/server-runtime/server.d.ts +10 -0
  211. package/dist/production/lib/server-runtime/server.js +351 -0
  212. package/dist/production/lib/server-runtime/serverHandoff.js +17 -0
  213. package/dist/production/lib/server-runtime/sessions/cookieStorage.d.ts +25 -0
  214. package/dist/production/lib/server-runtime/sessions/cookieStorage.js +45 -0
  215. package/dist/production/lib/server-runtime/sessions/memoryStorage.d.ts +23 -0
  216. package/dist/production/lib/server-runtime/sessions/memoryStorage.js +52 -0
  217. package/dist/production/lib/server-runtime/sessions.d.ts +145 -0
  218. package/dist/production/lib/server-runtime/sessions.js +98 -0
  219. package/dist/production/lib/server-runtime/single-fetch.d.ts +7 -0
  220. package/dist/production/lib/server-runtime/single-fetch.js +215 -0
  221. package/dist/production/lib/server-runtime/urls.js +31 -0
  222. package/dist/production/lib/server-runtime/warnings.js +20 -0
  223. package/dist/production/lib/types/future.d.ts +9 -0
  224. package/dist/production/lib/types/internal.d.ts +26 -177
  225. package/dist/production/lib/types/internal.js +3 -2
  226. package/dist/{development/register-CNAx3TXj.d.ts → production/lib/types/register.d.ts} +9 -15
  227. package/dist/production/lib/types/route-data.d.ts +113 -0
  228. package/dist/production/lib/types/route-module-annotations.d.ts +149 -0
  229. package/dist/production/lib/types/route-module.d.ts +19 -0
  230. package/dist/production/lib/types/serializes-to.d.ts +13 -0
  231. package/dist/production/lib/types/utils.d.ts +11 -0
  232. package/dist/production/vendor/turbo-stream-v2/flatten.js +159 -0
  233. package/dist/production/vendor/turbo-stream-v2/turbo-stream.js +178 -0
  234. package/dist/production/vendor/turbo-stream-v2/unflatten.js +198 -0
  235. package/dist/production/vendor/turbo-stream-v2/utils.js +47 -0
  236. package/docs/explanation/backend-for-frontend.md +50 -0
  237. package/docs/explanation/code-splitting.md +77 -0
  238. package/docs/explanation/concurrency.md +135 -0
  239. package/docs/explanation/form-vs-fetcher.md +292 -0
  240. package/docs/explanation/hot-module-replacement.md +137 -0
  241. package/docs/explanation/hydration.md +14 -0
  242. package/docs/explanation/index-query-param.md +86 -0
  243. package/docs/explanation/index.md +4 -0
  244. package/docs/explanation/lazy-route-discovery.md +78 -0
  245. package/docs/explanation/location.md +6 -0
  246. package/docs/explanation/progressive-enhancement.md +150 -0
  247. package/docs/explanation/race-conditions.md +88 -0
  248. package/docs/explanation/react-transitions.md +160 -0
  249. package/docs/explanation/route-matching.md +7 -0
  250. package/docs/explanation/server-client-execution.md +4 -0
  251. package/docs/explanation/sessions-and-cookies.md +465 -0
  252. package/docs/explanation/special-files.md +16 -0
  253. package/docs/explanation/state-management.md +524 -0
  254. package/docs/explanation/styling.md +87 -0
  255. package/docs/explanation/type-safety.md +82 -0
  256. package/docs/how-to/accessibility.md +44 -0
  257. package/docs/how-to/client-data.md +199 -0
  258. package/docs/how-to/data-strategy.md +317 -0
  259. package/docs/how-to/error-boundary.md +231 -0
  260. package/docs/how-to/error-reporting.md +134 -0
  261. package/docs/how-to/fetchers.md +307 -0
  262. package/docs/how-to/file-route-conventions.md +410 -0
  263. package/docs/how-to/file-uploads.md +217 -0
  264. package/docs/how-to/form-validation.md +120 -0
  265. package/docs/how-to/headers.md +164 -0
  266. package/docs/how-to/index.md +4 -0
  267. package/docs/how-to/instrumentation.md +556 -0
  268. package/docs/how-to/meta.md +40 -0
  269. package/docs/how-to/middleware.md +728 -0
  270. package/docs/how-to/navigation-blocking.md +233 -0
  271. package/docs/how-to/optimize-revalidation.md +12 -0
  272. package/docs/how-to/pre-rendering.md +225 -0
  273. package/docs/how-to/presets.md +103 -0
  274. package/docs/how-to/react-server-components.md +899 -0
  275. package/docs/how-to/resource-routes.md +126 -0
  276. package/docs/how-to/route-module-type-safety.md +100 -0
  277. package/docs/how-to/search-params.md +4 -0
  278. package/docs/how-to/security.md +30 -0
  279. package/docs/how-to/server-bundles.md +66 -0
  280. package/docs/how-to/spa.md +120 -0
  281. package/docs/how-to/status.md +63 -0
  282. package/docs/how-to/suspense.md +132 -0
  283. package/docs/how-to/using-handle.md +117 -0
  284. package/docs/how-to/view-transitions.md +237 -0
  285. package/docs/how-to/webhook.md +50 -0
  286. package/docs/index.md +39 -0
  287. package/docs/start/data/actions.md +138 -0
  288. package/docs/start/data/custom.md +198 -0
  289. package/docs/start/data/data-loading.md +44 -0
  290. package/docs/start/data/index.md +4 -0
  291. package/docs/start/data/installation.md +52 -0
  292. package/docs/start/data/navigating.md +12 -0
  293. package/docs/start/data/pending-ui.md +12 -0
  294. package/docs/start/data/route-object.md +248 -0
  295. package/docs/start/data/routing.md +281 -0
  296. package/docs/start/data/testing.md +8 -0
  297. package/docs/start/declarative/index.md +4 -0
  298. package/docs/start/declarative/installation.md +43 -0
  299. package/docs/start/declarative/navigating.md +133 -0
  300. package/docs/start/declarative/routing.md +237 -0
  301. package/docs/start/declarative/url-values.md +65 -0
  302. package/docs/start/framework/actions.md +175 -0
  303. package/docs/start/framework/data-loading.md +201 -0
  304. package/docs/start/framework/deploying.md +96 -0
  305. package/docs/start/framework/index.md +4 -0
  306. package/docs/start/framework/installation.md +42 -0
  307. package/docs/start/framework/navigating.md +182 -0
  308. package/docs/start/framework/pending-ui.md +142 -0
  309. package/docs/start/framework/rendering.md +59 -0
  310. package/docs/start/framework/route-module.md +527 -0
  311. package/docs/start/framework/routing.md +362 -0
  312. package/docs/start/framework/testing.md +133 -0
  313. package/docs/start/index.md +4 -0
  314. package/docs/start/modes.md +201 -0
  315. package/docs/upgrading/component-routes.md +363 -0
  316. package/docs/upgrading/future.md +31 -0
  317. package/docs/upgrading/index.md +4 -0
  318. package/docs/upgrading/remix.md +403 -0
  319. package/docs/upgrading/router-provider.md +442 -0
  320. package/docs/upgrading/v6.md +379 -0
  321. package/package.json +44 -87
  322. package/dist/development/browser-D3uq9sI1.d.ts +0 -318
  323. package/dist/development/browser-nIQ4Nsyi.d.mts +0 -318
  324. package/dist/development/chunk-IBI7OMNB.js +0 -1363
  325. package/dist/development/chunk-QUQL4437.mjs +0 -11529
  326. package/dist/development/chunk-S54KXAEJ.mjs +0 -2585
  327. package/dist/development/chunk-SRID2YZ2.js +0 -10229
  328. package/dist/development/chunk-XEJDWL2B.js +0 -188
  329. package/dist/development/context-m8rizgnE.d.mts +0 -1771
  330. package/dist/development/data-D4xhSy90.d.ts +0 -1732
  331. package/dist/development/data-U8FS-wNn.d.mts +0 -1732
  332. package/dist/development/dom-export.d.mts +0 -172
  333. package/dist/development/dom-export.mjs +0 -1008
  334. package/dist/development/index-react-server-client-BLiUx67a.d.ts +0 -3655
  335. package/dist/development/index-react-server-client-CdKROblb.d.mts +0 -2600
  336. package/dist/development/index-react-server-client.d.mts +0 -4
  337. package/dist/development/index-react-server-client.mjs +0 -59
  338. package/dist/development/index-react-server.d.mts +0 -2703
  339. package/dist/development/index-react-server.mjs +0 -3780
  340. package/dist/development/index.d.mts +0 -1478
  341. package/dist/development/index.mjs +0 -277
  342. package/dist/development/instrumentation-1q4YhLGP.d.ts +0 -715
  343. package/dist/development/lib/types/internal.d.mts +0 -184
  344. package/dist/development/lib/types/internal.mjs +0 -10
  345. package/dist/development/register-CqK96Zfk.d.mts +0 -30
  346. package/dist/production/browser-D3uq9sI1.d.ts +0 -318
  347. package/dist/production/browser-nIQ4Nsyi.d.mts +0 -318
  348. package/dist/production/chunk-EAQNHM3N.js +0 -188
  349. package/dist/production/chunk-NALGHHKE.mjs +0 -2585
  350. package/dist/production/chunk-Q65P7S7Y.mjs +0 -11529
  351. package/dist/production/chunk-SKEDDLRM.js +0 -1363
  352. package/dist/production/chunk-Y7DNFQZP.js +0 -10229
  353. package/dist/production/context-m8rizgnE.d.mts +0 -1771
  354. package/dist/production/data-D4xhSy90.d.ts +0 -1732
  355. package/dist/production/data-U8FS-wNn.d.mts +0 -1732
  356. package/dist/production/dom-export.d.mts +0 -172
  357. package/dist/production/dom-export.mjs +0 -1008
  358. package/dist/production/index-react-server-client-BLiUx67a.d.ts +0 -3655
  359. package/dist/production/index-react-server-client-CdKROblb.d.mts +0 -2600
  360. package/dist/production/index-react-server-client.d.mts +0 -4
  361. package/dist/production/index-react-server-client.mjs +0 -59
  362. package/dist/production/index-react-server.d.mts +0 -2703
  363. package/dist/production/index-react-server.mjs +0 -3780
  364. package/dist/production/index.d.mts +0 -1478
  365. package/dist/production/index.mjs +0 -277
  366. package/dist/production/instrumentation-1q4YhLGP.d.ts +0 -715
  367. package/dist/production/lib/types/internal.d.mts +0 -184
  368. package/dist/production/lib/types/internal.mjs +0 -10
  369. package/dist/production/register-CqK96Zfk.d.mts +0 -30
@@ -1,1363 +0,0 @@
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 _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.16.0
3
- *
4
- * Copyright (c) Remix Software Inc.
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
- var _chunkSRID2YZ2js = require('./chunk-SRID2YZ2.js');
55
-
56
- // lib/dom/dom.ts
57
- var defaultMethod = "get";
58
- var defaultEncType = "application/x-www-form-urlencoded";
59
- function isHtmlElement(object) {
60
- return typeof HTMLElement !== "undefined" && object instanceof HTMLElement;
61
- }
62
- function isButtonElement(object) {
63
- return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
64
- }
65
- function isFormElement(object) {
66
- return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
67
- }
68
- function isInputElement(object) {
69
- return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
70
- }
71
- function isModifiedEvent(event) {
72
- return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
73
- }
74
- function shouldProcessLinkClick(event, target) {
75
- return event.button === 0 && // Ignore everything but left clicks
76
- (!target || target === "_self") && // Let browser handle "target=_blank" etc.
77
- !isModifiedEvent(event);
78
- }
79
- function createSearchParams(init = "") {
80
- return new URLSearchParams(
81
- typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => {
82
- let value = init[key];
83
- return memo.concat(
84
- Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]]
85
- );
86
- }, [])
87
- );
88
- }
89
- function getSearchParamsForLocation(locationSearch, defaultSearchParams) {
90
- let searchParams = createSearchParams(locationSearch);
91
- if (defaultSearchParams) {
92
- defaultSearchParams.forEach((_, key) => {
93
- if (!searchParams.has(key)) {
94
- defaultSearchParams.getAll(key).forEach((value) => {
95
- searchParams.append(key, value);
96
- });
97
- }
98
- });
99
- }
100
- return searchParams;
101
- }
102
- var _formDataSupportsSubmitter = null;
103
- function isFormDataSubmitterSupported() {
104
- if (_formDataSupportsSubmitter === null) {
105
- try {
106
- new FormData(
107
- document.createElement("form"),
108
- // @ts-expect-error if FormData supports the submitter parameter, this will throw
109
- 0
110
- );
111
- _formDataSupportsSubmitter = false;
112
- } catch (e) {
113
- _formDataSupportsSubmitter = true;
114
- }
115
- }
116
- return _formDataSupportsSubmitter;
117
- }
118
- var supportedFormEncTypes = /* @__PURE__ */ new Set([
119
- "application/x-www-form-urlencoded",
120
- "multipart/form-data",
121
- "text/plain"
122
- ]);
123
- function getFormEncType(encType) {
124
- if (encType != null && !supportedFormEncTypes.has(encType)) {
125
- _chunkSRID2YZ2js.warning.call(void 0,
126
- false,
127
- `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
128
- );
129
- return null;
130
- }
131
- return encType;
132
- }
133
- function getFormSubmissionInfo(target, basename) {
134
- let method;
135
- let action;
136
- let encType;
137
- let formData;
138
- let body;
139
- if (isFormElement(target)) {
140
- let attr = target.getAttribute("action");
141
- action = attr ? _chunkSRID2YZ2js.stripBasename.call(void 0, attr, basename) : null;
142
- method = target.getAttribute("method") || defaultMethod;
143
- encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
144
- formData = new FormData(target);
145
- } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
146
- let form = target.form;
147
- if (form == null) {
148
- throw new Error(
149
- `Cannot submit a <button> or <input type="submit"> without a <form>`
150
- );
151
- }
152
- let attr = target.getAttribute("formaction") || form.getAttribute("action");
153
- action = attr ? _chunkSRID2YZ2js.stripBasename.call(void 0, attr, basename) : null;
154
- method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
155
- encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
156
- formData = new FormData(form, target);
157
- if (!isFormDataSubmitterSupported()) {
158
- let { name, type, value } = target;
159
- if (type === "image") {
160
- let prefix = name ? `${name}.` : "";
161
- formData.append(`${prefix}x`, "0");
162
- formData.append(`${prefix}y`, "0");
163
- } else if (name) {
164
- formData.append(name, value);
165
- }
166
- }
167
- } else if (isHtmlElement(target)) {
168
- throw new Error(
169
- `Cannot submit element that is not <form>, <button>, or <input type="submit|image">`
170
- );
171
- } else {
172
- method = defaultMethod;
173
- action = null;
174
- encType = defaultEncType;
175
- body = target;
176
- }
177
- if (formData && encType === "text/plain") {
178
- body = formData;
179
- formData = void 0;
180
- }
181
- return { action, method: method.toLowerCase(), encType, formData, body };
182
- }
183
-
184
- // lib/dom/lib.tsx
185
- var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react);
186
- var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
187
- try {
188
- if (isBrowser) {
189
- window.__reactRouterVersion = // @ts-expect-error
190
- "7.16.0";
191
- }
192
- } catch (e) {
193
- }
194
- function createBrowserRouter(routes, opts) {
195
- return _chunkSRID2YZ2js.createRouter.call(void 0, {
196
- basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]),
197
- getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.getContext]),
198
- future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]),
199
- history: _chunkSRID2YZ2js.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _5 => _5.window]) }),
200
- hydrationData: _optionalChain([opts, 'optionalAccess', _6 => _6.hydrationData]) || parseHydrationData(),
201
- routes,
202
- mapRouteProperties: _chunkSRID2YZ2js.mapRouteProperties,
203
- hydrationRouteProperties: _chunkSRID2YZ2js.hydrationRouteProperties,
204
- dataStrategy: _optionalChain([opts, 'optionalAccess', _7 => _7.dataStrategy]),
205
- patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _8 => _8.patchRoutesOnNavigation]),
206
- window: _optionalChain([opts, 'optionalAccess', _9 => _9.window]),
207
- instrumentations: _optionalChain([opts, 'optionalAccess', _10 => _10.instrumentations])
208
- }).initialize();
209
- }
210
- function createHashRouter(routes, opts) {
211
- return _chunkSRID2YZ2js.createRouter.call(void 0, {
212
- basename: _optionalChain([opts, 'optionalAccess', _11 => _11.basename]),
213
- getContext: _optionalChain([opts, 'optionalAccess', _12 => _12.getContext]),
214
- future: _optionalChain([opts, 'optionalAccess', _13 => _13.future]),
215
- history: _chunkSRID2YZ2js.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _14 => _14.window]) }),
216
- hydrationData: _optionalChain([opts, 'optionalAccess', _15 => _15.hydrationData]) || parseHydrationData(),
217
- routes,
218
- mapRouteProperties: _chunkSRID2YZ2js.mapRouteProperties,
219
- hydrationRouteProperties: _chunkSRID2YZ2js.hydrationRouteProperties,
220
- dataStrategy: _optionalChain([opts, 'optionalAccess', _16 => _16.dataStrategy]),
221
- patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _17 => _17.patchRoutesOnNavigation]),
222
- window: _optionalChain([opts, 'optionalAccess', _18 => _18.window]),
223
- instrumentations: _optionalChain([opts, 'optionalAccess', _19 => _19.instrumentations])
224
- }).initialize();
225
- }
226
- function parseHydrationData() {
227
- let state = _optionalChain([window, 'optionalAccess', _20 => _20.__staticRouterHydrationData]);
228
- if (state && state.errors) {
229
- state = {
230
- ...state,
231
- errors: deserializeErrors(state.errors)
232
- };
233
- }
234
- return state;
235
- }
236
- function deserializeErrors(errors) {
237
- if (!errors) return null;
238
- let entries = Object.entries(errors);
239
- let serialized = {};
240
- for (let [key, val] of entries) {
241
- if (val && val.__type === "RouteErrorResponse") {
242
- serialized[key] = new (0, _chunkSRID2YZ2js.ErrorResponseImpl)(
243
- val.status,
244
- val.statusText,
245
- val.data,
246
- val.internal === true
247
- );
248
- } else if (val && val.__type === "Error") {
249
- if (val.__subType) {
250
- let ErrorConstructor = window[val.__subType];
251
- if (typeof ErrorConstructor === "function") {
252
- try {
253
- let error = new ErrorConstructor(val.message);
254
- error.stack = "";
255
- serialized[key] = error;
256
- } catch (e) {
257
- }
258
- }
259
- }
260
- if (serialized[key] == null) {
261
- let error = new Error(val.message);
262
- error.stack = "";
263
- serialized[key] = error;
264
- }
265
- } else {
266
- serialized[key] = val;
267
- }
268
- }
269
- return serialized;
270
- }
271
- function BrowserRouter({
272
- basename,
273
- children,
274
- useTransitions,
275
- window: window2
276
- }) {
277
- let historyRef = React.useRef();
278
- if (historyRef.current == null) {
279
- historyRef.current = _chunkSRID2YZ2js.createBrowserHistory.call(void 0, { window: window2, v5Compat: true });
280
- }
281
- let history = historyRef.current;
282
- let [state, setStateImpl] = React.useState({
283
- action: history.action,
284
- location: history.location
285
- });
286
- let setState = React.useCallback(
287
- (newState) => {
288
- if (useTransitions === false) {
289
- setStateImpl(newState);
290
- } else {
291
- React.startTransition(() => setStateImpl(newState));
292
- }
293
- },
294
- [useTransitions]
295
- );
296
- React.useLayoutEffect(() => history.listen(setState), [history, setState]);
297
- return /* @__PURE__ */ React.createElement(
298
- _chunkSRID2YZ2js.Router,
299
- {
300
- basename,
301
- children,
302
- location: state.location,
303
- navigationType: state.action,
304
- navigator: history,
305
- useTransitions
306
- }
307
- );
308
- }
309
- function HashRouter({
310
- basename,
311
- children,
312
- useTransitions,
313
- window: window2
314
- }) {
315
- let historyRef = React.useRef();
316
- if (historyRef.current == null) {
317
- historyRef.current = _chunkSRID2YZ2js.createHashHistory.call(void 0, { window: window2, v5Compat: true });
318
- }
319
- let history = historyRef.current;
320
- let [state, setStateImpl] = React.useState({
321
- action: history.action,
322
- location: history.location
323
- });
324
- let setState = React.useCallback(
325
- (newState) => {
326
- if (useTransitions === false) {
327
- setStateImpl(newState);
328
- } else {
329
- React.startTransition(() => setStateImpl(newState));
330
- }
331
- },
332
- [useTransitions]
333
- );
334
- React.useLayoutEffect(() => history.listen(setState), [history, setState]);
335
- return /* @__PURE__ */ React.createElement(
336
- _chunkSRID2YZ2js.Router,
337
- {
338
- basename,
339
- children,
340
- location: state.location,
341
- navigationType: state.action,
342
- navigator: history,
343
- useTransitions
344
- }
345
- );
346
- }
347
- function HistoryRouter({
348
- basename,
349
- children,
350
- history,
351
- useTransitions
352
- }) {
353
- let [state, setStateImpl] = React.useState({
354
- action: history.action,
355
- location: history.location
356
- });
357
- let setState = React.useCallback(
358
- (newState) => {
359
- if (useTransitions === false) {
360
- setStateImpl(newState);
361
- } else {
362
- React.startTransition(() => setStateImpl(newState));
363
- }
364
- },
365
- [useTransitions]
366
- );
367
- React.useLayoutEffect(() => history.listen(setState), [history, setState]);
368
- return /* @__PURE__ */ React.createElement(
369
- _chunkSRID2YZ2js.Router,
370
- {
371
- basename,
372
- children,
373
- location: state.location,
374
- navigationType: state.action,
375
- navigator: history,
376
- useTransitions
377
- }
378
- );
379
- }
380
- HistoryRouter.displayName = "unstable_HistoryRouter";
381
- var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
382
- var Link = React.forwardRef(
383
- function LinkWithRef({
384
- onClick,
385
- discover = "render",
386
- prefetch = "none",
387
- relative,
388
- reloadDocument,
389
- replace,
390
- mask,
391
- state,
392
- target,
393
- to,
394
- preventScrollReset,
395
- viewTransition,
396
- defaultShouldRevalidate,
397
- ...rest
398
- }, forwardedRef) {
399
- let { basename, navigator, useTransitions } = React.useContext(_chunkSRID2YZ2js.NavigationContext);
400
- let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
401
- let parsed = _chunkSRID2YZ2js.parseToInfo.call(void 0, to, basename);
402
- to = parsed.to;
403
- let href = _chunkSRID2YZ2js.useHref.call(void 0, to, { relative });
404
- let location = _chunkSRID2YZ2js.useLocation.call(void 0, );
405
- let maskedHref = null;
406
- if (mask) {
407
- let resolved = _chunkSRID2YZ2js.resolveTo.call(void 0,
408
- mask,
409
- [],
410
- location.mask ? location.mask.pathname : "/",
411
- true
412
- );
413
- if (basename !== "/") {
414
- resolved.pathname = resolved.pathname === "/" ? basename : _chunkSRID2YZ2js.joinPaths.call(void 0, [basename, resolved.pathname]);
415
- }
416
- maskedHref = navigator.createHref(resolved);
417
- }
418
- let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkSRID2YZ2js.usePrefetchBehavior.call(void 0,
419
- prefetch,
420
- rest
421
- );
422
- let internalOnClick = useLinkClickHandler(to, {
423
- replace,
424
- mask,
425
- state,
426
- target,
427
- preventScrollReset,
428
- relative,
429
- viewTransition,
430
- defaultShouldRevalidate,
431
- useTransitions
432
- });
433
- function handleClick(event) {
434
- if (onClick) onClick(event);
435
- if (!event.defaultPrevented) {
436
- internalOnClick(event);
437
- }
438
- }
439
- let isSpaLink = !(parsed.isExternal || reloadDocument);
440
- let link = (
441
- // eslint-disable-next-line jsx-a11y/anchor-has-content
442
- /* @__PURE__ */ React.createElement(
443
- "a",
444
- {
445
- ...rest,
446
- ...prefetchHandlers,
447
- href: (isSpaLink ? maskedHref : void 0) || parsed.absoluteURL || href,
448
- onClick: isSpaLink ? handleClick : onClick,
449
- ref: _chunkSRID2YZ2js.mergeRefs.call(void 0, forwardedRef, prefetchRef),
450
- target,
451
- "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
452
- }
453
- )
454
- );
455
- return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunkSRID2YZ2js.PrefetchPageLinks, { page: href })) : link;
456
- }
457
- );
458
- Link.displayName = "Link";
459
- var NavLink = React.forwardRef(
460
- function NavLinkWithRef({
461
- "aria-current": ariaCurrentProp = "page",
462
- caseSensitive = false,
463
- className: classNameProp = "",
464
- end = false,
465
- style: styleProp,
466
- to,
467
- viewTransition,
468
- children,
469
- ...rest
470
- }, ref) {
471
- let path = _chunkSRID2YZ2js.useResolvedPath.call(void 0, to, { relative: rest.relative });
472
- let location = _chunkSRID2YZ2js.useLocation.call(void 0, );
473
- let routerState = React.useContext(_chunkSRID2YZ2js.DataRouterStateContext);
474
- let { navigator, basename } = React.useContext(_chunkSRID2YZ2js.NavigationContext);
475
- let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
476
- // eslint-disable-next-line react-hooks/rules-of-hooks
477
- useViewTransitionState(path) && viewTransition === true;
478
- let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
479
- let locationPathname = location.pathname;
480
- let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
481
- if (!caseSensitive) {
482
- locationPathname = locationPathname.toLowerCase();
483
- nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
484
- toPathname = toPathname.toLowerCase();
485
- }
486
- if (nextLocationPathname && basename) {
487
- nextLocationPathname = _chunkSRID2YZ2js.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
488
- }
489
- const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
490
- let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
491
- let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
492
- let renderProps = {
493
- isActive,
494
- isPending,
495
- isTransitioning
496
- };
497
- let ariaCurrent = isActive ? ariaCurrentProp : void 0;
498
- let className;
499
- if (typeof classNameProp === "function") {
500
- className = classNameProp(renderProps);
501
- } else {
502
- className = [
503
- classNameProp,
504
- isActive ? "active" : null,
505
- isPending ? "pending" : null,
506
- isTransitioning ? "transitioning" : null
507
- ].filter(Boolean).join(" ");
508
- }
509
- let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
510
- return /* @__PURE__ */ React.createElement(
511
- Link,
512
- {
513
- ...rest,
514
- "aria-current": ariaCurrent,
515
- className,
516
- ref,
517
- style,
518
- to,
519
- viewTransition
520
- },
521
- typeof children === "function" ? children(renderProps) : children
522
- );
523
- }
524
- );
525
- NavLink.displayName = "NavLink";
526
- var Form = React.forwardRef(
527
- ({
528
- discover = "render",
529
- fetcherKey,
530
- navigate,
531
- reloadDocument,
532
- replace,
533
- state,
534
- method = defaultMethod,
535
- action,
536
- onSubmit,
537
- relative,
538
- preventScrollReset,
539
- viewTransition,
540
- defaultShouldRevalidate,
541
- ...props
542
- }, forwardedRef) => {
543
- let { useTransitions } = React.useContext(_chunkSRID2YZ2js.NavigationContext);
544
- let submit = useSubmit();
545
- let formAction = useFormAction(action, { relative });
546
- let formMethod = method.toLowerCase() === "get" ? "get" : "post";
547
- let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX.test(action);
548
- let submitHandler = (event) => {
549
- onSubmit && onSubmit(event);
550
- if (event.defaultPrevented) return;
551
- event.preventDefault();
552
- let submitter = event.nativeEvent.submitter;
553
- let submitMethod = _optionalChain([submitter, 'optionalAccess', _21 => _21.getAttribute, 'call', _22 => _22("formmethod")]) || method;
554
- let doSubmit = () => submit(submitter || event.currentTarget, {
555
- fetcherKey,
556
- method: submitMethod,
557
- navigate,
558
- replace,
559
- state,
560
- relative,
561
- preventScrollReset,
562
- viewTransition,
563
- defaultShouldRevalidate
564
- });
565
- if (useTransitions && navigate !== false) {
566
- React.startTransition(() => doSubmit());
567
- } else {
568
- doSubmit();
569
- }
570
- };
571
- return /* @__PURE__ */ React.createElement(
572
- "form",
573
- {
574
- ref: forwardedRef,
575
- method: formMethod,
576
- action: formAction,
577
- onSubmit: reloadDocument ? onSubmit : submitHandler,
578
- ...props,
579
- "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
580
- }
581
- );
582
- }
583
- );
584
- Form.displayName = "Form";
585
- function ScrollRestoration({
586
- getKey,
587
- storageKey,
588
- ...props
589
- }) {
590
- let remixContext = React.useContext(_chunkSRID2YZ2js.FrameworkContext);
591
- let { basename } = React.useContext(_chunkSRID2YZ2js.NavigationContext);
592
- let location = _chunkSRID2YZ2js.useLocation.call(void 0, );
593
- let matches = _chunkSRID2YZ2js.useMatches.call(void 0, );
594
- useScrollRestoration({ getKey, storageKey });
595
- let ssrKey = React.useMemo(
596
- () => {
597
- if (!remixContext || !getKey) return null;
598
- let userKey = getScrollRestorationKey(
599
- location,
600
- matches,
601
- basename,
602
- getKey
603
- );
604
- return userKey !== location.key ? userKey : null;
605
- },
606
- // Nah, we only need this the first time for the SSR render
607
- // eslint-disable-next-line react-hooks/exhaustive-deps
608
- []
609
- );
610
- if (!remixContext || remixContext.isSpaMode) {
611
- return null;
612
- }
613
- let restoreScroll = ((storageKey2, restoreKey) => {
614
- if (!window.history.state || !window.history.state.key) {
615
- let key = Math.random().toString(32).slice(2);
616
- window.history.replaceState({ key }, "");
617
- }
618
- try {
619
- let positions = JSON.parse(sessionStorage.getItem(storageKey2) || "{}");
620
- let storedY = positions[restoreKey || window.history.state.key];
621
- if (typeof storedY === "number") {
622
- window.scrollTo(0, storedY);
623
- }
624
- } catch (error) {
625
- console.error(error);
626
- sessionStorage.removeItem(storageKey2);
627
- }
628
- }).toString();
629
- return /* @__PURE__ */ React.createElement(
630
- "script",
631
- {
632
- ...props,
633
- suppressHydrationWarning: true,
634
- dangerouslySetInnerHTML: {
635
- __html: `(${restoreScroll})(${_chunkSRID2YZ2js.escapeHtml.call(void 0,
636
- JSON.stringify(storageKey || SCROLL_RESTORATION_STORAGE_KEY)
637
- )}, ${_chunkSRID2YZ2js.escapeHtml.call(void 0, JSON.stringify(ssrKey))})`
638
- }
639
- }
640
- );
641
- }
642
- ScrollRestoration.displayName = "ScrollRestoration";
643
- function getDataRouterConsoleError(hookName) {
644
- return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
645
- }
646
- function useDataRouterContext(hookName) {
647
- let ctx = React.useContext(_chunkSRID2YZ2js.DataRouterContext);
648
- _chunkSRID2YZ2js.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
649
- return ctx;
650
- }
651
- function useDataRouterState(hookName) {
652
- let state = React.useContext(_chunkSRID2YZ2js.DataRouterStateContext);
653
- _chunkSRID2YZ2js.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
654
- return state;
655
- }
656
- function useLinkClickHandler(to, {
657
- target,
658
- replace: replaceProp,
659
- mask,
660
- state,
661
- preventScrollReset,
662
- relative,
663
- viewTransition,
664
- defaultShouldRevalidate,
665
- useTransitions
666
- } = {}) {
667
- let navigate = _chunkSRID2YZ2js.useNavigate.call(void 0, );
668
- let location = _chunkSRID2YZ2js.useLocation.call(void 0, );
669
- let path = _chunkSRID2YZ2js.useResolvedPath.call(void 0, to, { relative });
670
- return React.useCallback(
671
- (event) => {
672
- if (shouldProcessLinkClick(event, target)) {
673
- event.preventDefault();
674
- let replace = replaceProp !== void 0 ? replaceProp : _chunkSRID2YZ2js.createPath.call(void 0, location) === _chunkSRID2YZ2js.createPath.call(void 0, path);
675
- let doNavigate = () => navigate(to, {
676
- replace,
677
- mask,
678
- state,
679
- preventScrollReset,
680
- relative,
681
- viewTransition,
682
- defaultShouldRevalidate
683
- });
684
- if (useTransitions) {
685
- React.startTransition(() => doNavigate());
686
- } else {
687
- doNavigate();
688
- }
689
- }
690
- },
691
- [
692
- location,
693
- navigate,
694
- path,
695
- replaceProp,
696
- mask,
697
- state,
698
- target,
699
- to,
700
- preventScrollReset,
701
- relative,
702
- viewTransition,
703
- defaultShouldRevalidate,
704
- useTransitions
705
- ]
706
- );
707
- }
708
- function useSearchParams(defaultInit) {
709
- _chunkSRID2YZ2js.warning.call(void 0,
710
- typeof URLSearchParams !== "undefined",
711
- `You cannot use the \`useSearchParams\` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.`
712
- );
713
- let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));
714
- let hasSetSearchParamsRef = React.useRef(false);
715
- let location = _chunkSRID2YZ2js.useLocation.call(void 0, );
716
- let searchParams = React.useMemo(
717
- () => (
718
- // Only merge in the defaults if we haven't yet called setSearchParams.
719
- // Once we call that we want those to take precedence, otherwise you can't
720
- // remove a param with setSearchParams({}) if it has an initial value
721
- getSearchParamsForLocation(
722
- location.search,
723
- hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current
724
- )
725
- ),
726
- [location.search]
727
- );
728
- let navigate = _chunkSRID2YZ2js.useNavigate.call(void 0, );
729
- let setSearchParams = React.useCallback(
730
- (nextInit, navigateOptions) => {
731
- const newSearchParams = createSearchParams(
732
- typeof nextInit === "function" ? nextInit(new URLSearchParams(searchParams)) : nextInit
733
- );
734
- hasSetSearchParamsRef.current = true;
735
- navigate("?" + newSearchParams, navigateOptions);
736
- },
737
- [navigate, searchParams]
738
- );
739
- return [searchParams, setSearchParams];
740
- }
741
- var fetcherId = 0;
742
- var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
743
- function useSubmit() {
744
- let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
745
- let { basename } = React.useContext(_chunkSRID2YZ2js.NavigationContext);
746
- let currentRouteId = _chunkSRID2YZ2js.useRouteId.call(void 0, );
747
- let routerFetch = router.fetch;
748
- let routerNavigate = router.navigate;
749
- return React.useCallback(
750
- async (target, options = {}) => {
751
- let { action, method, encType, formData, body } = getFormSubmissionInfo(
752
- target,
753
- basename
754
- );
755
- if (options.navigate === false) {
756
- let key = options.fetcherKey || getUniqueFetcherId();
757
- await routerFetch(key, currentRouteId, options.action || action, {
758
- defaultShouldRevalidate: options.defaultShouldRevalidate,
759
- preventScrollReset: options.preventScrollReset,
760
- formData,
761
- body,
762
- formMethod: options.method || method,
763
- formEncType: options.encType || encType,
764
- flushSync: options.flushSync
765
- });
766
- } else {
767
- await routerNavigate(options.action || action, {
768
- defaultShouldRevalidate: options.defaultShouldRevalidate,
769
- preventScrollReset: options.preventScrollReset,
770
- formData,
771
- body,
772
- formMethod: options.method || method,
773
- formEncType: options.encType || encType,
774
- replace: options.replace,
775
- state: options.state,
776
- fromRouteId: currentRouteId,
777
- flushSync: options.flushSync,
778
- viewTransition: options.viewTransition
779
- });
780
- }
781
- },
782
- [routerFetch, routerNavigate, basename, currentRouteId]
783
- );
784
- }
785
- function useFormAction(action, { relative } = {}) {
786
- let { basename } = React.useContext(_chunkSRID2YZ2js.NavigationContext);
787
- let routeContext = React.useContext(_chunkSRID2YZ2js.RouteContext);
788
- _chunkSRID2YZ2js.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
789
- let [match] = routeContext.matches.slice(-1);
790
- let path = { ..._chunkSRID2YZ2js.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
791
- let location = _chunkSRID2YZ2js.useLocation.call(void 0, );
792
- if (action == null) {
793
- path.search = location.search;
794
- let params = new URLSearchParams(path.search);
795
- let indexValues = params.getAll("index");
796
- let hasNakedIndexParam = indexValues.some((v) => v === "");
797
- if (hasNakedIndexParam) {
798
- params.delete("index");
799
- indexValues.filter((v) => v).forEach((v) => params.append("index", v));
800
- let qs = params.toString();
801
- path.search = qs ? `?${qs}` : "";
802
- }
803
- }
804
- if ((!action || action === ".") && match.route.index) {
805
- path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
806
- }
807
- if (basename !== "/") {
808
- path.pathname = path.pathname === "/" ? basename : _chunkSRID2YZ2js.joinPaths.call(void 0, [basename, path.pathname]);
809
- }
810
- return _chunkSRID2YZ2js.createPath.call(void 0, path);
811
- }
812
- function useFetcher({
813
- key
814
- } = {}) {
815
- let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
816
- let state = useDataRouterState("useFetcher" /* UseFetcher */);
817
- let fetcherData = React.useContext(_chunkSRID2YZ2js.FetchersContext);
818
- let route = React.useContext(_chunkSRID2YZ2js.RouteContext);
819
- let routeId = _optionalChain([route, 'access', _23 => _23.matches, 'access', _24 => _24[route.matches.length - 1], 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id]);
820
- _chunkSRID2YZ2js.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
821
- _chunkSRID2YZ2js.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
822
- _chunkSRID2YZ2js.invariant.call(void 0,
823
- routeId != null,
824
- `useFetcher can only be used on routes that contain a unique "id"`
825
- );
826
- let defaultKey = React.useId();
827
- let [fetcherKey, setFetcherKey] = React.useState(key || defaultKey);
828
- if (key && key !== fetcherKey) {
829
- setFetcherKey(key);
830
- }
831
- let { deleteFetcher, getFetcher, resetFetcher, fetch: routerFetch } = router;
832
- React.useEffect(() => {
833
- getFetcher(fetcherKey);
834
- return () => deleteFetcher(fetcherKey);
835
- }, [deleteFetcher, getFetcher, fetcherKey]);
836
- let load = React.useCallback(
837
- async (href, opts) => {
838
- _chunkSRID2YZ2js.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
839
- await routerFetch(fetcherKey, routeId, href, opts);
840
- },
841
- [fetcherKey, routeId, routerFetch]
842
- );
843
- let submitImpl = useSubmit();
844
- let submit = React.useCallback(
845
- async (target, opts) => {
846
- await submitImpl(target, {
847
- ...opts,
848
- navigate: false,
849
- fetcherKey
850
- });
851
- },
852
- [fetcherKey, submitImpl]
853
- );
854
- let reset = React.useCallback(
855
- (opts) => resetFetcher(fetcherKey, opts),
856
- [resetFetcher, fetcherKey]
857
- );
858
- let FetcherForm = React.useMemo(() => {
859
- let FetcherForm2 = React.forwardRef(
860
- (props, ref) => {
861
- return /* @__PURE__ */ React.createElement(Form, { ...props, navigate: false, fetcherKey, ref });
862
- }
863
- );
864
- FetcherForm2.displayName = "fetcher.Form";
865
- return FetcherForm2;
866
- }, [fetcherKey]);
867
- let fetcher = state.fetchers.get(fetcherKey) || _chunkSRID2YZ2js.IDLE_FETCHER;
868
- let data = fetcherData.get(fetcherKey);
869
- let fetcherWithComponents = React.useMemo(
870
- () => ({
871
- Form: FetcherForm,
872
- submit,
873
- load,
874
- reset,
875
- ...fetcher,
876
- data
877
- }),
878
- [FetcherForm, submit, load, reset, fetcher, data]
879
- );
880
- return fetcherWithComponents;
881
- }
882
- function useFetchers() {
883
- let state = useDataRouterState("useFetchers" /* UseFetchers */);
884
- return React.useMemo(
885
- () => Array.from(state.fetchers.entries()).map(([key, fetcher]) => ({
886
- ...fetcher,
887
- key
888
- })),
889
- [state.fetchers]
890
- );
891
- }
892
- var SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions";
893
- var savedScrollPositions = {};
894
- function getScrollRestorationKey(location, matches, basename, getKey) {
895
- let key = null;
896
- if (getKey) {
897
- if (basename !== "/") {
898
- key = getKey(
899
- {
900
- ...location,
901
- pathname: _chunkSRID2YZ2js.stripBasename.call(void 0, location.pathname, basename) || location.pathname
902
- },
903
- matches
904
- );
905
- } else {
906
- key = getKey(location, matches);
907
- }
908
- }
909
- if (key == null) {
910
- key = location.key;
911
- }
912
- return key;
913
- }
914
- function useScrollRestoration({
915
- getKey,
916
- storageKey
917
- } = {}) {
918
- let { router } = useDataRouterContext("useScrollRestoration" /* UseScrollRestoration */);
919
- let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
920
- "useScrollRestoration" /* UseScrollRestoration */
921
- );
922
- let { basename } = React.useContext(_chunkSRID2YZ2js.NavigationContext);
923
- let location = _chunkSRID2YZ2js.useLocation.call(void 0, );
924
- let matches = _chunkSRID2YZ2js.useMatches.call(void 0, );
925
- let navigation = _chunkSRID2YZ2js.useNavigation.call(void 0, );
926
- React.useEffect(() => {
927
- window.history.scrollRestoration = "manual";
928
- return () => {
929
- window.history.scrollRestoration = "auto";
930
- };
931
- }, []);
932
- usePageHide(
933
- React.useCallback(() => {
934
- if (navigation.state === "idle") {
935
- let key = getScrollRestorationKey(location, matches, basename, getKey);
936
- savedScrollPositions[key] = window.scrollY;
937
- }
938
- try {
939
- sessionStorage.setItem(
940
- storageKey || SCROLL_RESTORATION_STORAGE_KEY,
941
- JSON.stringify(savedScrollPositions)
942
- );
943
- } catch (error) {
944
- _chunkSRID2YZ2js.warning.call(void 0,
945
- false,
946
- `Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
947
- );
948
- }
949
- window.history.scrollRestoration = "auto";
950
- }, [navigation.state, getKey, basename, location, matches, storageKey])
951
- );
952
- if (typeof document !== "undefined") {
953
- React.useLayoutEffect(() => {
954
- try {
955
- let sessionPositions = sessionStorage.getItem(
956
- storageKey || SCROLL_RESTORATION_STORAGE_KEY
957
- );
958
- if (sessionPositions) {
959
- savedScrollPositions = JSON.parse(sessionPositions);
960
- }
961
- } catch (e) {
962
- }
963
- }, [storageKey]);
964
- React.useLayoutEffect(() => {
965
- let disableScrollRestoration = _optionalChain([router, 'optionalAccess', _27 => _27.enableScrollRestoration, 'call', _28 => _28(
966
- savedScrollPositions,
967
- () => window.scrollY,
968
- getKey ? (location2, matches2) => getScrollRestorationKey(location2, matches2, basename, getKey) : void 0
969
- )]);
970
- return () => disableScrollRestoration && disableScrollRestoration();
971
- }, [router, basename, getKey]);
972
- React.useLayoutEffect(() => {
973
- if (restoreScrollPosition === false) {
974
- return;
975
- }
976
- if (typeof restoreScrollPosition === "number") {
977
- window.scrollTo(0, restoreScrollPosition);
978
- return;
979
- }
980
- try {
981
- if (location.hash) {
982
- let el = document.getElementById(
983
- decodeURIComponent(location.hash.slice(1))
984
- );
985
- if (el) {
986
- el.scrollIntoView();
987
- return;
988
- }
989
- }
990
- } catch (e2) {
991
- _chunkSRID2YZ2js.warning.call(void 0,
992
- false,
993
- `"${location.hash.slice(
994
- 1
995
- )}" is not a decodable element ID. The view will not scroll to it.`
996
- );
997
- }
998
- if (preventScrollReset === true) {
999
- return;
1000
- }
1001
- window.scrollTo(0, 0);
1002
- }, [location, restoreScrollPosition, preventScrollReset]);
1003
- }
1004
- }
1005
- function useBeforeUnload(callback, options) {
1006
- let { capture } = options || {};
1007
- React.useEffect(() => {
1008
- let opts = capture != null ? { capture } : void 0;
1009
- window.addEventListener("beforeunload", callback, opts);
1010
- return () => {
1011
- window.removeEventListener("beforeunload", callback, opts);
1012
- };
1013
- }, [callback, capture]);
1014
- }
1015
- function usePageHide(callback, options) {
1016
- let { capture } = options || {};
1017
- React.useEffect(() => {
1018
- let opts = capture != null ? { capture } : void 0;
1019
- window.addEventListener("pagehide", callback, opts);
1020
- return () => {
1021
- window.removeEventListener("pagehide", callback, opts);
1022
- };
1023
- }, [callback, capture]);
1024
- }
1025
- function usePrompt({
1026
- when,
1027
- message
1028
- }) {
1029
- let blocker = _chunkSRID2YZ2js.useBlocker.call(void 0, when);
1030
- React.useEffect(() => {
1031
- if (blocker.state === "blocked") {
1032
- let proceed = window.confirm(message);
1033
- if (proceed) {
1034
- setTimeout(blocker.proceed, 0);
1035
- } else {
1036
- blocker.reset();
1037
- }
1038
- }
1039
- }, [blocker, message]);
1040
- React.useEffect(() => {
1041
- if (blocker.state === "blocked" && !when) {
1042
- blocker.reset();
1043
- }
1044
- }, [blocker, when]);
1045
- }
1046
- function useViewTransitionState(to, { relative } = {}) {
1047
- let vtContext = React.useContext(_chunkSRID2YZ2js.ViewTransitionContext);
1048
- _chunkSRID2YZ2js.invariant.call(void 0,
1049
- vtContext != null,
1050
- "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
1051
- );
1052
- let { basename } = useDataRouterContext(
1053
- "useViewTransitionState" /* useViewTransitionState */
1054
- );
1055
- let path = _chunkSRID2YZ2js.useResolvedPath.call(void 0, to, { relative });
1056
- if (!vtContext.isTransitioning) {
1057
- return false;
1058
- }
1059
- let currentPath = _chunkSRID2YZ2js.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
1060
- let nextPath = _chunkSRID2YZ2js.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
1061
- return _chunkSRID2YZ2js.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkSRID2YZ2js.matchPath.call(void 0, path.pathname, currentPath) != null;
1062
- }
1063
-
1064
- // lib/dom/server.tsx
1065
-
1066
- function StaticRouter({
1067
- basename,
1068
- children,
1069
- location: locationProp = "/"
1070
- }) {
1071
- if (typeof locationProp === "string") {
1072
- locationProp = _chunkSRID2YZ2js.parsePath.call(void 0, locationProp);
1073
- }
1074
- let action = "POP" /* Pop */;
1075
- let location = {
1076
- pathname: locationProp.pathname || "/",
1077
- search: locationProp.search || "",
1078
- hash: locationProp.hash || "",
1079
- state: locationProp.state != null ? locationProp.state : null,
1080
- key: locationProp.key || "default",
1081
- mask: void 0
1082
- };
1083
- let staticNavigator = getStatelessNavigator();
1084
- return /* @__PURE__ */ React2.createElement(
1085
- _chunkSRID2YZ2js.Router,
1086
- {
1087
- basename,
1088
- children,
1089
- location,
1090
- navigationType: action,
1091
- navigator: staticNavigator,
1092
- static: true,
1093
- useTransitions: false
1094
- }
1095
- );
1096
- }
1097
- function StaticRouterProvider({
1098
- context,
1099
- router,
1100
- hydrate = true,
1101
- nonce
1102
- }) {
1103
- _chunkSRID2YZ2js.invariant.call(void 0,
1104
- router && context,
1105
- "You must provide `router` and `context` to <StaticRouterProvider>"
1106
- );
1107
- let dataRouterContext = {
1108
- router,
1109
- navigator: getStatelessNavigator(),
1110
- static: true,
1111
- staticContext: context,
1112
- basename: context.basename || "/"
1113
- };
1114
- let fetchersContext = /* @__PURE__ */ new Map();
1115
- let hydrateScript = "";
1116
- if (hydrate !== false) {
1117
- let data = {
1118
- loaderData: context.loaderData,
1119
- actionData: context.actionData,
1120
- errors: serializeErrors(context.errors)
1121
- };
1122
- let json = _chunkSRID2YZ2js.escapeHtml.call(void 0, JSON.stringify(JSON.stringify(data)));
1123
- hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
1124
- }
1125
- let { state } = dataRouterContext.router;
1126
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunkSRID2YZ2js.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunkSRID2YZ2js.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunkSRID2YZ2js.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunkSRID2YZ2js.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement(
1127
- _chunkSRID2YZ2js.Router,
1128
- {
1129
- basename: dataRouterContext.basename,
1130
- location: state.location,
1131
- navigationType: state.historyAction,
1132
- navigator: dataRouterContext.navigator,
1133
- static: dataRouterContext.static,
1134
- useTransitions: false
1135
- },
1136
- /* @__PURE__ */ React2.createElement(
1137
- _chunkSRID2YZ2js.DataRoutes,
1138
- {
1139
- manifest: router.manifest,
1140
- routes: router.routes,
1141
- future: router.future,
1142
- state,
1143
- isStatic: true
1144
- }
1145
- )
1146
- ))))), hydrateScript ? /* @__PURE__ */ React2.createElement(
1147
- "script",
1148
- {
1149
- suppressHydrationWarning: true,
1150
- nonce,
1151
- dangerouslySetInnerHTML: { __html: hydrateScript }
1152
- }
1153
- ) : null);
1154
- }
1155
- function serializeErrors(errors) {
1156
- if (!errors) return null;
1157
- let entries = Object.entries(errors);
1158
- let serialized = {};
1159
- for (let [key, val] of entries) {
1160
- if (_chunkSRID2YZ2js.isRouteErrorResponse.call(void 0, val)) {
1161
- serialized[key] = { ...val, __type: "RouteErrorResponse" };
1162
- } else if (val instanceof Error) {
1163
- serialized[key] = {
1164
- message: val.message,
1165
- __type: "Error",
1166
- // If this is a subclass (i.e., ReferenceError), send up the type so we
1167
- // can re-create the same type during hydration.
1168
- ...val.name !== "Error" ? {
1169
- __subType: val.name
1170
- } : {}
1171
- };
1172
- } else {
1173
- serialized[key] = val;
1174
- }
1175
- }
1176
- return serialized;
1177
- }
1178
- function getStatelessNavigator() {
1179
- return {
1180
- createHref,
1181
- encodeLocation,
1182
- push(to) {
1183
- throw new Error(
1184
- `You cannot use navigator.push() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)})\` somewhere in your app.`
1185
- );
1186
- },
1187
- replace(to) {
1188
- throw new Error(
1189
- `You cannot use navigator.replace() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)}, { replace: true })\` somewhere in your app.`
1190
- );
1191
- },
1192
- go(delta) {
1193
- throw new Error(
1194
- `You cannot use navigator.go() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${delta})\` somewhere in your app.`
1195
- );
1196
- },
1197
- back() {
1198
- throw new Error(
1199
- `You cannot use navigator.back() on the server because it is a stateless environment.`
1200
- );
1201
- },
1202
- forward() {
1203
- throw new Error(
1204
- `You cannot use navigator.forward() on the server because it is a stateless environment.`
1205
- );
1206
- }
1207
- };
1208
- }
1209
- function createStaticHandler2(routes, opts) {
1210
- return _chunkSRID2YZ2js.createStaticHandler.call(void 0, routes, {
1211
- ...opts,
1212
- mapRouteProperties: _chunkSRID2YZ2js.mapRouteProperties
1213
- });
1214
- }
1215
- function createStaticRouter(routes, context, opts = {}) {
1216
- let manifest = {};
1217
- let dataRoutes = _chunkSRID2YZ2js.convertRoutesToDataRoutes.call(void 0,
1218
- routes,
1219
- _chunkSRID2YZ2js.mapRouteProperties,
1220
- void 0,
1221
- manifest
1222
- );
1223
- let matches = context.matches.map((match) => {
1224
- let route = manifest[match.route.id] || match.route;
1225
- return {
1226
- ...match,
1227
- route
1228
- };
1229
- });
1230
- let msg = (method) => `You cannot use router.${method}() on the server because it is a stateless environment`;
1231
- return {
1232
- get basename() {
1233
- return context.basename;
1234
- },
1235
- get future() {
1236
- return {
1237
- v8_middleware: false,
1238
- v8_passThroughRequests: false,
1239
- v8_trailingSlashAwareDataRequests: false,
1240
- ..._optionalChain([opts, 'optionalAccess', _29 => _29.future])
1241
- };
1242
- },
1243
- get state() {
1244
- return {
1245
- historyAction: "POP" /* Pop */,
1246
- location: context.location,
1247
- matches,
1248
- loaderData: context.loaderData,
1249
- actionData: context.actionData,
1250
- errors: context.errors,
1251
- initialized: true,
1252
- renderFallback: false,
1253
- navigation: _chunkSRID2YZ2js.IDLE_NAVIGATION,
1254
- restoreScrollPosition: null,
1255
- preventScrollReset: false,
1256
- revalidation: "idle",
1257
- fetchers: /* @__PURE__ */ new Map(),
1258
- blockers: /* @__PURE__ */ new Map()
1259
- };
1260
- },
1261
- get routes() {
1262
- return dataRoutes;
1263
- },
1264
- get branches() {
1265
- return opts.branches;
1266
- },
1267
- get manifest() {
1268
- return manifest;
1269
- },
1270
- get window() {
1271
- return void 0;
1272
- },
1273
- initialize() {
1274
- throw msg("initialize");
1275
- },
1276
- subscribe() {
1277
- throw msg("subscribe");
1278
- },
1279
- enableScrollRestoration() {
1280
- throw msg("enableScrollRestoration");
1281
- },
1282
- navigate() {
1283
- throw msg("navigate");
1284
- },
1285
- fetch() {
1286
- throw msg("fetch");
1287
- },
1288
- revalidate() {
1289
- throw msg("revalidate");
1290
- },
1291
- createHref,
1292
- encodeLocation,
1293
- getFetcher() {
1294
- return _chunkSRID2YZ2js.IDLE_FETCHER;
1295
- },
1296
- deleteFetcher() {
1297
- throw msg("deleteFetcher");
1298
- },
1299
- resetFetcher() {
1300
- throw msg("resetFetcher");
1301
- },
1302
- dispose() {
1303
- throw msg("dispose");
1304
- },
1305
- getBlocker() {
1306
- return _chunkSRID2YZ2js.IDLE_BLOCKER;
1307
- },
1308
- deleteBlocker() {
1309
- throw msg("deleteBlocker");
1310
- },
1311
- patchRoutes() {
1312
- throw msg("patchRoutes");
1313
- },
1314
- _internalFetchControllers: /* @__PURE__ */ new Map(),
1315
- _internalSetRoutes() {
1316
- throw msg("_internalSetRoutes");
1317
- },
1318
- _internalSetStateDoNotUseOrYouWillBreakYourApp() {
1319
- throw msg("_internalSetStateDoNotUseOrYouWillBreakYourApp");
1320
- }
1321
- };
1322
- }
1323
- function createHref(to) {
1324
- return typeof to === "string" ? to : _chunkSRID2YZ2js.createPath.call(void 0, to);
1325
- }
1326
- function encodeLocation(to) {
1327
- let href = typeof to === "string" ? to : _chunkSRID2YZ2js.createPath.call(void 0, to);
1328
- href = href.replace(/ $/, "%20");
1329
- let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
1330
- return {
1331
- pathname: encoded.pathname,
1332
- search: encoded.search,
1333
- hash: encoded.hash
1334
- };
1335
- }
1336
- var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
1337
-
1338
-
1339
-
1340
-
1341
-
1342
-
1343
-
1344
-
1345
-
1346
-
1347
-
1348
-
1349
-
1350
-
1351
-
1352
-
1353
-
1354
-
1355
-
1356
-
1357
-
1358
-
1359
-
1360
-
1361
-
1362
-
1363
- exports.createSearchParams = createSearchParams; exports.createBrowserRouter = createBrowserRouter; exports.createHashRouter = createHashRouter; exports.BrowserRouter = BrowserRouter; exports.HashRouter = HashRouter; exports.HistoryRouter = HistoryRouter; exports.Link = Link; exports.NavLink = NavLink; exports.Form = Form; exports.ScrollRestoration = ScrollRestoration; exports.useLinkClickHandler = useLinkClickHandler; exports.useSearchParams = useSearchParams; exports.useSubmit = useSubmit; exports.useFormAction = useFormAction; exports.useFetcher = useFetcher; exports.useFetchers = useFetchers; exports.useScrollRestoration = useScrollRestoration; exports.useBeforeUnload = useBeforeUnload; exports.usePrompt = usePrompt; exports.useViewTransitionState = useViewTransitionState; exports.StaticRouter = StaticRouter; exports.StaticRouterProvider = StaticRouterProvider; exports.createStaticHandler = createStaticHandler2; exports.createStaticRouter = createStaticRouter;