@tonyclaw/llm-inspector 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/.output/nitro.json +17 -0
  2. package/.output/public/assets/alibaba-TTwafVwX.svg +1 -0
  3. package/.output/public/assets/index-B3RwBPLW.css +1 -0
  4. package/.output/public/assets/index-s4lwsWvq.js +97 -0
  5. package/.output/public/assets/main-Cp8AM0Pa.js +17 -0
  6. package/.output/public/assets/minimax-BPMzvuL-.jpeg +0 -0
  7. package/.output/public/assets/qwen-CONDcHqt.png +0 -0
  8. package/.output/public/assets/zhipuai-BPNAnxo-.svg +219 -0
  9. package/.output/server/_chunks/ssr-renderer.mjs +17 -0
  10. package/.output/server/_libs/@radix-ui/react-accessible-icon+[...].mjs +1 -0
  11. package/.output/server/_libs/@radix-ui/react-dismissable-layer+[...].mjs +210 -0
  12. package/.output/server/_libs/@radix-ui/react-navigation-menu+[...].mjs +1 -0
  13. package/.output/server/_libs/@radix-ui/react-one-time-password-field+[...].mjs +1 -0
  14. package/.output/server/_libs/@radix-ui/react-password-toggle-field+[...].mjs +1 -0
  15. package/.output/server/_libs/@radix-ui/react-use-callback-ref+[...].mjs +11 -0
  16. package/.output/server/_libs/@radix-ui/react-use-controllable-state+[...].mjs +69 -0
  17. package/.output/server/_libs/@radix-ui/react-use-effect-event+[...].mjs +1 -0
  18. package/.output/server/_libs/@radix-ui/react-use-escape-keydown+[...].mjs +17 -0
  19. package/.output/server/_libs/@radix-ui/react-use-is-hydrated+[...].mjs +1 -0
  20. package/.output/server/_libs/@radix-ui/react-use-layout-effect+[...].mjs +6 -0
  21. package/.output/server/_libs/@radix-ui/react-visually-hidden+[...].mjs +34 -0
  22. package/.output/server/_libs/ajv-formats.mjs +330 -0
  23. package/.output/server/_libs/ajv.mjs +11444 -0
  24. package/.output/server/_libs/aria-hidden.mjs +122 -0
  25. package/.output/server/_libs/atomically.mjs +152 -0
  26. package/.output/server/_libs/bail.mjs +8 -0
  27. package/.output/server/_libs/character-entities.mjs +2130 -0
  28. package/.output/server/_libs/class-variance-authority.mjs +44 -0
  29. package/.output/server/_libs/clsx.mjs +16 -0
  30. package/.output/server/_libs/comma-separated-tokens.mjs +10 -0
  31. package/.output/server/_libs/conf.mjs +635 -0
  32. package/.output/server/_libs/cookie-es.mjs +58 -0
  33. package/.output/server/_libs/core-util-is.mjs +75 -0
  34. package/.output/server/_libs/croner.mjs +1 -0
  35. package/.output/server/_libs/crossws.mjs +1 -0
  36. package/.output/server/_libs/debounce-fn.mjs +69 -0
  37. package/.output/server/_libs/decode-named-character-reference+[...].mjs +8 -0
  38. package/.output/server/_libs/detect-node-es.mjs +1 -0
  39. package/.output/server/_libs/devlop.mjs +8 -0
  40. package/.output/server/_libs/dot-prop.mjs +265 -0
  41. package/.output/server/_libs/env-paths.mjs +57 -0
  42. package/.output/server/_libs/estree-util-is-identifier-name.mjs +11 -0
  43. package/.output/server/_libs/extend.mjs +97 -0
  44. package/.output/server/_libs/fast-deep-equal.mjs +38 -0
  45. package/.output/server/_libs/fast-uri.mjs +812 -0
  46. package/.output/server/_libs/floating-ui__core.mjs +725 -0
  47. package/.output/server/_libs/floating-ui__dom.mjs +622 -0
  48. package/.output/server/_libs/floating-ui__react-dom.mjs +292 -0
  49. package/.output/server/_libs/floating-ui__utils.mjs +320 -0
  50. package/.output/server/_libs/get-nonce.mjs +9 -0
  51. package/.output/server/_libs/h3-v2.mjs +276 -0
  52. package/.output/server/_libs/h3.mjs +400 -0
  53. package/.output/server/_libs/hast-util-to-jsx-runtime.mjs +388 -0
  54. package/.output/server/_libs/hast-util-whitespace.mjs +10 -0
  55. package/.output/server/_libs/hookable.mjs +1 -0
  56. package/.output/server/_libs/html-url-attributes.mjs +26 -0
  57. package/.output/server/_libs/immediate.mjs +74 -0
  58. package/.output/server/_libs/inherits.mjs +50 -0
  59. package/.output/server/_libs/inline-style-parser.mjs +142 -0
  60. package/.output/server/_libs/is-plain-obj.mjs +10 -0
  61. package/.output/server/_libs/isarray.mjs +14 -0
  62. package/.output/server/_libs/isbot.mjs +20 -0
  63. package/.output/server/_libs/json-schema-traverse.mjs +180 -0
  64. package/.output/server/_libs/jszip.mjs +3049 -0
  65. package/.output/server/_libs/lie.mjs +273 -0
  66. package/.output/server/_libs/lucide-react.mjs +368 -0
  67. package/.output/server/_libs/mdast-util-from-markdown.mjs +717 -0
  68. package/.output/server/_libs/mdast-util-to-hast.mjs +710 -0
  69. package/.output/server/_libs/mdast-util-to-string.mjs +38 -0
  70. package/.output/server/_libs/micromark-core-commonmark.mjs +2259 -0
  71. package/.output/server/_libs/micromark-factory-destination.mjs +94 -0
  72. package/.output/server/_libs/micromark-factory-label.mjs +63 -0
  73. package/.output/server/_libs/micromark-factory-space.mjs +24 -0
  74. package/.output/server/_libs/micromark-factory-title.mjs +65 -0
  75. package/.output/server/_libs/micromark-factory-whitespace.mjs +22 -0
  76. package/.output/server/_libs/micromark-util-character.mjs +44 -0
  77. package/.output/server/_libs/micromark-util-chunked.mjs +36 -0
  78. package/.output/server/_libs/micromark-util-classify-character+[...].mjs +12 -0
  79. package/.output/server/_libs/micromark-util-combine-extensions+[...].mjs +41 -0
  80. package/.output/server/_libs/micromark-util-decode-numeric-character-reference+[...].mjs +19 -0
  81. package/.output/server/_libs/micromark-util-decode-string.mjs +21 -0
  82. package/.output/server/_libs/micromark-util-encode.mjs +1 -0
  83. package/.output/server/_libs/micromark-util-html-tag-name.mjs +69 -0
  84. package/.output/server/_libs/micromark-util-normalize-identifier+[...].mjs +6 -0
  85. package/.output/server/_libs/micromark-util-resolve-all.mjs +15 -0
  86. package/.output/server/_libs/micromark-util-sanitize-uri.mjs +41 -0
  87. package/.output/server/_libs/micromark-util-subtokenize.mjs +346 -0
  88. package/.output/server/_libs/micromark.mjs +906 -0
  89. package/.output/server/_libs/mimic-function.mjs +47 -0
  90. package/.output/server/_libs/ohash.mjs +1 -0
  91. package/.output/server/_libs/pako.mjs +4223 -0
  92. package/.output/server/_libs/process-nextick-args.mjs +48 -0
  93. package/.output/server/_libs/property-information.mjs +1209 -0
  94. package/.output/server/_libs/radix-ui.mjs +1 -0
  95. package/.output/server/_libs/radix-ui__number.mjs +6 -0
  96. package/.output/server/_libs/radix-ui__primitive.mjs +11 -0
  97. package/.output/server/_libs/radix-ui__react-accordion.mjs +1 -0
  98. package/.output/server/_libs/radix-ui__react-alert-dialog.mjs +1 -0
  99. package/.output/server/_libs/radix-ui__react-arrow.mjs +23 -0
  100. package/.output/server/_libs/radix-ui__react-aspect-ratio.mjs +1 -0
  101. package/.output/server/_libs/radix-ui__react-avatar.mjs +1 -0
  102. package/.output/server/_libs/radix-ui__react-checkbox.mjs +1 -0
  103. package/.output/server/_libs/radix-ui__react-collapsible.mjs +144 -0
  104. package/.output/server/_libs/radix-ui__react-collection.mjs +69 -0
  105. package/.output/server/_libs/radix-ui__react-compose-refs.mjs +39 -0
  106. package/.output/server/_libs/radix-ui__react-context-menu.mjs +1 -0
  107. package/.output/server/_libs/radix-ui__react-context.mjs +78 -0
  108. package/.output/server/_libs/radix-ui__react-dialog.mjs +325 -0
  109. package/.output/server/_libs/radix-ui__react-direction.mjs +9 -0
  110. package/.output/server/_libs/radix-ui__react-dropdown-menu.mjs +1 -0
  111. package/.output/server/_libs/radix-ui__react-focus-guards.mjs +29 -0
  112. package/.output/server/_libs/radix-ui__react-focus-scope.mjs +206 -0
  113. package/.output/server/_libs/radix-ui__react-form.mjs +1 -0
  114. package/.output/server/_libs/radix-ui__react-hover-card.mjs +1 -0
  115. package/.output/server/_libs/radix-ui__react-id.mjs +14 -0
  116. package/.output/server/_libs/radix-ui__react-label.mjs +1 -0
  117. package/.output/server/_libs/radix-ui__react-menu.mjs +1 -0
  118. package/.output/server/_libs/radix-ui__react-menubar.mjs +1 -0
  119. package/.output/server/_libs/radix-ui__react-popover.mjs +1 -0
  120. package/.output/server/_libs/radix-ui__react-popper.mjs +286 -0
  121. package/.output/server/_libs/radix-ui__react-portal.mjs +16 -0
  122. package/.output/server/_libs/radix-ui__react-presence.mjs +128 -0
  123. package/.output/server/_libs/radix-ui__react-primitive.mjs +42 -0
  124. package/.output/server/_libs/radix-ui__react-progress.mjs +1 -0
  125. package/.output/server/_libs/radix-ui__react-radio-group.mjs +1 -0
  126. package/.output/server/_libs/radix-ui__react-roving-focus.mjs +224 -0
  127. package/.output/server/_libs/radix-ui__react-scroll-area.mjs +721 -0
  128. package/.output/server/_libs/radix-ui__react-select.mjs +1163 -0
  129. package/.output/server/_libs/radix-ui__react-separator.mjs +28 -0
  130. package/.output/server/_libs/radix-ui__react-slider.mjs +1 -0
  131. package/.output/server/_libs/radix-ui__react-slot.mjs +99 -0
  132. package/.output/server/_libs/radix-ui__react-switch.mjs +1 -0
  133. package/.output/server/_libs/radix-ui__react-tabs.mjs +189 -0
  134. package/.output/server/_libs/radix-ui__react-toast.mjs +1 -0
  135. package/.output/server/_libs/radix-ui__react-toggle-group.mjs +1 -0
  136. package/.output/server/_libs/radix-ui__react-toggle.mjs +1 -0
  137. package/.output/server/_libs/radix-ui__react-toolbar.mjs +1 -0
  138. package/.output/server/_libs/radix-ui__react-tooltip.mjs +495 -0
  139. package/.output/server/_libs/radix-ui__react-use-previous.mjs +14 -0
  140. package/.output/server/_libs/radix-ui__react-use-size.mjs +39 -0
  141. package/.output/server/_libs/react-dom.mjs +9935 -0
  142. package/.output/server/_libs/react-markdown.mjs +147 -0
  143. package/.output/server/_libs/react-remove-scroll-bar.mjs +82 -0
  144. package/.output/server/_libs/react-remove-scroll.mjs +328 -0
  145. package/.output/server/_libs/react-style-singleton.mjs +69 -0
  146. package/.output/server/_libs/react.mjs +515 -0
  147. package/.output/server/_libs/readable-stream.mjs +1518 -0
  148. package/.output/server/_libs/remark-parse.mjs +19 -0
  149. package/.output/server/_libs/remark-rehype.mjs +21 -0
  150. package/.output/server/_libs/rou3.mjs +8 -0
  151. package/.output/server/_libs/safe-buffer.mjs +64 -0
  152. package/.output/server/_libs/semver.mjs +1984 -0
  153. package/.output/server/_libs/seroval-plugins.mjs +58 -0
  154. package/.output/server/_libs/seroval.mjs +1765 -0
  155. package/.output/server/_libs/setimmediate.mjs +1 -0
  156. package/.output/server/_libs/space-separated-tokens.mjs +6 -0
  157. package/.output/server/_libs/srvx.mjs +334 -0
  158. package/.output/server/_libs/stubborn-fs.mjs +91 -0
  159. package/.output/server/_libs/stubborn-utils.mjs +66 -0
  160. package/.output/server/_libs/style-to-js.mjs +72 -0
  161. package/.output/server/_libs/style-to-object.mjs +38 -0
  162. package/.output/server/_libs/tailwind-merge.mjs +3010 -0
  163. package/.output/server/_libs/tanstack__history.mjs +217 -0
  164. package/.output/server/_libs/tanstack__react-router.mjs +1480 -0
  165. package/.output/server/_libs/tanstack__react-store.mjs +1 -0
  166. package/.output/server/_libs/tanstack__react-virtual.mjs +44 -0
  167. package/.output/server/_libs/tanstack__router-core.mjs +4827 -0
  168. package/.output/server/_libs/tanstack__store.mjs +1 -0
  169. package/.output/server/_libs/tanstack__virtual-core.mjs +1225 -0
  170. package/.output/server/_libs/tiny-invariant.mjs +12 -0
  171. package/.output/server/_libs/tiny-warning.mjs +5 -0
  172. package/.output/server/_libs/trim-lines.mjs +41 -0
  173. package/.output/server/_libs/trough.mjs +85 -0
  174. package/.output/server/_libs/tslib.mjs +576 -0
  175. package/.output/server/_libs/ufo.mjs +54 -0
  176. package/.output/server/_libs/uint8array-extras.mjs +69 -0
  177. package/.output/server/_libs/unctx.mjs +1 -0
  178. package/.output/server/_libs/ungap__structured-clone.mjs +212 -0
  179. package/.output/server/_libs/unified.mjs +661 -0
  180. package/.output/server/_libs/unist-util-is.mjs +100 -0
  181. package/.output/server/_libs/unist-util-position.mjs +27 -0
  182. package/.output/server/_libs/unist-util-stringify-position.mjs +27 -0
  183. package/.output/server/_libs/unist-util-visit-parents.mjs +82 -0
  184. package/.output/server/_libs/unist-util-visit.mjs +24 -0
  185. package/.output/server/_libs/unstorage.mjs +1 -0
  186. package/.output/server/_libs/use-callback-ref.mjs +66 -0
  187. package/.output/server/_libs/use-sidecar.mjs +106 -0
  188. package/.output/server/_libs/use-sync-external-store.mjs +1 -0
  189. package/.output/server/_libs/util-deprecate.mjs +12 -0
  190. package/.output/server/_libs/vfile-message.mjs +138 -0
  191. package/.output/server/_libs/vfile.mjs +467 -0
  192. package/.output/server/_libs/when-exit.mjs +53 -0
  193. package/.output/server/_libs/zod.mjs +4460 -0
  194. package/.output/server/_ssr/index-ByCLZu7J.mjs +3061 -0
  195. package/.output/server/_ssr/index.mjs +1176 -0
  196. package/.output/server/_ssr/router-Bq_mxeNz.mjs +2872 -0
  197. package/.output/server/_ssr/start-HYkvq4Ni.mjs +4 -0
  198. package/.output/server/_tanstack-start-manifest_v-C4E0e9my.mjs +4 -0
  199. package/.output/server/index.mjs +393 -0
  200. package/README.md +196 -0
  201. package/package.json +91 -0
  202. package/src/assets/logos/alibaba.svg +1 -0
  203. package/src/assets/logos/anthropic.svg +1 -0
  204. package/src/assets/logos/deepseek.svg +1 -0
  205. package/src/assets/logos/minimax.jpeg +0 -0
  206. package/src/assets/logos/openai.svg +1 -0
  207. package/src/assets/logos/qwen.png +0 -0
  208. package/src/assets/logos/zhipuai.svg +219 -0
  209. package/src/cli.ts +68 -0
  210. package/src/components/ProxyViewer.tsx +325 -0
  211. package/src/components/ProxyViewerContainer.tsx +211 -0
  212. package/src/components/providers/ProviderCard.tsx +186 -0
  213. package/src/components/providers/ProviderForm.tsx +259 -0
  214. package/src/components/providers/ProviderLogo.tsx +111 -0
  215. package/src/components/providers/ProvidersPanel.tsx +259 -0
  216. package/src/components/providers/SettingsDialog.tsx +39 -0
  217. package/src/components/proxy-viewer/ConversationGroup.tsx +68 -0
  218. package/src/components/proxy-viewer/ConversationHeader.tsx +141 -0
  219. package/src/components/proxy-viewer/LogEntry.tsx +225 -0
  220. package/src/components/proxy-viewer/LogEntryHeader.tsx +250 -0
  221. package/src/components/proxy-viewer/ReplayDialog.tsx +208 -0
  222. package/src/components/proxy-viewer/ResponseView.tsx +161 -0
  223. package/src/components/proxy-viewer/StreamingChunkSequence.tsx +171 -0
  224. package/src/components/proxy-viewer/formats/anthropic/ContentBlocks.tsx +139 -0
  225. package/src/components/proxy-viewer/formats/anthropic/ResponseView.tsx +64 -0
  226. package/src/components/proxy-viewer/formats/index.tsx +24 -0
  227. package/src/components/proxy-viewer/formats/openai/ResponseView.tsx +80 -0
  228. package/src/components/proxy-viewer/index.ts +8 -0
  229. package/src/components/ui/badge.tsx +47 -0
  230. package/src/components/ui/button.tsx +47 -0
  231. package/src/components/ui/collapsible.tsx +21 -0
  232. package/src/components/ui/dialog.tsx +129 -0
  233. package/src/components/ui/json-viewer.tsx +464 -0
  234. package/src/components/ui/scroll-area.tsx +54 -0
  235. package/src/components/ui/select.tsx +178 -0
  236. package/src/components/ui/separator.tsx +28 -0
  237. package/src/components/ui/tabs.tsx +88 -0
  238. package/src/components/ui/tooltip.tsx +51 -0
  239. package/src/index.css +11 -0
  240. package/src/lib/export-logs.ts +51 -0
  241. package/src/lib/utils.ts +22 -0
  242. package/src/proxy/chunkStorage.ts +118 -0
  243. package/src/proxy/constants.ts +36 -0
  244. package/src/proxy/formats/anthropic/anthropicProvider.ts +75 -0
  245. package/src/proxy/formats/anthropic/handler.ts +74 -0
  246. package/src/proxy/formats/anthropic/index.ts +14 -0
  247. package/src/proxy/formats/anthropic/register.ts +4 -0
  248. package/src/proxy/formats/anthropic/schemas.ts +217 -0
  249. package/src/proxy/formats/anthropic/stream.ts +167 -0
  250. package/src/proxy/formats/handler.ts +46 -0
  251. package/src/proxy/formats/index.ts +12 -0
  252. package/src/proxy/formats/jsonSchema.ts +24 -0
  253. package/src/proxy/formats/openai/alibabaProvider.ts +38 -0
  254. package/src/proxy/formats/openai/handler.ts +70 -0
  255. package/src/proxy/formats/openai/index.ts +25 -0
  256. package/src/proxy/formats/openai/provider.ts +50 -0
  257. package/src/proxy/formats/openai/register.ts +4 -0
  258. package/src/proxy/formats/openai/schemas.ts +150 -0
  259. package/src/proxy/formats/openai/stream.ts +153 -0
  260. package/src/proxy/formats/protocol.ts +50 -0
  261. package/src/proxy/formats/providerRegistry.ts +51 -0
  262. package/src/proxy/formats/providers/index.ts +3 -0
  263. package/src/proxy/formats/registry.ts +61 -0
  264. package/src/proxy/handler.ts +389 -0
  265. package/src/proxy/logIndex.ts +187 -0
  266. package/src/proxy/logger.ts +99 -0
  267. package/src/proxy/providers.ts +234 -0
  268. package/src/proxy/schemas.ts +160 -0
  269. package/src/proxy/socketTracker.ts +158 -0
  270. package/src/proxy/store.ts +386 -0
  271. package/src/router.tsx +16 -0
  272. package/src/routes/__root.tsx +38 -0
  273. package/src/routes/api/config.paths.ts +14 -0
  274. package/src/routes/api/health.ts +11 -0
  275. package/src/routes/api/logs.$id.chunks.ts +36 -0
  276. package/src/routes/api/logs.$id.replay.ts +262 -0
  277. package/src/routes/api/logs.$id.ts +22 -0
  278. package/src/routes/api/logs.stream.ts +64 -0
  279. package/src/routes/api/logs.ts +30 -0
  280. package/src/routes/api/models.ts +10 -0
  281. package/src/routes/api/providers.$providerId.ts +45 -0
  282. package/src/routes/api/providers.ts +37 -0
  283. package/src/routes/api/sessions.ts +10 -0
  284. package/src/routes/index.tsx +6 -0
  285. package/src/routes/proxy/$.ts +15 -0
  286. package/styles/globals.css +121 -0
@@ -0,0 +1,1480 @@
1
+ import { j as jsxRuntimeExports, r as reactExports, R as React, a as React$1 } from "./react.mjs";
2
+ import { w as warning } from "./tiny-warning.mjs";
3
+ import { i as isNotFound, d as defaultGetScrollRestorationKey, r as restoreScroll, e as escapeHtml, s as storageKey, a as rootRouteId, b as isRedirect, g as getLocationChangeInfo, t as transformReadableStreamWithRouter, c as transformPipeableStreamWithRouter, f as isDangerousProtocol, h as exactPathTest, j as removeTrailingSlash, k as deepEqual, l as functionalUpdate, B as BaseRootRoute, m as BaseRoute, n as isModuleNotFoundError, R as RouterCore } from "./tanstack__router-core.mjs";
4
+ import { i as invariant } from "./tiny-invariant.mjs";
5
+ import { PassThrough } from "node:stream";
6
+ import { R as ReactDOMServer } from "./react-dom.mjs";
7
+ import { i as isbot } from "./isbot.mjs";
8
+ function CatchBoundary(props) {
9
+ const errorComponent = props.errorComponent ?? ErrorComponent;
10
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
11
+ CatchBoundaryImpl,
12
+ {
13
+ getResetKey: props.getResetKey,
14
+ onCatch: props.onCatch,
15
+ children: ({ error, reset }) => {
16
+ if (error) {
17
+ return reactExports.createElement(errorComponent, {
18
+ error,
19
+ reset
20
+ });
21
+ }
22
+ return props.children;
23
+ }
24
+ }
25
+ );
26
+ }
27
+ class CatchBoundaryImpl extends reactExports.Component {
28
+ constructor() {
29
+ super(...arguments);
30
+ this.state = { error: null };
31
+ }
32
+ static getDerivedStateFromProps(props) {
33
+ return { resetKey: props.getResetKey() };
34
+ }
35
+ static getDerivedStateFromError(error) {
36
+ return { error };
37
+ }
38
+ reset() {
39
+ this.setState({ error: null });
40
+ }
41
+ componentDidUpdate(prevProps, prevState) {
42
+ if (prevState.error && prevState.resetKey !== this.state.resetKey) {
43
+ this.reset();
44
+ }
45
+ }
46
+ componentDidCatch(error, errorInfo) {
47
+ if (this.props.onCatch) {
48
+ this.props.onCatch(error, errorInfo);
49
+ }
50
+ }
51
+ render() {
52
+ return this.props.children({
53
+ error: this.state.resetKey !== this.props.getResetKey() ? null : this.state.error,
54
+ reset: () => {
55
+ this.reset();
56
+ }
57
+ });
58
+ }
59
+ }
60
+ function ErrorComponent({ error }) {
61
+ const [show, setShow] = reactExports.useState(false);
62
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { padding: ".5rem", maxWidth: "100%" }, children: [
63
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "flex", alignItems: "center", gap: ".5rem" }, children: [
64
+ /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { style: { fontSize: "1rem" }, children: "Something went wrong!" }),
65
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
66
+ "button",
67
+ {
68
+ style: {
69
+ appearance: "none",
70
+ fontSize: ".6em",
71
+ border: "1px solid currentColor",
72
+ padding: ".1rem .2rem",
73
+ fontWeight: "bold",
74
+ borderRadius: ".25rem"
75
+ },
76
+ onClick: () => setShow((d) => !d),
77
+ children: show ? "Hide Error" : "Show Error"
78
+ }
79
+ )
80
+ ] }),
81
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { height: ".25rem" } }),
82
+ show ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
83
+ "pre",
84
+ {
85
+ style: {
86
+ fontSize: ".7em",
87
+ border: "1px solid red",
88
+ borderRadius: ".25rem",
89
+ padding: ".3rem",
90
+ color: "red",
91
+ overflow: "auto"
92
+ },
93
+ children: error.message ? /* @__PURE__ */ jsxRuntimeExports.jsx("code", { children: error.message }) : null
94
+ }
95
+ ) }) : null
96
+ ] });
97
+ }
98
+ const routerContext = reactExports.createContext(null);
99
+ function getRouterContext() {
100
+ if (typeof document === "undefined") {
101
+ return routerContext;
102
+ }
103
+ if (window.__TSR_ROUTER_CONTEXT__) {
104
+ return window.__TSR_ROUTER_CONTEXT__;
105
+ }
106
+ window.__TSR_ROUTER_CONTEXT__ = routerContext;
107
+ return routerContext;
108
+ }
109
+ function useRouter(opts) {
110
+ const value = reactExports.useContext(getRouterContext());
111
+ warning(
112
+ !((opts?.warn ?? true) && !value)
113
+ );
114
+ return value;
115
+ }
116
+ function useRouterState(opts) {
117
+ const contextRouter = useRouter({
118
+ warn: opts?.router === void 0
119
+ });
120
+ const router = opts?.router || contextRouter;
121
+ {
122
+ const state = router.state;
123
+ return opts?.select ? opts.select(state) : state;
124
+ }
125
+ }
126
+ const REACT_USE = "use";
127
+ const reactUse = React[REACT_USE];
128
+ function useForwardedRef(ref) {
129
+ const innerRef = reactExports.useRef(null);
130
+ reactExports.useImperativeHandle(ref, () => innerRef.current, []);
131
+ return innerRef;
132
+ }
133
+ const matchContext = reactExports.createContext(void 0);
134
+ const dummyMatchContext = reactExports.createContext(
135
+ void 0
136
+ );
137
+ function CatchNotFound(props) {
138
+ const resetKey = useRouterState({
139
+ select: (s) => `not-found-${s.location.pathname}-${s.status}`
140
+ });
141
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
142
+ CatchBoundary,
143
+ {
144
+ getResetKey: () => resetKey,
145
+ onCatch: (error, errorInfo) => {
146
+ if (isNotFound(error)) {
147
+ props.onCatch?.(error, errorInfo);
148
+ } else {
149
+ throw error;
150
+ }
151
+ },
152
+ errorComponent: ({ error }) => {
153
+ if (isNotFound(error)) {
154
+ return props.fallback?.(error);
155
+ } else {
156
+ throw error;
157
+ }
158
+ },
159
+ children: props.children
160
+ }
161
+ );
162
+ }
163
+ function DefaultGlobalNotFound() {
164
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Not Found" });
165
+ }
166
+ function SafeFragment(props) {
167
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: props.children });
168
+ }
169
+ function renderRouteNotFound(router, route, data) {
170
+ if (!route.options.notFoundComponent) {
171
+ if (router.options.defaultNotFoundComponent) {
172
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(router.options.defaultNotFoundComponent, { ...data });
173
+ }
174
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(DefaultGlobalNotFound, {});
175
+ }
176
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(route.options.notFoundComponent, { ...data });
177
+ }
178
+ function ScriptOnce({ children }) {
179
+ const router = useRouter();
180
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
181
+ "script",
182
+ {
183
+ nonce: router.options.ssr?.nonce,
184
+ dangerouslySetInnerHTML: {
185
+ __html: children + ";document.currentScript.remove()"
186
+ }
187
+ }
188
+ );
189
+ }
190
+ function ScrollRestoration() {
191
+ const router = useRouter();
192
+ if (!router.isScrollRestoring || false) {
193
+ return null;
194
+ }
195
+ if (typeof router.options.scrollRestoration === "function") {
196
+ const shouldRestore = router.options.scrollRestoration({
197
+ location: router.latestLocation
198
+ });
199
+ if (!shouldRestore) {
200
+ return null;
201
+ }
202
+ }
203
+ const getKey = router.options.getScrollRestorationKey || defaultGetScrollRestorationKey;
204
+ const userKey = getKey(router.latestLocation);
205
+ const resolvedKey = userKey !== defaultGetScrollRestorationKey(router.latestLocation) ? userKey : void 0;
206
+ const restoreScrollOptions = {
207
+ storageKey,
208
+ shouldScrollRestoration: true
209
+ };
210
+ if (resolvedKey) {
211
+ restoreScrollOptions.key = resolvedKey;
212
+ }
213
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
214
+ ScriptOnce,
215
+ {
216
+ children: `(${restoreScroll.toString()})(${escapeHtml(JSON.stringify(restoreScrollOptions))})`
217
+ }
218
+ );
219
+ }
220
+ function ClientOnly({ children, fallback = null }) {
221
+ return useHydrated() ? /* @__PURE__ */ jsxRuntimeExports.jsx(React$1.Fragment, { children }) : /* @__PURE__ */ jsxRuntimeExports.jsx(React$1.Fragment, { children: fallback });
222
+ }
223
+ function useHydrated() {
224
+ return React$1.useSyncExternalStore(
225
+ subscribe,
226
+ () => true,
227
+ () => false
228
+ );
229
+ }
230
+ function subscribe() {
231
+ return () => {
232
+ };
233
+ }
234
+ const Match = reactExports.memo(function MatchImpl({
235
+ matchId
236
+ }) {
237
+ const router = useRouter();
238
+ const matchState = useRouterState({
239
+ select: (s) => {
240
+ const matchIndex = s.matches.findIndex((d) => d.id === matchId);
241
+ const match = s.matches[matchIndex];
242
+ invariant(
243
+ match
244
+ );
245
+ return {
246
+ routeId: match.routeId,
247
+ ssr: match.ssr,
248
+ _displayPending: match._displayPending,
249
+ resetKey: s.loadedAt,
250
+ parentRouteId: s.matches[matchIndex - 1]?.routeId
251
+ };
252
+ },
253
+ structuralSharing: true
254
+ });
255
+ const route = router.routesById[matchState.routeId];
256
+ const PendingComponent = route.options.pendingComponent ?? router.options.defaultPendingComponent;
257
+ const pendingElement = PendingComponent ? /* @__PURE__ */ jsxRuntimeExports.jsx(PendingComponent, {}) : null;
258
+ const routeErrorComponent = route.options.errorComponent ?? router.options.defaultErrorComponent;
259
+ const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch;
260
+ const routeNotFoundComponent = route.isRoot ? (
261
+ // If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component
262
+ route.options.notFoundComponent ?? router.options.notFoundRoute?.options.component
263
+ ) : route.options.notFoundComponent;
264
+ const resolvedNoSsr = matchState.ssr === false || matchState.ssr === "data-only";
265
+ const ResolvedSuspenseBoundary = (
266
+ // If we're on the root route, allow forcefully wrapping in suspense
267
+ (!route.isRoot || route.options.wrapInSuspense || resolvedNoSsr) && (route.options.wrapInSuspense ?? PendingComponent ?? (route.options.errorComponent?.preload || resolvedNoSsr)) ? reactExports.Suspense : SafeFragment
268
+ );
269
+ const ResolvedCatchBoundary = routeErrorComponent ? CatchBoundary : SafeFragment;
270
+ const ResolvedNotFoundBoundary = routeNotFoundComponent ? CatchNotFound : SafeFragment;
271
+ const ShellComponent = route.isRoot ? route.options.shellComponent ?? SafeFragment : SafeFragment;
272
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(ShellComponent, { children: [
273
+ /* @__PURE__ */ jsxRuntimeExports.jsx(matchContext.Provider, { value: matchId, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResolvedSuspenseBoundary, { fallback: pendingElement, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
274
+ ResolvedCatchBoundary,
275
+ {
276
+ getResetKey: () => matchState.resetKey,
277
+ errorComponent: routeErrorComponent || ErrorComponent,
278
+ onCatch: (error, errorInfo) => {
279
+ if (isNotFound(error)) throw error;
280
+ routeOnCatch?.(error, errorInfo);
281
+ },
282
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
283
+ ResolvedNotFoundBoundary,
284
+ {
285
+ fallback: (error) => {
286
+ if (!routeNotFoundComponent || error.routeId && error.routeId !== matchState.routeId || !error.routeId && !route.isRoot)
287
+ throw error;
288
+ return reactExports.createElement(routeNotFoundComponent, error);
289
+ },
290
+ children: resolvedNoSsr || matchState._displayPending ? /* @__PURE__ */ jsxRuntimeExports.jsx(ClientOnly, { fallback: pendingElement, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MatchInner, { matchId }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(MatchInner, { matchId })
291
+ }
292
+ )
293
+ }
294
+ ) }) }),
295
+ matchState.parentRouteId === rootRouteId && router.options.scrollRestoration ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
296
+ /* @__PURE__ */ jsxRuntimeExports.jsx(OnRendered, {}),
297
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollRestoration, {})
298
+ ] }) : null
299
+ ] });
300
+ });
301
+ function OnRendered() {
302
+ const router = useRouter();
303
+ const prevLocationRef = reactExports.useRef(
304
+ void 0
305
+ );
306
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
307
+ "script",
308
+ {
309
+ suppressHydrationWarning: true,
310
+ ref: (el) => {
311
+ if (el && (prevLocationRef.current === void 0 || prevLocationRef.current.href !== router.latestLocation.href)) {
312
+ router.emit({
313
+ type: "onRendered",
314
+ ...getLocationChangeInfo(router.state)
315
+ });
316
+ prevLocationRef.current = router.latestLocation;
317
+ }
318
+ }
319
+ },
320
+ router.latestLocation.state.__TSR_key
321
+ );
322
+ }
323
+ const MatchInner = reactExports.memo(function MatchInnerImpl({
324
+ matchId
325
+ }) {
326
+ const router = useRouter();
327
+ const { match, key, routeId } = useRouterState({
328
+ select: (s) => {
329
+ const match2 = s.matches.find((d) => d.id === matchId);
330
+ const routeId2 = match2.routeId;
331
+ const remountFn = router.routesById[routeId2].options.remountDeps ?? router.options.defaultRemountDeps;
332
+ const remountDeps = remountFn?.({
333
+ routeId: routeId2,
334
+ loaderDeps: match2.loaderDeps,
335
+ params: match2._strictParams,
336
+ search: match2._strictSearch
337
+ });
338
+ const key2 = remountDeps ? JSON.stringify(remountDeps) : void 0;
339
+ return {
340
+ key: key2,
341
+ routeId: routeId2,
342
+ match: {
343
+ id: match2.id,
344
+ status: match2.status,
345
+ error: match2.error,
346
+ invalid: match2.invalid,
347
+ _forcePending: match2._forcePending,
348
+ _displayPending: match2._displayPending
349
+ }
350
+ };
351
+ },
352
+ structuralSharing: true
353
+ });
354
+ const route = router.routesById[routeId];
355
+ const out = reactExports.useMemo(() => {
356
+ const Comp = route.options.component ?? router.options.defaultComponent;
357
+ if (Comp) {
358
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Comp, {}, key);
359
+ }
360
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Outlet, {});
361
+ }, [key, route.options.component, router.options.defaultComponent]);
362
+ if (match._displayPending) {
363
+ throw router.getMatch(match.id)?._nonReactive.displayPendingPromise;
364
+ }
365
+ if (match._forcePending) {
366
+ throw router.getMatch(match.id)?._nonReactive.minPendingPromise;
367
+ }
368
+ if (match.status === "pending") {
369
+ const pendingMinMs = route.options.pendingMinMs ?? router.options.defaultPendingMinMs;
370
+ if (pendingMinMs) {
371
+ const routerMatch = router.getMatch(match.id);
372
+ if (routerMatch && !routerMatch._nonReactive.minPendingPromise) ;
373
+ }
374
+ throw router.getMatch(match.id)?._nonReactive.loadPromise;
375
+ }
376
+ if (match.status === "notFound") {
377
+ invariant(isNotFound(match.error));
378
+ return renderRouteNotFound(router, route, match.error);
379
+ }
380
+ if (match.status === "redirected") {
381
+ invariant(isRedirect(match.error));
382
+ throw router.getMatch(match.id)?._nonReactive.loadPromise;
383
+ }
384
+ if (match.status === "error") {
385
+ {
386
+ const RouteErrorComponent = (route.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent;
387
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
388
+ RouteErrorComponent,
389
+ {
390
+ error: match.error,
391
+ reset: void 0,
392
+ info: {
393
+ componentStack: ""
394
+ }
395
+ }
396
+ );
397
+ }
398
+ }
399
+ return out;
400
+ });
401
+ const Outlet = reactExports.memo(function OutletImpl() {
402
+ const router = useRouter();
403
+ const matchId = reactExports.useContext(matchContext);
404
+ const routeId = useRouterState({
405
+ select: (s) => s.matches.find((d) => d.id === matchId)?.routeId
406
+ });
407
+ const route = router.routesById[routeId];
408
+ const parentGlobalNotFound = useRouterState({
409
+ select: (s) => {
410
+ const matches = s.matches;
411
+ const parentMatch = matches.find((d) => d.id === matchId);
412
+ invariant(
413
+ parentMatch
414
+ );
415
+ return parentMatch.globalNotFound;
416
+ }
417
+ });
418
+ const childMatchId = useRouterState({
419
+ select: (s) => {
420
+ const matches = s.matches;
421
+ const index = matches.findIndex((d) => d.id === matchId);
422
+ return matches[index + 1]?.id;
423
+ }
424
+ });
425
+ const pendingElement = router.options.defaultPendingComponent ? /* @__PURE__ */ jsxRuntimeExports.jsx(router.options.defaultPendingComponent, {}) : null;
426
+ if (parentGlobalNotFound) {
427
+ return renderRouteNotFound(router, route, void 0);
428
+ }
429
+ if (!childMatchId) {
430
+ return null;
431
+ }
432
+ const nextMatch = /* @__PURE__ */ jsxRuntimeExports.jsx(Match, { matchId: childMatchId });
433
+ if (routeId === rootRouteId) {
434
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: pendingElement, children: nextMatch });
435
+ }
436
+ return nextMatch;
437
+ });
438
+ function Matches() {
439
+ const router = useRouter();
440
+ const rootRoute = router.routesById[rootRouteId];
441
+ const PendingComponent = rootRoute.options.pendingComponent ?? router.options.defaultPendingComponent;
442
+ const pendingElement = PendingComponent ? /* @__PURE__ */ jsxRuntimeExports.jsx(PendingComponent, {}) : null;
443
+ const ResolvedSuspense = SafeFragment;
444
+ const inner = /* @__PURE__ */ jsxRuntimeExports.jsxs(ResolvedSuspense, { fallback: pendingElement, children: [
445
+ false,
446
+ /* @__PURE__ */ jsxRuntimeExports.jsx(MatchesInner, {})
447
+ ] });
448
+ return router.options.InnerWrap ? /* @__PURE__ */ jsxRuntimeExports.jsx(router.options.InnerWrap, { children: inner }) : inner;
449
+ }
450
+ function MatchesInner() {
451
+ const router = useRouter();
452
+ const matchId = useRouterState({
453
+ select: (s) => {
454
+ return s.matches[0]?.id;
455
+ }
456
+ });
457
+ const resetKey = useRouterState({
458
+ select: (s) => s.loadedAt
459
+ });
460
+ const matchComponent = matchId ? /* @__PURE__ */ jsxRuntimeExports.jsx(Match, { matchId }) : null;
461
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(matchContext.Provider, { value: matchId, children: router.options.disableGlobalCatchBoundary ? matchComponent : /* @__PURE__ */ jsxRuntimeExports.jsx(
462
+ CatchBoundary,
463
+ {
464
+ getResetKey: () => resetKey,
465
+ errorComponent: ErrorComponent,
466
+ onCatch: (error) => {
467
+ warning(false, error.message || error.toString());
468
+ },
469
+ children: matchComponent
470
+ }
471
+ ) });
472
+ }
473
+ function RouterContextProvider({
474
+ router,
475
+ children,
476
+ ...rest
477
+ }) {
478
+ if (Object.keys(rest).length > 0) {
479
+ router.update({
480
+ ...router.options,
481
+ ...rest,
482
+ context: {
483
+ ...router.options.context,
484
+ ...rest.context
485
+ }
486
+ });
487
+ }
488
+ const routerContext2 = getRouterContext();
489
+ const provider = /* @__PURE__ */ jsxRuntimeExports.jsx(routerContext2.Provider, { value: router, children });
490
+ if (router.options.Wrap) {
491
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(router.options.Wrap, { children: provider });
492
+ }
493
+ return provider;
494
+ }
495
+ function RouterProvider({ router, ...rest }) {
496
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(RouterContextProvider, { router, ...rest, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Matches, {}) });
497
+ }
498
+ const renderRouterToStream = async ({
499
+ request,
500
+ router,
501
+ responseHeaders,
502
+ children
503
+ }) => {
504
+ if (typeof ReactDOMServer.renderToReadableStream === "function") {
505
+ const stream = await ReactDOMServer.renderToReadableStream(children, {
506
+ signal: request.signal,
507
+ nonce: router.options.ssr?.nonce,
508
+ progressiveChunkSize: Number.POSITIVE_INFINITY
509
+ });
510
+ if (isbot(request.headers.get("User-Agent"))) {
511
+ await stream.allReady;
512
+ }
513
+ const responseStream = transformReadableStreamWithRouter(
514
+ router,
515
+ stream
516
+ );
517
+ return new Response(responseStream, {
518
+ status: router.state.statusCode,
519
+ headers: responseHeaders
520
+ });
521
+ }
522
+ if (typeof ReactDOMServer.renderToPipeableStream === "function") {
523
+ const reactAppPassthrough = new PassThrough();
524
+ try {
525
+ const pipeable = ReactDOMServer.renderToPipeableStream(children, {
526
+ nonce: router.options.ssr?.nonce,
527
+ progressiveChunkSize: Number.POSITIVE_INFINITY,
528
+ ...isbot(request.headers.get("User-Agent")) ? {
529
+ onAllReady() {
530
+ pipeable.pipe(reactAppPassthrough);
531
+ }
532
+ } : {
533
+ onShellReady() {
534
+ pipeable.pipe(reactAppPassthrough);
535
+ }
536
+ },
537
+ onError: (error, info) => {
538
+ console.error("Error in renderToPipeableStream:", error, info);
539
+ if (!reactAppPassthrough.destroyed) {
540
+ reactAppPassthrough.destroy(
541
+ error instanceof Error ? error : new Error(String(error))
542
+ );
543
+ }
544
+ }
545
+ });
546
+ } catch (e) {
547
+ console.error("Error in renderToPipeableStream:", e);
548
+ reactAppPassthrough.destroy(e instanceof Error ? e : new Error(String(e)));
549
+ }
550
+ const responseStream = transformPipeableStreamWithRouter(
551
+ router,
552
+ reactAppPassthrough
553
+ );
554
+ return new Response(responseStream, {
555
+ status: router.state.statusCode,
556
+ headers: responseHeaders
557
+ });
558
+ }
559
+ throw new Error(
560
+ "No renderToReadableStream or renderToPipeableStream found in react-dom/server. Ensure you are using a version of react-dom that supports streaming."
561
+ );
562
+ };
563
+ function useMatch(opts) {
564
+ const nearestMatchId = reactExports.useContext(
565
+ opts.from ? dummyMatchContext : matchContext
566
+ );
567
+ const matchSelection = useRouterState({
568
+ select: (state) => {
569
+ const match = state.matches.find(
570
+ (d) => opts.from ? opts.from === d.routeId : d.id === nearestMatchId
571
+ );
572
+ invariant(
573
+ !((opts.shouldThrow ?? true) && !match),
574
+ `Could not find ${opts.from ? `an active match from "${opts.from}"` : "a nearest match!"}`
575
+ );
576
+ if (match === void 0) {
577
+ return void 0;
578
+ }
579
+ return opts.select ? opts.select(match) : match;
580
+ },
581
+ structuralSharing: opts.structuralSharing
582
+ });
583
+ return matchSelection;
584
+ }
585
+ function useLoaderData(opts) {
586
+ return useMatch({
587
+ from: opts.from,
588
+ strict: opts.strict,
589
+ structuralSharing: opts.structuralSharing,
590
+ select: (s) => {
591
+ return opts.select ? opts.select(s.loaderData) : s.loaderData;
592
+ }
593
+ });
594
+ }
595
+ function useLoaderDeps(opts) {
596
+ const { select, ...rest } = opts;
597
+ return useMatch({
598
+ ...rest,
599
+ select: (s) => {
600
+ return select ? select(s.loaderDeps) : s.loaderDeps;
601
+ }
602
+ });
603
+ }
604
+ function useParams(opts) {
605
+ return useMatch({
606
+ from: opts.from,
607
+ shouldThrow: opts.shouldThrow,
608
+ structuralSharing: opts.structuralSharing,
609
+ strict: opts.strict,
610
+ select: (match) => {
611
+ const params = opts.strict === false ? match.params : match._strictParams;
612
+ return opts.select ? opts.select(params) : params;
613
+ }
614
+ });
615
+ }
616
+ function useSearch(opts) {
617
+ return useMatch({
618
+ from: opts.from,
619
+ strict: opts.strict,
620
+ shouldThrow: opts.shouldThrow,
621
+ structuralSharing: opts.structuralSharing,
622
+ select: (match) => {
623
+ return opts.select ? opts.select(match.search) : match.search;
624
+ }
625
+ });
626
+ }
627
+ function useNavigate(_defaultOpts) {
628
+ const router = useRouter();
629
+ return reactExports.useCallback(
630
+ (options) => {
631
+ return router.navigate({
632
+ ...options,
633
+ from: options.from ?? _defaultOpts?.from
634
+ });
635
+ },
636
+ [_defaultOpts?.from, router]
637
+ );
638
+ }
639
+ function useLinkProps(options, forwardedRef) {
640
+ const router = useRouter();
641
+ const innerRef = useForwardedRef(forwardedRef);
642
+ const {
643
+ // custom props
644
+ activeProps,
645
+ inactiveProps,
646
+ activeOptions,
647
+ to,
648
+ preload: userPreload,
649
+ preloadDelay: userPreloadDelay,
650
+ hashScrollIntoView,
651
+ replace,
652
+ startTransition,
653
+ resetScroll,
654
+ viewTransition,
655
+ // element props
656
+ children,
657
+ target,
658
+ disabled,
659
+ style,
660
+ className,
661
+ onClick,
662
+ onFocus,
663
+ onMouseEnter,
664
+ onMouseLeave,
665
+ onTouchStart,
666
+ ignoreBlocker,
667
+ // prevent these from being returned
668
+ params: _params,
669
+ search: _search,
670
+ hash: _hash,
671
+ state: _state,
672
+ mask: _mask,
673
+ reloadDocument: _reloadDocument,
674
+ unsafeRelative: _unsafeRelative,
675
+ from: _from,
676
+ _fromLocation,
677
+ ...propsSafeToSpread
678
+ } = options;
679
+ {
680
+ const safeInternal = isSafeInternal(to);
681
+ if (typeof to === "string" && !safeInternal && // Quick checks to avoid `new URL` in common internal-like cases
682
+ to.indexOf(":") > -1) {
683
+ try {
684
+ new URL(to);
685
+ if (isDangerousProtocol(to, router.protocolAllowlist)) {
686
+ if (false) ;
687
+ return {
688
+ ...propsSafeToSpread,
689
+ ref: innerRef,
690
+ href: void 0,
691
+ ...children && { children },
692
+ ...target && { target },
693
+ ...disabled && { disabled },
694
+ ...style && { style },
695
+ ...className && { className }
696
+ };
697
+ }
698
+ return {
699
+ ...propsSafeToSpread,
700
+ ref: innerRef,
701
+ href: to,
702
+ ...children && { children },
703
+ ...target && { target },
704
+ ...disabled && { disabled },
705
+ ...style && { style },
706
+ ...className && { className }
707
+ };
708
+ } catch {
709
+ }
710
+ }
711
+ const next2 = router.buildLocation({ ...options, from: options.from });
712
+ const hrefOptionPublicHref2 = next2.maskedLocation ? next2.maskedLocation.publicHref : next2.publicHref;
713
+ const hrefOptionExternal2 = next2.maskedLocation ? next2.maskedLocation.external : next2.external;
714
+ const hrefOption2 = getHrefOption(
715
+ hrefOptionPublicHref2,
716
+ hrefOptionExternal2,
717
+ router.history,
718
+ disabled
719
+ );
720
+ const externalLink2 = (() => {
721
+ if (hrefOption2?.external) {
722
+ if (isDangerousProtocol(hrefOption2.href, router.protocolAllowlist)) {
723
+ return void 0;
724
+ }
725
+ return hrefOption2.href;
726
+ }
727
+ if (safeInternal) return void 0;
728
+ if (typeof to === "string" && to.indexOf(":") > -1) {
729
+ try {
730
+ new URL(to);
731
+ if (isDangerousProtocol(to, router.protocolAllowlist)) {
732
+ if (false) ;
733
+ return void 0;
734
+ }
735
+ return to;
736
+ } catch {
737
+ }
738
+ }
739
+ return void 0;
740
+ })();
741
+ const isActive2 = (() => {
742
+ if (externalLink2) return false;
743
+ const currentLocation = router.state.location;
744
+ const exact = activeOptions?.exact ?? false;
745
+ if (exact) {
746
+ const testExact = exactPathTest(
747
+ currentLocation.pathname,
748
+ next2.pathname,
749
+ router.basepath
750
+ );
751
+ if (!testExact) {
752
+ return false;
753
+ }
754
+ } else {
755
+ const currentPathSplit = removeTrailingSlash(
756
+ currentLocation.pathname,
757
+ router.basepath
758
+ );
759
+ const nextPathSplit = removeTrailingSlash(
760
+ next2.pathname,
761
+ router.basepath
762
+ );
763
+ const pathIsFuzzyEqual = currentPathSplit.startsWith(nextPathSplit) && (currentPathSplit.length === nextPathSplit.length || currentPathSplit[nextPathSplit.length] === "/");
764
+ if (!pathIsFuzzyEqual) {
765
+ return false;
766
+ }
767
+ }
768
+ const includeSearch = activeOptions?.includeSearch ?? true;
769
+ if (includeSearch) {
770
+ if (currentLocation.search !== next2.search) {
771
+ const currentSearchEmpty = !currentLocation.search || typeof currentLocation.search === "object" && Object.keys(currentLocation.search).length === 0;
772
+ const nextSearchEmpty = !next2.search || typeof next2.search === "object" && Object.keys(next2.search).length === 0;
773
+ if (!(currentSearchEmpty && nextSearchEmpty)) {
774
+ const searchTest = deepEqual(currentLocation.search, next2.search, {
775
+ partial: !exact,
776
+ ignoreUndefined: !activeOptions?.explicitUndefined
777
+ });
778
+ if (!searchTest) {
779
+ return false;
780
+ }
781
+ }
782
+ }
783
+ }
784
+ if (activeOptions?.includeHash) {
785
+ return false;
786
+ }
787
+ return true;
788
+ })();
789
+ if (externalLink2) {
790
+ return {
791
+ ...propsSafeToSpread,
792
+ ref: innerRef,
793
+ href: externalLink2,
794
+ ...children && { children },
795
+ ...target && { target },
796
+ ...disabled && { disabled },
797
+ ...style && { style },
798
+ ...className && { className }
799
+ };
800
+ }
801
+ const resolvedActiveProps2 = isActive2 ? functionalUpdate(activeProps, {}) ?? STATIC_ACTIVE_OBJECT : STATIC_EMPTY_OBJECT;
802
+ const resolvedInactiveProps2 = isActive2 ? STATIC_EMPTY_OBJECT : functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT;
803
+ const resolvedStyle2 = (() => {
804
+ const baseStyle = style;
805
+ const activeStyle = resolvedActiveProps2.style;
806
+ const inactiveStyle = resolvedInactiveProps2.style;
807
+ if (!baseStyle && !activeStyle && !inactiveStyle) {
808
+ return void 0;
809
+ }
810
+ if (baseStyle && !activeStyle && !inactiveStyle) {
811
+ return baseStyle;
812
+ }
813
+ if (!baseStyle && activeStyle && !inactiveStyle) {
814
+ return activeStyle;
815
+ }
816
+ if (!baseStyle && !activeStyle && inactiveStyle) {
817
+ return inactiveStyle;
818
+ }
819
+ return {
820
+ ...baseStyle,
821
+ ...activeStyle,
822
+ ...inactiveStyle
823
+ };
824
+ })();
825
+ const resolvedClassName2 = (() => {
826
+ const baseClassName = className;
827
+ const activeClassName = resolvedActiveProps2.className;
828
+ const inactiveClassName = resolvedInactiveProps2.className;
829
+ if (!baseClassName && !activeClassName && !inactiveClassName) {
830
+ return "";
831
+ }
832
+ let out = "";
833
+ if (baseClassName) {
834
+ out = baseClassName;
835
+ }
836
+ if (activeClassName) {
837
+ out = out ? `${out} ${activeClassName}` : activeClassName;
838
+ }
839
+ if (inactiveClassName) {
840
+ out = out ? `${out} ${inactiveClassName}` : inactiveClassName;
841
+ }
842
+ return out;
843
+ })();
844
+ return {
845
+ ...propsSafeToSpread,
846
+ ...resolvedActiveProps2,
847
+ ...resolvedInactiveProps2,
848
+ href: hrefOption2?.href,
849
+ ref: innerRef,
850
+ disabled: !!disabled,
851
+ target,
852
+ ...resolvedStyle2 && { style: resolvedStyle2 },
853
+ ...resolvedClassName2 && { className: resolvedClassName2 },
854
+ ...disabled && STATIC_DISABLED_PROPS,
855
+ ...isActive2 && STATIC_ACTIVE_PROPS
856
+ };
857
+ }
858
+ }
859
+ const STATIC_EMPTY_OBJECT = {};
860
+ const STATIC_ACTIVE_OBJECT = { className: "active" };
861
+ const STATIC_DISABLED_PROPS = { role: "link", "aria-disabled": true };
862
+ const STATIC_ACTIVE_PROPS = { "data-status": "active", "aria-current": "page" };
863
+ function getHrefOption(publicHref, external, history, disabled) {
864
+ if (disabled) return void 0;
865
+ if (external) {
866
+ return { href: publicHref, external: true };
867
+ }
868
+ return {
869
+ href: history.createHref(publicHref) || "/",
870
+ external: false
871
+ };
872
+ }
873
+ function isSafeInternal(to) {
874
+ if (typeof to !== "string") return false;
875
+ const zero = to.charCodeAt(0);
876
+ if (zero === 47) return to.charCodeAt(1) !== 47;
877
+ return zero === 46;
878
+ }
879
+ const Link = reactExports.forwardRef(
880
+ (props, ref) => {
881
+ const { _asChild, ...rest } = props;
882
+ const { type: _type, ...linkProps } = useLinkProps(rest, ref);
883
+ const children = typeof rest.children === "function" ? rest.children({
884
+ isActive: linkProps["data-status"] === "active"
885
+ }) : rest.children;
886
+ if (!_asChild) {
887
+ const { disabled: _, ...rest2 } = linkProps;
888
+ return reactExports.createElement("a", rest2, children);
889
+ }
890
+ return reactExports.createElement(_asChild, linkProps, children);
891
+ }
892
+ );
893
+ class Route extends BaseRoute {
894
+ /**
895
+ * @deprecated Use the `createRoute` function instead.
896
+ */
897
+ constructor(options) {
898
+ super(options);
899
+ this.useMatch = (opts) => {
900
+ return useMatch({
901
+ select: opts?.select,
902
+ from: this.id,
903
+ structuralSharing: opts?.structuralSharing
904
+ });
905
+ };
906
+ this.useRouteContext = (opts) => {
907
+ return useMatch({
908
+ ...opts,
909
+ from: this.id,
910
+ select: (d) => opts?.select ? opts.select(d.context) : d.context
911
+ });
912
+ };
913
+ this.useSearch = (opts) => {
914
+ return useSearch({
915
+ select: opts?.select,
916
+ structuralSharing: opts?.structuralSharing,
917
+ from: this.id
918
+ });
919
+ };
920
+ this.useParams = (opts) => {
921
+ return useParams({
922
+ select: opts?.select,
923
+ structuralSharing: opts?.structuralSharing,
924
+ from: this.id
925
+ });
926
+ };
927
+ this.useLoaderDeps = (opts) => {
928
+ return useLoaderDeps({ ...opts, from: this.id });
929
+ };
930
+ this.useLoaderData = (opts) => {
931
+ return useLoaderData({ ...opts, from: this.id });
932
+ };
933
+ this.useNavigate = () => {
934
+ return useNavigate({ from: this.fullPath });
935
+ };
936
+ this.Link = React$1.forwardRef(
937
+ (props, ref) => {
938
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { ref, from: this.fullPath, ...props });
939
+ }
940
+ );
941
+ this.$$typeof = /* @__PURE__ */ Symbol.for("react.memo");
942
+ }
943
+ }
944
+ function createRoute(options) {
945
+ return new Route(
946
+ // TODO: Help us TypeChris, you're our only hope!
947
+ options
948
+ );
949
+ }
950
+ class RootRoute extends BaseRootRoute {
951
+ /**
952
+ * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
953
+ */
954
+ constructor(options) {
955
+ super(options);
956
+ this.useMatch = (opts) => {
957
+ return useMatch({
958
+ select: opts?.select,
959
+ from: this.id,
960
+ structuralSharing: opts?.structuralSharing
961
+ });
962
+ };
963
+ this.useRouteContext = (opts) => {
964
+ return useMatch({
965
+ ...opts,
966
+ from: this.id,
967
+ select: (d) => opts?.select ? opts.select(d.context) : d.context
968
+ });
969
+ };
970
+ this.useSearch = (opts) => {
971
+ return useSearch({
972
+ select: opts?.select,
973
+ structuralSharing: opts?.structuralSharing,
974
+ from: this.id
975
+ });
976
+ };
977
+ this.useParams = (opts) => {
978
+ return useParams({
979
+ select: opts?.select,
980
+ structuralSharing: opts?.structuralSharing,
981
+ from: this.id
982
+ });
983
+ };
984
+ this.useLoaderDeps = (opts) => {
985
+ return useLoaderDeps({ ...opts, from: this.id });
986
+ };
987
+ this.useLoaderData = (opts) => {
988
+ return useLoaderData({ ...opts, from: this.id });
989
+ };
990
+ this.useNavigate = () => {
991
+ return useNavigate({ from: this.fullPath });
992
+ };
993
+ this.Link = React$1.forwardRef(
994
+ (props, ref) => {
995
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { ref, from: this.fullPath, ...props });
996
+ }
997
+ );
998
+ this.$$typeof = /* @__PURE__ */ Symbol.for("react.memo");
999
+ }
1000
+ }
1001
+ function createRootRoute(options) {
1002
+ return new RootRoute(options);
1003
+ }
1004
+ function createFileRoute(path) {
1005
+ if (typeof path === "object") {
1006
+ return new FileRoute(path, {
1007
+ silent: true
1008
+ }).createRoute(path);
1009
+ }
1010
+ return new FileRoute(path, {
1011
+ silent: true
1012
+ }).createRoute;
1013
+ }
1014
+ class FileRoute {
1015
+ constructor(path, _opts) {
1016
+ this.path = path;
1017
+ this.createRoute = (options) => {
1018
+ warning(
1019
+ this.silent
1020
+ );
1021
+ const route = createRoute(options);
1022
+ route.isRoot = false;
1023
+ return route;
1024
+ };
1025
+ this.silent = _opts?.silent;
1026
+ }
1027
+ }
1028
+ class LazyRoute {
1029
+ constructor(opts) {
1030
+ this.useMatch = (opts2) => {
1031
+ return useMatch({
1032
+ select: opts2?.select,
1033
+ from: this.options.id,
1034
+ structuralSharing: opts2?.structuralSharing
1035
+ });
1036
+ };
1037
+ this.useRouteContext = (opts2) => {
1038
+ return useMatch({
1039
+ from: this.options.id,
1040
+ select: (d) => opts2?.select ? opts2.select(d.context) : d.context
1041
+ });
1042
+ };
1043
+ this.useSearch = (opts2) => {
1044
+ return useSearch({
1045
+ select: opts2?.select,
1046
+ structuralSharing: opts2?.structuralSharing,
1047
+ from: this.options.id
1048
+ });
1049
+ };
1050
+ this.useParams = (opts2) => {
1051
+ return useParams({
1052
+ select: opts2?.select,
1053
+ structuralSharing: opts2?.structuralSharing,
1054
+ from: this.options.id
1055
+ });
1056
+ };
1057
+ this.useLoaderDeps = (opts2) => {
1058
+ return useLoaderDeps({ ...opts2, from: this.options.id });
1059
+ };
1060
+ this.useLoaderData = (opts2) => {
1061
+ return useLoaderData({ ...opts2, from: this.options.id });
1062
+ };
1063
+ this.useNavigate = () => {
1064
+ const router = useRouter();
1065
+ return useNavigate({ from: router.routesById[this.options.id].fullPath });
1066
+ };
1067
+ this.options = opts;
1068
+ this.$$typeof = /* @__PURE__ */ Symbol.for("react.memo");
1069
+ }
1070
+ }
1071
+ function createLazyFileRoute(id) {
1072
+ if (typeof id === "object") {
1073
+ return new LazyRoute(id);
1074
+ }
1075
+ return (opts) => new LazyRoute({ id, ...opts });
1076
+ }
1077
+ function lazyRouteComponent(importer, exportName) {
1078
+ let loadPromise;
1079
+ let comp;
1080
+ let error;
1081
+ let reload;
1082
+ const load = () => {
1083
+ if (!loadPromise) {
1084
+ loadPromise = importer().then((res) => {
1085
+ loadPromise = void 0;
1086
+ comp = res[exportName];
1087
+ }).catch((err) => {
1088
+ error = err;
1089
+ if (isModuleNotFoundError(error)) {
1090
+ if (error instanceof Error && typeof window !== "undefined" && typeof sessionStorage !== "undefined") {
1091
+ const storageKey2 = `tanstack_router_reload:${error.message}`;
1092
+ if (!sessionStorage.getItem(storageKey2)) {
1093
+ sessionStorage.setItem(storageKey2, "1");
1094
+ reload = true;
1095
+ }
1096
+ }
1097
+ }
1098
+ });
1099
+ }
1100
+ return loadPromise;
1101
+ };
1102
+ const lazyComp = function Lazy(props) {
1103
+ if (reload) {
1104
+ window.location.reload();
1105
+ throw new Promise(() => {
1106
+ });
1107
+ }
1108
+ if (error) {
1109
+ throw error;
1110
+ }
1111
+ if (!comp) {
1112
+ if (reactUse) {
1113
+ reactUse(load());
1114
+ } else {
1115
+ throw load();
1116
+ }
1117
+ }
1118
+ return reactExports.createElement(comp, props);
1119
+ };
1120
+ lazyComp.preload = load;
1121
+ return lazyComp;
1122
+ }
1123
+ const createRouter = (options) => {
1124
+ return new Router(options);
1125
+ };
1126
+ class Router extends RouterCore {
1127
+ constructor(options) {
1128
+ super(options);
1129
+ }
1130
+ }
1131
+ if (typeof globalThis !== "undefined") {
1132
+ globalThis.createFileRoute = createFileRoute;
1133
+ globalThis.createLazyFileRoute = createLazyFileRoute;
1134
+ } else if (typeof window !== "undefined") {
1135
+ window.createFileRoute = createFileRoute;
1136
+ window.createLazyFileRoute = createLazyFileRoute;
1137
+ }
1138
+ function Asset({
1139
+ tag,
1140
+ attrs,
1141
+ children,
1142
+ nonce
1143
+ }) {
1144
+ switch (tag) {
1145
+ case "title":
1146
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("title", { ...attrs, suppressHydrationWarning: true, children });
1147
+ case "meta":
1148
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("meta", { ...attrs, suppressHydrationWarning: true });
1149
+ case "link":
1150
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("link", { ...attrs, nonce, suppressHydrationWarning: true });
1151
+ case "style":
1152
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
1153
+ "style",
1154
+ {
1155
+ ...attrs,
1156
+ dangerouslySetInnerHTML: { __html: children },
1157
+ nonce
1158
+ }
1159
+ );
1160
+ case "script":
1161
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Script, { attrs, children });
1162
+ default:
1163
+ return null;
1164
+ }
1165
+ }
1166
+ function Script({
1167
+ attrs,
1168
+ children
1169
+ }) {
1170
+ useRouter();
1171
+ useHydrated();
1172
+ const dataScript = typeof attrs?.type === "string" && attrs.type !== "" && attrs.type !== "text/javascript" && attrs.type !== "module";
1173
+ reactExports.useEffect(() => {
1174
+ if (dataScript) return;
1175
+ if (attrs?.src) {
1176
+ const normSrc = (() => {
1177
+ try {
1178
+ const base = document.baseURI || window.location.href;
1179
+ return new URL(attrs.src, base).href;
1180
+ } catch {
1181
+ return attrs.src;
1182
+ }
1183
+ })();
1184
+ const existingScript = Array.from(
1185
+ document.querySelectorAll("script[src]")
1186
+ ).find((el) => el.src === normSrc);
1187
+ if (existingScript) {
1188
+ return;
1189
+ }
1190
+ const script = document.createElement("script");
1191
+ for (const [key, value] of Object.entries(attrs)) {
1192
+ if (key !== "suppressHydrationWarning" && value !== void 0 && value !== false) {
1193
+ script.setAttribute(
1194
+ key,
1195
+ typeof value === "boolean" ? "" : String(value)
1196
+ );
1197
+ }
1198
+ }
1199
+ document.head.appendChild(script);
1200
+ return () => {
1201
+ if (script.parentNode) {
1202
+ script.parentNode.removeChild(script);
1203
+ }
1204
+ };
1205
+ }
1206
+ if (typeof children === "string") {
1207
+ const typeAttr = typeof attrs?.type === "string" ? attrs.type : "text/javascript";
1208
+ const nonceAttr = typeof attrs?.nonce === "string" ? attrs.nonce : void 0;
1209
+ const existingScript = Array.from(
1210
+ document.querySelectorAll("script:not([src])")
1211
+ ).find((el) => {
1212
+ if (!(el instanceof HTMLScriptElement)) return false;
1213
+ const sType = el.getAttribute("type") ?? "text/javascript";
1214
+ const sNonce = el.getAttribute("nonce") ?? void 0;
1215
+ return el.textContent === children && sType === typeAttr && sNonce === nonceAttr;
1216
+ });
1217
+ if (existingScript) {
1218
+ return;
1219
+ }
1220
+ const script = document.createElement("script");
1221
+ script.textContent = children;
1222
+ if (attrs) {
1223
+ for (const [key, value] of Object.entries(attrs)) {
1224
+ if (key !== "suppressHydrationWarning" && value !== void 0 && value !== false) {
1225
+ script.setAttribute(
1226
+ key,
1227
+ typeof value === "boolean" ? "" : String(value)
1228
+ );
1229
+ }
1230
+ }
1231
+ }
1232
+ document.head.appendChild(script);
1233
+ return () => {
1234
+ if (script.parentNode) {
1235
+ script.parentNode.removeChild(script);
1236
+ }
1237
+ };
1238
+ }
1239
+ return void 0;
1240
+ }, [attrs, children, dataScript]);
1241
+ {
1242
+ if (attrs?.src) {
1243
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("script", { ...attrs, suppressHydrationWarning: true });
1244
+ }
1245
+ if (typeof children === "string") {
1246
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
1247
+ "script",
1248
+ {
1249
+ ...attrs,
1250
+ dangerouslySetInnerHTML: { __html: children },
1251
+ suppressHydrationWarning: true
1252
+ }
1253
+ );
1254
+ }
1255
+ return null;
1256
+ }
1257
+ }
1258
+ const useTags = () => {
1259
+ const router = useRouter();
1260
+ const nonce = router.options.ssr?.nonce;
1261
+ const routeMeta = useRouterState({
1262
+ select: (state) => {
1263
+ return state.matches.map((match) => match.meta).filter(Boolean);
1264
+ }
1265
+ });
1266
+ const meta = reactExports.useMemo(() => {
1267
+ const resultMeta = [];
1268
+ const metaByAttribute = {};
1269
+ let title;
1270
+ for (let i = routeMeta.length - 1; i >= 0; i--) {
1271
+ const metas = routeMeta[i];
1272
+ for (let j = metas.length - 1; j >= 0; j--) {
1273
+ const m = metas[j];
1274
+ if (!m) continue;
1275
+ if (m.title) {
1276
+ if (!title) {
1277
+ title = {
1278
+ tag: "title",
1279
+ children: m.title
1280
+ };
1281
+ }
1282
+ } else if ("script:ld+json" in m) {
1283
+ try {
1284
+ const json = JSON.stringify(m["script:ld+json"]);
1285
+ resultMeta.push({
1286
+ tag: "script",
1287
+ attrs: {
1288
+ type: "application/ld+json"
1289
+ },
1290
+ children: escapeHtml(json)
1291
+ });
1292
+ } catch {
1293
+ }
1294
+ } else {
1295
+ const attribute = m.name ?? m.property;
1296
+ if (attribute) {
1297
+ if (metaByAttribute[attribute]) {
1298
+ continue;
1299
+ } else {
1300
+ metaByAttribute[attribute] = true;
1301
+ }
1302
+ }
1303
+ resultMeta.push({
1304
+ tag: "meta",
1305
+ attrs: {
1306
+ ...m,
1307
+ nonce
1308
+ }
1309
+ });
1310
+ }
1311
+ }
1312
+ }
1313
+ if (title) {
1314
+ resultMeta.push(title);
1315
+ }
1316
+ if (nonce) {
1317
+ resultMeta.push({
1318
+ tag: "meta",
1319
+ attrs: {
1320
+ property: "csp-nonce",
1321
+ content: nonce
1322
+ }
1323
+ });
1324
+ }
1325
+ resultMeta.reverse();
1326
+ return resultMeta;
1327
+ }, [routeMeta, nonce]);
1328
+ const links = useRouterState({
1329
+ select: (state) => {
1330
+ const constructed = state.matches.map((match) => match.links).filter(Boolean).flat(1).map((link) => ({
1331
+ tag: "link",
1332
+ attrs: {
1333
+ ...link,
1334
+ nonce
1335
+ }
1336
+ }));
1337
+ const manifest = router.ssr?.manifest;
1338
+ const assets = state.matches.map((match) => manifest?.routes[match.routeId]?.assets ?? []).filter(Boolean).flat(1).filter((asset) => asset.tag === "link").map(
1339
+ (asset) => ({
1340
+ tag: "link",
1341
+ attrs: {
1342
+ ...asset.attrs,
1343
+ suppressHydrationWarning: true,
1344
+ nonce
1345
+ }
1346
+ })
1347
+ );
1348
+ return [...constructed, ...assets];
1349
+ },
1350
+ structuralSharing: true
1351
+ });
1352
+ const preloadLinks = useRouterState({
1353
+ select: (state) => {
1354
+ const preloadLinks2 = [];
1355
+ state.matches.map((match) => router.looseRoutesById[match.routeId]).forEach(
1356
+ (route) => router.ssr?.manifest?.routes[route.id]?.preloads?.filter(Boolean).forEach((preload) => {
1357
+ preloadLinks2.push({
1358
+ tag: "link",
1359
+ attrs: {
1360
+ rel: "modulepreload",
1361
+ href: preload,
1362
+ nonce
1363
+ }
1364
+ });
1365
+ })
1366
+ );
1367
+ return preloadLinks2;
1368
+ },
1369
+ structuralSharing: true
1370
+ });
1371
+ const styles = useRouterState({
1372
+ select: (state) => state.matches.map((match) => match.styles).flat(1).filter(Boolean).map(({ children, ...attrs }) => ({
1373
+ tag: "style",
1374
+ attrs: {
1375
+ ...attrs,
1376
+ nonce
1377
+ },
1378
+ children
1379
+ })),
1380
+ structuralSharing: true
1381
+ });
1382
+ const headScripts = useRouterState({
1383
+ select: (state) => state.matches.map((match) => match.headScripts).flat(1).filter(Boolean).map(({ children, ...script }) => ({
1384
+ tag: "script",
1385
+ attrs: {
1386
+ ...script,
1387
+ nonce
1388
+ },
1389
+ children
1390
+ })),
1391
+ structuralSharing: true
1392
+ });
1393
+ return uniqBy(
1394
+ [
1395
+ ...meta,
1396
+ ...preloadLinks,
1397
+ ...links,
1398
+ ...styles,
1399
+ ...headScripts
1400
+ ],
1401
+ (d) => {
1402
+ return JSON.stringify(d);
1403
+ }
1404
+ );
1405
+ };
1406
+ function uniqBy(arr, fn) {
1407
+ const seen = /* @__PURE__ */ new Set();
1408
+ return arr.filter((item) => {
1409
+ const key = fn(item);
1410
+ if (seen.has(key)) {
1411
+ return false;
1412
+ }
1413
+ seen.add(key);
1414
+ return true;
1415
+ });
1416
+ }
1417
+ function HeadContent() {
1418
+ const tags = useTags();
1419
+ const router = useRouter();
1420
+ const nonce = router.options.ssr?.nonce;
1421
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: tags.map((tag) => /* @__PURE__ */ reactExports.createElement(Asset, { ...tag, key: `tsr-meta-${JSON.stringify(tag)}`, nonce })) });
1422
+ }
1423
+ const Scripts = () => {
1424
+ const router = useRouter();
1425
+ const nonce = router.options.ssr?.nonce;
1426
+ const assetScripts = useRouterState({
1427
+ select: (state) => {
1428
+ const assetScripts2 = [];
1429
+ const manifest = router.ssr?.manifest;
1430
+ if (!manifest) {
1431
+ return [];
1432
+ }
1433
+ state.matches.map((match) => router.looseRoutesById[match.routeId]).forEach(
1434
+ (route) => manifest.routes[route.id]?.assets?.filter((d) => d.tag === "script").forEach((asset) => {
1435
+ assetScripts2.push({
1436
+ tag: "script",
1437
+ attrs: { ...asset.attrs, nonce },
1438
+ children: asset.children
1439
+ });
1440
+ })
1441
+ );
1442
+ return assetScripts2;
1443
+ },
1444
+ structuralSharing: true
1445
+ });
1446
+ const { scripts } = useRouterState({
1447
+ select: (state) => ({
1448
+ scripts: state.matches.map((match) => match.scripts).flat(1).filter(Boolean).map(({ children, ...script }) => ({
1449
+ tag: "script",
1450
+ attrs: {
1451
+ ...script,
1452
+ suppressHydrationWarning: true,
1453
+ nonce
1454
+ },
1455
+ children
1456
+ }))
1457
+ }),
1458
+ structuralSharing: true
1459
+ });
1460
+ let serverBufferedScript = void 0;
1461
+ if (router.serverSsr) {
1462
+ serverBufferedScript = router.serverSsr.takeBufferedScripts();
1463
+ }
1464
+ const allScripts = [...scripts, ...assetScripts];
1465
+ if (serverBufferedScript) {
1466
+ allScripts.unshift(serverBufferedScript);
1467
+ }
1468
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: allScripts.map((asset, i) => /* @__PURE__ */ reactExports.createElement(Asset, { ...asset, key: `tsr-scripts-${asset.tag}-${i}` })) });
1469
+ };
1470
+ export {
1471
+ HeadContent as H,
1472
+ Outlet as O,
1473
+ RouterProvider as R,
1474
+ Scripts as S,
1475
+ createRootRoute as a,
1476
+ createFileRoute as b,
1477
+ createRouter as c,
1478
+ lazyRouteComponent as l,
1479
+ renderRouterToStream as r
1480
+ };