@tonyclaw/agent-inspector 2.0.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 (400) hide show
  1. package/.output/cli.js +1611 -0
  2. package/.output/nitro.json +17 -0
  3. package/.output/public/assets/CompareDrawer-CU5ZrWcL.js +1 -0
  4. package/.output/public/assets/ProxyViewerContainer-pEBqVp1d.js +101 -0
  5. package/.output/public/assets/ReplayDialog-F58yNg5j.js +1 -0
  6. package/.output/public/assets/RequestAnatomy-C9lT0qE_.js +1 -0
  7. package/.output/public/assets/ResponseView-DHJq6bnz.js +1 -0
  8. package/.output/public/assets/StreamingChunkSequence-BTgfpFUT.js +1 -0
  9. package/.output/public/assets/_sessionId-DsNRbnNm.js +1 -0
  10. package/.output/public/assets/alibaba-TTwafVwX.svg +1 -0
  11. package/.output/public/assets/index-CpWG2hFn.css +1 -0
  12. package/.output/public/assets/index-DmBV8Gve.js +1 -0
  13. package/.output/public/assets/json-viewer-CZVYLR8j.js +14 -0
  14. package/.output/public/assets/main-DHs7FBK3.js +18 -0
  15. package/.output/public/assets/minimax-BPMzvuL-.jpeg +0 -0
  16. package/.output/public/assets/qwen-CONDcHqt.png +0 -0
  17. package/.output/public/assets/zhipuai-BPNAnxo-.svg +219 -0
  18. package/.output/server/_chunks/ssr-renderer.mjs +22 -0
  19. package/.output/server/_libs/@radix-ui/react-accessible-icon+[...].mjs +1 -0
  20. package/.output/server/_libs/@radix-ui/react-dismissable-layer+[...].mjs +210 -0
  21. package/.output/server/_libs/@radix-ui/react-navigation-menu+[...].mjs +2 -0
  22. package/.output/server/_libs/@radix-ui/react-one-time-password-field+[...].mjs +2 -0
  23. package/.output/server/_libs/@radix-ui/react-password-toggle-field+[...].mjs +2 -0
  24. package/.output/server/_libs/@radix-ui/react-use-callback-ref+[...].mjs +11 -0
  25. package/.output/server/_libs/@radix-ui/react-use-controllable-state+[...].mjs +69 -0
  26. package/.output/server/_libs/@radix-ui/react-use-effect-event+[...].mjs +1 -0
  27. package/.output/server/_libs/@radix-ui/react-use-escape-keydown+[...].mjs +17 -0
  28. package/.output/server/_libs/@radix-ui/react-use-is-hydrated+[...].mjs +1 -0
  29. package/.output/server/_libs/@radix-ui/react-use-layout-effect+[...].mjs +6 -0
  30. package/.output/server/_libs/@radix-ui/react-visually-hidden+[...].mjs +34 -0
  31. package/.output/server/_libs/ajv-formats.mjs +330 -0
  32. package/.output/server/_libs/ajv.mjs +11444 -0
  33. package/.output/server/_libs/aria-hidden.mjs +122 -0
  34. package/.output/server/_libs/atomically.mjs +152 -0
  35. package/.output/server/_libs/bail.mjs +8 -0
  36. package/.output/server/_libs/cfworker__json-schema.mjs +1 -0
  37. package/.output/server/_libs/character-entities.mjs +2130 -0
  38. package/.output/server/_libs/class-variance-authority.mjs +44 -0
  39. package/.output/server/_libs/clsx.mjs +16 -0
  40. package/.output/server/_libs/comma-separated-tokens.mjs +10 -0
  41. package/.output/server/_libs/conf.mjs +635 -0
  42. package/.output/server/_libs/cookie-es.mjs +58 -0
  43. package/.output/server/_libs/core-util-is.mjs +75 -0
  44. package/.output/server/_libs/croner.mjs +1 -0
  45. package/.output/server/_libs/crossws.mjs +1 -0
  46. package/.output/server/_libs/debounce-fn.mjs +69 -0
  47. package/.output/server/_libs/decode-named-character-reference+[...].mjs +8 -0
  48. package/.output/server/_libs/dequal.mjs +27 -0
  49. package/.output/server/_libs/detect-node-es.mjs +1 -0
  50. package/.output/server/_libs/devlop.mjs +8 -0
  51. package/.output/server/_libs/diff.mjs +320 -0
  52. package/.output/server/_libs/dot-prop.mjs +265 -0
  53. package/.output/server/_libs/env-paths.mjs +57 -0
  54. package/.output/server/_libs/estree-util-is-identifier-name.mjs +11 -0
  55. package/.output/server/_libs/extend.mjs +97 -0
  56. package/.output/server/_libs/fast-deep-equal.mjs +38 -0
  57. package/.output/server/_libs/fast-uri.mjs +812 -0
  58. package/.output/server/_libs/floating-ui__core.mjs +725 -0
  59. package/.output/server/_libs/floating-ui__dom.mjs +622 -0
  60. package/.output/server/_libs/floating-ui__react-dom.mjs +292 -0
  61. package/.output/server/_libs/floating-ui__utils.mjs +320 -0
  62. package/.output/server/_libs/get-nonce.mjs +9 -0
  63. package/.output/server/_libs/h3-v2.mjs +276 -0
  64. package/.output/server/_libs/h3.mjs +408 -0
  65. package/.output/server/_libs/hast-util-to-jsx-runtime.mjs +388 -0
  66. package/.output/server/_libs/hast-util-whitespace.mjs +10 -0
  67. package/.output/server/_libs/hookable.mjs +1 -0
  68. package/.output/server/_libs/html-url-attributes.mjs +26 -0
  69. package/.output/server/_libs/immediate.mjs +74 -0
  70. package/.output/server/_libs/inherits.mjs +50 -0
  71. package/.output/server/_libs/inline-style-parser.mjs +142 -0
  72. package/.output/server/_libs/is-plain-obj.mjs +10 -0
  73. package/.output/server/_libs/isarray.mjs +14 -0
  74. package/.output/server/_libs/isbot.mjs +20 -0
  75. package/.output/server/_libs/json-schema-traverse.mjs +180 -0
  76. package/.output/server/_libs/jszip.mjs +3051 -0
  77. package/.output/server/_libs/lie.mjs +273 -0
  78. package/.output/server/_libs/lucide-react.mjs +492 -0
  79. package/.output/server/_libs/mdast-util-from-markdown.mjs +717 -0
  80. package/.output/server/_libs/mdast-util-to-hast.mjs +710 -0
  81. package/.output/server/_libs/mdast-util-to-string.mjs +38 -0
  82. package/.output/server/_libs/micromark-core-commonmark.mjs +2259 -0
  83. package/.output/server/_libs/micromark-factory-destination.mjs +94 -0
  84. package/.output/server/_libs/micromark-factory-label.mjs +63 -0
  85. package/.output/server/_libs/micromark-factory-space.mjs +24 -0
  86. package/.output/server/_libs/micromark-factory-title.mjs +65 -0
  87. package/.output/server/_libs/micromark-factory-whitespace.mjs +22 -0
  88. package/.output/server/_libs/micromark-util-character.mjs +44 -0
  89. package/.output/server/_libs/micromark-util-chunked.mjs +36 -0
  90. package/.output/server/_libs/micromark-util-classify-character+[...].mjs +12 -0
  91. package/.output/server/_libs/micromark-util-combine-extensions+[...].mjs +41 -0
  92. package/.output/server/_libs/micromark-util-decode-numeric-character-reference+[...].mjs +19 -0
  93. package/.output/server/_libs/micromark-util-decode-string.mjs +21 -0
  94. package/.output/server/_libs/micromark-util-encode.mjs +1 -0
  95. package/.output/server/_libs/micromark-util-html-tag-name.mjs +69 -0
  96. package/.output/server/_libs/micromark-util-normalize-identifier+[...].mjs +6 -0
  97. package/.output/server/_libs/micromark-util-resolve-all.mjs +15 -0
  98. package/.output/server/_libs/micromark-util-sanitize-uri.mjs +41 -0
  99. package/.output/server/_libs/micromark-util-subtokenize.mjs +346 -0
  100. package/.output/server/_libs/micromark.mjs +906 -0
  101. package/.output/server/_libs/mimic-function.mjs +47 -0
  102. package/.output/server/_libs/modelcontextprotocol__server.mjs +9738 -0
  103. package/.output/server/_libs/ocache.mjs +1 -0
  104. package/.output/server/_libs/ohash.mjs +1 -0
  105. package/.output/server/_libs/pako.mjs +4223 -0
  106. package/.output/server/_libs/process-nextick-args.mjs +48 -0
  107. package/.output/server/_libs/property-information.mjs +1209 -0
  108. package/.output/server/_libs/radix-ui.mjs +1 -0
  109. package/.output/server/_libs/radix-ui__number.mjs +6 -0
  110. package/.output/server/_libs/radix-ui__primitive.mjs +11 -0
  111. package/.output/server/_libs/radix-ui__react-accordion.mjs +1 -0
  112. package/.output/server/_libs/radix-ui__react-alert-dialog.mjs +1 -0
  113. package/.output/server/_libs/radix-ui__react-arrow.mjs +23 -0
  114. package/.output/server/_libs/radix-ui__react-aspect-ratio.mjs +1 -0
  115. package/.output/server/_libs/radix-ui__react-avatar.mjs +1 -0
  116. package/.output/server/_libs/radix-ui__react-checkbox.mjs +1 -0
  117. package/.output/server/_libs/radix-ui__react-collapsible.mjs +144 -0
  118. package/.output/server/_libs/radix-ui__react-collection.mjs +69 -0
  119. package/.output/server/_libs/radix-ui__react-compose-refs.mjs +39 -0
  120. package/.output/server/_libs/radix-ui__react-context-menu.mjs +1 -0
  121. package/.output/server/_libs/radix-ui__react-context.mjs +78 -0
  122. package/.output/server/_libs/radix-ui__react-dialog.mjs +325 -0
  123. package/.output/server/_libs/radix-ui__react-direction.mjs +9 -0
  124. package/.output/server/_libs/radix-ui__react-dropdown-menu.mjs +1 -0
  125. package/.output/server/_libs/radix-ui__react-focus-guards.mjs +29 -0
  126. package/.output/server/_libs/radix-ui__react-focus-scope.mjs +206 -0
  127. package/.output/server/_libs/radix-ui__react-form.mjs +1 -0
  128. package/.output/server/_libs/radix-ui__react-hover-card.mjs +1 -0
  129. package/.output/server/_libs/radix-ui__react-id.mjs +14 -0
  130. package/.output/server/_libs/radix-ui__react-label.mjs +1 -0
  131. package/.output/server/_libs/radix-ui__react-menu.mjs +1 -0
  132. package/.output/server/_libs/radix-ui__react-menubar.mjs +1 -0
  133. package/.output/server/_libs/radix-ui__react-popover.mjs +1 -0
  134. package/.output/server/_libs/radix-ui__react-popper.mjs +286 -0
  135. package/.output/server/_libs/radix-ui__react-portal.mjs +16 -0
  136. package/.output/server/_libs/radix-ui__react-presence.mjs +128 -0
  137. package/.output/server/_libs/radix-ui__react-primitive.mjs +42 -0
  138. package/.output/server/_libs/radix-ui__react-progress.mjs +1 -0
  139. package/.output/server/_libs/radix-ui__react-radio-group.mjs +1 -0
  140. package/.output/server/_libs/radix-ui__react-roving-focus.mjs +224 -0
  141. package/.output/server/_libs/radix-ui__react-scroll-area.mjs +721 -0
  142. package/.output/server/_libs/radix-ui__react-select.mjs +1163 -0
  143. package/.output/server/_libs/radix-ui__react-separator.mjs +28 -0
  144. package/.output/server/_libs/radix-ui__react-slider.mjs +1 -0
  145. package/.output/server/_libs/radix-ui__react-slot.mjs +99 -0
  146. package/.output/server/_libs/radix-ui__react-switch.mjs +1 -0
  147. package/.output/server/_libs/radix-ui__react-tabs.mjs +189 -0
  148. package/.output/server/_libs/radix-ui__react-toast.mjs +2 -0
  149. package/.output/server/_libs/radix-ui__react-toggle-group.mjs +1 -0
  150. package/.output/server/_libs/radix-ui__react-toggle.mjs +1 -0
  151. package/.output/server/_libs/radix-ui__react-toolbar.mjs +1 -0
  152. package/.output/server/_libs/radix-ui__react-tooltip.mjs +495 -0
  153. package/.output/server/_libs/radix-ui__react-use-previous.mjs +14 -0
  154. package/.output/server/_libs/radix-ui__react-use-size.mjs +39 -0
  155. package/.output/server/_libs/react-dom.mjs +10781 -0
  156. package/.output/server/_libs/react-markdown.mjs +147 -0
  157. package/.output/server/_libs/react-remove-scroll-bar.mjs +82 -0
  158. package/.output/server/_libs/react-remove-scroll.mjs +328 -0
  159. package/.output/server/_libs/react-style-singleton.mjs +69 -0
  160. package/.output/server/_libs/react.mjs +515 -0
  161. package/.output/server/_libs/readable-stream.mjs +1518 -0
  162. package/.output/server/_libs/remark-parse.mjs +19 -0
  163. package/.output/server/_libs/remark-rehype.mjs +21 -0
  164. package/.output/server/_libs/rou3.mjs +14 -0
  165. package/.output/server/_libs/safe-buffer.mjs +64 -0
  166. package/.output/server/_libs/semver.mjs +1938 -0
  167. package/.output/server/_libs/seroval-plugins.mjs +58 -0
  168. package/.output/server/_libs/seroval.mjs +1765 -0
  169. package/.output/server/_libs/setimmediate.mjs +152 -0
  170. package/.output/server/_libs/space-separated-tokens.mjs +6 -0
  171. package/.output/server/_libs/srvx.mjs +1029 -0
  172. package/.output/server/_libs/stubborn-fs.mjs +91 -0
  173. package/.output/server/_libs/stubborn-utils.mjs +66 -0
  174. package/.output/server/_libs/style-to-js.mjs +72 -0
  175. package/.output/server/_libs/style-to-object.mjs +38 -0
  176. package/.output/server/_libs/swr.mjs +939 -0
  177. package/.output/server/_libs/tailwind-merge.mjs +3010 -0
  178. package/.output/server/_libs/tanstack__history.mjs +217 -0
  179. package/.output/server/_libs/tanstack__react-router.mjs +1480 -0
  180. package/.output/server/_libs/tanstack__react-store.mjs +1 -0
  181. package/.output/server/_libs/tanstack__react-virtual.mjs +44 -0
  182. package/.output/server/_libs/tanstack__router-core.mjs +4827 -0
  183. package/.output/server/_libs/tanstack__store.mjs +1 -0
  184. package/.output/server/_libs/tanstack__virtual-core.mjs +1225 -0
  185. package/.output/server/_libs/tiny-invariant.mjs +12 -0
  186. package/.output/server/_libs/tiny-warning.mjs +5 -0
  187. package/.output/server/_libs/trim-lines.mjs +41 -0
  188. package/.output/server/_libs/trough.mjs +85 -0
  189. package/.output/server/_libs/tslib.mjs +1 -0
  190. package/.output/server/_libs/ufo.mjs +54 -0
  191. package/.output/server/_libs/uint8array-extras.mjs +69 -0
  192. package/.output/server/_libs/ungap__structured-clone.mjs +212 -0
  193. package/.output/server/_libs/unified.mjs +661 -0
  194. package/.output/server/_libs/unist-util-is.mjs +100 -0
  195. package/.output/server/_libs/unist-util-position.mjs +27 -0
  196. package/.output/server/_libs/unist-util-stringify-position.mjs +27 -0
  197. package/.output/server/_libs/unist-util-visit-parents.mjs +82 -0
  198. package/.output/server/_libs/unist-util-visit.mjs +24 -0
  199. package/.output/server/_libs/unstorage.mjs +1 -0
  200. package/.output/server/_libs/use-callback-ref.mjs +66 -0
  201. package/.output/server/_libs/use-sidecar.mjs +106 -0
  202. package/.output/server/_libs/use-sync-external-store.mjs +64 -0
  203. package/.output/server/_libs/util-deprecate.mjs +12 -0
  204. package/.output/server/_libs/vfile-message.mjs +138 -0
  205. package/.output/server/_libs/vfile.mjs +467 -0
  206. package/.output/server/_libs/when-exit.mjs +53 -0
  207. package/.output/server/_libs/zod.mjs +4524 -0
  208. package/.output/server/_sessionId-wMLPvC5g.mjs +123 -0
  209. package/.output/server/_ssr/CompareDrawer-BU4V0uVf.mjs +1041 -0
  210. package/.output/server/_ssr/ProxyViewerContainer-BnRwFEnn.mjs +5972 -0
  211. package/.output/server/_ssr/ReplayDialog-C7dn9pd_.mjs +322 -0
  212. package/.output/server/_ssr/RequestAnatomy-C1rWpe9-.mjs +353 -0
  213. package/.output/server/_ssr/ResponseView-hGpPaYsf.mjs +602 -0
  214. package/.output/server/_ssr/StreamingChunkSequence-BRWI1r_G.mjs +302 -0
  215. package/.output/server/_ssr/index-BKURLVPz.mjs +118 -0
  216. package/.output/server/_ssr/index.mjs +1184 -0
  217. package/.output/server/_ssr/json-viewer-BBd2DtQP.mjs +515 -0
  218. package/.output/server/_ssr/router-BcZ0D6AB.mjs +6317 -0
  219. package/.output/server/_ssr/start-HYkvq4Ni.mjs +4 -0
  220. package/.output/server/_tanstack-start-manifest_v-1y8ZVxRI.mjs +4 -0
  221. package/.output/server/index.mjs +436 -0
  222. package/.output/server/node_modules/tslib/modules/index.js +70 -0
  223. package/.output/server/node_modules/tslib/modules/package.json +3 -0
  224. package/.output/server/node_modules/tslib/package.json +47 -0
  225. package/.output/server/node_modules/tslib/tslib.js +484 -0
  226. package/.output/server/package.json +9 -0
  227. package/LICENSE +21 -0
  228. package/README.md +52 -0
  229. package/package.json +110 -0
  230. package/src/assets/favicon.svg +31 -0
  231. package/src/assets/logos/alibaba.svg +1 -0
  232. package/src/assets/logos/anthropic.svg +1 -0
  233. package/src/assets/logos/claude-code.svg +4 -0
  234. package/src/assets/logos/deepseek.svg +1 -0
  235. package/src/assets/logos/mcp.png +0 -0
  236. package/src/assets/logos/minimax.jpeg +0 -0
  237. package/src/assets/logos/openai.svg +1 -0
  238. package/src/assets/logos/opencode.svg +4 -0
  239. package/src/assets/logos/qwen.png +0 -0
  240. package/src/assets/logos/zhipuai.svg +219 -0
  241. package/src/cli/detect-tools.ts +147 -0
  242. package/src/cli/doctor.ts +521 -0
  243. package/src/cli/onboard.ts +224 -0
  244. package/src/cli/templates/command-onboard.ts +17 -0
  245. package/src/cli/templates/skill-onboard.ts +547 -0
  246. package/src/cli.ts +345 -0
  247. package/src/components/OnboardingBanner.tsx +67 -0
  248. package/src/components/ProxyViewer.tsx +545 -0
  249. package/src/components/ProxyViewerContainer.tsx +363 -0
  250. package/src/components/providers/ImportWizardDialog.tsx +349 -0
  251. package/src/components/providers/ProviderCard.tsx +474 -0
  252. package/src/components/providers/ProviderForm.tsx +494 -0
  253. package/src/components/providers/ProviderLogo.tsx +117 -0
  254. package/src/components/providers/ProvidersPanel.tsx +619 -0
  255. package/src/components/providers/SettingsDialog.tsx +202 -0
  256. package/src/components/proxy-viewer/CompareDrawer.tsx +893 -0
  257. package/src/components/proxy-viewer/ConversationGroup.tsx +107 -0
  258. package/src/components/proxy-viewer/ConversationHeader.tsx +300 -0
  259. package/src/components/proxy-viewer/LogEntry.tsx +543 -0
  260. package/src/components/proxy-viewer/LogEntryHeader.tsx +501 -0
  261. package/src/components/proxy-viewer/ReplayDialog.tsx +218 -0
  262. package/src/components/proxy-viewer/ResponseView.tsx +171 -0
  263. package/src/components/proxy-viewer/StreamingChunkSequence.tsx +188 -0
  264. package/src/components/proxy-viewer/ThreadConnector.tsx +136 -0
  265. package/src/components/proxy-viewer/TurnGroup.tsx +337 -0
  266. package/src/components/proxy-viewer/anatomy/RequestAnatomy.tsx +98 -0
  267. package/src/components/proxy-viewer/anatomy/SegmentBar.tsx +196 -0
  268. package/src/components/proxy-viewer/anatomy/tokenEstimate.ts +53 -0
  269. package/src/components/proxy-viewer/anatomy/types.ts +39 -0
  270. package/src/components/proxy-viewer/anatomy/useAnatomyJump.ts +114 -0
  271. package/src/components/proxy-viewer/cacheTrend.ts +50 -0
  272. package/src/components/proxy-viewer/diff/DiffView.tsx +321 -0
  273. package/src/components/proxy-viewer/diff/computeDiff.ts +178 -0
  274. package/src/components/proxy-viewer/diff/index.ts +3 -0
  275. package/src/components/proxy-viewer/formats/anthropic/ContentBlocks.tsx +157 -0
  276. package/src/components/proxy-viewer/formats/anthropic/ResponseView.tsx +66 -0
  277. package/src/components/proxy-viewer/formats/anthropic/thinkingExtract.ts +21 -0
  278. package/src/components/proxy-viewer/formats/index.tsx +33 -0
  279. package/src/components/proxy-viewer/formats/openai/ResponseView.tsx +170 -0
  280. package/src/components/proxy-viewer/index.ts +9 -0
  281. package/src/components/proxy-viewer/lazy.ts +37 -0
  282. package/src/components/proxy-viewer/log-formats/anthropic.ts +194 -0
  283. package/src/components/proxy-viewer/log-formats/index.ts +23 -0
  284. package/src/components/proxy-viewer/log-formats/openai.ts +167 -0
  285. package/src/components/proxy-viewer/log-formats/types.ts +40 -0
  286. package/src/components/proxy-viewer/log-formats/unknown.ts +18 -0
  287. package/src/components/proxy-viewer/logEntryVisibility.ts +39 -0
  288. package/src/components/proxy-viewer/requestDiff.ts +277 -0
  289. package/src/components/proxy-viewer/useCopyFeedback.ts +36 -0
  290. package/src/components/proxy-viewer/useKeyboardNavigation.ts +190 -0
  291. package/src/components/proxy-viewer/viewerState.ts +66 -0
  292. package/src/components/ui/badge.tsx +47 -0
  293. package/src/components/ui/button.tsx +47 -0
  294. package/src/components/ui/collapsible.tsx +21 -0
  295. package/src/components/ui/confirm-dialog.tsx +51 -0
  296. package/src/components/ui/crab-logo.tsx +95 -0
  297. package/src/components/ui/crab-variants.tsx +467 -0
  298. package/src/components/ui/dialog.tsx +129 -0
  299. package/src/components/ui/json-expansion-button.tsx +56 -0
  300. package/src/components/ui/json-viewer-bulk.ts +97 -0
  301. package/src/components/ui/json-viewer.tsx +494 -0
  302. package/src/components/ui/mcp-logo.tsx +20 -0
  303. package/src/components/ui/scroll-area.tsx +54 -0
  304. package/src/components/ui/select.tsx +178 -0
  305. package/src/components/ui/separator.tsx +28 -0
  306. package/src/components/ui/tabs.tsx +88 -0
  307. package/src/components/ui/tooltip.tsx +51 -0
  308. package/src/index.css +11 -0
  309. package/src/knowledge/candidateStore.ts +63 -0
  310. package/src/knowledge/distiller.ts +98 -0
  311. package/src/knowledge/openclawClient.ts +118 -0
  312. package/src/knowledge/redactor.ts +80 -0
  313. package/src/knowledge/types.ts +84 -0
  314. package/src/lib/apiClient.ts +49 -0
  315. package/src/lib/export-logs.ts +51 -0
  316. package/src/lib/mask.ts +4 -0
  317. package/src/lib/objectUtils.ts +22 -0
  318. package/src/lib/providerContract.ts +26 -0
  319. package/src/lib/providerTestContract.ts +107 -0
  320. package/src/lib/runtimeConfig.ts +25 -0
  321. package/src/lib/serverPort.ts +41 -0
  322. package/src/lib/sessionUrl.ts +44 -0
  323. package/src/lib/stopReason.ts +58 -0
  324. package/src/lib/useOnboarding.ts +80 -0
  325. package/src/lib/useProviders.ts +30 -0
  326. package/src/lib/useStripConfig.ts +108 -0
  327. package/src/lib/utils.ts +21 -0
  328. package/src/mcp/loopback.ts +76 -0
  329. package/src/mcp/previewExtractor.ts +166 -0
  330. package/src/mcp/server.ts +396 -0
  331. package/src/mcp/toolHandlers.ts +341 -0
  332. package/src/proxy/chunkStorage.ts +112 -0
  333. package/src/proxy/claudeCodeStrip.ts +99 -0
  334. package/src/proxy/config.ts +172 -0
  335. package/src/proxy/constants.ts +47 -0
  336. package/src/proxy/dataDir.ts +86 -0
  337. package/src/proxy/formats/anthropic/anthropicProvider.ts +75 -0
  338. package/src/proxy/formats/anthropic/handler.ts +71 -0
  339. package/src/proxy/formats/anthropic/index.ts +14 -0
  340. package/src/proxy/formats/anthropic/register.ts +4 -0
  341. package/src/proxy/formats/anthropic/schemas.ts +237 -0
  342. package/src/proxy/formats/anthropic/stream.ts +205 -0
  343. package/src/proxy/formats/handler.ts +46 -0
  344. package/src/proxy/formats/index.ts +12 -0
  345. package/src/proxy/formats/jsonSchema.ts +36 -0
  346. package/src/proxy/formats/openai/alibabaProvider.ts +38 -0
  347. package/src/proxy/formats/openai/handler.ts +96 -0
  348. package/src/proxy/formats/openai/index.ts +25 -0
  349. package/src/proxy/formats/openai/provider.ts +50 -0
  350. package/src/proxy/formats/openai/register.ts +4 -0
  351. package/src/proxy/formats/openai/schemas.ts +187 -0
  352. package/src/proxy/formats/openai/stream.ts +206 -0
  353. package/src/proxy/formats/protocol.ts +50 -0
  354. package/src/proxy/formats/providerRegistry.ts +51 -0
  355. package/src/proxy/formats/providers/index.ts +3 -0
  356. package/src/proxy/formats/registry.ts +66 -0
  357. package/src/proxy/handler.ts +334 -0
  358. package/src/proxy/logFinalizer.ts +305 -0
  359. package/src/proxy/logFinalizer.worker.ts +24 -0
  360. package/src/proxy/logIndex.ts +268 -0
  361. package/src/proxy/logger.ts +179 -0
  362. package/src/proxy/openaiOrphanToolStrip.ts +142 -0
  363. package/src/proxy/providerImporters.ts +491 -0
  364. package/src/proxy/providers.ts +613 -0
  365. package/src/proxy/schemas.ts +209 -0
  366. package/src/proxy/sessionProcess.ts +140 -0
  367. package/src/proxy/sessionRuntime.ts +85 -0
  368. package/src/proxy/sessionSupervisor.ts +283 -0
  369. package/src/proxy/sessionWorkerEntry.ts +26 -0
  370. package/src/proxy/socketTracker.ts +255 -0
  371. package/src/proxy/store.ts +412 -0
  372. package/src/proxy/upstream.ts +90 -0
  373. package/src/router.tsx +16 -0
  374. package/src/routes/__root.tsx +45 -0
  375. package/src/routes/api/config.paths.ts +14 -0
  376. package/src/routes/api/config.ts +53 -0
  377. package/src/routes/api/health.ts +15 -0
  378. package/src/routes/api/knowledge.candidates.$candidateId.promote.ts +32 -0
  379. package/src/routes/api/knowledge.candidates.ts +10 -0
  380. package/src/routes/api/knowledge.project-context.ts +18 -0
  381. package/src/routes/api/knowledge.search.ts +31 -0
  382. package/src/routes/api/knowledge.sessions.$sessionId.candidates.ts +16 -0
  383. package/src/routes/api/logs.$id.chunks.ts +36 -0
  384. package/src/routes/api/logs.$id.replay.ts +191 -0
  385. package/src/routes/api/logs.$id.ts +22 -0
  386. package/src/routes/api/logs.stream.ts +74 -0
  387. package/src/routes/api/logs.ts +59 -0
  388. package/src/routes/api/mcp.ts +25 -0
  389. package/src/routes/api/models.ts +10 -0
  390. package/src/routes/api/providers.$providerId.test.log.ts +293 -0
  391. package/src/routes/api/providers.$providerId.ts +50 -0
  392. package/src/routes/api/providers.export.ts +26 -0
  393. package/src/routes/api/providers.import.ts +47 -0
  394. package/src/routes/api/providers.scan.ts +23 -0
  395. package/src/routes/api/providers.ts +45 -0
  396. package/src/routes/api/sessions.ts +17 -0
  397. package/src/routes/index.tsx +6 -0
  398. package/src/routes/proxy/$.ts +15 -0
  399. package/src/routes/session/$sessionId.tsx +23 -0
  400. package/styles/globals.css +188 -0
@@ -0,0 +1,101 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompareDrawer-CU5ZrWcL.js","assets/main-DHs7FBK3.js","assets/json-viewer-CZVYLR8j.js","assets/ReplayDialog-F58yNg5j.js","assets/ResponseView-DHJq6bnz.js","assets/RequestAnatomy-C9lT0qE_.js","assets/StreamingChunkSequence-BTgfpFUT.js"])))=>i.map(i=>d[i]);
2
+ import{u as Zo,a as ua,r as v,j as a,c as Zn,g as Hu,b as In,d as We,e as da,f as qu,h as Ju,_ as Mt}from"./main-DHs7FBK3.js";function G(e,t,n){function r(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);const u=i.prototype,d=Object.keys(u);for(let h=0;h<d.length;h++){const m=d[h];m in l||(l[m]=u[m].bind(l))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(l){var c;const u=n?.Parent?new s:this;r(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:l=>n?.Parent&&l instanceof n.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Xt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class fa extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const ha={};function bt(e){return ha}function pa(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function mo(e,t){return typeof t=="bigint"?t.toString():t}function Sr(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Wo(e){return e==null}function Vo(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Ku(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const s=n>o?n:o,i=Number.parseInt(e.toFixed(s).replace(".","")),l=Number.parseInt(t.toFixed(s).replace(".",""));return i%l/10**s}const Os=Symbol("evaluating");function _e(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Os)return r===void 0&&(r=Os,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Dt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function St(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Rs(e){return JSON.stringify(e)}function Gu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ma="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Nn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Yu=Sr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function nn(e){if(Nn(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Nn(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ga(e){return nn(e)?{...e}:Array.isArray(e)?[...e]:e}const Xu=new Set(["string","number","symbol"]);function rn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function jt(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function de(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Qu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const ed={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function td(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=St(e._zod.def,{get shape(){const i={};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(i[l]=n.shape[l])}return Dt(this,"shape",i),i},checks:[]});return jt(e,s)}function nd(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=St(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete i[l]}return Dt(this,"shape",i),i},checks:[]});return jt(e,s)}function rd(e,t){if(!nn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=St(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Dt(this,"shape",s),s}});return jt(e,o)}function od(e,t){if(!nn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=St(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Dt(this,"shape",r),r}});return jt(e,n)}function sd(e,t){const n=St(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Dt(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return jt(e,n)}function id(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=St(t._zod.def,{get shape(){const l=t._zod.def.shape,c={...l};if(n)for(const u in n){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:l[u]}):l[u])}else for(const u in l)c[u]=e?new e({type:"optional",innerType:l[u]}):l[u];return Dt(this,"shape",c),c},checks:[]});return jt(t,i)}function ad(e,t,n){const r=St(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return Dt(this,"shape",s),s}});return jt(t,r)}function Gt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Yt(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Wn(e){return typeof e=="string"?e:e?.message}function wt(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=Wn(e.inst?._zod.def?.error?.(e))??Wn(t?.error?.(e))??Wn(n.customError?.(e))??Wn(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ho(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Tn(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const xa=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,mo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},va=G("$ZodError",xa),ya=G("$ZodError",xa,{Parent:Error});function ld(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function cd(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>r({issues:i}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let i=n,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],l++}}};return r(e),n}const qo=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Xt;if(i.issues.length){const l=new(o?.Err??e)(i.issues.map(c=>wt(c,s,bt())));throw ma(l,o?.callee),l}return i.value},Jo=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const l=new(o?.Err??e)(i.issues.map(c=>wt(c,s,bt())));throw ma(l,o?.callee),l}return i.value},jr=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Xt;return s.issues.length?{success:!1,error:new(e??va)(s.issues.map(i=>wt(i,o,bt())))}:{success:!0,data:s.value}},ud=jr(ya),Er=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>wt(i,o,bt())))}:{success:!0,data:s.value}},dd=Er(ya),fd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return qo(e)(t,n,o)},hd=e=>(t,n,r)=>qo(e)(t,n,r),pd=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Jo(e)(t,n,o)},md=e=>async(t,n,r)=>Jo(e)(t,n,r),gd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return jr(e)(t,n,o)},xd=e=>(t,n,r)=>jr(e)(t,n,r),vd=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Er(e)(t,n,o)},yd=e=>async(t,n,r)=>Er(e)(t,n,r),bd=/^[cC][^\s-]{8,}$/,wd=/^[0-9a-z]+$/,_d=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,kd=/^[0-9a-vA-V]{20}$/,Cd=/^[A-Za-z0-9]{27}$/,Sd=/^[a-zA-Z0-9_-]{21}$/,jd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ed=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Is=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Nd=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Td="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Ad(){return new RegExp(Td,"u")}const zd=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Od=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Rd=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Id=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Pd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ba=/^[A-Za-z0-9_-]*$/,Md=/^\+[1-9]\d{6,14}$/,wa="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Dd=new RegExp(`^${wa}$`);function _a(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ld(e){return new RegExp(`^${_a(e)}$`)}function Fd(e){const t=_a({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${wa}T(?:${r})$`)}const $d=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Bd=/^-?\d+$/,ka=/^-?\d+(?:\.\d+)?$/,Ud=/^(?:true|false)$/i,Zd=/^null$/i,Wd=/^[^A-Z]*$/,Vd=/^[^a-z]*$/,He=G("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ca={number:"number",bigint:"bigint",object:"date"},Sa=G("$ZodCheckLessThan",(e,t)=>{He.init(e,t);const n=Ca[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ja=G("$ZodCheckGreaterThan",(e,t)=>{He.init(e,t);const n=Ca[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Hd=G("$ZodCheckMultipleOf",(e,t)=>{He.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Ku(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),qd=G("$ZodCheckNumberFormat",(e,t)=>{He.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=ed[t.format];e._zod.onattach.push(i=>{const l=i._zod.bag;l.format=t.format,l.minimum=o,l.maximum=s,n&&(l.pattern=Bd)}),e._zod.check=i=>{const l=i.value;if(n){if(!Number.isInteger(l)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?i.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):i.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}l<o&&i.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>s&&i.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Jd=G("$ZodCheckMaxLength",(e,t)=>{var n;He.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Wo(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const i=Ho(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Kd=G("$ZodCheckMinLength",(e,t)=>{var n;He.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Wo(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const i=Ho(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Gd=G("$ZodCheckLengthEquals",(e,t)=>{var n;He.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Wo(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const i=Ho(o),l=s>t.length;r.issues.push({origin:i,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Nr=G("$ZodCheckStringFormat",(e,t)=>{var n,r;He.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Yd=G("$ZodCheckRegex",(e,t)=>{Nr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xd=G("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Wd),Nr.init(e,t)}),Qd=G("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Vd),Nr.init(e,t)}),ef=G("$ZodCheckIncludes",(e,t)=>{He.init(e,t);const n=rn(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),tf=G("$ZodCheckStartsWith",(e,t)=>{He.init(e,t);const n=new RegExp(`^${rn(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),nf=G("$ZodCheckEndsWith",(e,t)=>{He.init(e,t);const n=new RegExp(`.*${rn(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),rf=G("$ZodCheckOverwrite",(e,t)=>{He.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class of{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
3
+ `).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
4
+ `))}}const sf={major:4,minor:3,patch:6},ze=G("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=sf;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const s of o._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,l,c)=>{let u=Gt(i),d;for(const h of l){if(h._zod.def.when){if(!h._zod.def.when(i))continue}else if(u)continue;const m=i.issues.length,p=h._zod.check(i);if(p instanceof Promise&&c?.async===!1)throw new Xt;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await p,i.issues.length!==m&&(u||(u=Gt(i,m)))});else{if(i.issues.length===m)continue;u||(u=Gt(i,m))}}return d?d.then(()=>i):i},s=(i,l,c)=>{if(Gt(i))return i.aborted=!0,i;const u=o(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new Xt;return u.then(d=>e._zod.parse(d,c))}return e._zod.parse(u,c)};e._zod.run=(i,l)=>{if(l.skipChecks)return e._zod.parse(i,l);if(l.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...l,skipChecks:!0});return u instanceof Promise?u.then(d=>s(d,i,l)):s(u,i,l)}const c=e._zod.parse(i,l);if(c instanceof Promise){if(l.async===!1)throw new Xt;return c.then(u=>o(u,r,l))}return o(c,r,l)}}_e(e,"~standard",()=>({validate:o=>{try{const s=ud(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return dd(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Ko=G("$ZodString",(e,t)=>{ze.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??$d(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Ie=G("$ZodStringFormat",(e,t)=>{Nr.init(e,t),Ko.init(e,t)}),af=G("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ed),Ie.init(e,t)}),lf=G("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Is(r))}else t.pattern??(t.pattern=Is());Ie.init(e,t)}),cf=G("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Nd),Ie.init(e,t)}),uf=G("$ZodURL",(e,t)=>{Ie.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),df=G("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ad()),Ie.init(e,t)}),ff=G("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Sd),Ie.init(e,t)}),hf=G("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=bd),Ie.init(e,t)}),pf=G("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=wd),Ie.init(e,t)}),mf=G("$ZodULID",(e,t)=>{t.pattern??(t.pattern=_d),Ie.init(e,t)}),gf=G("$ZodXID",(e,t)=>{t.pattern??(t.pattern=kd),Ie.init(e,t)}),xf=G("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Cd),Ie.init(e,t)}),vf=G("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Fd(t)),Ie.init(e,t)}),yf=G("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Dd),Ie.init(e,t)}),bf=G("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ld(t)),Ie.init(e,t)}),wf=G("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=jd),Ie.init(e,t)}),_f=G("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=zd),Ie.init(e,t),e._zod.bag.format="ipv4"}),kf=G("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Od),Ie.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Cf=G("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Rd),Ie.init(e,t)}),Sf=G("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Id),Ie.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,s]=r;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Ea(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const jf=G("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Pd),Ie.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Ea(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Ef(e){if(!ba.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ea(n)}const Nf=G("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ba),Ie.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Ef(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Tf=G("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Md),Ie.init(e,t)});function Af(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const zf=G("$ZodJWT",(e,t)=>{Ie.init(e,t),e._zod.check=n=>{Af(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Na=G("$ZodNumber",(e,t)=>{ze.init(e,t),e._zod.pattern=e._zod.bag.pattern??ka,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),Of=G("$ZodNumberFormat",(e,t)=>{qd.init(e,t),Na.init(e,t)}),Rf=G("$ZodBoolean",(e,t)=>{ze.init(e,t),e._zod.pattern=Ud,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),If=G("$ZodNull",(e,t)=>{ze.init(e,t),e._zod.pattern=Zd,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Pf=G("$ZodUnknown",(e,t)=>{ze.init(e,t),e._zod.parse=n=>n}),Mf=G("$ZodNever",(e,t)=>{ze.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ps(e,t,n){e.issues.length&&t.issues.push(...Yt(n,e.issues)),t.value[n]=e.value}const Df=G("$ZodArray",(e,t)=>{ze.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const l=o[i],c=t.element._zod.run({value:l,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Ps(u,n,i))):Ps(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function ur(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Yt(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Ta(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=Qu(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Aa(e,t,n,r,o,s){const i=[],l=o.keySet,c=o.catchall._zod,u=c.def.type,d=c.optout==="optional";for(const h in t){if(l.has(h))continue;if(u==="never"){i.push(h);continue}const m=c.run({value:t[h],issues:[]},r);m instanceof Promise?e.push(m.then(p=>ur(p,n,h,t,d))):ur(m,n,h,t,d)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const Lf=G("$ZodObject",(e,t)=>{if(ze.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const l=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...l};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=Sr(()=>Ta(t));_e(e._zod,"propValues",()=>{const l=t.shape,c={};for(const u in l){const d=l[u]._zod;if(d.values){c[u]??(c[u]=new Set);for(const h of d.values)c[u].add(h)}}return c});const o=Nn,s=t.catchall;let i;e._zod.parse=(l,c)=>{i??(i=r.value);const u=l.value;if(!o(u))return l.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),l;l.value={};const d=[],h=i.shape;for(const m of i.keys){const p=h[m],g=p._zod.optout==="optional",f=p._zod.run({value:u[m],issues:[]},c);f instanceof Promise?d.push(f.then(x=>ur(x,l,m,u,g))):ur(f,l,m,u,g)}return s?Aa(d,u,l,c,r.value,e):d.length?Promise.all(d).then(()=>l):l}}),Ff=G("$ZodObjectJIT",(e,t)=>{Lf.init(e,t);const n=e._zod.parse,r=Sr(()=>Ta(t)),o=m=>{const p=new of(["shape","payload","ctx"]),g=r.value,f=k=>{const C=Rs(k);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};p.write("const input = payload.value;");const x=Object.create(null);let y=0;for(const k of g.keys)x[k]=`key_${y++}`;p.write("const newResult = {};");for(const k of g.keys){const C=x[k],j=Rs(k),E=m[k]?._zod?.optout==="optional";p.write(`const ${C} = ${f(k)};`),E?p.write(`
5
+ if (${C}.issues.length) {
6
+ if (${j} in input) {
7
+ payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
8
+ ...iss,
9
+ path: iss.path ? [${j}, ...iss.path] : [${j}]
10
+ })));
11
+ }
12
+ }
13
+
14
+ if (${C}.value === undefined) {
15
+ if (${j} in input) {
16
+ newResult[${j}] = undefined;
17
+ }
18
+ } else {
19
+ newResult[${j}] = ${C}.value;
20
+ }
21
+
22
+ `):p.write(`
23
+ if (${C}.issues.length) {
24
+ payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
25
+ ...iss,
26
+ path: iss.path ? [${j}, ...iss.path] : [${j}]
27
+ })));
28
+ }
29
+
30
+ if (${C}.value === undefined) {
31
+ if (${j} in input) {
32
+ newResult[${j}] = undefined;
33
+ }
34
+ } else {
35
+ newResult[${j}] = ${C}.value;
36
+ }
37
+
38
+ `)}p.write("payload.value = newResult;"),p.write("return payload;");const _=p.compile();return(k,C)=>_(m,k,C)};let s;const i=Nn,l=!ha.jitless,u=l&&Yu.value,d=t.catchall;let h;e._zod.parse=(m,p)=>{h??(h=r.value);const g=m.value;return i(g)?l&&u&&p?.async===!1&&p.jitless!==!0?(s||(s=o(t.shape)),m=s(m,p),d?Aa([],g,m,p,h,e):m):n(m,p):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function Ms(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Gt(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>wt(i,r,bt())))}),t)}const za=G("$ZodUnion",(e,t)=>{ze.init(e,t),_e(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),_e(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),_e(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),_e(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Vo(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return r(o,s);let i=!1;const l=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)l.push(u),i=!0;else{if(u.issues.length===0)return u;l.push(u)}}return i?Promise.all(l).then(c=>Ms(c,o,e,s)):Ms(l,o,e,s)}}),$f=G("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,za.init(e,t);const n=e._zod.parse;_e(e._zod,"propValues",()=>{const o={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[l,c]of Object.entries(i)){o[l]||(o[l]=new Set);for(const u of c)o[l].add(u)}}return o});const r=Sr(()=>{const o=t.options,s=new Map;for(const i of o){const l=i._zod.propValues?.[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const c of l){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{const i=o.value;if(!Nn(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const l=r.value.get(i?.[t.discriminator]);return l?l._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),o)}}),Bf=G("$ZodIntersection",(e,t)=>{ze.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Ds(n,c,u)):Ds(n,s,i)}});function go(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(nn(e)&&nn(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const i=go(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],i=go(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ds(e,t,n){const r=new Map;let o;for(const l of t.issues)if(l.code==="unrecognized_keys"){o??(o=l);for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(l);for(const l of n.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(l);const s=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(s.length&&o&&e.issues.push({...o,keys:s}),Gt(e))return e;const i=go(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Uf=G("$ZodRecord",(e,t)=>{ze.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!nn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const l=new Set;for(const u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){l.add(typeof u=="number"?u.toString():u);const d=t.valueType._zod.run({value:o[u],issues:[]},r);d instanceof Promise?s.push(d.then(h=>{h.issues.length&&n.issues.push(...Yt(u,h.issues)),n.value[u]=h.value})):(d.issues.length&&n.issues.push(...Yt(u,d.issues)),n.value[u]=d.value)}let c;for(const u in o)l.has(u)||(c=c??[],c.push(u));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{n.value={};for(const l of Reflect.ownKeys(o)){if(l==="__proto__")continue;let c=t.keyType._zod.run({value:l,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&ka.test(l)&&c.issues.length){const h=t.keyType._zod.run({value:Number(l),issues:[]},r);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(c=h)}if(c.issues.length){t.mode==="loose"?n.value[l]=o[l]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(h=>wt(h,r,bt())),input:l,path:[l],inst:e});continue}const d=t.valueType._zod.run({value:o[l],issues:[]},r);d instanceof Promise?s.push(d.then(h=>{h.issues.length&&n.issues.push(...Yt(l,h.issues)),n.value[c.value]=h.value})):(d.issues.length&&n.issues.push(...Yt(l,d.issues)),n.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Zf=G("$ZodEnum",(e,t)=>{ze.init(e,t);const n=pa(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Xu.has(typeof o)).map(o=>typeof o=="string"?rn(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:n,input:i,inst:e}),o}}),Wf=G("$ZodLiteral",(e,t)=>{if(ze.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?rn(r):r?rn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),Vf=G("$ZodTransform",(e,t)=>{ze.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new fa(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n));if(o instanceof Promise)throw new Xt;return n.value=o,n}});function Ls(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Oa=G("$ZodOptional",(e,t)=>{ze.init(e,t),e._zod.optin="optional",e._zod.optout="optional",_e(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),_e(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Vo(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Ls(s,n.value)):Ls(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Hf=G("$ZodExactOptional",(e,t)=>{Oa.init(e,t),_e(e._zod,"values",()=>t.innerType._zod.values),_e(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),qf=G("$ZodNullable",(e,t)=>{ze.init(e,t),_e(e._zod,"optin",()=>t.innerType._zod.optin),_e(e._zod,"optout",()=>t.innerType._zod.optout),_e(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Vo(n.source)}|null)$`):void 0}),_e(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Jf=G("$ZodDefault",(e,t)=>{ze.init(e,t),e._zod.optin="optional",_e(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Fs(s,t)):Fs(o,t)}});function Fs(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Kf=G("$ZodPrefault",(e,t)=>{ze.init(e,t),e._zod.optin="optional",_e(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Gf=G("$ZodNonOptional",(e,t)=>{ze.init(e,t),_e(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>$s(s,e)):$s(o,e)}});function $s(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Yf=G("$ZodCatch",(e,t)=>{ze.init(e,t),_e(e._zod,"optin",()=>t.innerType._zod.optin),_e(e._zod,"optout",()=>t.innerType._zod.optout),_e(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>wt(i,r,bt()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>wt(s,r,bt()))},input:n.value}),n.issues=[]),n)}}),Xf=G("$ZodPipe",(e,t)=>{ze.init(e,t),_e(e._zod,"values",()=>t.in._zod.values),_e(e._zod,"optin",()=>t.in._zod.optin),_e(e._zod,"optout",()=>t.out._zod.optout),_e(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>Vn(i,t.in,r)):Vn(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>Vn(s,t.out,r)):Vn(o,t.out,r)}});function Vn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Qf=G("$ZodReadonly",(e,t)=>{ze.init(e,t),_e(e._zod,"propValues",()=>t.innerType._zod.propValues),_e(e._zod,"values",()=>t.innerType._zod.values),_e(e._zod,"optin",()=>t.innerType?._zod?.optin),_e(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Bs):Bs(o)}});function Bs(e){return e.value=Object.freeze(e.value),e}const eh=G("$ZodLazy",(e,t)=>{ze.init(e,t),_e(e._zod,"innerType",()=>t.getter()),_e(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),_e(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),_e(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),_e(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),th=G("$ZodCustom",(e,t)=>{He.init(e,t),ze.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>Us(s,n,r,e));Us(o,n,r,e)}});function Us(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Tn(o))}}var Zs;class nh{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function rh(){return new nh}(Zs=globalThis).__zod_globalRegistry??(Zs.__zod_globalRegistry=rh());const jn=globalThis.__zod_globalRegistry;function oh(e,t){return new e({type:"string",...de(t)})}function sh(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...de(t)})}function Ws(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...de(t)})}function ih(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...de(t)})}function ah(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...de(t)})}function lh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...de(t)})}function ch(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...de(t)})}function uh(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...de(t)})}function dh(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...de(t)})}function fh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...de(t)})}function hh(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...de(t)})}function ph(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...de(t)})}function mh(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...de(t)})}function gh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...de(t)})}function xh(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...de(t)})}function vh(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...de(t)})}function yh(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...de(t)})}function bh(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...de(t)})}function wh(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...de(t)})}function _h(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...de(t)})}function kh(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...de(t)})}function Ch(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...de(t)})}function Sh(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...de(t)})}function jh(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...de(t)})}function Eh(e,t){return new e({type:"string",format:"date",check:"string_format",...de(t)})}function Nh(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...de(t)})}function Th(e,t){return new e({type:"string",format:"duration",check:"string_format",...de(t)})}function Ah(e,t){return new e({type:"number",checks:[],...de(t)})}function zh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...de(t)})}function Oh(e,t){return new e({type:"boolean",...de(t)})}function Rh(e,t){return new e({type:"null",...de(t)})}function Ih(e){return new e({type:"unknown"})}function Ph(e,t){return new e({type:"never",...de(t)})}function Vs(e,t){return new Sa({check:"less_than",...de(t),value:e,inclusive:!1})}function Hr(e,t){return new Sa({check:"less_than",...de(t),value:e,inclusive:!0})}function Hs(e,t){return new ja({check:"greater_than",...de(t),value:e,inclusive:!1})}function qr(e,t){return new ja({check:"greater_than",...de(t),value:e,inclusive:!0})}function qs(e,t){return new Hd({check:"multiple_of",...de(t),value:e})}function Ra(e,t){return new Jd({check:"max_length",...de(t),maximum:e})}function dr(e,t){return new Kd({check:"min_length",...de(t),minimum:e})}function Ia(e,t){return new Gd({check:"length_equals",...de(t),length:e})}function Mh(e,t){return new Yd({check:"string_format",format:"regex",...de(t),pattern:e})}function Dh(e){return new Xd({check:"string_format",format:"lowercase",...de(e)})}function Lh(e){return new Qd({check:"string_format",format:"uppercase",...de(e)})}function Fh(e,t){return new ef({check:"string_format",format:"includes",...de(t),includes:e})}function $h(e,t){return new tf({check:"string_format",format:"starts_with",...de(t),prefix:e})}function Bh(e,t){return new nf({check:"string_format",format:"ends_with",...de(t),suffix:e})}function dn(e){return new rf({check:"overwrite",tx:e})}function Uh(e){return dn(t=>t.normalize(e))}function Zh(){return dn(e=>e.trim())}function Wh(){return dn(e=>e.toLowerCase())}function Vh(){return dn(e=>e.toUpperCase())}function Hh(){return dn(e=>Gu(e))}function qh(e,t,n){return new e({type:"array",element:t,...de(n)})}function Jh(e,t,n){return new e({type:"custom",check:"custom",fn:t,...de(n)})}function Kh(e){const t=Gh(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Tn(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(Tn(o))}},e(n.value,n)));return t}function Gh(e,t){const n=new He({check:"custom",...de(t)});return n._zod.check=e,n}function Pa(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??jn,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Le(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const l=e._zod.toJSONSchema?.();if(l)i.schema=l;else{const d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,d);else{const m=i.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,m,d)}const h=e._zod.parent;h&&(i.ref||(i.ref=h),Le(h,t,d),t.seen.get(h).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&Ze(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Ma(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const i of e.seen.entries()){const l=e.metadataRegistry.get(i[0])?.id;if(l){const c=r.get(l);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${l}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(l,i[0])}}const o=i=>{const l=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const h=e.external.registry.get(i[0])?.id,m=e.external.uri??(g=>g);if(h)return{ref:m(h)};const p=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=p,{defId:p,ref:`${m("__shared")}#/${l}/${p}`}}if(i[1]===n)return{ref:"#"};const u=`#/${l}/`,d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},s=i=>{if(i[1].schema.$ref)return;const l=i[1],{ref:c,defId:u}=o(i);l.def={...l.schema},u&&(l.defId=u);const d=l.schema;for(const h in d)delete d[h];d.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const l=i[1];if(l.cycle)throw new Error(`Cycle detected: #/${l.cycle?.join("/")}/<root>
39
+
40
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const l=i[1];if(t===i[0]){s(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(l.cycle){s(i);continue}if(l.count>1&&e.reused==="ref"){s(i);continue}}}function Da(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=i=>{const l=e.seen.get(i);if(l.ref===null)return;const c=l.def??l.schema,u={...c},d=l.ref;if(l.ref=null,d){r(d);const m=e.seen.get(d),p=m.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):Object.assign(c,p),Object.assign(c,u),i._zod.parent===d)for(const f in c)f==="$ref"||f==="allOf"||f in u||delete c[f];if(p.$ref&&m.def)for(const f in c)f==="$ref"||f==="allOf"||f in m.def&&JSON.stringify(c[f])===JSON.stringify(m.def[f])&&delete c[f]}const h=i._zod.parent;if(h&&h!==d){r(h);const m=e.seen.get(h);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(const p in c)p==="$ref"||p==="allOf"||p in m.def&&JSON.stringify(c[p])===JSON.stringify(m.def[p])&&delete c[p]}e.override({zodSchema:i,jsonSchema:c,path:l.path??[]})};for(const i of[...e.seen.entries()].reverse())r(i[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(i)}Object.assign(o,n.def??n.schema);const s=e.external?.defs??{};for(const i of e.seen.entries()){const l=i[1];l.def&&l.defId&&(s[l.defId]=l.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const i=JSON.parse(JSON.stringify(o));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:fr(t,"input",e.processors),output:fr(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function Ze(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ze(r.element,n);if(r.type==="set")return Ze(r.valueType,n);if(r.type==="lazy")return Ze(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Ze(r.innerType,n);if(r.type==="intersection")return Ze(r.left,n)||Ze(r.right,n);if(r.type==="record"||r.type==="map")return Ze(r.keyType,n)||Ze(r.valueType,n);if(r.type==="pipe")return Ze(r.in,n)||Ze(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Ze(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Ze(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Ze(o,n))return!0;return!!(r.rest&&Ze(r.rest,n))}return!1}const Yh=(e,t={})=>n=>{const r=Pa({...n,processors:t});return Le(e,r),Ma(r,e),Da(r,e)},fr=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=Pa({...o??{},target:s,io:t,processors:n});return Le(e,i),Ma(i,e),Da(i,e)},Xh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Qh=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:l,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),l&&(o.format=Xh[l]??l,o.format===""&&delete o.format,l==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){const d=[...c];d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},ep=(e,t,n,r)=>{const o=n,{minimum:s,maximum:i,format:l,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof l=="string"&&l.includes("int")?o.type="integer":o.type="number",typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d),typeof s=="number"&&(o.minimum=s,typeof d=="number"&&t.target!=="draft-04"&&(d>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof i=="number"&&(o.maximum=i,typeof u=="number"&&t.target!=="draft-04"&&(u<=i?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},tp=(e,t,n,r)=>{n.type="boolean"},np=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},rp=(e,t,n,r)=>{n.not={}},op=(e,t,n,r)=>{},sp=(e,t,n,r)=>{const o=e._zod.def,s=pa(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},ip=(e,t,n,r)=>{const o=e._zod.def,s=[];for(const i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s},ap=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},lp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},cp=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:l}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof l=="number"&&(o.maxItems=l),o.type="array",o.items=Le(s.element,t,{...r,path:[...r.path,"items"]})},up=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object",o.properties={};const i=s.shape;for(const u in i)o.properties[u]=Le(i[u],t,{...r,path:[...r.path,"properties",u]});const l=new Set(Object.keys(i)),c=new Set([...l].filter(u=>{const d=s.shape[u]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=Le(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},dp=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((l,c)=>Le(l,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},fp=(e,t,n,r)=>{const o=e._zod.def,s=Le(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=Le(o.right,t,{...r,path:[...r.path,"allOf",1]}),l=u=>"allOf"in u&&Object.keys(u).length===1,c=[...l(s)?s.allOf:[s],...l(i)?i.allOf:[i]];n.allOf=c},hp=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){const d=Le(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const h of c)o.patternProperties[h.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Le(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Le(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=i._zod.values;if(u){const d=[...u].filter(h=>typeof h=="string"||typeof h=="number");d.length>0&&(o.required=d)}},pp=(e,t,n,r)=>{const o=e._zod.def,s=Le(o.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},mp=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},gp=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},xp=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},vp=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},yp=(e,t,n,r)=>{const o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Le(s,t,r);const i=t.seen.get(e);i.ref=s},bp=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},La=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},wp=(e,t,n,r)=>{const o=e._zod.innerType;Le(o,t,r);const s=t.seen.get(e);s.ref=o},_p=G("ZodISODateTime",(e,t)=>{vf.init(e,t),Pe.init(e,t)});function kp(e){return jh(_p,e)}const Cp=G("ZodISODate",(e,t)=>{yf.init(e,t),Pe.init(e,t)});function Sp(e){return Eh(Cp,e)}const jp=G("ZodISOTime",(e,t)=>{bf.init(e,t),Pe.init(e,t)});function Ep(e){return Nh(jp,e)}const Np=G("ZodISODuration",(e,t)=>{wf.init(e,t),Pe.init(e,t)});function Tp(e){return Th(Np,e)}const Ap=(e,t)=>{va.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>cd(e,n)},flatten:{value:n=>ld(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,mo,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,mo,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ye=G("ZodError",Ap,{Parent:Error}),zp=qo(Ye),Op=Jo(Ye),Rp=jr(Ye),Ip=Er(Ye),Pp=fd(Ye),Mp=hd(Ye),Dp=pd(Ye),Lp=md(Ye),Fp=gd(Ye),$p=xd(Ye),Bp=vd(Ye),Up=yd(Ye),Oe=G("ZodType",(e,t)=>(ze.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:fr(e,"input"),output:fr(e,"output")}}),e.toJSONSchema=Yh(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(St(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>jt(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>zp(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Rp(e,n,r),e.parseAsync=async(n,r)=>Op(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Ip(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Pp(e,n,r),e.decode=(n,r)=>Mp(e,n,r),e.encodeAsync=async(n,r)=>Dp(e,n,r),e.decodeAsync=async(n,r)=>Lp(e,n,r),e.safeEncode=(n,r)=>Fp(e,n,r),e.safeDecode=(n,r)=>$p(e,n,r),e.safeEncodeAsync=async(n,r)=>Bp(e,n,r),e.safeDecodeAsync=async(n,r)=>Up(e,n,r),e.refine=(n,r)=>e.check(Lm(n,r)),e.superRefine=n=>e.check(Fm(n)),e.overwrite=n=>e.check(dn(n)),e.optional=()=>Ys(e),e.exactOptional=()=>km(e),e.nullable=()=>Xs(e),e.nullish=()=>Ys(Xs(e)),e.nonoptional=n=>Tm(e,n),e.array=()=>Se(e),e.or=n=>xt([e,n]),e.and=n=>xm(e,n),e.transform=n=>Qs(e,wm(n)),e.default=n=>jm(e,n),e.prefault=n=>Nm(e,n),e.catch=n=>zm(e,n),e.pipe=n=>Qs(e,n),e.readonly=()=>Im(e),e.describe=n=>{const r=e.clone();return jn.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return jn.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return jn.get(e);const r=e.clone();return jn.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Fa=G("_ZodString",(e,t)=>{Ko.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Qh(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(Mh(...r)),e.includes=(...r)=>e.check(Fh(...r)),e.startsWith=(...r)=>e.check($h(...r)),e.endsWith=(...r)=>e.check(Bh(...r)),e.min=(...r)=>e.check(dr(...r)),e.max=(...r)=>e.check(Ra(...r)),e.length=(...r)=>e.check(Ia(...r)),e.nonempty=(...r)=>e.check(dr(1,...r)),e.lowercase=r=>e.check(Dh(r)),e.uppercase=r=>e.check(Lh(r)),e.trim=()=>e.check(Zh()),e.normalize=(...r)=>e.check(Uh(...r)),e.toLowerCase=()=>e.check(Wh()),e.toUpperCase=()=>e.check(Vh()),e.slugify=()=>e.check(Hh())}),Zp=G("ZodString",(e,t)=>{Ko.init(e,t),Fa.init(e,t),e.email=n=>e.check(sh(Wp,n)),e.url=n=>e.check(uh(Vp,n)),e.jwt=n=>e.check(Sh(im,n)),e.emoji=n=>e.check(dh(Hp,n)),e.guid=n=>e.check(Ws(Js,n)),e.uuid=n=>e.check(ih(Hn,n)),e.uuidv4=n=>e.check(ah(Hn,n)),e.uuidv6=n=>e.check(lh(Hn,n)),e.uuidv7=n=>e.check(ch(Hn,n)),e.nanoid=n=>e.check(fh(qp,n)),e.guid=n=>e.check(Ws(Js,n)),e.cuid=n=>e.check(hh(Jp,n)),e.cuid2=n=>e.check(ph(Kp,n)),e.ulid=n=>e.check(mh(Gp,n)),e.base64=n=>e.check(_h(rm,n)),e.base64url=n=>e.check(kh(om,n)),e.xid=n=>e.check(gh(Yp,n)),e.ksuid=n=>e.check(xh(Xp,n)),e.ipv4=n=>e.check(vh(Qp,n)),e.ipv6=n=>e.check(yh(em,n)),e.cidrv4=n=>e.check(bh(tm,n)),e.cidrv6=n=>e.check(wh(nm,n)),e.e164=n=>e.check(Ch(sm,n)),e.datetime=n=>e.check(kp(n)),e.date=n=>e.check(Sp(n)),e.time=n=>e.check(Ep(n)),e.duration=n=>e.check(Tp(n))});function W(e){return oh(Zp,e)}const Pe=G("ZodStringFormat",(e,t)=>{Ie.init(e,t),Fa.init(e,t)}),Wp=G("ZodEmail",(e,t)=>{cf.init(e,t),Pe.init(e,t)}),Js=G("ZodGUID",(e,t)=>{af.init(e,t),Pe.init(e,t)}),Hn=G("ZodUUID",(e,t)=>{lf.init(e,t),Pe.init(e,t)}),Vp=G("ZodURL",(e,t)=>{uf.init(e,t),Pe.init(e,t)}),Hp=G("ZodEmoji",(e,t)=>{df.init(e,t),Pe.init(e,t)}),qp=G("ZodNanoID",(e,t)=>{ff.init(e,t),Pe.init(e,t)}),Jp=G("ZodCUID",(e,t)=>{hf.init(e,t),Pe.init(e,t)}),Kp=G("ZodCUID2",(e,t)=>{pf.init(e,t),Pe.init(e,t)}),Gp=G("ZodULID",(e,t)=>{mf.init(e,t),Pe.init(e,t)}),Yp=G("ZodXID",(e,t)=>{gf.init(e,t),Pe.init(e,t)}),Xp=G("ZodKSUID",(e,t)=>{xf.init(e,t),Pe.init(e,t)}),Qp=G("ZodIPv4",(e,t)=>{_f.init(e,t),Pe.init(e,t)}),em=G("ZodIPv6",(e,t)=>{kf.init(e,t),Pe.init(e,t)}),tm=G("ZodCIDRv4",(e,t)=>{Cf.init(e,t),Pe.init(e,t)}),nm=G("ZodCIDRv6",(e,t)=>{Sf.init(e,t),Pe.init(e,t)}),rm=G("ZodBase64",(e,t)=>{jf.init(e,t),Pe.init(e,t)}),om=G("ZodBase64URL",(e,t)=>{Nf.init(e,t),Pe.init(e,t)}),sm=G("ZodE164",(e,t)=>{Tf.init(e,t),Pe.init(e,t)}),im=G("ZodJWT",(e,t)=>{zf.init(e,t),Pe.init(e,t)}),$a=G("ZodNumber",(e,t)=>{Na.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>ep(e,r,o),e.gt=(r,o)=>e.check(Hs(r,o)),e.gte=(r,o)=>e.check(qr(r,o)),e.min=(r,o)=>e.check(qr(r,o)),e.lt=(r,o)=>e.check(Vs(r,o)),e.lte=(r,o)=>e.check(Hr(r,o)),e.max=(r,o)=>e.check(Hr(r,o)),e.int=r=>e.check(Ks(r)),e.safe=r=>e.check(Ks(r)),e.positive=r=>e.check(Hs(0,r)),e.nonnegative=r=>e.check(qr(0,r)),e.negative=r=>e.check(Vs(0,r)),e.nonpositive=r=>e.check(Hr(0,r)),e.multipleOf=(r,o)=>e.check(qs(r,o)),e.step=(r,o)=>e.check(qs(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function me(e){return Ah($a,e)}const am=G("ZodNumberFormat",(e,t)=>{Of.init(e,t),$a.init(e,t)});function Ks(e){return zh(am,e)}const lm=G("ZodBoolean",(e,t)=>{Rf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tp(e,n,r)});function Be(e){return Oh(lm,e)}const cm=G("ZodNull",(e,t)=>{If.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>np(e,n,r)});function xo(e){return Rh(cm,e)}const um=G("ZodUnknown",(e,t)=>{Pf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>op()});function Gs(){return Ih(um)}const dm=G("ZodNever",(e,t)=>{Mf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rp(e,n,r)});function fm(e){return Ph(dm,e)}const hm=G("ZodArray",(e,t)=>{Df.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cp(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(dr(n,r)),e.nonempty=n=>e.check(dr(1,n)),e.max=(n,r)=>e.check(Ra(n,r)),e.length=(n,r)=>e.check(Ia(n,r)),e.unwrap=()=>e.element});function Se(e,t){return qh(hm,e,t)}const pm=G("ZodObject",(e,t)=>{Ff.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>up(e,n,r,o),_e(e,"shape",()=>t.shape),e.keyof=()=>Ve(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Gs()}),e.loose=()=>e.clone({...e._zod.def,catchall:Gs()}),e.strict=()=>e.clone({...e._zod.def,catchall:fm()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>rd(e,n),e.safeExtend=n=>od(e,n),e.merge=n=>sd(e,n),e.pick=n=>td(e,n),e.omit=n=>nd(e,n),e.partial=(...n)=>id(Ua,e,n[0]),e.required=(...n)=>ad(Za,e,n[0])});function re(e,t){const n={type:"object",shape:e??{},...de(t)};return new pm(n)}const Ba=G("ZodUnion",(e,t)=>{za.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dp(e,n,r,o),e.options=t.options});function xt(e,t){return new Ba({type:"union",options:e,...de(t)})}const mm=G("ZodDiscriminatedUnion",(e,t)=>{Ba.init(e,t),$f.init(e,t)});function Lt(e,t,n){return new mm({type:"union",options:t,discriminator:e,...de(n)})}const gm=G("ZodIntersection",(e,t)=>{Bf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fp(e,n,r,o)});function xm(e,t){return new gm({type:"intersection",left:e,right:t})}const vm=G("ZodRecord",(e,t)=>{Uf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hp(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function pt(e,t,n){return new vm({type:"record",keyType:e,valueType:t,...de(n)})}const vo=G("ZodEnum",(e,t)=>{Zf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>sp(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new vo({...t,checks:[],...de(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new vo({...t,checks:[],...de(o),entries:s})}});function Ve(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new vo({type:"enum",entries:n,...de(t)})}const ym=G("ZodLiteral",(e,t)=>{Wf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ip(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ve(e,t){return new ym({type:"literal",values:Array.isArray(e)?e:[e],...de(t)})}const bm=G("ZodTransform",(e,t)=>{Vf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lp(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new fa(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Tn(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(Tn(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function wm(e){return new bm({type:"transform",transform:e})}const Ua=G("ZodOptional",(e,t)=>{Oa.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>La(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ys(e){return new Ua({type:"optional",innerType:e})}const _m=G("ZodExactOptional",(e,t)=>{Hf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>La(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function km(e){return new _m({type:"optional",innerType:e})}const Cm=G("ZodNullable",(e,t)=>{qf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Xs(e){return new Cm({type:"nullable",innerType:e})}const Sm=G("ZodDefault",(e,t)=>{Jf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function jm(e,t){return new Sm({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ga(t)}})}const Em=G("ZodPrefault",(e,t)=>{Kf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Nm(e,t){return new Em({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ga(t)}})}const Za=G("ZodNonOptional",(e,t)=>{Gf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Tm(e,t){return new Za({type:"nonoptional",innerType:e,...de(t)})}const Am=G("ZodCatch",(e,t)=>{Yf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function zm(e,t){return new Am({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Om=G("ZodPipe",(e,t)=>{Xf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yp(e,n,r,o),e.in=t.in,e.out=t.out});function Qs(e,t){return new Om({type:"pipe",in:e,out:t})}const Rm=G("ZodReadonly",(e,t)=>{Qf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Im(e){return new Rm({type:"readonly",innerType:e})}const Pm=G("ZodLazy",(e,t)=>{eh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wp(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function Mm(e){return new Pm({type:"lazy",getter:e})}const Dm=G("ZodCustom",(e,t)=>{th.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ap(e,n)});function Lm(e,t={}){return Jh(Dm,e,t)}function Fm(e){return Kh(e)}const on=Mm(()=>xt([W(),me(),Be(),xo(),Se(on),pt(W(),on)]));function Wa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ei(e,t){return e===null||typeof e!="object"||Array.isArray(e)?void 0:Object.getOwnPropertyDescriptor(e,t)?.value}const Go=re({type:W(),ttl:W().optional(),scope:W().optional()}),Yo=re({type:ve("text"),text:W(),cache_control:Go.optional()}),Va=re({type:ve("thinking"),thinking:W(),signature:W().optional()}),$m=re({type:ve("think"),thinking:W(),signature:W().optional()}),Bm=re({type:ve("base64"),media_type:W(),data:W()}),Ha=re({type:ve("image"),source:Bm}),qa=re({type:ve("tool_use"),id:W(),name:W(),input:pt(W(),on)}),Um=Lt("type",[Yo,Ha]),Zm=re({type:ve("tool_result"),tool_use_id:W().optional(),content:xt([W(),Se(Um)]),is_error:Be().optional()}),Wm=Lt("type",[Yo,Va,Ha,qa,Zm]),Vm=xt([W(),Se(Wm)]),Hm=re({role:Ve(["user","assistant"]),content:Vm}),qm=re({type:ve("text"),text:W(),cache_control:Go.optional()}),Jm=re({type:W(),properties:pt(W(),pt(W(),on)).optional(),required:Se(W()).optional(),additionalProperties:Be().optional(),$schema:W().optional()}),Km=re({name:W(),description:W().optional(),input_schema:Jm.optional(),cache_control:Go.optional()}),Gm=Lt("type",[re({type:ve("enabled"),budget_tokens:me()}),re({type:ve("disabled")}),re({type:ve("adaptive")})]),Ja=re({model:W(),messages:Se(Hm),system:Se(qm).optional(),tools:Se(Km).optional(),max_tokens:me().optional(),temperature:me().optional(),stream:Be().optional(),thinking:Gm.optional(),metadata:re({user_id:W().optional()}).optional()}),Xo=Lt("type",[Yo,Va,$m,qa]),Ym=re({input_tokens:me().nullable().optional(),output_tokens:me().nullable().optional(),cache_creation_input_tokens:me().nullable().optional(),cache_read_input_tokens:me().nullable().optional()}).passthrough(),Ka=re({id:W(),type:ve("message"),model:W(),role:ve("assistant"),content:Se(Xo),stop_reason:W().nullable(),stop_sequence:W().nullable().optional(),usage:Ym}).passthrough(),Xm=re({type:ve("message_start"),message:re({id:W(),type:ve("message"),model:W(),role:ve("assistant"),content:Se(Xo),stop_reason:xo(),stop_sequence:xo(),usage:re({input_tokens:me(),cache_creation_input_tokens:me().optional(),cache_read_input_tokens:me().optional()}).passthrough()})}),Qm=re({type:ve("content_block_start"),index:me(),content_block:Xo}),eg=Lt("type",[re({type:ve("text_delta"),text:W()}),re({type:ve("input_json_delta"),partial_json:W()}),re({type:ve("thinking_delta"),thinking:W()}),re({type:ve("signature_delta"),signature:W()})]),tg=re({type:ve("content_block_delta"),index:me(),delta:eg}),ng=re({type:ve("content_block_stop"),index:me()}),rg=re({type:ve("message_delta"),delta:re({stop_reason:W().nullable(),stop_sequence:W().nullable().optional()}),usage:re({output_tokens:me(),input_tokens:me().optional(),cache_creation_input_tokens:me().optional(),cache_read_input_tokens:me().optional()}).passthrough()}),og=re({type:ve("message_stop")}),sg=re({type:ve("ping")}),ig=re({type:ve("error"),error:re({type:W(),message:W()})}),ag=Lt("type",[Xm,Qm,tg,ng,rg,og,sg,ig]),lg=xt([W(),Se(Lt("type",[re({type:ve("text"),text:W()}),re({type:ve("image_url"),image_url:re({url:W(),detail:W().optional()})})]))]),Ga=re({role:Ve(["system","user","assistant","tool"]),content:lg,name:W().optional(),reasoning_content:W().optional(),thinking:W().optional(),think:W().optional()}),cg=re({name:W(),arguments:W()}),Ya=re({index:me().optional(),id:W().optional(),type:ve("function").optional(),function:re({name:W().optional(),arguments:W().optional()})});Ga.extend({content:xt([W(),Se(re({type:ve("text"),text:W()}))]).optional(),function_call:cg.optional(),tool_calls:Se(Ya).optional()});const ug=re({type:ve("function"),function:re({name:W(),description:W().optional(),parameters:pt(W(),on)})}),Xa=re({model:W(),messages:Se(Ga),temperature:me().optional(),max_tokens:me().optional(),stream:Be().optional(),tools:Se(ug).optional(),tool_choice:xt([Ve(["auto","none","required"]),re({type:ve("auto")}),re({type:ve("none")}),re({type:ve("function"),function:re({name:W()})})]).optional(),user:W().optional()}),Qa=re({role:Ve(["assistant"]).optional(),content:W().nullable().optional(),reasoning_content:W().nullable().optional(),thinking:W().nullable().optional(),think:W().nullable().optional(),function_call:re({name:W().optional(),arguments:W().optional()}).nullable().optional(),tool_calls:Se(re({index:me(),id:W().optional(),type:ve("function").optional(),function:re({name:W().optional(),arguments:W().optional()})})).nullable().optional()}),dg=re({index:me(),message:re({role:Ve(["assistant"]),content:W().nullable(),reasoning_content:W().optional(),thinking:W().optional(),think:W().optional(),function_call:re({name:W(),arguments:W()}).nullable().optional(),tool_calls:Se(Ya).optional()}).optional(),delta:Qa.optional(),finish_reason:W().nullable()}),fg=re({id:W(),object:ve("chat.completion"),created:me(),model:W(),choices:Se(dg),usage:re({prompt_tokens:me().nullable().optional(),completion_tokens:me().nullable().optional(),total_tokens:me().nullable().optional()}).passthrough(),service_tier:W().nullable().optional(),system_fingerprint:W().nullable().optional()}).passthrough(),hg=re({id:W(),object:ve("chat.completion.chunk"),created:me(),model:W(),choices:Se(re({index:me(),delta:Qa,finish_reason:W().nullable().optional()})),usage:re({prompt_tokens:me().nullable().optional(),completion_tokens:me().nullable().optional(),total_tokens:me().nullable().optional()}).passthrough().nullable().optional()}).passthrough();function el(e){try{const t=JSON.parse(e),n=fg.safeParse(t);return n.success?n.data:null}catch{return null}}const tl=re({index:me(),timestamp:me(),type:W(),data:on}),pg=re({chunks:Se(tl),truncated:Be().optional().default(!1)}),ti=re({id:me(),timestamp:W(),method:W(),path:W(),model:W().nullable(),sessionId:W().nullable(),rawRequestBody:W().nullable(),responseStatus:me().nullable(),responseText:W().nullable(),inputTokens:me().nullable(),outputTokens:me().nullable(),cacheCreationInputTokens:me().nullable(),cacheReadInputTokens:me().nullable(),elapsedMs:me().nullable(),streaming:Be(),userAgent:W().nullable(),origin:W().nullable(),rawHeaders:pt(W(),W()).optional(),headers:pt(W(),W()).optional(),apiFormat:Ve(["anthropic","openai","unknown"]).default("unknown"),isTest:Be().optional().default(!1),providerName:W().nullable().optional(),clientPort:me().nullable().optional(),clientPid:me().nullable().optional(),clientCwd:W().nullable().optional(),clientProjectFolder:W().nullable().optional(),streamingChunks:pg.optional(),streamingChunksPath:W().nullable().optional(),error:W().nullable().optional()});re({model:W()});re({model:W().optional(),metadata:re({user_id:W().optional()}).passthrough().optional()});const mg=re({error:W()});async function Kt(e,t){const n=await e.json();return t.parse(n)}async function or(e,t){try{const n=await e.json(),r=mg.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function Pn(e,t,n,r){const o=await fetch(e,n);if(!o.ok){const s=r?.(o)??`Request failed with status ${o.status}`;throw new Error(await or(o,s))}return Kt(o,t)}const hr=10,yo=600,Tr=re({stripClaudeCodeBillingHeader:Be(),hasSeenOnboarding:Be().default(!1),slowResponseThresholdSeconds:me().int().min(0).max(yo).default(hr)}),sr="/api/config";async function gg(e){return Pn(e,Tr,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function ni(e){return Pn(sr,Tr,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function nl(){const e=Zo(sr,gg,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=ua(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=e.data?.slowResponseThresholdSeconds??hr,o=l=>({stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:e.data?.hasSeenOnboarding??!1,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??hr,...l}),s=async l=>{await t(sr,ni({stripClaudeCodeBillingHeader:l}),{optimisticData:o({stripClaudeCodeBillingHeader:l}),rollbackOnError:!0,revalidate:!1})},i=async l=>{await t(sr,ni({slowResponseThresholdSeconds:l}),{optimisticData:o({slowResponseThresholdSeconds:l}),rollbackOnError:!0,revalidate:!1})};return{strip:n,slowResponseThresholdSeconds:r,isLoading:e.isLoading,isError:e.error!==void 0,setStrip:s,setSlowResponseThresholdSeconds:i}}const rl=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const xg=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const vg=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const ri=e=>{const t=vg(e);return t.charAt(0).toUpperCase()+t.slice(1)};var yg={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const bg=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const wg=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...l},c)=>v.createElement("svg",{ref:c,...yg,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:rl("lucide",o),...!s&&!bg(l)&&{"aria-hidden":"true"},...l},[...i.map(([u,d])=>v.createElement(u,d)),...Array.isArray(s)?s:[s]]));const ge=(e,t)=>{const n=v.forwardRef(({className:r,...o},s)=>v.createElement(wg,{ref:s,iconNode:t,className:rl(`lucide-${xg(ri(e))}`,`lucide-${e}`,r),...o}));return n.displayName=ri(e),n};const _g=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],kg=ge("arrow-down",_g);const Cg=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Sg=ge("arrow-left",Cg);const jg=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Eg=ge("arrow-up",jg);const Ng=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ft=ge("check",Ng);const Tg=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Mn=ge("chevron-down",Tg);const Ag=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Qo=ge("chevron-right",Ag);const zg=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Og=ge("chevron-up",zg);const Rg=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],Ig=ge("chevrons-down",Rg);const Pg=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],Mg=ge("chevrons-up",Pg);const Dg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],An=ge("circle-alert",Dg);const Lg=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Fg=ge("circle-check-big",Lg);const $g=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Bg=ge("circle-question-mark",$g);const Ug=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],sn=ge("clock",Ug);const Zg=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Wg=ge("columns-2",Zg);const Vg=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Dn=ge("copy",Vg);const Hg=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],es=ge("download",Hg);const qg=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ol=ge("external-link",qg);const Jg=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],ts=ge("eye-off",Jg);const Kg=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ns=ge("eye",Kg);const Gg=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]],Yg=ge("file-diff",Gg);const Xg=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m8 16 2-2-2-2",key:"10vzyd"}],["path",{d:"M12 18h4",key:"1wd2n7"}]],Qg=ge("file-terminal",Xg);const e0=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],t0=ge("gauge",e0);const n0=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]],r0=ge("git-compare-arrows",n0);const o0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],s0=ge("globe",o0);const i0=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],a0=ge("history",i0);const l0=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],pr=ge("loader-circle",l0);const c0=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],u0=ge("lock",c0);const d0=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],sl=ge("message-square",d0);const f0=[["path",{d:"M5 12h14",key:"1ays0h"}]],h0=ge("minus",f0);const p0=[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],m0=ge("octagon-alert",p0);const g0=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],x0=ge("pencil",g0);const v0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],bo=ge("plus",v0);const y0=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],b0=ge("radio",y0);const w0=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],_0=ge("rotate-ccw",w0);const k0=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],il=ge("rotate-cw",k0);const C0=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],S0=ge("rows-3",C0);const j0=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]],E0=ge("scan",j0);const N0=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],T0=ge("server",N0);const A0=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],z0=ge("settings",A0);const O0=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],al=ge("trash-2",O0);const R0=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],wo=ge("triangle-alert",R0);const I0=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],P0=ge("upload",I0);const M0=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],D0=ge("user",M0);const L0=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],F0=ge("wifi-off",L0);const $0=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],B0=ge("wifi",$0);const U0=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],oi=ge("wrench",U0);const Z0=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ll=ge("x",Z0);const W0=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],rs=ge("zap",W0),_o="/api/config";async function V0(e){return Pn(e,Tr,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function H0(e){return Pn(_o,Tr,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function q0(){const e=Zo(_o,V0,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=ua(),n=e.data?.hasSeenOnboarding??!1,r=async()=>{await t(_o,H0({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??hr},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,isLoading:e.isLoading,markSeen:r}}function J0(){const{hasSeenOnboarding:e,isLoading:t,markSeen:n}=q0();return t||e?null:a.jsxs("div",{role:"note","aria-label":"Onboarding tip",className:"mx-4 mt-2 mb-1 flex items-start gap-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3 text-sm",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-amber-600 dark:text-amber-400 mb-1",children:"Quick tour of the log tabs"}),a.jsxs("ul",{className:"space-y-0.5 text-muted-foreground text-xs leading-relaxed",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Request"})," / ",a.jsx("strong",{children:"Response"})," — structured views of what the proxy sent and received."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Headers"})," — request and response headers after proxy processing."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Raw Headers"})," / ",a.jsx("strong",{children:"Raw Request"})," /"," ",a.jsx("strong",{children:"Raw Response"})," — exact bytes from the upstream provider (visible in Full mode)."]})]})]}),a.jsxs("button",{type:"button",onClick:()=>{n()},className:"inline-flex items-center gap-1.5 text-xs h-8 px-3 rounded-md border border-amber-500/40 text-amber-700 dark:text-amber-300 hover:bg-amber-500/10 transition-colors shrink-0","aria-label":"Dismiss onboarding tip",children:[a.jsx(Ft,{className:"size-3.5"}),"Got it"]}),a.jsx("button",{type:"button",onClick:()=>{n()},className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 p-1 -m-1","aria-label":"Dismiss",children:a.jsx(ll,{className:"size-3.5"})})]})}function qn(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Jr={exports:{}};var si;function K0(){return si||(si=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(r,o,s){function i(u,d){if(!o[u]){if(!r[u]){var h=typeof qn=="function"&&qn;if(!d&&h)return h(u,!0);if(l)return l(u,!0);var m=new Error("Cannot find module '"+u+"'");throw m.code="MODULE_NOT_FOUND",m}var p=o[u]={exports:{}};r[u][0].call(p.exports,function(g){var f=r[u][1][g];return i(f||g)},p,p.exports,n,r,o,s)}return o[u].exports}for(var l=typeof qn=="function"&&qn,c=0;c<s.length;c++)i(s[c]);return i})({1:[function(n,r,o){var s=n("./utils"),i=n("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(c){for(var u,d,h,m,p,g,f,x=[],y=0,_=c.length,k=_,C=s.getTypeOf(c)!=="string";y<c.length;)k=_-y,h=C?(u=c[y++],d=y<_?c[y++]:0,y<_?c[y++]:0):(u=c.charCodeAt(y++),d=y<_?c.charCodeAt(y++):0,y<_?c.charCodeAt(y++):0),m=u>>2,p=(3&u)<<4|d>>4,g=1<k?(15&d)<<2|h>>6:64,f=2<k?63&h:64,x.push(l.charAt(m)+l.charAt(p)+l.charAt(g)+l.charAt(f));return x.join("")},o.decode=function(c){var u,d,h,m,p,g,f=0,x=0,y="data:";if(c.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");var _,k=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&k--,c.charAt(c.length-2)===l.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(_=i.uint8array?new Uint8Array(0|k):new Array(0|k);f<c.length;)u=l.indexOf(c.charAt(f++))<<2|(m=l.indexOf(c.charAt(f++)))>>4,d=(15&m)<<4|(p=l.indexOf(c.charAt(f++)))>>2,h=(3&p)<<6|(g=l.indexOf(c.charAt(f++))),_[x++]=u,p!==64&&(_[x++]=d),g!==64&&(_[x++]=h);return _}},{"./support":30,"./utils":32}],2:[function(n,r,o){var s=n("./external"),i=n("./stream/DataWorker"),l=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,h,m,p,g){this.compressedSize=d,this.uncompressedSize=h,this.crc32=m,this.compression=p,this.compressedContent=g}u.prototype={getContentWorker:function(){var d=new i(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),h=this;return d.on("end",function(){if(this.streamInfo.data_length!==h.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new i(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,h,m){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(h.compressWorker(m)).pipe(new c("compressedSize")).withStreamInfo("compression",h)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){var s=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){var s=n("./utils"),i=(function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c})();r.exports=function(l,c){return l!==void 0&&l.length?s.getTypeOf(l)!=="string"?(function(u,d,h,m){var p=i,g=m+h;u^=-1;for(var f=m;f<g;f++)u=u>>>8^p[255&(u^d[f])];return-1^u})(0|c,l,l.length,0):(function(u,d,h,m){var p=i,g=m+h;u^=-1;for(var f=m;f<g;f++)u=u>>>8^p[255&(u^d.charCodeAt(f))];return-1^u})(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(n,r,o){o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=n("pako"),l=n("./utils"),c=n("./stream/GenericWorker"),u=s?"uint8array":"array";function d(h,m){c.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=m,this.meta={}}o.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,h.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var h=this;this._pako.onData=function(m){h.push({data:m,meta:h.meta})}},o.compressWorker=function(h){return new d("Deflate",h)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function s(p,g){var f,x="";for(f=0;f<g;f++)x+=String.fromCharCode(255&p),p>>>=8;return x}function i(p,g,f,x,y,_){var k,C,j=p.file,z=p.compression,E=_!==u.utf8encode,A=l.transformTo("string",_(j.name)),O=l.transformTo("string",u.utf8encode(j.name)),P=j.comment,Z=l.transformTo("string",_(P)),S=l.transformTo("string",u.utf8encode(P)),R=O.length!==j.name.length,w=S.length!==P.length,I="",V="",$="",F=j.dir,J=j.date,se={crc32:0,compressedSize:0,uncompressedSize:0};g&&!f||(se.crc32=p.crc32,se.compressedSize=p.compressedSize,se.uncompressedSize=p.uncompressedSize);var U=0;g&&(U|=8),E||!R&&!w||(U|=2048);var B=0,te=0;F&&(B|=16),y==="UNIX"?(te=798,B|=(function(K,ue){var X=K;return K||(X=ue?16893:33204),(65535&X)<<16})(j.unixPermissions,F)):(te=20,B|=(function(K){return 63&(K||0)})(j.dosPermissions)),k=J.getUTCHours(),k<<=6,k|=J.getUTCMinutes(),k<<=5,k|=J.getUTCSeconds()/2,C=J.getUTCFullYear()-1980,C<<=4,C|=J.getUTCMonth()+1,C<<=5,C|=J.getUTCDate(),R&&(V=s(1,1)+s(d(A),4)+O,I+="up"+s(V.length,2)+V),w&&($=s(1,1)+s(d(Z),4)+S,I+="uc"+s($.length,2)+$);var ee="";return ee+=`
41
+ \0`,ee+=s(U,2),ee+=z.magic,ee+=s(k,2),ee+=s(C,2),ee+=s(se.crc32,4),ee+=s(se.compressedSize,4),ee+=s(se.uncompressedSize,4),ee+=s(A.length,2),ee+=s(I.length,2),{fileRecord:h.LOCAL_FILE_HEADER+ee+A+I,dirRecord:h.CENTRAL_FILE_HEADER+s(te,2)+ee+s(Z.length,2)+"\0\0\0\0"+s(B,4)+s(x,4)+A+I+Z}}var l=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),h=n("../signature");function m(p,g,f,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=f,this.encodeFileName=x,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(m,c),m.prototype.push=function(p){var g=p.meta.percent||0,f=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:f?(g+100*(f-x-1))/f:100}}))},m.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var g=this.streamFiles&&!p.file.dir;if(g){var f=i(p,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:f.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(p){this.accumulate=!1;var g=this.streamFiles&&!p.file.dir,f=i(p,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(f.dirRecord),g)this.push({data:(function(x){return h.DATA_DESCRIPTOR+s(x.crc32,4)+s(x.compressedSize,4)+s(x.uncompressedSize,4)})(p),meta:{percent:100}});else for(this.push({data:f.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var p=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var f=this.bytesWritten-p,x=(function(y,_,k,C,j){var z=l.transformTo("string",j(C));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(y,2)+s(y,2)+s(_,4)+s(k,4)+s(z.length,2)+z})(this.dirRecords.length,f,p,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},m.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},m.prototype.registerPrevious=function(p){this._sources.push(p);var g=this;return p.on("data",function(f){g.processChunk(f)}),p.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),p.on("error",function(f){g.error(f)}),this},m.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},m.prototype.error=function(p){var g=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var f=0;f<g.length;f++)try{g[f].error(p)}catch{}return!0},m.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,g=0;g<p.length;g++)p[g].lock()},r.exports=m},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){var s=n("../compressions"),i=n("./ZipFileWorker");o.generateWorker=function(l,c,u){var d=new i(c.streamFiles,u,c.platform,c.encodeFileName),h=0;try{l.forEach(function(m,p){h++;var g=(function(_,k){var C=_||k,j=s[C];if(!j)throw new Error(C+" is not a valid compression method !");return j})(p.options.compression,c.compression),f=p.options.compressionOptions||c.compressionOptions||{},x=p.dir,y=p.date;p._compressWorker(g,f).withStreamInfo("file",{name:m,dir:x,date:y,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(d)}),d.entriesCount=h}catch(m){d.error(m)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new s;for(var l in this)typeof this[l]!="function"&&(i[l]=this[l]);return i}}(s.prototype=n("./object")).loadAsync=n("./load"),s.support=n("./support"),s.defaults=n("./defaults"),s.version="3.10.1",s.loadAsync=function(i,l){return new s().loadAsync(i,l)},s.external=n("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){var s=n("./utils"),i=n("./external"),l=n("./utf8"),c=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function h(m){return new i.Promise(function(p,g){var f=m.decompressed.getContentWorker().pipe(new u);f.on("error",function(x){g(x)}).on("end",function(){f.streamInfo.crc32!==m.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(m,p){var g=this;return p=s.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(m)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",m,!0,p.optimizedBinaryString,p.base64).then(function(f){var x=new c(p);return x.load(f),x}).then(function(f){var x=[i.Promise.resolve(f)],y=f.files;if(p.checkCRC32)for(var _=0;_<y.length;_++)x.push(h(y[_]));return i.Promise.all(x)}).then(function(f){for(var x=f.shift(),y=x.files,_=0;_<y.length;_++){var k=y[_],C=k.fileNameStr,j=s.resolve(k.fileNameStr);g.file(j,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:p.createFolders}),k.dir||(g.file(j).unsafeOriginalName=C)}return x.zipComment.length&&(g.comment=x.zipComment),g})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){var s=n("../utils"),i=n("../stream/GenericWorker");function l(c,u){i.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}s.inherits(l,i),l.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},l.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){var s=n("readable-stream").Readable;function i(l,c,u){s.call(this,c),this._helper=l;var d=this;l.on("data",function(h,m){d.push(h)||d._helper.pause(),u&&u(m)}).on("error",function(h){d.emit("error",h)}).on("end",function(){d.push(null)})}n("../utils").inherits(i,s),i.prototype._read=function(){this._helper.resume()},r.exports=i},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,i){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,i);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,i)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var i=new Buffer(s);return i.fill(0),i},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(n,r,o){function s(j,z,E){var A,O=l.getTypeOf(z),P=l.extend(E||{},d);P.date=P.date||new Date,P.compression!==null&&(P.compression=P.compression.toUpperCase()),typeof P.unixPermissions=="string"&&(P.unixPermissions=parseInt(P.unixPermissions,8)),P.unixPermissions&&16384&P.unixPermissions&&(P.dir=!0),P.dosPermissions&&16&P.dosPermissions&&(P.dir=!0),P.dir&&(j=y(j)),P.createFolders&&(A=x(j))&&_.call(this,A,!0);var Z=O==="string"&&P.binary===!1&&P.base64===!1;E&&E.binary!==void 0||(P.binary=!Z),(z instanceof h&&z.uncompressedSize===0||P.dir||!z||z.length===0)&&(P.base64=!1,P.binary=!0,z="",P.compression="STORE",O="string");var S=null;S=z instanceof h||z instanceof c?z:g.isNode&&g.isStream(z)?new f(j,z):l.prepareContent(j,z,P.binary,P.optimizedBinaryString,P.base64);var R=new m(j,S,P);this.files[j]=R}var i=n("./utf8"),l=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),h=n("./compressedObject"),m=n("./zipObject"),p=n("./generate"),g=n("./nodejsUtils"),f=n("./nodejs/NodejsStreamInputAdapter"),x=function(j){j.slice(-1)==="/"&&(j=j.substring(0,j.length-1));var z=j.lastIndexOf("/");return 0<z?j.substring(0,z):""},y=function(j){return j.slice(-1)!=="/"&&(j+="/"),j},_=function(j,z){return z=z!==void 0?z:d.createFolders,j=y(j),this.files[j]||s.call(this,j,null,{dir:!0,createFolders:z}),this.files[j]};function k(j){return Object.prototype.toString.call(j)==="[object RegExp]"}var C={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(j){var z,E,A;for(z in this.files)A=this.files[z],(E=z.slice(this.root.length,z.length))&&z.slice(0,this.root.length)===this.root&&j(E,A)},filter:function(j){var z=[];return this.forEach(function(E,A){j(E,A)&&z.push(A)}),z},file:function(j,z,E){if(arguments.length!==1)return j=this.root+j,s.call(this,j,z,E),this;if(k(j)){var A=j;return this.filter(function(P,Z){return!Z.dir&&A.test(P)})}var O=this.files[this.root+j];return O&&!O.dir?O:null},folder:function(j){if(!j)return this;if(k(j))return this.filter(function(O,P){return P.dir&&j.test(O)});var z=this.root+j,E=_.call(this,z),A=this.clone();return A.root=E.name,A},remove:function(j){j=this.root+j;var z=this.files[j];if(z||(j.slice(-1)!=="/"&&(j+="/"),z=this.files[j]),z&&!z.dir)delete this.files[j];else for(var E=this.filter(function(O,P){return P.name.slice(0,j.length)===j}),A=0;A<E.length;A++)delete this.files[E[A].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(j){var z,E={};try{if((E=l.extend(j||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=E.type.toLowerCase(),E.compression=E.compression.toUpperCase(),E.type==="binarystring"&&(E.type="string"),!E.type)throw new Error("No output type specified.");l.checkSupport(E.type),E.platform!=="darwin"&&E.platform!=="freebsd"&&E.platform!=="linux"&&E.platform!=="sunos"||(E.platform="UNIX"),E.platform==="win32"&&(E.platform="DOS");var A=E.comment||this.comment||"";z=p.generateWorker(this,E,A)}catch(O){(z=new c("error")).error(O)}return new u(z,E.type||"string",E.mimeType)},generateAsync:function(j,z){return this.generateInternalStream(j).accumulate(z)},generateNodeStream:function(j,z){return(j=j||{}).type||(j.type="nodebuffer"),this.generateInternalStream(j).toNodejsStream(z)}};r.exports=C},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){var s=n("./DataReader");function i(l){s.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}n("../utils").inherits(i,s),i.prototype.byteAt=function(l){return this.data[this.zero+l]},i.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),h=l.charCodeAt(3),m=this.length-4;0<=m;--m)if(this.data[m]===c&&this.data[m+1]===u&&this.data[m+2]===d&&this.data[m+3]===h)return m-this.zero;return-1},i.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),h=l.charCodeAt(3),m=this.readData(4);return c===m[0]&&u===m[1]&&d===m[2]&&h===m[3]},i.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){var s=n("../utils");function i(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,u=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return s.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,o){var s=n("./Uint8ArrayReader");function i(l){s.call(this,l)}n("../utils").inherits(i,s),i.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var s=n("./DataReader");function i(l){s.call(this,l)}n("../utils").inherits(i,s),i.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},i.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},i.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},i.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var s=n("./ArrayReader");function i(l){s.call(this,l)}n("../utils").inherits(i,s),i.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var s=n("../utils"),i=n("../support"),l=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(h){var m=s.getTypeOf(h);return s.checkSupport(m),m!=="string"||i.uint8array?m==="nodebuffer"?new u(h):i.uint8array?new d(s.transformTo("uint8array",h)):new l(s.transformTo("array",h)):new c(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){var s=n("./GenericWorker"),i=n("../utils");function l(c){s.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(l,s),l.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},r.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var s=n("./GenericWorker"),i=n("../crc32");function l(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(l,s),l.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function l(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(l,i),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}i.prototype.processChunk.call(this,c)},r.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function l(c){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=s.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}s.inherits(l,i),l.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){function s(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,l){return this._listeners[i].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,l){if(this._listeners[i])for(var c=0;c<this._listeners[i].length;c++)this._listeners[i][c].call(this,l)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var l=this;return i.on("data",function(c){l.processChunk(c)}),i.on("end",function(){l.end()}),i.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,l){return this.extraStreamInfo[i]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},r.exports=s},{}],29:[function(n,r,o){var s=n("../utils"),i=n("./ConvertWorker"),l=n("./GenericWorker"),c=n("../base64"),u=n("../support"),d=n("../external"),h=null;if(u.nodestream)try{h=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(g,f){return new d.Promise(function(x,y){var _=[],k=g._internalType,C=g._outputType,j=g._mimeType;g.on("data",function(z,E){_.push(z),f&&f(E)}).on("error",function(z){_=[],y(z)}).on("end",function(){try{var z=(function(E,A,O){switch(E){case"blob":return s.newBlob(s.transformTo("arraybuffer",A),O);case"base64":return c.encode(A);default:return s.transformTo(E,A)}})(C,(function(E,A){var O,P=0,Z=null,S=0;for(O=0;O<A.length;O++)S+=A[O].length;switch(E){case"string":return A.join("");case"array":return Array.prototype.concat.apply([],A);case"uint8array":for(Z=new Uint8Array(S),O=0;O<A.length;O++)Z.set(A[O],P),P+=A[O].length;return Z;case"nodebuffer":return Buffer.concat(A);default:throw new Error("concat : unsupported type '"+E+"'")}})(k,_),j);x(z)}catch(E){y(E)}_=[]}).resume()})}function p(g,f,x){var y=f;switch(f){case"blob":case"arraybuffer":y="uint8array";break;case"base64":y="string"}try{this._internalType=y,this._outputType=f,this._mimeType=x,s.checkSupport(y),this._worker=g.pipe(new i(y)),g.lock()}catch(_){this._worker=new l("error"),this._worker.error(_)}}p.prototype={accumulate:function(g){return m(this,g)},on:function(g,f){var x=this;return g==="data"?this._worker.on(g,function(y){f.call(x,y.data,y.meta)}):this._worker.on(g,function(){s.delay(f,arguments,x)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new h(this,{objectMode:this._outputType!=="nodebuffer"},g)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var s=new ArrayBuffer(0);try{o.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(s),o.blob=i.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){for(var s=n("./utils"),i=n("./support"),l=n("./nodejsUtils"),c=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function h(){c.call(this,"utf-8 decode"),this.leftOver=null}function m(){c.call(this,"utf-8 encode")}o.utf8encode=function(p){return i.nodebuffer?l.newBufferFrom(p,"utf-8"):(function(g){var f,x,y,_,k,C=g.length,j=0;for(_=0;_<C;_++)(64512&(x=g.charCodeAt(_)))==55296&&_+1<C&&(64512&(y=g.charCodeAt(_+1)))==56320&&(x=65536+(x-55296<<10)+(y-56320),_++),j+=x<128?1:x<2048?2:x<65536?3:4;for(f=i.uint8array?new Uint8Array(j):new Array(j),_=k=0;k<j;_++)(64512&(x=g.charCodeAt(_)))==55296&&_+1<C&&(64512&(y=g.charCodeAt(_+1)))==56320&&(x=65536+(x-55296<<10)+(y-56320),_++),x<128?f[k++]=x:(x<2048?f[k++]=192|x>>>6:(x<65536?f[k++]=224|x>>>12:(f[k++]=240|x>>>18,f[k++]=128|x>>>12&63),f[k++]=128|x>>>6&63),f[k++]=128|63&x);return f})(p)},o.utf8decode=function(p){return i.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):(function(g){var f,x,y,_,k=g.length,C=new Array(2*k);for(f=x=0;f<k;)if((y=g[f++])<128)C[x++]=y;else if(4<(_=u[y]))C[x++]=65533,f+=_-1;else{for(y&=_===2?31:_===3?15:7;1<_&&f<k;)y=y<<6|63&g[f++],_--;1<_?C[x++]=65533:y<65536?C[x++]=y:(y-=65536,C[x++]=55296|y>>10&1023,C[x++]=56320|1023&y)}return C.length!==x&&(C.subarray?C=C.subarray(0,x):C.length=x),s.applyFromCharCode(C)})(p=s.transformTo(i.uint8array?"uint8array":"array",p))},s.inherits(h,c),h.prototype.processChunk=function(p){var g=s.transformTo(i.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var f=g;(g=new Uint8Array(f.length+this.leftOver.length)).set(this.leftOver,0),g.set(f,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var x=(function(_,k){var C;for((k=k||_.length)>_.length&&(k=_.length),C=k-1;0<=C&&(192&_[C])==128;)C--;return C<0||C===0?k:C+u[_[C]]>k?C:k})(g),y=g;x!==g.length&&(i.uint8array?(y=g.subarray(0,x),this.leftOver=g.subarray(x,g.length)):(y=g.slice(0,x),this.leftOver=g.slice(x,g.length))),this.push({data:o.utf8decode(y),meta:p.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=h,s.inherits(m,c),m.prototype.processChunk=function(p){this.push({data:o.utf8encode(p.data),meta:p.meta})},o.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var s=n("./support"),i=n("./base64"),l=n("./nodejsUtils"),c=n("./external");function u(f){return f}function d(f,x){for(var y=0;y<f.length;++y)x[y]=255&f.charCodeAt(y);return x}n("setimmediate"),o.newBlob=function(f,x){o.checkSupport("blob");try{return new Blob([f],{type:x})}catch{try{var y=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return y.append(f),y.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(f,x,y){var _=[],k=0,C=f.length;if(C<=y)return String.fromCharCode.apply(null,f);for(;k<C;)x==="array"||x==="nodebuffer"?_.push(String.fromCharCode.apply(null,f.slice(k,Math.min(k+y,C)))):_.push(String.fromCharCode.apply(null,f.subarray(k,Math.min(k+y,C)))),k+=y;return _.join("")},stringifyByChar:function(f){for(var x="",y=0;y<f.length;y++)x+=String.fromCharCode(f[y]);return x},applyCanBeUsed:{uint8array:(function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}})()}};function m(f){var x=65536,y=o.getTypeOf(f),_=!0;if(y==="uint8array"?_=h.applyCanBeUsed.uint8array:y==="nodebuffer"&&(_=h.applyCanBeUsed.nodebuffer),_)for(;1<x;)try{return h.stringifyByChunk(f,y,x)}catch{x=Math.floor(x/2)}return h.stringifyByChar(f)}function p(f,x){for(var y=0;y<f.length;y++)x[y]=f[y];return x}o.applyFromCharCode=m;var g={};g.string={string:u,array:function(f){return d(f,new Array(f.length))},arraybuffer:function(f){return g.string.uint8array(f).buffer},uint8array:function(f){return d(f,new Uint8Array(f.length))},nodebuffer:function(f){return d(f,l.allocBuffer(f.length))}},g.array={string:m,array:u,arraybuffer:function(f){return new Uint8Array(f).buffer},uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return l.newBufferFrom(f)}},g.arraybuffer={string:function(f){return m(new Uint8Array(f))},array:function(f){return p(new Uint8Array(f),new Array(f.byteLength))},arraybuffer:u,uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return l.newBufferFrom(new Uint8Array(f))}},g.uint8array={string:m,array:function(f){return p(f,new Array(f.length))},arraybuffer:function(f){return f.buffer},uint8array:u,nodebuffer:function(f){return l.newBufferFrom(f)}},g.nodebuffer={string:m,array:function(f){return p(f,new Array(f.length))},arraybuffer:function(f){return g.nodebuffer.uint8array(f).buffer},uint8array:function(f){return p(f,new Uint8Array(f.length))},nodebuffer:u},o.transformTo=function(f,x){if(x=x||"",!f)return x;o.checkSupport(f);var y=o.getTypeOf(x);return g[y][f](x)},o.resolve=function(f){for(var x=f.split("/"),y=[],_=0;_<x.length;_++){var k=x[_];k==="."||k===""&&_!==0&&_!==x.length-1||(k===".."?y.pop():y.push(k))}return y.join("/")},o.getTypeOf=function(f){return typeof f=="string"?"string":Object.prototype.toString.call(f)==="[object Array]"?"array":s.nodebuffer&&l.isBuffer(f)?"nodebuffer":s.uint8array&&f instanceof Uint8Array?"uint8array":s.arraybuffer&&f instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(f){if(!s[f.toLowerCase()])throw new Error(f+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(f){var x,y,_="";for(y=0;y<(f||"").length;y++)_+="\\x"+((x=f.charCodeAt(y))<16?"0":"")+x.toString(16).toUpperCase();return _},o.delay=function(f,x,y){setImmediate(function(){f.apply(y||null,x||[])})},o.inherits=function(f,x){function y(){}y.prototype=x.prototype,f.prototype=new y},o.extend=function(){var f,x,y={};for(f=0;f<arguments.length;f++)for(x in arguments[f])Object.prototype.hasOwnProperty.call(arguments[f],x)&&y[x]===void 0&&(y[x]=arguments[f][x]);return y},o.prepareContent=function(f,x,y,_,k){return c.Promise.resolve(x).then(function(C){return s.blob&&(C instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(C))!==-1)&&typeof FileReader<"u"?new c.Promise(function(j,z){var E=new FileReader;E.onload=function(A){j(A.target.result)},E.onerror=function(A){z(A.target.error)},E.readAsArrayBuffer(C)}):C}).then(function(C){var j=o.getTypeOf(C);return j?(j==="arraybuffer"?C=o.transformTo("uint8array",C):j==="string"&&(k?C=i.decode(C):y&&_!==!0&&(C=(function(z){return d(z,s.uint8array?new Uint8Array(z.length):new Array(z.length))})(C))),C):c.Promise.reject(new Error("Can't read the data of '"+f+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){var s=n("./reader/readerFor"),i=n("./utils"),l=n("./signature"),c=n("./zipEntry"),u=n("./support");function d(h){this.files=[],this.loadOptions=h}d.prototype={checkSignature:function(h){if(!this.reader.readAndCheckSignature(h)){this.reader.index-=4;var m=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(m)+", expected "+i.pretty(h)+")")}},isSignature:function(h,m){var p=this.reader.index;this.reader.setIndex(h);var g=this.reader.readString(4)===m;return this.reader.setIndex(p),g},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var h=this.reader.readData(this.zipCommentLength),m=u.uint8array?"uint8array":"array",p=i.transformTo(m,h);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var h,m,p,g=this.zip64EndOfCentralSize-44;0<g;)h=this.reader.readInt(2),m=this.reader.readInt(4),p=this.reader.readData(m),this.zip64ExtensibleData[h]={id:h,length:m,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var h,m;for(h=0;h<this.files.length;h++)m=this.files[h],this.reader.setIndex(m.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),m.readLocalPart(this.reader),m.handleUTF8(),m.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(h=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(h);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var h=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(h<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(h);var m=h;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(h=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(h),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var g=m-p;if(0<g)this.isSignature(m,l.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(h){this.reader=s(h)},load:function(h){this.prepareReader(h),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){var s=n("./reader/readerFor"),i=n("./utils"),l=n("./compressedObject"),c=n("./crc32"),u=n("./utf8"),d=n("./compressions"),h=n("./support");function m(p,g){this.options=p,this.loadOptions=g}m.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var g,f;if(p.skip(22),this.fileNameLength=p.readInt(2),f=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(f),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((g=(function(x){for(var y in d)if(Object.prototype.hasOwnProperty.call(d,y)&&d[y].magic===x)return d[y];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,g,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var g=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(g),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=s(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var g,f,x,y=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<y;)g=p.readInt(2),f=p.readInt(2),x=p.readData(f),this.extraFields[g]={id:g,length:f,value:x};p.setIndex(y)},handleUTF8:function(){var p=h.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var f=i.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(f)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var y=i.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(y)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var g=s(p.value);return g.readInt(1)!==1||c(this.fileName)!==g.readInt(4)?null:u.utf8decode(g.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var g=s(p.value);return g.readInt(1)!==1||c(this.fileComment)!==g.readInt(4)?null:u.utf8decode(g.readData(p.length-5))}return null}},r.exports=m},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){function s(g,f,x){this.name=g,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=f,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var i=n("./stream/StreamHelper"),l=n("./stream/DataWorker"),c=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");s.prototype={internalStream:function(g){var f=null,x="string";try{if(!g)throw new Error("No output type specified.");var y=(x=g.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),f=this._decompressWorker();var _=!this._dataBinary;_&&!y&&(f=f.pipe(new c.Utf8EncodeWorker)),!_&&y&&(f=f.pipe(new c.Utf8DecodeWorker))}catch(k){(f=new d("error")).error(k)}return new i(f,x,"")},async:function(g,f){return this.internalStream(g).accumulate(f)},nodeStream:function(g,f){return this.internalStream(g||"nodebuffer").toNodejsStream(f)},_compressWorker:function(g,f){if(this._data instanceof u&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(x,g,f)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var h=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],m=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<h.length;p++)s.prototype[h[p]]=m;r.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(s){var i,l,c=s.MutationObserver||s.WebKitMutationObserver;if(c){var u=0,d=new c(g),h=s.document.createTextNode("");d.observe(h,{characterData:!0}),i=function(){h.data=u=++u%2}}else if(s.setImmediate||s.MessageChannel===void 0)i="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var f=s.document.createElement("script");f.onreadystatechange=function(){g(),f.onreadystatechange=null,f.parentNode.removeChild(f),f=null},s.document.documentElement.appendChild(f)}:function(){setTimeout(g,0)};else{var m=new s.MessageChannel;m.port1.onmessage=g,i=function(){m.port2.postMessage(0)}}var p=[];function g(){var f,x;l=!0;for(var y=p.length;y;){for(x=p,p=[],f=-1;++f<y;)x[f]();y=p.length}l=!1}r.exports=function(f){p.push(f)!==1||l||i()}}).call(this,typeof Zn<"u"?Zn:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){var s=n("immediate");function i(){}var l={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function h(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,y!==i&&f(this,y)}function m(y,_,k){this.promise=y,typeof _=="function"&&(this.onFulfilled=_,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function p(y,_,k){s(function(){var C;try{C=_(k)}catch(j){return l.reject(y,j)}C===y?l.reject(y,new TypeError("Cannot resolve promise with itself")):l.resolve(y,C)})}function g(y){var _=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof _=="function")return function(){_.apply(y,arguments)}}function f(y,_){var k=!1;function C(E){k||(k=!0,l.reject(y,E))}function j(E){k||(k=!0,l.resolve(y,E))}var z=x(function(){_(j,C)});z.status==="error"&&C(z.value)}function x(y,_){var k={};try{k.value=y(_),k.status="success"}catch(C){k.status="error",k.value=C}return k}(r.exports=h).prototype.finally=function(y){if(typeof y!="function")return this;var _=this.constructor;return this.then(function(k){return _.resolve(y()).then(function(){return k})},function(k){return _.resolve(y()).then(function(){throw k})})},h.prototype.catch=function(y){return this.then(null,y)},h.prototype.then=function(y,_){if(typeof y!="function"&&this.state===u||typeof _!="function"&&this.state===c)return this;var k=new this.constructor(i);return this.state!==d?p(k,this.state===u?y:_,this.outcome):this.queue.push(new m(k,y,_)),k},m.prototype.callFulfilled=function(y){l.resolve(this.promise,y)},m.prototype.otherCallFulfilled=function(y){p(this.promise,this.onFulfilled,y)},m.prototype.callRejected=function(y){l.reject(this.promise,y)},m.prototype.otherCallRejected=function(y){p(this.promise,this.onRejected,y)},l.resolve=function(y,_){var k=x(g,_);if(k.status==="error")return l.reject(y,k.value);var C=k.value;if(C)f(y,C);else{y.state=u,y.outcome=_;for(var j=-1,z=y.queue.length;++j<z;)y.queue[j].callFulfilled(_)}return y},l.reject=function(y,_){y.state=c,y.outcome=_;for(var k=-1,C=y.queue.length;++k<C;)y.queue[k].callRejected(_);return y},h.resolve=function(y){return y instanceof this?y:l.resolve(new this(i),y)},h.reject=function(y){var _=new this(i);return l.reject(_,y)},h.all=function(y){var _=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=y.length,C=!1;if(!k)return this.resolve([]);for(var j=new Array(k),z=0,E=-1,A=new this(i);++E<k;)O(y[E],E);return A;function O(P,Z){_.resolve(P).then(function(S){j[Z]=S,++z!==k||C||(C=!0,l.resolve(A,j))},function(S){C||(C=!0,l.reject(A,S))})}},h.race=function(y){var _=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=y.length,C=!1;if(!k)return this.resolve([]);for(var j=-1,z=new this(i);++j<k;)E=y[j],_.resolve(E).then(function(A){C||(C=!0,l.resolve(z,A))},function(A){C||(C=!0,l.reject(z,A))});var E;return z}},{immediate:36}],38:[function(n,r,o){var s={};(0,n("./lib/utils/common").assign)(s,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){var s=n("./zlib/deflate"),i=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,h=0,m=-1,p=0,g=8;function f(y){if(!(this instanceof f))return new f(y);this.options=i.assign({level:m,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},y||{});var _=this.options;_.raw&&0<_.windowBits?_.windowBits=-_.windowBits:_.gzip&&0<_.windowBits&&_.windowBits<16&&(_.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var k=s.deflateInit2(this.strm,_.level,_.method,_.windowBits,_.memLevel,_.strategy);if(k!==h)throw new Error(c[k]);if(_.header&&s.deflateSetHeader(this.strm,_.header),_.dictionary){var C;if(C=typeof _.dictionary=="string"?l.string2buf(_.dictionary):d.call(_.dictionary)==="[object ArrayBuffer]"?new Uint8Array(_.dictionary):_.dictionary,(k=s.deflateSetDictionary(this.strm,C))!==h)throw new Error(c[k]);this._dict_set=!0}}function x(y,_){var k=new f(_);if(k.push(y,!0),k.err)throw k.msg||c[k.err];return k.result}f.prototype.push=function(y,_){var k,C,j=this.strm,z=this.options.chunkSize;if(this.ended)return!1;C=_===~~_?_:_===!0?4:0,typeof y=="string"?j.input=l.string2buf(y):d.call(y)==="[object ArrayBuffer]"?j.input=new Uint8Array(y):j.input=y,j.next_in=0,j.avail_in=j.input.length;do{if(j.avail_out===0&&(j.output=new i.Buf8(z),j.next_out=0,j.avail_out=z),(k=s.deflate(j,C))!==1&&k!==h)return this.onEnd(k),!(this.ended=!0);j.avail_out!==0&&(j.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(i.shrinkBuf(j.output,j.next_out))):this.onData(i.shrinkBuf(j.output,j.next_out)))}while((0<j.avail_in||j.avail_out===0)&&k!==1);return C===4?(k=s.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===h):C!==2||(this.onEnd(h),!(j.avail_out=0))},f.prototype.onData=function(y){this.chunks.push(y)},f.prototype.onEnd=function(y){y===h&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg},o.Deflate=f,o.deflate=x,o.deflateRaw=function(y,_){return(_=_||{}).raw=!0,x(y,_)},o.gzip=function(y,_){return(_=_||{}).gzip=!0,x(y,_)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){var s=n("./zlib/inflate"),i=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),h=n("./zlib/gzheader"),m=Object.prototype.toString;function p(f){if(!(this instanceof p))return new p(f);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},f||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||f&&f.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&(15&x.windowBits)==0&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var y=s.inflateInit2(this.strm,x.windowBits);if(y!==c.Z_OK)throw new Error(u[y]);this.header=new h,s.inflateGetHeader(this.strm,this.header)}function g(f,x){var y=new p(x);if(y.push(f,!0),y.err)throw y.msg||u[y.err];return y.result}p.prototype.push=function(f,x){var y,_,k,C,j,z,E=this.strm,A=this.options.chunkSize,O=this.options.dictionary,P=!1;if(this.ended)return!1;_=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof f=="string"?E.input=l.binstring2buf(f):m.call(f)==="[object ArrayBuffer]"?E.input=new Uint8Array(f):E.input=f,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new i.Buf8(A),E.next_out=0,E.avail_out=A),(y=s.inflate(E,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&O&&(z=typeof O=="string"?l.string2buf(O):m.call(O)==="[object ArrayBuffer]"?new Uint8Array(O):O,y=s.inflateSetDictionary(this.strm,z)),y===c.Z_BUF_ERROR&&P===!0&&(y=c.Z_OK,P=!1),y!==c.Z_STREAM_END&&y!==c.Z_OK)return this.onEnd(y),!(this.ended=!0);E.next_out&&(E.avail_out!==0&&y!==c.Z_STREAM_END&&(E.avail_in!==0||_!==c.Z_FINISH&&_!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=l.utf8border(E.output,E.next_out),C=E.next_out-k,j=l.buf2string(E.output,k),E.next_out=C,E.avail_out=A-C,C&&i.arraySet(E.output,E.output,k,C,0),this.onData(j)):this.onData(i.shrinkBuf(E.output,E.next_out)))),E.avail_in===0&&E.avail_out===0&&(P=!0)}while((0<E.avail_in||E.avail_out===0)&&y!==c.Z_STREAM_END);return y===c.Z_STREAM_END&&(_=c.Z_FINISH),_===c.Z_FINISH?(y=s.inflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===c.Z_OK):_!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(E.avail_out=0))},p.prototype.onData=function(f){this.chunks.push(f)},p.prototype.onEnd=function(f){f===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg},o.Inflate=p,o.inflate=g,o.inflateRaw=function(f,x){return(x=x||{}).raw=!0,g(f,x)},o.ungzip=g},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var h in d)d.hasOwnProperty(h)&&(c[h]=d[h])}}return c},o.shrinkBuf=function(c,u){return c.length===u?c:c.subarray?c.subarray(0,u):(c.length=u,c)};var i={arraySet:function(c,u,d,h,m){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+h),m);else for(var p=0;p<h;p++)c[m+p]=u[d+p]},flattenChunks:function(c){var u,d,h,m,p,g;for(u=h=0,d=c.length;u<d;u++)h+=c[u].length;for(g=new Uint8Array(h),u=m=0,d=c.length;u<d;u++)p=c[u],g.set(p,m),m+=p.length;return g}},l={arraySet:function(c,u,d,h,m){for(var p=0;p<h;p++)c[m+p]=u[d+p]},flattenChunks:function(c){return[].concat.apply([],c)}};o.setTyped=function(c){c?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,i)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,l))},o.setTyped(s)},{}],42:[function(n,r,o){var s=n("./common"),i=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new s.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(h,m){if(m<65537&&(h.subarray&&l||!h.subarray&&i))return String.fromCharCode.apply(null,s.shrinkBuf(h,m));for(var p="",g=0;g<m;g++)p+=String.fromCharCode(h[g]);return p}c[254]=c[254]=1,o.string2buf=function(h){var m,p,g,f,x,y=h.length,_=0;for(f=0;f<y;f++)(64512&(p=h.charCodeAt(f)))==55296&&f+1<y&&(64512&(g=h.charCodeAt(f+1)))==56320&&(p=65536+(p-55296<<10)+(g-56320),f++),_+=p<128?1:p<2048?2:p<65536?3:4;for(m=new s.Buf8(_),f=x=0;x<_;f++)(64512&(p=h.charCodeAt(f)))==55296&&f+1<y&&(64512&(g=h.charCodeAt(f+1)))==56320&&(p=65536+(p-55296<<10)+(g-56320),f++),p<128?m[x++]=p:(p<2048?m[x++]=192|p>>>6:(p<65536?m[x++]=224|p>>>12:(m[x++]=240|p>>>18,m[x++]=128|p>>>12&63),m[x++]=128|p>>>6&63),m[x++]=128|63&p);return m},o.buf2binstring=function(h){return d(h,h.length)},o.binstring2buf=function(h){for(var m=new s.Buf8(h.length),p=0,g=m.length;p<g;p++)m[p]=h.charCodeAt(p);return m},o.buf2string=function(h,m){var p,g,f,x,y=m||h.length,_=new Array(2*y);for(p=g=0;p<y;)if((f=h[p++])<128)_[g++]=f;else if(4<(x=c[f]))_[g++]=65533,p+=x-1;else{for(f&=x===2?31:x===3?15:7;1<x&&p<y;)f=f<<6|63&h[p++],x--;1<x?_[g++]=65533:f<65536?_[g++]=f:(f-=65536,_[g++]=55296|f>>10&1023,_[g++]=56320|1023&f)}return d(_,g)},o.utf8border=function(h,m){var p;for((m=m||h.length)>h.length&&(m=h.length),p=m-1;0<=p&&(192&h[p])==128;)p--;return p<0||p===0?m:p+c[h[p]]>m?p:m}},{"./common":41}],43:[function(n,r,o){r.exports=function(s,i,l,c){for(var u=65535&s|0,d=s>>>16&65535|0,h=0;l!==0;){for(l-=h=2e3<l?2e3:l;d=d+(u=u+i[c++]|0)|0,--h;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){var s=(function(){for(var i,l=[],c=0;c<256;c++){i=c;for(var u=0;u<8;u++)i=1&i?3988292384^i>>>1:i>>>1;l[c]=i}return l})();r.exports=function(i,l,c,u){var d=s,h=u+c;i^=-1;for(var m=u;m<h;m++)i=i>>>8^d[255&(i^l[m])];return-1^i}},{}],46:[function(n,r,o){var s,i=n("../utils/common"),l=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),h=0,m=4,p=0,g=-2,f=-1,x=4,y=2,_=8,k=9,C=286,j=30,z=19,E=2*C+1,A=15,O=3,P=258,Z=P+O+1,S=42,R=113,w=1,I=2,V=3,$=4;function F(b,Y){return b.msg=d[Y],Y}function J(b){return(b<<1)-(4<b?9:0)}function se(b){for(var Y=b.length;0<=--Y;)b[Y]=0}function U(b){var Y=b.state,q=Y.pending;q>b.avail_out&&(q=b.avail_out),q!==0&&(i.arraySet(b.output,Y.pending_buf,Y.pending_out,q,b.next_out),b.next_out+=q,Y.pending_out+=q,b.total_out+=q,b.avail_out-=q,Y.pending-=q,Y.pending===0&&(Y.pending_out=0))}function B(b,Y){l._tr_flush_block(b,0<=b.block_start?b.block_start:-1,b.strstart-b.block_start,Y),b.block_start=b.strstart,U(b.strm)}function te(b,Y){b.pending_buf[b.pending++]=Y}function ee(b,Y){b.pending_buf[b.pending++]=Y>>>8&255,b.pending_buf[b.pending++]=255&Y}function K(b,Y){var q,T,N=b.max_chain_length,D=b.strstart,L=b.prev_length,H=b.nice_match,M=b.strstart>b.w_size-Z?b.strstart-(b.w_size-Z):0,Q=b.window,oe=b.w_mask,ne=b.prev,pe=b.strstart+P,Ae=Q[D+L-1],ke=Q[D+L];b.prev_length>=b.good_match&&(N>>=2),H>b.lookahead&&(H=b.lookahead);do if(Q[(q=Y)+L]===ke&&Q[q+L-1]===Ae&&Q[q]===Q[D]&&Q[++q]===Q[D+1]){D+=2,q++;do;while(Q[++D]===Q[++q]&&Q[++D]===Q[++q]&&Q[++D]===Q[++q]&&Q[++D]===Q[++q]&&Q[++D]===Q[++q]&&Q[++D]===Q[++q]&&Q[++D]===Q[++q]&&Q[++D]===Q[++q]&&D<pe);if(T=P-(pe-D),D=pe-P,L<T){if(b.match_start=Y,H<=(L=T))break;Ae=Q[D+L-1],ke=Q[D+L]}}while((Y=ne[Y&oe])>M&&--N!=0);return L<=b.lookahead?L:b.lookahead}function ue(b){var Y,q,T,N,D,L,H,M,Q,oe,ne=b.w_size;do{if(N=b.window_size-b.lookahead-b.strstart,b.strstart>=ne+(ne-Z)){for(i.arraySet(b.window,b.window,ne,ne,0),b.match_start-=ne,b.strstart-=ne,b.block_start-=ne,Y=q=b.hash_size;T=b.head[--Y],b.head[Y]=ne<=T?T-ne:0,--q;);for(Y=q=ne;T=b.prev[--Y],b.prev[Y]=ne<=T?T-ne:0,--q;);N+=ne}if(b.strm.avail_in===0)break;if(L=b.strm,H=b.window,M=b.strstart+b.lookahead,Q=N,oe=void 0,oe=L.avail_in,Q<oe&&(oe=Q),q=oe===0?0:(L.avail_in-=oe,i.arraySet(H,L.input,L.next_in,oe,M),L.state.wrap===1?L.adler=c(L.adler,H,oe,M):L.state.wrap===2&&(L.adler=u(L.adler,H,oe,M)),L.next_in+=oe,L.total_in+=oe,oe),b.lookahead+=q,b.lookahead+b.insert>=O)for(D=b.strstart-b.insert,b.ins_h=b.window[D],b.ins_h=(b.ins_h<<b.hash_shift^b.window[D+1])&b.hash_mask;b.insert&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[D+O-1])&b.hash_mask,b.prev[D&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=D,D++,b.insert--,!(b.lookahead+b.insert<O)););}while(b.lookahead<Z&&b.strm.avail_in!==0)}function X(b,Y){for(var q,T;;){if(b.lookahead<Z){if(ue(b),b.lookahead<Z&&Y===h)return w;if(b.lookahead===0)break}if(q=0,b.lookahead>=O&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+O-1])&b.hash_mask,q=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart),q!==0&&b.strstart-q<=b.w_size-Z&&(b.match_length=K(b,q)),b.match_length>=O)if(T=l._tr_tally(b,b.strstart-b.match_start,b.match_length-O),b.lookahead-=b.match_length,b.match_length<=b.max_lazy_match&&b.lookahead>=O){for(b.match_length--;b.strstart++,b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+O-1])&b.hash_mask,q=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart,--b.match_length!=0;);b.strstart++}else b.strstart+=b.match_length,b.match_length=0,b.ins_h=b.window[b.strstart],b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+1])&b.hash_mask;else T=l._tr_tally(b,0,b.window[b.strstart]),b.lookahead--,b.strstart++;if(T&&(B(b,!1),b.strm.avail_out===0))return w}return b.insert=b.strstart<O-1?b.strstart:O-1,Y===m?(B(b,!0),b.strm.avail_out===0?V:$):b.last_lit&&(B(b,!1),b.strm.avail_out===0)?w:I}function ie(b,Y){for(var q,T,N;;){if(b.lookahead<Z){if(ue(b),b.lookahead<Z&&Y===h)return w;if(b.lookahead===0)break}if(q=0,b.lookahead>=O&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+O-1])&b.hash_mask,q=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart),b.prev_length=b.match_length,b.prev_match=b.match_start,b.match_length=O-1,q!==0&&b.prev_length<b.max_lazy_match&&b.strstart-q<=b.w_size-Z&&(b.match_length=K(b,q),b.match_length<=5&&(b.strategy===1||b.match_length===O&&4096<b.strstart-b.match_start)&&(b.match_length=O-1)),b.prev_length>=O&&b.match_length<=b.prev_length){for(N=b.strstart+b.lookahead-O,T=l._tr_tally(b,b.strstart-1-b.prev_match,b.prev_length-O),b.lookahead-=b.prev_length-1,b.prev_length-=2;++b.strstart<=N&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+O-1])&b.hash_mask,q=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart),--b.prev_length!=0;);if(b.match_available=0,b.match_length=O-1,b.strstart++,T&&(B(b,!1),b.strm.avail_out===0))return w}else if(b.match_available){if((T=l._tr_tally(b,0,b.window[b.strstart-1]))&&B(b,!1),b.strstart++,b.lookahead--,b.strm.avail_out===0)return w}else b.match_available=1,b.strstart++,b.lookahead--}return b.match_available&&(T=l._tr_tally(b,0,b.window[b.strstart-1]),b.match_available=0),b.insert=b.strstart<O-1?b.strstart:O-1,Y===m?(B(b,!0),b.strm.avail_out===0?V:$):b.last_lit&&(B(b,!1),b.strm.avail_out===0)?w:I}function ae(b,Y,q,T,N){this.good_length=b,this.max_lazy=Y,this.nice_length=q,this.max_chain=T,this.func=N}function he(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=_,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*E),this.dyn_dtree=new i.Buf16(2*(2*j+1)),this.bl_tree=new i.Buf16(2*(2*z+1)),se(this.dyn_ltree),se(this.dyn_dtree),se(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(A+1),this.heap=new i.Buf16(2*C+1),se(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*C+1),se(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function fe(b){var Y;return b&&b.state?(b.total_in=b.total_out=0,b.data_type=y,(Y=b.state).pending=0,Y.pending_out=0,Y.wrap<0&&(Y.wrap=-Y.wrap),Y.status=Y.wrap?S:R,b.adler=Y.wrap===2?0:1,Y.last_flush=h,l._tr_init(Y),p):F(b,g)}function we(b){var Y=fe(b);return Y===p&&(function(q){q.window_size=2*q.w_size,se(q.head),q.max_lazy_match=s[q.level].max_lazy,q.good_match=s[q.level].good_length,q.nice_match=s[q.level].nice_length,q.max_chain_length=s[q.level].max_chain,q.strstart=0,q.block_start=0,q.lookahead=0,q.insert=0,q.match_length=q.prev_length=O-1,q.match_available=0,q.ins_h=0})(b.state),Y}function Te(b,Y,q,T,N,D){if(!b)return g;var L=1;if(Y===f&&(Y=6),T<0?(L=0,T=-T):15<T&&(L=2,T-=16),N<1||k<N||q!==_||T<8||15<T||Y<0||9<Y||D<0||x<D)return F(b,g);T===8&&(T=9);var H=new he;return(b.state=H).strm=b,H.wrap=L,H.gzhead=null,H.w_bits=T,H.w_size=1<<H.w_bits,H.w_mask=H.w_size-1,H.hash_bits=N+7,H.hash_size=1<<H.hash_bits,H.hash_mask=H.hash_size-1,H.hash_shift=~~((H.hash_bits+O-1)/O),H.window=new i.Buf8(2*H.w_size),H.head=new i.Buf16(H.hash_size),H.prev=new i.Buf16(H.w_size),H.lit_bufsize=1<<N+6,H.pending_buf_size=4*H.lit_bufsize,H.pending_buf=new i.Buf8(H.pending_buf_size),H.d_buf=1*H.lit_bufsize,H.l_buf=3*H.lit_bufsize,H.level=Y,H.strategy=D,H.method=q,we(b)}s=[new ae(0,0,0,0,function(b,Y){var q=65535;for(q>b.pending_buf_size-5&&(q=b.pending_buf_size-5);;){if(b.lookahead<=1){if(ue(b),b.lookahead===0&&Y===h)return w;if(b.lookahead===0)break}b.strstart+=b.lookahead,b.lookahead=0;var T=b.block_start+q;if((b.strstart===0||b.strstart>=T)&&(b.lookahead=b.strstart-T,b.strstart=T,B(b,!1),b.strm.avail_out===0)||b.strstart-b.block_start>=b.w_size-Z&&(B(b,!1),b.strm.avail_out===0))return w}return b.insert=0,Y===m?(B(b,!0),b.strm.avail_out===0?V:$):(b.strstart>b.block_start&&(B(b,!1),b.strm.avail_out),w)}),new ae(4,4,8,4,X),new ae(4,5,16,8,X),new ae(4,6,32,32,X),new ae(4,4,16,16,ie),new ae(8,16,32,32,ie),new ae(8,16,128,128,ie),new ae(8,32,128,256,ie),new ae(32,128,258,1024,ie),new ae(32,258,258,4096,ie)],o.deflateInit=function(b,Y){return Te(b,Y,_,15,8,0)},o.deflateInit2=Te,o.deflateReset=we,o.deflateResetKeep=fe,o.deflateSetHeader=function(b,Y){return b&&b.state?b.state.wrap!==2?g:(b.state.gzhead=Y,p):g},o.deflate=function(b,Y){var q,T,N,D;if(!b||!b.state||5<Y||Y<0)return b?F(b,g):g;if(T=b.state,!b.output||!b.input&&b.avail_in!==0||T.status===666&&Y!==m)return F(b,b.avail_out===0?-5:g);if(T.strm=b,q=T.last_flush,T.last_flush=Y,T.status===S)if(T.wrap===2)b.adler=0,te(T,31),te(T,139),te(T,8),T.gzhead?(te(T,(T.gzhead.text?1:0)+(T.gzhead.hcrc?2:0)+(T.gzhead.extra?4:0)+(T.gzhead.name?8:0)+(T.gzhead.comment?16:0)),te(T,255&T.gzhead.time),te(T,T.gzhead.time>>8&255),te(T,T.gzhead.time>>16&255),te(T,T.gzhead.time>>24&255),te(T,T.level===9?2:2<=T.strategy||T.level<2?4:0),te(T,255&T.gzhead.os),T.gzhead.extra&&T.gzhead.extra.length&&(te(T,255&T.gzhead.extra.length),te(T,T.gzhead.extra.length>>8&255)),T.gzhead.hcrc&&(b.adler=u(b.adler,T.pending_buf,T.pending,0)),T.gzindex=0,T.status=69):(te(T,0),te(T,0),te(T,0),te(T,0),te(T,0),te(T,T.level===9?2:2<=T.strategy||T.level<2?4:0),te(T,3),T.status=R);else{var L=_+(T.w_bits-8<<4)<<8;L|=(2<=T.strategy||T.level<2?0:T.level<6?1:T.level===6?2:3)<<6,T.strstart!==0&&(L|=32),L+=31-L%31,T.status=R,ee(T,L),T.strstart!==0&&(ee(T,b.adler>>>16),ee(T,65535&b.adler)),b.adler=1}if(T.status===69)if(T.gzhead.extra){for(N=T.pending;T.gzindex<(65535&T.gzhead.extra.length)&&(T.pending!==T.pending_buf_size||(T.gzhead.hcrc&&T.pending>N&&(b.adler=u(b.adler,T.pending_buf,T.pending-N,N)),U(b),N=T.pending,T.pending!==T.pending_buf_size));)te(T,255&T.gzhead.extra[T.gzindex]),T.gzindex++;T.gzhead.hcrc&&T.pending>N&&(b.adler=u(b.adler,T.pending_buf,T.pending-N,N)),T.gzindex===T.gzhead.extra.length&&(T.gzindex=0,T.status=73)}else T.status=73;if(T.status===73)if(T.gzhead.name){N=T.pending;do{if(T.pending===T.pending_buf_size&&(T.gzhead.hcrc&&T.pending>N&&(b.adler=u(b.adler,T.pending_buf,T.pending-N,N)),U(b),N=T.pending,T.pending===T.pending_buf_size)){D=1;break}D=T.gzindex<T.gzhead.name.length?255&T.gzhead.name.charCodeAt(T.gzindex++):0,te(T,D)}while(D!==0);T.gzhead.hcrc&&T.pending>N&&(b.adler=u(b.adler,T.pending_buf,T.pending-N,N)),D===0&&(T.gzindex=0,T.status=91)}else T.status=91;if(T.status===91)if(T.gzhead.comment){N=T.pending;do{if(T.pending===T.pending_buf_size&&(T.gzhead.hcrc&&T.pending>N&&(b.adler=u(b.adler,T.pending_buf,T.pending-N,N)),U(b),N=T.pending,T.pending===T.pending_buf_size)){D=1;break}D=T.gzindex<T.gzhead.comment.length?255&T.gzhead.comment.charCodeAt(T.gzindex++):0,te(T,D)}while(D!==0);T.gzhead.hcrc&&T.pending>N&&(b.adler=u(b.adler,T.pending_buf,T.pending-N,N)),D===0&&(T.status=103)}else T.status=103;if(T.status===103&&(T.gzhead.hcrc?(T.pending+2>T.pending_buf_size&&U(b),T.pending+2<=T.pending_buf_size&&(te(T,255&b.adler),te(T,b.adler>>8&255),b.adler=0,T.status=R)):T.status=R),T.pending!==0){if(U(b),b.avail_out===0)return T.last_flush=-1,p}else if(b.avail_in===0&&J(Y)<=J(q)&&Y!==m)return F(b,-5);if(T.status===666&&b.avail_in!==0)return F(b,-5);if(b.avail_in!==0||T.lookahead!==0||Y!==h&&T.status!==666){var H=T.strategy===2?(function(M,Q){for(var oe;;){if(M.lookahead===0&&(ue(M),M.lookahead===0)){if(Q===h)return w;break}if(M.match_length=0,oe=l._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++,oe&&(B(M,!1),M.strm.avail_out===0))return w}return M.insert=0,Q===m?(B(M,!0),M.strm.avail_out===0?V:$):M.last_lit&&(B(M,!1),M.strm.avail_out===0)?w:I})(T,Y):T.strategy===3?(function(M,Q){for(var oe,ne,pe,Ae,ke=M.window;;){if(M.lookahead<=P){if(ue(M),M.lookahead<=P&&Q===h)return w;if(M.lookahead===0)break}if(M.match_length=0,M.lookahead>=O&&0<M.strstart&&(ne=ke[pe=M.strstart-1])===ke[++pe]&&ne===ke[++pe]&&ne===ke[++pe]){Ae=M.strstart+P;do;while(ne===ke[++pe]&&ne===ke[++pe]&&ne===ke[++pe]&&ne===ke[++pe]&&ne===ke[++pe]&&ne===ke[++pe]&&ne===ke[++pe]&&ne===ke[++pe]&&pe<Ae);M.match_length=P-(Ae-pe),M.match_length>M.lookahead&&(M.match_length=M.lookahead)}if(M.match_length>=O?(oe=l._tr_tally(M,1,M.match_length-O),M.lookahead-=M.match_length,M.strstart+=M.match_length,M.match_length=0):(oe=l._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++),oe&&(B(M,!1),M.strm.avail_out===0))return w}return M.insert=0,Q===m?(B(M,!0),M.strm.avail_out===0?V:$):M.last_lit&&(B(M,!1),M.strm.avail_out===0)?w:I})(T,Y):s[T.level].func(T,Y);if(H!==V&&H!==$||(T.status=666),H===w||H===V)return b.avail_out===0&&(T.last_flush=-1),p;if(H===I&&(Y===1?l._tr_align(T):Y!==5&&(l._tr_stored_block(T,0,0,!1),Y===3&&(se(T.head),T.lookahead===0&&(T.strstart=0,T.block_start=0,T.insert=0))),U(b),b.avail_out===0))return T.last_flush=-1,p}return Y!==m?p:T.wrap<=0?1:(T.wrap===2?(te(T,255&b.adler),te(T,b.adler>>8&255),te(T,b.adler>>16&255),te(T,b.adler>>24&255),te(T,255&b.total_in),te(T,b.total_in>>8&255),te(T,b.total_in>>16&255),te(T,b.total_in>>24&255)):(ee(T,b.adler>>>16),ee(T,65535&b.adler)),U(b),0<T.wrap&&(T.wrap=-T.wrap),T.pending!==0?p:1)},o.deflateEnd=function(b){var Y;return b&&b.state?(Y=b.state.status)!==S&&Y!==69&&Y!==73&&Y!==91&&Y!==103&&Y!==R&&Y!==666?F(b,g):(b.state=null,Y===R?F(b,-3):p):g},o.deflateSetDictionary=function(b,Y){var q,T,N,D,L,H,M,Q,oe=Y.length;if(!b||!b.state||(D=(q=b.state).wrap)===2||D===1&&q.status!==S||q.lookahead)return g;for(D===1&&(b.adler=c(b.adler,Y,oe,0)),q.wrap=0,oe>=q.w_size&&(D===0&&(se(q.head),q.strstart=0,q.block_start=0,q.insert=0),Q=new i.Buf8(q.w_size),i.arraySet(Q,Y,oe-q.w_size,q.w_size,0),Y=Q,oe=q.w_size),L=b.avail_in,H=b.next_in,M=b.input,b.avail_in=oe,b.next_in=0,b.input=Y,ue(q);q.lookahead>=O;){for(T=q.strstart,N=q.lookahead-(O-1);q.ins_h=(q.ins_h<<q.hash_shift^q.window[T+O-1])&q.hash_mask,q.prev[T&q.w_mask]=q.head[q.ins_h],q.head[q.ins_h]=T,T++,--N;);q.strstart=T,q.lookahead=O-1,ue(q)}return q.strstart+=q.lookahead,q.block_start=q.strstart,q.insert=q.lookahead,q.lookahead=0,q.match_length=q.prev_length=O-1,q.match_available=0,b.next_in=H,b.input=M,b.avail_in=L,q.wrap=D,p},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){r.exports=function(s,i){var l,c,u,d,h,m,p,g,f,x,y,_,k,C,j,z,E,A,O,P,Z,S,R,w,I;l=s.state,c=s.next_in,w=s.input,u=c+(s.avail_in-5),d=s.next_out,I=s.output,h=d-(i-s.avail_out),m=d+(s.avail_out-257),p=l.dmax,g=l.wsize,f=l.whave,x=l.wnext,y=l.window,_=l.hold,k=l.bits,C=l.lencode,j=l.distcode,z=(1<<l.lenbits)-1,E=(1<<l.distbits)-1;e:do{k<15&&(_+=w[c++]<<k,k+=8,_+=w[c++]<<k,k+=8),A=C[_&z];t:for(;;){if(_>>>=O=A>>>24,k-=O,(O=A>>>16&255)===0)I[d++]=65535&A;else{if(!(16&O)){if((64&O)==0){A=C[(65535&A)+(_&(1<<O)-1)];continue t}if(32&O){l.mode=12;break e}s.msg="invalid literal/length code",l.mode=30;break e}P=65535&A,(O&=15)&&(k<O&&(_+=w[c++]<<k,k+=8),P+=_&(1<<O)-1,_>>>=O,k-=O),k<15&&(_+=w[c++]<<k,k+=8,_+=w[c++]<<k,k+=8),A=j[_&E];n:for(;;){if(_>>>=O=A>>>24,k-=O,!(16&(O=A>>>16&255))){if((64&O)==0){A=j[(65535&A)+(_&(1<<O)-1)];continue n}s.msg="invalid distance code",l.mode=30;break e}if(Z=65535&A,k<(O&=15)&&(_+=w[c++]<<k,(k+=8)<O&&(_+=w[c++]<<k,k+=8)),p<(Z+=_&(1<<O)-1)){s.msg="invalid distance too far back",l.mode=30;break e}if(_>>>=O,k-=O,(O=d-h)<Z){if(f<(O=Z-O)&&l.sane){s.msg="invalid distance too far back",l.mode=30;break e}if(R=y,(S=0)===x){if(S+=g-O,O<P){for(P-=O;I[d++]=y[S++],--O;);S=d-Z,R=I}}else if(x<O){if(S+=g+x-O,(O-=x)<P){for(P-=O;I[d++]=y[S++],--O;);if(S=0,x<P){for(P-=O=x;I[d++]=y[S++],--O;);S=d-Z,R=I}}}else if(S+=x-O,O<P){for(P-=O;I[d++]=y[S++],--O;);S=d-Z,R=I}for(;2<P;)I[d++]=R[S++],I[d++]=R[S++],I[d++]=R[S++],P-=3;P&&(I[d++]=R[S++],1<P&&(I[d++]=R[S++]))}else{for(S=d-Z;I[d++]=I[S++],I[d++]=I[S++],I[d++]=I[S++],2<(P-=3););P&&(I[d++]=I[S++],1<P&&(I[d++]=I[S++]))}break}}break}}while(c<u&&d<m);c-=P=k>>3,_&=(1<<(k-=P<<3))-1,s.next_in=c,s.next_out=d,s.avail_in=c<u?u-c+5:5-(c-u),s.avail_out=d<m?m-d+257:257-(d-m),l.hold=_,l.bits=k}},{}],49:[function(n,r,o){var s=n("../utils/common"),i=n("./adler32"),l=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,h=2,m=0,p=-2,g=1,f=852,x=592;function y(S){return(S>>>24&255)+(S>>>8&65280)+((65280&S)<<8)+((255&S)<<24)}function _(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(S){var R;return S&&S.state?(R=S.state,S.total_in=S.total_out=R.total=0,S.msg="",R.wrap&&(S.adler=1&R.wrap),R.mode=g,R.last=0,R.havedict=0,R.dmax=32768,R.head=null,R.hold=0,R.bits=0,R.lencode=R.lendyn=new s.Buf32(f),R.distcode=R.distdyn=new s.Buf32(x),R.sane=1,R.back=-1,m):p}function C(S){var R;return S&&S.state?((R=S.state).wsize=0,R.whave=0,R.wnext=0,k(S)):p}function j(S,R){var w,I;return S&&S.state?(I=S.state,R<0?(w=0,R=-R):(w=1+(R>>4),R<48&&(R&=15)),R&&(R<8||15<R)?p:(I.window!==null&&I.wbits!==R&&(I.window=null),I.wrap=w,I.wbits=R,C(S))):p}function z(S,R){var w,I;return S?(I=new _,(S.state=I).window=null,(w=j(S,R))!==m&&(S.state=null),w):p}var E,A,O=!0;function P(S){if(O){var R;for(E=new s.Buf32(512),A=new s.Buf32(32),R=0;R<144;)S.lens[R++]=8;for(;R<256;)S.lens[R++]=9;for(;R<280;)S.lens[R++]=7;for(;R<288;)S.lens[R++]=8;for(u(d,S.lens,0,288,E,0,S.work,{bits:9}),R=0;R<32;)S.lens[R++]=5;u(h,S.lens,0,32,A,0,S.work,{bits:5}),O=!1}S.lencode=E,S.lenbits=9,S.distcode=A,S.distbits=5}function Z(S,R,w,I){var V,$=S.state;return $.window===null&&($.wsize=1<<$.wbits,$.wnext=0,$.whave=0,$.window=new s.Buf8($.wsize)),I>=$.wsize?(s.arraySet($.window,R,w-$.wsize,$.wsize,0),$.wnext=0,$.whave=$.wsize):(I<(V=$.wsize-$.wnext)&&(V=I),s.arraySet($.window,R,w-I,V,$.wnext),(I-=V)?(s.arraySet($.window,R,w-I,I,0),$.wnext=I,$.whave=$.wsize):($.wnext+=V,$.wnext===$.wsize&&($.wnext=0),$.whave<$.wsize&&($.whave+=V))),0}o.inflateReset=C,o.inflateReset2=j,o.inflateResetKeep=k,o.inflateInit=function(S){return z(S,15)},o.inflateInit2=z,o.inflate=function(S,R){var w,I,V,$,F,J,se,U,B,te,ee,K,ue,X,ie,ae,he,fe,we,Te,b,Y,q,T,N=0,D=new s.Buf8(4),L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!S||!S.state||!S.output||!S.input&&S.avail_in!==0)return p;(w=S.state).mode===12&&(w.mode=13),F=S.next_out,V=S.output,se=S.avail_out,$=S.next_in,I=S.input,J=S.avail_in,U=w.hold,B=w.bits,te=J,ee=se,Y=m;e:for(;;)switch(w.mode){case g:if(w.wrap===0){w.mode=13;break}for(;B<16;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}if(2&w.wrap&&U===35615){D[w.check=0]=255&U,D[1]=U>>>8&255,w.check=l(w.check,D,2,0),B=U=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&U)<<8)+(U>>8))%31){S.msg="incorrect header check",w.mode=30;break}if((15&U)!=8){S.msg="unknown compression method",w.mode=30;break}if(B-=4,b=8+(15&(U>>>=4)),w.wbits===0)w.wbits=b;else if(b>w.wbits){S.msg="invalid window size",w.mode=30;break}w.dmax=1<<b,S.adler=w.check=1,w.mode=512&U?10:12,B=U=0;break;case 2:for(;B<16;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}if(w.flags=U,(255&w.flags)!=8){S.msg="unknown compression method",w.mode=30;break}if(57344&w.flags){S.msg="unknown header flags set",w.mode=30;break}w.head&&(w.head.text=U>>8&1),512&w.flags&&(D[0]=255&U,D[1]=U>>>8&255,w.check=l(w.check,D,2,0)),B=U=0,w.mode=3;case 3:for(;B<32;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}w.head&&(w.head.time=U),512&w.flags&&(D[0]=255&U,D[1]=U>>>8&255,D[2]=U>>>16&255,D[3]=U>>>24&255,w.check=l(w.check,D,4,0)),B=U=0,w.mode=4;case 4:for(;B<16;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}w.head&&(w.head.xflags=255&U,w.head.os=U>>8),512&w.flags&&(D[0]=255&U,D[1]=U>>>8&255,w.check=l(w.check,D,2,0)),B=U=0,w.mode=5;case 5:if(1024&w.flags){for(;B<16;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}w.length=U,w.head&&(w.head.extra_len=U),512&w.flags&&(D[0]=255&U,D[1]=U>>>8&255,w.check=l(w.check,D,2,0)),B=U=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(J<(K=w.length)&&(K=J),K&&(w.head&&(b=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),s.arraySet(w.head.extra,I,$,K,b)),512&w.flags&&(w.check=l(w.check,I,K,$)),J-=K,$+=K,w.length-=K),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(J===0)break e;for(K=0;b=I[$+K++],w.head&&b&&w.length<65536&&(w.head.name+=String.fromCharCode(b)),b&&K<J;);if(512&w.flags&&(w.check=l(w.check,I,K,$)),J-=K,$+=K,b)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(J===0)break e;for(K=0;b=I[$+K++],w.head&&b&&w.length<65536&&(w.head.comment+=String.fromCharCode(b)),b&&K<J;);if(512&w.flags&&(w.check=l(w.check,I,K,$)),J-=K,$+=K,b)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;B<16;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}if(U!==(65535&w.check)){S.msg="header crc mismatch",w.mode=30;break}B=U=0}w.head&&(w.head.hcrc=w.flags>>9&1,w.head.done=!0),S.adler=w.check=0,w.mode=12;break;case 10:for(;B<32;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}S.adler=w.check=y(U),B=U=0,w.mode=11;case 11:if(w.havedict===0)return S.next_out=F,S.avail_out=se,S.next_in=$,S.avail_in=J,w.hold=U,w.bits=B,2;S.adler=w.check=1,w.mode=12;case 12:if(R===5||R===6)break e;case 13:if(w.last){U>>>=7&B,B-=7&B,w.mode=27;break}for(;B<3;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}switch(w.last=1&U,B-=1,3&(U>>>=1)){case 0:w.mode=14;break;case 1:if(P(w),w.mode=20,R!==6)break;U>>>=2,B-=2;break e;case 2:w.mode=17;break;case 3:S.msg="invalid block type",w.mode=30}U>>>=2,B-=2;break;case 14:for(U>>>=7&B,B-=7&B;B<32;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}if((65535&U)!=(U>>>16^65535)){S.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&U,B=U=0,w.mode=15,R===6)break e;case 15:w.mode=16;case 16:if(K=w.length){if(J<K&&(K=J),se<K&&(K=se),K===0)break e;s.arraySet(V,I,$,K,F),J-=K,$+=K,se-=K,F+=K,w.length-=K;break}w.mode=12;break;case 17:for(;B<14;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}if(w.nlen=257+(31&U),U>>>=5,B-=5,w.ndist=1+(31&U),U>>>=5,B-=5,w.ncode=4+(15&U),U>>>=4,B-=4,286<w.nlen||30<w.ndist){S.msg="too many length or distance symbols",w.mode=30;break}w.have=0,w.mode=18;case 18:for(;w.have<w.ncode;){for(;B<3;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}w.lens[L[w.have++]]=7&U,U>>>=3,B-=3}for(;w.have<19;)w.lens[L[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,q={bits:w.lenbits},Y=u(0,w.lens,0,19,w.lencode,0,w.work,q),w.lenbits=q.bits,Y){S.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have<w.nlen+w.ndist;){for(;ae=(N=w.lencode[U&(1<<w.lenbits)-1])>>>16&255,he=65535&N,!((ie=N>>>24)<=B);){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}if(he<16)U>>>=ie,B-=ie,w.lens[w.have++]=he;else{if(he===16){for(T=ie+2;B<T;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}if(U>>>=ie,B-=ie,w.have===0){S.msg="invalid bit length repeat",w.mode=30;break}b=w.lens[w.have-1],K=3+(3&U),U>>>=2,B-=2}else if(he===17){for(T=ie+3;B<T;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}B-=ie,b=0,K=3+(7&(U>>>=ie)),U>>>=3,B-=3}else{for(T=ie+7;B<T;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}B-=ie,b=0,K=11+(127&(U>>>=ie)),U>>>=7,B-=7}if(w.have+K>w.nlen+w.ndist){S.msg="invalid bit length repeat",w.mode=30;break}for(;K--;)w.lens[w.have++]=b}}if(w.mode===30)break;if(w.lens[256]===0){S.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,q={bits:w.lenbits},Y=u(d,w.lens,0,w.nlen,w.lencode,0,w.work,q),w.lenbits=q.bits,Y){S.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,q={bits:w.distbits},Y=u(h,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,q),w.distbits=q.bits,Y){S.msg="invalid distances set",w.mode=30;break}if(w.mode=20,R===6)break e;case 20:w.mode=21;case 21:if(6<=J&&258<=se){S.next_out=F,S.avail_out=se,S.next_in=$,S.avail_in=J,w.hold=U,w.bits=B,c(S,ee),F=S.next_out,V=S.output,se=S.avail_out,$=S.next_in,I=S.input,J=S.avail_in,U=w.hold,B=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;ae=(N=w.lencode[U&(1<<w.lenbits)-1])>>>16&255,he=65535&N,!((ie=N>>>24)<=B);){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}if(ae&&(240&ae)==0){for(fe=ie,we=ae,Te=he;ae=(N=w.lencode[Te+((U&(1<<fe+we)-1)>>fe)])>>>16&255,he=65535&N,!(fe+(ie=N>>>24)<=B);){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}U>>>=fe,B-=fe,w.back+=fe}if(U>>>=ie,B-=ie,w.back+=ie,w.length=he,ae===0){w.mode=26;break}if(32&ae){w.back=-1,w.mode=12;break}if(64&ae){S.msg="invalid literal/length code",w.mode=30;break}w.extra=15&ae,w.mode=22;case 22:if(w.extra){for(T=w.extra;B<T;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}w.length+=U&(1<<w.extra)-1,U>>>=w.extra,B-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;ae=(N=w.distcode[U&(1<<w.distbits)-1])>>>16&255,he=65535&N,!((ie=N>>>24)<=B);){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}if((240&ae)==0){for(fe=ie,we=ae,Te=he;ae=(N=w.distcode[Te+((U&(1<<fe+we)-1)>>fe)])>>>16&255,he=65535&N,!(fe+(ie=N>>>24)<=B);){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}U>>>=fe,B-=fe,w.back+=fe}if(U>>>=ie,B-=ie,w.back+=ie,64&ae){S.msg="invalid distance code",w.mode=30;break}w.offset=he,w.extra=15&ae,w.mode=24;case 24:if(w.extra){for(T=w.extra;B<T;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}w.offset+=U&(1<<w.extra)-1,U>>>=w.extra,B-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){S.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(se===0)break e;if(K=ee-se,w.offset>K){if((K=w.offset-K)>w.whave&&w.sane){S.msg="invalid distance too far back",w.mode=30;break}ue=K>w.wnext?(K-=w.wnext,w.wsize-K):w.wnext-K,K>w.length&&(K=w.length),X=w.window}else X=V,ue=F-w.offset,K=w.length;for(se<K&&(K=se),se-=K,w.length-=K;V[F++]=X[ue++],--K;);w.length===0&&(w.mode=21);break;case 26:if(se===0)break e;V[F++]=w.length,se--,w.mode=21;break;case 27:if(w.wrap){for(;B<32;){if(J===0)break e;J--,U|=I[$++]<<B,B+=8}if(ee-=se,S.total_out+=ee,w.total+=ee,ee&&(S.adler=w.check=w.flags?l(w.check,V,ee,F-ee):i(w.check,V,ee,F-ee)),ee=se,(w.flags?U:y(U))!==w.check){S.msg="incorrect data check",w.mode=30;break}B=U=0}w.mode=28;case 28:if(w.wrap&&w.flags){for(;B<32;){if(J===0)break e;J--,U+=I[$++]<<B,B+=8}if(U!==(4294967295&w.total)){S.msg="incorrect length check",w.mode=30;break}B=U=0}w.mode=29;case 29:Y=1;break e;case 30:Y=-3;break e;case 31:return-4;default:return p}return S.next_out=F,S.avail_out=se,S.next_in=$,S.avail_in=J,w.hold=U,w.bits=B,(w.wsize||ee!==S.avail_out&&w.mode<30&&(w.mode<27||R!==4))&&Z(S,S.output,S.next_out,ee-S.avail_out)?(w.mode=31,-4):(te-=S.avail_in,ee-=S.avail_out,S.total_in+=te,S.total_out+=ee,w.total+=ee,w.wrap&&ee&&(S.adler=w.check=w.flags?l(w.check,V,ee,S.next_out-ee):i(w.check,V,ee,S.next_out-ee)),S.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(te==0&&ee===0||R===4)&&Y===m&&(Y=-5),Y)},o.inflateEnd=function(S){if(!S||!S.state)return p;var R=S.state;return R.window&&(R.window=null),S.state=null,m},o.inflateGetHeader=function(S,R){var w;return S&&S.state?(2&(w=S.state).wrap)==0?p:((w.head=R).done=!1,m):p},o.inflateSetDictionary=function(S,R){var w,I=R.length;return S&&S.state?(w=S.state).wrap!==0&&w.mode!==11?p:w.mode===11&&i(1,R,I,0)!==w.check?-3:Z(S,R,I,I)?(w.mode=31,-4):(w.havedict=1,m):p},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){var s=n("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,h,m,p,g,f,x,y){var _,k,C,j,z,E,A,O,P,Z=y.bits,S=0,R=0,w=0,I=0,V=0,$=0,F=0,J=0,se=0,U=0,B=null,te=0,ee=new s.Buf16(16),K=new s.Buf16(16),ue=null,X=0;for(S=0;S<=15;S++)ee[S]=0;for(R=0;R<p;R++)ee[h[m+R]]++;for(V=Z,I=15;1<=I&&ee[I]===0;I--);if(I<V&&(V=I),I===0)return g[f++]=20971520,g[f++]=20971520,y.bits=1,0;for(w=1;w<I&&ee[w]===0;w++);for(V<w&&(V=w),S=J=1;S<=15;S++)if(J<<=1,(J-=ee[S])<0)return-1;if(0<J&&(d===0||I!==1))return-1;for(K[1]=0,S=1;S<15;S++)K[S+1]=K[S]+ee[S];for(R=0;R<p;R++)h[m+R]!==0&&(x[K[h[m+R]]++]=R);if(E=d===0?(B=ue=x,19):d===1?(B=i,te-=257,ue=l,X-=257,256):(B=c,ue=u,-1),S=w,z=f,F=R=U=0,C=-1,j=(se=1<<($=V))-1,d===1&&852<se||d===2&&592<se)return 1;for(;;){for(A=S-F,P=x[R]<E?(O=0,x[R]):x[R]>E?(O=ue[X+x[R]],B[te+x[R]]):(O=96,0),_=1<<S-F,w=k=1<<$;g[z+(U>>F)+(k-=_)]=A<<24|O<<16|P|0,k!==0;);for(_=1<<S-1;U&_;)_>>=1;if(_!==0?(U&=_-1,U+=_):U=0,R++,--ee[S]==0){if(S===I)break;S=h[m+x[R]]}if(V<S&&(U&j)!==C){for(F===0&&(F=V),z+=w,J=1<<($=S-F);$+F<I&&!((J-=ee[$+F])<=0);)$++,J<<=1;if(se+=1<<$,d===1&&852<se||d===2&&592<se)return 1;g[C=U&j]=V<<24|$<<16|z-f|0}}return U!==0&&(g[z+U]=S-F<<24|64<<16|0),y.bits=V,0}},{"../utils/common":41}],51:[function(n,r,o){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){var s=n("../utils/common"),i=0,l=1;function c(N){for(var D=N.length;0<=--D;)N[D]=0}var u=0,d=29,h=256,m=h+1+d,p=30,g=19,f=2*m+1,x=15,y=16,_=7,k=256,C=16,j=17,z=18,E=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],A=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Z=new Array(2*(m+2));c(Z);var S=new Array(2*p);c(S);var R=new Array(512);c(R);var w=new Array(256);c(w);var I=new Array(d);c(I);var V,$,F,J=new Array(p);function se(N,D,L,H,M){this.static_tree=N,this.extra_bits=D,this.extra_base=L,this.elems=H,this.max_length=M,this.has_stree=N&&N.length}function U(N,D){this.dyn_tree=N,this.max_code=0,this.stat_desc=D}function B(N){return N<256?R[N]:R[256+(N>>>7)]}function te(N,D){N.pending_buf[N.pending++]=255&D,N.pending_buf[N.pending++]=D>>>8&255}function ee(N,D,L){N.bi_valid>y-L?(N.bi_buf|=D<<N.bi_valid&65535,te(N,N.bi_buf),N.bi_buf=D>>y-N.bi_valid,N.bi_valid+=L-y):(N.bi_buf|=D<<N.bi_valid&65535,N.bi_valid+=L)}function K(N,D,L){ee(N,L[2*D],L[2*D+1])}function ue(N,D){for(var L=0;L|=1&N,N>>>=1,L<<=1,0<--D;);return L>>>1}function X(N,D,L){var H,M,Q=new Array(x+1),oe=0;for(H=1;H<=x;H++)Q[H]=oe=oe+L[H-1]<<1;for(M=0;M<=D;M++){var ne=N[2*M+1];ne!==0&&(N[2*M]=ue(Q[ne]++,ne))}}function ie(N){var D;for(D=0;D<m;D++)N.dyn_ltree[2*D]=0;for(D=0;D<p;D++)N.dyn_dtree[2*D]=0;for(D=0;D<g;D++)N.bl_tree[2*D]=0;N.dyn_ltree[2*k]=1,N.opt_len=N.static_len=0,N.last_lit=N.matches=0}function ae(N){8<N.bi_valid?te(N,N.bi_buf):0<N.bi_valid&&(N.pending_buf[N.pending++]=N.bi_buf),N.bi_buf=0,N.bi_valid=0}function he(N,D,L,H){var M=2*D,Q=2*L;return N[M]<N[Q]||N[M]===N[Q]&&H[D]<=H[L]}function fe(N,D,L){for(var H=N.heap[L],M=L<<1;M<=N.heap_len&&(M<N.heap_len&&he(D,N.heap[M+1],N.heap[M],N.depth)&&M++,!he(D,H,N.heap[M],N.depth));)N.heap[L]=N.heap[M],L=M,M<<=1;N.heap[L]=H}function we(N,D,L){var H,M,Q,oe,ne=0;if(N.last_lit!==0)for(;H=N.pending_buf[N.d_buf+2*ne]<<8|N.pending_buf[N.d_buf+2*ne+1],M=N.pending_buf[N.l_buf+ne],ne++,H===0?K(N,M,D):(K(N,(Q=w[M])+h+1,D),(oe=E[Q])!==0&&ee(N,M-=I[Q],oe),K(N,Q=B(--H),L),(oe=A[Q])!==0&&ee(N,H-=J[Q],oe)),ne<N.last_lit;);K(N,k,D)}function Te(N,D){var L,H,M,Q=D.dyn_tree,oe=D.stat_desc.static_tree,ne=D.stat_desc.has_stree,pe=D.stat_desc.elems,Ae=-1;for(N.heap_len=0,N.heap_max=f,L=0;L<pe;L++)Q[2*L]!==0?(N.heap[++N.heap_len]=Ae=L,N.depth[L]=0):Q[2*L+1]=0;for(;N.heap_len<2;)Q[2*(M=N.heap[++N.heap_len]=Ae<2?++Ae:0)]=1,N.depth[M]=0,N.opt_len--,ne&&(N.static_len-=oe[2*M+1]);for(D.max_code=Ae,L=N.heap_len>>1;1<=L;L--)fe(N,Q,L);for(M=pe;L=N.heap[1],N.heap[1]=N.heap[N.heap_len--],fe(N,Q,1),H=N.heap[1],N.heap[--N.heap_max]=L,N.heap[--N.heap_max]=H,Q[2*M]=Q[2*L]+Q[2*H],N.depth[M]=(N.depth[L]>=N.depth[H]?N.depth[L]:N.depth[H])+1,Q[2*L+1]=Q[2*H+1]=M,N.heap[1]=M++,fe(N,Q,1),2<=N.heap_len;);N.heap[--N.heap_max]=N.heap[1],(function(ke,Ge){var vn,rt,yn,Me,Bn,Vr,ct=Ge.dyn_tree,As=Ge.max_code,Zu=Ge.stat_desc.static_tree,Wu=Ge.stat_desc.has_stree,Vu=Ge.stat_desc.extra_bits,zs=Ge.stat_desc.extra_base,bn=Ge.stat_desc.max_length,Un=0;for(Me=0;Me<=x;Me++)ke.bl_count[Me]=0;for(ct[2*ke.heap[ke.heap_max]+1]=0,vn=ke.heap_max+1;vn<f;vn++)bn<(Me=ct[2*ct[2*(rt=ke.heap[vn])+1]+1]+1)&&(Me=bn,Un++),ct[2*rt+1]=Me,As<rt||(ke.bl_count[Me]++,Bn=0,zs<=rt&&(Bn=Vu[rt-zs]),Vr=ct[2*rt],ke.opt_len+=Vr*(Me+Bn),Wu&&(ke.static_len+=Vr*(Zu[2*rt+1]+Bn)));if(Un!==0){do{for(Me=bn-1;ke.bl_count[Me]===0;)Me--;ke.bl_count[Me]--,ke.bl_count[Me+1]+=2,ke.bl_count[bn]--,Un-=2}while(0<Un);for(Me=bn;Me!==0;Me--)for(rt=ke.bl_count[Me];rt!==0;)As<(yn=ke.heap[--vn])||(ct[2*yn+1]!==Me&&(ke.opt_len+=(Me-ct[2*yn+1])*ct[2*yn],ct[2*yn+1]=Me),rt--)}})(N,D),X(Q,Ae,N.bl_count)}function b(N,D,L){var H,M,Q=-1,oe=D[1],ne=0,pe=7,Ae=4;for(oe===0&&(pe=138,Ae=3),D[2*(L+1)+1]=65535,H=0;H<=L;H++)M=oe,oe=D[2*(H+1)+1],++ne<pe&&M===oe||(ne<Ae?N.bl_tree[2*M]+=ne:M!==0?(M!==Q&&N.bl_tree[2*M]++,N.bl_tree[2*C]++):ne<=10?N.bl_tree[2*j]++:N.bl_tree[2*z]++,Q=M,Ae=(ne=0)===oe?(pe=138,3):M===oe?(pe=6,3):(pe=7,4))}function Y(N,D,L){var H,M,Q=-1,oe=D[1],ne=0,pe=7,Ae=4;for(oe===0&&(pe=138,Ae=3),H=0;H<=L;H++)if(M=oe,oe=D[2*(H+1)+1],!(++ne<pe&&M===oe)){if(ne<Ae)for(;K(N,M,N.bl_tree),--ne!=0;);else M!==0?(M!==Q&&(K(N,M,N.bl_tree),ne--),K(N,C,N.bl_tree),ee(N,ne-3,2)):ne<=10?(K(N,j,N.bl_tree),ee(N,ne-3,3)):(K(N,z,N.bl_tree),ee(N,ne-11,7));Q=M,Ae=(ne=0)===oe?(pe=138,3):M===oe?(pe=6,3):(pe=7,4)}}c(J);var q=!1;function T(N,D,L,H){ee(N,(u<<1)+(H?1:0),3),(function(M,Q,oe,ne){ae(M),te(M,oe),te(M,~oe),s.arraySet(M.pending_buf,M.window,Q,oe,M.pending),M.pending+=oe})(N,D,L)}o._tr_init=function(N){q||((function(){var D,L,H,M,Q,oe=new Array(x+1);for(M=H=0;M<d-1;M++)for(I[M]=H,D=0;D<1<<E[M];D++)w[H++]=M;for(w[H-1]=M,M=Q=0;M<16;M++)for(J[M]=Q,D=0;D<1<<A[M];D++)R[Q++]=M;for(Q>>=7;M<p;M++)for(J[M]=Q<<7,D=0;D<1<<A[M]-7;D++)R[256+Q++]=M;for(L=0;L<=x;L++)oe[L]=0;for(D=0;D<=143;)Z[2*D+1]=8,D++,oe[8]++;for(;D<=255;)Z[2*D+1]=9,D++,oe[9]++;for(;D<=279;)Z[2*D+1]=7,D++,oe[7]++;for(;D<=287;)Z[2*D+1]=8,D++,oe[8]++;for(X(Z,m+1,oe),D=0;D<p;D++)S[2*D+1]=5,S[2*D]=ue(D,5);V=new se(Z,E,h+1,m,x),$=new se(S,A,0,p,x),F=new se(new Array(0),O,0,g,_)})(),q=!0),N.l_desc=new U(N.dyn_ltree,V),N.d_desc=new U(N.dyn_dtree,$),N.bl_desc=new U(N.bl_tree,F),N.bi_buf=0,N.bi_valid=0,ie(N)},o._tr_stored_block=T,o._tr_flush_block=function(N,D,L,H){var M,Q,oe=0;0<N.level?(N.strm.data_type===2&&(N.strm.data_type=(function(ne){var pe,Ae=4093624447;for(pe=0;pe<=31;pe++,Ae>>>=1)if(1&Ae&&ne.dyn_ltree[2*pe]!==0)return i;if(ne.dyn_ltree[18]!==0||ne.dyn_ltree[20]!==0||ne.dyn_ltree[26]!==0)return l;for(pe=32;pe<h;pe++)if(ne.dyn_ltree[2*pe]!==0)return l;return i})(N)),Te(N,N.l_desc),Te(N,N.d_desc),oe=(function(ne){var pe;for(b(ne,ne.dyn_ltree,ne.l_desc.max_code),b(ne,ne.dyn_dtree,ne.d_desc.max_code),Te(ne,ne.bl_desc),pe=g-1;3<=pe&&ne.bl_tree[2*P[pe]+1]===0;pe--);return ne.opt_len+=3*(pe+1)+5+5+4,pe})(N),M=N.opt_len+3+7>>>3,(Q=N.static_len+3+7>>>3)<=M&&(M=Q)):M=Q=L+5,L+4<=M&&D!==-1?T(N,D,L,H):N.strategy===4||Q===M?(ee(N,2+(H?1:0),3),we(N,Z,S)):(ee(N,4+(H?1:0),3),(function(ne,pe,Ae,ke){var Ge;for(ee(ne,pe-257,5),ee(ne,Ae-1,5),ee(ne,ke-4,4),Ge=0;Ge<ke;Ge++)ee(ne,ne.bl_tree[2*P[Ge]+1],3);Y(ne,ne.dyn_ltree,pe-1),Y(ne,ne.dyn_dtree,Ae-1)})(N,N.l_desc.max_code+1,N.d_desc.max_code+1,oe+1),we(N,N.dyn_ltree,N.dyn_dtree)),ie(N),H&&ae(N)},o._tr_tally=function(N,D,L){return N.pending_buf[N.d_buf+2*N.last_lit]=D>>>8&255,N.pending_buf[N.d_buf+2*N.last_lit+1]=255&D,N.pending_buf[N.l_buf+N.last_lit]=255&L,N.last_lit++,D===0?N.dyn_ltree[2*L]++:(N.matches++,D--,N.dyn_ltree[2*(w[L]+h+1)]++,N.dyn_dtree[2*B(D)]++),N.last_lit===N.lit_bufsize-1},o._tr_align=function(N){ee(N,2,3),K(N,k,Z),(function(D){D.bi_valid===16?(te(D,D.bi_buf),D.bi_buf=0,D.bi_valid=0):8<=D.bi_valid&&(D.pending_buf[D.pending++]=255&D.bi_buf,D.bi_buf>>=8,D.bi_valid-=8)})(N)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(s){(function(i,l){if(!i.setImmediate){var c,u,d,h,m=1,p={},g=!1,f=i.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(i);x=x&&x.setTimeout?x:i,c={}.toString.call(i.process)==="[object process]"?function(C){process.nextTick(function(){_(C)})}:(function(){if(i.postMessage&&!i.importScripts){var C=!0,j=i.onmessage;return i.onmessage=function(){C=!1},i.postMessage("","*"),i.onmessage=j,C}})()?(h="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",k,!1):i.attachEvent("onmessage",k),function(C){i.postMessage(h+C,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){_(C.data)},function(C){d.port2.postMessage(C)}):f&&"onreadystatechange"in f.createElement("script")?(u=f.documentElement,function(C){var j=f.createElement("script");j.onreadystatechange=function(){_(C),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(C){setTimeout(_,0,C)},x.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var j=new Array(arguments.length-1),z=0;z<j.length;z++)j[z]=arguments[z+1];var E={callback:C,args:j};return p[m]=E,c(m),m++},x.clearImmediate=y}function y(C){delete p[C]}function _(C){if(g)setTimeout(_,0,C);else{var j=p[C];if(j){g=!0;try{(function(z){var E=z.callback,A=z.args;switch(A.length){case 0:E();break;case 1:E(A[0]);break;case 2:E(A[0],A[1]);break;case 3:E(A[0],A[1],A[2]);break;default:E.apply(l,A)}})(j)}finally{y(C),g=!1}}}}function k(C){C.source===i&&typeof C.data=="string"&&C.data.indexOf(h)===0&&_(+C.data.slice(h.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof Zn<"u"?Zn:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Jr)),Jr.exports}var G0=K0();const Y0=Hu(G0);async function X0(e){try{const t=await fetch(`/api/logs/${e}/chunks`);if(!t.ok)return null;const n=await t.json();return JSON.stringify(n,null,2)}catch{return null}}async function Q0(e){const t=new Y0;for(const i of e)i.rawRequestBody!==null&&t.file(`#${i.id}.Request.json`,i.rawRequestBody),i.responseText!==null&&t.file(`#${i.id}.Response.json`,i.responseText);const n=e.filter(i=>i.streaming);await Promise.allSettled(n.map(async i=>{const l=await X0(i.id);l!==null&&t.file(`#${i.id}.SSE.Response.json`,l)}));const r=await t.generateAsync({type:"blob"}),o=URL.createObjectURL(r),s=document.createElement("a");s.href=o,s.download=`agent-inspector-export-${new Date().toISOString().slice(0,10)}.zip`,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o)}function cl(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=cl(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ul(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=cl(e))&&(r&&(r+=" "),r+=t);return r}const e1=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},t1=(e,t)=>({classGroupId:e,validator:t}),dl=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),mr="-",ii=[],n1="arbitrary..",r1=e=>{const t=s1(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return o1(i);const l=i.split(mr),c=l[0]===""&&l.length>1?1:0;return fl(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=r[i],u=n[i];return c?u?e1(u,c):c:u||ii}return n[i]||ii}}},fl=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const u=fl(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const l=t===0?e.join(mr):e.slice(t).join(mr),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(l))return d.classGroupId}},o1=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?n1+r:void 0})(),s1=e=>{const{theme:t,classGroups:n}=e;return i1(n,t)},i1=(e,t)=>{const n=dl();for(const r in e){const o=e[r];os(o,n,r,t)}return n},os=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const i=e[s];a1(i,t,n,r)}},a1=(e,t,n,r)=>{if(typeof e=="string"){l1(e,t,n);return}if(typeof e=="function"){c1(e,t,n,r);return}u1(e,t,n,r)},l1=(e,t,n)=>{const r=e===""?t:hl(t,e);r.classGroupId=n},c1=(e,t,n,r)=>{if(d1(e)){os(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(t1(n,e))},u1=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let i=0;i<s;i++){const[l,c]=o[i];os(c,hl(t,l),n,r)}},hl=(e,t)=>{let n=e;const r=t.split(mr),o=r.length;for(let s=0;s<o;s++){const i=r[s];let l=n.nextPart.get(i);l||(l=dl(),n.nextPart.set(i,l)),n=l}return n},d1=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,f1=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(s,i)=>{n[s]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let i=n[s];if(i!==void 0)return i;if((i=r[s])!==void 0)return o(s,i),i},set(s,i){s in n?n[s]=i:o(s,i)}}},ko="!",ai=":",h1=[],li=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),p1=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,l=0,c=0,u;const d=o.length;for(let f=0;f<d;f++){const x=o[f];if(i===0&&l===0){if(x===ai){s.push(o.slice(c,f)),c=f+1;continue}if(x==="/"){u=f;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const h=s.length===0?o:o.slice(c);let m=h,p=!1;h.endsWith(ko)?(m=h.slice(0,-1),p=!0):h.startsWith(ko)&&(m=h.slice(1),p=!0);const g=u&&u>c?u-c:void 0;return li(s,p,m,g)};if(t){const o=t+ai,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):li(h1,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},m1=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const i=n[s],l=i[0]==="[",c=t.has(i);l||c?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(i)):o.push(i)}return o.length>0&&(o.sort(),r.push(...o)),r}},g1=e=>({cache:f1(e.cacheSize),parseClassName:p1(e),sortModifiers:m1(e),...r1(e)}),x1=/\s+/,v1=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],l=e.trim().split(x1);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:h,modifiers:m,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:f}=n(d);if(h){c=d+(c.length>0?" "+c:c);continue}let x=!!f,y=r(x?g.substring(0,f):g);if(!y){if(!x){c=d+(c.length>0?" "+c:c);continue}if(y=r(g),!y){c=d+(c.length>0?" "+c:c);continue}x=!1}const _=m.length===0?"":m.length===1?m[0]:s(m).join(":"),k=p?_+ko:_,C=k+y;if(i.indexOf(C)>-1)continue;i.push(C);const j=o(y,x);for(let z=0;z<j.length;++z){const E=j[z];i.push(k+E)}c=d+(c.length>0?" "+c:c)}return c},y1=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=pl(n))&&(o&&(o+=" "),o+=r);return o},pl=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=pl(e[r]))&&(n&&(n+=" "),n+=t);return n},b1=(e,...t)=>{let n,r,o,s;const i=c=>{const u=t.reduce((d,h)=>h(d),e());return n=g1(u),r=n.cache.get,o=n.cache.set,s=l,l(c)},l=c=>{const u=r(c);if(u)return u;const d=v1(c,n);return o(c,d),d};return s=i,(...c)=>s(y1(...c))},w1=[],Fe=e=>{const t=n=>n[e]||w1;return t.isThemeGetter=!0,t},ml=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,gl=/^\((?:(\w[\w-]*):)?(.+)\)$/i,_1=/^\d+\/\d+$/,k1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,C1=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,S1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,j1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,E1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Zt=e=>_1.test(e),be=e=>!!e&&!Number.isNaN(Number(e)),vt=e=>!!e&&Number.isInteger(Number(e)),Kr=e=>e.endsWith("%")&&be(e.slice(0,-1)),ut=e=>k1.test(e),N1=()=>!0,T1=e=>C1.test(e)&&!S1.test(e),xl=()=>!1,A1=e=>j1.test(e),z1=e=>E1.test(e),O1=e=>!le(e)&&!ce(e),R1=e=>fn(e,bl,xl),le=e=>ml.test(e),At=e=>fn(e,wl,T1),Gr=e=>fn(e,L1,be),ci=e=>fn(e,vl,xl),I1=e=>fn(e,yl,z1),Jn=e=>fn(e,_l,A1),ce=e=>gl.test(e),wn=e=>hn(e,wl),P1=e=>hn(e,F1),ui=e=>hn(e,vl),M1=e=>hn(e,bl),D1=e=>hn(e,yl),Kn=e=>hn(e,_l,!0),fn=(e,t,n)=>{const r=ml.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},hn=(e,t,n=!1)=>{const r=gl.exec(e);return r?r[1]?t(r[1]):n:!1},vl=e=>e==="position"||e==="percentage",yl=e=>e==="image"||e==="url",bl=e=>e==="length"||e==="size"||e==="bg-size",wl=e=>e==="length",L1=e=>e==="number",F1=e=>e==="family-name",_l=e=>e==="shadow",$1=()=>{const e=Fe("color"),t=Fe("font"),n=Fe("text"),r=Fe("font-weight"),o=Fe("tracking"),s=Fe("leading"),i=Fe("breakpoint"),l=Fe("container"),c=Fe("spacing"),u=Fe("radius"),d=Fe("shadow"),h=Fe("inset-shadow"),m=Fe("text-shadow"),p=Fe("drop-shadow"),g=Fe("blur"),f=Fe("perspective"),x=Fe("aspect"),y=Fe("ease"),_=Fe("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...C(),ce,le],z=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],A=()=>[ce,le,c],O=()=>[Zt,"full","auto",...A()],P=()=>[vt,"none","subgrid",ce,le],Z=()=>["auto",{span:["full",vt,ce,le]},vt,ce,le],S=()=>[vt,"auto",ce,le],R=()=>["auto","min","max","fr",ce,le],w=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],I=()=>["start","end","center","stretch","center-safe","end-safe"],V=()=>["auto",...A()],$=()=>[Zt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],F=()=>[e,ce,le],J=()=>[...C(),ui,ci,{position:[ce,le]}],se=()=>["no-repeat",{repeat:["","x","y","space","round"]}],U=()=>["auto","cover","contain",M1,R1,{size:[ce,le]}],B=()=>[Kr,wn,At],te=()=>["","none","full",u,ce,le],ee=()=>["",be,wn,At],K=()=>["solid","dashed","dotted","double"],ue=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[be,Kr,ui,ci],ie=()=>["","none",g,ce,le],ae=()=>["none",be,ce,le],he=()=>["none",be,ce,le],fe=()=>[be,ce,le],we=()=>[Zt,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ut],breakpoint:[ut],color:[N1],container:[ut],"drop-shadow":[ut],ease:["in","out","in-out"],font:[O1],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ut],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ut],shadow:[ut],spacing:["px",be],text:[ut],"text-shadow":[ut],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Zt,le,ce,x]}],container:["container"],columns:[{columns:[be,le,ce,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:j()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{start:O()}],end:[{end:O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[vt,"auto",ce,le]}],basis:[{basis:[Zt,"full","auto",l,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[be,Zt,"auto","initial","none",le]}],grow:[{grow:["",be,ce,le]}],shrink:[{shrink:["",be,ce,le]}],order:[{order:[vt,"first","last","none",ce,le]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:Z()}],"col-start":[{"col-start":S()}],"col-end":[{"col-end":S()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:Z()}],"row-start":[{"row-start":S()}],"row-end":[{"row-end":S()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...w(),"normal"]}],"justify-items":[{"justify-items":[...I(),"normal"]}],"justify-self":[{"justify-self":["auto",...I()]}],"align-content":[{content:["normal",...w()]}],"align-items":[{items:[...I(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...I(),{baseline:["","last"]}]}],"place-content":[{"place-content":w()}],"place-items":[{"place-items":[...I(),"baseline"]}],"place-self":[{"place-self":["auto",...I()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:V()}],mx:[{mx:V()}],my:[{my:V()}],ms:[{ms:V()}],me:[{me:V()}],mt:[{mt:V()}],mr:[{mr:V()}],mb:[{mb:V()}],ml:[{ml:V()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],w:[{w:[l,"screen",...$()]}],"min-w":[{"min-w":[l,"screen","none",...$()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...$()]}],h:[{h:["screen","lh",...$()]}],"min-h":[{"min-h":["screen","lh","none",...$()]}],"max-h":[{"max-h":["screen","lh",...$()]}],"font-size":[{text:["base",n,wn,At]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ce,Gr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Kr,le]}],"font-family":[{font:[P1,le,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ce,le]}],"line-clamp":[{"line-clamp":[be,"none",ce,Gr]}],leading:[{leading:[s,...A()]}],"list-image":[{"list-image":["none",ce,le]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ce,le]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:[be,"from-font","auto",ce,At]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[be,"auto",ce,le]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ce,le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ce,le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:J()}],"bg-repeat":[{bg:se()}],"bg-size":[{bg:U()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},vt,ce,le],radial:["",ce,le],conic:[vt,ce,le]},D1,I1]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:te()}],"rounded-s":[{"rounded-s":te()}],"rounded-e":[{"rounded-e":te()}],"rounded-t":[{"rounded-t":te()}],"rounded-r":[{"rounded-r":te()}],"rounded-b":[{"rounded-b":te()}],"rounded-l":[{"rounded-l":te()}],"rounded-ss":[{"rounded-ss":te()}],"rounded-se":[{"rounded-se":te()}],"rounded-ee":[{"rounded-ee":te()}],"rounded-es":[{"rounded-es":te()}],"rounded-tl":[{"rounded-tl":te()}],"rounded-tr":[{"rounded-tr":te()}],"rounded-br":[{"rounded-br":te()}],"rounded-bl":[{"rounded-bl":te()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...K(),"hidden","none"]}],"divide-style":[{divide:[...K(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...K(),"none","hidden"]}],"outline-offset":[{"outline-offset":[be,ce,le]}],"outline-w":[{outline:["",be,wn,At]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",d,Kn,Jn]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",h,Kn,Jn]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[be,At]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",m,Kn,Jn]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[be,ce,le]}],"mix-blend":[{"mix-blend":[...ue(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ue()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[be]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[ce,le]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[be]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:J()}],"mask-repeat":[{mask:se()}],"mask-size":[{mask:U()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ce,le]}],filter:[{filter:["","none",ce,le]}],blur:[{blur:ie()}],brightness:[{brightness:[be,ce,le]}],contrast:[{contrast:[be,ce,le]}],"drop-shadow":[{"drop-shadow":["","none",p,Kn,Jn]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",be,ce,le]}],"hue-rotate":[{"hue-rotate":[be,ce,le]}],invert:[{invert:["",be,ce,le]}],saturate:[{saturate:[be,ce,le]}],sepia:[{sepia:["",be,ce,le]}],"backdrop-filter":[{"backdrop-filter":["","none",ce,le]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[be,ce,le]}],"backdrop-contrast":[{"backdrop-contrast":[be,ce,le]}],"backdrop-grayscale":[{"backdrop-grayscale":["",be,ce,le]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[be,ce,le]}],"backdrop-invert":[{"backdrop-invert":["",be,ce,le]}],"backdrop-opacity":[{"backdrop-opacity":[be,ce,le]}],"backdrop-saturate":[{"backdrop-saturate":[be,ce,le]}],"backdrop-sepia":[{"backdrop-sepia":["",be,ce,le]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ce,le]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[be,"initial",ce,le]}],ease:[{ease:["linear","initial",y,ce,le]}],delay:[{delay:[be,ce,le]}],animate:[{animate:["none",_,ce,le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,ce,le]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[ce,le,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:we()}],"translate-x":[{"translate-x":we()}],"translate-y":[{"translate-y":we()}],"translate-z":[{"translate-z":we()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ce,le]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ce,le]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[be,wn,At,Gr]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},B1=b1($1);function xe(...e){return B1(ul(e))}function Je(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":(e/1e3).toFixed(1).replace(/\.0$/,"")+"K"}function U1(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const Z1="2.0.0",W1={version:Z1},di=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,fi=ul,ss=(e,t)=>n=>{var r;if(t?.variants==null)return fi(e,n?.class,n?.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(u=>{const d=n?.[u],h=s?.[u];if(d===null)return null;const m=di(d)||di(h);return o[u][m]}),l=n&&Object.entries(n).reduce((u,d)=>{let[h,m]=d;return m===void 0||(u[h]=m),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:h,className:m,...p}=d;return Object.entries(p).every(g=>{let[f,x]=g;return Array.isArray(x)?x.includes({...s,...l}[f]):{...s,...l}[f]===x})?[...u,h,m]:u},[]);return fi(e,i,c,n?.class,n?.className)};function hi(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function kl(...e){return t=>{let n=!1;const r=e.map(o=>{const s=hi(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():hi(e[o],null)}}}}function Re(...e){return v.useCallback(kl(...e),e)}function an(e){const t=H1(e),n=v.forwardRef((r,o)=>{const{children:s,...i}=r,l=v.Children.toArray(s),c=l.find(J1);if(c){const u=c.props.children,d=l.map(h=>h===c?v.Children.count(u)>1?v.Children.only(null):v.isValidElement(u)?u.props.children:null:h);return a.jsx(t,{...i,ref:o,children:v.isValidElement(u)?v.cloneElement(u,void 0,d):null})}return a.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var V1=an("Slot");function H1(e){const t=v.forwardRef((n,r)=>{const{children:o,...s}=n;if(v.isValidElement(o)){const i=G1(o),l=K1(s,o.props);return o.type!==v.Fragment&&(l.ref=r?kl(r,i):i),v.cloneElement(o,l)}return v.Children.count(o)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Cl=Symbol("radix.slottable");function q1(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Cl,t}function J1(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Cl}function K1(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{const c=s(...l);return o(...l),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function G1(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Y1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ce=Y1.reduce((e,t)=>{const n=an(`Primitive.${t}`),r=v.forwardRef((o,s)=>{const{asChild:i,...l}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function X1(e,t){e&&In.flushSync(()=>e.dispatchEvent(t))}var Sl=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Q1="VisuallyHidden",jl=v.forwardRef((e,t)=>a.jsx(Ce.span,{...e,ref:t,style:{...Sl,...e.style}}));jl.displayName=Q1;var ex=jl;function tx(e,t){const n=v.createContext(t),r=s=>{const{children:i,...l}=s,c=v.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=v.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function $t(e,t=[]){let n=[];function r(s,i){const l=v.createContext(i),c=n.length;n=[...n,i];const u=h=>{const{scope:m,children:p,...g}=h,f=m?.[e]?.[c]||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(f.Provider,{value:x,children:p})};u.displayName=s+"Provider";function d(h,m){const p=m?.[e]?.[c]||l,g=v.useContext(p);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${s}\``)}return[u,d]}const o=()=>{const s=n.map(i=>v.createContext(i));return function(l){const c=l?.[e]||s;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,nx(o,...t)]}function nx(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((l,{useScope:c,scopeName:u})=>{const h=c(s)[`__scope${u}`];return{...l,...h}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function El(e){const t=e+"CollectionProvider",[n,r]=$t(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=f=>{const{scope:x,children:y}=f,_=We.useRef(null),k=We.useRef(new Map).current;return a.jsx(o,{scope:x,itemMap:k,collectionRef:_,children:y})};i.displayName=t;const l=e+"CollectionSlot",c=an(l),u=We.forwardRef((f,x)=>{const{scope:y,children:_}=f,k=s(l,y),C=Re(x,k.collectionRef);return a.jsx(c,{ref:C,children:_})});u.displayName=l;const d=e+"CollectionItemSlot",h="data-radix-collection-item",m=an(d),p=We.forwardRef((f,x)=>{const{scope:y,children:_,...k}=f,C=We.useRef(null),j=Re(x,C),z=s(d,y);return We.useEffect(()=>(z.itemMap.set(C,{ref:C,...k}),()=>{z.itemMap.delete(C)})),a.jsx(m,{[h]:"",ref:j,children:_})});p.displayName=d;function g(f){const x=s(e+"CollectionConsumer",f);return We.useCallback(()=>{const _=x.collectionRef.current;if(!_)return[];const k=Array.from(_.querySelectorAll(`[${h}]`));return Array.from(x.itemMap.values()).sort((z,E)=>k.indexOf(z.ref.current)-k.indexOf(E.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:u,ItemSlot:p},g,r]}function ye(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var Ue=globalThis?.document?v.useLayoutEffect:()=>{},rx=da[" useInsertionEffect ".trim().toString()]||Ue;function ln({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=ox({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const d=v.useRef(e!==void 0);v.useEffect(()=>{const h=d.current;h!==l&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,r])}const u=v.useCallback(d=>{if(l){const h=sx(d)?d(e):d;h!==e&&i.current?.(h)}else s(d)},[l,e,s,i]);return[c,u]}function ox({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),o=v.useRef(n),s=v.useRef(t);return rx(()=>{s.current=t},[t]),v.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function sx(e){return typeof e=="function"}function ix(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var Bt=e=>{const{present:t,children:n}=e,r=ax(t),o=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),s=Re(r.ref,lx(o));return typeof n=="function"||r.isPresent?v.cloneElement(o,{ref:s}):null};Bt.displayName="Presence";function ax(e){const[t,n]=v.useState(),r=v.useRef(null),o=v.useRef(e),s=v.useRef("none"),i=e?"mounted":"unmounted",[l,c]=ix(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=Gn(r.current);s.current=l==="mounted"?u:"none"},[l]),Ue(()=>{const u=r.current,d=o.current;if(d!==e){const m=s.current,p=Gn(u);e?c("MOUNT"):p==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&m!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),Ue(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,h=p=>{const f=Gn(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&f&&(c("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},m=p=>{p.target===t&&(s.current=Gn(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:v.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Gn(e){return e?.animationName||"none"}function lx(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var cx=da[" useId ".trim().toString()]||(()=>{}),ux=0;function ht(e){const[t,n]=v.useState(cx());return Ue(()=>{n(r=>r??String(ux++))},[e]),e||(t?`radix-${t}`:"")}var dx=v.createContext(void 0);function is(e){const t=v.useContext(dx);return e||t||"ltr"}function _t(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>t.current?.(...n),[])}function fx(e,t=globalThis?.document){const n=_t(e);v.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var hx="DismissableLayer",Co="dismissableLayer.update",px="dismissableLayer.pointerDownOutside",mx="dismissableLayer.focusOutside",pi,Nl=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ar=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,u=v.useContext(Nl),[d,h]=v.useState(null),m=d?.ownerDocument??globalThis?.document,[,p]=v.useState({}),g=Re(t,E=>h(E)),f=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=f.indexOf(x),_=d?f.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,C=_>=y,j=vx(E=>{const A=E.target,O=[...u.branches].some(P=>P.contains(A));!C||O||(o?.(E),i?.(E),E.defaultPrevented||l?.())},m),z=yx(E=>{const A=E.target;[...u.branches].some(P=>P.contains(A))||(s?.(E),i?.(E),E.defaultPrevented||l?.())},m);return fx(E=>{_===u.layers.size-1&&(r?.(E),!E.defaultPrevented&&l&&(E.preventDefault(),l()))},m),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(pi=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),mi(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=pi)}},[d,m,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),mi())},[d,u]),v.useEffect(()=>{const E=()=>p({});return document.addEventListener(Co,E),()=>document.removeEventListener(Co,E)},[]),a.jsx(Ce.div,{...c,ref:g,style:{pointerEvents:k?C?"auto":"none":void 0,...e.style},onFocusCapture:ye(e.onFocusCapture,z.onFocusCapture),onBlurCapture:ye(e.onBlurCapture,z.onBlurCapture),onPointerDownCapture:ye(e.onPointerDownCapture,j.onPointerDownCapture)})});Ar.displayName=hx;var gx="DismissableLayerBranch",xx=v.forwardRef((e,t)=>{const n=v.useContext(Nl),r=v.useRef(null),o=Re(t,r);return v.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),a.jsx(Ce.div,{...e,ref:o})});xx.displayName=gx;function vx(e,t=globalThis?.document){const n=_t(e),r=v.useRef(!1),o=v.useRef(()=>{});return v.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){Tl(px,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function yx(e,t=globalThis?.document){const n=_t(e),r=v.useRef(!1);return v.useEffect(()=>{const o=s=>{s.target&&!r.current&&Tl(mx,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function mi(){const e=new CustomEvent(Co);document.dispatchEvent(e)}function Tl(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?X1(o,s):o.dispatchEvent(s)}var Yr="focusScope.autoFocusOnMount",Xr="focusScope.autoFocusOnUnmount",gi={bubbles:!1,cancelable:!0},bx="FocusScope",as=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[l,c]=v.useState(null),u=_t(o),d=_t(s),h=v.useRef(null),m=Re(t,f=>c(f)),p=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let f=function(k){if(p.paused||!l)return;const C=k.target;l.contains(C)?h.current=C:yt(h.current,{select:!0})},x=function(k){if(p.paused||!l)return;const C=k.relatedTarget;C!==null&&(l.contains(C)||yt(h.current,{select:!0}))},y=function(k){if(document.activeElement===document.body)for(const j of k)j.removedNodes.length>0&&yt(l)};document.addEventListener("focusin",f),document.addEventListener("focusout",x);const _=new MutationObserver(y);return l&&_.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",x),_.disconnect()}}},[r,l,p.paused]),v.useEffect(()=>{if(l){vi.add(p);const f=document.activeElement;if(!l.contains(f)){const y=new CustomEvent(Yr,gi);l.addEventListener(Yr,u),l.dispatchEvent(y),y.defaultPrevented||(wx(jx(Al(l)),{select:!0}),document.activeElement===f&&yt(l))}return()=>{l.removeEventListener(Yr,u),setTimeout(()=>{const y=new CustomEvent(Xr,gi);l.addEventListener(Xr,d),l.dispatchEvent(y),y.defaultPrevented||yt(f??document.body,{select:!0}),l.removeEventListener(Xr,d),vi.remove(p)},0)}}},[l,u,d,p]);const g=v.useCallback(f=>{if(!n&&!r||p.paused)return;const x=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,y=document.activeElement;if(x&&y){const _=f.currentTarget,[k,C]=_x(_);k&&C?!f.shiftKey&&y===C?(f.preventDefault(),n&&yt(k,{select:!0})):f.shiftKey&&y===k&&(f.preventDefault(),n&&yt(C,{select:!0})):y===_&&f.preventDefault()}},[n,r,p.paused]);return a.jsx(Ce.div,{tabIndex:-1,...i,ref:m,onKeyDown:g})});as.displayName=bx;function wx(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(yt(r,{select:t}),document.activeElement!==n)return}function _x(e){const t=Al(e),n=xi(t,e),r=xi(t.reverse(),e);return[n,r]}function Al(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function xi(e,t){for(const n of e)if(!kx(n,{upTo:t}))return n}function kx(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Cx(e){return e instanceof HTMLInputElement&&"select"in e}function yt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Cx(e)&&t&&e.select()}}var vi=Sx();function Sx(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=yi(e,t),e.unshift(t)},remove(t){e=yi(e,t),e[0]?.resume()}}}function yi(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function jx(e){return e.filter(t=>t.tagName!=="A")}var Ex="Portal",zr=v.forwardRef((e,t)=>{const{container:n,...r}=e,[o,s]=v.useState(!1);Ue(()=>s(!0),[]);const i=n||o&&globalThis?.document?.body;return i?qu.createPortal(a.jsx(Ce.div,{...r,ref:t}),i):null});zr.displayName=Ex;var Qr=0;function zl(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??bi()),document.body.insertAdjacentElement("beforeend",e[1]??bi()),Qr++,()=>{Qr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Qr--}},[])}function bi(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ot=function(){return ot=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},ot.apply(this,arguments)};function Ol(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Nx(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var ir="right-scroll-bar-position",ar="width-before-scroll-bar",Tx="with-scroll-bars-hidden",Ax="--removed-body-scroll-bar-size";function eo(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function zx(e,t){var n=v.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Ox=typeof window<"u"?v.useLayoutEffect:v.useEffect,wi=new WeakMap;function Rx(e,t){var n=zx(null,function(r){return e.forEach(function(o){return eo(o,r)})});return Ox(function(){var r=wi.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(l){s.has(l)||eo(l,null)}),s.forEach(function(l){o.has(l)||eo(l,i)})}wi.set(n,e)},[e]),n}function Ix(e){return e}function Px(e,t){t===void 0&&(t=Ix);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var l=n;n=[],l.forEach(s),i=n}var c=function(){var d=i;i=[],d.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){i.push(d),u()},filter:function(d){return i=i.filter(d),n}}}};return o}function Mx(e){e===void 0&&(e={});var t=Px(null);return t.options=ot({async:!0,ssr:!1},e),t}var Rl=function(e){var t=e.sideCar,n=Ol(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return v.createElement(r,ot({},n))};Rl.isSideCarExport=!0;function Dx(e,t){return e.useMedium(t),Rl}var Il=Mx(),to=function(){},Or=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:to,onWheelCapture:to,onTouchMoveCapture:to}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,h=e.shards,m=e.sideCar,p=e.noRelative,g=e.noIsolation,f=e.inert,x=e.allowPinchZoom,y=e.as,_=y===void 0?"div":y,k=e.gapMode,C=Ol(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=m,z=Rx([n,t]),E=ot(ot({},C),o);return v.createElement(v.Fragment,null,d&&v.createElement(j,{sideCar:Il,removeScrollBar:u,shards:h,noRelative:p,noIsolation:g,inert:f,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:k}),i?v.cloneElement(v.Children.only(l),ot(ot({},E),{ref:z})):v.createElement(_,ot({},E,{className:c,ref:z}),l))});Or.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Or.classNames={fullWidth:ar,zeroRight:ir};var Lx=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Fx(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Lx();return t&&e.setAttribute("nonce",t),e}function $x(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Bx(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Ux=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Fx())&&($x(t,n),Bx(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Zx=function(){var e=Ux();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Pl=function(){var e=Zx(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Wx={left:0,top:0,right:0,gap:0},no=function(e){return parseInt(e||"",10)||0},Vx=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[no(n),no(r),no(o)]},Hx=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Wx;var t=Vx(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},qx=Pl(),Qt="data-scroll-locked",Jx=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),`
42
+ .`.concat(Tx,` {
43
+ overflow: hidden `).concat(r,`;
44
+ padding-right: `).concat(l,"px ").concat(r,`;
45
+ }
46
+ body[`).concat(Qt,`] {
47
+ overflow: hidden `).concat(r,`;
48
+ overscroll-behavior: contain;
49
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
50
+ padding-left: `.concat(o,`px;
51
+ padding-top: `).concat(s,`px;
52
+ padding-right: `).concat(i,`px;
53
+ margin-left:0;
54
+ margin-top:0;
55
+ margin-right: `).concat(l,"px ").concat(r,`;
56
+ `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
57
+ }
58
+
59
+ .`).concat(ir,` {
60
+ right: `).concat(l,"px ").concat(r,`;
61
+ }
62
+
63
+ .`).concat(ar,` {
64
+ margin-right: `).concat(l,"px ").concat(r,`;
65
+ }
66
+
67
+ .`).concat(ir," .").concat(ir,` {
68
+ right: 0 `).concat(r,`;
69
+ }
70
+
71
+ .`).concat(ar," .").concat(ar,` {
72
+ margin-right: 0 `).concat(r,`;
73
+ }
74
+
75
+ body[`).concat(Qt,`] {
76
+ `).concat(Ax,": ").concat(l,`px;
77
+ }
78
+ `)},_i=function(){var e=parseInt(document.body.getAttribute(Qt)||"0",10);return isFinite(e)?e:0},Kx=function(){v.useEffect(function(){return document.body.setAttribute(Qt,(_i()+1).toString()),function(){var e=_i()-1;e<=0?document.body.removeAttribute(Qt):document.body.setAttribute(Qt,e.toString())}},[])},Gx=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Kx();var s=v.useMemo(function(){return Hx(o)},[o]);return v.createElement(qx,{styles:Jx(s,!t,o,n?"":"!important")})},So=!1;if(typeof window<"u")try{var Yn=Object.defineProperty({},"passive",{get:function(){return So=!0,!0}});window.addEventListener("test",Yn,Yn),window.removeEventListener("test",Yn,Yn)}catch{So=!1}var Wt=So?{passive:!1}:!1,Yx=function(e){return e.tagName==="TEXTAREA"},Ml=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Yx(e)&&n[t]==="visible")},Xx=function(e){return Ml(e,"overflowY")},Qx=function(e){return Ml(e,"overflowX")},ki=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Dl(e,r);if(o){var s=Ll(e,r),i=s[1],l=s[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ev=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},tv=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Dl=function(e,t){return e==="v"?Xx(t):Qx(t)},Ll=function(e,t){return e==="v"?ev(t):tv(t)},nv=function(e,t){return e==="h"&&t==="rtl"?-1:1},rv=function(e,t,n,r,o){var s=nv(e,window.getComputedStyle(t).direction),i=s*r,l=n.target,c=t.contains(l),u=!1,d=i>0,h=0,m=0;do{if(!l)break;var p=Ll(e,l),g=p[0],f=p[1],x=p[2],y=f-x-s*g;(g||y)&&Dl(e,l)&&(h+=y,m+=g);var _=l.parentNode;l=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(h)<1||!d&&Math.abs(m)<1)&&(u=!0),u},Xn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ci=function(e){return[e.deltaX,e.deltaY]},Si=function(e){return e&&"current"in e?e.current:e},ov=function(e,t){return e[0]===t[0]&&e[1]===t[1]},sv=function(e){return`
79
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
80
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
81
+ `)},iv=0,Vt=[];function av(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),o=v.useState(iv++)[0],s=v.useState(Pl)[0],i=v.useRef(e);v.useEffect(function(){i.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var f=Nx([e.lockRef.current],(e.shards||[]).map(Si),!0).filter(Boolean);return f.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),f.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=v.useCallback(function(f,x){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!i.current.allowPinchZoom;var y=Xn(f),_=n.current,k="deltaX"in f?f.deltaX:_[0]-y[0],C="deltaY"in f?f.deltaY:_[1]-y[1],j,z=f.target,E=Math.abs(k)>Math.abs(C)?"h":"v";if("touches"in f&&E==="h"&&z.type==="range")return!1;var A=window.getSelection(),O=A&&A.anchorNode,P=O?O===z||O.contains(z):!1;if(P)return!1;var Z=ki(E,z);if(!Z)return!0;if(Z?j=E:(j=E==="v"?"h":"v",Z=ki(E,z)),!Z)return!1;if(!r.current&&"changedTouches"in f&&(k||C)&&(r.current=j),!j)return!0;var S=r.current||j;return rv(S,x,f,S==="h"?k:C)},[]),c=v.useCallback(function(f){var x=f;if(!(!Vt.length||Vt[Vt.length-1]!==s)){var y="deltaY"in x?Ci(x):Xn(x),_=t.current.filter(function(j){return j.name===x.type&&(j.target===x.target||x.target===j.shadowParent)&&ov(j.delta,y)})[0];if(_&&_.should){x.cancelable&&x.preventDefault();return}if(!_){var k=(i.current.shards||[]).map(Si).filter(Boolean).filter(function(j){return j.contains(x.target)}),C=k.length>0?l(x,k[0]):!i.current.noIsolation;C&&x.cancelable&&x.preventDefault()}}},[]),u=v.useCallback(function(f,x,y,_){var k={name:f,delta:x,target:y,should:_,shadowParent:lv(y)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(C){return C!==k})},1)},[]),d=v.useCallback(function(f){n.current=Xn(f),r.current=void 0},[]),h=v.useCallback(function(f){u(f.type,Ci(f),f.target,l(f,e.lockRef.current))},[]),m=v.useCallback(function(f){u(f.type,Xn(f),f.target,l(f,e.lockRef.current))},[]);v.useEffect(function(){return Vt.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Wt),document.addEventListener("touchmove",c,Wt),document.addEventListener("touchstart",d,Wt),function(){Vt=Vt.filter(function(f){return f!==s}),document.removeEventListener("wheel",c,Wt),document.removeEventListener("touchmove",c,Wt),document.removeEventListener("touchstart",d,Wt)}},[]);var p=e.removeScrollBar,g=e.inert;return v.createElement(v.Fragment,null,g?v.createElement(s,{styles:sv(o)}):null,p?v.createElement(Gx,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function lv(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const cv=Dx(Il,av);var ls=v.forwardRef(function(e,t){return v.createElement(Or,ot({},e,{ref:t,sideCar:cv}))});ls.classNames=Or.classNames;var uv=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ht=new WeakMap,Qn=new WeakMap,er={},ro=0,Fl=function(e){return e&&(e.host||Fl(e.parentNode))},dv=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Fl(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},fv=function(e,t,n,r){var o=dv(t,Array.isArray(e)?e:[e]);er[n]||(er[n]=new WeakMap);var s=er[n],i=[],l=new Set,c=new Set(o),u=function(h){!h||l.has(h)||(l.add(h),u(h.parentNode))};o.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(m){if(l.has(m))d(m);else try{var p=m.getAttribute(r),g=p!==null&&p!=="false",f=(Ht.get(m)||0)+1,x=(s.get(m)||0)+1;Ht.set(m,f),s.set(m,x),i.push(m),f===1&&g&&Qn.set(m,!0),x===1&&m.setAttribute(n,"true"),g||m.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",m,y)}})};return d(t),l.clear(),ro++,function(){i.forEach(function(h){var m=Ht.get(h)-1,p=s.get(h)-1;Ht.set(h,m),s.set(h,p),m||(Qn.has(h)||h.removeAttribute(r),Qn.delete(h)),p||h.removeAttribute(n)}),ro--,ro||(Ht=new WeakMap,Ht=new WeakMap,Qn=new WeakMap,er={})}},$l=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=uv(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),fv(r,o,n,"aria-hidden")):function(){return null}},Rr="Dialog",[Bl]=$t(Rr),[hv,nt]=Bl(Rr),Ul=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,l=v.useRef(null),c=v.useRef(null),[u,d]=ln({prop:r,defaultProp:o??!1,onChange:s,caller:Rr});return a.jsx(hv,{scope:t,triggerRef:l,contentRef:c,contentId:ht(),titleId:ht(),descriptionId:ht(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(h=>!h),[d]),modal:i,children:n})};Ul.displayName=Rr;var Zl="DialogTrigger",Wl=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=nt(Zl,n),s=Re(t,o.triggerRef);return a.jsx(Ce.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":ds(o.open),...r,ref:s,onClick:ye(e.onClick,o.onOpenToggle)})});Wl.displayName=Zl;var cs="DialogPortal",[pv,Vl]=Bl(cs,{forceMount:void 0}),Hl=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=nt(cs,t);return a.jsx(pv,{scope:t,forceMount:n,children:v.Children.map(r,i=>a.jsx(Bt,{present:n||s.open,children:a.jsx(zr,{asChild:!0,container:o,children:i})}))})};Hl.displayName=cs;var gr="DialogOverlay",ql=v.forwardRef((e,t)=>{const n=Vl(gr,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=nt(gr,e.__scopeDialog);return s.modal?a.jsx(Bt,{present:r||s.open,children:a.jsx(gv,{...o,ref:t})}):null});ql.displayName=gr;var mv=an("DialogOverlay.RemoveScroll"),gv=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=nt(gr,n);return a.jsx(ls,{as:mv,allowPinchZoom:!0,shards:[o.contentRef],children:a.jsx(Ce.div,{"data-state":ds(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Ot="DialogContent",Jl=v.forwardRef((e,t)=>{const n=Vl(Ot,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=nt(Ot,e.__scopeDialog);return a.jsx(Bt,{present:r||s.open,children:s.modal?a.jsx(xv,{...o,ref:t}):a.jsx(vv,{...o,ref:t})})});Jl.displayName=Ot;var xv=v.forwardRef((e,t)=>{const n=nt(Ot,e.__scopeDialog),r=v.useRef(null),o=Re(t,n.contentRef,r);return v.useEffect(()=>{const s=r.current;if(s)return $l(s)},[]),a.jsx(Kl,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ye(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ye(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&s.preventDefault()}),onFocusOutside:ye(e.onFocusOutside,s=>s.preventDefault())})}),vv=v.forwardRef((e,t)=>{const n=nt(Ot,e.__scopeDialog),r=v.useRef(!1),o=v.useRef(!1);return a.jsx(Kl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||n.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;n.triggerRef.current?.contains(i)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),Kl=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,l=nt(Ot,n),c=v.useRef(null),u=Re(t,c);return zl(),a.jsxs(a.Fragment,{children:[a.jsx(as,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:a.jsx(Ar,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":ds(l.open),...i,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(bv,{titleId:l.titleId}),a.jsx(_v,{contentRef:c,descriptionId:l.descriptionId})]})]})}),us="DialogTitle",Gl=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=nt(us,n);return a.jsx(Ce.h2,{id:o.titleId,...r,ref:t})});Gl.displayName=us;var Yl="DialogDescription",yv=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=nt(Yl,n);return a.jsx(Ce.p,{id:o.descriptionId,...r,ref:t})});yv.displayName=Yl;var Xl="DialogClose",Ql=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=nt(Xl,n);return a.jsx(Ce.button,{type:"button",...r,ref:t,onClick:ye(e.onClick,()=>o.onOpenChange(!1))})});Ql.displayName=Xl;function ds(e){return e?"open":"closed"}var ec="DialogTitleWarning",[Vk,tc]=tx(ec,{contentName:Ot,titleName:us,docsSlug:"dialog"}),bv=({titleId:e})=>{const t=tc(ec),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
82
+
83
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
84
+
85
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},wv="DialogDescriptionWarning",_v=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${tc(wv).contentName}}.`;return v.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},kv=Ul,Cv=Wl,Sv=Hl,jv=ql,Ev=Jl,Nv=Gl,Tv=Ql;function Av(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function zv(e){const[t,n]=v.useState(void 0);return Ue(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,l=u.blockSize}else i=e.offsetWidth,l=e.offsetHeight;n({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const Ov=["top","right","bottom","left"],kt=Math.min,qe=Math.max,xr=Math.round,tr=Math.floor,it=e=>({x:e,y:e}),Rv={left:"right",right:"left",bottom:"top",top:"bottom"},Iv={start:"end",end:"start"};function jo(e,t,n){return qe(e,kt(t,n))}function mt(e,t){return typeof e=="function"?e(t):e}function gt(e){return e.split("-")[0]}function pn(e){return e.split("-")[1]}function fs(e){return e==="x"?"y":"x"}function hs(e){return e==="y"?"height":"width"}const Pv=new Set(["top","bottom"]);function st(e){return Pv.has(gt(e))?"y":"x"}function ps(e){return fs(st(e))}function Mv(e,t,n){n===void 0&&(n=!1);const r=pn(e),o=ps(e),s=hs(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=vr(i)),[i,vr(i)]}function Dv(e){const t=vr(e);return[Eo(e),t,Eo(t)]}function Eo(e){return e.replace(/start|end/g,t=>Iv[t])}const ji=["left","right"],Ei=["right","left"],Lv=["top","bottom"],Fv=["bottom","top"];function $v(e,t,n){switch(e){case"top":case"bottom":return n?t?Ei:ji:t?ji:Ei;case"left":case"right":return t?Lv:Fv;default:return[]}}function Bv(e,t,n,r){const o=pn(e);let s=$v(gt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Eo)))),s}function vr(e){return e.replace(/left|right|bottom|top/g,t=>Rv[t])}function Uv(e){return{top:0,right:0,bottom:0,left:0,...e}}function nc(e){return typeof e!="number"?Uv(e):{top:e,right:e,bottom:e,left:e}}function yr(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Ni(e,t,n){let{reference:r,floating:o}=e;const s=st(t),i=ps(t),l=hs(i),c=gt(t),u=s==="y",d=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,m=r[l]/2-o[l]/2;let p;switch(c){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:h};break;case"left":p={x:r.x-o.width,y:h};break;default:p={x:r.x,y:r.y}}switch(pn(t)){case"start":p[i]-=m*(n&&u?-1:1);break;case"end":p[i]+=m*(n&&u?-1:1);break}return p}async function Zv(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:m=!1,padding:p=0}=mt(t,e),g=nc(p),x=l[m?h==="floating"?"reference":"floating":h],y=yr(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),_=h==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),C=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},j=yr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:_,offsetParent:k,strategy:c}):_);return{top:(y.top-j.top+g.top)/C.y,bottom:(j.bottom-y.bottom+g.bottom)/C.y,left:(y.left-j.left+g.left)/C.x,right:(j.right-y.right+g.right)/C.x}}const Wv=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=s.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:h}=Ni(u,r,c),m=r,p={},g=0;for(let x=0;x<l.length;x++){var f;const{name:y,fn:_}=l[x],{x:k,y:C,data:j,reset:z}=await _({x:d,y:h,initialPlacement:r,placement:m,strategy:o,middlewareData:p,rects:u,platform:{...i,detectOverflow:(f=i.detectOverflow)!=null?f:Zv},elements:{reference:e,floating:t}});d=k??d,h=C??h,p={...p,[y]:{...p[y],...j}},z&&g<=50&&(g++,typeof z=="object"&&(z.placement&&(m=z.placement),z.rects&&(u=z.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):z.rects),{x:d,y:h}=Ni(u,m,c)),x=-1)}return{x:d,y:h,placement:m,strategy:o,middlewareData:p}},Vv=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=mt(e,t)||{};if(u==null)return{};const h=nc(d),m={x:n,y:r},p=ps(o),g=hs(p),f=await i.getDimensions(u),x=p==="y",y=x?"top":"left",_=x?"bottom":"right",k=x?"clientHeight":"clientWidth",C=s.reference[g]+s.reference[p]-m[p]-s.floating[g],j=m[p]-s.reference[p],z=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let E=z?z[k]:0;(!E||!await(i.isElement==null?void 0:i.isElement(z)))&&(E=l.floating[k]||s.floating[g]);const A=C/2-j/2,O=E/2-f[g]/2-1,P=kt(h[y],O),Z=kt(h[_],O),S=P,R=E-f[g]-Z,w=E/2-f[g]/2+A,I=jo(S,w,R),V=!c.arrow&&pn(o)!=null&&w!==I&&s.reference[g]/2-(w<S?P:Z)-f[g]/2<0,$=V?w<S?w-S:w-R:0;return{[p]:m[p]+$,data:{[p]:I,centerOffset:w-I-$,...V&&{alignmentOffset:$}},reset:V}}}),Hv=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:f=!0,...x}=mt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=gt(o),_=st(l),k=gt(l)===l,C=await(c.isRTL==null?void 0:c.isRTL(u.floating)),j=m||(k||!f?[vr(l)]:Dv(l)),z=g!=="none";!m&&z&&j.push(...Bv(l,f,g,C));const E=[l,...j],A=await c.detectOverflow(t,x),O=[];let P=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&O.push(A[y]),h){const w=Mv(o,i,C);O.push(A[w[0]],A[w[1]])}if(P=[...P,{placement:o,overflows:O}],!O.every(w=>w<=0)){var Z,S;const w=(((Z=s.flip)==null?void 0:Z.index)||0)+1,I=E[w];if(I&&(!(h==="alignment"?_!==st(I):!1)||P.every(F=>st(F.placement)===_?F.overflows[0]>0:!0)))return{data:{index:w,overflows:P},reset:{placement:I}};let V=(S=P.filter($=>$.overflows[0]<=0).sort(($,F)=>$.overflows[1]-F.overflows[1])[0])==null?void 0:S.placement;if(!V)switch(p){case"bestFit":{var R;const $=(R=P.filter(F=>{if(z){const J=st(F.placement);return J===_||J==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(J=>J>0).reduce((J,se)=>J+se,0)]).sort((F,J)=>F[1]-J[1])[0])==null?void 0:R[0];$&&(V=$);break}case"initialPlacement":V=l;break}if(o!==V)return{reset:{placement:V}}}return{}}}};function Ti(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ai(e){return Ov.some(t=>e[t]>=0)}const qv=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=mt(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=Ti(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Ai(l)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),l=Ti(i,n.floating);return{data:{escapedOffsets:l,escaped:Ai(l)}}}default:return{}}}}},rc=new Set(["left","top"]);async function Jv(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=gt(n),l=pn(n),c=st(n)==="y",u=rc.has(i)?-1:1,d=s&&c?-1:1,h=mt(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof g=="number"&&(p=l==="end"?g*-1:g),c?{x:p*d,y:m*u}:{x:m*u,y:p*d}}const Kv=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:l}=t,c=await Jv(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},Gv=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:y=>{let{x:_,y:k}=y;return{x:_,y:k}}},...u}=mt(e,t),d={x:n,y:r},h=await s.detectOverflow(t,u),m=st(gt(o)),p=fs(m);let g=d[p],f=d[m];if(i){const y=p==="y"?"top":"left",_=p==="y"?"bottom":"right",k=g+h[y],C=g-h[_];g=jo(k,g,C)}if(l){const y=m==="y"?"top":"left",_=m==="y"?"bottom":"right",k=f+h[y],C=f-h[_];f=jo(k,f,C)}const x=c.fn({...t,[p]:g,[m]:f});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[p]:i,[m]:l}}}}}},Yv=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=mt(e,t),d={x:n,y:r},h=st(o),m=fs(h);let p=d[m],g=d[h];const f=mt(l,t),x=typeof f=="number"?{mainAxis:f,crossAxis:0}:{mainAxis:0,crossAxis:0,...f};if(c){const k=m==="y"?"height":"width",C=s.reference[m]-s.floating[k]+x.mainAxis,j=s.reference[m]+s.reference[k]-x.mainAxis;p<C?p=C:p>j&&(p=j)}if(u){var y,_;const k=m==="y"?"width":"height",C=rc.has(gt(o)),j=s.reference[h]-s.floating[k]+(C&&((y=i.offset)==null?void 0:y[h])||0)+(C?0:x.crossAxis),z=s.reference[h]+s.reference[k]+(C?0:((_=i.offset)==null?void 0:_[h])||0)-(C?x.crossAxis:0);g<j?g=j:g>z&&(g=z)}return{[m]:p,[h]:g}}}},Xv=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:l}=t,{apply:c=()=>{},...u}=mt(e,t),d=await i.detectOverflow(t,u),h=gt(o),m=pn(o),p=st(o)==="y",{width:g,height:f}=s.floating;let x,y;h==="top"||h==="bottom"?(x=h,y=m===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(y=h,x=m==="end"?"top":"bottom");const _=f-d.top-d.bottom,k=g-d.left-d.right,C=kt(f-d[x],_),j=kt(g-d[y],k),z=!t.middlewareData.shift;let E=C,A=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=_),z&&!m){const P=qe(d.left,0),Z=qe(d.right,0),S=qe(d.top,0),R=qe(d.bottom,0);p?A=g-2*(P!==0||Z!==0?P+Z:qe(d.left,d.right)):E=f-2*(S!==0||R!==0?S+R:qe(d.top,d.bottom))}await c({...t,availableWidth:A,availableHeight:E});const O=await i.getDimensions(l.floating);return g!==O.width||f!==O.height?{reset:{rects:!0}}:{}}}};function Ir(){return typeof window<"u"}function mn(e){return oc(e)?(e.nodeName||"").toLowerCase():"#document"}function Ke(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function lt(e){var t;return(t=(oc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function oc(e){return Ir()?e instanceof Node||e instanceof Ke(e).Node:!1}function et(e){return Ir()?e instanceof Element||e instanceof Ke(e).Element:!1}function at(e){return Ir()?e instanceof HTMLElement||e instanceof Ke(e).HTMLElement:!1}function zi(e){return!Ir()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ke(e).ShadowRoot}const Qv=new Set(["inline","contents"]);function Ln(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=tt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Qv.has(o)}const ey=new Set(["table","td","th"]);function ty(e){return ey.has(mn(e))}const ny=[":popover-open",":modal"];function Pr(e){return ny.some(t=>{try{return e.matches(t)}catch{return!1}})}const ry=["transform","translate","scale","rotate","perspective"],oy=["transform","translate","scale","rotate","perspective","filter"],sy=["paint","layout","strict","content"];function ms(e){const t=gs(),n=et(e)?tt(e):e;return ry.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||oy.some(r=>(n.willChange||"").includes(r))||sy.some(r=>(n.contain||"").includes(r))}function iy(e){let t=Ct(e);for(;at(t)&&!cn(t);){if(ms(t))return t;if(Pr(t))return null;t=Ct(t)}return null}function gs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ay=new Set(["html","body","#document"]);function cn(e){return ay.has(mn(e))}function tt(e){return Ke(e).getComputedStyle(e)}function Mr(e){return et(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ct(e){if(mn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||zi(e)&&e.host||lt(e);return zi(t)?t.host:t}function sc(e){const t=Ct(e);return cn(t)?e.ownerDocument?e.ownerDocument.body:e.body:at(t)&&Ln(t)?t:sc(t)}function zn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=sc(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ke(o);if(s){const l=No(i);return t.concat(i,i.visualViewport||[],Ln(o)?o:[],l&&n?zn(l):[])}return t.concat(o,zn(o,[],n))}function No(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ic(e){const t=tt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=at(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=xr(n)!==s||xr(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function xs(e){return et(e)?e:e.contextElement}function en(e){const t=xs(e);if(!at(t))return it(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=ic(t);let i=(s?xr(n.width):n.width)/r,l=(s?xr(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const ly=it(0);function ac(e){const t=Ke(e);return!gs()||!t.visualViewport?ly:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cy(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ke(e)?!1:t}function Rt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=xs(e);let i=it(1);t&&(r?et(r)&&(i=en(r)):i=en(e));const l=cy(s,n,r)?ac(s):it(0);let c=(o.left+l.x)/i.x,u=(o.top+l.y)/i.y,d=o.width/i.x,h=o.height/i.y;if(s){const m=Ke(s),p=r&&et(r)?Ke(r):r;let g=m,f=No(g);for(;f&&r&&p!==g;){const x=en(f),y=f.getBoundingClientRect(),_=tt(f),k=y.left+(f.clientLeft+parseFloat(_.paddingLeft))*x.x,C=y.top+(f.clientTop+parseFloat(_.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,h*=x.y,c+=k,u+=C,g=Ke(f),f=No(g)}}return yr({width:d,height:h,x:c,y:u})}function Dr(e,t){const n=Mr(e).scrollLeft;return t?t.left+n:Rt(lt(e)).left+n}function lc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Dr(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function uy(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=lt(r),l=t?Pr(t.floating):!1;if(r===i||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=it(1);const d=it(0),h=at(r);if((h||!h&&!s)&&((mn(r)!=="body"||Ln(i))&&(c=Mr(r)),at(r))){const p=Rt(r);u=en(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const m=i&&!h&&!s?lc(i,c):it(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+m.x,y:n.y*u.y-c.scrollTop*u.y+d.y+m.y}}function dy(e){return Array.from(e.getClientRects())}function fy(e){const t=lt(e),n=Mr(e),r=e.ownerDocument.body,o=qe(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=qe(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Dr(e);const l=-n.scrollTop;return tt(r).direction==="rtl"&&(i+=qe(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const Oi=25;function hy(e,t){const n=Ke(e),r=lt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,l=0,c=0;if(o){s=o.width,i=o.height;const d=gs();(!d||d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const u=Dr(r);if(u<=0){const d=r.ownerDocument,h=d.body,m=getComputedStyle(h),p=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,g=Math.abs(r.clientWidth-h.clientWidth-p);g<=Oi&&(s-=g)}else u<=Oi&&(s+=u);return{width:s,height:i,x:l,y:c}}const py=new Set(["absolute","fixed"]);function my(e,t){const n=Rt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=at(e)?en(e):it(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:l,x:c,y:u}}function Ri(e,t,n){let r;if(t==="viewport")r=hy(e,n);else if(t==="document")r=fy(lt(e));else if(et(t))r=my(t,n);else{const o=ac(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return yr(r)}function cc(e,t){const n=Ct(e);return n===t||!et(n)||cn(n)?!1:tt(n).position==="fixed"||cc(n,t)}function gy(e,t){const n=t.get(e);if(n)return n;let r=zn(e,[],!1).filter(l=>et(l)&&mn(l)!=="body"),o=null;const s=tt(e).position==="fixed";let i=s?Ct(e):e;for(;et(i)&&!cn(i);){const l=tt(i),c=ms(i);!c&&l.position==="fixed"&&(o=null),(s?!c&&!o:!c&&l.position==="static"&&!!o&&py.has(o.position)||Ln(i)&&!c&&cc(e,i))?r=r.filter(d=>d!==i):o=l,i=Ct(i)}return t.set(e,r),r}function xy(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Pr(t)?[]:gy(t,this._c):[].concat(n),r],l=i[0],c=i.reduce((u,d)=>{const h=Ri(t,d,o);return u.top=qe(h.top,u.top),u.right=kt(h.right,u.right),u.bottom=kt(h.bottom,u.bottom),u.left=qe(h.left,u.left),u},Ri(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function vy(e){const{width:t,height:n}=ic(e);return{width:t,height:n}}function yy(e,t,n){const r=at(t),o=lt(t),s=n==="fixed",i=Rt(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=it(0);function u(){c.x=Dr(o)}if(r||!r&&!s)if((mn(t)!=="body"||Ln(o))&&(l=Mr(t)),r){const p=Rt(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else o&&u();s&&!r&&o&&u();const d=o&&!r&&!s?lc(o,l):it(0),h=i.left+l.scrollLeft-c.x-d.x,m=i.top+l.scrollTop-c.y-d.y;return{x:h,y:m,width:i.width,height:i.height}}function oo(e){return tt(e).position==="static"}function Ii(e,t){if(!at(e)||tt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return lt(e)===n&&(n=n.ownerDocument.body),n}function uc(e,t){const n=Ke(e);if(Pr(e))return n;if(!at(e)){let o=Ct(e);for(;o&&!cn(o);){if(et(o)&&!oo(o))return o;o=Ct(o)}return n}let r=Ii(e,t);for(;r&&ty(r)&&oo(r);)r=Ii(r,t);return r&&cn(r)&&oo(r)&&!ms(r)?n:r||iy(e)||n}const by=async function(e){const t=this.getOffsetParent||uc,n=this.getDimensions,r=await n(e.floating);return{reference:yy(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wy(e){return tt(e).direction==="rtl"}const _y={convertOffsetParentRelativeRectToViewportRelativeRect:uy,getDocumentElement:lt,getClippingRect:xy,getOffsetParent:uc,getElementRects:by,getClientRects:dy,getDimensions:vy,getScale:en,isElement:et,isRTL:wy};function dc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ky(e,t){let n=null,r;const o=lt(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const u=e.getBoundingClientRect(),{left:d,top:h,width:m,height:p}=u;if(l||t(),!m||!p)return;const g=tr(h),f=tr(o.clientWidth-(d+m)),x=tr(o.clientHeight-(h+p)),y=tr(d),k={rootMargin:-g+"px "+-f+"px "+-x+"px "+-y+"px",threshold:qe(0,kt(1,c))||1};let C=!0;function j(z){const E=z[0].intersectionRatio;if(E!==c){if(!C)return i();E?i(!1,E):r=setTimeout(()=>{i(!1,1e-7)},1e3)}E===1&&!dc(u,e.getBoundingClientRect())&&i(),C=!1}try{n=new IntersectionObserver(j,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(j,k)}n.observe(e)}return i(!0),s}function Cy(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=xs(e),d=o||s?[...u?zn(u):[],...zn(t)]:[];d.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const h=u&&l?ky(u,n):null;let m=-1,p=null;i&&(p=new ResizeObserver(y=>{let[_]=y;_&&_.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(t)})),n()}),u&&!c&&p.observe(u),p.observe(t));let g,f=c?Rt(e):null;c&&x();function x(){const y=Rt(e);f&&!dc(f,y)&&n(),f=y,g=requestAnimationFrame(x)}return n(),()=>{var y;d.forEach(_=>{o&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),h?.(),(y=p)==null||y.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const Sy=Kv,jy=Gv,Ey=Hv,Ny=Xv,Ty=qv,Pi=Vv,Ay=Yv,zy=(e,t,n)=>{const r=new Map,o={platform:_y,...n},s={...o.platform,_c:r};return Wv(e,t,{...o,platform:s})};var Oy=typeof document<"u",Ry=function(){},lr=Oy?v.useLayoutEffect:Ry;function br(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!br(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!br(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function fc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Mi(e,t){const n=fc(e);return Math.round(t*n)/n}function so(e){const t=v.useRef(e);return lr(()=>{t.current=e}),t}function Iy(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,h]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=v.useState(r);br(m,r)||p(r);const[g,f]=v.useState(null),[x,y]=v.useState(null),_=v.useCallback(F=>{F!==z.current&&(z.current=F,f(F))},[]),k=v.useCallback(F=>{F!==E.current&&(E.current=F,y(F))},[]),C=s||g,j=i||x,z=v.useRef(null),E=v.useRef(null),A=v.useRef(d),O=c!=null,P=so(c),Z=so(o),S=so(u),R=v.useCallback(()=>{if(!z.current||!E.current)return;const F={placement:t,strategy:n,middleware:m};Z.current&&(F.platform=Z.current),zy(z.current,E.current,F).then(J=>{const se={...J,isPositioned:S.current!==!1};w.current&&!br(A.current,se)&&(A.current=se,In.flushSync(()=>{h(se)}))})},[m,t,n,Z,S]);lr(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,h(F=>({...F,isPositioned:!1})))},[u]);const w=v.useRef(!1);lr(()=>(w.current=!0,()=>{w.current=!1}),[]),lr(()=>{if(C&&(z.current=C),j&&(E.current=j),C&&j){if(P.current)return P.current(C,j,R);R()}},[C,j,R,P,O]);const I=v.useMemo(()=>({reference:z,floating:E,setReference:_,setFloating:k}),[_,k]),V=v.useMemo(()=>({reference:C,floating:j}),[C,j]),$=v.useMemo(()=>{const F={position:n,left:0,top:0};if(!V.floating)return F;const J=Mi(V.floating,d.x),se=Mi(V.floating,d.y);return l?{...F,transform:"translate("+J+"px, "+se+"px)",...fc(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:J,top:se}},[n,l,V.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:R,refs:I,elements:V,floatingStyles:$}),[d,R,I,V,$])}const Py=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Pi({element:r.current,padding:o}).fn(n):{}:r?Pi({element:r,padding:o}).fn(n):{}}}},My=(e,t)=>({...Sy(e),options:[e,t]}),Dy=(e,t)=>({...jy(e),options:[e,t]}),Ly=(e,t)=>({...Ay(e),options:[e,t]}),Fy=(e,t)=>({...Ey(e),options:[e,t]}),$y=(e,t)=>({...Ny(e),options:[e,t]}),By=(e,t)=>({...Ty(e),options:[e,t]}),Uy=(e,t)=>({...Py(e),options:[e,t]});var Zy="Arrow",hc=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return a.jsx(Ce.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});hc.displayName=Zy;var Wy=hc,vs="Popper",[pc,Lr]=$t(vs),[Vy,mc]=pc(vs),gc=e=>{const{__scopePopper:t,children:n}=e,[r,o]=v.useState(null);return a.jsx(Vy,{scope:t,anchor:r,onAnchorChange:o,children:n})};gc.displayName=vs;var xc="PopperAnchor",vc=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=mc(xc,n),i=v.useRef(null),l=Re(t,i),c=v.useRef(null);return v.useEffect(()=>{const u=c.current;c.current=r?.current||i.current,u!==c.current&&s.onAnchorChange(c.current)}),r?null:a.jsx(Ce.div,{...o,ref:l})});vc.displayName=xc;var ys="PopperContent",[Hy,qy]=pc(ys),yc=v.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:g,...f}=e,x=mc(ys,n),[y,_]=v.useState(null),k=Re(t,X=>_(X)),[C,j]=v.useState(null),z=zv(C),E=z?.width??0,A=z?.height??0,O=r+(s!=="center"?"-"+s:""),P=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},Z=Array.isArray(u)?u:[u],S=Z.length>0,R={padding:P,boundary:Z.filter(Ky),altBoundary:S},{refs:w,floatingStyles:I,placement:V,isPositioned:$,middlewareData:F}=Iy({strategy:"fixed",placement:O,whileElementsMounted:(...X)=>Cy(...X,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[My({mainAxis:o+A,alignmentAxis:i}),c&&Dy({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Ly():void 0,...R}),c&&Fy({...R}),$y({...R,apply:({elements:X,rects:ie,availableWidth:ae,availableHeight:he})=>{const{width:fe,height:we}=ie.reference,Te=X.floating.style;Te.setProperty("--radix-popper-available-width",`${ae}px`),Te.setProperty("--radix-popper-available-height",`${he}px`),Te.setProperty("--radix-popper-anchor-width",`${fe}px`),Te.setProperty("--radix-popper-anchor-height",`${we}px`)}}),C&&Uy({element:C,padding:l}),Gy({arrowWidth:E,arrowHeight:A}),m&&By({strategy:"referenceHidden",...R})]}),[J,se]=_c(V),U=_t(g);Ue(()=>{$&&U?.()},[$,U]);const B=F.arrow?.x,te=F.arrow?.y,ee=F.arrow?.centerOffset!==0,[K,ue]=v.useState();return Ue(()=>{y&&ue(window.getComputedStyle(y).zIndex)},[y]),a.jsx("div",{ref:w.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:$?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:K,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(Hy,{scope:n,placedSide:J,onArrowChange:j,arrowX:B,arrowY:te,shouldHideArrow:ee,children:a.jsx(Ce.div,{"data-side":J,"data-align":se,...f,ref:k,style:{...f.style,animation:$?void 0:"none"}})})})});yc.displayName=ys;var bc="PopperArrow",Jy={top:"bottom",right:"left",bottom:"top",left:"right"},wc=v.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=qy(bc,r),i=Jy[s.placedSide];return a.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:a.jsx(Wy,{...o,ref:n,style:{...o.style,display:"block"}})})});wc.displayName=bc;function Ky(e){return e!==null}var Gy=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,d]=_c(n),h={start:"0%",center:"50%",end:"100%"}[d],m=(o.arrow?.x??0)+l/2,p=(o.arrow?.y??0)+c/2;let g="",f="";return u==="bottom"?(g=i?h:`${m}px`,f=`${-c}px`):u==="top"?(g=i?h:`${m}px`,f=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,f=i?h:`${p}px`):u==="left"&&(g=`${r.floating.width+c}px`,f=i?h:`${p}px`),{data:{x:g,y:f}}}});function _c(e){const[t,n="center"]=e.split("-");return[t,n]}var kc=gc,Cc=vc,Sc=yc,jc=wc,io="rovingFocusGroup.onEntryFocus",Yy={bubbles:!1,cancelable:!0},Fn="RovingFocusGroup",[To,Ec,Xy]=El(Fn),[Qy,Nc]=$t(Fn,[Xy]),[e2,t2]=Qy(Fn),Tc=v.forwardRef((e,t)=>a.jsx(To.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(To.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(n2,{...e,ref:t})})}));Tc.displayName=Fn;var n2=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=e,m=v.useRef(null),p=Re(t,m),g=is(s),[f,x]=ln({prop:i,defaultProp:l??null,onChange:c,caller:Fn}),[y,_]=v.useState(!1),k=_t(u),C=Ec(n),j=v.useRef(!1),[z,E]=v.useState(0);return v.useEffect(()=>{const A=m.current;if(A)return A.addEventListener(io,k),()=>A.removeEventListener(io,k)},[k]),a.jsx(e2,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:f,onItemFocus:v.useCallback(A=>x(A),[x]),onItemShiftTab:v.useCallback(()=>_(!0),[]),onFocusableItemAdd:v.useCallback(()=>E(A=>A+1),[]),onFocusableItemRemove:v.useCallback(()=>E(A=>A-1),[]),children:a.jsx(Ce.div,{tabIndex:y||z===0?-1:0,"data-orientation":r,...h,ref:p,style:{outline:"none",...e.style},onMouseDown:ye(e.onMouseDown,()=>{j.current=!0}),onFocus:ye(e.onFocus,A=>{const O=!j.current;if(A.target===A.currentTarget&&O&&!y){const P=new CustomEvent(io,Yy);if(A.currentTarget.dispatchEvent(P),!P.defaultPrevented){const Z=C().filter(V=>V.focusable),S=Z.find(V=>V.active),R=Z.find(V=>V.id===f),I=[S,R,...Z].filter(Boolean).map(V=>V.ref.current);Oc(I,d)}}j.current=!1}),onBlur:ye(e.onBlur,()=>_(!1))})})}),Ac="RovingFocusGroupItem",zc=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...l}=e,c=ht(),u=s||c,d=t2(Ac,n),h=d.currentTabStopId===u,m=Ec(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:f}=d;return v.useEffect(()=>{if(r)return p(),()=>g()},[r,p,g]),a.jsx(To.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:a.jsx(Ce.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:ye(e.onMouseDown,x=>{r?d.onItemFocus(u):x.preventDefault()}),onFocus:ye(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:ye(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const y=s2(x,d.orientation,d.dir);if(y!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let k=m().filter(C=>C.focusable).map(C=>C.ref.current);if(y==="last")k.reverse();else if(y==="prev"||y==="next"){y==="prev"&&k.reverse();const C=k.indexOf(x.currentTarget);k=d.loop?i2(k,C+1):k.slice(C+1)}setTimeout(()=>Oc(k))}}),children:typeof i=="function"?i({isCurrentTabStop:h,hasTabStop:f!=null}):i})})});zc.displayName=Ac;var r2={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function o2(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function s2(e,t,n){const r=o2(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return r2[r]}function Oc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function i2(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var a2=Tc,l2=zc;function Di(e,[t,n]){return Math.min(n,Math.max(t,e))}var c2=[" ","Enter","ArrowUp","ArrowDown"],u2=[" ","Enter"],It="Select",[Fr,$r,d2]=El(It),[gn]=$t(It,[d2,Lr]),Br=Lr(),[f2,Et]=gn(It),[h2,p2]=gn(It),Rc=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:m,required:p,form:g}=e,f=Br(t),[x,y]=v.useState(null),[_,k]=v.useState(null),[C,j]=v.useState(!1),z=is(u),[E,A]=ln({prop:r,defaultProp:o??!1,onChange:s,caller:It}),[O,P]=ln({prop:i,defaultProp:l,onChange:c,caller:It}),Z=v.useRef(null),S=x?g||!!x.closest("form"):!0,[R,w]=v.useState(new Set),I=Array.from(R).map(V=>V.props.value).join(";");return a.jsx(kc,{...f,children:a.jsxs(f2,{required:p,scope:t,trigger:x,onTriggerChange:y,valueNode:_,onValueNodeChange:k,valueNodeHasChildren:C,onValueNodeHasChildrenChange:j,contentId:ht(),value:O,onValueChange:P,open:E,onOpenChange:A,dir:z,triggerPointerDownPosRef:Z,disabled:m,children:[a.jsx(Fr.Provider,{scope:t,children:a.jsx(h2,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(V=>{w($=>new Set($).add(V))},[]),onNativeOptionRemove:v.useCallback(V=>{w($=>{const F=new Set($);return F.delete(V),F})},[]),children:n})}),S?a.jsxs(tu,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:h,value:O,onChange:V=>P(V.target.value),disabled:m,form:g,children:[O===void 0?a.jsx("option",{value:""}):null,Array.from(R)]},I):null]})})};Rc.displayName=It;var Ic="SelectTrigger",Pc=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=Br(n),i=Et(Ic,n),l=i.disabled||r,c=Re(t,i.onTriggerChange),u=$r(n),d=v.useRef("touch"),[h,m,p]=ru(f=>{const x=u().filter(k=>!k.disabled),y=x.find(k=>k.value===i.value),_=ou(x,f,y);_!==void 0&&i.onValueChange(_.value)}),g=f=>{l||(i.onOpenChange(!0),p()),f&&(i.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return a.jsx(Cc,{asChild:!0,...s,children:a.jsx(Ce.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":nu(i.value)?"":void 0,...o,ref:c,onClick:ye(o.onClick,f=>{f.currentTarget.focus(),d.current!=="mouse"&&g(f)}),onPointerDown:ye(o.onPointerDown,f=>{d.current=f.pointerType;const x=f.target;x.hasPointerCapture(f.pointerId)&&x.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(g(f),f.preventDefault())}),onKeyDown:ye(o.onKeyDown,f=>{const x=h.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&m(f.key),!(x&&f.key===" ")&&c2.includes(f.key)&&(g(),f.preventDefault())})})})});Pc.displayName=Ic;var Mc="SelectValue",Dc=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...l}=e,c=Et(Mc,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,h=Re(t,c.onValueNodeChange);return Ue(()=>{u(d)},[u,d]),a.jsx(Ce.span,{...l,ref:h,style:{pointerEvents:"none"},children:nu(c.value)?a.jsx(a.Fragment,{children:i}):s})});Dc.displayName=Mc;var m2="SelectIcon",Lc=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return a.jsx(Ce.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});Lc.displayName=m2;var g2="SelectPortal",Fc=e=>a.jsx(zr,{asChild:!0,...e});Fc.displayName=g2;var Pt="SelectContent",$c=v.forwardRef((e,t)=>{const n=Et(Pt,e.__scopeSelect),[r,o]=v.useState();if(Ue(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?In.createPortal(a.jsx(Bc,{scope:e.__scopeSelect,children:a.jsx(Fr.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(Uc,{...e,ref:t})});$c.displayName=Pt;var Qe=10,[Bc,Nt]=gn(Pt),x2="SelectContentImpl",v2=an("SelectContent.RemoveScroll"),Uc=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:f,avoidCollisions:x,...y}=e,_=Et(Pt,n),[k,C]=v.useState(null),[j,z]=v.useState(null),E=Re(t,X=>C(X)),[A,O]=v.useState(null),[P,Z]=v.useState(null),S=$r(n),[R,w]=v.useState(!1),I=v.useRef(!1);v.useEffect(()=>{if(k)return $l(k)},[k]),zl();const V=v.useCallback(X=>{const[ie,...ae]=S().map(we=>we.ref.current),[he]=ae.slice(-1),fe=document.activeElement;for(const we of X)if(we===fe||(we?.scrollIntoView({block:"nearest"}),we===ie&&j&&(j.scrollTop=0),we===he&&j&&(j.scrollTop=j.scrollHeight),we?.focus(),document.activeElement!==fe))return},[S,j]),$=v.useCallback(()=>V([A,k]),[V,A,k]);v.useEffect(()=>{R&&$()},[R,$]);const{onOpenChange:F,triggerPointerDownPosRef:J}=_;v.useEffect(()=>{if(k){let X={x:0,y:0};const ie=he=>{X={x:Math.abs(Math.round(he.pageX)-(J.current?.x??0)),y:Math.abs(Math.round(he.pageY)-(J.current?.y??0))}},ae=he=>{X.x<=10&&X.y<=10?he.preventDefault():k.contains(he.target)||F(!1),document.removeEventListener("pointermove",ie),J.current=null};return J.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",ae,{capture:!0})}}},[k,F,J]),v.useEffect(()=>{const X=()=>F(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[F]);const[se,U]=ru(X=>{const ie=S().filter(fe=>!fe.disabled),ae=ie.find(fe=>fe.ref.current===document.activeElement),he=ou(ie,X,ae);he&&setTimeout(()=>he.ref.current.focus())}),B=v.useCallback((X,ie,ae)=>{const he=!I.current&&!ae;(_.value!==void 0&&_.value===ie||he)&&(O(X),he&&(I.current=!0))},[_.value]),te=v.useCallback(()=>k?.focus(),[k]),ee=v.useCallback((X,ie,ae)=>{const he=!I.current&&!ae;(_.value!==void 0&&_.value===ie||he)&&Z(X)},[_.value]),K=r==="popper"?Ao:Zc,ue=K===Ao?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:f,avoidCollisions:x}:{};return a.jsx(Bc,{scope:n,content:k,viewport:j,onViewportChange:z,itemRefCallback:B,selectedItem:A,onItemLeave:te,itemTextRefCallback:ee,focusSelectedItem:$,selectedItemText:P,position:r,isPositioned:R,searchRef:se,children:a.jsx(ls,{as:v2,allowPinchZoom:!0,children:a.jsx(as,{asChild:!0,trapped:_.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:ye(o,X=>{_.trigger?.focus({preventScroll:!0}),X.preventDefault()}),children:a.jsx(Ar,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:a.jsx(K,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:X=>X.preventDefault(),...y,...ue,onPlaced:()=>w(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ye(y.onKeyDown,X=>{const ie=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!ie&&X.key.length===1&&U(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let he=S().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);if(["ArrowUp","End"].includes(X.key)&&(he=he.slice().reverse()),["ArrowUp","ArrowDown"].includes(X.key)){const fe=X.target,we=he.indexOf(fe);he=he.slice(we+1)}setTimeout(()=>V(he)),X.preventDefault()}})})})})})})});Uc.displayName=x2;var y2="SelectItemAlignedPosition",Zc=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=Et(Pt,n),i=Nt(Pt,n),[l,c]=v.useState(null),[u,d]=v.useState(null),h=Re(t,E=>d(E)),m=$r(n),p=v.useRef(!1),g=v.useRef(!0),{viewport:f,selectedItem:x,selectedItemText:y,focusSelectedItem:_}=i,k=v.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&f&&x&&y){const E=s.trigger.getBoundingClientRect(),A=u.getBoundingClientRect(),O=s.valueNode.getBoundingClientRect(),P=y.getBoundingClientRect();if(s.dir!=="rtl"){const fe=P.left-A.left,we=O.left-fe,Te=E.left-we,b=E.width+Te,Y=Math.max(b,A.width),q=window.innerWidth-Qe,T=Di(we,[Qe,Math.max(Qe,q-Y)]);l.style.minWidth=b+"px",l.style.left=T+"px"}else{const fe=A.right-P.right,we=window.innerWidth-O.right-fe,Te=window.innerWidth-E.right-we,b=E.width+Te,Y=Math.max(b,A.width),q=window.innerWidth-Qe,T=Di(we,[Qe,Math.max(Qe,q-Y)]);l.style.minWidth=b+"px",l.style.right=T+"px"}const Z=m(),S=window.innerHeight-Qe*2,R=f.scrollHeight,w=window.getComputedStyle(u),I=parseInt(w.borderTopWidth,10),V=parseInt(w.paddingTop,10),$=parseInt(w.borderBottomWidth,10),F=parseInt(w.paddingBottom,10),J=I+V+R+F+$,se=Math.min(x.offsetHeight*5,J),U=window.getComputedStyle(f),B=parseInt(U.paddingTop,10),te=parseInt(U.paddingBottom,10),ee=E.top+E.height/2-Qe,K=S-ee,ue=x.offsetHeight/2,X=x.offsetTop+ue,ie=I+V+X,ae=J-ie;if(ie<=ee){const fe=Z.length>0&&x===Z[Z.length-1].ref.current;l.style.bottom="0px";const we=u.clientHeight-f.offsetTop-f.offsetHeight,Te=Math.max(K,ue+(fe?te:0)+we+$),b=ie+Te;l.style.height=b+"px"}else{const fe=Z.length>0&&x===Z[0].ref.current;l.style.top="0px";const Te=Math.max(ee,I+f.offsetTop+(fe?B:0)+ue)+ae;l.style.height=Te+"px",f.scrollTop=ie-ee+f.offsetTop}l.style.margin=`${Qe}px 0`,l.style.minHeight=se+"px",l.style.maxHeight=S+"px",r?.(),requestAnimationFrame(()=>p.current=!0)}},[m,s.trigger,s.valueNode,l,u,f,x,y,s.dir,r]);Ue(()=>k(),[k]);const[C,j]=v.useState();Ue(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const z=v.useCallback(E=>{E&&g.current===!0&&(k(),_?.(),g.current=!1)},[k,_]);return a.jsx(w2,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:z,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:a.jsx(Ce.div,{...o,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Zc.displayName=y2;var b2="SelectPopperPosition",Ao=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Qe,...s}=e,i=Br(n);return a.jsx(Sc,{...i,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Ao.displayName=b2;var[w2,bs]=gn(Pt,{}),zo="SelectViewport",Wc=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=Nt(zo,n),i=bs(zo,n),l=Re(t,s.onViewportChange),c=v.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(Fr.Slot,{scope:n,children:a.jsx(Ce.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ye(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=i;if(m?.current&&h){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-Qe*2,f=parseFloat(h.style.minHeight),x=parseFloat(h.style.height),y=Math.max(f,x);if(y<g){const _=y+p,k=Math.min(g,_),C=_-k;h.style.height=k+"px",h.style.bottom==="0px"&&(d.scrollTop=C>0?C:0,h.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Wc.displayName=zo;var Vc="SelectGroup",[_2,k2]=gn(Vc),C2=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=ht();return a.jsx(_2,{scope:n,id:o,children:a.jsx(Ce.div,{role:"group","aria-labelledby":o,...r,ref:t})})});C2.displayName=Vc;var Hc="SelectLabel",S2=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=k2(Hc,n);return a.jsx(Ce.div,{id:o.id,...r,ref:t})});S2.displayName=Hc;var wr="SelectItem",[j2,qc]=gn(wr),Jc=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,l=Et(wr,n),c=Nt(wr,n),u=l.value===r,[d,h]=v.useState(s??""),[m,p]=v.useState(!1),g=Re(t,_=>c.itemRefCallback?.(_,r,o)),f=ht(),x=v.useRef("touch"),y=()=>{o||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(j2,{scope:n,value:r,disabled:o,textId:f,isSelected:u,onItemTextChange:v.useCallback(_=>{h(k=>k||(_?.textContent??"").trim())},[]),children:a.jsx(Fr.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:a.jsx(Ce.div,{role:"option","aria-labelledby":f,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:g,onFocus:ye(i.onFocus,()=>p(!0)),onBlur:ye(i.onBlur,()=>p(!1)),onClick:ye(i.onClick,()=>{x.current!=="mouse"&&y()}),onPointerUp:ye(i.onPointerUp,()=>{x.current==="mouse"&&y()}),onPointerDown:ye(i.onPointerDown,_=>{x.current=_.pointerType}),onPointerMove:ye(i.onPointerMove,_=>{x.current=_.pointerType,o?c.onItemLeave?.():x.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ye(i.onPointerLeave,_=>{_.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:ye(i.onKeyDown,_=>{c.searchRef?.current!==""&&_.key===" "||(u2.includes(_.key)&&y(),_.key===" "&&_.preventDefault())})})})})});Jc.displayName=wr;var En="SelectItemText",Kc=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=Et(En,n),l=Nt(En,n),c=qc(En,n),u=p2(En,n),[d,h]=v.useState(null),m=Re(t,y=>h(y),c.onItemTextChange,y=>l.itemTextRefCallback?.(y,c.value,c.disabled)),p=d?.textContent,g=v.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:f,onNativeOptionRemove:x}=u;return Ue(()=>(f(g),()=>x(g)),[f,x,g]),a.jsxs(a.Fragment,{children:[a.jsx(Ce.span,{id:c.textId,...s,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?In.createPortal(s.children,i.valueNode):null]})});Kc.displayName=En;var Gc="SelectItemIndicator",Yc=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return qc(Gc,n).isSelected?a.jsx(Ce.span,{"aria-hidden":!0,...r,ref:t}):null});Yc.displayName=Gc;var Oo="SelectScrollUpButton",Xc=v.forwardRef((e,t)=>{const n=Nt(Oo,e.__scopeSelect),r=bs(Oo,e.__scopeSelect),[o,s]=v.useState(!1),i=Re(t,r.onScrollButtonChange);return Ue(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;s(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(eu,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Xc.displayName=Oo;var Ro="SelectScrollDownButton",Qc=v.forwardRef((e,t)=>{const n=Nt(Ro,e.__scopeSelect),r=bs(Ro,e.__scopeSelect),[o,s]=v.useState(!1),i=Re(t,r.onScrollButtonChange);return Ue(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;s(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(eu,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Qc.displayName=Ro;var eu=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=Nt("SelectScrollButton",n),i=v.useRef(null),l=$r(n),c=v.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Ue(()=>{l().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),a.jsx(Ce.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ye(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ye(o.onPointerMove,()=>{s.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ye(o.onPointerLeave,()=>{c()})})}),E2="SelectSeparator",N2=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(Ce.div,{"aria-hidden":!0,...r,ref:t})});N2.displayName=E2;var Io="SelectArrow",T2=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Br(n),s=Et(Io,n),i=Nt(Io,n);return s.open&&i.position==="popper"?a.jsx(jc,{...o,...r,ref:t}):null});T2.displayName=Io;var A2="SelectBubbleInput",tu=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=v.useRef(null),s=Re(r,o),i=Av(t);return v.useEffect(()=>{const l=o.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const h=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(h)}},[i,t]),a.jsx(Ce.select,{...n,style:{...Sl,...n.style},ref:s,defaultValue:t})});tu.displayName=A2;function nu(e){return e===""||e===void 0}function ru(e){const t=_t(e),n=v.useRef(""),r=v.useRef(0),o=v.useCallback(i=>{const l=n.current+i;t(l),(function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),s=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function ou(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=z2(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function z2(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var O2=Rc,R2=Pc,I2=Dc,P2=Lc,M2=Fc,D2=$c,L2=Wc,F2=Jc,$2=Kc,B2=Yc,U2=Xc,Z2=Qc,Ur="Tabs",[W2]=$t(Ur,[Nc]),su=Nc(),[V2,ws]=W2(Ur),iu=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=is(l),[h,m]=ln({prop:r,onChange:o,defaultProp:s??"",caller:Ur});return a.jsx(V2,{scope:n,baseId:ht(),value:h,onValueChange:m,orientation:i,dir:d,activationMode:c,children:a.jsx(Ce.div,{dir:d,"data-orientation":i,...u,ref:t})})});iu.displayName=Ur;var au="TabsList",lu=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=ws(au,n),i=su(n);return a.jsx(a2,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:a.jsx(Ce.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});lu.displayName=au;var cu="TabsTrigger",uu=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=ws(cu,n),l=su(n),c=hu(i.baseId,r),u=pu(i.baseId,r),d=r===i.value;return a.jsx(l2,{asChild:!0,...l,focusable:!o,active:d,children:a.jsx(Ce.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:ye(e.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?i.onValueChange(r):h.preventDefault()}),onKeyDown:ye(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&i.onValueChange(r)}),onFocus:ye(e.onFocus,()=>{const h=i.activationMode!=="manual";!d&&!o&&h&&i.onValueChange(r)})})})});uu.displayName=cu;var du="TabsContent",fu=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,l=ws(du,n),c=hu(l.baseId,r),u=pu(l.baseId,r),d=r===l.value,h=v.useRef(d);return v.useEffect(()=>{const m=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(Bt,{present:o||d,children:({present:m})=>a.jsx(Ce.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:m&&s})})});fu.displayName=du;function hu(e,t){return`${e}-trigger-${t}`}function pu(e,t){return`${e}-content-${t}`}var H2=iu,q2=lu,J2=uu,K2=fu,[Zr]=$t("Tooltip",[Lr]),Wr=Lr(),mu="TooltipProvider",G2=700,Po="tooltip.open",[Y2,_s]=Zr(mu),gu=e=>{const{__scopeTooltip:t,delayDuration:n=G2,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=v.useRef(!0),l=v.useRef(!1),c=v.useRef(0);return v.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(Y2,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:v.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:v.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:s})};gu.displayName=mu;var On="Tooltip",[X2,$n]=Zr(On),xu=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=_s(On,e.__scopeTooltip),u=Wr(t),[d,h]=v.useState(null),m=ht(),p=v.useRef(0),g=i??c.disableHoverableContent,f=l??c.delayDuration,x=v.useRef(!1),[y,_]=ln({prop:r,defaultProp:o??!1,onChange:E=>{E?(c.onOpen(),document.dispatchEvent(new CustomEvent(Po))):c.onClose(),s?.(E)},caller:On}),k=v.useMemo(()=>y?x.current?"delayed-open":"instant-open":"closed",[y]),C=v.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x.current=!1,_(!0)},[_]),j=v.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),z=v.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{x.current=!0,_(!0),p.current=0},f)},[f,_]);return v.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),a.jsx(kc,{...u,children:a.jsx(X2,{scope:t,contentId:m,open:y,stateAttribute:k,trigger:d,onTriggerChange:h,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayedRef.current?z():C()},[c.isOpenDelayedRef,z,C]),onTriggerLeave:v.useCallback(()=>{g?j():(window.clearTimeout(p.current),p.current=0)},[j,g]),onOpen:C,onClose:j,disableHoverableContent:g,children:n})})};xu.displayName=On;var Mo="TooltipTrigger",vu=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=$n(Mo,n),s=_s(Mo,n),i=Wr(n),l=v.useRef(null),c=Re(t,l,o.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),h=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),a.jsx(Cc,{asChild:!0,...i,children:a.jsx(Ce.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:ye(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:ye(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:ye(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:ye(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:ye(e.onBlur,o.onClose),onClick:ye(e.onClick,o.onClose)})})});vu.displayName=Mo;var ks="TooltipPortal",[Q2,eb]=Zr(ks,{forceMount:void 0}),yu=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=$n(ks,t);return a.jsx(Q2,{scope:t,forceMount:n,children:a.jsx(Bt,{present:n||s.open,children:a.jsx(zr,{asChild:!0,container:o,children:r})})})};yu.displayName=ks;var un="TooltipContent",bu=v.forwardRef((e,t)=>{const n=eb(un,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=$n(un,e.__scopeTooltip);return a.jsx(Bt,{present:r||i.open,children:i.disableHoverableContent?a.jsx(wu,{side:o,...s,ref:t}):a.jsx(tb,{side:o,...s,ref:t})})}),tb=v.forwardRef((e,t)=>{const n=$n(un,e.__scopeTooltip),r=_s(un,e.__scopeTooltip),o=v.useRef(null),s=Re(t,o),[i,l]=v.useState(null),{trigger:c,onClose:u}=n,d=o.current,{onPointerInTransitChange:h}=r,m=v.useCallback(()=>{l(null),h(!1)},[h]),p=v.useCallback((g,f)=>{const x=g.currentTarget,y={x:g.clientX,y:g.clientY},_=sb(y,x.getBoundingClientRect()),k=ib(y,_),C=ab(f.getBoundingClientRect()),j=cb([...k,...C]);l(j),h(!0)},[h]);return v.useEffect(()=>()=>m(),[m]),v.useEffect(()=>{if(c&&d){const g=x=>p(x,d),f=x=>p(x,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",f),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",f)}}},[c,d,p,m]),v.useEffect(()=>{if(i){const g=f=>{const x=f.target,y={x:f.clientX,y:f.clientY},_=c?.contains(x)||d?.contains(x),k=!lb(y,i);_?m():k&&(m(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,i,u,m]),a.jsx(wu,{...e,ref:s})}),[nb,rb]=Zr(On,{isInside:!1}),ob=q1("TooltipContent"),wu=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=$n(un,n),u=Wr(n),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(Po,d),()=>document.removeEventListener(Po,d)),[d]),v.useEffect(()=>{if(c.trigger){const h=m=>{m.target?.contains(c.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,d]),a.jsx(Ar,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:a.jsxs(Sc,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(ob,{children:r}),a.jsx(nb,{scope:n,isInside:!0,children:a.jsx(ex,{id:c.contentId,role:"tooltip",children:o||r})})]})})});bu.displayName=un;var _u="TooltipArrow",ku=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Wr(n);return rb(_u,n).isInside?null:a.jsx(jc,{...o,...r,ref:t})});ku.displayName=_u;function sb(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function ib(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ab(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function lb(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],u=l.x,d=l.y,h=c.x,m=c.y;d>r!=m>r&&n<(h-u)*(r-d)/(m-d)+u&&(o=!o)}return o}function cb(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),ub(t)}function ub(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var db=gu,fb=xu,hb=vu,pb=yu,mb=bu,gb=ku;const xb=ss("inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function Cu({className:e,variant:t="default",asChild:n=!1,...r}){const o=n?V1:"span";return a.jsx(o,{"data-slot":"badge","data-variant":t,className:xe(xb({variant:t}),e),...r})}function Cs({...e}){return a.jsx(kv,{"data-slot":"dialog",...e})}function vb({...e}){return a.jsx(Cv,{"data-slot":"dialog-trigger",...e})}function yb({...e}){return a.jsx(Sv,{"data-slot":"dialog-portal",...e})}function bb({className:e,...t}){return a.jsx(jv,{"data-slot":"dialog-overlay",className:xe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t})}function Ss({className:e,children:t,...n}){return a.jsxs(yb,{children:[a.jsx(bb,{}),a.jsxs(Ev,{"data-slot":"dialog-content",className:xe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",e),...n,children:[t,a.jsxs(Tv,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(ll,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function js({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-header",className:xe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function Es({className:e,...t}){return a.jsx(Nv,{"data-slot":"dialog-title",className:xe("text-lg font-semibold leading-none tracking-tight",e),...t})}const wb=ss("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function De({className:e,variant:t,size:n,...r}){return a.jsx("button",{"data-slot":"button",className:xe(wb({variant:t,size:n,className:e})),...r})}function Su({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o="Confirm",variant:s="default",onConfirm:i}){return a.jsx(Cs,{open:e,onOpenChange:t,children:a.jsxs(Ss,{children:[a.jsx(js,{children:a.jsx(Es,{children:n})}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[a.jsx(De,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),a.jsx(De,{variant:s,size:"sm",onClick:()=>{i(),t(!1)},children:o})]})]})})}const _b={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function Li(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function kb({conversationId:e,startTime:t,endTime:n,totalCalls:r,totalInputTokens:o,totalOutputTokens:s,apiFormat:i,expanded:l,onToggle:c,hideApiFormat:u=!1,isLoading:d=!1,userAgent:h,onClear:m}){const[p,g]=v.useState(!1),f=y=>{y.stopPropagation(),m!==void 0&&g(!0)},x=v.useCallback(y=>{y.stopPropagation(),window.open(Ju(e),"_blank","noopener,noreferrer")},[e]);return a.jsxs("div",{role:"button",tabIndex:0,"data-nav-id":`conv-${e}`,"data-nav-action":l?"collapse":"expand",className:xe("flex items-center gap-3 px-3 py-2 cursor-pointer transition-colors","hover:bg-muted/50","select-none","border border-border rounded-lg mb-2 bg-background sticky top-0 z-10","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:c,onKeyDown:y=>{y.target===y.currentTarget&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),c())},children:[l?a.jsx(Mn,{className:"size-4 text-muted-foreground shrink-0"}):d?a.jsx(pr,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):a.jsx(Qo,{className:"size-4 text-muted-foreground shrink-0"}),a.jsx("span",{className:"text-purple-400/90 font-mono text-xs font-semibold shrink-0",title:e,children:e.startsWith("PID:")||e.includes("|")?e:e.length>24?e.slice(0,12)+"..."+e.slice(-12):e}),h!=null&&h!==""&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:h,children:[a.jsx(D0,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:h})]}),!u&&a.jsx(Cu,{variant:"outline",className:xe("text-[10px] px-1.5 py-0 h-5 font-mono shrink-0",i==="openai"&&"border-blue-500/40 text-blue-400",i==="anthropic"&&"border-orange-500/40 text-orange-400",i==="unknown"&&"border-muted text-muted-foreground"),children:_b[i]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(sn,{className:"size-3"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[Li(t)," - ",Li(n)]})]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(sl,{className:"size-3"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[r," call",r!==1?"s":""]})]}),a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(rs,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsx("span",{className:"text-blue-400",children:Je(o)})," / ",a.jsx("span",{className:"text-amber-400",children:Je(s)})]})]}),a.jsx("span",{className:"flex-1 min-w-0"}),a.jsx("button",{type:"button",onClick:x,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&x(y)},"aria-label":`Open session ${e} in a new tab`,title:"Open this session in a new tab",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-8 rounded hover:bg-muted cursor-pointer",children:a.jsx(ol,{className:"size-3.5"})}),m!==void 0&&a.jsx("button",{type:"button",onClick:f,"aria-label":`Clear group (${r} request${r!==1?"s":""})`,title:"Clear this group",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-8 rounded hover:bg-muted cursor-pointer",children:a.jsx(al,{className:"size-3.5"})}),a.jsx(Su,{open:p,onOpenChange:g,title:"Clear this group?",description:`This will remove ${r} request${r!==1?"s":""} from this conversation. This action cannot be undone.`,confirmLabel:"Clear",variant:"destructive",onConfirm:()=>{m?.()}})]})}function Cb(e){const t=e.find(n=>n.apiFormat!=="unknown");return t!==void 0?t.apiFormat:e[0]?.apiFormat??"unknown"}function Sb(e){let t=!1,n=!1;for(const r of e)if(r.apiFormat==="anthropic"?t=!0:r.apiFormat==="openai"&&(n=!0),t&&n)return!0;return!1}function jb(e){if(e.isTest===!0)return"provider-test";if(e.sessionId!==null&&e.sessionId!==""&&e.sessionId!==void 0)return e.sessionId;const t=e.clientPid!==null&&e.clientPid!==void 0,n=e.clientProjectFolder!==null&&e.clientProjectFolder!==void 0;if(!t&&!n)return"default";const r=t?`PID:${e.clientPid}`:"unknown",o=n?e.clientProjectFolder:"no-folder";return`${r}|${o}`}function Eb(e){const t=new Map;for(const r of e){const o=jb(r),s=t.get(o);s!==void 0?s.push(r):t.set(o,[r])}const n=[];for(const[r,o]of t){const s=[...o].sort((i,l)=>i.timestamp.localeCompare(l.timestamp));n.push({id:r,conversationId:r,logs:s})}return n.sort((r,o)=>(r.logs[0]?.timestamp??"").localeCompare(o.logs[0]?.timestamp??"")),n}function Fi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Nb(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),Fi(t)?typeof t.stop_reason=="string"?t.stop_reason==="end_turn"||t.stop_reason==="tool_use"?t.stop_reason:null:Array.isArray(t.choices)&&t.choices.length>0&&Fi(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function ju(e){return e==="end_turn"||e==="stop"}function Xe({className:e,style:t,d:n,eyeStalks:r,eyes:o,legs:s,extras:i}){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:t,className:xe("inline-block size-5",e),children:[a.jsx("path",{d:n}),r,o,s,i]})}const Tt=a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),a.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),a.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),a.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]}),Eu=a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7",y1:"16",x2:"5.5",y2:"18.5"}),a.jsx("line",{x1:"9.5",y1:"17",x2:"8.5",y2:"19.5"}),a.jsx("line",{x1:"14.5",y1:"17",x2:"15.5",y2:"19.5"}),a.jsx("line",{x1:"17",y1:"16",x2:"18.5",y2:"18.5"})]});function Nu({className:e}){return a.jsx(Xe,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"})]}),legs:Tt,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function Tb({className:e}){return a.jsx(Xe,{className:e,d:"M4 13 C4 7 7.5 5.5 12 5.5 C16.5 5.5 20 7 20 13 C20 17.5 16.5 19 12 19 C7.5 19 4 17.5 4 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"9.5",y1:"6.5",x2:"9.5",y2:"4.5"}),a.jsx("line",{x1:"14.5",y1:"6.5",x2:"14.5",y2:"4.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"})]}),legs:Eu,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C4 9.5 2.5 10 3 12 C3.5 13.5 4.5 13 5 12"}),a.jsx("path",{d:"M19 11 C20 9.5 21.5 10 21 12 C20.5 13.5 19.5 13 19 12"})]})})}function Ab({className:e}){return a.jsx(Xe,{className:e,d:"M3 13.5 C3 8 7 6 12 6 C17 6 21 8 21 13.5 C21 17 17 19 12 19 C7 19 3 17 3 13.5 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7",y1:"7",x2:"6.5",y2:"4.5"}),a.jsx("line",{x1:"17",y1:"7",x2:"17.5",y2:"4.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"6.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"17.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:Tt,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M4 12 C2.5 10.5 1 11 1.5 13 C2 14.5 3.5 14 4.5 13"}),a.jsx("path",{d:"M20 12 C21.5 10.5 23 11 22.5 13 C22 14.5 20.5 14 19.5 13"})]})})}function zb({className:e}){return a.jsx(Xe,{className:e,d:"M6 14 C6 8 9 5.5 12 5.5 C15 5.5 18 8 18 14 C18 18 15 20 12 20 C9 20 6 18 6 14 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"6.5",x2:"10",y2:"3.5"}),a.jsx("line",{x1:"14",y1:"6.5",x2:"14",y2:"3.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"10",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7",y1:"17",x2:"5",y2:"20.5"}),a.jsx("line",{x1:"9.5",y1:"18.5",x2:"8.5",y2:"21.5"}),a.jsx("line",{x1:"14.5",y1:"18.5",x2:"15.5",y2:"21.5"}),a.jsx("line",{x1:"17",y1:"17",x2:"19",y2:"20.5"})]}),extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M6.5 11 C5 8.5 3 9 3.5 11.5 C4 13.5 5 13 6 12"}),a.jsx("path",{d:"M17.5 11 C19 8.5 21 9 20.5 11.5 C20 13.5 19 13 18 12"})]})})}function Ob({className:e}){return a.jsx(Xe,{className:e,d:"M5 13 C5 9 8 7 12 7 L13 4 L14 7 C16 7 19 9 19 13 C19 16 16 18 13 18 L12 21 L11 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:Tt,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function Rb({className:e}){return a.jsx(Xe,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("line",{x1:"13.5",y1:"4",x2:"15.5",y2:"5"})]}),legs:Tt,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function Ib({className:e}){return a.jsx(Xe,{className:e,d:"M5.5 13.5 C5.5 10 8.5 8 12 8 C15.5 8 18.5 10 18.5 13.5 C18.5 16 15.5 17.5 12 17.5 C8.5 17.5 5.5 16 5.5 13.5 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"6"}),a.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"6"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"9",y1:"6",x2:"11",y2:"6.5"}),a.jsx("line",{x1:"13",y1:"6",x2:"15",y2:"6.5"})]}),legs:Eu,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M6 11.5 C4.5 10.5 3 11 3.5 12.5 C4 13.5 5 13 5.5 12.5"}),a.jsx("path",{d:"M18 11.5 C19.5 10.5 21 11 20.5 12.5 C20 13.5 19 13 18.5 12.5"})]})})}function Pb({className:e}){return a.jsx(Xe,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:Tt,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("line",{x1:"8.5",y1:"4",x2:"10.5",y2:"4.5"}),a.jsx("line",{x1:"15.5",y1:"4",x2:"13.5",y2:"4.5"}),a.jsx("path",{d:"M9 15.5 C10 14.5 14 14.5 15 15.5"})]})})}function Mb({className:e}){return a.jsx(Xe,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"})]}),legs:Tt,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("ellipse",{cx:"12",cy:"15",rx:"2",ry:"1.5",fill:"currentColor",stroke:"none"})]})})}function Db({className:e}){return a.jsx(Xe,{className:e,d:"M4.5 13 C4.5 8 7.5 6 12 6 C16.5 6 19.5 8 19.5 13 C19.5 17 16.5 18.5 12 18.5 C7.5 18.5 4.5 17 4.5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"9.5",y1:"7",x2:"9",y2:"5"}),a.jsx("line",{x1:"14.5",y1:"7",x2:"15",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"15",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"})]}),legs:Tt,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9 2 9.5 2.5 12 C3 14 4 13 5 12"}),a.jsx("path",{d:"M19 11 C20.5 9 22 9.5 21.5 12 C21 14 20 13 19 12"}),a.jsx("path",{d:"M9 14.5 C10 16 14 16 15 14.5"}),a.jsx("circle",{cx:"7",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"}),a.jsx("circle",{cx:"17",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"})]})})}function Lb({className:e}){return a.jsx(Xe,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5.5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7.5",y1:"5.5",x2:"16.5",y2:"5.5"}),a.jsx("rect",{x:"7",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"}),a.jsx("rect",{x:"13",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"})]}),legs:Tt,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("path",{d:"M9.5 15 C10.5 16 13.5 16 14.5 15"})]})})}function Fb({className:e}){return a.jsx(Xe,{className:e,d:"M7 13.5 C7 10.5 9.5 9 12 9 C14.5 9 17 10.5 17 13.5 C17 16 14.5 17.5 12 17.5 C9.5 17.5 7 16 7 13.5 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10.5",y1:"9.5",x2:"10.5",y2:"8"}),a.jsx("line",{x1:"13.5",y1:"9.5",x2:"13.5",y2:"8"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"10.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"13.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"8",y1:"16",x2:"6.5",y2:"18"}),a.jsx("line",{x1:"10",y1:"17",x2:"9.5",y2:"19"}),a.jsx("line",{x1:"14",y1:"17",x2:"14.5",y2:"19"}),a.jsx("line",{x1:"16",y1:"16",x2:"17.5",y2:"18"})]}),extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M7.5 12 C6.5 11 5.5 11.5 6 13 C6.5 14 7 13.5 7.5 13"}),a.jsx("path",{d:"M16.5 12 C17.5 11 18.5 11.5 18 13 C17.5 14 17 13.5 16.5 13"})]})})}const Rn=[Nu,Tb,Ab,zb,Ob,Rb,Ib,Pb,Mb,Db,Lb,Fb];function _r(e){return Rn[Math.abs(e)%Rn.length]??Nu}function $b(e){const t=Rn.length-2;return t<=0?0:1+((Number.isFinite(e)?Math.trunc(e):0)%t+t)%t}function Bb(e){return _r($b(e))}const Ub="data:image/svg+xml,%3csvg%20height='2500'%20viewBox='0%206.603%201192.672%201193.397'%20width='2500'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m233.96%20800.215%20234.684-131.678%203.947-11.436-3.947-6.363h-11.436l-39.221-2.416-134.094-3.624-116.296-4.832-112.67-6.04-28.35-6.04-26.577-35.035%202.738-17.477%2023.84-16.027%2034.147%202.98%2075.463%205.155%20113.235%207.812%2082.147%204.832%20121.692%2012.644h19.329l2.738-7.812-6.604-4.832-5.154-4.832-117.182-79.41-126.845-83.92-66.443-48.321-35.92-24.484-18.12-22.953-7.813-50.093%2032.618-35.92%2043.812%202.98%2011.195%202.98%2044.375%2034.147%2094.792%2073.37%20123.786%2091.167%2018.12%2015.06%207.249-5.154.886-3.624-8.135-13.61-67.329-121.692-71.838-123.785-31.974-51.302-8.456-30.765c-2.98-12.645-5.154-23.275-5.154-36.242l37.127-50.416%2020.537-6.604%2049.53%206.604%2020.86%2018.121%2030.765%2070.39%2049.852%20110.818%2077.315%20150.684%2022.631%2044.698%2012.08%2041.396%204.51%2012.645h7.813v-7.248l6.362-84.886%2011.759-104.215%2011.436-134.094%203.946-37.772%2018.685-45.262%2037.127-24.482%2028.994%2013.852%2023.839%2034.148-3.303%2022.067-14.174%2092.134-27.785%20144.323-18.121%2096.644h10.55l12.08-12.08%2048.887-64.913%2082.147-102.685%2036.242-40.752%2042.282-45.02%2027.14-21.423h51.303l37.772%2056.135-16.913%2057.986-52.832%2067.007-43.812%2056.779-62.82%2084.563-39.22%2067.651%203.623%205.396%209.343-.886%20141.906-30.201%2076.671-13.852%2091.49-15.705%2041.396%2019.329%204.51%2019.65-16.269%2040.189-97.852%2024.16-114.764%2022.954-170.9%2040.43-2.093%201.53%202.416%202.98%2076.993%207.248%2032.94%201.771h80.617l150.12%2011.195%2039.222%2025.933%2023.517%2031.732-3.946%2024.16-60.403%2030.766-81.503-19.33-190.228-45.26-65.235-16.27h-9.02v5.397l54.362%2053.154%2099.624%2089.96%20124.752%20115.973%206.362%2028.671-16.027%2022.63-16.912-2.415-109.611-82.47-42.282-37.127-95.758-80.618h-6.363v8.456l22.067%2032.296%20116.537%20175.167%206.04%2053.719-8.456%2017.476-30.201%2010.55-33.181-6.04-68.215-95.758-70.39-107.84-56.778-96.644-6.926%203.947-33.503%20360.886-15.705%2018.443-36.243%2013.852-30.201-22.953-16.027-37.127%2016.027-73.37%2019.329-95.758%2015.704-76.107%2014.175-94.55%208.456-31.41-.563-2.094-6.927.886-71.275%2097.852-108.402%20146.497-85.772%2091.812-20.537%208.134-35.597-18.443%203.301-32.94%2019.893-29.315%20118.712-151.007%2071.597-93.583%2046.228-54.04-.322-7.813h-2.738l-315.302%20204.725-56.135%207.248-24.16-22.63%202.98-37.128%2011.435-12.08%2094.792-65.236-.322.323z'%20fill='%23d97757'/%3e%3c/svg%3e",Zb="data:image/svg+xml,%3csvg%20height='2500'%20viewBox='-1%20-.1%20949.1%20959.8'%20width='2474'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m925.8%20456.3c10.4%2023.2%2017%2048%2019.7%2073.3%202.6%2025.3%201.3%2050.9-4.1%2075.8-5.3%2024.9-14.5%2048.8-27.3%2070.8-8.4%2014.7-18.3%2028.5-29.7%2041.2-11.3%2012.6-23.9%2024-37.6%2034-13.8%2010-28.5%2018.4-44.1%2025.3-15.5%206.8-31.7%2012-48.3%2015.4-7.8%2024.2-19.4%2047.1-34.4%2067.7-14.9%2020.6-33%2038.7-53.6%2053.6-20.6%2015-43.4%2026.6-67.6%2034.4-24.2%207.9-49.5%2011.8-75%2011.8-16.9.1-33.9-1.7-50.5-5.1-16.5-3.5-32.7-8.8-48.2-15.7s-30.2-15.5-43.9-25.5c-13.6-10-26.2-21.5-37.4-34.2-25%205.4-50.6%206.7-75.9%204.1-25.3-2.7-50.1-9.3-73.4-19.7-23.2-10.3-44.7-24.3-63.6-41.4s-35-37.1-47.7-59.1c-8.5-14.7-15.5-30.2-20.8-46.3s-8.8-32.7-10.6-49.6c-1.8-16.8-1.7-33.8.1-50.7%201.8-16.8%205.5-33.4%2010.8-49.5-17-18.9-31-40.4-41.4-63.6-10.3-23.3-17-48-19.6-73.3-2.7-25.3-1.3-50.9%204-75.8s14.5-48.8%2027.3-70.8c8.4-14.7%2018.3-28.6%2029.6-41.2s24-24%2037.7-34%2028.5-18.5%2044-25.3c15.6-6.9%2031.8-12%2048.4-15.4%207.8-24.3%2019.4-47.1%2034.3-67.7%2015-20.6%2033.1-38.7%2053.7-53.7%2020.6-14.9%2043.4-26.5%2067.6-34.4%2024.2-7.8%2049.5-11.8%2075-11.7%2016.9-.1%2033.9%201.6%2050.5%205.1s32.8%208.7%2048.3%2015.6c15.5%207%2030.2%2015.5%2043.9%2025.5%2013.7%2010.1%2026.3%2021.5%2037.5%2034.2%2024.9-5.3%2050.5-6.6%2075.8-4s50%209.3%2073.3%2019.6c23.2%2010.4%2044.7%2024.3%2063.6%2041.4%2018.9%2017%2035%2036.9%2047.7%2059%208.5%2014.6%2015.5%2030.1%2020.8%2046.3%205.3%2016.1%208.9%2032.7%2010.6%2049.6%201.8%2016.9%201.8%2033.9-.1%2050.8-1.8%2016.9-5.5%2033.5-10.8%2049.6%2017.1%2018.9%2031%2040.3%2041.4%2063.6zm-333.2%20426.9c21.8-9%2041.6-22.3%2058.3-39s30-36.5%2039-58.4c9-21.8%2013.7-45.2%2013.7-68.8v-223q-.1-.3-.2-.7-.1-.3-.3-.6-.2-.3-.5-.5-.3-.3-.6-.4l-80.7-46.6v269.4c0%202.7-.4%205.5-1.1%208.1-.7%202.7-1.7%205.2-3.1%207.6s-3%204.6-5%206.5a32.1%2032.1%200%200%201%20-6.5%205l-191.1%20110.3c-1.6%201-4.3%202.4-5.7%203.2%207.9%206.7%2016.5%2012.6%2025.5%2017.8%209.1%205.2%2018.5%209.6%2028.3%2013.2%209.8%203.5%2019.9%206.2%2030.1%208%2010.3%201.8%2020.7%202.7%2031.1%202.7%2023.6%200%2047-4.7%2068.8-13.8zm-455.1-151.4c11.9%2020.5%2027.6%2038.3%2046.3%2052.7%2018.8%2014.4%2040.1%2024.9%2062.9%2031s46.6%207.7%2070%204.6%2045.9-10.7%2066.4-22.5l193.2-111.5.5-.5q.2-.2.3-.6.2-.3.3-.6v-94l-233.2%20134.9c-2.4%201.4-4.9%202.4-7.5%203.2-2.7.7-5.4%201-8.2%201-2.7%200-5.4-.3-8.1-1-2.6-.8-5.2-1.8-7.6-3.2l-191.1-110.4c-1.7-1-4.2-2.5-5.6-3.4-1.8%2010.3-2.7%2020.7-2.7%2031.1s1%2020.8%202.8%2031.1c1.8%2010.2%204.6%2020.3%208.1%2030.1%203.6%209.8%208%2019.2%2013.2%2028.2zm-50.2-417c-11.8%2020.5-19.4%2043.1-22.5%2066.5s-1.5%2047.1%204.6%2070c6.1%2022.8%2016.6%2044.1%2031%2062.9%2014.4%2018.7%2032.3%2034.4%2052.7%2046.2l193.1%20111.6q.3.1.7.2h.7q.4%200%20.7-.2.3-.1.6-.3l81-46.8-233.2-134.6c-2.3-1.4-4.5-3.1-6.5-5a32.1%2032.1%200%200%201%20-5-6.5c-1.3-2.4-2.4-4.9-3.1-7.6-.7-2.6-1.1-5.3-1-8.1v-227.1c-9.8%203.6-19.3%208-28.3%2013.2-9%205.3-17.5%2011.3-25.5%2018-7.9%206.7-15.3%2014.1-22%2022.1-6.7%207.9-12.6%2016.5-17.8%2025.5zm663.3%20154.4c2.4%201.4%204.6%203%206.6%205%201.9%201.9%203.6%204.1%205%206.5%201.3%202.4%202.4%205%203.1%207.6.6%202.7%201%205.4.9%208.2v227.1c32.1-11.8%2060.1-32.5%2080.8-59.7%2020.8-27.2%2033.3-59.7%2036.2-93.7s-3.9-68.2-19.7-98.5-39.9-55.5-69.5-72.5l-193.1-111.6q-.3-.1-.7-.2h-.7q-.3.1-.7.2-.3.1-.6.3l-80.6%2046.6%20233.2%20134.7zm80.5-121h-.1v.1zm-.1-.1c5.8-33.6%201.9-68.2-11.3-99.7-13.1-31.5-35-58.6-63-78.2-28-19.5-61-30.7-95.1-32.2-34.2-1.4-68%206.9-97.6%2023.9l-193.1%20111.5q-.3.2-.5.5l-.4.6q-.1.3-.2.7-.1.3-.1.7v93.2l233.2-134.7c2.4-1.4%205-2.4%207.6-3.2%202.7-.7%205.4-1%208.1-1%202.8%200%205.5.3%208.2%201%202.6.8%205.1%201.8%207.5%203.2l191.1%20110.4c1.7%201%204.2%202.4%205.6%203.3zm-505.3-103.2c0-2.7.4-5.4%201.1-8.1.7-2.6%201.7-5.2%203.1-7.6%201.4-2.3%203-4.5%205-6.5%201.9-1.9%204.1-3.6%206.5-4.9l191.1-110.3c1.8-1.1%204.3-2.5%205.7-3.2-26.2-21.9-58.2-35.9-92.1-40.2-33.9-4.4-68.3%201-99.2%2015.5-31%2014.5-57.2%2037.6-75.5%2066.4-18.3%2028.9-28%2062.3-28%2096.5v223q.1.4.2.7.1.3.3.6.2.3.5.6.2.2.6.4l80.7%2046.6zm43.8%20294.7%20103.9%2060%20103.9-60v-119.9l-103.8-60-103.9%2060z'/%3e%3c/svg%3e",Wb="data:image/svg+xml,%3csvg%20fill='none'%20height='1320'%20viewBox='3.771%206.973%2023.993%2017.652'%20width='2500'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m27.501%208.469c-.252-.123-.36.111-.508.23-.05.04-.093.09-.135.135-.368.395-.797.652-1.358.621-.821-.045-1.521.213-2.14.842-.132-.776-.57-1.238-1.235-1.535-.349-.155-.701-.309-.944-.645-.171-.238-.217-.504-.303-.765-.054-.159-.108-.32-.29-.348-.197-.031-.274.135-.352.273-.31.567-.43%201.192-.419%201.825.028%201.421.628%202.554%201.82%203.36.136.093.17.186.128.321-.081.278-.178.547-.264.824-.054.178-.135.217-.324.14a5.448%205.448%200%200%201%20-1.719-1.169c-.848-.82-1.614-1.726-2.57-2.435-.225-.166-.449-.32-.681-.467-.976-.95.128-1.729.383-1.82.267-.096.093-.428-.77-.424s-1.653.293-2.659.677a2.782%202.782%200%200%201%20-.46.135%209.554%209.554%200%200%200%20-2.853-.1c-1.866.21-3.356%201.092-4.452%202.6-1.315%201.81-1.625%203.87-1.246%206.018.399%202.261%201.552%204.136%203.326%205.601%201.837%201.518%203.955%202.262%206.37%202.12%201.466-.085%203.1-.282%204.942-1.842.465.23.952.322%201.762.392.623.059%201.223-.031%201.687-.127.728-.154.677-.828.414-.953-2.132-.994-1.665-.59-2.09-.916%201.084-1.285%202.717-2.619%203.356-6.94.05-.343.007-.558%200-.837-.004-.168.034-.235.228-.254a4.084%204.084%200%200%200%201.529-.47c1.382-.757%201.938-1.997%202.07-3.485.02-.227-.004-.463-.243-.582zm-12.041%2013.391c-2.067-1.627-3.07-2.162-3.483-2.138-.387.021-.318.465-.233.754.089.285.205.482.368.732.113.166.19.414-.112.598-.666.414-1.823-.139-1.878-.166-1.347-.793-2.473-1.842-3.267-3.276-.765-1.38-1.21-2.861-1.284-4.441-.02-.383.093-.518.472-.586a4.692%204.692%200%200%201%201.514-.04c2.109.31%203.905%201.255%205.41%202.749.86.853%201.51%201.871%202.18%202.865.711%201.057%201.478%202.063%202.454%202.887.343.289.619.51.881.672-.792.088-2.117.107-3.022-.61zm.99-6.38a.304.304%200%201%201%20.609%200c0%20.17-.136.304-.306.304a.3.3%200%200%201%20-.303-.305zm3.077%201.581c-.197.08-.394.15-.584.159a1.246%201.246%200%200%201%20-.79-.252c-.27-.227-.463-.354-.546-.752a1.752%201.752%200%200%201%20.016-.582c.07-.324-.008-.531-.235-.72-.187-.155-.422-.196-.682-.196a.551.551%200%200%201%20-.252-.078c-.108-.055-.197-.19-.112-.356.027-.053.159-.183.19-.207.352-.201.758-.135%201.134.016.349.142.611.404.99.773.388.448.457.573.678.906.174.264.333.534.441.842.066.192-.02.35-.248.448z'%20fill='%234d6bfe'/%3e%3c/svg%3e",Vb="/assets/minimax-BPMzvuL-.jpeg",Hb="/assets/alibaba-TTwafVwX.svg",qb="/assets/qwen-CONDcHqt.png",Jb="/assets/zhipuai-BPNAnxo-.svg",Kb={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function Tu(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(Kb))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const Ut={width:24,height:24,objectFit:"contain"},Gb=We.memo(({className:e})=>a.jsx("img",{src:Ub,alt:"Anthropic",className:e,style:Ut})),Yb=We.memo(({className:e})=>a.jsx("img",{src:Zb,alt:"OpenAI",className:e,style:{...Ut,background:"white",borderRadius:"4px"}})),Xb=We.memo(({className:e})=>a.jsx("img",{src:Wb,alt:"DeepSeek",className:e,style:Ut})),Qb=We.memo(({className:e})=>a.jsx("img",{src:Vb,alt:"MiniMax",className:e,style:Ut})),ew=We.memo(({className:e})=>a.jsx("img",{src:Hb,alt:"Alibaba",className:e,style:Ut})),tw=We.memo(({className:e})=>a.jsx("img",{src:qb,alt:"Qwen",className:e,style:Ut})),nw=We.memo(({className:e})=>a.jsx("img",{src:Jb,alt:"ZhipuAI",className:e,style:Ut}));function Au({provider:e,className:t}){switch(e){case"anthropic":return a.jsx(Gb,{className:t});case"openai":return a.jsx(Yb,{className:t});case"deepseek":return a.jsx(Xb,{className:t});case"minimax":return a.jsx(Qb,{className:t});case"alibaba":return a.jsx(ew,{className:t});case"qwen":return a.jsx(tw,{className:t});case"zhipuai":return a.jsx(nw,{className:t});case"unknown":return null}}function $e({delayDuration:e=0,...t}){return a.jsx(db,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function je({...e}){return a.jsx(fb,{"data-slot":"tooltip",...e})}function Ee({...e}){return a.jsx(hb,{"data-slot":"tooltip-trigger",...e})}function Ne({className:e,sideOffset:t=0,children:n,...r}){return a.jsx(pb,{children:a.jsxs(mb,{"data-slot":"tooltip-content",sideOffset:t,className:xe("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,a.jsx(gb,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const rw="x-anthropic-billing-header:";function ow(e){return e.trimStart().toLowerCase().startsWith(rw)}function sw(e){return Wa(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function iw(e){if(!Wa(e))return!1;const t=ei(e,"type"),n=ei(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:ow(n)}function aw(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!sw(t))return{body:e,removed:0};const n=t.system;if(!Array.isArray(n)||n.length===0)return{body:e,removed:0};const r=[];let o=0;for(const s of n){if(iw(s)){o+=1;continue}r.push(s)}return o===0?{body:e,removed:0}:(r.length===0?delete t.system:t.system=r,{body:JSON.stringify(t),removed:o})}function lw(e){return{depth:Number.POSITIVE_INFINITY}}function cw(e){try{const t=JSON.parse(e);return{kind:"json",data:Do(t)}}catch{return{kind:"text"}}}function ao(e){const t=v.useMemo(()=>e===null?null:cw(e),[e]),n=t?.kind==="json"?t.data:null,r=v.useMemo(()=>n===null?null:lw(),[n]),[o,s]=v.useState(!1),[i,l]=v.useState(0),[c,u]=v.useState(0),[d,h]=v.useTransition(),m=v.useCallback(()=>{const p=!o,g=p&&r!==null?r.depth:0;h(()=>{s(p),l(g),u(f=>f+1)})},[o,r]);return{parsedData:n,policy:r,isExpanded:o,toggle:m,isPending:d,bulkDepth:i,bulkRevision:c}}function Do(e){if(e==null)return null;switch(typeof e){case"string":return e;case"number":return e;case"boolean":return e;case"object":{if(Array.isArray(e))return e.map(n=>Do(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=Do(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function zu({className:e,orientation:t="horizontal",...n}){return a.jsx(H2,{"data-slot":"tabs","data-orientation":t,orientation:t,className:xe("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const uw=ss("rounded-lg p-[3px] group-data-[orientation=horizontal]/tabs:h-9 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Ou({className:e,variant:t="default",...n}){return a.jsx(q2,{"data-slot":"tabs-list","data-variant":t,className:xe(uw({variant:t}),e),...n})}function dt({className:e,...t}){return a.jsx(J2,{"data-slot":"tabs-trigger",className:xe("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",e),...t})}function ft({className:e,...t}){return a.jsx(K2,{"data-slot":"tabs-content",className:xe("flex-1 outline-none",e),...t})}function _n(e){const[t,n]=v.useState(!1),r=v.useRef(null);v.useEffect(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);const o=v.useCallback(s=>{s.stopPropagation(),e!==null&&window.navigator.clipboard.writeText(e).then(()=>{n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),2e3)})},[e]);return{copied:t,copy:o}}const dw=v.lazy(()=>Mt(()=>import("./CompareDrawer-CU5ZrWcL.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.CompareDrawer}))),fw=v.lazy(()=>Mt(()=>import("./ReplayDialog-F58yNg5j.js"),__vite__mapDeps([3,1,4,2])).then(e=>({default:e.ReplayDialog}))),hw=v.lazy(()=>Mt(()=>import("./RequestAnatomy-C9lT0qE_.js"),__vite__mapDeps([5,1])).then(e=>({default:e.RequestAnatomy}))),pw=v.lazy(()=>Mt(()=>import("./ResponseView-DHJq6bnz.js"),__vite__mapDeps([4,1,2])).then(e=>({default:e.ResponseView}))),mw=v.lazy(()=>Mt(()=>import("./StreamingChunkSequence-BTgfpFUT.js"),__vite__mapDeps([6,1,2])).then(e=>({default:e.StreamingChunkSequence}))),$i=v.lazy(()=>Mt(()=>import("./json-viewer-CZVYLR8j.js").then(e=>e.j),__vite__mapDeps([2,1])).then(e=>({default:e.JsonViewer}))),gw=v.lazy(()=>Mt(()=>import("./json-viewer-CZVYLR8j.js").then(e=>e.j),__vite__mapDeps([2,1])).then(e=>({default:e.JsonViewerFromString}))),xw=1200,vw=12;function yw(e){const{containerRef:t,setExpandToPath:n,ensureTabActive:r,highlightMs:o}=e,s=v.useRef(null);return v.useCallback(i=>{r?.(),n(i.path);const l=h=>{h.scrollIntoView({behavior:"smooth",block:"center"}),h.classList.add("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),s.current!==null&&clearTimeout(s.current),s.current=setTimeout(()=>{h.classList.remove("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),n(null)},o??xw)},u=`[data-anatomy-path="${(h=>typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(h):h.replace(/(["'\\[\](){}])/g,"\\$1"))(i.path)}"]`,d=h=>{const m=t.current;if(m!==null){const p=m.querySelector(u);if(p!==null){l(p);return}}h>0?window.requestAnimationFrame(()=>d(h-1)):n(null)};window.requestAnimationFrame(()=>d(vw))},[t,r,o,n])}class Ru{diff(t,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const s=this.castInput(t,r),i=this.castInput(n,r),l=this.removeEmpty(this.tokenize(s,r)),c=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(l,c,r,o)}diffWithOptionsObj(t,n,r,o){var s;const i=_=>{if(_=this.postProcess(_,r),o){setTimeout(function(){o(_)},0);return}else return _},l=n.length,c=t.length;let u=1,d=l+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const h=(s=r.timeout)!==null&&s!==void 0?s:1/0,m=Date.now()+h,p=[{oldPos:-1,lastComponent:void 0}];let g=this.extractCommon(p[0],n,t,0,r);if(p[0].oldPos+1>=c&&g+1>=l)return i(this.buildValues(p[0].lastComponent,n,t));let f=-1/0,x=1/0;const y=()=>{for(let _=Math.max(f,-u);_<=Math.min(x,u);_+=2){let k;const C=p[_-1],j=p[_+1];C&&(p[_-1]=void 0);let z=!1;if(j){const A=j.oldPos-_;z=j&&0<=A&&A<l}const E=C&&C.oldPos+1<c;if(!z&&!E){p[_]=void 0;continue}if(!E||z&&C.oldPos<j.oldPos?k=this.addToPath(j,!0,!1,0,r):k=this.addToPath(C,!1,!0,1,r),g=this.extractCommon(k,n,t,_,r),k.oldPos+1>=c&&g+1>=l)return i(this.buildValues(k.lastComponent,n,t))||!0;p[_]=k,k.oldPos+1>=c&&(x=Math.min(x,_-1)),g+1>=l&&(f=Math.max(f,_+1))}u++};if(o)(function _(){setTimeout(function(){if(u>d||Date.now()>m)return o(void 0);y()||_()},0)})();else for(;u<=d&&Date.now()<=m;){const _=y();if(_)return _}}addToPath(t,n,r,o,s){const i=t.lastComponent;return i&&!s.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(t,n,r,o,s){const i=n.length,l=r.length;let c=t.oldPos,u=c-o,d=0;for(;u+1<i&&c+1<l&&this.equals(r[c+1],n[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const o=[];let s;for(;t;)o.push(t),s=t.previousComponent,delete t.previousComponent,t=s;o.reverse();const i=o.length;let l=0,c=0,u=0;for(;l<i;l++){const d=o[l];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let h=n.slice(c,c+d.count);h=h.map(function(m,p){const g=r[u+p];return g.length>m.length?g:m}),d.value=this.join(h)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return o}}class bw extends Ru{constructor(){super(...arguments),this.tokenize=Pu}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
86
+ `))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
87
+ `))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
88
+ `)&&(t=t.slice(0,-1)),n.endsWith(`
89
+ `)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const ww=new bw;function Iu(e,t,n){return ww.diff(e,t,n)}function Pu(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
90
+ `));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let o=0;o<r.length;o++){const s=r[o];o%2&&!t.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}class _w extends Ru{constructor(){super(...arguments),this.tokenize=Pu}get useLongestToken(){return!0}castInput(t,n){const{undefinedReplacement:r,stringifyReplacer:o=(s,i)=>typeof i>"u"?r:i}=n;return typeof t=="string"?t:JSON.stringify(Lo(t,null,null,o),null," ")}equals(t,n,r){return super.equals(t.replace(/,([\r\n])/g,"$1"),n.replace(/,([\r\n])/g,"$1"),r)}}const kw=new _w;function Cw(e,t,n){return kw.diff(e,t,n)}function Lo(e,t,n,r,o){t=t||[],n=n||[],r&&(e=r(o===void 0?"":o,e));let s;for(s=0;s<t.length;s+=1)if(t[s]===e)return n[s];let i;if(Object.prototype.toString.call(e)==="[object Array]"){for(t.push(e),i=new Array(e.length),n.push(i),s=0;s<e.length;s+=1)i[s]=Lo(e[s],t,n,r,String(s));return t.pop(),n.pop(),i}if(e&&e.toJSON&&(e=e.toJSON()),typeof e=="object"&&e!==null){t.push(e),i={},n.push(i);const l=[];let c;for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&l.push(c);for(l.sort(),s=0;s<l.length;s+=1)c=l[s],i[c]=Lo(e[c],t,n,r,c);t.pop(),n.pop()}else i=e;return i}function Bi(e){return e===void 0?[]:Object.entries(e).map(t=>[t[0].toLowerCase(),t[1]]).sort(([t],[n])=>t.localeCompare(n))}function Ui([e,t]){return`${e}: ${t}`}function Fo(e){const t=[];let n=0,r=0;for(const o of e){const s=o.value.split(`
91
+ `);s.length>0&&s[s.length-1]===""&&s.pop();for(const i of s)o.added?(r+=1,t.push({kind:"added",text:i,oldLineNumber:null,newLineNumber:r})):o.removed?(n+=1,t.push({kind:"removed",text:i,oldLineNumber:n,newLineNumber:null})):(n+=1,r+=1,t.push({kind:"context",text:i,oldLineNumber:n,newLineNumber:r}))}return t}function Sw(e,t){const n=Bi(e).map(Ui).join(`
92
+ `),r=Bi(t).map(Ui).join(`
93
+ `);if(n===r)return{lines:[],isEmpty:!0};const o=Iu(n,r);return{lines:Fo(o),isEmpty:!1}}function Zi(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function jw(e,t){const n=e??"",r=t??"";if(n===r)return{lines:[],isEmpty:!0};const o=Zi(n),s=Zi(r);if(o!==null&&s!==null){const l=Cw(o,s)??[];if(l.length===1){const c=l[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:Fo(l),isEmpty:!1}}const i=Iu(n,r);return{lines:Fo(i),isEmpty:!1}}function Ew(e,t,n){const r=new Array(e);return new Proxy(r,{get(o,s,i){if(typeof s=="string"){const l=s.charCodeAt(0);if(l>=48&&l<=57){const c=+s;if(Number.isInteger(c)&&c>=0&&c<e){let u=o[c];if(!u){const d=t[c*2];u=o[c]={index:c,key:n(c),start:d,size:t[c*2+1],end:d+t[c*2+1],lane:0}}return u}}if(s==="length")return e}return Reflect.get(o,s,i)}})}function qt(e,t,n){let r=n.initialDeps??[],o,s=!0;function i(){const l=e();return(l.length!==r.length||l.some((u,d)=>r[d]!==u))&&(r=l,o=t(...l),n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(o),s=!1),o}return i.updateDeps=l=>{r=l},i}function Wi(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Vi=(e,t)=>Math.abs(e-t)<1.01,Nw=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};let kn;const Hi=()=>{if(kn!==void 0)return kn;if(typeof navigator>"u")return kn=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return kn=!0;const e=navigator.maxTouchPoints;return kn=navigator.platform==="MacIntel"&&e!==void 0&&e>0},qi=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Tw=e=>e,Aw=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,o=new Array(r);for(let s=0;s<r;s++)o[s]=t+s;return o},zw=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=i=>{const{width:l,height:c}=i;t({width:Math.round(l),height:Math.round(c)})};if(o(qi(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(i=>{const l=()=>{const c=i[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){o({width:u.inlineSize,height:u.blockSize});return}}o(qi(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},kr={passive:!0},Ow=typeof window>"u"?!0:"onscrollend"in window,Rw=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const o=e.targetWindow;if(!o)return;const s=e.options.useScrollendEvent&&Ow;let i=0;const l=s?null:Nw(o,()=>t(i,!1),e.options.isScrollingResetDelay),c=h=>()=>{i=n(r),l?.(),t(i,h)},u=c(!0),d=c(!1);return r.addEventListener("scroll",u,kr),s&&r.addEventListener("scrollend",d,kr),()=>{r.removeEventListener("scroll",u),s&&r.removeEventListener("scrollend",d)}},Iw=(e,t)=>Rw(e,t,n=>{const{horizontal:r,isRtl:o}=e.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),Pw=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},Mw=(e,{adjustments:t=0,behavior:n},r)=>{var o,s;(s=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||s.call(o,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},Dw=Mw;class Lw{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,o;return((o=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:o.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(s=>{const i=()=>{const l=s.target,c=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);for(const[u,d]of this.elementsCache)if(d===l){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(l,s,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var s;return(s=r())==null?void 0:s.observe(o,{box:"border-box"})},unobserve:o=>{var s;return(s=r())==null?void 0:s.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{var r,o;const s={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Tw,rangeExtractor:Aw,onChange:()=>{},measureElement:Pw,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(const u in n){const d=n[u];d!==void 0&&(s[u]=d)}const i=this.options;let l=null,c=null;if(i!==void 0&&i.enabled&&s.enabled&&s.anchorTo==="end"&&this.scrollElement!==null){const u=i.count,d=s.count,h=this.getMeasurements(),m=u>0?((r=h[0])==null?void 0:r.key)??i.getItemKey(0):null,p=u>0?((o=h[u-1])==null?void 0:o.key)??i.getItemKey(u-1):null;if(d!==u||u>0&&d>0&&(s.getItemKey(0)!==m||s.getItemKey(d-1)!==p)){const x=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??h[0]:null;x&&(l=[x.key,this.getScrollOffset()-x.start]);const y=s.followOnAppend===!0?"auto":s.followOnAppend||null;y&&d>u&&this.isAtEnd(i.scrollEndThreshold)&&(u===0||s.getItemKey(d-1)!==p)&&(c=y)}}this.options=s,(l||c)&&(this.pendingScrollAnchor=[l?.[0]??null,l?.[1]??0,c])},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=qt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this._intendedScrollOffset!==null&&Math.abs(s-this._intendedScrollOffset)<1.5&&(s=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=i,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const s=this.scrollElement,i=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},l=()=>{this._iosTouching=!1,!(!Hi()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",i,kr),s.addEventListener("touchend",l,kr),this.unsubs.push(()=>{s.removeEventListener("touchstart",i),s.removeEventListener("touchend",l),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[s,i,l]=o;if(s!==null){const{count:c,getItemKey:u}=this.options;let d=0;for(;d<c&&u(d)!==s;)d++;const h=d<c?this.getMeasurements()[d]:void 0;if(h){const m=h.start+i-this.getScrollOffset();Vi(m,0)||this.applyScrollAdjustment(m)}}l&&this.scrollToEnd({behavior:l})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const o=new Map,s=new Map;for(let i=r-1;i>=0;i--){const l=n[i];if(o.has(l.lane))continue;const c=s.get(l.lane);if(c==null||l.end>c.end?s.set(l.lane,l):l.end<c.end&&o.set(l.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((i,l)=>i.end===l.end?i.index-l.index:i.end-l.end)[0]:void 0},this.getMeasurementOptions=qt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,r,o,s,i,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:l,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=qt(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:l,laneAssignmentMode:c},u)=>{const d=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const g of this.laneAssignments.keys())g>=n&&this.laneAssignments.delete(g);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(g=>{this.itemSizeCache.set(g.key,g.size)}));const h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),l===1){const g=this.options.gap,f=n*2;let x=this._flatMeasurements;if(!x||x.length<f){const k=new Float64Array(f);x&&h>0&&k.set(x.subarray(0,h*2)),x=k,this._flatMeasurements=x}let y;if(h===0)y=r+o;else{const k=h-1;y=x[k*2]+x[k*2+1]+g}for(let k=h;k<n;k++){const C=s(k),j=d.get(C),z=typeof j=="number"?j:this.options.estimateSize(k);x[k*2]=y,x[k*2+1]=z,y+=z+g}const _=Ew(n,x,s);return this.measurementsCache=_,_}const m=this.measurementsCache.slice(0,h),p=new Array(l).fill(void 0);for(let g=0;g<h;g++){const f=m[g];f&&(p[f.lane]=g)}for(let g=h;g<n;g++){const f=s(g),x=this.laneAssignments.get(g);let y,_;const k=c==="estimate"||d.has(f);if(x!==void 0&&this.options.lanes>1){y=x;const E=p[y],A=E!==void 0?m[E]:void 0;_=A?A.end+this.options.gap:r+o}else{const E=this.options.lanes===1?m[g-1]:this.getFurthestMeasurement(m,g);_=E?E.end+this.options.gap:r+o,y=E?E.lane:g%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(g,y)}const C=d.get(f),j=typeof C=="number"?C:this.options.estimateSize(g),z=_+j;m[g]={index:g,start:_,size:j,end:z,key:f,lane:y},p[y]=g}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=qt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,s)=>this.range=n.length>0&&r>0?Fw({measurements:n,outerSize:r,scrollOffset:o,lanes:s,flat:s===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=qt(()=>{let n=null,r=null;const o=this.calculateRange();return o&&(n=o.startIndex,r=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,o,s,i)=>s===null||i===null?[]:n({startIndex:s,endIndex:i,overscan:r,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(o!==void 0&&this.range){const s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,o-s),l=Math.min(this.options.count-1,o+s);return n>=i&&n<=l}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((i,l)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(l))});return}const r=this.indexFromElement(n),o=this.options.getItemKey(r),s=this.elementsCache.get(o);s!==n&&(s&&this.observer.unobserve(s),this.observer.observe(n),this.elementsCache.set(o,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var o,s;if(n<0||n>=this.options.count)return;let i,l,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),l=u[n*2],i=u[n*2+1];else{const m=this.measurementsCache[n];if(!m)return;c=m.key,l=m.start,i=m.size}const d=this.itemSizeCache.get(c)??i,h=r-d;if(h!==0){const m=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=m?this.getTotalSize():0,g=((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:c,start:l,size:i,end:l+i,lane:0},h,this):l<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(c,r),this.itemSizeCacheVersion++,m?this.applyScrollAdjustment(this.getTotalSize()-p):g&&this.applyScrollAdjustment(h),this.notify(!1)}},this.getVirtualItems=qt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,i=n.length;s<i;s++){const l=n[s],c=r[l];o.push(c)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const o=this._flatMeasurements,s=this.options.lanes===1&&o!=null,i=Mu(0,r.length-1,s?l=>o[l*2]:l=>Wi(r[l]).start,n);return Wi(r[i])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,o=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=n>=i+s?"end":"start"),r==="center"?n+=(o-s)/2:r==="end"&&(n-=s);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.getSize(),s=this.getScrollOffset(),i=this.measurementsCache[n];if(!i)return;if(r==="auto")if(i.end>=s+o-this.options.scrollPaddingEnd)r="end";else if(i.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const l=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,r,i.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:o="auto"}={})=>{const s=this.getOffsetForAlignment(n,r),i=this.now();this.scrollState={index:null,align:r,behavior:o,startedAt:i,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:o="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.getOffsetForIndex(n,r);if(!s)return;const[i,l]=s,c=this.now();this.scrollState={index:n,align:l,behavior:o,startedAt:c,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const o=this.getScrollOffset()+n,s=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:s,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let o;if(r.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const s=r.length-1,i=this._flatMeasurements;i!=null?o=i[s*2]+i[s*2+1]:o=((n=r[s])==null?void 0:n.end)??0}else{const s=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&s.some(l=>l===null);){const l=r[i];s[l.lane]===null&&(s[l.lane]=l.end),i--}o=Math.max(...s.filter(l=>l!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const o of r)o&&this.itemSizeCache.has(o.key)&&n.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:o})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:o,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){t!==0&&(Hi()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=r?r[0]:this.scrollState.lastTargetOffset,s=1,i=o!==this.scrollState.lastTargetOffset;if(!i&&Vi(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,i){const l=this.getSize()||600,c=Math.abs(o-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&c>l;this.scrollState.lastTargetOffset=o,u||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Mu=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,s=n(o);if(s<r)e=o+1;else if(s>r)t=o-1;else return o}return e>0?e-1:0};function Fw({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:o}){const s=e.length-1,i=o?d=>o[d*2]:d=>e[d].start,l=o?d=>o[d*2]+o[d*2+1]:d=>e[d].end;if(e.length<=r)return{startIndex:0,endIndex:s};let c=Mu(0,s,i,n),u=c;if(r===1)for(;u<s&&l(u)<n+t;)u++;else if(r>1){const d=Array(r).fill(0);for(;u<s&&d.some(m=>m<n+t);){const m=e[u];d[m.lane]=m.end,u++}const h=Array(r).fill(n+t);for(;c>=0&&h.some(m=>m>=n);){const m=e[c];h[m.lane]=m.start,c--}c=Math.max(0,c-c%r),u=Math.min(s,u+(r-1-u%r))}return{startIndex:c,endIndex:u}}const Ji=typeof document<"u"?v.useLayoutEffect:v.useEffect;function $w({useFlushSync:e=!0,...t}){const n=v.useReducer(s=>s+1,0)[1],r={...t,onChange:(s,i)=>{var l;e&&i?In.flushSync(n):n(),(l=t.onChange)==null||l.call(t,s,i)}},[o]=v.useState(()=>new Lw(r));return o.setOptions(r),Ji(()=>o._didMount(),[]),Ji(()=>o._willUpdate()),o}function Bw(e){return $w({observeElementRect:zw,observeElementOffset:Iw,scrollToFn:Dw,...e})}const Uw=22,lo=1e4;function Zw(e){return e==="added"?"+":e==="removed"?"-":" "}function Ww(e){return e==="added"?"bg-green-500/10 text-green-700 dark:text-green-300":e==="removed"?"bg-red-500/10 text-red-700 dark:text-red-300":"text-foreground/80"}const Vw=function({result:t,emptyLabel:n}){const[r,o]=v.useState("unified"),s=v.useRef(null),i=Bw({count:t.lines.length,getScrollElement:()=>s.current,estimateSize:()=>Uw,overscan:10});if(t.isEmpty)return a.jsx("div",{className:"rounded border border-dashed border-border bg-muted/30 px-4 py-6 text-center text-xs text-muted-foreground","data-testid":"diff-empty",children:n??"No transformation applied — raw and processed are identical."});const l=t.lines.length,c=l>lo,u=c?t.lines.slice(0,lo):t.lines;return a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsxs("span",{children:[l.toLocaleString()," line",l===1?"":"s",c&&` (showing first ${lo.toLocaleString()})`]}),a.jsxs("div",{className:"inline-flex rounded-md border border-border overflow-hidden",children:[a.jsxs("button",{type:"button",onClick:()=>o("unified"),"aria-pressed":r==="unified",className:xe("flex items-center gap-1 px-2 py-1 transition-colors",r==="unified"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Unified diff (single column)",children:[a.jsx(S0,{className:"size-3"}),"Unified"]}),a.jsxs("button",{type:"button",onClick:()=>o("split"),"aria-pressed":r==="split",className:xe("flex items-center gap-1 px-2 py-1 transition-colors border-l border-border",r==="split"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Split diff (side by side)",children:[a.jsx(Wg,{className:"size-3"}),"Split"]})]})]}),a.jsx("div",{ref:s,className:"max-h-[60vh] overflow-auto rounded border border-border bg-background font-mono text-xs","data-testid":"diff-viewport",children:r==="unified"?a.jsx(Hw,{virtualizer:i,lines:u}):a.jsx(Kw,{lines:u})})]})};function Hw({virtualizer:e,lines:t}){return a.jsx("div",{style:{height:`${e.getTotalSize()}px`,width:"100%",position:"relative"},children:e.getVirtualItems().map(n=>{const r=t[n.index];return r===void 0?null:a.jsxs("div",{"data-index":n.index,ref:e.measureElement,className:xe("flex items-start gap-3 px-2",Ww(r.kind)),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${n.start}px)`},children:[a.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.oldLineNumber??""}),a.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.newLineNumber??""}),a.jsx("span",{className:xe("select-none w-3 text-right font-bold",r.kind==="added"&&"text-green-600 dark:text-green-400",r.kind==="removed"&&"text-red-600 dark:text-red-400"),children:Zw(r.kind)}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:r.text})]},n.key)})})}function qw(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r===void 0)break;if(r.kind==="context"){t.push({left:{text:r.text,lineNumber:r.oldLineNumber},right:{text:r.text,lineNumber:r.newLineNumber},kind:"equal"}),n+=1;continue}const o=[],s=[];for(;n<e.length&&e[n]?.kind==="removed";){const l=e[n];l!==void 0&&o.push(l),n+=1}for(;n<e.length&&e[n]?.kind==="added";){const l=e[n];l!==void 0&&s.push(l),n+=1}const i=Math.max(o.length,s.length);for(let l=0;l<i;l+=1){const c=o[l],u=s[l];c!==void 0&&u!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:{text:u.text,lineNumber:u.newLineNumber},kind:"changed"}):c!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:null,kind:"removed"}):u!==void 0&&t.push({left:null,right:{text:u.text,lineNumber:u.newLineNumber},kind:"added"})}}return t}function Jw(e){switch(e){case"changed":return"bg-amber-500/10";case"removed":return"bg-red-500/10";case"added":return"bg-green-500/10";case"equal":return""}}function Kw({lines:e}){const t=qw(e);return a.jsx("div",{"data-testid":"diff-split",children:t.map((n,r)=>a.jsxs("div",{className:xe("grid grid-cols-2 font-mono text-xs",Jw(n.kind)),children:[a.jsxs("div",{className:"flex items-start gap-2 px-2 border-r border-border/50",children:[a.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.left?.lineNumber??""}),a.jsx("span",{className:xe("select-none w-3 text-right font-bold",(n.kind==="removed"||n.kind==="changed")&&"text-red-600 dark:text-red-400"),children:n.left!==null?"-":" "}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.left?.text??""})]}),a.jsxs("div",{className:"flex items-start gap-2 px-2",children:[a.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.right?.lineNumber??""}),a.jsx("span",{className:xe("select-none w-3 text-right font-bold",(n.kind==="added"||n.kind==="changed")&&"text-green-600 dark:text-green-400"),children:n.right!==null?"+":" "}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.right?.text??""})]})]},r))})}const Du=v.memo(Vw),Gw={success:"bg-emerald-500/15 text-emerald-400 border-emerald-500/25",client_error:"bg-amber-500/15 text-amber-400 border-amber-500/25",server_error:"bg-rose-500/15 text-rose-400 border-rose-500/25",pending:"bg-muted text-muted-foreground border-border"};function co(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function Ki({trend:e}){if(e===null)return null;const t=e.direction==="up",n=t?Eg:kg,r=t?"+":"-";return a.jsxs("span",{className:"flex items-center gap-0.5 text-muted-foreground tabular-nums",children:[a.jsx(n,{className:t?"size-3 text-emerald-400":"size-3 text-rose-400"}),a.jsxs("span",{className:"font-mono",children:[r,Je(e.delta)]})]})}const Yw=v.memo(function({log:e,messageCount:t=null,toolCount:n=null,expanded:r,onToggle:o,responseToolNames:s=null,cacheTrend:i=null,activeTab:l,tabActions:c,onReplay:u,slowResponseThresholdSeconds:d=0}){const h=U1(e.responseStatus),m=e.elapsedMs!==null&&d>0&&e.elapsedMs>d*1e3,p=e.inputTokens!==null||e.outputTokens!==null,g=v.useMemo(()=>s?.join(", ")??null,[s]);return a.jsx($e,{children:a.jsxs("div",{id:`log-${e.id}`,role:"button",tabIndex:0,"data-nav-id":`log-${e.id}`,"data-nav-action":r?"collapse":"expand",className:xe("flex items-center gap-2 px-3 py-1 cursor-pointer transition-colors","hover:bg-muted/50","select-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:o,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),o())},children:[a.jsxs("span",{className:"text-blue-400/80 font-mono text-xs font-semibold tabular-nums shrink-0",children:["#",e.id]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(sn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:e.timestamp})]}),e.model!==null&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("span",{className:"shrink-0",children:a.jsx(Au,{provider:Tu(e.model),className:"size-4"})})}),a.jsx(Ne,{children:e.model})]}),h!=="success"&&a.jsxs(Cu,{variant:"outline",className:xe("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums gap-1",Gw[h]),children:[h==="server_error"?a.jsx(m0,{className:"size-3","aria-label":"Server error"}):h==="client_error"?a.jsx(wo,{className:"size-3","aria-label":"Client error"}):h==="pending"?a.jsx(pr,{className:"size-3 animate-spin","aria-label":"Pending"}):null,e.responseStatus]}),e.elapsedMs!==null&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:xe("flex items-center gap-1 text-xs shrink-0",m?"text-amber-400":"text-muted-foreground"),children:[a.jsx(sn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:co(e.elapsedMs)}),m&&a.jsx(wo,{className:"size-3","aria-label":"Slow response"})]})}),a.jsx(Ne,{children:m?`Slow response: ${co(e.elapsedMs)} exceeds ${co(d*1e3)}`:"Elapsed response time"})]}),p&&a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(rs,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsxs("span",{className:e.inputTokens!==null?"text-blue-400":"text-muted-foreground",children:["IN ",e.inputTokens!==null?Je(e.inputTokens):"—"]})," / ",a.jsxs("span",{className:e.outputTokens!==null?"text-amber-400":"text-muted-foreground",children:["OUT ",e.outputTokens!==null?Je(e.outputTokens):"—"]})]})]}),e.cacheCreationInputTokens!==null&&e.cacheCreationInputTokens>0&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(Ki,{trend:i?.creation??null}),a.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",Je(e.cacheCreationInputTokens)]})]})}),a.jsx(Ne,{children:"Tokens cached for reuse, reducing future API cost"})]}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(Ki,{trend:i?.read??null}),a.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",Je(e.cacheReadInputTokens)]})]})}),a.jsx(Ne,{children:"Tokens served from cache, reducing API cost"})]}),t!==null&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(sl,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:t})]}),n!==null&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(oi,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:n})]}),s!==null&&s.length>0&&a.jsxs("span",{className:"flex items-center gap-1 text-amber-400/80 text-xs shrink-0",children:[a.jsx(oi,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums truncate max-w-[160px]",children:g})]}),e.origin!==null&&a.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:`Origin: ${e.origin}`,children:[a.jsx(s0,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",title:e.origin,children:e.origin})]}),(e.clientPid!==null||e.clientProjectFolder!==null)&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-purple-400/80 text-xs shrink-0",children:[a.jsx(Qg,{className:"size-3"}),e.clientProjectFolder!==null?a.jsx("span",{className:"font-mono tabular-nums",children:e.clientProjectFolder}):a.jsxs("span",{className:"font-mono tabular-nums",children:["PID ",e.clientPid]})]})}),a.jsx(Ne,{children:e.clientCwd!==null?`PID: ${e.clientPid??"?"} CWD: ${e.clientCwd}`:`Process ID: ${e.clientPid??"?"}`})]}),e.streaming&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(b0,{className:"size-3 text-muted-foreground/60 shrink-0"})}),a.jsx(Ne,{children:"Request used SSE streaming"})]}),a.jsx("span",{className:"flex-1 min-w-0"}),r&&a.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",onClick:f=>f.stopPropagation(),onKeyDown:f=>f.stopPropagation(),children:[c!==void 0&&l!==void 0&&(()=>{const f=c[l];return f===void 0?null:a.jsxs(a.Fragment,{children:[f.expansion!==null&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(De,{variant:"outline",size:"icon",className:"size-8",onClick:f.expansion.onToggle,disabled:f.expansion.isPending,"aria-pressed":f.expansion.isExpanded,"aria-label":f.expansion.isExpanded?"Collapse all JSON":"Expand all JSON",children:f.expansion.isExpanded?a.jsx(Mg,{className:"size-3.5"}):a.jsx(Ig,{className:"size-3.5"})})}),a.jsx(Ne,{children:f.expansion.isExpanded?"Collapse all JSON nodes":"Expand all JSON nodes"})]}),f.diffWithRaw!==void 0&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(De,{variant:"outline",size:"icon",className:xe("size-8",f.diffWithRaw.active&&"bg-accent text-accent-foreground"),onClick:f.diffWithRaw.onToggle,"aria-pressed":f.diffWithRaw.active,"aria-label":f.diffWithRaw.active?"Hide raw diff":"Diff with raw",children:a.jsx(Yg,{className:"size-3.5"})})}),a.jsx(Ne,{children:f.diffWithRaw.active?"Hide diff with raw request":"Show diff between displayed and raw request body"})]}),f.diffWithPrevious!==void 0&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(De,{variant:"outline",size:"icon",className:"size-8",onClick:f.diffWithPrevious,"aria-label":"Diff with previous",children:a.jsx(a0,{className:"size-3.5"})})}),a.jsx(Ne,{children:"Compare this request with the immediately preceding one"})]}),f.copyText!==null&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(De,{variant:"outline",size:"icon",className:"size-8",onClick:f.onCopy,"aria-label":f.copyCopied?"Copied":f.copyLabel,children:f.copyCopied?a.jsx(Ft,{className:"size-3.5 text-emerald-500"}):a.jsx(Dn,{className:"size-3.5"})})}),a.jsx(Ne,{children:f.copyCopied?"Copied to clipboard":f.copyLabel})]})]})})(),u!==void 0&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(De,{variant:"outline",size:"icon",className:"size-8",onClick:u,"aria-label":"Replay request",children:a.jsx(_0,{className:"size-3.5"})})}),a.jsx(Ne,{children:"Re-send this request to the provider"})]})]}),r?a.jsx(Mn,{className:"size-4 text-muted-foreground shrink-0"}):a.jsx(Qo,{className:"size-4 text-muted-foreground shrink-0"})]})})}),Xw="/v1/chat/completions",Qw="/chat/completions",e_="/v1/messages";class t_{handlers=new Map;pathMap=new Map;register(t){this.handlers.set(t.format,t)}registerPath(t,n){this.pathMap.set(t,n)}get(t){return this.handlers.get(t)}getByPath(t){const n=t.split("?")[0]??"",r=this.pathMap.get(n);return r===void 0?void 0:this.handlers.get(r)}detectFormat(t){if(t===null)return"unknown";for(const n of this.handlers.values())if(n.detectFormat(t))return n.format;return"unknown"}}const xn=new t_;function n_(e){return xn.getByPath(e)??null}function r_(e){return n_(e)?.format??"unknown"}xn.registerPath(e_,"anthropic");xn.registerPath(Xw,"openai");xn.registerPath(Qw,"openai");function o_(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function s_(e){switch(e.type){case"text":return{type:"text",text:e.text};case"thinking":{const t={type:"thinking",thinking:e.thinking};return e.signature!==""&&(t.signature=e.signature),t}case"think":{const t={type:"think",thinking:e.thinking};return e.signature!==""&&(t.signature=e.signature),t}case"tool_use":return{type:"tool_use",id:e.id,name:e.name,input:o_(e.inputJson)}}}function Lu(e,t,n,r){const o=new Map;let s="",i="",l=null,c=null,u=0,d=0;const h=1e3;let m=0,p=0;const g=[];for(const x of e.split(`
94
+ `)){const y=x.trim();if(y.startsWith("data: "))try{const _=JSON.parse(y.slice(6)),k=ag.safeParse(_);if(!k.success)continue;const C=k.data;switch(m===0&&(p=Date.now()),r===!0&&g.length<h&&g.push({index:m,timestamp:Date.now()-p,type:C.type,data:C}),m++,C.type){case"message_start":s=C.message.id,i=C.message.model,u=C.message.usage.input_tokens,t.inputTokens=u,t.cacheCreationInputTokens=C.message.usage.cache_creation_input_tokens??null,t.cacheReadInputTokens=C.message.usage.cache_read_input_tokens??null,t.model===null&&(t.model=i);break;case"content_block_start":{const j=C.content_block;switch(j.type){case"text":o.set(C.index,{type:"text",text:j.text??""});break;case"thinking":o.set(C.index,{type:"thinking",thinking:j.thinking??"",signature:j.signature??""});break;case"think":o.set(C.index,{type:"think",thinking:j.thinking??"",signature:j.signature??""});break;case"tool_use":o.set(C.index,{type:"tool_use",id:j.id,name:j.name,inputJson:""});break}break}case"content_block_delta":{const j=o.get(C.index);if(j===void 0)break;const z=C.delta;z.type==="text_delta"&&j.type==="text"?j.text+=z.text:z.type==="thinking_delta"&&(j.type==="thinking"||j.type==="think")?j.thinking+=z.thinking:z.type==="signature_delta"&&(j.type==="thinking"||j.type==="think")?j.signature+=z.signature:z.type==="input_json_delta"&&j.type==="tool_use"&&(j.inputJson+=z.partial_json);break}case"message_delta":l=C.delta.stop_reason,c=C.delta.stop_sequence??null,d=C.usage.output_tokens,t.outputTokens=d,C.usage.cache_creation_input_tokens!==void 0&&(t.cacheCreationInputTokens=C.usage.cache_creation_input_tokens),C.usage.cache_read_input_tokens!==void 0&&(t.cacheReadInputTokens=C.usage.cache_read_input_tokens);break;case"error":t.error=C.error.message;break;case"content_block_stop":case"message_stop":case"ping":break}}catch{}}r===!0&&(t.streamingChunks={chunks:g,truncated:m>h});const f=[...o.entries()].sort(([x],[y])=>x-y).map(([,x])=>s_(x));return JSON.stringify({id:s,type:"message",model:i!==""?i:n??"",role:"assistant",content:f,stop_reason:l,stop_sequence:c,usage:{input_tokens:u,output_tokens:d}})}const i_={format:"anthropic",parseRequest(e,t){try{const n=JSON.parse(e),r=Ja.safeParse(n);return r.success?{model:r.data.model,sessionId:r.data.metadata?.user_id??t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){try{const t=JSON.parse(e),n=Ka.safeParse(t);if(n.success)return{inputTokens:n.data.usage.input_tokens??null,outputTokens:n.data.usage.output_tokens??null,cacheCreationInputTokens:n.data.usage.cache_creation_input_tokens??null,cacheReadInputTokens:n.data.usage.cache_read_input_tokens??null}}catch{}return{inputTokens:null,outputTokens:null,cacheCreationInputTokens:null,cacheReadInputTokens:null}},extractStream(e,t,n,r){return Lu(e,t,n,r)},detectFormat(e){if(e===null)return!1;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=Object.keys(t);return n.includes("model")&&n.includes("messages")&&n.includes("system")}return!1}catch{return!1}}};xn.register(i_);class a_{providers=[];register(t){this.providers.push(t)}findProvider(t){let n=null;for(const r of this.providers)if(r.matches(t)){if(r.name!=="anthropic")return r;n=r}return n}getAll(){return[...this.providers]}}const Ns=new a_,l_="https://api.anthropic.com",c_={MiniMax:"https://api.minimaxi.com/anthropic"},u_={name:"anthropic",matches(e){const t=e.toLowerCase();if(t.startsWith("openai-"))return!1;if(t.includes("claude")||t.includes("anthropic"))return!0;for(const n of Object.keys(c_))if(t.startsWith(n.toLowerCase()))return!0;return!0},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:l_},extractStream(e,t,n,r){return Lu(e,t,n,r)}};Ns.register(u_);function Ts(e,t,n,r=!0){let o="",s="",i="",l="",c=null,u=0,d=0,h=!1,m=!1;const p=new Map,g=1e3;let f=0,x=0;const y=[];for(const k of e.split(`
95
+ `)){const C=k.trim();if(!C.startsWith("data: "))continue;const j=C.slice(6);if(j==="[DONE]")break;try{const z=JSON.parse(j);if(typeof z=="object"&&z!==null&&!Array.isArray(z)){const O=Object.getOwnPropertyDescriptor(z,"error");if(O!==void 0&&typeof O.value=="object"&&O.value!==null){const P=Object.getOwnPropertyDescriptor(O.value,"message");P!==void 0&&typeof P.value=="string"&&(t.error=P.value);continue}}const E=hg.safeParse(z);if(!E.success)continue;const A=E.data;if(f===0&&(x=Date.now()),r===!0&&y.length<g&&y.push({index:f,timestamp:Date.now()-x,type:"chat.completion.chunk",data:A}),f++,m||(o=A.id,s=A.model,m=!0),!h&&A.usage!==void 0&&A.usage!==null){if(u=A.usage.prompt_tokens??0,d=A.usage.completion_tokens??0,t.inputTokens=u,typeof z=="object"&&z!==null&&!Array.isArray(z)){const O=Object.getOwnPropertyDescriptor(z,"usage");if(O!==void 0&&typeof O.value=="object"&&O.value!==null){const P=Object.getOwnPropertyDescriptor(O.value,"prompt_tokens_details");if(P!==void 0&&typeof P.value=="object"&&P.value!==null){const Z=Object.getOwnPropertyDescriptor(P.value,"cached_tokens");Z!==void 0&&typeof Z.value=="number"&&(t.cacheReadInputTokens=Z.value)}}}h=!0}for(const O of A.choices){const P=O.delta;P.content!==void 0&&P.content!==null&&(i+=P.content),P.reasoning_content!==void 0&&P.reasoning_content!==null&&(l+=P.reasoning_content),P.thinking!==void 0&&P.thinking!==null&&(l+=P.thinking);const Z=P.think;if(Z!=null&&(l+=Z),O.finish_reason!==void 0&&O.finish_reason!==null&&(c=O.finish_reason),P.tool_calls!==void 0&&P.tool_calls!==null)for(const S of P.tool_calls){let R=p.get(S.index);R===void 0&&(R={index:S.index,type:"function",function:{name:"",arguments:""}},p.set(S.index,R)),S.id!==void 0&&(R.id=S.id),S.function?.name!==void 0&&(R.function.name+=S.function.name),S.function?.arguments!==void 0&&(R.function.arguments+=S.function.arguments)}}}catch{}}r===!0&&(t.streamingChunks={chunks:y,truncated:f>g}),h||(d=Math.ceil(i.length/4)),t.outputTokens=d;const _={role:"assistant",content:i};return l&&(_.reasoning_content=l),p.size>0&&(_.tool_calls=[...p.values()]),JSON.stringify({id:o,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:s!==""?s:n??"",choices:[{index:0,message:_,finish_reason:c}],usage:{prompt_tokens:u,completion_tokens:d,total_tokens:u+d}})}const d_={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),r=Xa.safeParse(n);return r.success?{model:r.data.model,sessionId:t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){const t=el(e);if(t){let n=null;try{const r=JSON.parse(e);if(r!==null&&typeof r=="object"&&!Array.isArray(r)){const o=Object.getOwnPropertyDescriptor(r,"usage");if(o!==void 0&&typeof o.value=="object"&&o.value!==null){const s=Object.getOwnPropertyDescriptor(o.value,"prompt_tokens_details");if(s!==void 0&&typeof s.value=="object"&&s.value!==null){const i=Object.getOwnPropertyDescriptor(s.value,"cached_tokens");i!==void 0&&typeof i.value=="number"&&(n=i.value)}}}}catch{}return{inputTokens:t.usage.prompt_tokens??null,outputTokens:t.usage.completion_tokens??null,cacheCreationInputTokens:null,cacheReadInputTokens:n}}return{inputTokens:null,outputTokens:null,cacheCreationInputTokens:null,cacheReadInputTokens:null}},extractStream(e,t,n,r){return Ts(e,t,n,r)},detectFormat(e){if(e===null)return!1;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=Object.keys(t);return n.includes("model")&&n.includes("messages")&&!n.includes("system")}return!1}catch{return!1}}};xn.register(d_);const f_="https://api.openai.com/v1",h_={name:"openai",matches(e){const t=e.toLowerCase();return!!(t.startsWith("openai-")||t.includes("gpt-")||t.includes("o1")||t.includes("o2")||t.includes("o3"))},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:f_},extractStream(e,t,n,r){return Ts(e,t,n,r)}};Ns.register(h_);const p_="https://dashscope.aliyuncs.com/compatible-mode/v1",m_={name:"alibaba",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return!!(t.startsWith("glm-5")||t.startsWith("qwen"))},getUpstreamBase(e,t){return p_},extractStream(e,t,n){return Ts(e,t,n)}};Ns.register(m_);function Fu(e,t){for(const n of Array.from(e))t(n)}const g_=/[\u3000-\u9FFF\uAC00-\uD7FF\uF900-\uFAFF\uFF00-\uFFEF\u{1F300}-\u{1FAFF}]/u;function $u(e){if(e.length===0)return 0;let t=0,n=0;return Fu(e,r=>{g_.test(r)?t+=1:n+=1}),Math.ceil(t*1)+Math.ceil(n/4)}function Bu(e){if(e.length===0)return 0;let t=0;return Fu(e,()=>{t+=1}),t}function zt(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const tn={parsed:null,toolNames:null};function x_(e){if(typeof e=="string")return e;if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n;switch(r.type){case"text":typeof r.text=="string"&&t.push(r.text);break;case"thinking":case"think":typeof r.thinking=="string"&&t.push(r.thinking);break;case"tool_use":{const s=typeof r.name=="string"?r.name:"",i=r.input!==void 0?JSON.stringify(r.input):"";t.push(`${s} ${i}`.trim());break}case"tool_result":{const s=r.content;if(typeof s=="string")t.push(s);else if(Array.isArray(s)){for(const i of s)if(i!==null&&typeof i=="object"){const l=i.text;typeof l=="string"&&t.push(l)}}break}case"image":t.push("[image]");break}}return t.join(`
96
+ `)}function v_(e){if(typeof e=="string")return e;if(!Array.isArray(e))return"";const t=[];for(const n of e)if(n!==null&&typeof n=="object"){const r=n.text;n.type==="text"&&typeof r=="string"&&t.push(r)}return t.join(`
97
+ `)}function y_(e){if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n;typeof r.name=="string"&&t.push(r.name),typeof r.description=="string"&&t.push(r.description),r.input_schema!==void 0&&t.push(JSON.stringify(r.input_schema))}return t.join(`
98
+ `)}function uo(e,t,n,r){return{role:e,label:t,text:n,size:$u(n),characters:Bu(n),path:r}}const b_={format:"anthropic",analyzeRequest(e){if(e===null)return zt(e);try{const t=Ja.safeParse(JSON.parse(e));return t.success?{parsed:t.data,comparisonValue:t.data,messageCount:t.data.messages.length,toolCount:t.data.tools!==void 0&&t.data.tools.length>0?t.data.tools.length:null}:zt(e)}catch{return zt(e)}},analyzeResponse(e){if(e===null)return tn;try{let t=JSON.parse(e);typeof t=="string"&&(t=JSON.parse(t));const n=Ka.safeParse(t);if(!n.success)return tn;const r=n.data.content.filter(o=>o.type==="tool_use").map(o=>o.name);return{parsed:n.data,toolNames:r.length>0?r:null}}catch{return tn}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(t.system!==void 0){const r=v_(t.system);r.length>0&&n.push(uo("system","system",r,"/system"))}if(Array.isArray(t.messages)&&t.messages.forEach((r,o)=>{if(r===null||typeof r!="object")return;const s=r,i=s.role==="user"||s.role==="assistant"?s.role:"user",l=x_(s.content);n.push(uo(i,`[${o}] ${i}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=y_(t.tools);n.push(uo("tools","tools",r,"/tools"))}return n.length>0?n:null}};function w_(e){if(typeof e=="string")return e;if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n,o=r.type;o==="text"&&typeof r.text=="string"?t.push(r.text):o==="image_url"&&t.push("[image]")}return t.join(`
99
+ `)}function __(e){const t=[],n=w_(e.content);n.length>0&&t.push(n);const r=typeof e.reasoning_content=="string"?e.reasoning_content:typeof e.thinking=="string"?e.thinking:typeof e.think=="string"?e.think:"";r.length>0&&t.push(r);const o=e.tool_calls;if(Array.isArray(o))for(const s of o){if(s===null||typeof s!="object")continue;const i=s.function;if(i===void 0)continue;const l=typeof i.name=="string"?i.name:"",c=typeof i.arguments=="string"?i.arguments:"";t.push(`${l} ${c}`.trim())}return t.join(`
100
+ `)}function k_(e){if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const o=n.function;o!==void 0&&(typeof o.name=="string"&&t.push(o.name),typeof o.description=="string"&&t.push(o.description),o.parameters!==void 0&&t.push(JSON.stringify(o.parameters)))}return t.join(`
101
+ `)}function Gi(e,t,n,r){return{role:e,label:t,text:n,size:$u(n),characters:Bu(n),path:r}}const C_={format:"openai",analyzeRequest(e){if(e===null)return zt(e);try{const t=Xa.safeParse(JSON.parse(e));return t.success?{parsed:t.data,comparisonValue:t.data,messageCount:t.data.messages.length,toolCount:t.data.tools!==void 0&&t.data.tools.length>0?t.data.tools.length:null}:zt(e)}catch{return zt(e)}},analyzeResponse(e){if(e===null)return tn;const t=el(e);if(t===null)return tn;const n=t.choices[0]?.message?.tool_calls?.map(r=>r.function?.name??"").filter(r=>r!=="")??[];return{parsed:t,toolNames:n.length>0?n:null}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(Array.isArray(t.messages)&&t.messages.forEach((r,o)=>{if(r===null||typeof r!="object")return;const s=r,i=s.role==="user"||s.role==="assistant"||s.role==="system"||s.role==="tool"?s.role:"user",l=__(s);n.push(Gi(i,`[${o}] ${i}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=k_(t.tools);n.push(Gi("tools","tools",r,"/tools"))}return n.length>0?n:null}},S_={format:"unknown",analyzeRequest(e){return zt(e)},analyzeResponse(){return tn},anatomySegments(){return null}},j_={anthropic:b_,openai:C_,unknown:S_};function E_(e){return j_[e]}function $o(e){const t=r_(e.path);return t==="unknown"?e.apiFormat:t}function Yi(e,t,n){return e==="anthropic"&&t==="full"&&n}function N_(e,t){return e==="full"&&t}function T_(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}function Jt(){return a.jsx("div",{className:"h-1","aria-hidden":"true"})}function A_({active:e,onClick:t}){return a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs(De,{variant:e?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:t,"aria-pressed":e,children:[a.jsx(r0,{className:"size-3.5 mr-1"}),e?"Showing diff":"Diff with Raw"]})}),a.jsx(Ne,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const z_=v.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const r=v.useMemo(()=>jw(e,t),[e,t]);return a.jsx(Du,{result:r,emptyLabel:n})}),O_=v.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const r=v.useMemo(()=>Sw(e,t),[e,t]);return a.jsx(Du,{result:r,emptyLabel:n})}),R_=v.memo(function({log:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,cacheTrend:o=null,onCompareWithPrevious:s}){const[i,l]=v.useState(!1),[c,u]=v.useState(!1),[d,h]=v.useState(!1),[m,p]=v.useState(!1),[g,f]=v.useState("request"),[x,y]=v.useState(null),_=v.useRef(null),k=$o(e),C=E_(k),j=v.useMemo(()=>C.analyzeRequest(e.rawRequestBody),[C,e.rawRequestBody]),z=v.useMemo(()=>C.analyzeResponse(e.responseText),[C,e.responseText]),A=v.useMemo(()=>!n||k!=="anthropic"||e.rawRequestBody===null?null:aw(e.rawRequestBody).body,[e.rawRequestBody,k,n])??e.rawRequestBody,O=ao(A),P=ao(e.rawRequestBody),Z=ao(e.responseText),S=v.useMemo(()=>e.headers&&Object.keys(e.headers).length>0?JSON.stringify(e.headers,null,2):null,[e.headers]),R=v.useMemo(()=>e.rawHeaders&&Object.keys(e.rawHeaders).length>0?JSON.stringify(e.rawHeaders,null,2):null,[e.rawHeaders]),w=_n(A),I=_n(e.rawRequestBody),V=_n(S),$=_n(R),F=_n(e.responseText),J=v.useMemo(()=>({request:{copyLabel:"Copy request body",copyText:A,copyCopied:w.copied,onCopy:w.copy,expansion:{isExpanded:O.isExpanded,isPending:O.isPending,onToggle:O.toggle},diffWithRaw:T_(k,t,n,e.rawRequestBody!==null)?{active:m,onToggle:()=>p(!m)}:void 0,diffWithPrevious:s===void 0?void 0:()=>{s(e)}},"raw-request":{copyLabel:"Copy raw request",copyText:e.rawRequestBody,copyCopied:I.copied,onCopy:I.copy,expansion:{isExpanded:P.isExpanded,isPending:P.isPending,onToggle:P.toggle}},headers:{copyLabel:"Copy headers",copyText:S,copyCopied:V.copied,onCopy:V.copy,expansion:null},"raw-headers":{copyLabel:"Copy raw headers",copyText:R,copyCopied:$.copied,onCopy:$.copy,expansion:null},raw:{copyLabel:"Copy response",copyText:e.responseText,copyCopied:F.copied,onCopy:F.copy,expansion:{isExpanded:Z.isExpanded,isPending:Z.isPending,onToggle:Z.toggle}}}),[A,w,O,m,e.rawRequestBody,I,P,S,V,R,$,e.responseText,F,Z,k,t,n,s]),se=v.useMemo(()=>O.parsedData!==null?C.anatomySegments(O.parsedData):null,[C,O.parsedData]),U=v.useMemo(()=>{if(se!==null)return new Set(se.map(te=>te.path))},[se]),B=yw({containerRef:_,setExpandToPath:y,ensureTabActive:()=>{g!=="request"&&f("request")}});return a.jsxs($e,{children:[a.jsxs("div",{className:"border border-border rounded-lg mb-1 overflow-hidden",children:[a.jsx(Yw,{log:e,messageCount:j.messageCount,toolCount:j.toolCount,expanded:i,onToggle:()=>l(!i),responseToolNames:z.toolNames,cacheTrend:o,slowResponseThresholdSeconds:r,activeTab:g,tabActions:J,onReplay:s===void 0?void 0:()=>{u(!0)}}),i&&a.jsx("div",{onClick:te=>te.stopPropagation(),onKeyDown:te=>te.stopPropagation(),children:a.jsxs(zu,{value:g,onValueChange:f,children:[a.jsxs(Ou,{className:"mx-4 mt-2",children:[t==="full"&&a.jsx(dt,{value:"raw-headers",children:"Raw Headers"}),t==="full"&&a.jsx(dt,{value:"headers",children:"Headers"}),Yi(k,t,n)&&a.jsx(dt,{value:"raw-request",children:"Raw Request"}),a.jsx(dt,{value:"request",children:"Request"}),se!==null&&a.jsx(dt,{value:"anatomy",children:"Anatomy"}),t==="full"&&a.jsx(dt,{value:"raw",children:"Raw Response"}),a.jsx(dt,{value:"parsed",children:"Response"})]}),Yi(k,t,n)&&a.jsx(ft,{value:"raw-request",children:g==="raw-request"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:e.rawRequestBody===null?a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):P.parsedData!==null?a.jsx(v.Suspense,{fallback:a.jsx(Jt,{}),children:a.jsx($i,{data:P.parsedData,bulkDepth:P.bulkDepth,bulkRevision:P.bulkRevision})}):a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:e.rawRequestBody})})}),a.jsx(ft,{value:"request",children:g==="request"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:m?a.jsx(z_,{rawBody:e.rawRequestBody,displayedBody:A,emptyLabel:"No transformation applied — raw and sent request bodies are identical."}):a.jsx("div",{ref:_,children:A===null?a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):O.parsedData!==null?a.jsx(v.Suspense,{fallback:a.jsx(Jt,{}),children:a.jsx($i,{data:O.parsedData,bulkDepth:O.bulkDepth,bulkRevision:O.bulkRevision,anatomyPaths:U,expandToPath:x})}):a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:A})})})}),se!==null&&a.jsx(ft,{value:"anatomy",children:g==="anatomy"&&a.jsx(v.Suspense,{fallback:a.jsx(Jt,{}),children:a.jsx(hw,{parsed:null,inputTokens:e.inputTokens??null,segments:se,onSegmentActivate:B})})}),t==="full"&&a.jsx(ft,{value:"headers",children:g==="headers"&&a.jsxs("div",{className:"px-4 pt-1 pb-3",children:[a.jsx("div",{className:"flex justify-end gap-2 mb-2",children:N_(t,e.rawHeaders!==void 0&&Object.keys(e.rawHeaders).length>0)&&a.jsx(A_,{active:d,onClick:te=>{te.stopPropagation(),h(!d)}})}),d?a.jsx(O_,{rawHeaders:e.rawHeaders,headers:e.headers,emptyLabel:"No transformation applied — raw and processed headers are identical."}):e.headers&&Object.keys(e.headers).length>0?a.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.headers).sort(([te],[ee])=>te.localeCompare(ee)).map(([te,ee])=>a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[te,":"]}),a.jsx("span",{className:"text-muted-foreground truncate",title:ee,children:ee})]},te))}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No headers captured"})]})}),t==="full"&&a.jsx(ft,{value:"raw-headers",children:g==="raw-headers"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:e.rawHeaders&&Object.keys(e.rawHeaders).length>0?a.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.rawHeaders).sort(([te],[ee])=>te.localeCompare(ee)).map(([te,ee])=>a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[te,":"]}),a.jsx("span",{className:"text-muted-foreground truncate",title:ee,children:ee})]},te))}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No raw headers captured"})})}),a.jsx(ft,{value:"raw",children:g==="raw"&&a.jsxs("div",{className:"px-4 pt-1 pb-3 space-y-3",children:[e.error!==void 0&&e.error!==null&&a.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[a.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),a.jsx("div",{className:"text-muted-foreground font-mono",children:e.error})]}),e.responseText!==null?a.jsx(v.Suspense,{fallback:a.jsx(Jt,{}),children:a.jsx(gw,{text:e.responseText,defaultExpandDepth:0,bulkDepth:Z.bulkDepth,bulkRevision:Z.bulkRevision})}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No response"}),e.streaming===!0&&a.jsx(v.Suspense,{fallback:a.jsx(Jt,{}),children:a.jsx(mw,{logId:e.id,truncated:e.streamingChunksPath!==null})})]})}),a.jsx(ft,{value:"parsed",children:g==="parsed"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:a.jsx(v.Suspense,{fallback:a.jsx(Jt,{}),children:a.jsx(pw,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:k,error:e.error})})})})]})})]}),a.jsx(v.Suspense,{fallback:null,children:a.jsx(fw,{log:e,open:c,onOpenChange:u})})]})});function I_({stopReason:e,isPending:t,isFirst:n,isTurnStart:r,isOnlyEntry:o=!1,crabIndex:s=0,collapsible:i=!1,onToggle:l}){const c=e==="end_turn"||e==="stop",u=o&&r&&c,d=t&&!c,h=v.useMemo(()=>_r(s),[s]),m=v.useMemo(()=>Bb(s),[s]),p=i&&l?{role:"button",tabIndex:0,className:"cursor-pointer",onClick:g=>{g.stopPropagation(),l()},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),l())}}:{};return a.jsxs("div",{className:"flex flex-col items-center w-6 shrink-0 pt-0.5 pb-0.5",children:[a.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]",children:!n&&a.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),u?a.jsx("span",{title:"Start and end of turn",children:a.jsx(m,{className:xe("size-3.5 text-[#80FF00]","animate-crab-settle","drop-shadow-[0_0_4px_rgba(128,255,0,0.5)]")})}):c?a.jsx("span",{title:e==="end_turn"?"End of Turn (Anthropic)":"End of Turn (OpenAI)",...p,children:a.jsx(h,{className:xe("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})}):r?a.jsx("span",{title:"Start of turn",...p,children:a.jsx(h,{className:xe("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}):d?a.jsx("span",{title:"Processing…",children:a.jsx(h,{className:xe("size-3.5 text-amber-300/80","animate-crab-crawl")})}):a.jsx("span",{children:a.jsx(h,{className:"size-3.5 text-muted-foreground/40"})}),a.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:!c&&a.jsx("div",{className:xe("w-0.5 h-full",t?"border-dashed bg-transparent border-l-2 border-muted-foreground/20":"bg-muted-foreground/30")})})]})}function P_(e,t){return e||t}function M_(e,t,n){return e>1&&t&&!n}function D_(e){const t=[];let n=[],r=0;for(const o of e){n.push({log:o,stopReason:Nb(o)});const s=n[n.length-1];s!==void 0&&ju(s.stopReason)&&(t.push({entries:n,turnIndex:r}),n=[],r+=1)}return n.length>0&&t.push({entries:n,turnIndex:r}),t}function L_(e){const t=new Map;for(const n of e)for(let r=1;r<n.logs.length;r+=1){const o=n.logs[r],s=n.logs[r-1];if(o===void 0||s===void 0)continue;const i=$o(o),l=$o(s);i==="unknown"||i!==l||t.set(o.id,s)}return t}function fo(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const F_=v.memo(function({entries:t,viewMode:n,strip:r,slowResponseThresholdSeconds:o,cacheTrends:s,onCompareWithPrevious:i,comparisonPredecessors:l,turnIndex:c=0}){const u=t.length-1,d=t[u]?.stopReason??null,h=d!==null?ju(d):!1,m=t[u]?.log.responseStatus===null,p=t.length===1,g=M_(t.length,h,m),[f,x]=v.useState(!1),y=v.useRef(!1);v.useEffect(()=>{g?h&&!y.current&&x(!0):x(!1),y.current=h},[g,h]);const _=v.useCallback(()=>{g&&x(S=>!S)},[g]),k=v.useMemo(()=>{let S=0,R=0,w=null,I=!1;for(const V of t)V.log.inputTokens!==null&&(S+=V.log.inputTokens,I=!0),V.log.outputTokens!==null&&(R+=V.log.outputTokens,I=!0),V.log.elapsedMs!==null&&(w=w===null?V.log.elapsedMs:Math.max(w,V.log.elapsedMs));return{totalInput:S,totalOutput:R,hasTokens:I,maxElapsed:w}},[t,u]),C=v.useMemo(()=>{const S=new Set;for(const R of t){const w=Tu(R.log.model);w!=="unknown"&&S.add(w)}return[...S]},[t]),j=v.useMemo(()=>_r(t[0]?.log.id??0),[t]),z=v.useMemo(()=>_r(t[u]?.log.id??0),[t,u]),E=c%2===0?"bg-muted/10":"bg-muted/25",A=k.maxElapsed!==null&&o>0&&k.maxElapsed>o*1e3,[O,P]=v.useState(0),Z=v.useRef(null);return v.useEffect(()=>{const S=Z.current;if(!S)return;let R=0;const w=new ResizeObserver(()=>{window.cancelAnimationFrame(R),R=window.requestAnimationFrame(()=>P(I=>I+1))});return w.observe(S),()=>{w.disconnect(),window.cancelAnimationFrame(R)}},[]),a.jsx("div",{ref:Z,className:xe("border rounded-lg",m?"border-amber-500/10":"border-transparent"),children:f?a.jsxs("div",{"data-nav-id":`turn-collapsed-${t[0]?.log.id??c}`,"data-nav-action":"expand",role:"button",tabIndex:0,className:"flex items-stretch cursor-pointer focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none rounded-lg",onClick:_,onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),_())},children:[a.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:a.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}),a.jsxs("div",{className:"w-6 shrink-0 flex flex-col items-center pt-0.5 pb-0.5",children:[a.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]"}),a.jsx("span",{role:"button",tabIndex:0,title:"Start of turn — click to expand",className:"cursor-pointer",onClick:S=>{S.stopPropagation(),_()},onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),_())},children:a.jsx(j,{className:xe("size-3.5 text-emerald-400","animate-crab-appear drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}),a.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:a.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),a.jsx("span",{role:"button",tabIndex:0,title:"End of Turn — click to expand",className:"cursor-pointer",onClick:S=>{S.stopPropagation(),_()},onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),_())},children:a.jsx(z,{className:xe("size-3.5 text-amber-400","animate-crab-settle drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})})]}),t.length>1&&a.jsxs("div",{className:xe("flex-1 min-w-0 mb-0.5 rounded-lg border border-border py-1 px-3 flex items-center gap-3 text-xs",E),children:[a.jsxs("span",{className:"text-blue-400/80 font-mono font-semibold tabular-nums shrink-0",children:["#",t[0]?.log.id??"?"," ~ #",t[u]?.log.id??"?"]}),a.jsxs("span",{className:"text-muted-foreground shrink-0",children:[t.length," request",t.length>1?"s":""]}),C.length>0&&a.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:C.map(S=>a.jsx(Au,{provider:S,className:"size-4"},S))}),k.maxElapsed!==null&&a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:xe("flex items-center gap-1 shrink-0",A?"text-amber-400":"text-muted-foreground"),children:[a.jsx(sn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:fo(k.maxElapsed)}),A&&a.jsx(wo,{className:"size-3","aria-label":"Slow response"})]})}),a.jsx(Ne,{children:A?`Slow response: ${fo(k.maxElapsed)} exceeds ${fo(o*1e3)}`:"Slowest request in this turn"})]})}),k.hasTokens&&a.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[a.jsx(rs,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsxs("span",{className:"text-blue-400",children:["IN ",Je(k.totalInput)]})," / ",a.jsxs("span",{className:"text-amber-400",children:["OUT ",Je(k.totalOutput)]})]})]}),a.jsx("span",{className:"flex-1 min-w-0"}),a.jsx(Qo,{className:"size-4 text-muted-foreground shrink-0"})]})]}):t.map((S,R)=>{const{log:w,stopReason:I}=S,V=R===0;return a.jsxs("div",{className:"flex items-stretch",children:[V?a.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:a.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}):a.jsx("div",{className:"w-5 shrink-0"}),a.jsx(I_,{stopReason:I,isPending:w.responseStatus===null,isFirst:R===0,isTurnStart:V,isOnlyEntry:p,crabIndex:w.id%12,collapsible:g&&V,onToggle:_}),a.jsx("div",{className:xe("flex-1 min-w-0 mb-0.5 rounded-lg",E),children:a.jsx(R_,{log:w,viewMode:n,strip:r,slowResponseThresholdSeconds:o,cacheTrend:s?.get(w.id)??null,onCompareWithPrevious:l.has(w.id)?i:void 0})})]},w.id)})})});function $_(e){let t=0,n=0;for(const r of e)r.inputTokens!==null&&(t+=r.inputTokens),r.outputTokens!==null&&(n+=r.outputTokens);return{totalInputTokens:t,totalOutputTokens:n}}const B_=v.memo(function({group:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,onClearGroup:l,standalone:c=!1}){const[u,d]=v.useState(!1),h=v.useMemo(()=>$_(e.logs),[e.logs]),m=e.logs[0]?.timestamp??new Date().toISOString(),p=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),g=Sb(e.logs),f=e.logs.some(y=>y.responseStatus===null),x=v.useMemo(()=>D_(e.logs),[e.logs]);return a.jsxs("div",{className:"mb-2",children:[!c&&a.jsx(kb,{conversationId:e.conversationId,startTime:m,endTime:p,totalCalls:e.logs.length,totalInputTokens:h.totalInputTokens,totalOutputTokens:h.totalOutputTokens,apiFormat:Cb(e.logs),expanded:u,onToggle:()=>d(!u),hideApiFormat:g,isLoading:f,userAgent:e.logs[0]?.userAgent??null,onClear:()=>l(e.logs.map(y=>y.id))}),P_(c,u)&&a.jsx("div",{children:x.map(y=>a.jsx(F_,{entries:y.entries,viewMode:t,strip:n,slowResponseThresholdSeconds:r,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,turnIndex:y.turnIndex},y.turnIndex))})]})});function U_({className:e}){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:xe("inline-block size-5",e),children:[a.jsx("path",{d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z"}),a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"}),a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),a.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),a.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),a.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"}),a.jsxs("g",{children:[a.jsx("path",{d:"M5.6 17.7 L8.4 15.4 L10.8 18 C9.1 18.9 7.2 18.8 5.6 17.7 Z",fill:"#2f6b3f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M6.9 17.5 L8.4 16 L9.8 17.7 C8.9 18.1 7.8 18.1 6.9 17.5 Z",fill:"#6fb36f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M8.4 16 L8.4 18.4",stroke:"#d6b45f",strokeWidth:"0.34"}),a.jsx("circle",{cx:"10.6",cy:"17.75",r:"0.36",fill:"#c2412d",stroke:"none"})]}),a.jsxs("g",{children:[a.jsx("path",{d:"M8 16.5 L11.9 13.6 L15.8 16.8 C13.3 18.4 10.4 18.3 8 16.5 Z",fill:"#2f6b3f",stroke:"none",opacity:"0.97"}),a.jsx("path",{d:"M9.8 16.3 L11.9 14.4 L14.3 16.5 C12.8 17.4 11.3 17.4 9.8 16.3 Z",fill:"#6fb36f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M11.9 14.3 L11.9 17.8",stroke:"#d6b45f",strokeWidth:"0.42"}),a.jsx("path",{d:"M9.8 16.3 C11.2 15.8 12.9 15.9 14.3 16.5",stroke:"#9fca78",strokeWidth:"0.36"}),a.jsx("circle",{cx:"15.6",cy:"16.75",r:"0.43",fill:"#c2412d",stroke:"none"})]}),a.jsxs("g",{children:[a.jsx("path",{d:"M13.6 18.1 L16.2 15.7 L18.5 18.2 C17.1 19.1 15.2 19 13.6 18.1 Z",fill:"#2f6b3f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M14.8 17.9 L16.2 16.3 L17.5 18 C16.6 18.4 15.7 18.4 14.8 17.9 Z",fill:"#6fb36f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M16.2 16.3 L16.2 18.6",stroke:"#d6b45f",strokeWidth:"0.34"}),a.jsx("circle",{cx:"18.35",cy:"18.15",r:"0.36",fill:"#c2412d",stroke:"none"})]})]})}const Z_="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAQAAAAi5ZK2AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfpCxsJDCnsge2KAAAM2ElEQVR42u2de3AW1RnGnyQQDARDwiUFpHIVMHIpYgFRB2nLxQrC0FIDiCKDWNqBUqBlai8wvciIpaRTWh3QDqCDIIjKDL0IaBC5SKlysWJArgqh3BMICYFs/wgpGUi+8579dr89e/Z5zp/59j2755fn3d2z5wJQFEVRFEVRoVQSm+AG1UFrtEdT1EcjNEA5SlCMIhxDAQoJ3S4lIwf9cD+6ozXq1vKbYuzHNmxEPo6xwcKtungIS3EajkYpwLPoyqYLp3KwACe1cFcvezATmWzEMOk+rMBV18CrSjHy0IqNGQb1wMa4cV8vZfgzGrNRTVYm8nDFQ+SV5QymIIWNa6ZGaz6y6ZR/I4cNbJrSkOcb8MpyCVPYzCapKz71GXllWY5b2dhm6EGcTwhyBw52oyUbPHgNx6WEIXfg4CDuYKMHq0kevI/rlhP4Ghs+OE1ERcKRO3BwEh3Z+NFC7sDBATQngMRrcoDIHTj4iE/yUXJ5VVlhYsMkWezy+a6urgRbsAP7cRincQGpqI+maI+O6IMuSHYRbwIW0X/mJvZTeAH9ah1CATTCaKxBmWbUi7iTOMxEXoCncIsodgvM1ezo2cFPMebdy89qfyHL0vxSN5FQzHL5ajRxVU8v7NO4cWQRjCnIy/DDOOq6FcvENS0gGjMS+wUMjvvdZ5awrsv4KvEE7/Iz+Lontc4Q1vc8AQXt8rO4x7Oa54hqLOLI2aBdfrenHVyviWqdQUx2uLxS6fhMUO8ugrLD5VXqLfpmfxdh2eHyKi0S1P5b4rLF5ZVqiiJl/Z8SmD0ur9TzgnNoQWi2uLxSt+Gy8ixGEpvZLs9AN3RGqsYRa5Xn8SeCM9XlDfFT7Ll2bDnWYYRwOMZjyjP5kOjMdPkDOHpTjPX4iuDILOWL2znCMxH5IyitMc4+ZAuO3q08nyYEaFpiHxbjYWyDIMm/qDyje4kwPMgdOBihjDBNeU7fJcQwIXewTnBzUJ3Vk8Rozr18mOAtuxT1FFH6KmNMJkhTkH+7lse3G0s7RZyuygjPEGVYEntV6aSIlKOM8CvCDEtirywVyFDE6q2M8WPiDJPLJcMgBiljPEWg4XG5AwfTlfEmKWPkEml4XO7gCBooI85TRvlm8I1ax3CX68w8PYeB2KGFfEWM6Yo3qgy5uKj8VU/lLz5HG2QjHRlIA1CCIhTjBI6ggg43LbGXYYggZj3lgkYVtbwaluITvIlf4gHhNEomdheJXfpeXoX8EVHUAR4sY1CKfEyN5gibMCIHXvJsBYur2IDxSCNy05HXx1mPFy/5L2ZFZb6rGR2uusiByb6sWlOMZ5FOl5vocqAuDvm2XNExjLV5t52wuhyY7vM6Ve+jA11uksuB5glYcLgIY+hyc1yeJBj87E35q6BXkC5PAHJgdgKXI9xlzzt8eF0OjE/wypQH7Li7h9nl4wJYjPQ4utPlwSF/LKD1Z8+gC10eLeQOHHyJ1nR54pGPCniVadmcGyK3xOVVZYvWnNpqb5hBIv+L1hCJAdiuhXyVcpT6dV3GSLylhXyxy7YrxHYU4CBO4yKABmiCNuiIe9DMVbT5mMp7eWJc/rgLl1dgC6bE2NelM6Zim4uoDzOxm5nYS/GicNOuznhJc0X5k2HprIkS8gos1cTSSrgYodFbhkQ5sR/F/a7aqD8Oa9TSny43x+UblDNialcmVovr2WP2qOYoIV8V57tREuaK6/o+E7sJid2bO+00Ya0HTPV6lFy+3LNWmymsMZfIg+1w9fZ5ep6ozp3mjaKjy90rGetF9d5H5Ha4vFLZOB62zYGIPH6NEk2NqEvk4U/s1V/f8gX1DyJye5ADQC/BGfyRyO1I7Nf1rvIcPiZye1xeqaGCua6ZNiMf7sOSAolD3h+v4otrH2RewYPCo1JxWnkmQ4jcROTZNcyGWSMcN7PQ5KUJw4zc33t5G+xHzfu3S7655wqmPRG5ccgPxxjkqN7DvbnyfDYRuVmJvY1iYMQEQYxCxRkVEnlYXF5ZdguibFLEKI/6S9pQg1x+Ow4IYrZSxlmqjJFGl4fF5dLVJBcoYzQl8jDcy3XestV7tbcl8vC43IGD3spo6gEVtxF5mJCXCu7H6u6ZRlFE/nAoE7sDB8sEEd9URqkTfuT2P7FXlSuiZQb2KKKU0OXhcbmDGYKYdZWrTO8l8nDcyx04mCeKqh5IsYaJPRyJ3cEfhHFnePTPQ+ShQQ68r4z1NJEHkdj9Q95KcN7didwmlwOzBC2dTOT2uByoj5PBPcbR5UEgly0tPo3I7XE5kI1zgoVOWhO5PS4HXhHE/IDI7XE5MFIU9QdEbo/LO6NIEPWS98Mn/F04pD+R16oWOCiK+4LXyMf4irwnin1ErrtWzGtGIW+MXcJvdB4v/H87LvqIvL1yWG90XZ6J7UHNpVvoI/KGKPDxS5q/Lm/ry5e06i7/SBi5HHd5izxVI/nqIpcM6aXL1WW+1z7v6SPyJ0I7RMJvl+sgP+H9uLihviFvp5FDmNhrL096/34+2Jf3cgBYw8TuAfI3/OiHu8MXl+tsMM97ee3lKBr7AT1JuVuwG+Sp2EvkcSMvR1+/PqbO9Bw5MIn38rgTu69rP6fFeJd2hzwFn/OJPU6XO5gNX5VTy6iNk66QA4+KLqoCY5nYay0L4bs6YedN1e5EJ5fRdogu60dM7DE+/SZk+lIqxmMzrl5br2wzxrvbCA5Ad9FlraTLay2vJ3YV2DS0Rds4VzuYI7isQ1q9TNG6l79uzsK/8ldAyffhYRoRwz0qJgLIgT6CC/uHMcjpck/0c8Gl9aHLbUIO/FN5aflEbhfyOoJBfrlEbhNyydf5C0jnvdwm5MAY5eWtInK7kAOzlRc4mYndLuTAq8pL7KGMMTzUXTGGdrj6qc2KS7yq7O27E1fYxx4ufaK4yCOK41M0ofg7dYHIRVIh2xr3gyBdbpxUW8+8ozh+PV0ePqkmSK1RJPdLhrj890Qu1ynFxa6PeXRTQ76X871cS6rPqh/GPDrLiJc0ulxTqgVtj8U8OglneS8Pn9RrHjaMefwbvJeHT4vj/JY+iMjDJ/UQip8oIqyNcewyJnYT9T3lpf9NEaEJPqvlyEV0uZnqKpjVkqWIkV3DTuKlmusfE3kClYwzygaYIIiSi03XxuA7OIF5aE7kJuttZRPsQpIoUga64W601l75mF0xCZdkYdvBPtZP5AGom6Ahtvu2brnfiZ3IXfbKye7rdHmo9AtBc5zyYftIujxAtRONcduIFLrcJm3wpdmDdfm/iDy2BgqbZnpoXE7kSiUJOy8qMNWD2nJwlC43QY+Km+i5OF/fHhD0ARJ5grpjt4qbaT1auM4oU1DGxG6Oev2/71xdCpEr7Jqtro5YpwWELk+AXtZqsHz01ojdDHM1PU7kCVEznNDEko8RuEXQ0bsAJZqRiTxhGqQ5FdGBg3NYgsfRpoZoDTEIv8N/tCNGDnlSwPU/hxkujyzCPhzBOZQiBY3QFB3i6Lidp7lhZSbe0VorcyVGoZwer1JdbHHlTC8LE3vC1US8CLg/xf+XtDqEfLPa4BiRR0/dBXsGhzOxE3kMdcGXCUc+h8iDT/IFCQR+BROJ3ARlaw5DcF8uYAiRm6J6yHPRXaNb9mhvUknkPmuocuGC+MoS1Cdy89QSK3wCvg8PaZ8NkSdM/YT7hsvLRcwSfKwh8kBVB08LN/JSlxIscNUzT+QBKBlDsC1O4OeR53LkDZEHqN7Ic9VRW4a3kav92EbkxigF38BcbEO5CMBhLME45Tz3yCJPChn8dPRBF7RHB3RARrVtvC6hGIewHwUowBYcirMW/e/lubhCZybunyALmR7/6zKxR05ETuRETuRETuRsNCKniJwicorIKSKniJwicorIKSKniJyqGfnHmvsyE3nIlRJzHxi63ErlEXnUNI6JPWrKUO7rTJdbp98QedSUjWIm9qjpGSKPnrYysUdNzYRLEBO5RRrLxF6p5AhB7yz4zUqMtn+CUpSgZyt/sZpz0mzTWuXU5sbRaIgoOT1T8fdCnCZ026RC2lJzQ25CD4EKFX9PwWLUI/RoQQe+hbdcrEBFGazRovf0tdFwe1SUJVyx5u90u03aKOx7J3aLNEP8lY1J3ho10hg3Q7dbo59pjJwhdkvUAMeJPXr6jtY2Ary3W6Jfaw2CptutUJLmJgLEboXSsUkLO5O8JQ9079LtxE7sxE7sxE7sFqkhH+mIXV1WhG43DMoD7OPZZNHD/gWnPUUR+4BwX2wyeQMAijEYH4h/fS+hRw97c0K3B/tAvCf6ZRmh26OLGCpy+wE2VfQe6XLYTFHD/h6bKGrYy9CDDWQr9vwakV/FE2wce5WGl29CfgrD2TC2qy+W4/w14Hsxy5aVKvjFSN1CLVAPp1DEpqAoiqIoyiz9D9lYMumhgrvLAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI1LTExLTI3VDA5OjEyOjQxKzAwOjAwvIZCxQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNS0xMS0yN1QwOToxMjo0MSswMDowMM3b+nkAAAAASUVORK5CYII=";function W_({className:e}){return a.jsx("img",{src:Z_,alt:"Model Context Protocol","aria-hidden":"true",className:xe("inline-block size-8 object-contain invert",e)})}function Xi({...e}){return a.jsx(O2,{"data-slot":"select",...e})}function Qi({...e}){return a.jsx(I2,{"data-slot":"select-value",...e})}function ea({className:e,size:t="default",children:n,...r}){return a.jsxs(R2,{"data-slot":"select-trigger","data-size":t,className:xe("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,a.jsx(P2,{asChild:!0,children:a.jsx(Mn,{className:"size-4 opacity-50"})})]})}function ta({className:e,children:t,position:n="popper",align:r="center",...o}){return a.jsx(M2,{children:a.jsxs(D2,{"data-slot":"select-content",className:xe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,align:r,...o,children:[a.jsx(V_,{}),a.jsx(L2,{className:xe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),a.jsx(H_,{})]})})}function nr({className:e,children:t,...n}){return a.jsxs(F2,{"data-slot":"select-item",className:xe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[a.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:a.jsx(B2,{children:a.jsx(Ft,{className:"size-4"})})}),a.jsx($2,{children:t})]})}function V_({className:e,...t}){return a.jsx(U2,{"data-slot":"select-scroll-up-button",className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Og,{className:"size-4"})})}function H_({className:e,...t}){return a.jsx(Z2,{"data-slot":"select-scroll-down-button",className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Mn,{className:"size-4"})})}function q_(){return a.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[a.jsx("title",{children:"Claude Code"}),a.jsx("path",{clipRule:"evenodd",d:"M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z"})]})}function J_(){return a.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[a.jsx("title",{children:"OpenCode"}),a.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})]})}function K_(){return a.jsxs("svg",{fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[a.jsx("title",{children:"MiMo Code"}),a.jsx("text",{x:"12",y:"18",textAnchor:"middle",fontSize:"16",fontWeight:"800",fontFamily:"system-ui, sans-serif",children:"M"})]})}const G_=re({name:W(),apiKey:W(),format:Ve(["anthropic","openai"]),anthropicBaseUrl:W(),openaiBaseUrl:W(),models:Se(W()),sourceTool:Ve(["claude-code","opencode","mimo-code"]),alreadyExists:Be()}),Y_=re({providers:Se(G_),warnings:Se(W()).optional()}),X_=re({success:Be().optional(),imported:me().optional(),message:W().optional(),errors:Se(W()).optional()}),Q_={"claude-code":q_,opencode:J_,"mimo-code":K_};function ek({open:e,onOpenChange:t,onImportComplete:n}){const[r,o]=v.useState(!1),[s,i]=v.useState(null),[l,c]=v.useState([]),[u,d]=v.useState([]),[h,m]=v.useState(new Set),[p,g]=v.useState(!1),[f,x]=v.useState(null),[y,_]=v.useState(null),k=v.useCallback(()=>{o(!0),i(null),d([]),c([]),m(new Set),x(null),_(null),fetch("/api/providers/scan").then(E=>E.ok?E.json().then(A=>{const O=Y_.safeParse(A);if(!O.success){i(`Invalid response: ${O.error.message}`);return}c(O.data.providers),d(O.data.warnings??[]);const P=new Set;O.data.providers.forEach((Z,S)=>{Z.alreadyExists||P.add(S)}),m(P)}):E.text().then(A=>{i(`Scan failed (${E.status}): ${A}`)})).catch(E=>{i(E instanceof Error?E.message:String(E))}).finally(()=>{o(!1)})},[]);v.useEffect(()=>{e&&k()},[e,k]);const C=v.useCallback(E=>{m(A=>{const O=new Set(A);return O.has(E)?O.delete(E):O.add(E),O})},[]),j=v.useCallback(()=>{const E=l.filter((P,Z)=>h.has(Z));if(E.length===0)return;g(!0),_(null),x(null);const A=new Date().toISOString(),O=E.map(P=>({id:window.crypto.randomUUID(),name:P.name,apiKey:P.apiKey,format:P.format,anthropicBaseUrl:P.anthropicBaseUrl,openaiBaseUrl:P.openaiBaseUrl,models:P.models,createdAt:A,updatedAt:A}));fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:O})}).then(P=>P.json()).then(P=>{const Z=X_.safeParse(P);if(!Z.success){_(`Invalid response: ${Z.error.message}`);return}const S=Z.data;c(R=>R.map((w,I)=>h.has(I)?{...w,alreadyExists:!0}:w)),m(new Set),S.errors!==void 0&&S.errors.length>0&&S.message!==void 0?x(S.message):x(`Imported ${S.imported??E.length} provider(s)`),n()}).catch(P=>{_(P instanceof Error?P.message:String(P))}).finally(()=>{g(!1)})},[l,h,n]),z=l.some(E=>!E.alreadyExists);return a.jsx(Cs,{open:e,onOpenChange:t,children:a.jsxs(Ss,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsxs(js,{children:[a.jsx(Es,{children:"Import from External Tools"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Detect provider configurations from Claude Code, OpenCode, and MiMo Code."})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3",children:[r&&a.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-muted-foreground",children:[a.jsx(pr,{className:"size-4 animate-spin"}),a.jsx("span",{className:"text-sm",children:"Scanning for external providers..."})]}),s!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm py-4",children:[a.jsx(An,{className:"size-4"}),s]}),!r&&s===null&&l.length===0&&a.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No external provider configurations found.",a.jsx("br",{}),a.jsx("span",{className:"text-xs",children:"Supported tools: Claude Code (~/.claude/settings.json), OpenCode (~/.config/opencode/opencode.json), MiMo Code (~/.config/mimocode/mimocode.jsonc)"})]}),!r&&l.map((E,A)=>a.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${E.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!E.alreadyExists&&a.jsx("input",{type:"checkbox",checked:h.has(A),disabled:p,onChange:()=>C(A),className:"mt-0.5 size-4"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[(()=>{const O=Q_[E.sourceTool];return O===void 0?null:a.jsx(O,{})})(),E.alreadyExists&&a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Already added"})]}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1 truncate",children:[E.models.slice(0,4).join(", "),E.models.length>4?` +${E.models.length-4} more`:""]}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:E.format==="anthropic"?E.anthropicBaseUrl:E.openaiBaseUrl}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:E.apiKey.length>8?`${E.apiKey.slice(0,4)}••••${E.apiKey.slice(-4)}`:"••••"})]})]},`${E.sourceTool}-${E.name}`)),u.length>0&&a.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((E,A)=>a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(An,{className:"size-3"}),E]},A))}),f!==null&&a.jsx("div",{className:"text-sm text-green-500 border-t pt-2",children:f}),y!==null&&a.jsx("div",{className:"text-sm text-destructive border-t pt-2",children:y})]}),a.jsxs("div",{className:"flex items-center justify-between pt-3 border-t",children:[a.jsxs(De,{variant:"outline",size:"sm",onClick:k,disabled:r,children:[a.jsx(pr,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),a.jsxs(De,{size:"sm",onClick:j,disabled:!z||h.size===0||p,children:[a.jsx(es,{className:"size-3 mr-1"}),p?"Importing...":`Import Selected (${h.size})`]})]})]})})}function Uu(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const tk={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function nk(e){return Object.prototype.hasOwnProperty.call(e,"success")}function rk(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function ok(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return a.jsx(sn,{...t});case"network_unreachable":return a.jsx(F0,{...t});case"connection_refused":return a.jsx(B0,{...t});case"auth_failed":return a.jsx(u0,{...t});case"rate_limited":return a.jsx(t0,{...t});case"server_error":return a.jsx(T0,{...t});case"invalid_response":return a.jsx(Bg,{...t});case"unknown":return a.jsx(An,{...t});default:return a.jsx(An,{...t})}}function rr({result:e}){const[t,n]=v.useState(!1);if(!nk(e))return rk(e)?a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[a.jsx(h0,{className:"size-3"}),a.jsx("span",{children:"Not configured"})]}):a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[a.jsx(il,{className:"size-3 animate-spin"}),a.jsx("span",{children:"Testing..."})]});if(e.success){const c=[];e.inputTokens!==void 0&&c.push(a.jsxs("span",{children:[e.inputTokens," in"]},"in")),e.outputTokens!==void 0&&c.push(a.jsxs("span",{children:[e.outputTokens," out"]},"out")),e.cacheCreationInputTokens!==void 0&&e.cacheCreationInputTokens>0&&c.push(a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["+",e.cacheCreationInputTokens," cache"]})}),a.jsx(Ne,{children:"Tokens cached for reuse, reducing future API cost"})]})},"cache-create")),e.cacheReadInputTokens!==void 0&&e.cacheReadInputTokens>0&&c.push(a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["~",e.cacheReadInputTokens," cached"]})}),a.jsx(Ne,{children:"Tokens served from cache, reducing API cost"})]})},"cache-read"));const u=[];for(let d=0;d<c.length;d++)d>0&&u.push(", "),u.push(c[d]);return a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 shrink-0",children:[a.jsx(Fg,{className:"size-3"}),a.jsx("span",{children:"Connected"}),c.length>0&&a.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]})]})}),a.jsx(Ne,{children:"Connection test passed"})]})})}const r=e.error,o=r?.message??"Connection failed",s=r?.hint,i=r?.details,l=r?.type??"unknown";return a.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600 max-w-[200px]",children:[ok(l),a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("span",{className:"truncate",children:o})}),a.jsx(Ne,{children:"Connection test failed"})]})}),i!==void 0&&a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>n(!t),className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:t?a.jsx(ts,{className:"size-3"}):a.jsx(ns,{className:"size-3"})})}),a.jsx(Ne,{children:t?"Hide error details":"Show detailed error information"})]})})]}),t&&i!==void 0&&a.jsxs("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded p-2 max-w-[300px]",children:[s!==void 0&&a.jsx("div",{className:"mb-1",children:s}),a.jsx("div",{className:"font-mono whitespace-pre-wrap break-all text-red-400/80",children:i})]})]})}function sk(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n,o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function ik({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:o,onEdit:s,onDelete:i,onTest:l}){const[c,u]=v.useState(!1),[d,h]=v.useState(!1),[m,p]=v.useState(!1),g=v.useRef(null),f=v.useRef(void 0);t?.testedAt!==void 0&&t.testedAt!==f.current&&(f.current=t.testedAt,g.current=null);const x=v.useCallback(()=>{p(k=>{const C=!k;return C&&g.current===null&&t?.models!==void 0&&(g.current=t.testedAt??"",fetch(`/api/providers/${e.id}/test/log`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})),C})},[e.id,t]);function y(){navigator.clipboard.writeText(e.apiKey).catch(()=>{}),h(!0),setTimeout(()=>h(!1),2e3)}const _=e.apiDocsUrl??Object.entries(tk).find(([k])=>e.name.toLowerCase().includes(k))?.[1];return a.jsxs("div",{className:`border rounded-lg p-4 flex flex-col gap-3 bg-card transition-all duration-500 ${o===!0?"ring-2 ring-primary shadow-md":""}`,children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"font-medium truncate",children:e.name}),e.source==="company"&&a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400 shrink-0",children:"公司"})}),a.jsx(Ne,{children:"Company-provided API key"})]})}),e.source==="personal"&&a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 shrink-0",children:"个人"})}),a.jsx(Ne,{children:"Your personal API key"})]})})]}),_!==void 0&&a.jsxs("a",{href:_,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1 text-xs",title:"View API documentation",children:[a.jsx(ol,{className:"size-3"}),a.jsx("span",{className:"sr-only",children:"Docs"})]})]}),e.models!==void 0&&e.models.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1",children:e.models.map(k=>a.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:k},k))}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("code",{className:"text-xs text-muted-foreground bg-muted px-2 py-1 rounded flex-1 truncate",children:c?e.apiKey:Uu(e.apiKey)}),a.jsx("button",{type:"button",onClick:()=>u(k=>!k),className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":c?"Hide API key":"Show API key",children:c?a.jsx(ts,{className:"size-4"}):a.jsx(ns,{className:"size-4"})}),a.jsx("button",{type:"button",onClick:y,className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":"Copy API key",children:d?a.jsx(Ft,{className:"size-4 text-green-500"}):a.jsx(Dn,{className:"size-4"})})]}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[a.jsx("span",{className:"font-medium",children:"Anthropic:"})," ",a.jsx("span",{className:"truncate",children:e.anthropicBaseUrl})]}),t&&a.jsx(rr,{result:t.anthropic.nonStreaming})]}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[a.jsx("span",{className:"font-medium",children:"OpenAI:"})," ",a.jsx("span",{className:"truncate",children:e.openaiBaseUrl})]}),t&&a.jsx(rr,{result:t.openai.nonStreaming})]}),t?.testedAt!==void 0&&a.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a.jsx(sn,{className:"size-3"}),a.jsxs("span",{children:["Tested ",sk(t.testedAt)]})]}),t?.models!==void 0&&Object.keys(t.models).length>0&&a.jsxs("div",{className:"border-t pt-2",children:[a.jsxs("button",{type:"button",onClick:x,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",children:[a.jsx("span",{className:"font-mono",children:m?"▾":"▸"}),"Model Test Results (",Object.keys(t.models).length,")"]}),m&&a.jsx("div",{className:"mt-2 overflow-x-auto",children:a.jsxs("table",{className:"w-full text-xs border-collapse",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border",children:[a.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Model"}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&a.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Anthropic"}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"OpenAI"})]})}),a.jsx("tbody",{children:Object.entries(t.models).map(([k,C])=>a.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[a.jsx("td",{className:"py-1 px-2 font-medium",children:k}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&a.jsx("td",{className:"py-1 px-2",children:a.jsx(rr,{result:C.anthropic.nonStreaming})}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsx("td",{className:"py-1 px-2",children:a.jsx(rr,{result:C.openai.nonStreaming})})]},k))})]})})]}),a.jsxs("div",{className:"flex gap-2 pt-1 border-t",children:[l!==void 0&&a.jsxs(De,{variant:"outline",size:"sm",onClick:()=>l(e.id),className:"text-xs h-7 gap-1",disabled:n??!1,children:[a.jsx(il,{className:`size-3 ${n??!1?"animate-spin":""}`}),n??!1?r!==void 0?`Testing (${r}s)`:"Testing...":"Test"]}),a.jsxs(De,{variant:"outline",size:"sm",onClick:()=>s(e),className:"text-xs h-7 gap-1",disabled:n??!1,children:[a.jsx(x0,{className:"size-3"}),"Edit"]}),a.jsxs(De,{variant:"outline",size:"sm",onClick:()=>i(e.id),className:"text-xs h-7 gap-1 text-destructive hover:text-destructive",disabled:n??!1,children:[a.jsx(al,{className:"size-3"}),"Delete"]})]})]})}const ak={deepseek:{format:"openai",baseUrl:"https://api.deepseek.com"},minimax:{format:"anthropic",baseUrl:"https://api.minimaxi.com/anthropic",apiDocsUrl:"https://platform.minimaxi.com/docs/api-reference/api-overview"},alibaba:{format:"openai",baseUrl:"https://dashscope.aliyuncs.com/compatible-mode"}},na=["MiniMax M3","MiniMax M2.7","MiniMax M2.7-highspeed","MiniMax M2.5","MiniMax M2.5-highspeed","MiniMax M2.1","MiniMax M2.1-highspeed","MiniMax M2"],ra=["glm-5","glm-5.1","qwen3.6-plus","qwen3.7-max"];function lk({provider:e,onSubmit:t,onCancel:n}){const[r,o]=v.useState(e?.name??""),[s,i]=v.useState(e?.apiKey??""),[l,c]=v.useState(!1),[u,d]=v.useState(!1),h=e?.models,[m,p]=v.useState(h!==void 0&&h.length>0?h:[""]),[g,f]=v.useState("anthropic"),[x,y]=v.useState(e?.anthropicBaseUrl??""),[_,k]=v.useState(e?.openaiBaseUrl??""),[C,j]=v.useState(e?.apiDocsUrl??""),[z,E]=v.useState(e?.source),[A,O]=v.useState({}),[P,Z]=v.useState(!1),[S,R]=v.useState(null),w=v.useRef([]);v.useEffect(()=>{if(S===null)return;const K=S;function ue(X){if(!(X.target instanceof Node))return;const ie=w.current[K];ie!=null&&!ie.contains(X.target)&&R(null)}return document.addEventListener("mousedown",ue),()=>document.removeEventListener("mousedown",ue)},[S]);const[I,V]=v.useState(!1),[$,F]=v.useState(!1),J=r.toLowerCase().includes("minimax"),se=r.toLowerCase().includes("alibaba");function U(){navigator.clipboard.writeText(s).catch(()=>{}),d(!0),setTimeout(()=>d(!1),2e3)}v.useEffect(()=>{e&&(o(e.name),i(e.apiKey),p((e.models?.length??0)>0?e.models:[""]),y(e.anthropicBaseUrl??""),k(e.openaiBaseUrl??""),j(e.apiDocsUrl??""),E(e.source),V(!1),F(!1))},[e]),v.useEffect(()=>{const K=r.toLowerCase();for(const[ue,X]of Object.entries(ak))if(K.includes(ue)){X.format==="anthropic"&&!I?y(X.baseUrl):X.format==="openai"&&!$&&k(X.baseUrl),X.apiDocsUrl!==void 0&&!C&&j(X.apiDocsUrl),ue==="minimax"&&m.length===1&&m[0]===""&&p([na[0]??""]),ue==="alibaba"&&m.length===1&&m[0]===""&&p([ra[0]??""]);break}},[r]);function B(){const K={};return r.trim()||(K.name="Name is required"),s.trim()||(K.apiKey="API key is required"),(m.length===0||m.every(ue=>!ue.trim()))&&(K.models="At least one model is required"),x.trim()&&!te(x.trim())&&(K.anthropicBaseUrl="Invalid URL format"),_.trim()&&!te(_.trim())&&(K.openaiBaseUrl="Invalid URL format"),!x.trim()&&!_.trim()&&(K.format="At least one format URL (Anthropic or OpenAI) is required"),O(K),Object.keys(K).length===0}function te(K){try{return new URL(K),!0}catch{return!1}}function ee(K){if(K.preventDefault(),!!B()){Z(!0);try{t({name:r.trim(),apiKey:s.trim(),models:m.map(ue=>ue.trim()).filter(ue=>ue!==""),anthropicBaseUrl:x.trim()||void 0,openaiBaseUrl:_.trim()||void 0,apiDocsUrl:C.trim()||void 0,source:z})}finally{Z(!1)}}}return a.jsxs("form",{onSubmit:ee,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{htmlFor:"provider-name",className:"text-sm font-medium",children:["Name ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx("input",{id:"provider-name",type:"text",value:r,onChange:K=>o(K.target.value),placeholder:"Provider Name",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),A.name!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.name})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-source",className:"text-sm font-medium",children:"Token Source"}),a.jsxs("select",{id:"provider-source",value:z??"",onChange:K=>E(K.target.value==="company"||K.target.value==="personal"?K.target.value:void 0),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",children:[a.jsx("option",{value:"",children:"—"}),a.jsx("option",{value:"personal",children:"个人 (Personal)"}),a.jsx("option",{value:"company",children:"公司 (Company)"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Label whether this API key is company-provided or personal."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{htmlFor:"provider-apikey",className:"text-sm font-medium",children:["API Key ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{id:"provider-apikey",type:"text",value:l||s.length===0?s:Uu(s),onChange:K=>i(K.target.value),onFocus:()=>{!l&&s.length>0&&c(!0)},placeholder:"sk-ant-...",readOnly:!l&&s.length>0,className:"flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("button",{type:"button",onClick:()=>c(K=>!K),className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":l?"Hide API key":"Show API key",children:l?a.jsx(ts,{className:"size-4"}):a.jsx(ns,{className:"size-4"})}),a.jsx("button",{type:"button",onClick:U,className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":"Copy API key",children:u?a.jsx(Ft,{className:"size-4 text-green-500"}):a.jsx(Dn,{className:"size-4"})})]}),A.apiKey!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.apiKey})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{className:"text-sm font-medium",children:["Models ",a.jsx("span",{className:"text-destructive",children:"*"})]}),m.map((K,ue)=>a.jsxs("div",{ref:X=>{w.current[ue]=X},className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx("input",{type:"text",value:K,onChange:X=>{p(ie=>{const ae=[...ie];return ae[ue]=X.target.value,ae})},placeholder:J||se?"Type or select a model...":"Model name",className:"w-full rounded-md border border-input bg-background px-4 py-3 pr-8 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),(J||se)&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>R(S===ue?null:ue),className:"absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors p-1 z-10","aria-label":"Show model suggestions",children:a.jsx(Mn,{className:"size-4"})}),S===ue&&a.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 bg-popover border border-border rounded-md shadow-md max-h-48 overflow-y-auto",children:(J?na:ra).map(X=>a.jsx("button",{type:"button",onClick:()=>{p(ie=>{const ae=[...ie];return ae[ue]=X,ae}),R(null)},className:"w-full text-left px-3 py-2 text-sm hover:bg-muted transition-colors",children:X},X))})]})]}),m.length>1&&a.jsx("button",{type:"button",onClick:()=>p(X=>X.filter((ie,ae)=>ae!==ue)),className:"text-muted-foreground hover:text-destructive transition-colors p-1 shrink-0","aria-label":"Remove model",children:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M3 6h18"}),a.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),a.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]})})]},ue)),a.jsx("button",{type:"button",onClick:()=>p(K=>[...K,""]),className:"text-xs text-primary hover:underline flex items-center gap-1",children:"+ Add Model"}),A.models!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.models})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex gap-1 border-b border-border",children:[a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>f("anthropic"),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${g==="anthropic"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Anthropic Format"})}),a.jsx(Ne,{children:"Anthropic Messages API protocol"})]})}),a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>f("openai"),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${g==="openai"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"OpenAI Format"})}),a.jsx(Ne,{children:"OpenAI Chat Completions API protocol"})]})})]}),A.format!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.format})]}),g==="anthropic"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-anthropic-base-url",className:"text-sm font-medium",children:"Anthropic Base URL"}),a.jsx("input",{id:"provider-anthropic-base-url",type:"text",value:x,onChange:K=>{V(!0),y(K.target.value)},placeholder:"https://api.anthropic.com",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),A.anthropicBaseUrl!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.anthropicBaseUrl}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Anthropic-compatible endpoint URL. Leave empty if this provider does not support Anthropic format."})]}),g==="openai"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-openai-base-url",className:"text-sm font-medium",children:"OpenAI Base URL"}),a.jsx("input",{id:"provider-openai-base-url",type:"text",value:_,onChange:K=>{F(!0),k(K.target.value)},placeholder:"https://api.openai.com/v1",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),A.openaiBaseUrl!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.openaiBaseUrl}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"OpenAI-compatible endpoint URL. Leave empty if this provider does not support OpenAI format."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-api-docs-url",className:"text-sm font-medium",children:"API Docs URL"}),a.jsx("input",{id:"provider-api-docs-url",type:"text",value:C,onChange:K=>j(K.target.value),placeholder:"https://api.example.com/docs",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional API documentation URL. If not set, uses known provider docs."})]}),a.jsxs("div",{className:"sticky bottom-0 bg-card border-t flex gap-2 justify-end pt-2 pb-2",children:[a.jsx(De,{type:"button",variant:"outline",onClick:n,disabled:P,children:"Cancel"}),a.jsx(De,{type:"submit",disabled:P,children:P?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const Bo=re({id:W(),name:W(),apiKey:W(),model:W().optional(),models:Se(W()).min(1),format:Ve(["anthropic","openai"]).optional(),baseUrl:W().optional(),anthropicBaseUrl:W().optional(),openaiBaseUrl:W().optional(),authHeader:Ve(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:W().optional(),source:Ve(["company","personal"]).optional(),createdAt:W(),updatedAt:W()}),ck=Ve(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),uk=re({message:W(),type:ck,details:W().optional(),hint:W().optional()}),dk=re({type:Ve(["text","thinking"]),text:W().optional(),thinking:W().optional()}),fk=re({success:Be(),error:uk.optional(),model:W().optional(),inputTokens:me().optional(),outputTokens:me().optional(),cacheCreationInputTokens:me().optional(),cacheReadInputTokens:me().optional(),latencyMs:me().optional(),content:Se(dk).optional(),rawResponse:W().optional(),streaming:Be().optional(),streamingChunks:re({chunks:Se(tl),truncated:Be().default(!1)}).optional(),requestHeaders:pt(W(),W()).optional()}),oa=xt([fk,re({notConfigured:ve(!0)}),re({testing:ve(!0)})]),Cr=re({nonStreaming:oa,streaming:oa}),hk=re({anthropic:Cr,openai:Cr}),pk=re({anthropic:Cr,openai:Cr,models:pt(W(),hk).optional(),testedAt:W().optional()});function mk(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function sa(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const gk=re({providerConfig:W()}),xk=re({success:Be().optional(),imported:me().optional(),message:W().optional(),errors:Se(W()).optional()}),vk=30,ho="Network error: could not reach the server. Is the proxy running?";function ia(e){return{name:e.name,apiKey:e.apiKey,models:e.models,anthropicBaseUrl:(e.anthropicBaseUrl?.length??0)>0?e.anthropicBaseUrl:void 0,openaiBaseUrl:(e.openaiBaseUrl?.length??0)>0?e.openaiBaseUrl:void 0,apiDocsUrl:(e.apiDocsUrl?.length??0)>0?e.apiDocsUrl:void 0,source:e.source}}function yk({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:r,externalTestingTimeLeft:o,onProvidersMutate:s,onTestResultsChange:i,onTestingProvidersChange:l,onTestingTimeLeftChange:c}){const[u,d]=v.useState(!1),[h,m]=v.useState(),[p,g]=v.useState(null),[f,x]=v.useState({}),[y,_]=v.useState(new Set),[k,C]=v.useState({}),[j,z]=v.useState(null),[E,A]=v.useState(!1),[O,P]=v.useState(null),[Z,S]=v.useState(!1),[R,w]=v.useState(!1),[I,V]=v.useState(null),[$,F]=v.useState("all"),J=v.useRef(null),se=v.useRef(null),U=e??[],B=v.useMemo(()=>{const L=$==="all"?U:U.filter(H=>H.source===$);return $==="all"?[...L].sort((H,M)=>{const Q={personal:0,company:1};return(Q[H.source??""]??2)-(Q[M.source??""]??2)}):L},[U,$]),te=n??f,ee=r??y,K=o??k,ue=c?(L,H)=>c(L,H):(L,H)=>{C(H===void 0?M=>{const Q={...M};return delete Q[L],Q}:M=>({...M,[L]:H}))};v.useEffect(()=>{(async()=>{try{const L=await fetch("/api/config/paths");if(L.ok){const H=await Kt(L,gk);z(H.providerConfig)}}catch{}})()},[]);const X=v.useCallback(L=>{se.current!==null&&clearTimeout(se.current),P(L),J.current?.scrollTo({top:J.current.scrollHeight,behavior:"smooth"}),se.current=setTimeout(()=>{P(null),se.current=null},2e3)},[]);v.useEffect(()=>()=>{se.current!==null&&clearTimeout(se.current)},[]);const ie=v.useCallback(()=>{s?.().catch(()=>{})},[s]),ae=v.useCallback((L,H)=>{i?i(L,H):x(M=>({...M,[L]:H}))},[i]),he=v.useCallback((L,H)=>{if(l){l(L,H);return}_(M=>{const Q=new Set(M);return H?Q.add(L):Q.delete(L),Q})},[l]),fe=v.useCallback(async L=>{ae(L,mk()),he(L,!0);const H=new AbortController;let M=vk;ue(L,M);const Q=setInterval(()=>{M--,ue(L,M),M<=0&&(clearInterval(Q),H.abort())},1e3);try{const oe=await fetch(`/api/providers/${L}/test`,{method:"POST",signal:H.signal});if(oe.ok){const ne=await Kt(oe,pk);ae(L,ne)}else ae(L,sa(`HTTP ${oe.status}: ${oe.statusText}`,"server_error"))}catch(oe){oe instanceof Error&&oe.name==="AbortError"&&ae(L,sa("Request timed out","timeout"))}finally{clearInterval(Q),ue(L,void 0),he(L,!1)}},[ue,ae,he]);function we(L){(async()=>{try{const H=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ia(L))});if(!H.ok){g(await or(H,"Failed to add provider"));return}const M=await Kt(H,Bo);d(!1),X(M.id),ie(),await fe(M.id)}catch{g(ho)}})()}function Te(L){h&&(async()=>{try{const H=await fetch(`/api/providers/${h.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(ia(L))});if(!H.ok){g(await or(H,"Failed to update provider"));return}const M=await Kt(H,Bo);m(void 0),X(M.id),ie(),((L.apiKey??"")!==(h.apiKey??"")||JSON.stringify(L.models)!==JSON.stringify(h.models)||(L.anthropicBaseUrl??"")!==(h.anthropicBaseUrl??"")||(L.openaiBaseUrl??"")!==(h.openaiBaseUrl??""))&&await fe(M.id)}catch{g(ho)}})()}function b(L){V(L),w(!0)}function Y(){const L=I;L!==null&&(async()=>{let H;try{H=await fetch(`/api/providers/${L}`,{method:"DELETE"})}catch{g(ho);return}if(!H.ok){g(await or(H,"Failed to delete provider"));return}ie()})()}const q=v.useRef(null);function T(L){const H="/api/providers/export";(async()=>{try{const M=await fetch(H);if(!M.ok){g("Failed to export providers");return}const Q=await M.blob(),oe=URL.createObjectURL(Q),ne=document.createElement("a");ne.href=oe,ne.download=M.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(ne),ne.click(),document.body.removeChild(ne),URL.revokeObjectURL(oe)}catch{g("Failed to export providers")}})()}function N(){q.current?.click()}function D(L){const H=L.target.files?.[0];H&&(async()=>{try{const M=await H.text(),Q=await fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)}),oe=await Kt(Q,xk);Q.ok&&oe.imported!==void 0&&oe.imported>0?(ie(),g(null)):oe.errors&&oe.errors.length>0?g(oe.errors.join("; ")):g(oe.message??"Import failed")}catch{g("Failed to import providers")}L.target.value=""})()}return t?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading providers..."})}):u||h?a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center justify-between sticky top-0 bg-background z-10 pb-2",children:a.jsx("h3",{className:"text-lg font-medium",children:h?"Edit Provider":"Add New Provider"})}),a.jsx(lk,{provider:h,onSubmit:h?Te:we,onCancel:()=>{d(!1),m(void 0)}})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between sticky top-0 z-10 bg-background pb-2",children:[a.jsx("h3",{className:"text-lg font-medium",children:"Providers"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs(De,{variant:"outline",size:"sm",onClick:()=>T(),className:"gap-1 hover:bg-muted",children:[a.jsx(es,{className:"size-3"}),"Export"]})}),a.jsx(Ne,{children:"Download providers as JSON for backup or sharing"})]})}),a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs(De,{variant:"outline",size:"sm",onClick:N,className:"gap-1 hover:bg-muted",children:[a.jsx(P0,{className:"size-3"}),"Import"]})}),a.jsx(Ne,{children:"Import providers from an exported JSON file"})]})}),a.jsx("input",{type:"file",ref:q,accept:".json",onChange:D,style:{display:"none"}}),a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs(De,{variant:"outline",size:"sm",onClick:()=>S(!0),className:"gap-1",children:[a.jsx(E0,{className:"size-3"}),"Scan"]})}),a.jsx(Ne,{children:"Detect and import provider configs from Claude Code and OpenCode"})]})}),a.jsxs(De,{onClick:()=>d(!0),size:"sm",className:"gap-1",children:[a.jsx(bo,{className:"size-4"}),"Add Provider"]})]})]}),j!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/30 rounded-md px-3 py-2",children:[a.jsx("span",{className:"shrink-0",children:"Config:"}),a.jsx("span",{className:"font-mono truncate",title:j,children:j}),a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>{window.navigator.clipboard.writeText(j).then(()=>{A(!0),setTimeout(()=>A(!1),2e3)})},className:"shrink-0 ml-auto text-muted-foreground hover:text-foreground transition-colors",children:E?a.jsx(Ft,{className:"size-3 text-green-500"}):a.jsx(Dn,{className:"size-3"})})}),a.jsx(Ne,{children:"Copy config file path to clipboard"})]})})]}),p!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive bg-destructive/10 rounded-md px-3 py-2",children:[a.jsx(An,{className:"size-4 shrink-0"}),p]}),U.length===0?a.jsxs("div",{className:"text-center py-12 space-y-3",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured yet."}),a.jsxs(De,{onClick:()=>d(!0),variant:"outline",size:"sm",children:[a.jsx(bo,{className:"size-4"}),"Add Your First Provider"]})]}):a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"flex gap-1 border-b border-border",children:["all","personal","company"].map(L=>a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>F(L),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${$===L?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:L==="all"?"All":L==="personal"?"Personal":"Company"})}),a.jsx(Ne,{children:L==="all"?"Show all providers":L==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},L))}),a.jsx("div",{ref:J,className:"space-y-3",children:B.map(L=>a.jsx(ik,{provider:L,testResults:te[L.id],isTesting:ee.has(L.id),testingTimeLeft:K[L.id],isHighlighted:L.id===O,onEdit:H=>m(H),onDelete:b,onTest:H=>{fe(H)}},L.id))})]}),a.jsx(ek,{open:Z,onOpenChange:S,onImportComplete:()=>{s!==void 0&&s()}}),a.jsx(Su,{open:R,onOpenChange:w,title:"Delete Provider",description:"Are you sure you want to delete this provider? This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",onConfirm:Y})]})}async function bk(e){return Pn(e,Bo.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function wk(){const e=Zo("/api/providers",bk,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}function _k(){const[e,t]=v.useState(!1),[n,r]=v.useState("providers"),{providers:o,isLoading:s,mutate:i}=wk(),[l,c]=v.useState({}),[u,d]=v.useState(new Set),[h,m]=v.useState({}),p=v.useCallback((x,y)=>{c(_=>({..._,[x]:y}))},[]),g=v.useCallback((x,y)=>{d(_=>{const k=new Set(_);return y?k.add(x):k.delete(x),k})},[]),f=v.useCallback((x,y)=>{m(_=>{if(y===void 0){const k={..._};return delete k[x],k}return{..._,[x]:y}})},[]);return a.jsxs(Cs,{open:e,onOpenChange:t,children:[a.jsx(vb,{asChild:!0,children:a.jsxs(De,{variant:"ghost",size:"icon",className:"size-8",children:[a.jsx(z0,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Settings"})]})}),a.jsxs(Ss,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsx(js,{children:a.jsx(Es,{children:"Settings"})}),a.jsxs(zu,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[a.jsxs(Ou,{children:[a.jsx(dt,{value:"providers",children:"Providers"}),a.jsx(dt,{value:"proxy",children:"Proxy"})]}),a.jsxs("div",{className:"mt-4 overflow-y-auto flex-1 pr-3",children:[a.jsx(ft,{value:"providers",children:a.jsx(yk,{externalProviders:o,isLoading:s,externalTestResults:l,externalTestingProviders:u,externalTestingTimeLeft:h,onProvidersMutate:()=>i(),onTestResultsChange:p,onTestingProvidersChange:g,onTestingTimeLeftChange:f})}),a.jsx(ft,{value:"proxy",children:a.jsx(kk,{})})]})]})]})]})}function kk(){const{strip:e,slowResponseThresholdSeconds:t,isLoading:n,setStrip:r,setSlowResponseThresholdSeconds:o}=nl(),[s,i]=v.useState(null),[l,c]=v.useState(!1),u=v.useCallback(async h=>{i(null),c(!0);try{await r(h)}catch(m){i(m instanceof Error?m.message:String(m))}finally{c(!1)}},[r]),d=v.useCallback(async h=>{i(null),c(!0);try{await o(h)}catch(m){i(m instanceof Error?m.message:String(m))}finally{c(!1)}},[o]);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Claude Code billing header"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["When enabled, the proxy strips the synthetic ",a.jsx("code",{children:"x-anthropic-billing-header"})," text block that Claude Code prepends to the system prompt before forwarding to upstream. Improves prefix-cache hit rates against third-party upstreams. The default at startup is controlled by the ",a.jsx("code",{children:"AGENT_INSPECTOR_STRIP_CLAUDE_CODE_BILLING_HEADER"})," ","environment variable; your choice is persisted to ",a.jsx("code",{children:"config.json"})," and overrides the env var for subsequent requests."]})]}),a.jsxs("label",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"checkbox",role:"switch",checked:e,disabled:n||l,onChange:h=>{u(h.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("span",{className:"text-sm",children:n?"Loading…":e?"Stripping enabled":"Stripping disabled"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{htmlFor:"slow-response-threshold",className:"text-sm font-semibold",children:"Slow response threshold"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Logs whose elapsed time exceeds this many seconds show a warning icon next to the duration. Set to ",a.jsx("code",{children:"0"})," to disable the indicator."]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{id:"slow-response-threshold",type:"number",min:0,max:yo,step:1,value:t,disabled:n||l,onChange:h=>{const m=Number(h.currentTarget.value);Number.isInteger(m)&&(m<0||m>yo||d(m))},className:"h-8 w-24 rounded-md border border-input bg-transparent px-2 text-sm font-mono disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds"})]})]}),s!==null&&a.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",s]})]})}function Ck(e){const t=new Map;for(const n of e){const r=n.logs;for(let o=1;o<r.length;o++){const s=r[o-1],i=r[o];s===void 0||i===void 0||t.set(i.id,{creation:aa(s.cacheCreationInputTokens,i.cacheCreationInputTokens),read:aa(s.cacheReadInputTokens,i.cacheReadInputTokens)})}}return t}function aa(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const Uo="data-nav-id",Sk="data-nav-action";function la(e){return Array.from(e.querySelectorAll(`[${Uo}]`))}function ca(e){return e instanceof HTMLElement}function jk(e,t){let n=e;for(;n!==null&&n!==t;){if(n.hasAttribute(Uo))return n;n=n.parentElement}return e.hasAttribute(Uo)?e:null}function po(e){const t=e.getAttribute(Sk);return t==="toggle"||t==="expand"||t==="collapse"?t:null}function Cn(e){e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",behavior:"smooth"})}function Sn(e,t){return e[t]??null}function Ek(e){const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||e.isContentEditable)}function Nk(e,t){const n=t??e,r=v.useCallback(o=>{const s=e.current;if(!s)return;const i=o.target;if(!ca(i)||i!==n.current||!s.contains(i))return;const l=la(s),c=Sn(l,0);c!==null&&Cn(c)},[e,n]);v.useEffect(()=>{const o=n.current,s=e.current;if(!o||!s)return;const i=l=>{const c=l.target;if(!ca(c)||!s.contains(c)||Ek(c))return;const u=la(s);if(u.length===0)return;const d=jk(c,s),h=d!==null?u.indexOf(d):-1;let m=!1;switch(l.key){case"ArrowUp":case"W":{if(l.key==="W"&&!l.shiftKey)break;l.preventDefault();const p=h>0?h-1:h===-1?u.length-1:-1;if(p!==-1){const g=Sn(u,p);g!==null&&Cn(g)}m=!0;break}case"ArrowDown":case"S":{if(l.key==="S"&&!l.shiftKey)break;l.preventDefault();const p=h<u.length-1?h+1:h===-1?0:-1;if(p!==-1){const g=Sn(u,p);g!==null&&Cn(g)}m=!0;break}case"ArrowLeft":case"A":{if(l.key==="A"&&!l.shiftKey||d===null)break;if(l.preventDefault(),po(d)==="collapse")d.click();else if(h>0){const g=Sn(u,h-1);g!==null&&Cn(g)}m=!0;break}case"ArrowRight":case"D":{if(l.key==="D"&&!l.shiftKey||d===null)break;if(l.preventDefault(),po(d)==="expand")d.click();else if(h<u.length-1){const g=Sn(u,h+1);g!==null&&Cn(g)}m=!0;break}case" ":{if(d===null)break;l.preventDefault(),po(d)!==null&&d.click(),m=!0;break}}m&&l.stopPropagation()};return document.addEventListener("keydown",i,{capture:!0}),()=>document.removeEventListener("keydown",i,{capture:!0})},[e,n]),v.useEffect(()=>{const o=n.current;if(o)return o.addEventListener("focus",r),()=>o.removeEventListener("focus",r)},[r,n])}function cr(e){return e.length<=30?e:e.slice(0,12)+"…"+e.slice(-12)}function Tk(e){let t=0,n=0;for(const r of e)r.inputTokens!==null&&(t+=r.inputTokens),r.outputTokens!==null&&(n+=r.outputTokens);return{totalIn:t,totalOut:n}}function Ak(e){const t=e[0],n=e[e.length-1];if(t===void 0||n===void 0)return null;const r=o=>new Date(o).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});return`${r(t.timestamp)} - ${r(n.timestamp)}`}function zk(e){for(const t of e)if(t.userAgent!==null&&t.userAgent!==void 0&&t.userAgent!=="")return t.userAgent;return null}function Ok({command:e}){const[t,n]=v.useState(!1),r=v.useCallback(()=>{window.navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[e]);return a.jsxs("div",{className:"inline-flex items-center gap-2 bg-muted rounded-md px-3 py-2",children:[a.jsx("pre",{className:"text-blue-500 font-mono text-sm m-0",children:e}),a.jsx("button",{type:"button",onClick:r,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 cursor-pointer","aria-label":"Copy command",children:t?a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M20 6 9 17l-5-5"})}):a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),a.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})]})}function Rk(){return a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:"inline-flex h-7 items-center gap-2 rounded-md border border-cyan-400/30 bg-cyan-500/10 px-2.5 font-mono text-[11px] font-medium text-cyan-300 shadow-[0_0_16px_rgba(34,211,238,0.08)]",children:[a.jsx("span",{className:"size-1.5 rounded-full bg-emerald-300 shadow-[0_0_8px_rgba(110,231,183,0.8)]"}),"MCP Ready",a.jsx("span",{className:"hidden text-cyan-200/70 sm:inline",children:"/api/mcp"})]})}),a.jsx(Ne,{sideOffset:8,className:"max-w-[320px] text-left leading-relaxed",children:"Coding agents can inspect logs, replay requests, test providers, and debug sessions through MCP at /api/mcp."})]})})}function Ik({sessionId:e,logs:t,totalIn:n,totalOut:r}){const[o,s]=v.useState(!1),i=v.useMemo(()=>Ak(t),[t]),l=v.useMemo(()=>zk(t),[t]),c=v.useCallback(()=>{window.navigator.clipboard.writeText(window.location.href).then(()=>{s(!0),setTimeout(()=>s(!1),2e3)})},[]);return a.jsxs("div",{className:"mb-4 flex items-center gap-3 border border-border rounded-md bg-muted/20 px-3 py-2 text-xs",children:[a.jsx("a",{href:"/",className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":"Back to all sessions",title:"Back to all sessions",children:a.jsx(Sg,{className:"size-3.5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"font-mono font-semibold text-purple-400/90 truncate",title:e,children:cr(e)}),l!==null&&a.jsx("span",{className:"font-mono text-muted-foreground truncate max-w-[220px]",title:l,children:l})]}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[a.jsxs("span",{children:[t.length," request",t.length!==1?"s":""]}),i!==null&&a.jsx("span",{children:i}),(n>0||r>0)&&a.jsxs("span",{className:"font-mono",children:[Je(n)," in / ",Je(r)," out"]})]})]}),a.jsx("button",{type:"button",onClick:c,className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":o?"Copied session link":"Copy session link",title:o?"Copied session link":"Copy session link",children:o?a.jsx(Ft,{className:"size-3.5"}):a.jsx(Dn,{className:"size-3.5"})})]})}function Pk({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:s,onModelChange:i,onClearAll:l,onClearGroup:c,viewMode:u,onViewModeChange:d,strip:h,slowResponseThresholdSeconds:m,hideSessionFilter:p=!1,pinnedSessionId:g}){const{totalIn:f,totalOut:x}=v.useMemo(()=>Tk(e),[e]),[y,_]=v.useState(!1),[k,C]=v.useState(null),[j,z]=v.useState("hidden"),E=v.useRef(null),A=v.useRef(null);Nk(E,A),v.useEffect(()=>{const $=50+Rn.length*400,F=setTimeout(()=>z("playing"),50),J=setTimeout(()=>z("done"),$);return()=>{clearTimeout(F),clearTimeout(J)}},[]),v.useEffect(()=>{if(g===void 0){document.title="Agent Inspector";return}const I=e.length===1?"1 req":`${e.length} req`;document.title=`${cr(g)} - ${I} - Agent Inspector`},[e.length,g]);const O=v.useCallback(async()=>{_(!0);try{await Q0(e)}finally{_(!1)}},[e]);v.useEffect(()=>{C(null)},[r,o]);const P=v.useCallback(()=>{C(null)},[]),Z=v.useMemo(()=>Eb(e),[e]),S=v.useMemo(()=>Ck(Z),[Z]),R=v.useMemo(()=>L_(Z),[Z]),w=v.useCallback(I=>{const V=R.get(I.id);V!==void 0&&C([V,I])},[R]);return a.jsxs("div",{className:"max-w-[1400px] xl:max-w-[1600px] 2xl:max-w-[1800px] mx-auto px-6 pb-6",children:[a.jsxs("div",{className:"sticky top-0 z-30 bg-background pt-6",children:[a.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-start gap-3 pb-8",children:[a.jsx("div",{}),a.jsxs("h1",{className:"flex min-w-0 flex-col items-center gap-2 text-center",children:[a.jsxs("span",{className:"flex max-w-[calc(100vw-7rem)] items-end gap-2 whitespace-nowrap",children:[a.jsxs("span",{className:"flex shrink-0 items-end gap-1 group cursor-default","aria-hidden":"true",children:[a.jsx(U_,{className:"size-10 text-amber-500 transition-all duration-300 group-hover:scale-125 group-hover:-translate-y-1.5"}),a.jsx("span",{className:"hidden items-end gap-0.5 sm:flex",children:Rn.map((I,V)=>{const $=["text-amber-500","text-rose-500","text-sky-500","text-emerald-500","text-violet-500","text-orange-500","text-cyan-500","text-pink-500","text-lime-500","text-blue-500","text-yellow-500","text-fuchsia-500"][V],F=j==="hidden"?"opacity-0 scale-0":j==="playing"?"animate-crab-piano-pop":"";return a.jsx(I,{className:`size-5 ${$} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${F}`,style:{transitionDelay:`${V*50}ms`,...j==="playing"?{animationDelay:`${V*400}ms`}:{}}},V)})})]}),a.jsxs("span",{className:"flex min-w-0 items-baseline gap-2 pl-1",children:[a.jsx("span",{className:"truncate text-lg font-bold",children:"Agent Inspector"}),a.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-muted-foreground",children:["v",W1.version]})]}),a.jsx(bo,{className:"size-4 shrink-0 text-muted-foreground/70","aria-hidden":"true"}),a.jsx(W_,{className:"size-10 shrink-0"})]}),a.jsx(Rk,{})]}),a.jsx("div",{className:"justify-self-end",children:a.jsx(_k,{})})]}),g!==void 0&&a.jsx(Ik,{sessionId:g,logs:e,totalIn:f,totalOut:x}),a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[!p&&a.jsxs(Xi,{value:r,onValueChange:s,children:[a.jsx(ea,{className:"flex-1 max-w-[350px] text-xs",children:a.jsx(Qi,{placeholder:"All sessions"})}),a.jsxs(ta,{children:[a.jsx(nr,{value:"__all__",children:"All sessions"}),t.map(I=>a.jsx(nr,{value:I,children:cr(I)},I))]})]}),a.jsxs(Xi,{value:o,onValueChange:i,children:[a.jsx(ea,{className:"flex-1 max-w-[250px] text-xs",children:a.jsx(Qi,{placeholder:"All models"})}),a.jsxs(ta,{children:[a.jsx(nr,{value:"__all__",children:"All models"}),n.map(I=>a.jsx(nr,{value:I,children:I},I))]})]}),a.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[a.jsx("button",{type:"button",onClick:()=>d("simple"),className:`h-8 px-3 cursor-pointer transition-colors text-xs ${u==="simple"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Simple"}),a.jsx("button",{type:"button",onClick:()=>d("full"),className:`h-8 px-3 cursor-pointer transition-colors text-xs ${u==="full"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Full"})]}),a.jsx("div",{className:"flex-1"}),a.jsxs("span",{className:"text-muted-foreground text-xs font-mono",children:[e.length," request",e.length!==1?"s":"",f>0||x>0?` · ${Je(f)} in / ${Je(x)} out`:""]}),e.length>0&&a.jsx("button",{type:"button",onClick:()=>{O()},disabled:y,className:"h-8 px-3 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center gap-1.5 rounded-md hover:bg-muted",title:"Export all logs as JSON ZIP",children:y?a.jsx("span",{children:"Exporting..."}):a.jsxs(a.Fragment,{children:[a.jsx(es,{className:"size-3.5"}),a.jsx("span",{children:"Export"})]})}),a.jsx("button",{type:"button",onClick:l,className:"h-8 px-3 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer rounded-md hover:bg-muted",title:"Clear all logs",children:"Clear"})]})]}),a.jsx("div",{children:e.length===0?r!=="__all__"?a.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[a.jsx("p",{className:"text-sm font-medium",children:"Session not found"}),a.jsx("p",{className:"text-xs font-mono bg-muted px-3 py-1 rounded inline-block max-w-[500px] break-all",children:cr(r)}),a.jsxs("p",{className:"text-xs",children:["This session may have been cleared or never existed."," ",p?a.jsx("a",{href:"/",className:"underline hover:text-foreground transition-colors",children:"Back to all sessions"}):a.jsx("button",{type:"button",onClick:()=>s("__all__"),className:"underline hover:text-foreground transition-colors",children:"Show all sessions"})]})]}):a.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[a.jsx("p",{className:"text-sm",children:"No requests captured yet."}),a.jsx("p",{className:"text-xs",children:"Route AI coding tools through the proxy:"}),a.jsx(Ok,{command:"LLM_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}):a.jsx("div",{ref:A,tabIndex:0,className:"flex flex-col gap-2 focus:outline-none",children:a.jsx("div",{ref:E,children:Z.map(I=>a.jsx(B_,{group:I,viewMode:u,strip:h,slowResponseThresholdSeconds:m,cacheTrends:S,onCompareWithPrevious:w,comparisonPredecessors:R,onClearGroup:c,standalone:Z.length===1},I.id))})})}),k!==null&&a.jsx(v.Suspense,{fallback:null,children:a.jsx(dw,{left:k[0],right:k[1],onClose:P})})]})}const Mk=xt([re({type:ve("init"),logs:Se(ti)}),re({type:ve("update"),log:ti})]);function Dk(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function Lk(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function Fk(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(r=>!(t!=="__all__"&&r.sessionId!==t||n!=="__all__"&&r.model!==n))}const $k=50,Bk=12,Uk=1800;function Zk(e){return e===void 0?"/api/logs/stream":`/api/logs/stream?${new URLSearchParams({sessionId:e}).toString()}`}function Hk({initialSessionId:e}={}){const[t,n]=v.useState([]),[r,o]=v.useState(e??"__all__"),[s,i]=v.useState("__all__"),[l,c]=v.useState("simple"),[u,d]=v.useState(null),h=v.useRef(null),m=v.useRef(null),p=v.useRef(null),g=v.useRef(new Map),f=v.useRef([]),x=v.useRef(null),y=v.useMemo(()=>Fk(t,r,s),[t,r,s]),_=v.useMemo(()=>Dk(t),[t]),k=v.useMemo(()=>Lk(t),[t]),C=v.useCallback(()=>{x.current=null;const Z=f.current;f.current=[],Z.length!==0&&n(S=>{let R=S;for(const w of Z){const I=g.current.get(w.id);I!==void 0?R=[...R.slice(0,I),w,...R.slice(I+1)]:(g.current.set(w.id,R.length),R=[...R,w])}return R})},[]),j=v.useCallback(Z=>{f.current.push(Z),x.current===null&&(x.current=setTimeout(C,$k))},[C]),z=v.useCallback(()=>{h.current&&h.current.close();const Z=new EventSource(Zk(e));h.current=Z,Z.onmessage=S=>{try{const R=String(S.data),w=JSON.parse(R),I=Mk.safeParse(w);if(!I.success){d("Failed to parse SSE data");return}const V=I.data;if(V.type==="init"){x.current!==null&&(clearTimeout(x.current),x.current=null),f.current=[];const $=new Map;for(let F=0;F<V.logs.length;F++){const J=V.logs[F];J!==void 0&&$.set(J.id,F)}g.current=$,n(V.logs),d(null)}else V.type==="update"&&j(V.log)}catch{d("Failed to parse SSE data")}},Z.onerror=()=>{d("SSE connection lost, reconnecting..."),Z.close(),m.current!==null&&clearTimeout(m.current),m.current=setTimeout(z,3e3)}},[e,j]);v.useEffect(()=>(z(),()=>{h.current&&(h.current.close(),h.current=null),m.current!==null&&(clearTimeout(m.current),m.current=null),x.current!==null&&(clearTimeout(x.current),x.current=null)}),[z]),v.useEffect(()=>{const Z=window.location.hash;if(!Z.startsWith("#log-")||p.current===Z)return;const S=Z.slice(1);let R=!1,w=0,I=null,V=null;const $=()=>{if(R)return;const F=document.getElementById(S);if(F!==null){p.current=Z,F.scrollIntoView({block:"center",behavior:"smooth"}),F instanceof HTMLElement&&(I=F,F.setAttribute("data-deep-link-highlight","true"),V=window.setTimeout(()=>{F.removeAttribute("data-deep-link-highlight")},Uk),F.focus({preventScroll:!0}),F.getAttribute("data-nav-action")==="expand"&&F.click());return}w+=1,w<Bk&&window.setTimeout($,100)};return $(),()=>{R=!0,V!==null&&window.clearTimeout(V),I!==null&&I.removeAttribute("data-deep-link-highlight")}},[y.length]);const E=v.useCallback(()=>{e!==void 0&&t.length===0||(async()=>{try{const Z=e===void 0?void 0:JSON.stringify({ids:t.map(R=>R.id)});if(!(await fetch("/api/logs",{method:"DELETE",...Z===void 0?{}:{headers:{"Content-Type":"application/json"},body:Z}})).ok){d("Failed to clear logs");return}g.current.clear(),n([]),d(null)}catch(Z){d(Z instanceof Error?Z.message:"Unknown error clearing logs")}})()},[t,e]),A=v.useCallback(Z=>{Z.length!==0&&(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:Z})})).ok){d("Failed to clear group");return}const R=new Set(Z);n(w=>{const I=w.filter($=>!R.has($.id)),V=new Map;for(let $=0;$<I.length;$++){const F=I[$];F!==void 0&&V.set(F.id,$)}return g.current=V,I}),d(null)}catch(S){d(S instanceof Error?S.message:"Unknown error clearing group")}})()},[]),{strip:O,slowResponseThresholdSeconds:P}=nl();return a.jsxs(a.Fragment,{children:[u!==null&&a.jsx("div",{className:"fixed top-4 right-4 bg-destructive text-destructive-foreground px-4 py-2 rounded-md text-sm z-50",children:u}),a.jsx(J0,{}),a.jsx(Pk,{logs:y,sessions:_,models:k,selectedSession:r,selectedModel:s,onSessionChange:o,onModelChange:i,onClearAll:E,onClearGroup:A,viewMode:l,onViewModeChange:c,strip:O,slowResponseThresholdSeconds:P,hideSessionFilter:e!==void 0,pinnedSessionId:e})]})}export{Ig as $,W as A,Cu as B,Wg as C,Cs as D,ln as E,Ce as F,ht as G,ye as H,Bt as I,Re as J,Ue as K,$t as L,h0 as M,is as N,_t as O,Hk as P,Di as Q,S0 as R,Mn as S,zu as T,Do as U,wo as V,U1 as W,ll as X,pr as Y,rs as Z,cw as _,jb as a,xe as b,ge as c,bo as d,x0 as e,Je as f,E_ as g,Qo as h,Ft as i,Dn as j,Ss as k,js as l,Es as m,_0 as n,Ou as o,dt as p,ft as q,$o as r,$e as s,je as t,Ee as u,Ne as v,De as w,re as x,Be as y,me as z};