byterover-cli 3.10.0 → 3.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (843) hide show
  1. package/dist/agent/infra/agent/service-initializer.js +8 -2
  2. package/dist/agent/infra/llm/agent-llm-service.d.ts +9 -9
  3. package/dist/agent/infra/llm/agent-llm-service.js +28 -18
  4. package/dist/agent/infra/llm/generators/ai-sdk-content-generator.d.ts +10 -1
  5. package/dist/agent/infra/llm/generators/ai-sdk-content-generator.js +21 -4
  6. package/dist/agent/infra/llm/generators/ai-sdk-message-converter.d.ts +4 -0
  7. package/dist/agent/infra/llm/generators/ai-sdk-message-converter.js +8 -1
  8. package/dist/agent/infra/map/abstract-generator.d.ts +29 -0
  9. package/dist/agent/infra/map/abstract-generator.js +161 -0
  10. package/dist/agent/infra/map/abstract-queue.d.ts +7 -0
  11. package/dist/agent/infra/map/abstract-queue.js +100 -26
  12. package/dist/agent/infra/system-prompt/contributors/file-contributor.js +6 -2
  13. package/dist/agent/infra/tools/implementations/curate-tool-task-context.d.ts +2 -0
  14. package/dist/agent/infra/tools/implementations/curate-tool-task-context.js +28 -0
  15. package/dist/agent/infra/tools/implementations/curate-tool.js +57 -16
  16. package/dist/agent/infra/tools/tool-manager.d.ts +10 -1
  17. package/dist/agent/infra/tools/tool-manager.js +10 -1
  18. package/dist/oclif/commands/review.d.ts +16 -0
  19. package/dist/oclif/commands/review.js +96 -0
  20. package/dist/server/core/domain/entities/brv-config.d.ts +6 -0
  21. package/dist/server/core/domain/entities/brv-config.js +27 -0
  22. package/dist/server/core/domain/entities/provider-registry.js +0 -1
  23. package/dist/server/core/domain/transport/schemas.d.ts +8 -0
  24. package/dist/server/core/domain/transport/schemas.js +6 -0
  25. package/dist/server/core/domain/transport/task-info.d.ts +7 -0
  26. package/dist/server/core/interfaces/i-provider-config-store.d.ts +5 -1
  27. package/dist/server/infra/context-tree/propagate-summaries.d.ts +18 -0
  28. package/dist/server/infra/context-tree/propagate-summaries.js +52 -0
  29. package/dist/server/infra/daemon/agent-process.js +78 -8
  30. package/dist/server/infra/daemon/brv-server.js +23 -0
  31. package/dist/server/infra/daemon/post-work-registry.d.ts +45 -0
  32. package/dist/server/infra/daemon/post-work-registry.js +82 -0
  33. package/dist/server/infra/dream/dream-lock-service.d.ts +3 -4
  34. package/dist/server/infra/dream/dream-lock-service.js +3 -4
  35. package/dist/server/infra/dream/dream-state-schema.d.ts +35 -0
  36. package/dist/server/infra/dream/dream-state-schema.js +15 -0
  37. package/dist/server/infra/dream/dream-state-service.d.ts +22 -0
  38. package/dist/server/infra/dream/dream-state-service.js +62 -3
  39. package/dist/server/infra/dream/dream-trigger.js +6 -2
  40. package/dist/server/infra/executor/curate-executor.d.ts +33 -0
  41. package/dist/server/infra/executor/curate-executor.js +116 -36
  42. package/dist/server/infra/executor/dream-executor.d.ts +29 -0
  43. package/dist/server/infra/executor/dream-executor.js +70 -16
  44. package/dist/server/infra/executor/folder-pack-executor.d.ts +10 -0
  45. package/dist/server/infra/executor/folder-pack-executor.js +22 -24
  46. package/dist/server/infra/git/git-error-messages.d.ts +10 -0
  47. package/dist/server/infra/git/git-error-messages.js +12 -0
  48. package/dist/server/infra/git/isomorphic-git-service.js +24 -76
  49. package/dist/server/infra/git/status-row-classifier.d.ts +32 -0
  50. package/dist/server/infra/git/status-row-classifier.js +78 -0
  51. package/dist/server/infra/process/curate-log-handler.d.ts +3 -0
  52. package/dist/server/infra/process/curate-log-handler.js +6 -2
  53. package/dist/server/infra/process/feature-handlers.js +1 -0
  54. package/dist/server/infra/process/task-router.d.ts +29 -0
  55. package/dist/server/infra/process/task-router.js +43 -1
  56. package/dist/server/infra/process/transport-handlers.d.ts +4 -2
  57. package/dist/server/infra/process/transport-handlers.js +1 -0
  58. package/dist/server/infra/storage/file-provider-config-store.d.ts +4 -1
  59. package/dist/server/infra/storage/file-provider-config-store.js +5 -2
  60. package/dist/server/infra/transport/handlers/provider-handler.d.ts +9 -0
  61. package/dist/server/infra/transport/handlers/provider-handler.js +63 -2
  62. package/dist/server/infra/transport/handlers/review-handler.d.ts +5 -0
  63. package/dist/server/infra/transport/handlers/review-handler.js +22 -0
  64. package/dist/shared/transport/events/index.d.ts +2 -0
  65. package/dist/shared/transport/events/review-events.d.ts +11 -0
  66. package/dist/shared/transport/events/review-events.js +2 -0
  67. package/dist/shared/transport/types/dto.d.ts +2 -0
  68. package/dist/tui/features/auth/api/get-auth-state.js +6 -3
  69. package/dist/tui/features/auth/components/auth-initializer.js +4 -2
  70. package/dist/tui/features/provider/components/provider-flow.js +30 -5
  71. package/node_modules/@tanstack/query-core/LICENSE +21 -0
  72. package/node_modules/@tanstack/query-core/build/legacy/chunk-PXG64RU4.js +25 -0
  73. package/node_modules/@tanstack/query-core/build/legacy/chunk-PXG64RU4.js.map +1 -0
  74. package/node_modules/@tanstack/query-core/build/legacy/focusManager.cjs +108 -0
  75. package/node_modules/@tanstack/query-core/build/legacy/focusManager.cjs.map +1 -0
  76. package/node_modules/@tanstack/query-core/build/legacy/focusManager.d.cts +17 -0
  77. package/node_modules/@tanstack/query-core/build/legacy/focusManager.d.ts +17 -0
  78. package/node_modules/@tanstack/query-core/build/legacy/focusManager.js +81 -0
  79. package/node_modules/@tanstack/query-core/build/legacy/focusManager.js.map +1 -0
  80. package/node_modules/@tanstack/query-core/build/legacy/hydration-BlEVG2Lp.d.ts +1384 -0
  81. package/node_modules/@tanstack/query-core/build/legacy/hydration-uphG6M-i.d.cts +1384 -0
  82. package/node_modules/@tanstack/query-core/build/legacy/hydration.cjs +178 -0
  83. package/node_modules/@tanstack/query-core/build/legacy/hydration.cjs.map +1 -0
  84. package/node_modules/@tanstack/query-core/build/legacy/hydration.d.cts +3 -0
  85. package/node_modules/@tanstack/query-core/build/legacy/hydration.d.ts +3 -0
  86. package/node_modules/@tanstack/query-core/build/legacy/hydration.js +152 -0
  87. package/node_modules/@tanstack/query-core/build/legacy/hydration.js.map +1 -0
  88. package/node_modules/@tanstack/query-core/build/legacy/index.cjs +110 -0
  89. package/node_modules/@tanstack/query-core/build/legacy/index.cjs.map +1 -0
  90. package/node_modules/@tanstack/query-core/build/legacy/index.d.cts +10 -0
  91. package/node_modules/@tanstack/query-core/build/legacy/index.d.ts +10 -0
  92. package/node_modules/@tanstack/query-core/build/legacy/index.js +73 -0
  93. package/node_modules/@tanstack/query-core/build/legacy/index.js.map +1 -0
  94. package/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.cjs +146 -0
  95. package/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.cjs.map +1 -0
  96. package/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.d.cts +15 -0
  97. package/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.d.ts +15 -0
  98. package/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.js +126 -0
  99. package/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.js.map +1 -0
  100. package/node_modules/@tanstack/query-core/build/legacy/infiniteQueryObserver.cjs +93 -0
  101. package/node_modules/@tanstack/query-core/build/legacy/infiniteQueryObserver.cjs.map +1 -0
  102. package/node_modules/@tanstack/query-core/build/legacy/infiniteQueryObserver.d.cts +20 -0
  103. package/node_modules/@tanstack/query-core/build/legacy/infiniteQueryObserver.d.ts +20 -0
  104. package/node_modules/@tanstack/query-core/build/legacy/infiniteQueryObserver.js +74 -0
  105. package/node_modules/@tanstack/query-core/build/legacy/infiniteQueryObserver.js.map +1 -0
  106. package/node_modules/@tanstack/query-core/build/legacy/mutation.cjs +333 -0
  107. package/node_modules/@tanstack/query-core/build/legacy/mutation.cjs.map +1 -0
  108. package/node_modules/@tanstack/query-core/build/legacy/mutation.d.cts +3 -0
  109. package/node_modules/@tanstack/query-core/build/legacy/mutation.d.ts +3 -0
  110. package/node_modules/@tanstack/query-core/build/legacy/mutation.js +306 -0
  111. package/node_modules/@tanstack/query-core/build/legacy/mutation.js.map +1 -0
  112. package/node_modules/@tanstack/query-core/build/legacy/mutationCache.cjs +170 -0
  113. package/node_modules/@tanstack/query-core/build/legacy/mutationCache.cjs.map +1 -0
  114. package/node_modules/@tanstack/query-core/build/legacy/mutationCache.d.cts +3 -0
  115. package/node_modules/@tanstack/query-core/build/legacy/mutationCache.d.ts +3 -0
  116. package/node_modules/@tanstack/query-core/build/legacy/mutationCache.js +137 -0
  117. package/node_modules/@tanstack/query-core/build/legacy/mutationCache.js.map +1 -0
  118. package/node_modules/@tanstack/query-core/build/legacy/mutationObserver.cjs +190 -0
  119. package/node_modules/@tanstack/query-core/build/legacy/mutationObserver.cjs.map +1 -0
  120. package/node_modules/@tanstack/query-core/build/legacy/mutationObserver.d.cts +3 -0
  121. package/node_modules/@tanstack/query-core/build/legacy/mutationObserver.d.ts +3 -0
  122. package/node_modules/@tanstack/query-core/build/legacy/mutationObserver.js +164 -0
  123. package/node_modules/@tanstack/query-core/build/legacy/mutationObserver.js.map +1 -0
  124. package/node_modules/@tanstack/query-core/build/legacy/notifyManager.cjs +113 -0
  125. package/node_modules/@tanstack/query-core/build/legacy/notifyManager.cjs.map +1 -0
  126. package/node_modules/@tanstack/query-core/build/legacy/notifyManager.d.cts +46 -0
  127. package/node_modules/@tanstack/query-core/build/legacy/notifyManager.d.ts +46 -0
  128. package/node_modules/@tanstack/query-core/build/legacy/notifyManager.js +88 -0
  129. package/node_modules/@tanstack/query-core/build/legacy/notifyManager.js.map +1 -0
  130. package/node_modules/@tanstack/query-core/build/legacy/onlineManager.cjs +97 -0
  131. package/node_modules/@tanstack/query-core/build/legacy/onlineManager.cjs.map +1 -0
  132. package/node_modules/@tanstack/query-core/build/legacy/onlineManager.d.cts +16 -0
  133. package/node_modules/@tanstack/query-core/build/legacy/onlineManager.d.ts +16 -0
  134. package/node_modules/@tanstack/query-core/build/legacy/onlineManager.js +70 -0
  135. package/node_modules/@tanstack/query-core/build/legacy/onlineManager.js.map +1 -0
  136. package/node_modules/@tanstack/query-core/build/legacy/queriesObserver.cjs +260 -0
  137. package/node_modules/@tanstack/query-core/build/legacy/queriesObserver.cjs.map +1 -0
  138. package/node_modules/@tanstack/query-core/build/legacy/queriesObserver.d.cts +27 -0
  139. package/node_modules/@tanstack/query-core/build/legacy/queriesObserver.d.ts +27 -0
  140. package/node_modules/@tanstack/query-core/build/legacy/queriesObserver.js +234 -0
  141. package/node_modules/@tanstack/query-core/build/legacy/queriesObserver.js.map +1 -0
  142. package/node_modules/@tanstack/query-core/build/legacy/query.cjs +478 -0
  143. package/node_modules/@tanstack/query-core/build/legacy/query.cjs.map +1 -0
  144. package/node_modules/@tanstack/query-core/build/legacy/query.d.cts +3 -0
  145. package/node_modules/@tanstack/query-core/build/legacy/query.d.ts +3 -0
  146. package/node_modules/@tanstack/query-core/build/legacy/query.js +459 -0
  147. package/node_modules/@tanstack/query-core/build/legacy/query.js.map +1 -0
  148. package/node_modules/@tanstack/query-core/build/legacy/queryCache.cjs +131 -0
  149. package/node_modules/@tanstack/query-core/build/legacy/queryCache.cjs.map +1 -0
  150. package/node_modules/@tanstack/query-core/build/legacy/queryCache.d.cts +3 -0
  151. package/node_modules/@tanstack/query-core/build/legacy/queryCache.d.ts +3 -0
  152. package/node_modules/@tanstack/query-core/build/legacy/queryCache.js +105 -0
  153. package/node_modules/@tanstack/query-core/build/legacy/queryCache.js.map +1 -0
  154. package/node_modules/@tanstack/query-core/build/legacy/queryClient.cjs +349 -0
  155. package/node_modules/@tanstack/query-core/build/legacy/queryClient.cjs.map +1 -0
  156. package/node_modules/@tanstack/query-core/build/legacy/queryClient.d.cts +3 -0
  157. package/node_modules/@tanstack/query-core/build/legacy/queryClient.d.ts +3 -0
  158. package/node_modules/@tanstack/query-core/build/legacy/queryClient.js +324 -0
  159. package/node_modules/@tanstack/query-core/build/legacy/queryClient.js.map +1 -0
  160. package/node_modules/@tanstack/query-core/build/legacy/queryObserver.cjs +515 -0
  161. package/node_modules/@tanstack/query-core/build/legacy/queryObserver.cjs.map +1 -0
  162. package/node_modules/@tanstack/query-core/build/legacy/queryObserver.d.cts +3 -0
  163. package/node_modules/@tanstack/query-core/build/legacy/queryObserver.d.ts +3 -0
  164. package/node_modules/@tanstack/query-core/build/legacy/queryObserver.js +498 -0
  165. package/node_modules/@tanstack/query-core/build/legacy/queryObserver.js.map +1 -0
  166. package/node_modules/@tanstack/query-core/build/legacy/removable.cjs +69 -0
  167. package/node_modules/@tanstack/query-core/build/legacy/removable.cjs.map +1 -0
  168. package/node_modules/@tanstack/query-core/build/legacy/removable.d.cts +11 -0
  169. package/node_modules/@tanstack/query-core/build/legacy/removable.d.ts +11 -0
  170. package/node_modules/@tanstack/query-core/build/legacy/removable.js +43 -0
  171. package/node_modules/@tanstack/query-core/build/legacy/removable.js.map +1 -0
  172. package/node_modules/@tanstack/query-core/build/legacy/retryer.cjs +165 -0
  173. package/node_modules/@tanstack/query-core/build/legacy/retryer.cjs.map +1 -0
  174. package/node_modules/@tanstack/query-core/build/legacy/retryer.d.cts +3 -0
  175. package/node_modules/@tanstack/query-core/build/legacy/retryer.d.ts +3 -0
  176. package/node_modules/@tanstack/query-core/build/legacy/retryer.js +139 -0
  177. package/node_modules/@tanstack/query-core/build/legacy/retryer.js.map +1 -0
  178. package/node_modules/@tanstack/query-core/build/legacy/streamedQuery.cjs +82 -0
  179. package/node_modules/@tanstack/query-core/build/legacy/streamedQuery.cjs.map +1 -0
  180. package/node_modules/@tanstack/query-core/build/legacy/streamedQuery.d.cts +34 -0
  181. package/node_modules/@tanstack/query-core/build/legacy/streamedQuery.d.ts +34 -0
  182. package/node_modules/@tanstack/query-core/build/legacy/streamedQuery.js +59 -0
  183. package/node_modules/@tanstack/query-core/build/legacy/streamedQuery.js.map +1 -0
  184. package/node_modules/@tanstack/query-core/build/legacy/subscribable.cjs +51 -0
  185. package/node_modules/@tanstack/query-core/build/legacy/subscribable.cjs.map +1 -0
  186. package/node_modules/@tanstack/query-core/build/legacy/subscribable.d.cts +10 -0
  187. package/node_modules/@tanstack/query-core/build/legacy/subscribable.d.ts +10 -0
  188. package/node_modules/@tanstack/query-core/build/legacy/subscribable.js +28 -0
  189. package/node_modules/@tanstack/query-core/build/legacy/subscribable.js.map +1 -0
  190. package/node_modules/@tanstack/query-core/build/legacy/thenable.cjs +76 -0
  191. package/node_modules/@tanstack/query-core/build/legacy/thenable.cjs.map +1 -0
  192. package/node_modules/@tanstack/query-core/build/legacy/thenable.d.cts +47 -0
  193. package/node_modules/@tanstack/query-core/build/legacy/thenable.d.ts +47 -0
  194. package/node_modules/@tanstack/query-core/build/legacy/thenable.js +52 -0
  195. package/node_modules/@tanstack/query-core/build/legacy/thenable.js.map +1 -0
  196. package/node_modules/@tanstack/query-core/build/legacy/timeoutManager.cjs +110 -0
  197. package/node_modules/@tanstack/query-core/build/legacy/timeoutManager.cjs.map +1 -0
  198. package/node_modules/@tanstack/query-core/build/legacy/timeoutManager.d.cts +58 -0
  199. package/node_modules/@tanstack/query-core/build/legacy/timeoutManager.d.ts +58 -0
  200. package/node_modules/@tanstack/query-core/build/legacy/timeoutManager.js +81 -0
  201. package/node_modules/@tanstack/query-core/build/legacy/timeoutManager.js.map +1 -0
  202. package/node_modules/@tanstack/query-core/build/legacy/types.cjs +37 -0
  203. package/node_modules/@tanstack/query-core/build/legacy/types.cjs.map +1 -0
  204. package/node_modules/@tanstack/query-core/build/legacy/types.d.cts +3 -0
  205. package/node_modules/@tanstack/query-core/build/legacy/types.d.ts +3 -0
  206. package/node_modules/@tanstack/query-core/build/legacy/types.js +12 -0
  207. package/node_modules/@tanstack/query-core/build/legacy/types.js.map +1 -0
  208. package/node_modules/@tanstack/query-core/build/legacy/utils.cjs +330 -0
  209. package/node_modules/@tanstack/query-core/build/legacy/utils.cjs.map +1 -0
  210. package/node_modules/@tanstack/query-core/build/legacy/utils.d.cts +3 -0
  211. package/node_modules/@tanstack/query-core/build/legacy/utils.d.ts +3 -0
  212. package/node_modules/@tanstack/query-core/build/legacy/utils.js +283 -0
  213. package/node_modules/@tanstack/query-core/build/legacy/utils.js.map +1 -0
  214. package/node_modules/@tanstack/query-core/build/modern/focusManager.cjs +94 -0
  215. package/node_modules/@tanstack/query-core/build/modern/focusManager.cjs.map +1 -0
  216. package/node_modules/@tanstack/query-core/build/modern/focusManager.d.cts +17 -0
  217. package/node_modules/@tanstack/query-core/build/modern/focusManager.d.ts +17 -0
  218. package/node_modules/@tanstack/query-core/build/modern/focusManager.js +68 -0
  219. package/node_modules/@tanstack/query-core/build/modern/focusManager.js.map +1 -0
  220. package/node_modules/@tanstack/query-core/build/modern/hydration-BlEVG2Lp.d.ts +1384 -0
  221. package/node_modules/@tanstack/query-core/build/modern/hydration-uphG6M-i.d.cts +1384 -0
  222. package/node_modules/@tanstack/query-core/build/modern/hydration.cjs +173 -0
  223. package/node_modules/@tanstack/query-core/build/modern/hydration.cjs.map +1 -0
  224. package/node_modules/@tanstack/query-core/build/modern/hydration.d.cts +3 -0
  225. package/node_modules/@tanstack/query-core/build/modern/hydration.d.ts +3 -0
  226. package/node_modules/@tanstack/query-core/build/modern/hydration.js +145 -0
  227. package/node_modules/@tanstack/query-core/build/modern/hydration.js.map +1 -0
  228. package/node_modules/@tanstack/query-core/build/modern/index.cjs +110 -0
  229. package/node_modules/@tanstack/query-core/build/modern/index.cjs.map +1 -0
  230. package/node_modules/@tanstack/query-core/build/modern/index.d.cts +10 -0
  231. package/node_modules/@tanstack/query-core/build/modern/index.d.ts +10 -0
  232. package/node_modules/@tanstack/query-core/build/modern/index.js +71 -0
  233. package/node_modules/@tanstack/query-core/build/modern/index.js.map +1 -0
  234. package/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.cjs +142 -0
  235. package/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.cjs.map +1 -0
  236. package/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.d.cts +15 -0
  237. package/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.d.ts +15 -0
  238. package/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js +120 -0
  239. package/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js.map +1 -0
  240. package/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.cjs +92 -0
  241. package/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.cjs.map +1 -0
  242. package/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.d.cts +20 -0
  243. package/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.d.ts +20 -0
  244. package/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js +71 -0
  245. package/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js.map +1 -0
  246. package/node_modules/@tanstack/query-core/build/modern/mutation.cjs +307 -0
  247. package/node_modules/@tanstack/query-core/build/modern/mutation.cjs.map +1 -0
  248. package/node_modules/@tanstack/query-core/build/modern/mutation.d.cts +3 -0
  249. package/node_modules/@tanstack/query-core/build/modern/mutation.d.ts +3 -0
  250. package/node_modules/@tanstack/query-core/build/modern/mutation.js +281 -0
  251. package/node_modules/@tanstack/query-core/build/modern/mutation.js.map +1 -0
  252. package/node_modules/@tanstack/query-core/build/modern/mutationCache.cjs +149 -0
  253. package/node_modules/@tanstack/query-core/build/modern/mutationCache.cjs.map +1 -0
  254. package/node_modules/@tanstack/query-core/build/modern/mutationCache.d.cts +3 -0
  255. package/node_modules/@tanstack/query-core/build/modern/mutationCache.d.ts +3 -0
  256. package/node_modules/@tanstack/query-core/build/modern/mutationCache.js +124 -0
  257. package/node_modules/@tanstack/query-core/build/modern/mutationCache.js.map +1 -0
  258. package/node_modules/@tanstack/query-core/build/modern/mutationObserver.cjs +165 -0
  259. package/node_modules/@tanstack/query-core/build/modern/mutationObserver.cjs.map +1 -0
  260. package/node_modules/@tanstack/query-core/build/modern/mutationObserver.d.cts +3 -0
  261. package/node_modules/@tanstack/query-core/build/modern/mutationObserver.d.ts +3 -0
  262. package/node_modules/@tanstack/query-core/build/modern/mutationObserver.js +140 -0
  263. package/node_modules/@tanstack/query-core/build/modern/mutationObserver.js.map +1 -0
  264. package/node_modules/@tanstack/query-core/build/modern/notifyManager.cjs +113 -0
  265. package/node_modules/@tanstack/query-core/build/modern/notifyManager.cjs.map +1 -0
  266. package/node_modules/@tanstack/query-core/build/modern/notifyManager.d.cts +46 -0
  267. package/node_modules/@tanstack/query-core/build/modern/notifyManager.d.ts +46 -0
  268. package/node_modules/@tanstack/query-core/build/modern/notifyManager.js +86 -0
  269. package/node_modules/@tanstack/query-core/build/modern/notifyManager.js.map +1 -0
  270. package/node_modules/@tanstack/query-core/build/modern/onlineManager.cjs +84 -0
  271. package/node_modules/@tanstack/query-core/build/modern/onlineManager.cjs.map +1 -0
  272. package/node_modules/@tanstack/query-core/build/modern/onlineManager.d.cts +16 -0
  273. package/node_modules/@tanstack/query-core/build/modern/onlineManager.d.ts +16 -0
  274. package/node_modules/@tanstack/query-core/build/modern/onlineManager.js +58 -0
  275. package/node_modules/@tanstack/query-core/build/modern/onlineManager.js.map +1 -0
  276. package/node_modules/@tanstack/query-core/build/modern/queriesObserver.cjs +237 -0
  277. package/node_modules/@tanstack/query-core/build/modern/queriesObserver.cjs.map +1 -0
  278. package/node_modules/@tanstack/query-core/build/modern/queriesObserver.d.cts +27 -0
  279. package/node_modules/@tanstack/query-core/build/modern/queriesObserver.d.ts +27 -0
  280. package/node_modules/@tanstack/query-core/build/modern/queriesObserver.js +212 -0
  281. package/node_modules/@tanstack/query-core/build/modern/queriesObserver.js.map +1 -0
  282. package/node_modules/@tanstack/query-core/build/modern/query.cjs +452 -0
  283. package/node_modules/@tanstack/query-core/build/modern/query.cjs.map +1 -0
  284. package/node_modules/@tanstack/query-core/build/modern/query.d.cts +3 -0
  285. package/node_modules/@tanstack/query-core/build/modern/query.d.ts +3 -0
  286. package/node_modules/@tanstack/query-core/build/modern/query.js +434 -0
  287. package/node_modules/@tanstack/query-core/build/modern/query.js.map +1 -0
  288. package/node_modules/@tanstack/query-core/build/modern/queryCache.cjs +122 -0
  289. package/node_modules/@tanstack/query-core/build/modern/queryCache.cjs.map +1 -0
  290. package/node_modules/@tanstack/query-core/build/modern/queryCache.d.cts +3 -0
  291. package/node_modules/@tanstack/query-core/build/modern/queryCache.d.ts +3 -0
  292. package/node_modules/@tanstack/query-core/build/modern/queryCache.js +97 -0
  293. package/node_modules/@tanstack/query-core/build/modern/queryCache.js.map +1 -0
  294. package/node_modules/@tanstack/query-core/build/modern/queryClient.cjs +322 -0
  295. package/node_modules/@tanstack/query-core/build/modern/queryClient.cjs.map +1 -0
  296. package/node_modules/@tanstack/query-core/build/modern/queryClient.d.cts +3 -0
  297. package/node_modules/@tanstack/query-core/build/modern/queryClient.d.ts +3 -0
  298. package/node_modules/@tanstack/query-core/build/modern/queryClient.js +305 -0
  299. package/node_modules/@tanstack/query-core/build/modern/queryClient.js.map +1 -0
  300. package/node_modules/@tanstack/query-core/build/modern/queryObserver.cjs +488 -0
  301. package/node_modules/@tanstack/query-core/build/modern/queryObserver.cjs.map +1 -0
  302. package/node_modules/@tanstack/query-core/build/modern/queryObserver.d.cts +3 -0
  303. package/node_modules/@tanstack/query-core/build/modern/queryObserver.d.ts +3 -0
  304. package/node_modules/@tanstack/query-core/build/modern/queryObserver.js +472 -0
  305. package/node_modules/@tanstack/query-core/build/modern/queryObserver.js.map +1 -0
  306. package/node_modules/@tanstack/query-core/build/modern/removable.cjs +58 -0
  307. package/node_modules/@tanstack/query-core/build/modern/removable.cjs.map +1 -0
  308. package/node_modules/@tanstack/query-core/build/modern/removable.d.cts +11 -0
  309. package/node_modules/@tanstack/query-core/build/modern/removable.d.ts +11 -0
  310. package/node_modules/@tanstack/query-core/build/modern/removable.js +33 -0
  311. package/node_modules/@tanstack/query-core/build/modern/removable.js.map +1 -0
  312. package/node_modules/@tanstack/query-core/build/modern/retryer.cjs +161 -0
  313. package/node_modules/@tanstack/query-core/build/modern/retryer.cjs.map +1 -0
  314. package/node_modules/@tanstack/query-core/build/modern/retryer.d.cts +3 -0
  315. package/node_modules/@tanstack/query-core/build/modern/retryer.d.ts +3 -0
  316. package/node_modules/@tanstack/query-core/build/modern/retryer.js +133 -0
  317. package/node_modules/@tanstack/query-core/build/modern/retryer.js.map +1 -0
  318. package/node_modules/@tanstack/query-core/build/modern/streamedQuery.cjs +82 -0
  319. package/node_modules/@tanstack/query-core/build/modern/streamedQuery.cjs.map +1 -0
  320. package/node_modules/@tanstack/query-core/build/modern/streamedQuery.d.cts +34 -0
  321. package/node_modules/@tanstack/query-core/build/modern/streamedQuery.d.ts +34 -0
  322. package/node_modules/@tanstack/query-core/build/modern/streamedQuery.js +57 -0
  323. package/node_modules/@tanstack/query-core/build/modern/streamedQuery.js.map +1 -0
  324. package/node_modules/@tanstack/query-core/build/modern/subscribable.cjs +51 -0
  325. package/node_modules/@tanstack/query-core/build/modern/subscribable.cjs.map +1 -0
  326. package/node_modules/@tanstack/query-core/build/modern/subscribable.d.cts +10 -0
  327. package/node_modules/@tanstack/query-core/build/modern/subscribable.d.ts +10 -0
  328. package/node_modules/@tanstack/query-core/build/modern/subscribable.js +26 -0
  329. package/node_modules/@tanstack/query-core/build/modern/subscribable.js.map +1 -0
  330. package/node_modules/@tanstack/query-core/build/modern/thenable.cjs +75 -0
  331. package/node_modules/@tanstack/query-core/build/modern/thenable.cjs.map +1 -0
  332. package/node_modules/@tanstack/query-core/build/modern/thenable.d.cts +47 -0
  333. package/node_modules/@tanstack/query-core/build/modern/thenable.d.ts +47 -0
  334. package/node_modules/@tanstack/query-core/build/modern/thenable.js +49 -0
  335. package/node_modules/@tanstack/query-core/build/modern/thenable.js.map +1 -0
  336. package/node_modules/@tanstack/query-core/build/modern/timeoutManager.cjs +98 -0
  337. package/node_modules/@tanstack/query-core/build/modern/timeoutManager.cjs.map +1 -0
  338. package/node_modules/@tanstack/query-core/build/modern/timeoutManager.d.cts +58 -0
  339. package/node_modules/@tanstack/query-core/build/modern/timeoutManager.d.ts +58 -0
  340. package/node_modules/@tanstack/query-core/build/modern/timeoutManager.js +70 -0
  341. package/node_modules/@tanstack/query-core/build/modern/timeoutManager.js.map +1 -0
  342. package/node_modules/@tanstack/query-core/build/modern/types.cjs +37 -0
  343. package/node_modules/@tanstack/query-core/build/modern/types.cjs.map +1 -0
  344. package/node_modules/@tanstack/query-core/build/modern/types.d.cts +3 -0
  345. package/node_modules/@tanstack/query-core/build/modern/types.d.ts +3 -0
  346. package/node_modules/@tanstack/query-core/build/modern/types.js +10 -0
  347. package/node_modules/@tanstack/query-core/build/modern/types.js.map +1 -0
  348. package/node_modules/@tanstack/query-core/build/modern/utils.cjs +330 -0
  349. package/node_modules/@tanstack/query-core/build/modern/utils.cjs.map +1 -0
  350. package/node_modules/@tanstack/query-core/build/modern/utils.d.cts +3 -0
  351. package/node_modules/@tanstack/query-core/build/modern/utils.d.ts +3 -0
  352. package/node_modules/@tanstack/query-core/build/modern/utils.js +281 -0
  353. package/node_modules/@tanstack/query-core/build/modern/utils.js.map +1 -0
  354. package/node_modules/@tanstack/query-core/package.json +65 -0
  355. package/node_modules/@tanstack/query-core/src/focusManager.ts +86 -0
  356. package/node_modules/@tanstack/query-core/src/hydration.ts +285 -0
  357. package/node_modules/@tanstack/query-core/src/index.ts +55 -0
  358. package/node_modules/@tanstack/query-core/src/infiniteQueryBehavior.ts +176 -0
  359. package/node_modules/@tanstack/query-core/src/infiniteQueryObserver.ts +190 -0
  360. package/node_modules/@tanstack/query-core/src/mutation.ts +419 -0
  361. package/node_modules/@tanstack/query-core/src/mutationCache.ts +244 -0
  362. package/node_modules/@tanstack/query-core/src/mutationObserver.ts +227 -0
  363. package/node_modules/@tanstack/query-core/src/notifyManager.ts +99 -0
  364. package/node_modules/@tanstack/query-core/src/onlineManager.ts +71 -0
  365. package/node_modules/@tanstack/query-core/src/queriesObserver.ts +315 -0
  366. package/node_modules/@tanstack/query-core/src/query.ts +756 -0
  367. package/node_modules/@tanstack/query-core/src/queryCache.ts +223 -0
  368. package/node_modules/@tanstack/query-core/src/queryClient.ts +648 -0
  369. package/node_modules/@tanstack/query-core/src/queryObserver.ts +828 -0
  370. package/node_modules/@tanstack/query-core/src/removable.ts +39 -0
  371. package/node_modules/@tanstack/query-core/src/retryer.ts +228 -0
  372. package/node_modules/@tanstack/query-core/src/streamedQuery.ts +122 -0
  373. package/node_modules/@tanstack/query-core/src/subscribable.ts +30 -0
  374. package/node_modules/@tanstack/query-core/src/thenable.ts +111 -0
  375. package/node_modules/@tanstack/query-core/src/timeoutManager.ts +135 -0
  376. package/node_modules/@tanstack/query-core/src/types.ts +1391 -0
  377. package/node_modules/@tanstack/query-core/src/utils.ts +499 -0
  378. package/node_modules/@tanstack/react-query/LICENSE +21 -0
  379. package/node_modules/@tanstack/react-query/README.md +48 -0
  380. package/node_modules/@tanstack/react-query/build/codemods/src/utils/index.cjs +208 -0
  381. package/node_modules/@tanstack/react-query/build/codemods/src/utils/transformers/query-cache-transformer.cjs +124 -0
  382. package/node_modules/@tanstack/react-query/build/codemods/src/utils/transformers/query-client-transformer.cjs +53 -0
  383. package/node_modules/@tanstack/react-query/build/codemods/src/utils/transformers/use-query-like-transformer.cjs +38 -0
  384. package/node_modules/@tanstack/react-query/build/codemods/src/v4/key-transformation.cjs +181 -0
  385. package/node_modules/@tanstack/react-query/build/codemods/src/v4/replace-import-specifier.cjs +25 -0
  386. package/node_modules/@tanstack/react-query/build/codemods/src/v4/utils/replacers/key-replacer.cjs +164 -0
  387. package/node_modules/@tanstack/react-query/build/codemods/src/v5/is-loading/is-loading.cjs +244 -0
  388. package/node_modules/@tanstack/react-query/build/codemods/src/v5/keep-previous-data/README.md +32 -0
  389. package/node_modules/@tanstack/react-query/build/codemods/src/v5/keep-previous-data/keep-previous-data.cjs +271 -0
  390. package/node_modules/@tanstack/react-query/build/codemods/src/v5/keep-previous-data/utils/already-has-placeholder-data-property.cjs +26 -0
  391. package/node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/remove-overloads.cjs +58 -0
  392. package/node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/transformers/filter-aware-usage-transformer.cjs +271 -0
  393. package/node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/transformers/query-fn-aware-usage-transformer.cjs +185 -0
  394. package/node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/utils/index.cjs +123 -0
  395. package/node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/utils/unknown-usage-error.cjs +27 -0
  396. package/node_modules/@tanstack/react-query/build/codemods/src/v5/rename-hydrate/rename-hydrate.cjs +55 -0
  397. package/node_modules/@tanstack/react-query/build/codemods/src/v5/rename-properties/rename-properties.cjs +41 -0
  398. package/node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.cjs +91 -0
  399. package/node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.cjs.map +1 -0
  400. package/node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.d.cts +14 -0
  401. package/node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.d.ts +14 -0
  402. package/node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.js +57 -0
  403. package/node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.js.map +1 -0
  404. package/node_modules/@tanstack/react-query/build/legacy/IsRestoringProvider.cjs +47 -0
  405. package/node_modules/@tanstack/react-query/build/legacy/IsRestoringProvider.cjs.map +1 -0
  406. package/node_modules/@tanstack/react-query/build/legacy/IsRestoringProvider.d.cts +6 -0
  407. package/node_modules/@tanstack/react-query/build/legacy/IsRestoringProvider.d.ts +6 -0
  408. package/node_modules/@tanstack/react-query/build/legacy/IsRestoringProvider.js +12 -0
  409. package/node_modules/@tanstack/react-query/build/legacy/IsRestoringProvider.js.map +1 -0
  410. package/node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.cjs +72 -0
  411. package/node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.cjs.map +1 -0
  412. package/node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.d.cts +12 -0
  413. package/node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.d.ts +12 -0
  414. package/node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.js +36 -0
  415. package/node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.js.map +1 -0
  416. package/node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.cjs +67 -0
  417. package/node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.cjs.map +1 -0
  418. package/node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.d.cts +19 -0
  419. package/node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.d.ts +19 -0
  420. package/node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.js +32 -0
  421. package/node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.js.map +1 -0
  422. package/node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.cjs +69 -0
  423. package/node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.cjs.map +1 -0
  424. package/node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.d.cts +16 -0
  425. package/node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.d.ts +16 -0
  426. package/node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.js +33 -0
  427. package/node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.js.map +1 -0
  428. package/node_modules/@tanstack/react-query/build/legacy/index.cjs +97 -0
  429. package/node_modules/@tanstack/react-query/build/legacy/index.cjs.map +1 -0
  430. package/node_modules/@tanstack/react-query/build/legacy/index.d.cts +22 -0
  431. package/node_modules/@tanstack/react-query/build/legacy/index.d.ts +22 -0
  432. package/node_modules/@tanstack/react-query/build/legacy/index.js +54 -0
  433. package/node_modules/@tanstack/react-query/build/legacy/index.js.map +1 -0
  434. package/node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.cjs +33 -0
  435. package/node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.cjs.map +1 -0
  436. package/node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.d.cts +23 -0
  437. package/node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.d.ts +23 -0
  438. package/node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.js +8 -0
  439. package/node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.js.map +1 -0
  440. package/node_modules/@tanstack/react-query/build/legacy/mutationOptions.cjs +33 -0
  441. package/node_modules/@tanstack/react-query/build/legacy/mutationOptions.cjs.map +1 -0
  442. package/node_modules/@tanstack/react-query/build/legacy/mutationOptions.d.cts +7 -0
  443. package/node_modules/@tanstack/react-query/build/legacy/mutationOptions.d.ts +7 -0
  444. package/node_modules/@tanstack/react-query/build/legacy/mutationOptions.js +8 -0
  445. package/node_modules/@tanstack/react-query/build/legacy/mutationOptions.js.map +1 -0
  446. package/node_modules/@tanstack/react-query/build/legacy/queryOptions.cjs +33 -0
  447. package/node_modules/@tanstack/react-query/build/legacy/queryOptions.cjs.map +1 -0
  448. package/node_modules/@tanstack/react-query/build/legacy/queryOptions.d.cts +24 -0
  449. package/node_modules/@tanstack/react-query/build/legacy/queryOptions.d.ts +24 -0
  450. package/node_modules/@tanstack/react-query/build/legacy/queryOptions.js +8 -0
  451. package/node_modules/@tanstack/react-query/build/legacy/queryOptions.js.map +1 -0
  452. package/node_modules/@tanstack/react-query/build/legacy/suspense.cjs +58 -0
  453. package/node_modules/@tanstack/react-query/build/legacy/suspense.cjs.map +1 -0
  454. package/node_modules/@tanstack/react-query/build/legacy/suspense.d.cts +12 -0
  455. package/node_modules/@tanstack/react-query/build/legacy/suspense.d.ts +12 -0
  456. package/node_modules/@tanstack/react-query/build/legacy/suspense.js +29 -0
  457. package/node_modules/@tanstack/react-query/build/legacy/suspense.js.map +1 -0
  458. package/node_modules/@tanstack/react-query/build/legacy/types.cjs +19 -0
  459. package/node_modules/@tanstack/react-query/build/legacy/types.cjs.map +1 -0
  460. package/node_modules/@tanstack/react-query/build/legacy/types.d.cts +52 -0
  461. package/node_modules/@tanstack/react-query/build/legacy/types.d.ts +52 -0
  462. package/node_modules/@tanstack/react-query/build/legacy/types.js +1 -0
  463. package/node_modules/@tanstack/react-query/build/legacy/types.js.map +1 -0
  464. package/node_modules/@tanstack/react-query/build/legacy/useBaseQuery.cjs +133 -0
  465. package/node_modules/@tanstack/react-query/build/legacy/useBaseQuery.cjs.map +1 -0
  466. package/node_modules/@tanstack/react-query/build/legacy/useBaseQuery.d.cts +6 -0
  467. package/node_modules/@tanstack/react-query/build/legacy/useBaseQuery.d.ts +6 -0
  468. package/node_modules/@tanstack/react-query/build/legacy/useBaseQuery.js +108 -0
  469. package/node_modules/@tanstack/react-query/build/legacy/useBaseQuery.js.map +1 -0
  470. package/node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.cjs +40 -0
  471. package/node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.cjs.map +1 -0
  472. package/node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.d.cts +9 -0
  473. package/node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.d.ts +9 -0
  474. package/node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.js +16 -0
  475. package/node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.js.map +1 -0
  476. package/node_modules/@tanstack/react-query/build/legacy/useIsFetching.cjs +56 -0
  477. package/node_modules/@tanstack/react-query/build/legacy/useIsFetching.cjs.map +1 -0
  478. package/node_modules/@tanstack/react-query/build/legacy/useIsFetching.d.cts +5 -0
  479. package/node_modules/@tanstack/react-query/build/legacy/useIsFetching.d.ts +5 -0
  480. package/node_modules/@tanstack/react-query/build/legacy/useIsFetching.js +22 -0
  481. package/node_modules/@tanstack/react-query/build/legacy/useIsFetching.js.map +1 -0
  482. package/node_modules/@tanstack/react-query/build/legacy/useMutation.cjs +74 -0
  483. package/node_modules/@tanstack/react-query/build/legacy/useMutation.cjs.map +1 -0
  484. package/node_modules/@tanstack/react-query/build/legacy/useMutation.d.cts +6 -0
  485. package/node_modules/@tanstack/react-query/build/legacy/useMutation.d.ts +6 -0
  486. package/node_modules/@tanstack/react-query/build/legacy/useMutation.js +45 -0
  487. package/node_modules/@tanstack/react-query/build/legacy/useMutation.js.map +1 -0
  488. package/node_modules/@tanstack/react-query/build/legacy/useMutationState.cjs +86 -0
  489. package/node_modules/@tanstack/react-query/build/legacy/useMutationState.cjs.map +1 -0
  490. package/node_modules/@tanstack/react-query/build/legacy/useMutationState.d.cts +10 -0
  491. package/node_modules/@tanstack/react-query/build/legacy/useMutationState.d.ts +10 -0
  492. package/node_modules/@tanstack/react-query/build/legacy/useMutationState.js +51 -0
  493. package/node_modules/@tanstack/react-query/build/legacy/useMutationState.js.map +1 -0
  494. package/node_modules/@tanstack/react-query/build/legacy/usePrefetchInfiniteQuery.cjs +37 -0
  495. package/node_modules/@tanstack/react-query/build/legacy/usePrefetchInfiniteQuery.cjs.map +1 -0
  496. package/node_modules/@tanstack/react-query/build/legacy/usePrefetchInfiniteQuery.d.cts +5 -0
  497. package/node_modules/@tanstack/react-query/build/legacy/usePrefetchInfiniteQuery.d.ts +5 -0
  498. package/node_modules/@tanstack/react-query/build/legacy/usePrefetchInfiniteQuery.js +12 -0
  499. package/node_modules/@tanstack/react-query/build/legacy/usePrefetchInfiniteQuery.js.map +1 -0
  500. package/node_modules/@tanstack/react-query/build/legacy/usePrefetchQuery.cjs +37 -0
  501. package/node_modules/@tanstack/react-query/build/legacy/usePrefetchQuery.cjs.map +1 -0
  502. package/node_modules/@tanstack/react-query/build/legacy/usePrefetchQuery.d.cts +6 -0
  503. package/node_modules/@tanstack/react-query/build/legacy/usePrefetchQuery.d.ts +6 -0
  504. package/node_modules/@tanstack/react-query/build/legacy/usePrefetchQuery.js +12 -0
  505. package/node_modules/@tanstack/react-query/build/legacy/usePrefetchQuery.js.map +1 -0
  506. package/node_modules/@tanstack/react-query/build/legacy/useQueries.cjs +132 -0
  507. package/node_modules/@tanstack/react-query/build/legacy/useQueries.cjs.map +1 -0
  508. package/node_modules/@tanstack/react-query/build/legacy/useQueries.d.cts +76 -0
  509. package/node_modules/@tanstack/react-query/build/legacy/useQueries.d.ts +76 -0
  510. package/node_modules/@tanstack/react-query/build/legacy/useQueries.js +112 -0
  511. package/node_modules/@tanstack/react-query/build/legacy/useQueries.js.map +1 -0
  512. package/node_modules/@tanstack/react-query/build/legacy/useQuery.cjs +36 -0
  513. package/node_modules/@tanstack/react-query/build/legacy/useQuery.cjs.map +1 -0
  514. package/node_modules/@tanstack/react-query/build/legacy/useQuery.d.cts +9 -0
  515. package/node_modules/@tanstack/react-query/build/legacy/useQuery.d.ts +9 -0
  516. package/node_modules/@tanstack/react-query/build/legacy/useQuery.js +12 -0
  517. package/node_modules/@tanstack/react-query/build/legacy/useQuery.js.map +1 -0
  518. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseInfiniteQuery.cjs +51 -0
  519. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseInfiniteQuery.cjs.map +1 -0
  520. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseInfiniteQuery.d.cts +6 -0
  521. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseInfiniteQuery.d.ts +6 -0
  522. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseInfiniteQuery.js +27 -0
  523. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseInfiniteQuery.js.map +1 -0
  524. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseQueries.cjs +56 -0
  525. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseQueries.cjs.map +1 -0
  526. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseQueries.d.cts +79 -0
  527. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseQueries.d.ts +79 -0
  528. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseQueries.js +32 -0
  529. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseQueries.js.map +1 -0
  530. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseQuery.cjs +52 -0
  531. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseQuery.cjs.map +1 -0
  532. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseQuery.d.cts +6 -0
  533. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseQuery.d.ts +6 -0
  534. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseQuery.js +28 -0
  535. package/node_modules/@tanstack/react-query/build/legacy/useSuspenseQuery.js.map +1 -0
  536. package/node_modules/@tanstack/react-query/build/modern/HydrationBoundary.cjs +91 -0
  537. package/node_modules/@tanstack/react-query/build/modern/HydrationBoundary.cjs.map +1 -0
  538. package/node_modules/@tanstack/react-query/build/modern/HydrationBoundary.d.cts +14 -0
  539. package/node_modules/@tanstack/react-query/build/modern/HydrationBoundary.d.ts +14 -0
  540. package/node_modules/@tanstack/react-query/build/modern/HydrationBoundary.js +57 -0
  541. package/node_modules/@tanstack/react-query/build/modern/HydrationBoundary.js.map +1 -0
  542. package/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.cjs +47 -0
  543. package/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.cjs.map +1 -0
  544. package/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.d.cts +6 -0
  545. package/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.d.ts +6 -0
  546. package/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js +12 -0
  547. package/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js.map +1 -0
  548. package/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.cjs +72 -0
  549. package/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.cjs.map +1 -0
  550. package/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.d.cts +12 -0
  551. package/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.d.ts +12 -0
  552. package/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js +36 -0
  553. package/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js.map +1 -0
  554. package/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.cjs +67 -0
  555. package/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.cjs.map +1 -0
  556. package/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.d.cts +19 -0
  557. package/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.d.ts +19 -0
  558. package/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js +32 -0
  559. package/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js.map +1 -0
  560. package/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.cjs +69 -0
  561. package/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.cjs.map +1 -0
  562. package/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.d.cts +16 -0
  563. package/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.d.ts +16 -0
  564. package/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js +33 -0
  565. package/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js.map +1 -0
  566. package/node_modules/@tanstack/react-query/build/modern/index.cjs +97 -0
  567. package/node_modules/@tanstack/react-query/build/modern/index.cjs.map +1 -0
  568. package/node_modules/@tanstack/react-query/build/modern/index.d.cts +22 -0
  569. package/node_modules/@tanstack/react-query/build/modern/index.d.ts +22 -0
  570. package/node_modules/@tanstack/react-query/build/modern/index.js +54 -0
  571. package/node_modules/@tanstack/react-query/build/modern/index.js.map +1 -0
  572. package/node_modules/@tanstack/react-query/build/modern/infiniteQueryOptions.cjs +33 -0
  573. package/node_modules/@tanstack/react-query/build/modern/infiniteQueryOptions.cjs.map +1 -0
  574. package/node_modules/@tanstack/react-query/build/modern/infiniteQueryOptions.d.cts +23 -0
  575. package/node_modules/@tanstack/react-query/build/modern/infiniteQueryOptions.d.ts +23 -0
  576. package/node_modules/@tanstack/react-query/build/modern/infiniteQueryOptions.js +8 -0
  577. package/node_modules/@tanstack/react-query/build/modern/infiniteQueryOptions.js.map +1 -0
  578. package/node_modules/@tanstack/react-query/build/modern/mutationOptions.cjs +33 -0
  579. package/node_modules/@tanstack/react-query/build/modern/mutationOptions.cjs.map +1 -0
  580. package/node_modules/@tanstack/react-query/build/modern/mutationOptions.d.cts +7 -0
  581. package/node_modules/@tanstack/react-query/build/modern/mutationOptions.d.ts +7 -0
  582. package/node_modules/@tanstack/react-query/build/modern/mutationOptions.js +8 -0
  583. package/node_modules/@tanstack/react-query/build/modern/mutationOptions.js.map +1 -0
  584. package/node_modules/@tanstack/react-query/build/modern/queryOptions.cjs +33 -0
  585. package/node_modules/@tanstack/react-query/build/modern/queryOptions.cjs.map +1 -0
  586. package/node_modules/@tanstack/react-query/build/modern/queryOptions.d.cts +24 -0
  587. package/node_modules/@tanstack/react-query/build/modern/queryOptions.d.ts +24 -0
  588. package/node_modules/@tanstack/react-query/build/modern/queryOptions.js +8 -0
  589. package/node_modules/@tanstack/react-query/build/modern/queryOptions.js.map +1 -0
  590. package/node_modules/@tanstack/react-query/build/modern/suspense.cjs +58 -0
  591. package/node_modules/@tanstack/react-query/build/modern/suspense.cjs.map +1 -0
  592. package/node_modules/@tanstack/react-query/build/modern/suspense.d.cts +12 -0
  593. package/node_modules/@tanstack/react-query/build/modern/suspense.d.ts +12 -0
  594. package/node_modules/@tanstack/react-query/build/modern/suspense.js +29 -0
  595. package/node_modules/@tanstack/react-query/build/modern/suspense.js.map +1 -0
  596. package/node_modules/@tanstack/react-query/build/modern/types.cjs +19 -0
  597. package/node_modules/@tanstack/react-query/build/modern/types.cjs.map +1 -0
  598. package/node_modules/@tanstack/react-query/build/modern/types.d.cts +52 -0
  599. package/node_modules/@tanstack/react-query/build/modern/types.d.ts +52 -0
  600. package/node_modules/@tanstack/react-query/build/modern/types.js +1 -0
  601. package/node_modules/@tanstack/react-query/build/modern/types.js.map +1 -0
  602. package/node_modules/@tanstack/react-query/build/modern/useBaseQuery.cjs +130 -0
  603. package/node_modules/@tanstack/react-query/build/modern/useBaseQuery.cjs.map +1 -0
  604. package/node_modules/@tanstack/react-query/build/modern/useBaseQuery.d.cts +6 -0
  605. package/node_modules/@tanstack/react-query/build/modern/useBaseQuery.d.ts +6 -0
  606. package/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js +105 -0
  607. package/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js.map +1 -0
  608. package/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.cjs +40 -0
  609. package/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.cjs.map +1 -0
  610. package/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.d.cts +9 -0
  611. package/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.d.ts +9 -0
  612. package/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js +16 -0
  613. package/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js.map +1 -0
  614. package/node_modules/@tanstack/react-query/build/modern/useIsFetching.cjs +56 -0
  615. package/node_modules/@tanstack/react-query/build/modern/useIsFetching.cjs.map +1 -0
  616. package/node_modules/@tanstack/react-query/build/modern/useIsFetching.d.cts +5 -0
  617. package/node_modules/@tanstack/react-query/build/modern/useIsFetching.d.ts +5 -0
  618. package/node_modules/@tanstack/react-query/build/modern/useIsFetching.js +22 -0
  619. package/node_modules/@tanstack/react-query/build/modern/useIsFetching.js.map +1 -0
  620. package/node_modules/@tanstack/react-query/build/modern/useMutation.cjs +74 -0
  621. package/node_modules/@tanstack/react-query/build/modern/useMutation.cjs.map +1 -0
  622. package/node_modules/@tanstack/react-query/build/modern/useMutation.d.cts +6 -0
  623. package/node_modules/@tanstack/react-query/build/modern/useMutation.d.ts +6 -0
  624. package/node_modules/@tanstack/react-query/build/modern/useMutation.js +45 -0
  625. package/node_modules/@tanstack/react-query/build/modern/useMutation.js.map +1 -0
  626. package/node_modules/@tanstack/react-query/build/modern/useMutationState.cjs +86 -0
  627. package/node_modules/@tanstack/react-query/build/modern/useMutationState.cjs.map +1 -0
  628. package/node_modules/@tanstack/react-query/build/modern/useMutationState.d.cts +10 -0
  629. package/node_modules/@tanstack/react-query/build/modern/useMutationState.d.ts +10 -0
  630. package/node_modules/@tanstack/react-query/build/modern/useMutationState.js +51 -0
  631. package/node_modules/@tanstack/react-query/build/modern/useMutationState.js.map +1 -0
  632. package/node_modules/@tanstack/react-query/build/modern/usePrefetchInfiniteQuery.cjs +37 -0
  633. package/node_modules/@tanstack/react-query/build/modern/usePrefetchInfiniteQuery.cjs.map +1 -0
  634. package/node_modules/@tanstack/react-query/build/modern/usePrefetchInfiniteQuery.d.cts +5 -0
  635. package/node_modules/@tanstack/react-query/build/modern/usePrefetchInfiniteQuery.d.ts +5 -0
  636. package/node_modules/@tanstack/react-query/build/modern/usePrefetchInfiniteQuery.js +12 -0
  637. package/node_modules/@tanstack/react-query/build/modern/usePrefetchInfiniteQuery.js.map +1 -0
  638. package/node_modules/@tanstack/react-query/build/modern/usePrefetchQuery.cjs +37 -0
  639. package/node_modules/@tanstack/react-query/build/modern/usePrefetchQuery.cjs.map +1 -0
  640. package/node_modules/@tanstack/react-query/build/modern/usePrefetchQuery.d.cts +6 -0
  641. package/node_modules/@tanstack/react-query/build/modern/usePrefetchQuery.d.ts +6 -0
  642. package/node_modules/@tanstack/react-query/build/modern/usePrefetchQuery.js +12 -0
  643. package/node_modules/@tanstack/react-query/build/modern/usePrefetchQuery.js.map +1 -0
  644. package/node_modules/@tanstack/react-query/build/modern/useQueries.cjs +132 -0
  645. package/node_modules/@tanstack/react-query/build/modern/useQueries.cjs.map +1 -0
  646. package/node_modules/@tanstack/react-query/build/modern/useQueries.d.cts +76 -0
  647. package/node_modules/@tanstack/react-query/build/modern/useQueries.d.ts +76 -0
  648. package/node_modules/@tanstack/react-query/build/modern/useQueries.js +112 -0
  649. package/node_modules/@tanstack/react-query/build/modern/useQueries.js.map +1 -0
  650. package/node_modules/@tanstack/react-query/build/modern/useQuery.cjs +36 -0
  651. package/node_modules/@tanstack/react-query/build/modern/useQuery.cjs.map +1 -0
  652. package/node_modules/@tanstack/react-query/build/modern/useQuery.d.cts +9 -0
  653. package/node_modules/@tanstack/react-query/build/modern/useQuery.d.ts +9 -0
  654. package/node_modules/@tanstack/react-query/build/modern/useQuery.js +12 -0
  655. package/node_modules/@tanstack/react-query/build/modern/useQuery.js.map +1 -0
  656. package/node_modules/@tanstack/react-query/build/modern/useSuspenseInfiniteQuery.cjs +51 -0
  657. package/node_modules/@tanstack/react-query/build/modern/useSuspenseInfiniteQuery.cjs.map +1 -0
  658. package/node_modules/@tanstack/react-query/build/modern/useSuspenseInfiniteQuery.d.cts +6 -0
  659. package/node_modules/@tanstack/react-query/build/modern/useSuspenseInfiniteQuery.d.ts +6 -0
  660. package/node_modules/@tanstack/react-query/build/modern/useSuspenseInfiniteQuery.js +27 -0
  661. package/node_modules/@tanstack/react-query/build/modern/useSuspenseInfiniteQuery.js.map +1 -0
  662. package/node_modules/@tanstack/react-query/build/modern/useSuspenseQueries.cjs +56 -0
  663. package/node_modules/@tanstack/react-query/build/modern/useSuspenseQueries.cjs.map +1 -0
  664. package/node_modules/@tanstack/react-query/build/modern/useSuspenseQueries.d.cts +79 -0
  665. package/node_modules/@tanstack/react-query/build/modern/useSuspenseQueries.d.ts +79 -0
  666. package/node_modules/@tanstack/react-query/build/modern/useSuspenseQueries.js +32 -0
  667. package/node_modules/@tanstack/react-query/build/modern/useSuspenseQueries.js.map +1 -0
  668. package/node_modules/@tanstack/react-query/build/modern/useSuspenseQuery.cjs +52 -0
  669. package/node_modules/@tanstack/react-query/build/modern/useSuspenseQuery.cjs.map +1 -0
  670. package/node_modules/@tanstack/react-query/build/modern/useSuspenseQuery.d.cts +6 -0
  671. package/node_modules/@tanstack/react-query/build/modern/useSuspenseQuery.d.ts +6 -0
  672. package/node_modules/@tanstack/react-query/build/modern/useSuspenseQuery.js +28 -0
  673. package/node_modules/@tanstack/react-query/build/modern/useSuspenseQuery.js.map +1 -0
  674. package/node_modules/@tanstack/react-query/build/query-codemods/eslint.config.js +18 -0
  675. package/node_modules/@tanstack/react-query/build/query-codemods/package.json +38 -0
  676. package/node_modules/@tanstack/react-query/build/query-codemods/root.eslint.config.js +64 -0
  677. package/node_modules/@tanstack/react-query/build/query-codemods/tsconfig.json +8 -0
  678. package/node_modules/@tanstack/react-query/build/query-codemods/vite.config.ts +30 -0
  679. package/node_modules/@tanstack/react-query/package.json +87 -0
  680. package/node_modules/@tanstack/react-query/src/HydrationBoundary.tsx +111 -0
  681. package/node_modules/@tanstack/react-query/src/IsRestoringProvider.ts +7 -0
  682. package/node_modules/@tanstack/react-query/src/QueryClientProvider.tsx +45 -0
  683. package/node_modules/@tanstack/react-query/src/QueryErrorResetBoundary.tsx +56 -0
  684. package/node_modules/@tanstack/react-query/src/errorBoundaryUtils.ts +82 -0
  685. package/node_modules/@tanstack/react-query/src/index.ts +56 -0
  686. package/node_modules/@tanstack/react-query/src/infiniteQueryOptions.ts +149 -0
  687. package/node_modules/@tanstack/react-query/src/mutationOptions.ts +41 -0
  688. package/node_modules/@tanstack/react-query/src/queryOptions.ts +87 -0
  689. package/node_modules/@tanstack/react-query/src/suspense.ts +80 -0
  690. package/node_modules/@tanstack/react-query/src/types.ts +242 -0
  691. package/node_modules/@tanstack/react-query/src/useBaseQuery.ts +170 -0
  692. package/node_modules/@tanstack/react-query/src/useInfiniteQuery.ts +81 -0
  693. package/node_modules/@tanstack/react-query/src/useIsFetching.ts +24 -0
  694. package/node_modules/@tanstack/react-query/src/useMutation.ts +69 -0
  695. package/node_modules/@tanstack/react-query/src/useMutationState.ts +75 -0
  696. package/node_modules/@tanstack/react-query/src/usePrefetchInfiniteQuery.tsx +30 -0
  697. package/node_modules/@tanstack/react-query/src/usePrefetchQuery.tsx +19 -0
  698. package/node_modules/@tanstack/react-query/src/useQueries.ts +333 -0
  699. package/node_modules/@tanstack/react-query/src/useQuery.ts +52 -0
  700. package/node_modules/@tanstack/react-query/src/useSuspenseInfiniteQuery.ts +50 -0
  701. package/node_modules/@tanstack/react-query/src/useSuspenseQueries.ts +211 -0
  702. package/node_modules/@tanstack/react-query/src/useSuspenseQuery.ts +34 -0
  703. package/node_modules/react-router/CHANGELOG.md +2366 -0
  704. package/node_modules/react-router/LICENSE.md +23 -0
  705. package/node_modules/react-router/README.md +7 -0
  706. package/node_modules/react-router/dist/development/browser-BEPxnEBW.d.mts +313 -0
  707. package/node_modules/react-router/dist/development/browser-CJ9_du-U.d.ts +313 -0
  708. package/node_modules/react-router/dist/development/chunk-4LKRSAEJ.mjs +2508 -0
  709. package/node_modules/react-router/dist/development/chunk-7PAHGFS4.js +188 -0
  710. package/node_modules/react-router/dist/development/chunk-HMDR2CVH.js +1334 -0
  711. package/node_modules/react-router/dist/development/chunk-JZWAC4HX.mjs +11009 -0
  712. package/node_modules/react-router/dist/development/chunk-WICQJKU6.js +9736 -0
  713. package/node_modules/react-router/dist/development/dom-export.d.mts +171 -0
  714. package/node_modules/react-router/dist/development/dom-export.d.ts +172 -0
  715. package/node_modules/react-router/dist/development/dom-export.js +987 -0
  716. package/node_modules/react-router/dist/development/dom-export.mjs +979 -0
  717. package/node_modules/react-router/dist/development/index-react-server-client-1TI9M9o1.d.ts +2534 -0
  718. package/node_modules/react-router/dist/development/index-react-server-client-MKTlCGL3.d.mts +2534 -0
  719. package/node_modules/react-router/dist/development/index-react-server-client.d.mts +3 -0
  720. package/node_modules/react-router/dist/development/index-react-server-client.d.ts +3 -0
  721. package/node_modules/react-router/dist/development/index-react-server-client.js +61 -0
  722. package/node_modules/react-router/dist/development/index-react-server-client.mjs +59 -0
  723. package/node_modules/react-router/dist/development/index-react-server.d.mts +2553 -0
  724. package/node_modules/react-router/dist/development/index-react-server.d.ts +2553 -0
  725. package/node_modules/react-router/dist/development/index-react-server.js +3708 -0
  726. package/node_modules/react-router/dist/development/index-react-server.mjs +3597 -0
  727. package/node_modules/react-router/dist/development/index.d.mts +1387 -0
  728. package/node_modules/react-router/dist/development/index.d.ts +1387 -0
  729. package/node_modules/react-router/dist/development/index.js +2551 -0
  730. package/node_modules/react-router/dist/development/index.mjs +275 -0
  731. package/node_modules/react-router/dist/development/instrumentation-DvHY1sgY.d.ts +3332 -0
  732. package/node_modules/react-router/dist/development/lib/types/internal.d.mts +184 -0
  733. package/node_modules/react-router/dist/development/lib/types/internal.d.ts +184 -0
  734. package/node_modules/react-router/dist/development/lib/types/internal.js +10 -0
  735. package/node_modules/react-router/dist/development/lib/types/internal.mjs +10 -0
  736. package/node_modules/react-router/dist/development/register-Bm80E9qL.d.ts +30 -0
  737. package/node_modules/react-router/dist/development/register-CS_tiXsm.d.mts +30 -0
  738. package/node_modules/react-router/dist/development/router-5iOvts3c.d.mts +3332 -0
  739. package/node_modules/react-router/dist/production/browser-BEPxnEBW.d.mts +313 -0
  740. package/node_modules/react-router/dist/production/browser-CJ9_du-U.d.ts +313 -0
  741. package/node_modules/react-router/dist/production/chunk-GSFLVUYQ.mjs +2508 -0
  742. package/node_modules/react-router/dist/production/chunk-N2HZAAIG.js +1334 -0
  743. package/node_modules/react-router/dist/production/chunk-NGWWS4QJ.js +188 -0
  744. package/node_modules/react-router/dist/production/chunk-QSNCZFX5.js +9736 -0
  745. package/node_modules/react-router/dist/production/chunk-Y3R63HEB.mjs +11009 -0
  746. package/node_modules/react-router/dist/production/dom-export.d.mts +171 -0
  747. package/node_modules/react-router/dist/production/dom-export.d.ts +172 -0
  748. package/node_modules/react-router/dist/production/dom-export.js +987 -0
  749. package/node_modules/react-router/dist/production/dom-export.mjs +979 -0
  750. package/node_modules/react-router/dist/production/index-react-server-client-1TI9M9o1.d.ts +2534 -0
  751. package/node_modules/react-router/dist/production/index-react-server-client-MKTlCGL3.d.mts +2534 -0
  752. package/node_modules/react-router/dist/production/index-react-server-client.d.mts +3 -0
  753. package/node_modules/react-router/dist/production/index-react-server-client.d.ts +3 -0
  754. package/node_modules/react-router/dist/production/index-react-server-client.js +61 -0
  755. package/node_modules/react-router/dist/production/index-react-server-client.mjs +59 -0
  756. package/node_modules/react-router/dist/production/index-react-server.d.mts +2553 -0
  757. package/node_modules/react-router/dist/production/index-react-server.d.ts +2553 -0
  758. package/node_modules/react-router/dist/production/index-react-server.js +3708 -0
  759. package/node_modules/react-router/dist/production/index-react-server.mjs +3597 -0
  760. package/node_modules/react-router/dist/production/index.d.mts +1387 -0
  761. package/node_modules/react-router/dist/production/index.d.ts +1387 -0
  762. package/node_modules/react-router/dist/production/index.js +2551 -0
  763. package/node_modules/react-router/dist/production/index.mjs +275 -0
  764. package/node_modules/react-router/dist/production/instrumentation-DvHY1sgY.d.ts +3332 -0
  765. package/node_modules/react-router/dist/production/lib/types/internal.d.mts +184 -0
  766. package/node_modules/react-router/dist/production/lib/types/internal.d.ts +184 -0
  767. package/node_modules/react-router/dist/production/lib/types/internal.js +10 -0
  768. package/node_modules/react-router/dist/production/lib/types/internal.mjs +10 -0
  769. package/node_modules/react-router/dist/production/register-Bm80E9qL.d.ts +30 -0
  770. package/node_modules/react-router/dist/production/register-CS_tiXsm.d.mts +30 -0
  771. package/node_modules/react-router/dist/production/router-5iOvts3c.d.mts +3332 -0
  772. package/node_modules/react-router/node_modules/cookie/LICENSE +24 -0
  773. package/node_modules/react-router/node_modules/cookie/README.md +295 -0
  774. package/node_modules/react-router/node_modules/cookie/dist/index.d.ts +148 -0
  775. package/node_modules/react-router/node_modules/cookie/dist/index.js +350 -0
  776. package/node_modules/react-router/node_modules/cookie/dist/index.js.map +1 -0
  777. package/node_modules/react-router/node_modules/cookie/package.json +47 -0
  778. package/node_modules/react-router/package.json +163 -0
  779. package/node_modules/react-router-dom/LICENSE.md +23 -0
  780. package/node_modules/react-router-dom/README.md +6 -0
  781. package/node_modules/react-router-dom/dist/index.d.mts +2 -0
  782. package/node_modules/react-router-dom/dist/index.d.ts +2 -0
  783. package/node_modules/react-router-dom/dist/index.js +45 -0
  784. package/node_modules/react-router-dom/dist/index.mjs +18 -0
  785. package/node_modules/react-router-dom/package.json +83 -0
  786. package/node_modules/set-cookie-parser/LICENSE +21 -0
  787. package/node_modules/set-cookie-parser/README.md +202 -0
  788. package/node_modules/set-cookie-parser/lib/set-cookie.js +242 -0
  789. package/node_modules/set-cookie-parser/package.json +45 -0
  790. package/node_modules/zustand/LICENSE +21 -0
  791. package/node_modules/zustand/README.md +512 -0
  792. package/node_modules/zustand/esm/index.d.mts +2 -0
  793. package/node_modules/zustand/esm/index.mjs +2 -0
  794. package/node_modules/zustand/esm/middleware/combine.d.mts +4 -0
  795. package/node_modules/zustand/esm/middleware/devtools.d.mts +58 -0
  796. package/node_modules/zustand/esm/middleware/immer.d.mts +29 -0
  797. package/node_modules/zustand/esm/middleware/immer.mjs +12 -0
  798. package/node_modules/zustand/esm/middleware/persist.d.mts +99 -0
  799. package/node_modules/zustand/esm/middleware/redux.d.mts +21 -0
  800. package/node_modules/zustand/esm/middleware/ssrSafe.d.mts +2 -0
  801. package/node_modules/zustand/esm/middleware/subscribeWithSelector.d.mts +25 -0
  802. package/node_modules/zustand/esm/middleware.d.mts +6 -0
  803. package/node_modules/zustand/esm/middleware.mjs +487 -0
  804. package/node_modules/zustand/esm/react/shallow.d.mts +1 -0
  805. package/node_modules/zustand/esm/react/shallow.mjs +12 -0
  806. package/node_modules/zustand/esm/react.d.mts +14 -0
  807. package/node_modules/zustand/esm/react.mjs +22 -0
  808. package/node_modules/zustand/esm/shallow.d.mts +2 -0
  809. package/node_modules/zustand/esm/shallow.mjs +2 -0
  810. package/node_modules/zustand/esm/traditional.d.mts +14 -0
  811. package/node_modules/zustand/esm/traditional.mjs +26 -0
  812. package/node_modules/zustand/esm/vanilla/shallow.d.mts +1 -0
  813. package/node_modules/zustand/esm/vanilla/shallow.mjs +55 -0
  814. package/node_modules/zustand/esm/vanilla.d.mts +31 -0
  815. package/node_modules/zustand/esm/vanilla.mjs +24 -0
  816. package/node_modules/zustand/index.d.ts +2 -0
  817. package/node_modules/zustand/index.js +19 -0
  818. package/node_modules/zustand/middleware/combine.d.ts +4 -0
  819. package/node_modules/zustand/middleware/devtools.d.ts +58 -0
  820. package/node_modules/zustand/middleware/immer.d.ts +29 -0
  821. package/node_modules/zustand/middleware/immer.js +14 -0
  822. package/node_modules/zustand/middleware/persist.d.ts +99 -0
  823. package/node_modules/zustand/middleware/redux.d.ts +21 -0
  824. package/node_modules/zustand/middleware/ssrSafe.d.ts +2 -0
  825. package/node_modules/zustand/middleware/subscribeWithSelector.d.ts +25 -0
  826. package/node_modules/zustand/middleware.d.ts +6 -0
  827. package/node_modules/zustand/middleware.js +495 -0
  828. package/node_modules/zustand/package.json +108 -0
  829. package/node_modules/zustand/react/shallow.d.ts +1 -0
  830. package/node_modules/zustand/react/shallow.js +14 -0
  831. package/node_modules/zustand/react.d.ts +14 -0
  832. package/node_modules/zustand/react.js +25 -0
  833. package/node_modules/zustand/shallow.d.ts +2 -0
  834. package/node_modules/zustand/shallow.js +15 -0
  835. package/node_modules/zustand/traditional.d.ts +14 -0
  836. package/node_modules/zustand/traditional.js +29 -0
  837. package/node_modules/zustand/ts_version_4.5_and_above_is_required.d.ts +0 -0
  838. package/node_modules/zustand/vanilla/shallow.d.ts +1 -0
  839. package/node_modules/zustand/vanilla/shallow.js +57 -0
  840. package/node_modules/zustand/vanilla.d.ts +31 -0
  841. package/node_modules/zustand/vanilla.js +26 -0
  842. package/oclif.manifest.json +516 -454
  843. package/package.json +5 -2
@@ -0,0 +1,3708 @@
1
+ 'use strict';
2
+
3
+ var node_async_hooks = require('node:async_hooks');
4
+ var React2 = require('react');
5
+ var setCookieParser = require('set-cookie-parser');
6
+ var reactServerClient = require('react-router/internal/react-server-client');
7
+ var cookie = require('cookie');
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
28
+
29
+ /**
30
+ * react-router v7.13.0
31
+ *
32
+ * Copyright (c) Remix Software Inc.
33
+ *
34
+ * This source code is licensed under the MIT license found in the
35
+ * LICENSE.md file in the root directory of this source tree.
36
+ *
37
+ * @license MIT
38
+ */
39
+ var __typeError = (msg) => {
40
+ throw TypeError(msg);
41
+ };
42
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
43
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
44
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
45
+
46
+ // lib/router/history.ts
47
+ function invariant(value, message) {
48
+ if (value === false || value === null || typeof value === "undefined") {
49
+ throw new Error(message);
50
+ }
51
+ }
52
+ function warning(cond, message) {
53
+ if (!cond) {
54
+ if (typeof console !== "undefined") console.warn(message);
55
+ try {
56
+ throw new Error(message);
57
+ } catch (e) {
58
+ }
59
+ }
60
+ }
61
+ function createKey() {
62
+ return Math.random().toString(36).substring(2, 10);
63
+ }
64
+ function createLocation(current, to, state = null, key) {
65
+ let location = {
66
+ pathname: typeof current === "string" ? current : current.pathname,
67
+ search: "",
68
+ hash: "",
69
+ ...typeof to === "string" ? parsePath(to) : to,
70
+ state,
71
+ // TODO: This could be cleaned up. push/replace should probably just take
72
+ // full Locations now and avoid the need to run through this flow at all
73
+ // But that's a pretty big refactor to the current test suite so going to
74
+ // keep as is for the time being and just let any incoming keys take precedence
75
+ key: to && to.key || key || createKey()
76
+ };
77
+ return location;
78
+ }
79
+ function createPath({
80
+ pathname = "/",
81
+ search = "",
82
+ hash = ""
83
+ }) {
84
+ if (search && search !== "?")
85
+ pathname += search.charAt(0) === "?" ? search : "?" + search;
86
+ if (hash && hash !== "#")
87
+ pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
88
+ return pathname;
89
+ }
90
+ function parsePath(path) {
91
+ let parsedPath = {};
92
+ if (path) {
93
+ let hashIndex = path.indexOf("#");
94
+ if (hashIndex >= 0) {
95
+ parsedPath.hash = path.substring(hashIndex);
96
+ path = path.substring(0, hashIndex);
97
+ }
98
+ let searchIndex = path.indexOf("?");
99
+ if (searchIndex >= 0) {
100
+ parsedPath.search = path.substring(searchIndex);
101
+ path = path.substring(0, searchIndex);
102
+ }
103
+ if (path) {
104
+ parsedPath.pathname = path;
105
+ }
106
+ }
107
+ return parsedPath;
108
+ }
109
+
110
+ // lib/router/instrumentation.ts
111
+ var UninstrumentedSymbol = Symbol("Uninstrumented");
112
+ function getRouteInstrumentationUpdates(fns, route) {
113
+ let aggregated = {
114
+ lazy: [],
115
+ "lazy.loader": [],
116
+ "lazy.action": [],
117
+ "lazy.middleware": [],
118
+ middleware: [],
119
+ loader: [],
120
+ action: []
121
+ };
122
+ fns.forEach(
123
+ (fn) => fn({
124
+ id: route.id,
125
+ index: route.index,
126
+ path: route.path,
127
+ instrument(i) {
128
+ let keys = Object.keys(aggregated);
129
+ for (let key of keys) {
130
+ if (i[key]) {
131
+ aggregated[key].push(i[key]);
132
+ }
133
+ }
134
+ }
135
+ })
136
+ );
137
+ let updates = {};
138
+ if (typeof route.lazy === "function" && aggregated.lazy.length > 0) {
139
+ let instrumented = wrapImpl(aggregated.lazy, route.lazy, () => void 0);
140
+ if (instrumented) {
141
+ updates.lazy = instrumented;
142
+ }
143
+ }
144
+ if (typeof route.lazy === "object") {
145
+ let lazyObject = route.lazy;
146
+ ["middleware", "loader", "action"].forEach((key) => {
147
+ let lazyFn = lazyObject[key];
148
+ let instrumentations = aggregated[`lazy.${key}`];
149
+ if (typeof lazyFn === "function" && instrumentations.length > 0) {
150
+ let instrumented = wrapImpl(instrumentations, lazyFn, () => void 0);
151
+ if (instrumented) {
152
+ updates.lazy = Object.assign(updates.lazy || {}, {
153
+ [key]: instrumented
154
+ });
155
+ }
156
+ }
157
+ });
158
+ }
159
+ ["loader", "action"].forEach((key) => {
160
+ let handler = route[key];
161
+ if (typeof handler === "function" && aggregated[key].length > 0) {
162
+ let original = handler[UninstrumentedSymbol] ?? handler;
163
+ let instrumented = wrapImpl(
164
+ aggregated[key],
165
+ original,
166
+ (...args) => getHandlerInfo(args[0])
167
+ );
168
+ if (instrumented) {
169
+ if (key === "loader" && original.hydrate === true) {
170
+ instrumented.hydrate = true;
171
+ }
172
+ instrumented[UninstrumentedSymbol] = original;
173
+ updates[key] = instrumented;
174
+ }
175
+ }
176
+ });
177
+ if (route.middleware && route.middleware.length > 0 && aggregated.middleware.length > 0) {
178
+ updates.middleware = route.middleware.map((middleware) => {
179
+ let original = middleware[UninstrumentedSymbol] ?? middleware;
180
+ let instrumented = wrapImpl(
181
+ aggregated.middleware,
182
+ original,
183
+ (...args) => getHandlerInfo(args[0])
184
+ );
185
+ if (instrumented) {
186
+ instrumented[UninstrumentedSymbol] = original;
187
+ return instrumented;
188
+ }
189
+ return middleware;
190
+ });
191
+ }
192
+ return updates;
193
+ }
194
+ function wrapImpl(impls, handler, getInfo) {
195
+ if (impls.length === 0) {
196
+ return null;
197
+ }
198
+ return async (...args) => {
199
+ let result = await recurseRight(
200
+ impls,
201
+ getInfo(...args),
202
+ () => handler(...args),
203
+ impls.length - 1
204
+ );
205
+ if (result.type === "error") {
206
+ throw result.value;
207
+ }
208
+ return result.value;
209
+ };
210
+ }
211
+ async function recurseRight(impls, info, handler, index) {
212
+ let impl = impls[index];
213
+ let result;
214
+ if (!impl) {
215
+ try {
216
+ let value = await handler();
217
+ result = { type: "success", value };
218
+ } catch (e) {
219
+ result = { type: "error", value: e };
220
+ }
221
+ } else {
222
+ let handlerPromise = void 0;
223
+ let callHandler = async () => {
224
+ if (handlerPromise) {
225
+ console.error("You cannot call instrumented handlers more than once");
226
+ } else {
227
+ handlerPromise = recurseRight(impls, info, handler, index - 1);
228
+ }
229
+ result = await handlerPromise;
230
+ invariant(result, "Expected a result");
231
+ if (result.type === "error" && result.value instanceof Error) {
232
+ return { status: "error", error: result.value };
233
+ }
234
+ return { status: "success", error: void 0 };
235
+ };
236
+ try {
237
+ await impl(callHandler, info);
238
+ } catch (e) {
239
+ console.error("An instrumentation function threw an error:", e);
240
+ }
241
+ if (!handlerPromise) {
242
+ await callHandler();
243
+ }
244
+ await handlerPromise;
245
+ }
246
+ if (result) {
247
+ return result;
248
+ }
249
+ return {
250
+ type: "error",
251
+ value: new Error("No result assigned in instrumentation chain.")
252
+ };
253
+ }
254
+ function getHandlerInfo(args) {
255
+ let { request, context, params, unstable_pattern } = args;
256
+ return {
257
+ request: getReadonlyRequest(request),
258
+ params: { ...params },
259
+ unstable_pattern,
260
+ context: getReadonlyContext(context)
261
+ };
262
+ }
263
+ function getReadonlyRequest(request) {
264
+ return {
265
+ method: request.method,
266
+ url: request.url,
267
+ headers: {
268
+ get: (...args) => request.headers.get(...args)
269
+ }
270
+ };
271
+ }
272
+ function getReadonlyContext(context) {
273
+ if (isPlainObject(context)) {
274
+ let frozen = { ...context };
275
+ Object.freeze(frozen);
276
+ return frozen;
277
+ } else {
278
+ return {
279
+ get: (ctx) => context.get(ctx)
280
+ };
281
+ }
282
+ }
283
+ var objectProtoNames = Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
284
+ function isPlainObject(thing) {
285
+ if (thing === null || typeof thing !== "object") {
286
+ return false;
287
+ }
288
+ const proto = Object.getPrototypeOf(thing);
289
+ return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames;
290
+ }
291
+
292
+ // lib/router/utils.ts
293
+ function createContext(defaultValue) {
294
+ return { defaultValue };
295
+ }
296
+ var _map;
297
+ var RouterContextProvider = class {
298
+ /**
299
+ * Create a new `RouterContextProvider` instance
300
+ * @param init An optional initial context map to populate the provider with
301
+ */
302
+ constructor(init) {
303
+ __privateAdd(this, _map, /* @__PURE__ */ new Map());
304
+ if (init) {
305
+ for (let [context, value] of init) {
306
+ this.set(context, value);
307
+ }
308
+ }
309
+ }
310
+ /**
311
+ * Access a value from the context. If no value has been set for the context,
312
+ * it will return the context's `defaultValue` if provided, or throw an error
313
+ * if no `defaultValue` was set.
314
+ * @param context The context to get the value for
315
+ * @returns The value for the context, or the context's `defaultValue` if no
316
+ * value was set
317
+ */
318
+ get(context) {
319
+ if (__privateGet(this, _map).has(context)) {
320
+ return __privateGet(this, _map).get(context);
321
+ }
322
+ if (context.defaultValue !== void 0) {
323
+ return context.defaultValue;
324
+ }
325
+ throw new Error("No value found for context");
326
+ }
327
+ /**
328
+ * Set a value for the context. If the context already has a value set, this
329
+ * will overwrite it.
330
+ *
331
+ * @param context The context to set the value for
332
+ * @param value The value to set for the context
333
+ * @returns {void}
334
+ */
335
+ set(context, value) {
336
+ __privateGet(this, _map).set(context, value);
337
+ }
338
+ };
339
+ _map = new WeakMap();
340
+ var unsupportedLazyRouteObjectKeys = /* @__PURE__ */ new Set([
341
+ "lazy",
342
+ "caseSensitive",
343
+ "path",
344
+ "id",
345
+ "index",
346
+ "children"
347
+ ]);
348
+ function isUnsupportedLazyRouteObjectKey(key) {
349
+ return unsupportedLazyRouteObjectKeys.has(
350
+ key
351
+ );
352
+ }
353
+ var unsupportedLazyRouteFunctionKeys = /* @__PURE__ */ new Set([
354
+ "lazy",
355
+ "caseSensitive",
356
+ "path",
357
+ "id",
358
+ "index",
359
+ "middleware",
360
+ "children"
361
+ ]);
362
+ function isUnsupportedLazyRouteFunctionKey(key) {
363
+ return unsupportedLazyRouteFunctionKeys.has(
364
+ key
365
+ );
366
+ }
367
+ function isIndexRoute(route) {
368
+ return route.index === true;
369
+ }
370
+ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [], manifest = {}, allowInPlaceMutations = false) {
371
+ return routes.map((route, index) => {
372
+ let treePath = [...parentPath, String(index)];
373
+ let id = typeof route.id === "string" ? route.id : treePath.join("-");
374
+ invariant(
375
+ route.index !== true || !route.children,
376
+ `Cannot specify children on an index route`
377
+ );
378
+ invariant(
379
+ allowInPlaceMutations || !manifest[id],
380
+ `Found a route id collision on id "${id}". Route id's must be globally unique within Data Router usages`
381
+ );
382
+ if (isIndexRoute(route)) {
383
+ let indexRoute = {
384
+ ...route,
385
+ id
386
+ };
387
+ manifest[id] = mergeRouteUpdates(
388
+ indexRoute,
389
+ mapRouteProperties(indexRoute)
390
+ );
391
+ return indexRoute;
392
+ } else {
393
+ let pathOrLayoutRoute = {
394
+ ...route,
395
+ id,
396
+ children: void 0
397
+ };
398
+ manifest[id] = mergeRouteUpdates(
399
+ pathOrLayoutRoute,
400
+ mapRouteProperties(pathOrLayoutRoute)
401
+ );
402
+ if (route.children) {
403
+ pathOrLayoutRoute.children = convertRoutesToDataRoutes(
404
+ route.children,
405
+ mapRouteProperties,
406
+ treePath,
407
+ manifest,
408
+ allowInPlaceMutations
409
+ );
410
+ }
411
+ return pathOrLayoutRoute;
412
+ }
413
+ });
414
+ }
415
+ function mergeRouteUpdates(route, updates) {
416
+ return Object.assign(route, {
417
+ ...updates,
418
+ ...typeof updates.lazy === "object" && updates.lazy != null ? {
419
+ lazy: {
420
+ ...route.lazy,
421
+ ...updates.lazy
422
+ }
423
+ } : {}
424
+ });
425
+ }
426
+ function matchRoutes(routes, locationArg, basename = "/") {
427
+ return matchRoutesImpl(routes, locationArg, basename, false);
428
+ }
429
+ function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
430
+ let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
431
+ let pathname = stripBasename(location.pathname || "/", basename);
432
+ if (pathname == null) {
433
+ return null;
434
+ }
435
+ let branches = flattenRoutes(routes);
436
+ rankRouteBranches(branches);
437
+ let matches = null;
438
+ for (let i = 0; matches == null && i < branches.length; ++i) {
439
+ let decoded = decodePath(pathname);
440
+ matches = matchRouteBranch(
441
+ branches[i],
442
+ decoded,
443
+ allowPartial
444
+ );
445
+ }
446
+ return matches;
447
+ }
448
+ function convertRouteMatchToUiMatch(match, loaderData) {
449
+ let { route, pathname, params } = match;
450
+ return {
451
+ id: route.id,
452
+ pathname,
453
+ params,
454
+ data: loaderData[route.id],
455
+ loaderData: loaderData[route.id],
456
+ handle: route.handle
457
+ };
458
+ }
459
+ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
460
+ let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
461
+ let meta = {
462
+ relativePath: relativePath === void 0 ? route.path || "" : relativePath,
463
+ caseSensitive: route.caseSensitive === true,
464
+ childrenIndex: index,
465
+ route
466
+ };
467
+ if (meta.relativePath.startsWith("/")) {
468
+ if (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) {
469
+ return;
470
+ }
471
+ invariant(
472
+ meta.relativePath.startsWith(parentPath),
473
+ `Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
474
+ );
475
+ meta.relativePath = meta.relativePath.slice(parentPath.length);
476
+ }
477
+ let path = joinPaths([parentPath, meta.relativePath]);
478
+ let routesMeta = parentsMeta.concat(meta);
479
+ if (route.children && route.children.length > 0) {
480
+ invariant(
481
+ // Our types know better, but runtime JS may not!
482
+ // @ts-expect-error
483
+ route.index !== true,
484
+ `Index routes must not have child routes. Please remove all child routes from route path "${path}".`
485
+ );
486
+ flattenRoutes(
487
+ route.children,
488
+ branches,
489
+ routesMeta,
490
+ path,
491
+ hasParentOptionalSegments
492
+ );
493
+ }
494
+ if (route.path == null && !route.index) {
495
+ return;
496
+ }
497
+ branches.push({
498
+ path,
499
+ score: computeScore(path, route.index),
500
+ routesMeta
501
+ });
502
+ };
503
+ routes.forEach((route, index) => {
504
+ if (route.path === "" || !route.path?.includes("?")) {
505
+ flattenRoute(route, index);
506
+ } else {
507
+ for (let exploded of explodeOptionalSegments(route.path)) {
508
+ flattenRoute(route, index, true, exploded);
509
+ }
510
+ }
511
+ });
512
+ return branches;
513
+ }
514
+ function explodeOptionalSegments(path) {
515
+ let segments = path.split("/");
516
+ if (segments.length === 0) return [];
517
+ let [first, ...rest] = segments;
518
+ let isOptional = first.endsWith("?");
519
+ let required = first.replace(/\?$/, "");
520
+ if (rest.length === 0) {
521
+ return isOptional ? [required, ""] : [required];
522
+ }
523
+ let restExploded = explodeOptionalSegments(rest.join("/"));
524
+ let result = [];
525
+ result.push(
526
+ ...restExploded.map(
527
+ (subpath) => subpath === "" ? required : [required, subpath].join("/")
528
+ )
529
+ );
530
+ if (isOptional) {
531
+ result.push(...restExploded);
532
+ }
533
+ return result.map(
534
+ (exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded
535
+ );
536
+ }
537
+ function rankRouteBranches(branches) {
538
+ branches.sort(
539
+ (a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(
540
+ a.routesMeta.map((meta) => meta.childrenIndex),
541
+ b.routesMeta.map((meta) => meta.childrenIndex)
542
+ )
543
+ );
544
+ }
545
+ var paramRe = /^:[\w-]+$/;
546
+ var dynamicSegmentValue = 3;
547
+ var indexRouteValue = 2;
548
+ var emptySegmentValue = 1;
549
+ var staticSegmentValue = 10;
550
+ var splatPenalty = -2;
551
+ var isSplat = (s) => s === "*";
552
+ function computeScore(path, index) {
553
+ let segments = path.split("/");
554
+ let initialScore = segments.length;
555
+ if (segments.some(isSplat)) {
556
+ initialScore += splatPenalty;
557
+ }
558
+ if (index) {
559
+ initialScore += indexRouteValue;
560
+ }
561
+ return segments.filter((s) => !isSplat(s)).reduce(
562
+ (score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue),
563
+ initialScore
564
+ );
565
+ }
566
+ function compareIndexes(a, b) {
567
+ let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);
568
+ return siblings ? (
569
+ // If two routes are siblings, we should try to match the earlier sibling
570
+ // first. This allows people to have fine-grained control over the matching
571
+ // behavior by simply putting routes with identical paths in the order they
572
+ // want them tried.
573
+ a[a.length - 1] - b[b.length - 1]
574
+ ) : (
575
+ // Otherwise, it doesn't really make sense to rank non-siblings by index,
576
+ // so they sort equally.
577
+ 0
578
+ );
579
+ }
580
+ function matchRouteBranch(branch, pathname, allowPartial = false) {
581
+ let { routesMeta } = branch;
582
+ let matchedParams = {};
583
+ let matchedPathname = "/";
584
+ let matches = [];
585
+ for (let i = 0; i < routesMeta.length; ++i) {
586
+ let meta = routesMeta[i];
587
+ let end = i === routesMeta.length - 1;
588
+ let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
589
+ let match = matchPath(
590
+ { path: meta.relativePath, caseSensitive: meta.caseSensitive, end },
591
+ remainingPathname
592
+ );
593
+ let route = meta.route;
594
+ if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {
595
+ match = matchPath(
596
+ {
597
+ path: meta.relativePath,
598
+ caseSensitive: meta.caseSensitive,
599
+ end: false
600
+ },
601
+ remainingPathname
602
+ );
603
+ }
604
+ if (!match) {
605
+ return null;
606
+ }
607
+ Object.assign(matchedParams, match.params);
608
+ matches.push({
609
+ // TODO: Can this as be avoided?
610
+ params: matchedParams,
611
+ pathname: joinPaths([matchedPathname, match.pathname]),
612
+ pathnameBase: normalizePathname(
613
+ joinPaths([matchedPathname, match.pathnameBase])
614
+ ),
615
+ route
616
+ });
617
+ if (match.pathnameBase !== "/") {
618
+ matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);
619
+ }
620
+ }
621
+ return matches;
622
+ }
623
+ function matchPath(pattern, pathname) {
624
+ if (typeof pattern === "string") {
625
+ pattern = { path: pattern, caseSensitive: false, end: true };
626
+ }
627
+ let [matcher, compiledParams] = compilePath(
628
+ pattern.path,
629
+ pattern.caseSensitive,
630
+ pattern.end
631
+ );
632
+ let match = pathname.match(matcher);
633
+ if (!match) return null;
634
+ let matchedPathname = match[0];
635
+ let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
636
+ let captureGroups = match.slice(1);
637
+ let params = compiledParams.reduce(
638
+ (memo, { paramName, isOptional }, index) => {
639
+ if (paramName === "*") {
640
+ let splatValue = captureGroups[index] || "";
641
+ pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
642
+ }
643
+ const value = captureGroups[index];
644
+ if (isOptional && !value) {
645
+ memo[paramName] = void 0;
646
+ } else {
647
+ memo[paramName] = (value || "").replace(/%2F/g, "/");
648
+ }
649
+ return memo;
650
+ },
651
+ {}
652
+ );
653
+ return {
654
+ params,
655
+ pathname: matchedPathname,
656
+ pathnameBase,
657
+ pattern
658
+ };
659
+ }
660
+ function compilePath(path, caseSensitive = false, end = true) {
661
+ warning(
662
+ path === "*" || !path.endsWith("*") || path.endsWith("/*"),
663
+ `Route path "${path}" will be treated as if it were "${path.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${path.replace(/\*$/, "/*")}".`
664
+ );
665
+ let params = [];
666
+ let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
667
+ /\/:([\w-]+)(\?)?/g,
668
+ (_, paramName, isOptional) => {
669
+ params.push({ paramName, isOptional: isOptional != null });
670
+ return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
671
+ }
672
+ ).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
673
+ if (path.endsWith("*")) {
674
+ params.push({ paramName: "*" });
675
+ regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
676
+ } else if (end) {
677
+ regexpSource += "\\/*$";
678
+ } else if (path !== "" && path !== "/") {
679
+ regexpSource += "(?:(?=\\/|$))";
680
+ } else ;
681
+ let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
682
+ return [matcher, params];
683
+ }
684
+ function decodePath(value) {
685
+ try {
686
+ return value.split("/").map((v) => decodeURIComponent(v).replace(/\//g, "%2F")).join("/");
687
+ } catch (error) {
688
+ warning(
689
+ false,
690
+ `The URL path "${value}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${error}).`
691
+ );
692
+ return value;
693
+ }
694
+ }
695
+ function stripBasename(pathname, basename) {
696
+ if (basename === "/") return pathname;
697
+ if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
698
+ return null;
699
+ }
700
+ let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
701
+ let nextChar = pathname.charAt(startIndex);
702
+ if (nextChar && nextChar !== "/") {
703
+ return null;
704
+ }
705
+ return pathname.slice(startIndex) || "/";
706
+ }
707
+ function prependBasename({
708
+ basename,
709
+ pathname
710
+ }) {
711
+ return pathname === "/" ? basename : joinPaths([basename, pathname]);
712
+ }
713
+ var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
714
+ var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
715
+ function resolvePath(to, fromPathname = "/") {
716
+ let {
717
+ pathname: toPathname,
718
+ search = "",
719
+ hash = ""
720
+ } = typeof to === "string" ? parsePath(to) : to;
721
+ let pathname;
722
+ if (toPathname) {
723
+ toPathname = toPathname.replace(/\/\/+/g, "/");
724
+ if (toPathname.startsWith("/")) {
725
+ pathname = resolvePathname(toPathname.substring(1), "/");
726
+ } else {
727
+ pathname = resolvePathname(toPathname, fromPathname);
728
+ }
729
+ } else {
730
+ pathname = fromPathname;
731
+ }
732
+ return {
733
+ pathname,
734
+ search: normalizeSearch(search),
735
+ hash: normalizeHash(hash)
736
+ };
737
+ }
738
+ function resolvePathname(relativePath, fromPathname) {
739
+ let segments = fromPathname.replace(/\/+$/, "").split("/");
740
+ let relativeSegments = relativePath.split("/");
741
+ relativeSegments.forEach((segment) => {
742
+ if (segment === "..") {
743
+ if (segments.length > 1) segments.pop();
744
+ } else if (segment !== ".") {
745
+ segments.push(segment);
746
+ }
747
+ });
748
+ return segments.length > 1 ? segments.join("/") : "/";
749
+ }
750
+ function getInvalidPathError(char, field, dest, path) {
751
+ return `Cannot include a '${char}' character in a manually specified \`to.${field}\` field [${JSON.stringify(
752
+ path
753
+ )}]. Please separate it out to the \`to.${dest}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
754
+ }
755
+ function getPathContributingMatches(matches) {
756
+ return matches.filter(
757
+ (match, index) => index === 0 || match.route.path && match.route.path.length > 0
758
+ );
759
+ }
760
+ function getResolveToMatches(matches) {
761
+ let pathMatches = getPathContributingMatches(matches);
762
+ return pathMatches.map(
763
+ (match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase
764
+ );
765
+ }
766
+ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = false) {
767
+ let to;
768
+ if (typeof toArg === "string") {
769
+ to = parsePath(toArg);
770
+ } else {
771
+ to = { ...toArg };
772
+ invariant(
773
+ !to.pathname || !to.pathname.includes("?"),
774
+ getInvalidPathError("?", "pathname", "search", to)
775
+ );
776
+ invariant(
777
+ !to.pathname || !to.pathname.includes("#"),
778
+ getInvalidPathError("#", "pathname", "hash", to)
779
+ );
780
+ invariant(
781
+ !to.search || !to.search.includes("#"),
782
+ getInvalidPathError("#", "search", "hash", to)
783
+ );
784
+ }
785
+ let isEmptyPath = toArg === "" || to.pathname === "";
786
+ let toPathname = isEmptyPath ? "/" : to.pathname;
787
+ let from;
788
+ if (toPathname == null) {
789
+ from = locationPathname;
790
+ } else {
791
+ let routePathnameIndex = routePathnames.length - 1;
792
+ if (!isPathRelative && toPathname.startsWith("..")) {
793
+ let toSegments = toPathname.split("/");
794
+ while (toSegments[0] === "..") {
795
+ toSegments.shift();
796
+ routePathnameIndex -= 1;
797
+ }
798
+ to.pathname = toSegments.join("/");
799
+ }
800
+ from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
801
+ }
802
+ let path = resolvePath(to, from);
803
+ let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
804
+ let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
805
+ if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
806
+ path.pathname += "/";
807
+ }
808
+ return path;
809
+ }
810
+ var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
811
+ var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
812
+ var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
813
+ var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
814
+ var DataWithResponseInit = class {
815
+ constructor(data2, init) {
816
+ this.type = "DataWithResponseInit";
817
+ this.data = data2;
818
+ this.init = init || null;
819
+ }
820
+ };
821
+ function data(data2, init) {
822
+ return new DataWithResponseInit(
823
+ data2,
824
+ typeof init === "number" ? { status: init } : init
825
+ );
826
+ }
827
+ var redirect = (url, init = 302) => {
828
+ let responseInit = init;
829
+ if (typeof responseInit === "number") {
830
+ responseInit = { status: responseInit };
831
+ } else if (typeof responseInit.status === "undefined") {
832
+ responseInit.status = 302;
833
+ }
834
+ let headers = new Headers(responseInit.headers);
835
+ headers.set("Location", url);
836
+ return new Response(null, { ...responseInit, headers });
837
+ };
838
+ var redirectDocument = (url, init) => {
839
+ let response = redirect(url, init);
840
+ response.headers.set("X-Remix-Reload-Document", "true");
841
+ return response;
842
+ };
843
+ var replace = (url, init) => {
844
+ let response = redirect(url, init);
845
+ response.headers.set("X-Remix-Replace", "true");
846
+ return response;
847
+ };
848
+ var ErrorResponseImpl = class {
849
+ constructor(status, statusText, data2, internal = false) {
850
+ this.status = status;
851
+ this.statusText = statusText || "";
852
+ this.internal = internal;
853
+ if (data2 instanceof Error) {
854
+ this.data = data2.toString();
855
+ this.error = data2;
856
+ } else {
857
+ this.data = data2;
858
+ }
859
+ }
860
+ };
861
+ function isRouteErrorResponse(error) {
862
+ return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
863
+ }
864
+ function getRoutePattern(matches) {
865
+ return matches.map((m) => m.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
866
+ }
867
+
868
+ // lib/router/router.ts
869
+ var validMutationMethodsArr = [
870
+ "POST",
871
+ "PUT",
872
+ "PATCH",
873
+ "DELETE"
874
+ ];
875
+ var validMutationMethods = new Set(
876
+ validMutationMethodsArr
877
+ );
878
+ var validRequestMethodsArr = [
879
+ "GET",
880
+ ...validMutationMethodsArr
881
+ ];
882
+ var validRequestMethods = new Set(validRequestMethodsArr);
883
+ var redirectStatusCodes = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
884
+ var defaultMapRouteProperties = (route) => ({
885
+ hasErrorBoundary: Boolean(route.hasErrorBoundary)
886
+ });
887
+ var ResetLoaderDataSymbol = Symbol("ResetLoaderData");
888
+ function createStaticHandler(routes, opts) {
889
+ invariant(
890
+ routes.length > 0,
891
+ "You must provide a non-empty routes array to createStaticHandler"
892
+ );
893
+ let manifest = {};
894
+ let basename = (opts ? opts.basename : null) || "/";
895
+ let _mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
896
+ let mapRouteProperties = _mapRouteProperties;
897
+ if (opts?.unstable_instrumentations) {
898
+ let instrumentations = opts.unstable_instrumentations;
899
+ mapRouteProperties = (route) => {
900
+ return {
901
+ ..._mapRouteProperties(route),
902
+ ...getRouteInstrumentationUpdates(
903
+ instrumentations.map((i) => i.route).filter(Boolean),
904
+ route
905
+ )
906
+ };
907
+ };
908
+ }
909
+ let dataRoutes = convertRoutesToDataRoutes(
910
+ routes,
911
+ mapRouteProperties,
912
+ void 0,
913
+ manifest
914
+ );
915
+ async function query(request, {
916
+ requestContext,
917
+ filterMatchesToLoad,
918
+ skipLoaderErrorBubbling,
919
+ skipRevalidation,
920
+ dataStrategy,
921
+ generateMiddlewareResponse
922
+ } = {}) {
923
+ let url = new URL(request.url);
924
+ let method = request.method;
925
+ let location = createLocation("", createPath(url), null, "default");
926
+ let matches = matchRoutes(dataRoutes, location, basename);
927
+ requestContext = requestContext != null ? requestContext : new RouterContextProvider();
928
+ if (!isValidMethod(method) && method !== "HEAD") {
929
+ let error = getInternalRouterError(405, { method });
930
+ let { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes);
931
+ let staticContext = {
932
+ basename,
933
+ location,
934
+ matches: methodNotAllowedMatches,
935
+ loaderData: {},
936
+ actionData: null,
937
+ errors: {
938
+ [route.id]: error
939
+ },
940
+ statusCode: error.status,
941
+ loaderHeaders: {},
942
+ actionHeaders: {}
943
+ };
944
+ return generateMiddlewareResponse ? generateMiddlewareResponse(() => Promise.resolve(staticContext)) : staticContext;
945
+ } else if (!matches) {
946
+ let error = getInternalRouterError(404, { pathname: location.pathname });
947
+ let { matches: notFoundMatches, route } = getShortCircuitMatches(dataRoutes);
948
+ let staticContext = {
949
+ basename,
950
+ location,
951
+ matches: notFoundMatches,
952
+ loaderData: {},
953
+ actionData: null,
954
+ errors: {
955
+ [route.id]: error
956
+ },
957
+ statusCode: error.status,
958
+ loaderHeaders: {},
959
+ actionHeaders: {}
960
+ };
961
+ return generateMiddlewareResponse ? generateMiddlewareResponse(() => Promise.resolve(staticContext)) : staticContext;
962
+ }
963
+ if (generateMiddlewareResponse) {
964
+ invariant(
965
+ requestContext instanceof RouterContextProvider,
966
+ "When using middleware in `staticHandler.query()`, any provided `requestContext` must be an instance of `RouterContextProvider`"
967
+ );
968
+ try {
969
+ await loadLazyMiddlewareForMatches(
970
+ matches,
971
+ manifest,
972
+ mapRouteProperties
973
+ );
974
+ let renderedStaticContext;
975
+ let response = await runServerMiddlewarePipeline(
976
+ {
977
+ request,
978
+ unstable_pattern: getRoutePattern(matches),
979
+ matches,
980
+ params: matches[0].params,
981
+ // If we're calling middleware then it must be enabled so we can cast
982
+ // this to the proper type knowing it's not an `AppLoadContext`
983
+ context: requestContext
984
+ },
985
+ async () => {
986
+ let res = await generateMiddlewareResponse(
987
+ async (revalidationRequest, opts2 = {}) => {
988
+ let result2 = await queryImpl(
989
+ revalidationRequest,
990
+ location,
991
+ matches,
992
+ requestContext,
993
+ dataStrategy || null,
994
+ skipLoaderErrorBubbling === true,
995
+ null,
996
+ "filterMatchesToLoad" in opts2 ? opts2.filterMatchesToLoad ?? null : filterMatchesToLoad ?? null,
997
+ skipRevalidation === true
998
+ );
999
+ if (isResponse(result2)) {
1000
+ return result2;
1001
+ }
1002
+ renderedStaticContext = { location, basename, ...result2 };
1003
+ return renderedStaticContext;
1004
+ }
1005
+ );
1006
+ return res;
1007
+ },
1008
+ async (error, routeId) => {
1009
+ if (isRedirectResponse(error)) {
1010
+ return error;
1011
+ }
1012
+ if (isResponse(error)) {
1013
+ try {
1014
+ error = new ErrorResponseImpl(
1015
+ error.status,
1016
+ error.statusText,
1017
+ await parseResponseBody(error)
1018
+ );
1019
+ } catch (e) {
1020
+ error = e;
1021
+ }
1022
+ }
1023
+ if (isDataWithResponseInit(error)) {
1024
+ error = dataWithResponseInitToErrorResponse(error);
1025
+ }
1026
+ if (renderedStaticContext) {
1027
+ if (routeId in renderedStaticContext.loaderData) {
1028
+ renderedStaticContext.loaderData[routeId] = void 0;
1029
+ }
1030
+ let staticContext = getStaticContextFromError(
1031
+ dataRoutes,
1032
+ renderedStaticContext,
1033
+ error,
1034
+ skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
1035
+ );
1036
+ return generateMiddlewareResponse(
1037
+ () => Promise.resolve(staticContext)
1038
+ );
1039
+ } else {
1040
+ let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
1041
+ matches,
1042
+ matches.find(
1043
+ (m) => m.route.id === routeId || m.route.loader
1044
+ )?.route.id || routeId
1045
+ ).route.id;
1046
+ let staticContext = {
1047
+ matches,
1048
+ location,
1049
+ basename,
1050
+ loaderData: {},
1051
+ actionData: null,
1052
+ errors: {
1053
+ [boundaryRouteId]: error
1054
+ },
1055
+ statusCode: isRouteErrorResponse(error) ? error.status : 500,
1056
+ actionHeaders: {},
1057
+ loaderHeaders: {}
1058
+ };
1059
+ return generateMiddlewareResponse(
1060
+ () => Promise.resolve(staticContext)
1061
+ );
1062
+ }
1063
+ }
1064
+ );
1065
+ invariant(isResponse(response), "Expected a response in query()");
1066
+ return response;
1067
+ } catch (e) {
1068
+ if (isResponse(e)) {
1069
+ return e;
1070
+ }
1071
+ throw e;
1072
+ }
1073
+ }
1074
+ let result = await queryImpl(
1075
+ request,
1076
+ location,
1077
+ matches,
1078
+ requestContext,
1079
+ dataStrategy || null,
1080
+ skipLoaderErrorBubbling === true,
1081
+ null,
1082
+ filterMatchesToLoad || null,
1083
+ skipRevalidation === true
1084
+ );
1085
+ if (isResponse(result)) {
1086
+ return result;
1087
+ }
1088
+ return { location, basename, ...result };
1089
+ }
1090
+ async function queryRoute(request, {
1091
+ routeId,
1092
+ requestContext,
1093
+ dataStrategy,
1094
+ generateMiddlewareResponse
1095
+ } = {}) {
1096
+ let url = new URL(request.url);
1097
+ let method = request.method;
1098
+ let location = createLocation("", createPath(url), null, "default");
1099
+ let matches = matchRoutes(dataRoutes, location, basename);
1100
+ requestContext = requestContext != null ? requestContext : new RouterContextProvider();
1101
+ if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") {
1102
+ throw getInternalRouterError(405, { method });
1103
+ } else if (!matches) {
1104
+ throw getInternalRouterError(404, { pathname: location.pathname });
1105
+ }
1106
+ let match = routeId ? matches.find((m) => m.route.id === routeId) : getTargetMatch(matches, location);
1107
+ if (routeId && !match) {
1108
+ throw getInternalRouterError(403, {
1109
+ pathname: location.pathname,
1110
+ routeId
1111
+ });
1112
+ } else if (!match) {
1113
+ throw getInternalRouterError(404, { pathname: location.pathname });
1114
+ }
1115
+ if (generateMiddlewareResponse) {
1116
+ invariant(
1117
+ requestContext instanceof RouterContextProvider,
1118
+ "When using middleware in `staticHandler.queryRoute()`, any provided `requestContext` must be an instance of `RouterContextProvider`"
1119
+ );
1120
+ await loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties);
1121
+ let response = await runServerMiddlewarePipeline(
1122
+ {
1123
+ request,
1124
+ unstable_pattern: getRoutePattern(matches),
1125
+ matches,
1126
+ params: matches[0].params,
1127
+ // If we're calling middleware then it must be enabled so we can cast
1128
+ // this to the proper type knowing it's not an `AppLoadContext`
1129
+ context: requestContext
1130
+ },
1131
+ async () => {
1132
+ let res = await generateMiddlewareResponse(
1133
+ async (innerRequest) => {
1134
+ let result2 = await queryImpl(
1135
+ innerRequest,
1136
+ location,
1137
+ matches,
1138
+ requestContext,
1139
+ dataStrategy || null,
1140
+ false,
1141
+ match,
1142
+ null,
1143
+ false
1144
+ );
1145
+ let processed = handleQueryResult(result2);
1146
+ return isResponse(processed) ? processed : typeof processed === "string" ? new Response(processed) : Response.json(processed);
1147
+ }
1148
+ );
1149
+ return res;
1150
+ },
1151
+ (error) => {
1152
+ if (isDataWithResponseInit(error)) {
1153
+ return Promise.resolve(dataWithResponseInitToResponse(error));
1154
+ }
1155
+ if (isResponse(error)) {
1156
+ return Promise.resolve(error);
1157
+ }
1158
+ throw error;
1159
+ }
1160
+ );
1161
+ return response;
1162
+ }
1163
+ let result = await queryImpl(
1164
+ request,
1165
+ location,
1166
+ matches,
1167
+ requestContext,
1168
+ dataStrategy || null,
1169
+ false,
1170
+ match,
1171
+ null,
1172
+ false
1173
+ );
1174
+ return handleQueryResult(result);
1175
+ function handleQueryResult(result2) {
1176
+ if (isResponse(result2)) {
1177
+ return result2;
1178
+ }
1179
+ let error = result2.errors ? Object.values(result2.errors)[0] : void 0;
1180
+ if (error !== void 0) {
1181
+ throw error;
1182
+ }
1183
+ if (result2.actionData) {
1184
+ return Object.values(result2.actionData)[0];
1185
+ }
1186
+ if (result2.loaderData) {
1187
+ return Object.values(result2.loaderData)[0];
1188
+ }
1189
+ return void 0;
1190
+ }
1191
+ }
1192
+ async function queryImpl(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, skipRevalidation) {
1193
+ invariant(
1194
+ request.signal,
1195
+ "query()/queryRoute() requests must contain an AbortController signal"
1196
+ );
1197
+ try {
1198
+ if (isMutationMethod(request.method)) {
1199
+ let result2 = await submit(
1200
+ request,
1201
+ matches,
1202
+ routeMatch || getTargetMatch(matches, location),
1203
+ requestContext,
1204
+ dataStrategy,
1205
+ skipLoaderErrorBubbling,
1206
+ routeMatch != null,
1207
+ filterMatchesToLoad,
1208
+ skipRevalidation
1209
+ );
1210
+ return result2;
1211
+ }
1212
+ let result = await loadRouteData(
1213
+ request,
1214
+ matches,
1215
+ requestContext,
1216
+ dataStrategy,
1217
+ skipLoaderErrorBubbling,
1218
+ routeMatch,
1219
+ filterMatchesToLoad
1220
+ );
1221
+ return isResponse(result) ? result : {
1222
+ ...result,
1223
+ actionData: null,
1224
+ actionHeaders: {}
1225
+ };
1226
+ } catch (e) {
1227
+ if (isDataStrategyResult(e) && isResponse(e.result)) {
1228
+ if (e.type === "error" /* error */) {
1229
+ throw e.result;
1230
+ }
1231
+ return e.result;
1232
+ }
1233
+ if (isRedirectResponse(e)) {
1234
+ return e;
1235
+ }
1236
+ throw e;
1237
+ }
1238
+ }
1239
+ async function submit(request, matches, actionMatch, requestContext, dataStrategy, skipLoaderErrorBubbling, isRouteRequest, filterMatchesToLoad, skipRevalidation) {
1240
+ let result;
1241
+ if (!actionMatch.route.action && !actionMatch.route.lazy) {
1242
+ let error = getInternalRouterError(405, {
1243
+ method: request.method,
1244
+ pathname: new URL(request.url).pathname,
1245
+ routeId: actionMatch.route.id
1246
+ });
1247
+ if (isRouteRequest) {
1248
+ throw error;
1249
+ }
1250
+ result = {
1251
+ type: "error" /* error */,
1252
+ error
1253
+ };
1254
+ } else {
1255
+ let dsMatches = getTargetedDataStrategyMatches(
1256
+ mapRouteProperties,
1257
+ manifest,
1258
+ request,
1259
+ matches,
1260
+ actionMatch,
1261
+ [],
1262
+ requestContext
1263
+ );
1264
+ let results = await callDataStrategy(
1265
+ request,
1266
+ dsMatches,
1267
+ isRouteRequest,
1268
+ requestContext,
1269
+ dataStrategy
1270
+ );
1271
+ result = results[actionMatch.route.id];
1272
+ if (request.signal.aborted) {
1273
+ throwStaticHandlerAbortedError(request, isRouteRequest);
1274
+ }
1275
+ }
1276
+ if (isRedirectResult(result)) {
1277
+ throw new Response(null, {
1278
+ status: result.response.status,
1279
+ headers: {
1280
+ Location: result.response.headers.get("Location")
1281
+ }
1282
+ });
1283
+ }
1284
+ if (isRouteRequest) {
1285
+ if (isErrorResult(result)) {
1286
+ throw result.error;
1287
+ }
1288
+ return {
1289
+ matches: [actionMatch],
1290
+ loaderData: {},
1291
+ actionData: { [actionMatch.route.id]: result.data },
1292
+ errors: null,
1293
+ // Note: statusCode + headers are unused here since queryRoute will
1294
+ // return the raw Response or value
1295
+ statusCode: 200,
1296
+ loaderHeaders: {},
1297
+ actionHeaders: {}
1298
+ };
1299
+ }
1300
+ if (skipRevalidation) {
1301
+ if (isErrorResult(result)) {
1302
+ let boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id);
1303
+ return {
1304
+ statusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500,
1305
+ actionData: null,
1306
+ actionHeaders: {
1307
+ ...result.headers ? { [actionMatch.route.id]: result.headers } : {}
1308
+ },
1309
+ matches,
1310
+ loaderData: {},
1311
+ errors: {
1312
+ [boundaryMatch.route.id]: result.error
1313
+ },
1314
+ loaderHeaders: {}
1315
+ };
1316
+ } else {
1317
+ return {
1318
+ actionData: {
1319
+ [actionMatch.route.id]: result.data
1320
+ },
1321
+ actionHeaders: result.headers ? { [actionMatch.route.id]: result.headers } : {},
1322
+ matches,
1323
+ loaderData: {},
1324
+ errors: null,
1325
+ statusCode: result.statusCode || 200,
1326
+ loaderHeaders: {}
1327
+ };
1328
+ }
1329
+ }
1330
+ let loaderRequest = new Request(request.url, {
1331
+ headers: request.headers,
1332
+ redirect: request.redirect,
1333
+ signal: request.signal
1334
+ });
1335
+ if (isErrorResult(result)) {
1336
+ let boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id);
1337
+ let handlerContext2 = await loadRouteData(
1338
+ loaderRequest,
1339
+ matches,
1340
+ requestContext,
1341
+ dataStrategy,
1342
+ skipLoaderErrorBubbling,
1343
+ null,
1344
+ filterMatchesToLoad,
1345
+ [boundaryMatch.route.id, result]
1346
+ );
1347
+ return {
1348
+ ...handlerContext2,
1349
+ statusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500,
1350
+ actionData: null,
1351
+ actionHeaders: {
1352
+ ...result.headers ? { [actionMatch.route.id]: result.headers } : {}
1353
+ }
1354
+ };
1355
+ }
1356
+ let handlerContext = await loadRouteData(
1357
+ loaderRequest,
1358
+ matches,
1359
+ requestContext,
1360
+ dataStrategy,
1361
+ skipLoaderErrorBubbling,
1362
+ null,
1363
+ filterMatchesToLoad
1364
+ );
1365
+ return {
1366
+ ...handlerContext,
1367
+ actionData: {
1368
+ [actionMatch.route.id]: result.data
1369
+ },
1370
+ // action status codes take precedence over loader status codes
1371
+ ...result.statusCode ? { statusCode: result.statusCode } : {},
1372
+ actionHeaders: result.headers ? { [actionMatch.route.id]: result.headers } : {}
1373
+ };
1374
+ }
1375
+ async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) {
1376
+ let isRouteRequest = routeMatch != null;
1377
+ if (isRouteRequest && !routeMatch?.route.loader && !routeMatch?.route.lazy) {
1378
+ throw getInternalRouterError(400, {
1379
+ method: request.method,
1380
+ pathname: new URL(request.url).pathname,
1381
+ routeId: routeMatch?.route.id
1382
+ });
1383
+ }
1384
+ let dsMatches;
1385
+ if (routeMatch) {
1386
+ dsMatches = getTargetedDataStrategyMatches(
1387
+ mapRouteProperties,
1388
+ manifest,
1389
+ request,
1390
+ matches,
1391
+ routeMatch,
1392
+ [],
1393
+ requestContext
1394
+ );
1395
+ } else {
1396
+ let maxIdx = pendingActionResult && isErrorResult(pendingActionResult[1]) ? (
1397
+ // Up to but not including the boundary
1398
+ matches.findIndex((m) => m.route.id === pendingActionResult[0]) - 1
1399
+ ) : void 0;
1400
+ let pattern = getRoutePattern(matches);
1401
+ dsMatches = matches.map((match, index) => {
1402
+ if (maxIdx != null && index > maxIdx) {
1403
+ return getDataStrategyMatch(
1404
+ mapRouteProperties,
1405
+ manifest,
1406
+ request,
1407
+ pattern,
1408
+ match,
1409
+ [],
1410
+ requestContext,
1411
+ false
1412
+ );
1413
+ }
1414
+ return getDataStrategyMatch(
1415
+ mapRouteProperties,
1416
+ manifest,
1417
+ request,
1418
+ pattern,
1419
+ match,
1420
+ [],
1421
+ requestContext,
1422
+ (match.route.loader || match.route.lazy) != null && (!filterMatchesToLoad || filterMatchesToLoad(match))
1423
+ );
1424
+ });
1425
+ }
1426
+ if (!dataStrategy && !dsMatches.some((m) => m.shouldLoad)) {
1427
+ return {
1428
+ matches,
1429
+ loaderData: {},
1430
+ errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? {
1431
+ [pendingActionResult[0]]: pendingActionResult[1].error
1432
+ } : null,
1433
+ statusCode: 200,
1434
+ loaderHeaders: {}
1435
+ };
1436
+ }
1437
+ let results = await callDataStrategy(
1438
+ request,
1439
+ dsMatches,
1440
+ isRouteRequest,
1441
+ requestContext,
1442
+ dataStrategy
1443
+ );
1444
+ if (request.signal.aborted) {
1445
+ throwStaticHandlerAbortedError(request, isRouteRequest);
1446
+ }
1447
+ let handlerContext = processRouteLoaderData(
1448
+ matches,
1449
+ results,
1450
+ pendingActionResult,
1451
+ true,
1452
+ skipLoaderErrorBubbling
1453
+ );
1454
+ return {
1455
+ ...handlerContext,
1456
+ matches
1457
+ };
1458
+ }
1459
+ async function callDataStrategy(request, matches, isRouteRequest, requestContext, dataStrategy) {
1460
+ let results = await callDataStrategyImpl(
1461
+ dataStrategy || defaultDataStrategy,
1462
+ request,
1463
+ matches,
1464
+ null,
1465
+ requestContext);
1466
+ let dataResults = {};
1467
+ await Promise.all(
1468
+ matches.map(async (match) => {
1469
+ if (!(match.route.id in results)) {
1470
+ return;
1471
+ }
1472
+ let result = results[match.route.id];
1473
+ if (isRedirectDataStrategyResult(result)) {
1474
+ let response = result.result;
1475
+ throw normalizeRelativeRoutingRedirectResponse(
1476
+ response,
1477
+ request,
1478
+ match.route.id,
1479
+ matches,
1480
+ basename
1481
+ );
1482
+ }
1483
+ if (isRouteRequest) {
1484
+ if (isResponse(result.result)) {
1485
+ throw result;
1486
+ } else if (isDataWithResponseInit(result.result)) {
1487
+ throw dataWithResponseInitToResponse(result.result);
1488
+ }
1489
+ }
1490
+ dataResults[match.route.id] = await convertDataStrategyResultToDataResult(result);
1491
+ })
1492
+ );
1493
+ return dataResults;
1494
+ }
1495
+ return {
1496
+ dataRoutes,
1497
+ query,
1498
+ queryRoute
1499
+ };
1500
+ }
1501
+ function getStaticContextFromError(routes, handlerContext, error, boundaryId) {
1502
+ let errorBoundaryId = boundaryId || handlerContext._deepestRenderedBoundaryId || routes[0].id;
1503
+ return {
1504
+ ...handlerContext,
1505
+ statusCode: isRouteErrorResponse(error) ? error.status : 500,
1506
+ errors: {
1507
+ [errorBoundaryId]: error
1508
+ }
1509
+ };
1510
+ }
1511
+ function throwStaticHandlerAbortedError(request, isRouteRequest) {
1512
+ if (request.signal.reason !== void 0) {
1513
+ throw request.signal.reason;
1514
+ }
1515
+ let method = isRouteRequest ? "queryRoute" : "query";
1516
+ throw new Error(
1517
+ `${method}() call aborted without an \`AbortSignal.reason\`: ${request.method} ${request.url}`
1518
+ );
1519
+ }
1520
+ function normalizeTo(location, matches, basename, to, fromRouteId, relative) {
1521
+ let contextualMatches;
1522
+ let activeRouteMatch;
1523
+ {
1524
+ contextualMatches = matches;
1525
+ activeRouteMatch = matches[matches.length - 1];
1526
+ }
1527
+ let path = resolveTo(
1528
+ to ? to : ".",
1529
+ getResolveToMatches(contextualMatches),
1530
+ stripBasename(location.pathname, basename) || location.pathname,
1531
+ relative === "path"
1532
+ );
1533
+ if (to == null) {
1534
+ path.search = location.search;
1535
+ path.hash = location.hash;
1536
+ }
1537
+ if ((to == null || to === "" || to === ".") && activeRouteMatch) {
1538
+ let nakedIndex = hasNakedIndexQuery(path.search);
1539
+ if (activeRouteMatch.route.index && !nakedIndex) {
1540
+ path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
1541
+ } else if (!activeRouteMatch.route.index && nakedIndex) {
1542
+ let params = new URLSearchParams(path.search);
1543
+ let indexValues = params.getAll("index");
1544
+ params.delete("index");
1545
+ indexValues.filter((v) => v).forEach((v) => params.append("index", v));
1546
+ let qs = params.toString();
1547
+ path.search = qs ? `?${qs}` : "";
1548
+ }
1549
+ }
1550
+ if (basename !== "/") {
1551
+ path.pathname = prependBasename({ basename, pathname: path.pathname });
1552
+ }
1553
+ return createPath(path);
1554
+ }
1555
+ function shouldRevalidateLoader(loaderMatch, arg) {
1556
+ if (loaderMatch.route.shouldRevalidate) {
1557
+ let routeChoice = loaderMatch.route.shouldRevalidate(arg);
1558
+ if (typeof routeChoice === "boolean") {
1559
+ return routeChoice;
1560
+ }
1561
+ }
1562
+ return arg.defaultShouldRevalidate;
1563
+ }
1564
+ var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();
1565
+ var loadLazyRouteProperty = ({
1566
+ key,
1567
+ route,
1568
+ manifest,
1569
+ mapRouteProperties
1570
+ }) => {
1571
+ let routeToUpdate = manifest[route.id];
1572
+ invariant(routeToUpdate, "No route found in manifest");
1573
+ if (!routeToUpdate.lazy || typeof routeToUpdate.lazy !== "object") {
1574
+ return;
1575
+ }
1576
+ let lazyFn = routeToUpdate.lazy[key];
1577
+ if (!lazyFn) {
1578
+ return;
1579
+ }
1580
+ let cache2 = lazyRoutePropertyCache.get(routeToUpdate);
1581
+ if (!cache2) {
1582
+ cache2 = {};
1583
+ lazyRoutePropertyCache.set(routeToUpdate, cache2);
1584
+ }
1585
+ let cachedPromise = cache2[key];
1586
+ if (cachedPromise) {
1587
+ return cachedPromise;
1588
+ }
1589
+ let propertyPromise = (async () => {
1590
+ let isUnsupported = isUnsupportedLazyRouteObjectKey(key);
1591
+ let staticRouteValue = routeToUpdate[key];
1592
+ let isStaticallyDefined = staticRouteValue !== void 0 && key !== "hasErrorBoundary";
1593
+ if (isUnsupported) {
1594
+ warning(
1595
+ !isUnsupported,
1596
+ "Route property " + key + " is not a supported lazy route property. This property will be ignored."
1597
+ );
1598
+ cache2[key] = Promise.resolve();
1599
+ } else if (isStaticallyDefined) {
1600
+ warning(
1601
+ false,
1602
+ `Route "${routeToUpdate.id}" has a static property "${key}" defined. The lazy property will be ignored.`
1603
+ );
1604
+ } else {
1605
+ let value = await lazyFn();
1606
+ if (value != null) {
1607
+ Object.assign(routeToUpdate, { [key]: value });
1608
+ Object.assign(routeToUpdate, mapRouteProperties(routeToUpdate));
1609
+ }
1610
+ }
1611
+ if (typeof routeToUpdate.lazy === "object") {
1612
+ routeToUpdate.lazy[key] = void 0;
1613
+ if (Object.values(routeToUpdate.lazy).every((value) => value === void 0)) {
1614
+ routeToUpdate.lazy = void 0;
1615
+ }
1616
+ }
1617
+ })();
1618
+ cache2[key] = propertyPromise;
1619
+ return propertyPromise;
1620
+ };
1621
+ var lazyRouteFunctionCache = /* @__PURE__ */ new WeakMap();
1622
+ function loadLazyRoute(route, type, manifest, mapRouteProperties, lazyRoutePropertiesToSkip) {
1623
+ let routeToUpdate = manifest[route.id];
1624
+ invariant(routeToUpdate, "No route found in manifest");
1625
+ if (!route.lazy) {
1626
+ return {
1627
+ lazyRoutePromise: void 0,
1628
+ lazyHandlerPromise: void 0
1629
+ };
1630
+ }
1631
+ if (typeof route.lazy === "function") {
1632
+ let cachedPromise = lazyRouteFunctionCache.get(routeToUpdate);
1633
+ if (cachedPromise) {
1634
+ return {
1635
+ lazyRoutePromise: cachedPromise,
1636
+ lazyHandlerPromise: cachedPromise
1637
+ };
1638
+ }
1639
+ let lazyRoutePromise2 = (async () => {
1640
+ invariant(
1641
+ typeof route.lazy === "function",
1642
+ "No lazy route function found"
1643
+ );
1644
+ let lazyRoute = await route.lazy();
1645
+ let routeUpdates = {};
1646
+ for (let lazyRouteProperty in lazyRoute) {
1647
+ let lazyValue = lazyRoute[lazyRouteProperty];
1648
+ if (lazyValue === void 0) {
1649
+ continue;
1650
+ }
1651
+ let isUnsupported = isUnsupportedLazyRouteFunctionKey(lazyRouteProperty);
1652
+ let staticRouteValue = routeToUpdate[lazyRouteProperty];
1653
+ let isStaticallyDefined = staticRouteValue !== void 0 && // This property isn't static since it should always be updated based
1654
+ // on the route updates
1655
+ lazyRouteProperty !== "hasErrorBoundary";
1656
+ if (isUnsupported) {
1657
+ warning(
1658
+ !isUnsupported,
1659
+ "Route property " + lazyRouteProperty + " is not a supported property to be returned from a lazy route function. This property will be ignored."
1660
+ );
1661
+ } else if (isStaticallyDefined) {
1662
+ warning(
1663
+ !isStaticallyDefined,
1664
+ `Route "${routeToUpdate.id}" has a static property "${lazyRouteProperty}" defined but its lazy function is also returning a value for this property. The lazy route property "${lazyRouteProperty}" will be ignored.`
1665
+ );
1666
+ } else {
1667
+ routeUpdates[lazyRouteProperty] = lazyValue;
1668
+ }
1669
+ }
1670
+ Object.assign(routeToUpdate, routeUpdates);
1671
+ Object.assign(routeToUpdate, {
1672
+ // To keep things framework agnostic, we use the provided `mapRouteProperties`
1673
+ // function to set the framework-aware properties (`element`/`hasErrorBoundary`)
1674
+ // since the logic will differ between frameworks.
1675
+ ...mapRouteProperties(routeToUpdate),
1676
+ lazy: void 0
1677
+ });
1678
+ })();
1679
+ lazyRouteFunctionCache.set(routeToUpdate, lazyRoutePromise2);
1680
+ lazyRoutePromise2.catch(() => {
1681
+ });
1682
+ return {
1683
+ lazyRoutePromise: lazyRoutePromise2,
1684
+ lazyHandlerPromise: lazyRoutePromise2
1685
+ };
1686
+ }
1687
+ let lazyKeys = Object.keys(route.lazy);
1688
+ let lazyPropertyPromises = [];
1689
+ let lazyHandlerPromise = void 0;
1690
+ for (let key of lazyKeys) {
1691
+ if (lazyRoutePropertiesToSkip && lazyRoutePropertiesToSkip.includes(key)) {
1692
+ continue;
1693
+ }
1694
+ let promise = loadLazyRouteProperty({
1695
+ key,
1696
+ route,
1697
+ manifest,
1698
+ mapRouteProperties
1699
+ });
1700
+ if (promise) {
1701
+ lazyPropertyPromises.push(promise);
1702
+ if (key === type) {
1703
+ lazyHandlerPromise = promise;
1704
+ }
1705
+ }
1706
+ }
1707
+ let lazyRoutePromise = lazyPropertyPromises.length > 0 ? Promise.all(lazyPropertyPromises).then(() => {
1708
+ }) : void 0;
1709
+ lazyRoutePromise?.catch(() => {
1710
+ });
1711
+ lazyHandlerPromise?.catch(() => {
1712
+ });
1713
+ return {
1714
+ lazyRoutePromise,
1715
+ lazyHandlerPromise
1716
+ };
1717
+ }
1718
+ function isNonNullable(value) {
1719
+ return value !== void 0;
1720
+ }
1721
+ function loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties) {
1722
+ let promises = matches.map(({ route }) => {
1723
+ if (typeof route.lazy !== "object" || !route.lazy.middleware) {
1724
+ return void 0;
1725
+ }
1726
+ return loadLazyRouteProperty({
1727
+ key: "middleware",
1728
+ route,
1729
+ manifest,
1730
+ mapRouteProperties
1731
+ });
1732
+ }).filter(isNonNullable);
1733
+ return promises.length > 0 ? Promise.all(promises) : void 0;
1734
+ }
1735
+ async function defaultDataStrategy(args) {
1736
+ let matchesToLoad = args.matches.filter((m) => m.shouldLoad);
1737
+ let keyedResults = {};
1738
+ let results = await Promise.all(matchesToLoad.map((m) => m.resolve()));
1739
+ results.forEach((result, i) => {
1740
+ keyedResults[matchesToLoad[i].route.id] = result;
1741
+ });
1742
+ return keyedResults;
1743
+ }
1744
+ function runServerMiddlewarePipeline(args, handler, errorHandler) {
1745
+ return runMiddlewarePipeline(
1746
+ args,
1747
+ handler,
1748
+ processResult,
1749
+ isResponse,
1750
+ errorHandler
1751
+ );
1752
+ function processResult(result) {
1753
+ return isDataWithResponseInit(result) ? dataWithResponseInitToResponse(result) : result;
1754
+ }
1755
+ }
1756
+ async function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) {
1757
+ let { matches, request, params, context, unstable_pattern } = args;
1758
+ let tuples = matches.flatMap(
1759
+ (m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
1760
+ );
1761
+ let result = await callRouteMiddleware(
1762
+ {
1763
+ request,
1764
+ params,
1765
+ context,
1766
+ unstable_pattern
1767
+ },
1768
+ tuples,
1769
+ handler,
1770
+ processResult,
1771
+ isResult,
1772
+ errorHandler
1773
+ );
1774
+ return result;
1775
+ }
1776
+ async function callRouteMiddleware(args, middlewares, handler, processResult, isResult, errorHandler, idx = 0) {
1777
+ let { request } = args;
1778
+ if (request.signal.aborted) {
1779
+ throw request.signal.reason ?? new Error(`Request aborted: ${request.method} ${request.url}`);
1780
+ }
1781
+ let tuple = middlewares[idx];
1782
+ if (!tuple) {
1783
+ let result = await handler();
1784
+ return result;
1785
+ }
1786
+ let [routeId, middleware] = tuple;
1787
+ let nextResult;
1788
+ let next = async () => {
1789
+ if (nextResult) {
1790
+ throw new Error("You may only call `next()` once per middleware");
1791
+ }
1792
+ try {
1793
+ let result = await callRouteMiddleware(
1794
+ args,
1795
+ middlewares,
1796
+ handler,
1797
+ processResult,
1798
+ isResult,
1799
+ errorHandler,
1800
+ idx + 1
1801
+ );
1802
+ nextResult = { value: result };
1803
+ return nextResult.value;
1804
+ } catch (error) {
1805
+ nextResult = { value: await errorHandler(error, routeId, nextResult) };
1806
+ return nextResult.value;
1807
+ }
1808
+ };
1809
+ try {
1810
+ let value = await middleware(args, next);
1811
+ let result = value != null ? processResult(value) : void 0;
1812
+ if (isResult(result)) {
1813
+ return result;
1814
+ } else if (nextResult) {
1815
+ return result ?? nextResult.value;
1816
+ } else {
1817
+ nextResult = { value: await next() };
1818
+ return nextResult.value;
1819
+ }
1820
+ } catch (error) {
1821
+ let response = await errorHandler(error, routeId, nextResult);
1822
+ return response;
1823
+ }
1824
+ }
1825
+ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip) {
1826
+ let lazyMiddlewarePromise = loadLazyRouteProperty({
1827
+ key: "middleware",
1828
+ route: match.route,
1829
+ manifest,
1830
+ mapRouteProperties
1831
+ });
1832
+ let lazyRoutePromises = loadLazyRoute(
1833
+ match.route,
1834
+ isMutationMethod(request.method) ? "action" : "loader",
1835
+ manifest,
1836
+ mapRouteProperties,
1837
+ lazyRoutePropertiesToSkip
1838
+ );
1839
+ return {
1840
+ middleware: lazyMiddlewarePromise,
1841
+ route: lazyRoutePromises.lazyRoutePromise,
1842
+ handler: lazyRoutePromises.lazyHandlerPromise
1843
+ };
1844
+ }
1845
+ function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
1846
+ let isUsingNewApi = false;
1847
+ let _lazyPromises = getDataStrategyMatchLazyPromises(
1848
+ mapRouteProperties,
1849
+ manifest,
1850
+ request,
1851
+ match,
1852
+ lazyRoutePropertiesToSkip
1853
+ );
1854
+ return {
1855
+ ...match,
1856
+ _lazyPromises,
1857
+ shouldLoad,
1858
+ shouldRevalidateArgs,
1859
+ shouldCallHandler(defaultShouldRevalidate) {
1860
+ isUsingNewApi = true;
1861
+ if (!shouldRevalidateArgs) {
1862
+ return shouldLoad;
1863
+ }
1864
+ if (typeof defaultShouldRevalidate === "boolean") {
1865
+ return shouldRevalidateLoader(match, {
1866
+ ...shouldRevalidateArgs,
1867
+ defaultShouldRevalidate
1868
+ });
1869
+ }
1870
+ return shouldRevalidateLoader(match, shouldRevalidateArgs);
1871
+ },
1872
+ resolve(handlerOverride) {
1873
+ let { lazy, loader, middleware } = match.route;
1874
+ let callHandler = isUsingNewApi || shouldLoad || handlerOverride && !isMutationMethod(request.method) && (lazy || loader);
1875
+ let isMiddlewareOnlyRoute = middleware && middleware.length > 0 && !loader && !lazy;
1876
+ if (callHandler && (isMutationMethod(request.method) || !isMiddlewareOnlyRoute)) {
1877
+ return callLoaderOrAction({
1878
+ request,
1879
+ unstable_pattern,
1880
+ match,
1881
+ lazyHandlerPromise: _lazyPromises?.handler,
1882
+ lazyRoutePromise: _lazyPromises?.route,
1883
+ handlerOverride,
1884
+ scopedContext
1885
+ });
1886
+ }
1887
+ return Promise.resolve({ type: "data" /* data */, result: void 0 });
1888
+ }
1889
+ };
1890
+ }
1891
+ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, matches, targetMatch, lazyRoutePropertiesToSkip, scopedContext, shouldRevalidateArgs = null) {
1892
+ return matches.map((match) => {
1893
+ if (match.route.id !== targetMatch.route.id) {
1894
+ return {
1895
+ ...match,
1896
+ shouldLoad: false,
1897
+ shouldRevalidateArgs,
1898
+ shouldCallHandler: () => false,
1899
+ _lazyPromises: getDataStrategyMatchLazyPromises(
1900
+ mapRouteProperties,
1901
+ manifest,
1902
+ request,
1903
+ match,
1904
+ lazyRoutePropertiesToSkip
1905
+ ),
1906
+ resolve: () => Promise.resolve({ type: "data", result: void 0 })
1907
+ };
1908
+ }
1909
+ return getDataStrategyMatch(
1910
+ mapRouteProperties,
1911
+ manifest,
1912
+ request,
1913
+ getRoutePattern(matches),
1914
+ match,
1915
+ lazyRoutePropertiesToSkip,
1916
+ scopedContext,
1917
+ true,
1918
+ shouldRevalidateArgs
1919
+ );
1920
+ });
1921
+ }
1922
+ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherKey, scopedContext, isStaticHandler) {
1923
+ if (matches.some((m) => m._lazyPromises?.middleware)) {
1924
+ await Promise.all(matches.map((m) => m._lazyPromises?.middleware));
1925
+ }
1926
+ let dataStrategyArgs = {
1927
+ request,
1928
+ unstable_pattern: getRoutePattern(matches),
1929
+ params: matches[0].params,
1930
+ context: scopedContext,
1931
+ matches
1932
+ };
1933
+ let runClientMiddleware = () => {
1934
+ throw new Error(
1935
+ "You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`"
1936
+ );
1937
+ } ;
1938
+ let results = await dataStrategyImpl({
1939
+ ...dataStrategyArgs,
1940
+ fetcherKey,
1941
+ runClientMiddleware
1942
+ });
1943
+ try {
1944
+ await Promise.all(
1945
+ matches.flatMap((m) => [
1946
+ m._lazyPromises?.handler,
1947
+ m._lazyPromises?.route
1948
+ ])
1949
+ );
1950
+ } catch (e) {
1951
+ }
1952
+ return results;
1953
+ }
1954
+ async function callLoaderOrAction({
1955
+ request,
1956
+ unstable_pattern,
1957
+ match,
1958
+ lazyHandlerPromise,
1959
+ lazyRoutePromise,
1960
+ handlerOverride,
1961
+ scopedContext
1962
+ }) {
1963
+ let result;
1964
+ let onReject;
1965
+ let isAction = isMutationMethod(request.method);
1966
+ let type = isAction ? "action" : "loader";
1967
+ let runHandler = (handler) => {
1968
+ let reject;
1969
+ let abortPromise = new Promise((_, r) => reject = r);
1970
+ onReject = () => reject();
1971
+ request.signal.addEventListener("abort", onReject);
1972
+ let actualHandler = (ctx) => {
1973
+ if (typeof handler !== "function") {
1974
+ return Promise.reject(
1975
+ new Error(
1976
+ `You cannot call the handler for a route which defines a boolean "${type}" [routeId: ${match.route.id}]`
1977
+ )
1978
+ );
1979
+ }
1980
+ return handler(
1981
+ {
1982
+ request,
1983
+ unstable_pattern,
1984
+ params: match.params,
1985
+ context: scopedContext
1986
+ },
1987
+ ...ctx !== void 0 ? [ctx] : []
1988
+ );
1989
+ };
1990
+ let handlerPromise = (async () => {
1991
+ try {
1992
+ let val = await (handlerOverride ? handlerOverride((ctx) => actualHandler(ctx)) : actualHandler());
1993
+ return { type: "data", result: val };
1994
+ } catch (e) {
1995
+ return { type: "error", result: e };
1996
+ }
1997
+ })();
1998
+ return Promise.race([handlerPromise, abortPromise]);
1999
+ };
2000
+ try {
2001
+ let handler = isAction ? match.route.action : match.route.loader;
2002
+ if (lazyHandlerPromise || lazyRoutePromise) {
2003
+ if (handler) {
2004
+ let handlerError;
2005
+ let [value] = await Promise.all([
2006
+ // If the handler throws, don't let it immediately bubble out,
2007
+ // since we need to let the lazy() execution finish so we know if this
2008
+ // route has a boundary that can handle the error
2009
+ runHandler(handler).catch((e) => {
2010
+ handlerError = e;
2011
+ }),
2012
+ // Ensure all lazy route promises are resolved before continuing
2013
+ lazyHandlerPromise,
2014
+ lazyRoutePromise
2015
+ ]);
2016
+ if (handlerError !== void 0) {
2017
+ throw handlerError;
2018
+ }
2019
+ result = value;
2020
+ } else {
2021
+ await lazyHandlerPromise;
2022
+ let handler2 = isAction ? match.route.action : match.route.loader;
2023
+ if (handler2) {
2024
+ [result] = await Promise.all([runHandler(handler2), lazyRoutePromise]);
2025
+ } else if (type === "action") {
2026
+ let url = new URL(request.url);
2027
+ let pathname = url.pathname + url.search;
2028
+ throw getInternalRouterError(405, {
2029
+ method: request.method,
2030
+ pathname,
2031
+ routeId: match.route.id
2032
+ });
2033
+ } else {
2034
+ return { type: "data" /* data */, result: void 0 };
2035
+ }
2036
+ }
2037
+ } else if (!handler) {
2038
+ let url = new URL(request.url);
2039
+ let pathname = url.pathname + url.search;
2040
+ throw getInternalRouterError(404, {
2041
+ pathname
2042
+ });
2043
+ } else {
2044
+ result = await runHandler(handler);
2045
+ }
2046
+ } catch (e) {
2047
+ return { type: "error" /* error */, result: e };
2048
+ } finally {
2049
+ if (onReject) {
2050
+ request.signal.removeEventListener("abort", onReject);
2051
+ }
2052
+ }
2053
+ return result;
2054
+ }
2055
+ async function parseResponseBody(response) {
2056
+ let contentType = response.headers.get("Content-Type");
2057
+ if (contentType && /\bapplication\/json\b/.test(contentType)) {
2058
+ return response.body == null ? null : response.json();
2059
+ }
2060
+ return response.text();
2061
+ }
2062
+ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
2063
+ let { result, type } = dataStrategyResult;
2064
+ if (isResponse(result)) {
2065
+ let data2;
2066
+ try {
2067
+ data2 = await parseResponseBody(result);
2068
+ } catch (e) {
2069
+ return { type: "error" /* error */, error: e };
2070
+ }
2071
+ if (type === "error" /* error */) {
2072
+ return {
2073
+ type: "error" /* error */,
2074
+ error: new ErrorResponseImpl(result.status, result.statusText, data2),
2075
+ statusCode: result.status,
2076
+ headers: result.headers
2077
+ };
2078
+ }
2079
+ return {
2080
+ type: "data" /* data */,
2081
+ data: data2,
2082
+ statusCode: result.status,
2083
+ headers: result.headers
2084
+ };
2085
+ }
2086
+ if (type === "error" /* error */) {
2087
+ if (isDataWithResponseInit(result)) {
2088
+ if (result.data instanceof Error) {
2089
+ return {
2090
+ type: "error" /* error */,
2091
+ error: result.data,
2092
+ statusCode: result.init?.status,
2093
+ headers: result.init?.headers ? new Headers(result.init.headers) : void 0
2094
+ };
2095
+ }
2096
+ return {
2097
+ type: "error" /* error */,
2098
+ error: dataWithResponseInitToErrorResponse(result),
2099
+ statusCode: isRouteErrorResponse(result) ? result.status : void 0,
2100
+ headers: result.init?.headers ? new Headers(result.init.headers) : void 0
2101
+ };
2102
+ }
2103
+ return {
2104
+ type: "error" /* error */,
2105
+ error: result,
2106
+ statusCode: isRouteErrorResponse(result) ? result.status : void 0
2107
+ };
2108
+ }
2109
+ if (isDataWithResponseInit(result)) {
2110
+ return {
2111
+ type: "data" /* data */,
2112
+ data: result.data,
2113
+ statusCode: result.init?.status,
2114
+ headers: result.init?.headers ? new Headers(result.init.headers) : void 0
2115
+ };
2116
+ }
2117
+ return { type: "data" /* data */, data: result };
2118
+ }
2119
+ function normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename) {
2120
+ let location = response.headers.get("Location");
2121
+ invariant(
2122
+ location,
2123
+ "Redirects returned/thrown from loaders/actions must have a Location header"
2124
+ );
2125
+ if (!isAbsoluteUrl(location)) {
2126
+ let trimmedMatches = matches.slice(
2127
+ 0,
2128
+ matches.findIndex((m) => m.route.id === routeId) + 1
2129
+ );
2130
+ location = normalizeTo(
2131
+ new URL(request.url),
2132
+ trimmedMatches,
2133
+ basename,
2134
+ location
2135
+ );
2136
+ response.headers.set("Location", location);
2137
+ }
2138
+ return response;
2139
+ }
2140
+ function processRouteLoaderData(matches, results, pendingActionResult, isStaticHandler = false, skipLoaderErrorBubbling = false) {
2141
+ let loaderData = {};
2142
+ let errors = null;
2143
+ let statusCode;
2144
+ let foundError = false;
2145
+ let loaderHeaders = {};
2146
+ let pendingError = pendingActionResult && isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : void 0;
2147
+ matches.forEach((match) => {
2148
+ if (!(match.route.id in results)) {
2149
+ return;
2150
+ }
2151
+ let id = match.route.id;
2152
+ let result = results[id];
2153
+ invariant(
2154
+ !isRedirectResult(result),
2155
+ "Cannot handle redirect results in processLoaderData"
2156
+ );
2157
+ if (isErrorResult(result)) {
2158
+ let error = result.error;
2159
+ if (pendingError !== void 0) {
2160
+ error = pendingError;
2161
+ pendingError = void 0;
2162
+ }
2163
+ errors = errors || {};
2164
+ if (skipLoaderErrorBubbling) {
2165
+ errors[id] = error;
2166
+ } else {
2167
+ let boundaryMatch = findNearestBoundary(matches, id);
2168
+ if (errors[boundaryMatch.route.id] == null) {
2169
+ errors[boundaryMatch.route.id] = error;
2170
+ }
2171
+ }
2172
+ if (!isStaticHandler) {
2173
+ loaderData[id] = ResetLoaderDataSymbol;
2174
+ }
2175
+ if (!foundError) {
2176
+ foundError = true;
2177
+ statusCode = isRouteErrorResponse(result.error) ? result.error.status : 500;
2178
+ }
2179
+ if (result.headers) {
2180
+ loaderHeaders[id] = result.headers;
2181
+ }
2182
+ } else {
2183
+ loaderData[id] = result.data;
2184
+ if (result.statusCode && result.statusCode !== 200 && !foundError) {
2185
+ statusCode = result.statusCode;
2186
+ }
2187
+ if (result.headers) {
2188
+ loaderHeaders[id] = result.headers;
2189
+ }
2190
+ }
2191
+ });
2192
+ if (pendingError !== void 0 && pendingActionResult) {
2193
+ errors = { [pendingActionResult[0]]: pendingError };
2194
+ if (pendingActionResult[2]) {
2195
+ loaderData[pendingActionResult[2]] = void 0;
2196
+ }
2197
+ }
2198
+ return {
2199
+ loaderData,
2200
+ errors,
2201
+ statusCode: statusCode || 200,
2202
+ loaderHeaders
2203
+ };
2204
+ }
2205
+ function findNearestBoundary(matches, routeId) {
2206
+ let eligibleMatches = routeId ? matches.slice(0, matches.findIndex((m) => m.route.id === routeId) + 1) : [...matches];
2207
+ return eligibleMatches.reverse().find((m) => m.route.hasErrorBoundary === true) || matches[0];
2208
+ }
2209
+ function getShortCircuitMatches(routes) {
2210
+ let route = routes.length === 1 ? routes[0] : routes.find((r) => r.index || !r.path || r.path === "/") || {
2211
+ id: `__shim-error-route__`
2212
+ };
2213
+ return {
2214
+ matches: [
2215
+ {
2216
+ params: {},
2217
+ pathname: "",
2218
+ pathnameBase: "",
2219
+ route
2220
+ }
2221
+ ],
2222
+ route
2223
+ };
2224
+ }
2225
+ function getInternalRouterError(status, {
2226
+ pathname,
2227
+ routeId,
2228
+ method,
2229
+ type,
2230
+ message
2231
+ } = {}) {
2232
+ let statusText = "Unknown Server Error";
2233
+ let errorMessage = "Unknown @remix-run/router error";
2234
+ if (status === 400) {
2235
+ statusText = "Bad Request";
2236
+ if (method && pathname && routeId) {
2237
+ errorMessage = `You made a ${method} request to "${pathname}" but did not provide a \`loader\` for route "${routeId}", so there is no way to handle the request.`;
2238
+ } else if (type === "invalid-body") {
2239
+ errorMessage = "Unable to encode submission body";
2240
+ }
2241
+ } else if (status === 403) {
2242
+ statusText = "Forbidden";
2243
+ errorMessage = `Route "${routeId}" does not match URL "${pathname}"`;
2244
+ } else if (status === 404) {
2245
+ statusText = "Not Found";
2246
+ errorMessage = `No route matches URL "${pathname}"`;
2247
+ } else if (status === 405) {
2248
+ statusText = "Method Not Allowed";
2249
+ if (method && pathname && routeId) {
2250
+ errorMessage = `You made a ${method.toUpperCase()} request to "${pathname}" but did not provide an \`action\` for route "${routeId}", so there is no way to handle the request.`;
2251
+ } else if (method) {
2252
+ errorMessage = `Invalid request method "${method.toUpperCase()}"`;
2253
+ }
2254
+ }
2255
+ return new ErrorResponseImpl(
2256
+ status || 500,
2257
+ statusText,
2258
+ new Error(errorMessage),
2259
+ true
2260
+ );
2261
+ }
2262
+ function dataWithResponseInitToResponse(data2) {
2263
+ return Response.json(data2.data, data2.init ?? void 0);
2264
+ }
2265
+ function dataWithResponseInitToErrorResponse(data2) {
2266
+ return new ErrorResponseImpl(
2267
+ data2.init?.status ?? 500,
2268
+ data2.init?.statusText ?? "Internal Server Error",
2269
+ data2.data
2270
+ );
2271
+ }
2272
+ function isDataStrategyResult(result) {
2273
+ return result != null && typeof result === "object" && "type" in result && "result" in result && (result.type === "data" /* data */ || result.type === "error" /* error */);
2274
+ }
2275
+ function isRedirectDataStrategyResult(result) {
2276
+ return isResponse(result.result) && redirectStatusCodes.has(result.result.status);
2277
+ }
2278
+ function isErrorResult(result) {
2279
+ return result.type === "error" /* error */;
2280
+ }
2281
+ function isRedirectResult(result) {
2282
+ return (result && result.type) === "redirect" /* redirect */;
2283
+ }
2284
+ function isDataWithResponseInit(value) {
2285
+ return typeof value === "object" && value != null && "type" in value && "data" in value && "init" in value && value.type === "DataWithResponseInit";
2286
+ }
2287
+ function isResponse(value) {
2288
+ return value != null && typeof value.status === "number" && typeof value.statusText === "string" && typeof value.headers === "object" && typeof value.body !== "undefined";
2289
+ }
2290
+ function isRedirectStatusCode(statusCode) {
2291
+ return redirectStatusCodes.has(statusCode);
2292
+ }
2293
+ function isRedirectResponse(result) {
2294
+ return isResponse(result) && isRedirectStatusCode(result.status) && result.headers.has("Location");
2295
+ }
2296
+ function isValidMethod(method) {
2297
+ return validRequestMethods.has(method.toUpperCase());
2298
+ }
2299
+ function isMutationMethod(method) {
2300
+ return validMutationMethods.has(method.toUpperCase());
2301
+ }
2302
+ function hasNakedIndexQuery(search) {
2303
+ return new URLSearchParams(search).getAll("index").some((v) => v === "");
2304
+ }
2305
+ function getTargetMatch(matches, location) {
2306
+ let search = typeof location === "string" ? parsePath(location).search : location.search;
2307
+ if (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || "")) {
2308
+ return matches[matches.length - 1];
2309
+ }
2310
+ let pathMatches = getPathContributingMatches(matches);
2311
+ return pathMatches[pathMatches.length - 1];
2312
+ }
2313
+
2314
+ // lib/server-runtime/invariant.ts
2315
+ function invariant2(value, message) {
2316
+ if (value === false || value === null || typeof value === "undefined") {
2317
+ console.error(
2318
+ "The following error is a bug in React Router; please open an issue! https://github.com/remix-run/react-router/issues/new/choose"
2319
+ );
2320
+ throw new Error(message);
2321
+ }
2322
+ }
2323
+
2324
+ // lib/server-runtime/headers.ts
2325
+ function getDocumentHeadersImpl(context, getRouteHeadersFn, _defaultHeaders) {
2326
+ let boundaryIdx = context.errors ? context.matches.findIndex((m) => context.errors[m.route.id]) : -1;
2327
+ let matches = boundaryIdx >= 0 ? context.matches.slice(0, boundaryIdx + 1) : context.matches;
2328
+ let errorHeaders;
2329
+ if (boundaryIdx >= 0) {
2330
+ let { actionHeaders, actionData, loaderHeaders, loaderData } = context;
2331
+ context.matches.slice(boundaryIdx).some((match) => {
2332
+ let id = match.route.id;
2333
+ if (actionHeaders[id] && (!actionData || !actionData.hasOwnProperty(id))) {
2334
+ errorHeaders = actionHeaders[id];
2335
+ } else if (loaderHeaders[id] && !loaderData.hasOwnProperty(id)) {
2336
+ errorHeaders = loaderHeaders[id];
2337
+ }
2338
+ return errorHeaders != null;
2339
+ });
2340
+ }
2341
+ const defaultHeaders = new Headers(_defaultHeaders);
2342
+ return matches.reduce((parentHeaders, match, idx) => {
2343
+ let { id } = match.route;
2344
+ let loaderHeaders = context.loaderHeaders[id] || new Headers();
2345
+ let actionHeaders = context.actionHeaders[id] || new Headers();
2346
+ let includeErrorHeaders = errorHeaders != null && idx === matches.length - 1;
2347
+ let includeErrorCookies = includeErrorHeaders && errorHeaders !== loaderHeaders && errorHeaders !== actionHeaders;
2348
+ let headersFn = getRouteHeadersFn(match);
2349
+ if (headersFn == null) {
2350
+ let headers2 = new Headers(parentHeaders);
2351
+ if (includeErrorCookies) {
2352
+ prependCookies(errorHeaders, headers2);
2353
+ }
2354
+ prependCookies(actionHeaders, headers2);
2355
+ prependCookies(loaderHeaders, headers2);
2356
+ return headers2;
2357
+ }
2358
+ let headers = new Headers(
2359
+ typeof headersFn === "function" ? headersFn({
2360
+ loaderHeaders,
2361
+ parentHeaders,
2362
+ actionHeaders,
2363
+ errorHeaders: includeErrorHeaders ? errorHeaders : void 0
2364
+ }) : headersFn
2365
+ );
2366
+ if (includeErrorCookies) {
2367
+ prependCookies(errorHeaders, headers);
2368
+ }
2369
+ prependCookies(actionHeaders, headers);
2370
+ prependCookies(loaderHeaders, headers);
2371
+ prependCookies(parentHeaders, headers);
2372
+ return headers;
2373
+ }, new Headers(defaultHeaders));
2374
+ }
2375
+ function prependCookies(parentHeaders, childHeaders) {
2376
+ let parentSetCookieString = parentHeaders.get("Set-Cookie");
2377
+ if (parentSetCookieString) {
2378
+ let cookies = setCookieParser.splitCookiesString(parentSetCookieString);
2379
+ let childCookies = new Set(childHeaders.getSetCookie());
2380
+ cookies.forEach((cookie) => {
2381
+ if (!childCookies.has(cookie)) {
2382
+ childHeaders.append("Set-Cookie", cookie);
2383
+ }
2384
+ });
2385
+ }
2386
+ }
2387
+ var SINGLE_FETCH_REDIRECT_STATUS = 202;
2388
+
2389
+ // lib/actions.ts
2390
+ function throwIfPotentialCSRFAttack(headers, allowedActionOrigins) {
2391
+ let originHeader = headers.get("origin");
2392
+ let originDomain = typeof originHeader === "string" && originHeader !== "null" ? new URL(originHeader).host : originHeader;
2393
+ let host = parseHostHeader(headers);
2394
+ if (originDomain && (!host || originDomain !== host.value)) {
2395
+ if (!isAllowedOrigin(originDomain, allowedActionOrigins)) {
2396
+ if (host) {
2397
+ throw new Error(
2398
+ `${host.type} header does not match \`origin\` header from a forwarded action request. Aborting the action.`
2399
+ );
2400
+ } else {
2401
+ throw new Error(
2402
+ "`x-forwarded-host` or `host` headers are not provided. One of these is needed to compare the `origin` header from a forwarded action request. Aborting the action."
2403
+ );
2404
+ }
2405
+ }
2406
+ }
2407
+ }
2408
+ function matchWildcardDomain(domain, pattern) {
2409
+ const domainParts = domain.split(".");
2410
+ const patternParts = pattern.split(".");
2411
+ if (patternParts.length < 1) {
2412
+ return false;
2413
+ }
2414
+ if (domainParts.length < patternParts.length) {
2415
+ return false;
2416
+ }
2417
+ while (patternParts.length) {
2418
+ const patternPart = patternParts.pop();
2419
+ const domainPart = domainParts.pop();
2420
+ switch (patternPart) {
2421
+ case "": {
2422
+ return false;
2423
+ }
2424
+ case "*": {
2425
+ if (domainPart) {
2426
+ continue;
2427
+ } else {
2428
+ return false;
2429
+ }
2430
+ }
2431
+ case "**": {
2432
+ if (patternParts.length > 0) {
2433
+ return false;
2434
+ }
2435
+ return domainPart !== void 0;
2436
+ }
2437
+ case void 0:
2438
+ default: {
2439
+ if (domainPart !== patternPart) {
2440
+ return false;
2441
+ }
2442
+ }
2443
+ }
2444
+ }
2445
+ return domainParts.length === 0;
2446
+ }
2447
+ function isAllowedOrigin(originDomain, allowedActionOrigins = []) {
2448
+ return allowedActionOrigins.some(
2449
+ (allowedOrigin) => allowedOrigin && (allowedOrigin === originDomain || matchWildcardDomain(originDomain, allowedOrigin))
2450
+ );
2451
+ }
2452
+ function parseHostHeader(headers) {
2453
+ let forwardedHostHeader = headers.get("x-forwarded-host");
2454
+ let forwardedHostValue = forwardedHostHeader?.split(",")[0]?.trim();
2455
+ let hostHeader = headers.get("host");
2456
+ return forwardedHostValue ? {
2457
+ type: "x-forwarded-host",
2458
+ value: forwardedHostValue
2459
+ } : hostHeader ? {
2460
+ type: "host",
2461
+ value: hostHeader
2462
+ } : void 0;
2463
+ }
2464
+
2465
+ // lib/errors.ts
2466
+ var ERROR_DIGEST_BASE = "REACT_ROUTER_ERROR";
2467
+ var ERROR_DIGEST_REDIRECT = "REDIRECT";
2468
+ var ERROR_DIGEST_ROUTE_ERROR_RESPONSE = "ROUTE_ERROR_RESPONSE";
2469
+ function createRedirectErrorDigest(response) {
2470
+ return `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_REDIRECT}:${JSON.stringify({
2471
+ status: response.status,
2472
+ statusText: response.statusText,
2473
+ location: response.headers.get("Location"),
2474
+ reloadDocument: response.headers.get("X-Remix-Reload-Document") === "true",
2475
+ replace: response.headers.get("X-Remix-Replace") === "true"
2476
+ })}`;
2477
+ }
2478
+ function createRouteErrorResponseDigest(response) {
2479
+ let status = 500;
2480
+ let statusText = "";
2481
+ let data2;
2482
+ if (isDataWithResponseInit(response)) {
2483
+ status = response.init?.status ?? status;
2484
+ statusText = response.init?.statusText ?? statusText;
2485
+ data2 = response.data;
2486
+ } else {
2487
+ status = response.status;
2488
+ statusText = response.statusText;
2489
+ data2 = void 0;
2490
+ }
2491
+ return `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_ROUTE_ERROR_RESPONSE}:${JSON.stringify(
2492
+ {
2493
+ status,
2494
+ statusText,
2495
+ data: data2
2496
+ }
2497
+ )}`;
2498
+ }
2499
+
2500
+ // lib/rsc/server.rsc.ts
2501
+ var Outlet = reactServerClient.Outlet;
2502
+ var WithComponentProps = reactServerClient.UNSAFE_WithComponentProps;
2503
+ var WithErrorBoundaryProps = reactServerClient.UNSAFE_WithErrorBoundaryProps;
2504
+ var WithHydrateFallbackProps = reactServerClient.UNSAFE_WithHydrateFallbackProps;
2505
+ var globalVar = typeof globalThis !== "undefined" ? globalThis : global;
2506
+ var ServerStorage = globalVar.___reactRouterServerStorage___ ?? (globalVar.___reactRouterServerStorage___ = new node_async_hooks.AsyncLocalStorage());
2507
+ var redirect2 = (...args) => {
2508
+ const response = redirect(...args);
2509
+ const ctx = ServerStorage.getStore();
2510
+ if (ctx && ctx.runningAction) {
2511
+ ctx.redirect = response;
2512
+ }
2513
+ return response;
2514
+ };
2515
+ var redirectDocument2 = (...args) => {
2516
+ const response = redirectDocument(...args);
2517
+ const ctx = ServerStorage.getStore();
2518
+ if (ctx && ctx.runningAction) {
2519
+ ctx.redirect = response;
2520
+ }
2521
+ return response;
2522
+ };
2523
+ var replace2 = (...args) => {
2524
+ const response = replace(...args);
2525
+ const ctx = ServerStorage.getStore();
2526
+ if (ctx && ctx.runningAction) {
2527
+ ctx.redirect = response;
2528
+ }
2529
+ return response;
2530
+ };
2531
+ var cachedResolvePromise = (
2532
+ // @ts-expect-error - on 18 types, requires 19.
2533
+ React2__namespace.cache(async (resolve) => {
2534
+ return Promise.allSettled([resolve]).then((r) => r[0]);
2535
+ })
2536
+ );
2537
+ var Await = async ({
2538
+ children,
2539
+ resolve,
2540
+ errorElement
2541
+ }) => {
2542
+ let promise = cachedResolvePromise(resolve);
2543
+ let resolved = await promise;
2544
+ if (resolved.status === "rejected" && !errorElement) {
2545
+ throw resolved.reason;
2546
+ }
2547
+ if (resolved.status === "rejected") {
2548
+ return React2__namespace.createElement(reactServerClient.UNSAFE_AwaitContextProvider, {
2549
+ children: React2__namespace.createElement(React2__namespace.Fragment, null, errorElement),
2550
+ value: { _tracked: true, _error: resolved.reason }
2551
+ });
2552
+ }
2553
+ const toRender = typeof children === "function" ? children(resolved.value) : children;
2554
+ return React2__namespace.createElement(reactServerClient.UNSAFE_AwaitContextProvider, {
2555
+ children: toRender,
2556
+ value: { _tracked: true, _data: resolved.value }
2557
+ });
2558
+ };
2559
+ async function matchRSCServerRequest({
2560
+ allowedActionOrigins,
2561
+ createTemporaryReferenceSet,
2562
+ basename,
2563
+ decodeReply,
2564
+ requestContext,
2565
+ loadServerAction,
2566
+ decodeAction,
2567
+ decodeFormState,
2568
+ onError,
2569
+ request,
2570
+ routes,
2571
+ generateResponse
2572
+ }) {
2573
+ let url = new URL(request.url);
2574
+ basename = basename || "/";
2575
+ let normalizedPath = url.pathname;
2576
+ if (url.pathname.endsWith("/_.rsc")) {
2577
+ normalizedPath = url.pathname.replace(/_\.rsc$/, "");
2578
+ } else if (url.pathname.endsWith(".rsc")) {
2579
+ normalizedPath = url.pathname.replace(/\.rsc$/, "");
2580
+ }
2581
+ if (stripBasename(normalizedPath, basename) !== "/" && normalizedPath.endsWith("/")) {
2582
+ normalizedPath = normalizedPath.slice(0, -1);
2583
+ }
2584
+ url.pathname = normalizedPath;
2585
+ basename = basename.length > normalizedPath.length ? normalizedPath : basename;
2586
+ let routerRequest = new Request(url.toString(), {
2587
+ method: request.method,
2588
+ headers: request.headers,
2589
+ body: request.body,
2590
+ signal: request.signal,
2591
+ duplex: request.body ? "half" : void 0
2592
+ });
2593
+ const temporaryReferences = createTemporaryReferenceSet();
2594
+ const requestUrl = new URL(request.url);
2595
+ if (isManifestRequest(requestUrl)) {
2596
+ let response2 = await generateManifestResponse(
2597
+ routes,
2598
+ basename,
2599
+ request,
2600
+ generateResponse,
2601
+ temporaryReferences
2602
+ );
2603
+ return response2;
2604
+ }
2605
+ let isDataRequest = isReactServerRequest(requestUrl);
2606
+ let matches = matchRoutes(routes, url.pathname, basename);
2607
+ if (matches) {
2608
+ await Promise.all(matches.map((m) => explodeLazyRoute(m.route)));
2609
+ }
2610
+ const leafMatch = matches?.[matches.length - 1];
2611
+ if (!isDataRequest && leafMatch && !leafMatch.route.Component && !leafMatch.route.ErrorBoundary) {
2612
+ return generateResourceResponse(
2613
+ routerRequest,
2614
+ routes,
2615
+ basename,
2616
+ leafMatch.route.id,
2617
+ requestContext,
2618
+ onError
2619
+ );
2620
+ }
2621
+ let response = await generateRenderResponse(
2622
+ routerRequest,
2623
+ routes,
2624
+ basename,
2625
+ isDataRequest,
2626
+ decodeReply,
2627
+ requestContext,
2628
+ loadServerAction,
2629
+ decodeAction,
2630
+ decodeFormState,
2631
+ onError,
2632
+ generateResponse,
2633
+ temporaryReferences,
2634
+ allowedActionOrigins
2635
+ );
2636
+ response.headers.set("X-Remix-Response", "yes");
2637
+ return response;
2638
+ }
2639
+ async function generateManifestResponse(routes, basename, request, generateResponse, temporaryReferences) {
2640
+ let url = new URL(request.url);
2641
+ let pathParam = url.searchParams.get("paths");
2642
+ let pathnames = pathParam ? pathParam.split(",").filter(Boolean) : [url.pathname.replace(/\.manifest$/, "")];
2643
+ let routeIds = /* @__PURE__ */ new Set();
2644
+ let matchedRoutes = pathnames.flatMap((pathname) => {
2645
+ let pathnameMatches = matchRoutes(routes, pathname, basename);
2646
+ return pathnameMatches?.map((m, i) => ({
2647
+ ...m.route,
2648
+ parentId: pathnameMatches[i - 1]?.route.id
2649
+ })) ?? [];
2650
+ }).filter((route) => {
2651
+ if (!routeIds.has(route.id)) {
2652
+ routeIds.add(route.id);
2653
+ return true;
2654
+ }
2655
+ return false;
2656
+ });
2657
+ let payload = {
2658
+ type: "manifest",
2659
+ patches: (await Promise.all([
2660
+ ...matchedRoutes.map((route) => getManifestRoute(route)),
2661
+ getAdditionalRoutePatches(
2662
+ pathnames,
2663
+ routes,
2664
+ basename,
2665
+ Array.from(routeIds)
2666
+ )
2667
+ ])).flat(1)
2668
+ };
2669
+ return generateResponse(
2670
+ {
2671
+ statusCode: 200,
2672
+ headers: new Headers({
2673
+ "Content-Type": "text/x-component",
2674
+ Vary: "Content-Type"
2675
+ }),
2676
+ payload
2677
+ },
2678
+ { temporaryReferences, onError: defaultOnError }
2679
+ );
2680
+ }
2681
+ function prependBasenameToRedirectResponse(response, basename = "/") {
2682
+ if (basename === "/") {
2683
+ return response;
2684
+ }
2685
+ let redirect3 = response.headers.get("Location");
2686
+ if (!redirect3 || isAbsoluteUrl(redirect3)) {
2687
+ return response;
2688
+ }
2689
+ response.headers.set(
2690
+ "Location",
2691
+ prependBasename({ basename, pathname: redirect3 })
2692
+ );
2693
+ return response;
2694
+ }
2695
+ async function processServerAction(request, basename, decodeReply, loadServerAction, decodeAction, decodeFormState, onError, temporaryReferences) {
2696
+ const getRevalidationRequest = () => new Request(request.url, {
2697
+ method: "GET",
2698
+ headers: request.headers,
2699
+ signal: request.signal
2700
+ });
2701
+ const isFormRequest = canDecodeWithFormData(
2702
+ request.headers.get("Content-Type")
2703
+ );
2704
+ const actionId = request.headers.get("rsc-action-id");
2705
+ if (actionId) {
2706
+ if (!decodeReply || !loadServerAction) {
2707
+ throw new Error(
2708
+ "Cannot handle enhanced server action without decodeReply and loadServerAction functions"
2709
+ );
2710
+ }
2711
+ const reply = isFormRequest ? await request.formData() : await request.text();
2712
+ const actionArgs = await decodeReply(reply, { temporaryReferences });
2713
+ const action = await loadServerAction(actionId);
2714
+ const serverAction = action.bind(null, ...actionArgs);
2715
+ let actionResult = Promise.resolve(serverAction());
2716
+ try {
2717
+ await actionResult;
2718
+ } catch (error) {
2719
+ if (isResponse(error)) {
2720
+ return error;
2721
+ }
2722
+ onError?.(error);
2723
+ }
2724
+ let maybeFormData = actionArgs.length === 1 ? actionArgs[0] : actionArgs[1];
2725
+ let formData = maybeFormData && typeof maybeFormData === "object" && maybeFormData instanceof FormData ? maybeFormData : null;
2726
+ let skipRevalidation = formData?.has("$SKIP_REVALIDATION") ?? false;
2727
+ return {
2728
+ actionResult,
2729
+ revalidationRequest: getRevalidationRequest(),
2730
+ skipRevalidation
2731
+ };
2732
+ } else if (isFormRequest) {
2733
+ const formData = await request.clone().formData();
2734
+ if (Array.from(formData.keys()).some((k) => k.startsWith("$ACTION_"))) {
2735
+ if (!decodeAction) {
2736
+ throw new Error(
2737
+ "Cannot handle form actions without a decodeAction function"
2738
+ );
2739
+ }
2740
+ const action = await decodeAction(formData);
2741
+ let formState = void 0;
2742
+ try {
2743
+ let result = await action();
2744
+ if (isRedirectResponse(result)) {
2745
+ result = prependBasenameToRedirectResponse(result, basename);
2746
+ }
2747
+ formState = decodeFormState?.(result, formData);
2748
+ } catch (error) {
2749
+ if (isRedirectResponse(error)) {
2750
+ return prependBasenameToRedirectResponse(error, basename);
2751
+ }
2752
+ if (isResponse(error)) {
2753
+ return error;
2754
+ }
2755
+ onError?.(error);
2756
+ }
2757
+ return {
2758
+ formState,
2759
+ revalidationRequest: getRevalidationRequest(),
2760
+ skipRevalidation: false
2761
+ };
2762
+ }
2763
+ }
2764
+ }
2765
+ async function generateResourceResponse(request, routes, basename, routeId, requestContext, onError) {
2766
+ try {
2767
+ const staticHandler = createStaticHandler(routes, {
2768
+ basename
2769
+ });
2770
+ let response = await staticHandler.queryRoute(request, {
2771
+ routeId,
2772
+ requestContext,
2773
+ async generateMiddlewareResponse(queryRoute) {
2774
+ try {
2775
+ let response2 = await queryRoute(request);
2776
+ return generateResourceResponse2(response2);
2777
+ } catch (error) {
2778
+ return generateErrorResponse(error);
2779
+ }
2780
+ }
2781
+ });
2782
+ return response;
2783
+ } catch (error) {
2784
+ return generateErrorResponse(error);
2785
+ }
2786
+ function generateErrorResponse(error) {
2787
+ let response;
2788
+ if (isResponse(error)) {
2789
+ response = error;
2790
+ } else if (isRouteErrorResponse(error)) {
2791
+ onError?.(error);
2792
+ const errorMessage = typeof error.data === "string" ? error.data : error.statusText;
2793
+ response = new Response(errorMessage, {
2794
+ status: error.status,
2795
+ statusText: error.statusText
2796
+ });
2797
+ } else {
2798
+ onError?.(error);
2799
+ response = new Response("Internal Server Error", { status: 500 });
2800
+ }
2801
+ return generateResourceResponse2(response);
2802
+ }
2803
+ function generateResourceResponse2(response) {
2804
+ const headers = new Headers(response.headers);
2805
+ headers.set("React-Router-Resource", "true");
2806
+ return new Response(response.body, {
2807
+ status: response.status,
2808
+ statusText: response.statusText,
2809
+ headers
2810
+ });
2811
+ }
2812
+ }
2813
+ async function generateRenderResponse(request, routes, basename, isDataRequest, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, generateResponse, temporaryReferences, allowedActionOrigins) {
2814
+ let statusCode = 200;
2815
+ let url = new URL(request.url);
2816
+ let isSubmission = isMutationMethod(request.method);
2817
+ let routeIdsToLoad = !isSubmission && url.searchParams.has("_routes") ? url.searchParams.get("_routes").split(",") : null;
2818
+ const staticHandler = createStaticHandler(routes, {
2819
+ basename,
2820
+ mapRouteProperties: (r) => ({
2821
+ hasErrorBoundary: r.ErrorBoundary != null
2822
+ })
2823
+ });
2824
+ let actionResult;
2825
+ const ctx = {
2826
+ runningAction: false
2827
+ };
2828
+ const result = await ServerStorage.run(
2829
+ ctx,
2830
+ () => staticHandler.query(request, {
2831
+ requestContext,
2832
+ skipLoaderErrorBubbling: isDataRequest,
2833
+ skipRevalidation: isSubmission,
2834
+ ...routeIdsToLoad ? { filterMatchesToLoad: (m) => routeIdsToLoad.includes(m.route.id) } : {},
2835
+ async generateMiddlewareResponse(query) {
2836
+ let formState;
2837
+ let skipRevalidation = false;
2838
+ if (request.method === "POST") {
2839
+ throwIfPotentialCSRFAttack(request.headers, allowedActionOrigins);
2840
+ ctx.runningAction = true;
2841
+ let result2 = await processServerAction(
2842
+ request,
2843
+ basename,
2844
+ decodeReply,
2845
+ loadServerAction,
2846
+ decodeAction,
2847
+ decodeFormState,
2848
+ onError,
2849
+ temporaryReferences
2850
+ );
2851
+ ctx.runningAction = false;
2852
+ if (isResponse(result2)) {
2853
+ return generateRedirectResponse(
2854
+ result2,
2855
+ actionResult,
2856
+ basename,
2857
+ isDataRequest,
2858
+ generateResponse,
2859
+ temporaryReferences,
2860
+ ctx.redirect?.headers
2861
+ );
2862
+ }
2863
+ skipRevalidation = result2?.skipRevalidation ?? false;
2864
+ actionResult = result2?.actionResult;
2865
+ formState = result2?.formState;
2866
+ request = result2?.revalidationRequest ?? request;
2867
+ if (ctx.redirect) {
2868
+ return generateRedirectResponse(
2869
+ ctx.redirect,
2870
+ actionResult,
2871
+ basename,
2872
+ isDataRequest,
2873
+ generateResponse,
2874
+ temporaryReferences,
2875
+ void 0
2876
+ );
2877
+ }
2878
+ }
2879
+ let staticContext = await query(
2880
+ request,
2881
+ skipRevalidation ? {
2882
+ filterMatchesToLoad: () => false
2883
+ } : void 0
2884
+ );
2885
+ if (isResponse(staticContext)) {
2886
+ return generateRedirectResponse(
2887
+ staticContext,
2888
+ actionResult,
2889
+ basename,
2890
+ isDataRequest,
2891
+ generateResponse,
2892
+ temporaryReferences,
2893
+ ctx.redirect?.headers
2894
+ );
2895
+ }
2896
+ return generateStaticContextResponse(
2897
+ routes,
2898
+ basename,
2899
+ generateResponse,
2900
+ statusCode,
2901
+ routeIdsToLoad,
2902
+ isDataRequest,
2903
+ isSubmission,
2904
+ actionResult,
2905
+ formState,
2906
+ staticContext,
2907
+ temporaryReferences,
2908
+ skipRevalidation,
2909
+ ctx.redirect?.headers
2910
+ );
2911
+ }
2912
+ })
2913
+ );
2914
+ if (isRedirectResponse(result)) {
2915
+ return generateRedirectResponse(
2916
+ result,
2917
+ actionResult,
2918
+ basename,
2919
+ isDataRequest,
2920
+ generateResponse,
2921
+ temporaryReferences,
2922
+ ctx.redirect?.headers
2923
+ );
2924
+ }
2925
+ invariant2(isResponse(result), "Expected a response from query");
2926
+ return result;
2927
+ }
2928
+ function generateRedirectResponse(response, actionResult, basename, isDataRequest, generateResponse, temporaryReferences, sideEffectRedirectHeaders) {
2929
+ let redirect3 = response.headers.get("Location");
2930
+ if (isDataRequest && basename) {
2931
+ redirect3 = stripBasename(redirect3, basename) || redirect3;
2932
+ }
2933
+ let payload = {
2934
+ type: "redirect",
2935
+ location: redirect3,
2936
+ reload: response.headers.get("X-Remix-Reload-Document") === "true",
2937
+ replace: response.headers.get("X-Remix-Replace") === "true",
2938
+ status: response.status,
2939
+ actionResult
2940
+ };
2941
+ let headers = new Headers(sideEffectRedirectHeaders);
2942
+ for (const [key, value] of response.headers.entries()) {
2943
+ headers.append(key, value);
2944
+ }
2945
+ headers.delete("Location");
2946
+ headers.delete("X-Remix-Reload-Document");
2947
+ headers.delete("X-Remix-Replace");
2948
+ headers.delete("Content-Length");
2949
+ headers.set("Content-Type", "text/x-component");
2950
+ headers.set("Vary", "Content-Type");
2951
+ return generateResponse(
2952
+ {
2953
+ statusCode: SINGLE_FETCH_REDIRECT_STATUS,
2954
+ headers,
2955
+ payload
2956
+ },
2957
+ { temporaryReferences, onError: defaultOnError }
2958
+ );
2959
+ }
2960
+ async function generateStaticContextResponse(routes, basename, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, formState, staticContext, temporaryReferences, skipRevalidation, sideEffectRedirectHeaders) {
2961
+ statusCode = staticContext.statusCode ?? statusCode;
2962
+ if (staticContext.errors) {
2963
+ staticContext.errors = Object.fromEntries(
2964
+ Object.entries(staticContext.errors).map(([key, error]) => [
2965
+ key,
2966
+ isRouteErrorResponse(error) ? Object.fromEntries(Object.entries(error)) : error
2967
+ ])
2968
+ );
2969
+ }
2970
+ staticContext.matches.forEach((m) => {
2971
+ const routeHasNoLoaderData = staticContext.loaderData[m.route.id] === void 0;
2972
+ const routeHasError = Boolean(
2973
+ staticContext.errors && m.route.id in staticContext.errors
2974
+ );
2975
+ if (routeHasNoLoaderData && !routeHasError) {
2976
+ staticContext.loaderData[m.route.id] = null;
2977
+ }
2978
+ });
2979
+ let headers = getDocumentHeadersImpl(
2980
+ staticContext,
2981
+ (match) => match.route.headers,
2982
+ sideEffectRedirectHeaders
2983
+ );
2984
+ headers.delete("Content-Length");
2985
+ const baseRenderPayload = {
2986
+ type: "render",
2987
+ basename: staticContext.basename,
2988
+ actionData: staticContext.actionData,
2989
+ errors: staticContext.errors,
2990
+ loaderData: staticContext.loaderData,
2991
+ location: staticContext.location,
2992
+ formState
2993
+ };
2994
+ const renderPayloadPromise = () => getRenderPayload(
2995
+ baseRenderPayload,
2996
+ routes,
2997
+ basename,
2998
+ routeIdsToLoad,
2999
+ isDataRequest,
3000
+ staticContext
3001
+ );
3002
+ let payload;
3003
+ if (actionResult) {
3004
+ payload = {
3005
+ type: "action",
3006
+ actionResult,
3007
+ rerender: skipRevalidation ? void 0 : renderPayloadPromise()
3008
+ };
3009
+ } else if (isSubmission && isDataRequest) {
3010
+ payload = {
3011
+ ...baseRenderPayload,
3012
+ matches: [],
3013
+ patches: []
3014
+ };
3015
+ } else {
3016
+ payload = await renderPayloadPromise();
3017
+ }
3018
+ return generateResponse(
3019
+ {
3020
+ statusCode,
3021
+ headers,
3022
+ payload
3023
+ },
3024
+ { temporaryReferences, onError: defaultOnError }
3025
+ );
3026
+ }
3027
+ async function getRenderPayload(baseRenderPayload, routes, basename, routeIdsToLoad, isDataRequest, staticContext) {
3028
+ let deepestRenderedRouteIdx = staticContext.matches.length - 1;
3029
+ let parentIds = {};
3030
+ staticContext.matches.forEach((m, i) => {
3031
+ if (i > 0) {
3032
+ parentIds[m.route.id] = staticContext.matches[i - 1].route.id;
3033
+ }
3034
+ if (staticContext.errors && m.route.id in staticContext.errors && deepestRenderedRouteIdx > i) {
3035
+ deepestRenderedRouteIdx = i;
3036
+ }
3037
+ });
3038
+ let matchesPromise = Promise.all(
3039
+ staticContext.matches.map((match, i) => {
3040
+ let isBelowErrorBoundary = i > deepestRenderedRouteIdx;
3041
+ let parentId = parentIds[match.route.id];
3042
+ return getRSCRouteMatch({
3043
+ staticContext,
3044
+ match,
3045
+ routeIdsToLoad,
3046
+ isBelowErrorBoundary,
3047
+ parentId
3048
+ });
3049
+ })
3050
+ );
3051
+ let patchesPromise = getAdditionalRoutePatches(
3052
+ [staticContext.location.pathname],
3053
+ routes,
3054
+ basename,
3055
+ staticContext.matches.map((m) => m.route.id)
3056
+ );
3057
+ let [matches, patches] = await Promise.all([matchesPromise, patchesPromise]);
3058
+ return {
3059
+ ...baseRenderPayload,
3060
+ matches,
3061
+ patches
3062
+ };
3063
+ }
3064
+ async function getRSCRouteMatch({
3065
+ staticContext,
3066
+ match,
3067
+ isBelowErrorBoundary,
3068
+ routeIdsToLoad,
3069
+ parentId
3070
+ }) {
3071
+ await explodeLazyRoute(match.route);
3072
+ const Layout = match.route.Layout || React2__namespace.Fragment;
3073
+ const Component = match.route.Component;
3074
+ const ErrorBoundary = match.route.ErrorBoundary;
3075
+ const HydrateFallback = match.route.HydrateFallback;
3076
+ const loaderData = staticContext.loaderData[match.route.id];
3077
+ const actionData = staticContext.actionData?.[match.route.id];
3078
+ const params = match.params;
3079
+ let element = void 0;
3080
+ let shouldLoadRoute = !routeIdsToLoad || routeIdsToLoad.includes(match.route.id);
3081
+ if (Component && shouldLoadRoute) {
3082
+ element = !isBelowErrorBoundary ? React2__namespace.createElement(
3083
+ Layout,
3084
+ null,
3085
+ isClientReference(Component) ? React2__namespace.createElement(WithComponentProps, {
3086
+ children: React2__namespace.createElement(Component)
3087
+ }) : React2__namespace.createElement(Component, {
3088
+ loaderData,
3089
+ actionData,
3090
+ params,
3091
+ matches: staticContext.matches.map(
3092
+ (match2) => convertRouteMatchToUiMatch(match2, staticContext.loaderData)
3093
+ )
3094
+ })
3095
+ ) : React2__namespace.createElement(Outlet);
3096
+ }
3097
+ let error = void 0;
3098
+ if (ErrorBoundary && staticContext.errors) {
3099
+ error = staticContext.errors[match.route.id];
3100
+ }
3101
+ const errorElement = ErrorBoundary ? React2__namespace.createElement(
3102
+ Layout,
3103
+ null,
3104
+ isClientReference(ErrorBoundary) ? React2__namespace.createElement(WithErrorBoundaryProps, {
3105
+ children: React2__namespace.createElement(ErrorBoundary)
3106
+ }) : React2__namespace.createElement(ErrorBoundary, {
3107
+ loaderData,
3108
+ actionData,
3109
+ params,
3110
+ error
3111
+ })
3112
+ ) : void 0;
3113
+ const hydrateFallbackElement = HydrateFallback ? React2__namespace.createElement(
3114
+ Layout,
3115
+ null,
3116
+ isClientReference(HydrateFallback) ? React2__namespace.createElement(WithHydrateFallbackProps, {
3117
+ children: React2__namespace.createElement(HydrateFallback)
3118
+ }) : React2__namespace.createElement(HydrateFallback, {
3119
+ loaderData,
3120
+ actionData,
3121
+ params
3122
+ })
3123
+ ) : void 0;
3124
+ return {
3125
+ clientAction: match.route.clientAction,
3126
+ clientLoader: match.route.clientLoader,
3127
+ element,
3128
+ errorElement,
3129
+ handle: match.route.handle,
3130
+ hasAction: !!match.route.action,
3131
+ hasComponent: !!Component,
3132
+ hasErrorBoundary: !!ErrorBoundary,
3133
+ hasLoader: !!match.route.loader,
3134
+ hydrateFallbackElement,
3135
+ id: match.route.id,
3136
+ index: match.route.index,
3137
+ links: match.route.links,
3138
+ meta: match.route.meta,
3139
+ params,
3140
+ parentId,
3141
+ path: match.route.path,
3142
+ pathname: match.pathname,
3143
+ pathnameBase: match.pathnameBase,
3144
+ shouldRevalidate: match.route.shouldRevalidate,
3145
+ // Add an unused client-only export (if present) so HMR can support
3146
+ // switching between server-first and client-only routes during development
3147
+ ...match.route.__ensureClientRouteModuleForHMR ? {
3148
+ __ensureClientRouteModuleForHMR: match.route.__ensureClientRouteModuleForHMR
3149
+ } : {}
3150
+ };
3151
+ }
3152
+ async function getManifestRoute(route) {
3153
+ await explodeLazyRoute(route);
3154
+ const Layout = route.Layout || React2__namespace.Fragment;
3155
+ const errorElement = route.ErrorBoundary ? React2__namespace.createElement(
3156
+ Layout,
3157
+ null,
3158
+ React2__namespace.createElement(route.ErrorBoundary)
3159
+ ) : void 0;
3160
+ return {
3161
+ clientAction: route.clientAction,
3162
+ clientLoader: route.clientLoader,
3163
+ handle: route.handle,
3164
+ hasAction: !!route.action,
3165
+ hasComponent: !!route.Component,
3166
+ hasErrorBoundary: !!route.ErrorBoundary,
3167
+ errorElement,
3168
+ hasLoader: !!route.loader,
3169
+ id: route.id,
3170
+ parentId: route.parentId,
3171
+ path: route.path,
3172
+ index: "index" in route ? route.index : void 0,
3173
+ links: route.links,
3174
+ meta: route.meta
3175
+ };
3176
+ }
3177
+ async function explodeLazyRoute(route) {
3178
+ if ("lazy" in route && route.lazy) {
3179
+ let {
3180
+ default: lazyDefaultExport,
3181
+ Component: lazyComponentExport,
3182
+ ...lazyProperties
3183
+ } = await route.lazy();
3184
+ let Component = lazyComponentExport || lazyDefaultExport;
3185
+ if (Component && !route.Component) {
3186
+ route.Component = Component;
3187
+ }
3188
+ for (let [k, v] of Object.entries(lazyProperties)) {
3189
+ if (k !== "id" && k !== "path" && k !== "index" && k !== "children" && route[k] == null) {
3190
+ route[k] = v;
3191
+ }
3192
+ }
3193
+ route.lazy = void 0;
3194
+ }
3195
+ }
3196
+ async function getAdditionalRoutePatches(pathnames, routes, basename, matchedRouteIds) {
3197
+ let patchRouteMatches = /* @__PURE__ */ new Map();
3198
+ let matchedPaths = /* @__PURE__ */ new Set();
3199
+ for (const pathname of pathnames) {
3200
+ let segments = pathname.split("/").filter(Boolean);
3201
+ let paths = ["/"];
3202
+ segments.pop();
3203
+ while (segments.length > 0) {
3204
+ paths.push(`/${segments.join("/")}`);
3205
+ segments.pop();
3206
+ }
3207
+ paths.forEach((path) => {
3208
+ if (matchedPaths.has(path)) {
3209
+ return;
3210
+ }
3211
+ matchedPaths.add(path);
3212
+ let matches = matchRoutes(routes, path, basename) || [];
3213
+ matches.forEach((m, i) => {
3214
+ if (patchRouteMatches.get(m.route.id)) {
3215
+ return;
3216
+ }
3217
+ patchRouteMatches.set(m.route.id, {
3218
+ ...m.route,
3219
+ parentId: matches[i - 1]?.route.id
3220
+ });
3221
+ });
3222
+ });
3223
+ }
3224
+ let patches = await Promise.all(
3225
+ [...patchRouteMatches.values()].filter((route) => !matchedRouteIds.some((id) => id === route.id)).map((route) => getManifestRoute(route))
3226
+ );
3227
+ return patches;
3228
+ }
3229
+ function isReactServerRequest(url) {
3230
+ return url.pathname.endsWith(".rsc");
3231
+ }
3232
+ function isManifestRequest(url) {
3233
+ return url.pathname.endsWith(".manifest");
3234
+ }
3235
+ function defaultOnError(error) {
3236
+ if (isRedirectResponse(error)) {
3237
+ return createRedirectErrorDigest(error);
3238
+ }
3239
+ if (isResponse(error) || isDataWithResponseInit(error)) {
3240
+ return createRouteErrorResponseDigest(error);
3241
+ }
3242
+ }
3243
+ function isClientReference(x) {
3244
+ try {
3245
+ return x.$$typeof === Symbol.for("react.client.reference");
3246
+ } catch {
3247
+ return false;
3248
+ }
3249
+ }
3250
+ function canDecodeWithFormData(contentType) {
3251
+ if (!contentType) return false;
3252
+ return contentType.match(/\bapplication\/x-www-form-urlencoded\b/) || contentType.match(/\bmultipart\/form-data\b/);
3253
+ }
3254
+
3255
+ // lib/href.ts
3256
+ function href(path, ...args) {
3257
+ let params = args[0];
3258
+ let result = trimTrailingSplat(path).replace(
3259
+ /\/:([\w-]+)(\?)?/g,
3260
+ // same regex as in .\router\utils.ts: compilePath().
3261
+ (_, param, questionMark) => {
3262
+ const isRequired = questionMark === void 0;
3263
+ const value = params?.[param];
3264
+ if (isRequired && value === void 0) {
3265
+ throw new Error(
3266
+ `Path '${path}' requires param '${param}' but it was not provided`
3267
+ );
3268
+ }
3269
+ return value === void 0 ? "" : "/" + value;
3270
+ }
3271
+ );
3272
+ if (path.endsWith("*")) {
3273
+ const value = params?.["*"];
3274
+ if (value !== void 0) {
3275
+ result += "/" + value;
3276
+ }
3277
+ }
3278
+ return result || "/";
3279
+ }
3280
+ function trimTrailingSplat(path) {
3281
+ let i = path.length - 1;
3282
+ let char = path[i];
3283
+ if (char !== "*" && char !== "/") return path;
3284
+ i--;
3285
+ for (; i >= 0; i--) {
3286
+ if (path[i] !== "/") break;
3287
+ }
3288
+ return path.slice(0, i + 1);
3289
+ }
3290
+
3291
+ // lib/server-runtime/crypto.ts
3292
+ var encoder = /* @__PURE__ */ new TextEncoder();
3293
+ var sign = async (value, secret) => {
3294
+ let data2 = encoder.encode(value);
3295
+ let key = await createKey2(secret, ["sign"]);
3296
+ let signature = await crypto.subtle.sign("HMAC", key, data2);
3297
+ let hash = btoa(String.fromCharCode(...new Uint8Array(signature))).replace(
3298
+ /=+$/,
3299
+ ""
3300
+ );
3301
+ return value + "." + hash;
3302
+ };
3303
+ var unsign = async (cookie, secret) => {
3304
+ let index = cookie.lastIndexOf(".");
3305
+ let value = cookie.slice(0, index);
3306
+ let hash = cookie.slice(index + 1);
3307
+ let data2 = encoder.encode(value);
3308
+ let key = await createKey2(secret, ["verify"]);
3309
+ try {
3310
+ let signature = byteStringToUint8Array(atob(hash));
3311
+ let valid = await crypto.subtle.verify("HMAC", key, signature, data2);
3312
+ return valid ? value : false;
3313
+ } catch (error) {
3314
+ return false;
3315
+ }
3316
+ };
3317
+ var createKey2 = async (secret, usages) => crypto.subtle.importKey(
3318
+ "raw",
3319
+ encoder.encode(secret),
3320
+ { name: "HMAC", hash: "SHA-256" },
3321
+ false,
3322
+ usages
3323
+ );
3324
+ function byteStringToUint8Array(byteString) {
3325
+ let array = new Uint8Array(byteString.length);
3326
+ for (let i = 0; i < byteString.length; i++) {
3327
+ array[i] = byteString.charCodeAt(i);
3328
+ }
3329
+ return array;
3330
+ }
3331
+
3332
+ // lib/server-runtime/warnings.ts
3333
+ var alreadyWarned = {};
3334
+ function warnOnce(condition, message) {
3335
+ if (!condition && !alreadyWarned[message]) {
3336
+ alreadyWarned[message] = true;
3337
+ console.warn(message);
3338
+ }
3339
+ }
3340
+
3341
+ // lib/server-runtime/cookies.ts
3342
+ var createCookie = (name, cookieOptions = {}) => {
3343
+ let { secrets = [], ...options } = {
3344
+ path: "/",
3345
+ sameSite: "lax",
3346
+ ...cookieOptions
3347
+ };
3348
+ warnOnceAboutExpiresCookie(name, options.expires);
3349
+ return {
3350
+ get name() {
3351
+ return name;
3352
+ },
3353
+ get isSigned() {
3354
+ return secrets.length > 0;
3355
+ },
3356
+ get expires() {
3357
+ return typeof options.maxAge !== "undefined" ? new Date(Date.now() + options.maxAge * 1e3) : options.expires;
3358
+ },
3359
+ async parse(cookieHeader, parseOptions) {
3360
+ if (!cookieHeader) return null;
3361
+ let cookies = cookie.parse(cookieHeader, { ...options, ...parseOptions });
3362
+ if (name in cookies) {
3363
+ let value = cookies[name];
3364
+ if (typeof value === "string" && value !== "") {
3365
+ let decoded = await decodeCookieValue(value, secrets);
3366
+ return decoded;
3367
+ } else {
3368
+ return "";
3369
+ }
3370
+ } else {
3371
+ return null;
3372
+ }
3373
+ },
3374
+ async serialize(value, serializeOptions) {
3375
+ return cookie.serialize(
3376
+ name,
3377
+ value === "" ? "" : await encodeCookieValue(value, secrets),
3378
+ {
3379
+ ...options,
3380
+ ...serializeOptions
3381
+ }
3382
+ );
3383
+ }
3384
+ };
3385
+ };
3386
+ var isCookie = (object) => {
3387
+ return object != null && typeof object.name === "string" && typeof object.isSigned === "boolean" && typeof object.parse === "function" && typeof object.serialize === "function";
3388
+ };
3389
+ async function encodeCookieValue(value, secrets) {
3390
+ let encoded = encodeData(value);
3391
+ if (secrets.length > 0) {
3392
+ encoded = await sign(encoded, secrets[0]);
3393
+ }
3394
+ return encoded;
3395
+ }
3396
+ async function decodeCookieValue(value, secrets) {
3397
+ if (secrets.length > 0) {
3398
+ for (let secret of secrets) {
3399
+ let unsignedValue = await unsign(value, secret);
3400
+ if (unsignedValue !== false) {
3401
+ return decodeData(unsignedValue);
3402
+ }
3403
+ }
3404
+ return null;
3405
+ }
3406
+ return decodeData(value);
3407
+ }
3408
+ function encodeData(value) {
3409
+ return btoa(myUnescape(encodeURIComponent(JSON.stringify(value))));
3410
+ }
3411
+ function decodeData(value) {
3412
+ try {
3413
+ return JSON.parse(decodeURIComponent(myEscape(atob(value))));
3414
+ } catch (error) {
3415
+ return {};
3416
+ }
3417
+ }
3418
+ function myEscape(value) {
3419
+ let str = value.toString();
3420
+ let result = "";
3421
+ let index = 0;
3422
+ let chr, code;
3423
+ while (index < str.length) {
3424
+ chr = str.charAt(index++);
3425
+ if (/[\w*+\-./@]/.exec(chr)) {
3426
+ result += chr;
3427
+ } else {
3428
+ code = chr.charCodeAt(0);
3429
+ if (code < 256) {
3430
+ result += "%" + hex(code, 2);
3431
+ } else {
3432
+ result += "%u" + hex(code, 4).toUpperCase();
3433
+ }
3434
+ }
3435
+ }
3436
+ return result;
3437
+ }
3438
+ function hex(code, length) {
3439
+ let result = code.toString(16);
3440
+ while (result.length < length) result = "0" + result;
3441
+ return result;
3442
+ }
3443
+ function myUnescape(value) {
3444
+ let str = value.toString();
3445
+ let result = "";
3446
+ let index = 0;
3447
+ let chr, part;
3448
+ while (index < str.length) {
3449
+ chr = str.charAt(index++);
3450
+ if (chr === "%") {
3451
+ if (str.charAt(index) === "u") {
3452
+ part = str.slice(index + 1, index + 5);
3453
+ if (/^[\da-f]{4}$/i.exec(part)) {
3454
+ result += String.fromCharCode(parseInt(part, 16));
3455
+ index += 5;
3456
+ continue;
3457
+ }
3458
+ } else {
3459
+ part = str.slice(index, index + 2);
3460
+ if (/^[\da-f]{2}$/i.exec(part)) {
3461
+ result += String.fromCharCode(parseInt(part, 16));
3462
+ index += 2;
3463
+ continue;
3464
+ }
3465
+ }
3466
+ }
3467
+ result += chr;
3468
+ }
3469
+ return result;
3470
+ }
3471
+ function warnOnceAboutExpiresCookie(name, expires) {
3472
+ warnOnce(
3473
+ !expires,
3474
+ `The "${name}" cookie has an "expires" property set. This will cause the expires value to not be updated when the session is committed. Instead, you should set the expires value when serializing the cookie. You can use \`commitSession(session, { expires })\` if using a session storage object, or \`cookie.serialize("value", { expires })\` if you're using the cookie directly.`
3475
+ );
3476
+ }
3477
+
3478
+ // lib/server-runtime/sessions.ts
3479
+ function flash(name) {
3480
+ return `__flash_${name}__`;
3481
+ }
3482
+ var createSession = (initialData = {}, id = "") => {
3483
+ let map = new Map(Object.entries(initialData));
3484
+ return {
3485
+ get id() {
3486
+ return id;
3487
+ },
3488
+ get data() {
3489
+ return Object.fromEntries(map);
3490
+ },
3491
+ has(name) {
3492
+ return map.has(name) || map.has(flash(name));
3493
+ },
3494
+ get(name) {
3495
+ if (map.has(name)) return map.get(name);
3496
+ let flashName = flash(name);
3497
+ if (map.has(flashName)) {
3498
+ let value = map.get(flashName);
3499
+ map.delete(flashName);
3500
+ return value;
3501
+ }
3502
+ return void 0;
3503
+ },
3504
+ set(name, value) {
3505
+ map.set(name, value);
3506
+ },
3507
+ flash(name, value) {
3508
+ map.set(flash(name), value);
3509
+ },
3510
+ unset(name) {
3511
+ map.delete(name);
3512
+ }
3513
+ };
3514
+ };
3515
+ var isSession = (object) => {
3516
+ return object != null && typeof object.id === "string" && typeof object.data !== "undefined" && typeof object.has === "function" && typeof object.get === "function" && typeof object.set === "function" && typeof object.flash === "function" && typeof object.unset === "function";
3517
+ };
3518
+ function createSessionStorage({
3519
+ cookie: cookieArg,
3520
+ createData,
3521
+ readData,
3522
+ updateData,
3523
+ deleteData
3524
+ }) {
3525
+ let cookie = isCookie(cookieArg) ? cookieArg : createCookie(cookieArg?.name || "__session", cookieArg);
3526
+ warnOnceAboutSigningSessionCookie(cookie);
3527
+ return {
3528
+ async getSession(cookieHeader, options) {
3529
+ let id = cookieHeader && await cookie.parse(cookieHeader, options);
3530
+ let data2 = id && await readData(id);
3531
+ return createSession(data2 || {}, id || "");
3532
+ },
3533
+ async commitSession(session, options) {
3534
+ let { id, data: data2 } = session;
3535
+ let expires = options?.maxAge != null ? new Date(Date.now() + options.maxAge * 1e3) : options?.expires != null ? options.expires : cookie.expires;
3536
+ if (id) {
3537
+ await updateData(id, data2, expires);
3538
+ } else {
3539
+ id = await createData(data2, expires);
3540
+ }
3541
+ return cookie.serialize(id, options);
3542
+ },
3543
+ async destroySession(session, options) {
3544
+ await deleteData(session.id);
3545
+ return cookie.serialize("", {
3546
+ ...options,
3547
+ maxAge: void 0,
3548
+ expires: /* @__PURE__ */ new Date(0)
3549
+ });
3550
+ }
3551
+ };
3552
+ }
3553
+ function warnOnceAboutSigningSessionCookie(cookie) {
3554
+ warnOnce(
3555
+ cookie.isSigned,
3556
+ `The "${cookie.name}" cookie is not signed, but session cookies should be signed to prevent tampering on the client before they are sent back to the server. See https://reactrouter.com/explanation/sessions-and-cookies#signing-cookies for more information.`
3557
+ );
3558
+ }
3559
+
3560
+ // lib/server-runtime/sessions/cookieStorage.ts
3561
+ function createCookieSessionStorage({ cookie: cookieArg } = {}) {
3562
+ let cookie = isCookie(cookieArg) ? cookieArg : createCookie(cookieArg?.name || "__session", cookieArg);
3563
+ warnOnceAboutSigningSessionCookie(cookie);
3564
+ return {
3565
+ async getSession(cookieHeader, options) {
3566
+ return createSession(
3567
+ cookieHeader && await cookie.parse(cookieHeader, options) || {}
3568
+ );
3569
+ },
3570
+ async commitSession(session, options) {
3571
+ let serializedCookie = await cookie.serialize(session.data, options);
3572
+ if (serializedCookie.length > 4096) {
3573
+ throw new Error(
3574
+ "Cookie length will exceed browser maximum. Length: " + serializedCookie.length
3575
+ );
3576
+ }
3577
+ return serializedCookie;
3578
+ },
3579
+ async destroySession(_session, options) {
3580
+ return cookie.serialize("", {
3581
+ ...options,
3582
+ maxAge: void 0,
3583
+ expires: /* @__PURE__ */ new Date(0)
3584
+ });
3585
+ }
3586
+ };
3587
+ }
3588
+
3589
+ // lib/server-runtime/sessions/memoryStorage.ts
3590
+ function createMemorySessionStorage({ cookie } = {}) {
3591
+ let map = /* @__PURE__ */ new Map();
3592
+ return createSessionStorage({
3593
+ cookie,
3594
+ async createData(data2, expires) {
3595
+ let id = Math.random().toString(36).substring(2, 10);
3596
+ map.set(id, { data: data2, expires });
3597
+ return id;
3598
+ },
3599
+ async readData(id) {
3600
+ if (map.has(id)) {
3601
+ let { data: data2, expires } = map.get(id);
3602
+ if (!expires || expires > /* @__PURE__ */ new Date()) {
3603
+ return data2;
3604
+ }
3605
+ if (expires) map.delete(id);
3606
+ }
3607
+ return null;
3608
+ },
3609
+ async updateData(id, data2, expires) {
3610
+ map.set(id, { data: data2, expires });
3611
+ },
3612
+ async deleteData(id) {
3613
+ map.delete(id);
3614
+ }
3615
+ });
3616
+ }
3617
+
3618
+ Object.defineProperty(exports, "BrowserRouter", {
3619
+ enumerable: true,
3620
+ get: function () { return reactServerClient.BrowserRouter; }
3621
+ });
3622
+ Object.defineProperty(exports, "Form", {
3623
+ enumerable: true,
3624
+ get: function () { return reactServerClient.Form; }
3625
+ });
3626
+ Object.defineProperty(exports, "HashRouter", {
3627
+ enumerable: true,
3628
+ get: function () { return reactServerClient.HashRouter; }
3629
+ });
3630
+ Object.defineProperty(exports, "Link", {
3631
+ enumerable: true,
3632
+ get: function () { return reactServerClient.Link; }
3633
+ });
3634
+ Object.defineProperty(exports, "Links", {
3635
+ enumerable: true,
3636
+ get: function () { return reactServerClient.Links; }
3637
+ });
3638
+ Object.defineProperty(exports, "MemoryRouter", {
3639
+ enumerable: true,
3640
+ get: function () { return reactServerClient.MemoryRouter; }
3641
+ });
3642
+ Object.defineProperty(exports, "Meta", {
3643
+ enumerable: true,
3644
+ get: function () { return reactServerClient.Meta; }
3645
+ });
3646
+ Object.defineProperty(exports, "NavLink", {
3647
+ enumerable: true,
3648
+ get: function () { return reactServerClient.NavLink; }
3649
+ });
3650
+ Object.defineProperty(exports, "Navigate", {
3651
+ enumerable: true,
3652
+ get: function () { return reactServerClient.Navigate; }
3653
+ });
3654
+ Object.defineProperty(exports, "Outlet", {
3655
+ enumerable: true,
3656
+ get: function () { return reactServerClient.Outlet; }
3657
+ });
3658
+ Object.defineProperty(exports, "Route", {
3659
+ enumerable: true,
3660
+ get: function () { return reactServerClient.Route; }
3661
+ });
3662
+ Object.defineProperty(exports, "Router", {
3663
+ enumerable: true,
3664
+ get: function () { return reactServerClient.Router; }
3665
+ });
3666
+ Object.defineProperty(exports, "RouterProvider", {
3667
+ enumerable: true,
3668
+ get: function () { return reactServerClient.RouterProvider; }
3669
+ });
3670
+ Object.defineProperty(exports, "Routes", {
3671
+ enumerable: true,
3672
+ get: function () { return reactServerClient.Routes; }
3673
+ });
3674
+ Object.defineProperty(exports, "ScrollRestoration", {
3675
+ enumerable: true,
3676
+ get: function () { return reactServerClient.ScrollRestoration; }
3677
+ });
3678
+ Object.defineProperty(exports, "StaticRouter", {
3679
+ enumerable: true,
3680
+ get: function () { return reactServerClient.StaticRouter; }
3681
+ });
3682
+ Object.defineProperty(exports, "StaticRouterProvider", {
3683
+ enumerable: true,
3684
+ get: function () { return reactServerClient.StaticRouterProvider; }
3685
+ });
3686
+ Object.defineProperty(exports, "unstable_HistoryRouter", {
3687
+ enumerable: true,
3688
+ get: function () { return reactServerClient.unstable_HistoryRouter; }
3689
+ });
3690
+ exports.Await = Await;
3691
+ exports.RouterContextProvider = RouterContextProvider;
3692
+ exports.createContext = createContext;
3693
+ exports.createCookie = createCookie;
3694
+ exports.createCookieSessionStorage = createCookieSessionStorage;
3695
+ exports.createMemorySessionStorage = createMemorySessionStorage;
3696
+ exports.createSession = createSession;
3697
+ exports.createSessionStorage = createSessionStorage;
3698
+ exports.createStaticHandler = createStaticHandler;
3699
+ exports.data = data;
3700
+ exports.href = href;
3701
+ exports.isCookie = isCookie;
3702
+ exports.isRouteErrorResponse = isRouteErrorResponse;
3703
+ exports.isSession = isSession;
3704
+ exports.matchRoutes = matchRoutes;
3705
+ exports.redirect = redirect2;
3706
+ exports.redirectDocument = redirectDocument2;
3707
+ exports.replace = replace2;
3708
+ exports.unstable_matchRSCServerRequest = matchRSCServerRequest;