cartethyia 2.5.9 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (386) hide show
  1. package/.env.example +15 -42
  2. package/README.md +11 -10
  3. package/dist/dashboard/assets/{BannedPage-Brvuj_Eb.js → BannedPage-l6XMnfr9.js} +1 -1
  4. package/dist/dashboard/assets/BannedPage-l6XMnfr9.js.gz +0 -0
  5. package/dist/dashboard/assets/{CliToolDetailPage-CqfXtI3y.js → CliToolDetailPage-DwOzAW45.js} +1 -1
  6. package/dist/dashboard/assets/CliToolDetailPage-DwOzAW45.js.gz +0 -0
  7. package/dist/dashboard/assets/{CliToolsPage-GQeS91bg.js → CliToolsPage-BT3Up3QA.js} +1 -1
  8. package/dist/dashboard/assets/CliToolsPage-BT3Up3QA.js.gz +0 -0
  9. package/dist/dashboard/assets/{CombosPage-BDRsTXBB.js → CombosPage-6kYIUpzR.js} +1 -1
  10. package/dist/dashboard/assets/CombosPage-6kYIUpzR.js.gz +0 -0
  11. package/dist/dashboard/assets/{ConsoleLogPage-zP8AFHX0.js → ConsoleLogPage-zRnj1mlR.js} +1 -1
  12. package/dist/dashboard/assets/ConsoleLogPage-zRnj1mlR.js.gz +0 -0
  13. package/dist/dashboard/assets/{CustomizationPage-BmfrNZ14.js → CustomizationPage-C7m-H1Rz.js} +1 -1
  14. package/dist/dashboard/assets/CustomizationPage-C7m-H1Rz.js.gz +0 -0
  15. package/dist/dashboard/assets/HealthEventsModal-C8MR_BdB.js +1 -0
  16. package/dist/dashboard/assets/HealthEventsModal-C8MR_BdB.js.gz +0 -0
  17. package/dist/dashboard/assets/{LoginPage-DoreIgm8.js → LoginPage-CbphLvjg.js} +1 -1
  18. package/dist/dashboard/assets/LoginPage-CbphLvjg.js.gz +0 -0
  19. package/dist/dashboard/assets/{ModelPicker-C7pDb41R.js → ModelPicker-DVny4S5_.js} +1 -1
  20. package/dist/dashboard/assets/ModelPicker-DVny4S5_.js.gz +0 -0
  21. package/dist/dashboard/assets/OverviewPage-DABu2Wgt.js +1 -0
  22. package/dist/dashboard/assets/OverviewPage-DABu2Wgt.js.gz +0 -0
  23. package/dist/dashboard/assets/ProviderDetailPage-C15x9q13.js +3 -0
  24. package/dist/dashboard/assets/ProviderDetailPage-C15x9q13.js.gz +0 -0
  25. package/dist/dashboard/assets/{ProvidersPage-BnoPgA7w.js → ProvidersPage-Dfb2896L.js} +1 -1
  26. package/dist/dashboard/assets/ProvidersPage-Dfb2896L.js.gz +0 -0
  27. package/dist/dashboard/assets/{ProxyPage-Bq_TGgdb.js → ProxyPage-BaCIdAUt.js} +1 -1
  28. package/dist/dashboard/assets/ProxyPage-BaCIdAUt.js.gz +0 -0
  29. package/dist/dashboard/assets/QuotaPage-BsdoCIw1.js +1 -0
  30. package/dist/dashboard/assets/QuotaPage-BsdoCIw1.js.gz +0 -0
  31. package/dist/dashboard/assets/SettingsPage-KVJFh3Ip.js +1 -0
  32. package/dist/dashboard/assets/SettingsPage-KVJFh3Ip.js.gz +0 -0
  33. package/dist/dashboard/assets/{SetupPage-Day3mCOn.js → SetupPage-D4g6vOGc.js} +1 -1
  34. package/dist/dashboard/assets/SetupPage-D4g6vOGc.js.gz +0 -0
  35. package/dist/dashboard/assets/{SortableList-DQxllnB5.js → SortableList-C93i14BD.js} +1 -1
  36. package/dist/dashboard/assets/SortableList-C93i14BD.js.gz +0 -0
  37. package/dist/dashboard/assets/{StudioPage-uMExoWu1.js → StudioPage-SgQpymjm.js} +1 -1
  38. package/dist/dashboard/assets/{StudioPage-uMExoWu1.js.gz → StudioPage-SgQpymjm.js.gz} +0 -0
  39. package/dist/dashboard/assets/{UsagePage-DXa1oR-4.js → UsagePage-BFME-eba.js} +2 -2
  40. package/dist/dashboard/assets/UsagePage-BFME-eba.js.gz +0 -0
  41. package/dist/dashboard/assets/{api-keys-DQYLQxpW.js → api-keys-C23S9sgp.js} +1 -1
  42. package/dist/dashboard/assets/api-keys-C23S9sgp.js.gz +0 -0
  43. package/dist/dashboard/assets/{app-BIt446yE.js → app-2KhtHCv9.js} +1 -1
  44. package/dist/dashboard/assets/{app-BIt446yE.js.gz → app-2KhtHCv9.js.gz} +0 -0
  45. package/dist/dashboard/assets/app-CEeaMHOy.css +2 -0
  46. package/dist/dashboard/assets/app-CEeaMHOy.css.gz +0 -0
  47. package/dist/dashboard/assets/{assert-C9FD_JwJ.js → assert-DU6qrMA_.js} +1 -1
  48. package/dist/dashboard/assets/assert-DU6qrMA_.js.gz +0 -0
  49. package/dist/dashboard/assets/{badge-CR72dasT.js → badge-CKsF123d.js} +1 -1
  50. package/dist/dashboard/assets/badge-CKsF123d.js.gz +0 -0
  51. package/dist/dashboard/assets/{banner-CI9_eSfO.js → banner-8j7uChA9.js} +1 -1
  52. package/dist/dashboard/assets/banner-8j7uChA9.js.gz +0 -0
  53. package/dist/dashboard/assets/{card-DS7CQEsO.js → card-CdsSlWA3.js} +1 -1
  54. package/dist/dashboard/assets/card-CdsSlWA3.js.gz +0 -0
  55. package/dist/dashboard/assets/{cli-tools-CNqzrfdb.js → cli-tools-BaFUuFFF.js} +1 -1
  56. package/dist/dashboard/assets/cli-tools-BaFUuFFF.js.gz +0 -0
  57. package/dist/dashboard/assets/{clipboard-button-611pSsaX.js → clipboard-button-uL5aYLfW.js} +1 -1
  58. package/dist/dashboard/assets/clipboard-button-uL5aYLfW.js.gz +0 -0
  59. package/dist/dashboard/assets/{dialog-k37exjNt.js → dialog-C07hr5_G.js} +1 -1
  60. package/dist/dashboard/assets/dialog-C07hr5_G.js.gz +0 -0
  61. package/dist/dashboard/assets/{drawer-CX7N8ucR.js → drawer-BPO1TcKH.js} +1 -1
  62. package/dist/dashboard/assets/drawer-BPO1TcKH.js.gz +0 -0
  63. package/dist/dashboard/assets/{entry-CTP8AyiS.js → entry-Bz_CtDfC.js} +1 -1
  64. package/dist/dashboard/assets/entry-Bz_CtDfC.js.gz +0 -0
  65. package/dist/dashboard/assets/entry-CwPRKk0d.js +4 -0
  66. package/dist/dashboard/assets/entry-CwPRKk0d.js.gz +0 -0
  67. package/dist/dashboard/assets/entry-GJRbmrpA.js +1 -0
  68. package/dist/dashboard/assets/entry-GJRbmrpA.js.gz +0 -0
  69. package/dist/dashboard/assets/{github-badge-sltk1qUi.js → github-badge-DmQreSDd.js} +1 -1
  70. package/dist/dashboard/assets/github-badge-DmQreSDd.js.gz +0 -0
  71. package/dist/dashboard/assets/{index-z3zDOSMM.js → index-Bblu6erR.js} +2 -2
  72. package/dist/dashboard/assets/index-Bblu6erR.js.gz +0 -0
  73. package/dist/dashboard/assets/{inline-BhY2sSnO.js → inline-C9dCYaBZ.js} +1 -1
  74. package/dist/dashboard/assets/inline-C9dCYaBZ.js.gz +0 -0
  75. package/dist/dashboard/assets/{input-V1umFiBk.js → input-CjCnXweJ.js} +1 -1
  76. package/dist/dashboard/assets/input-CjCnXweJ.js.gz +0 -0
  77. package/dist/dashboard/assets/{layout-BBOYycyS.js → layout-V6y8DAkl.js} +1 -1
  78. package/dist/dashboard/assets/layout-V6y8DAkl.js.gz +0 -0
  79. package/dist/dashboard/assets/{list-row-1zzZYM0B.js → list-row-CM1AaG_y.js} +1 -1
  80. package/dist/dashboard/assets/list-row-CM1AaG_y.js.gz +0 -0
  81. package/dist/dashboard/assets/{live-BivGfuUs.js → live-ta6GMb-8.js} +1 -1
  82. package/dist/dashboard/assets/live-ta6GMb-8.js.gz +0 -0
  83. package/dist/dashboard/assets/{model-bans-CmffjLuG.js → model-bans-BmYTmbAk.js} +1 -1
  84. package/dist/dashboard/assets/model-bans-BmYTmbAk.js.gz +0 -0
  85. package/dist/dashboard/assets/{mutation-46P0oWMe.js → mutation-g_fduiNw.js} +1 -1
  86. package/dist/dashboard/assets/mutation-g_fduiNw.js.gz +0 -0
  87. package/dist/dashboard/assets/{numbers-DkfMR5Qs.js → numbers-BOevJzdz.js} +1 -1
  88. package/dist/dashboard/assets/numbers-BOevJzdz.js.gz +0 -0
  89. package/dist/dashboard/assets/{query-keys-BFhGpwR1.js → query-keys-UETqfytp.js} +1 -1
  90. package/dist/dashboard/assets/query-keys-UETqfytp.js.gz +0 -0
  91. package/dist/dashboard/assets/{routing-CAb4F37R.js → routing-BPUo-W8d.js} +1 -1
  92. package/dist/dashboard/assets/routing-BPUo-W8d.js.gz +0 -0
  93. package/dist/dashboard/assets/{select-C6MMiaio.js → select-C980c4cz.js} +1 -1
  94. package/dist/dashboard/assets/select-C980c4cz.js.gz +0 -0
  95. package/dist/dashboard/assets/{settings-DNX9sydi.js → settings--3hxSyry.js} +1 -1
  96. package/dist/dashboard/assets/settings--3hxSyry.js.gz +0 -0
  97. package/dist/dashboard/assets/{stack-BHTfXdz_.js → stack-_gfTdLVB.js} +1 -1
  98. package/dist/dashboard/assets/stack-_gfTdLVB.js.gz +0 -0
  99. package/dist/dashboard/assets/{state-mPDRlQkl.js → state-2c5V4zo7.js} +1 -1
  100. package/dist/dashboard/assets/state-2c5V4zo7.js.gz +0 -0
  101. package/dist/dashboard/assets/{switch-DOmJxg7H.js → switch-Dkke7Naf.js} +1 -1
  102. package/dist/dashboard/assets/switch-Dkke7Naf.js.gz +0 -0
  103. package/dist/dashboard/assets/{useMutation-Dem0lXQj.js → useMutation-EDFRkn1i.js} +1 -1
  104. package/dist/dashboard/assets/useMutation-EDFRkn1i.js.gz +0 -0
  105. package/dist/dashboard/index.html +1 -1
  106. package/dist/dashboard/index.html.gz +0 -0
  107. package/dist/dashboard/precompressed-assets.json +51 -51
  108. package/migrations/README.md +52 -52
  109. package/migrations/full-postgres/0020_add_telemetry_event_analytics.sql +77 -0
  110. package/migrations/full-postgres/0021_add_api_key_concurrency_tolerance.sql +13 -0
  111. package/migrations/full-postgres/0022_add_inferhub_config_key.sql +17 -0
  112. package/migrations/full-postgres/0023_drop_api_key_concurrency_tolerance.sql +13 -0
  113. package/migrations/lite-sqlite3/0020_add_telemetry_event_analytics.sql +69 -0
  114. package/migrations/lite-sqlite3/0021_add_api_key_concurrency_tolerance.sql +13 -0
  115. package/migrations/lite-sqlite3/0022_add_inferhub_config_key.sql +17 -0
  116. package/migrations/lite-sqlite3/0023_drop_api_key_concurrency_tolerance.sql +13 -0
  117. package/package.json +96 -97
  118. package/scripts/cli/admin.ts +126 -125
  119. package/scripts/cli/autostart.ts +237 -237
  120. package/scripts/cli/background.ts +120 -110
  121. package/scripts/cli/bin/carte.cjs +8 -8
  122. package/scripts/cli/bin/cartethyia.cjs +167 -167
  123. package/scripts/cli/console-menu.ts +308 -275
  124. package/scripts/cli/controller.ts +145 -0
  125. package/scripts/cli/doctor.ts +1 -1
  126. package/scripts/cli/env.ts +99 -99
  127. package/scripts/cli/gateway.ts +264 -261
  128. package/scripts/{health.ts → cli/health.ts} +4 -4
  129. package/scripts/cli/instance.ts +234 -224
  130. package/scripts/cli/main.ts +188 -164
  131. package/scripts/cli/platform.ts +64 -64
  132. package/scripts/cli/prompt.ts +275 -107
  133. package/scripts/cli/services.ts +88 -88
  134. package/scripts/cli/setup.ts +445 -445
  135. package/scripts/cli/start.ts +85 -82
  136. package/scripts/cli/startup-signal.ts +23 -23
  137. package/scripts/cli/telemetry.ts +70 -0
  138. package/scripts/cli/tray/index.ts +263 -263
  139. package/scripts/cli/tray/windows.ps1 +107 -107
  140. package/scripts/cli/tray.ts +192 -208
  141. package/scripts/cli/update.ts +39 -39
  142. package/scripts/cli/version.ts +67 -67
  143. package/scripts/cli/wordmark.ts +58 -58
  144. package/src/boot/app.ts +16 -1
  145. package/src/boot/dependencies.ts +128 -25
  146. package/src/config/package-paths.ts +24 -0
  147. package/src/config/resources.ts +137 -0
  148. package/src/config/runtime.ts +133 -76
  149. package/src/config/spec.ts +30 -29
  150. package/src/config/telemetry.ts +0 -25
  151. package/src/console/api-keys/bucket-spend.ts +14 -17
  152. package/src/console/api-keys/contracts.ts +410 -410
  153. package/src/console/api-keys/routes.ts +12 -0
  154. package/src/console/audit/store.ts +2 -3
  155. package/src/console/auth/setup-service.ts +8 -1
  156. package/src/console/backup/routes.ts +7 -0
  157. package/src/console/backup/service.ts +463 -463
  158. package/src/console/backup/store.ts +16 -11
  159. package/src/console/backup/validate.ts +1 -4
  160. package/src/console/cli-tools/fs-ops.ts +18 -2
  161. package/src/console/data-management/contracts.ts +1 -8
  162. package/src/console/data-management/operations.ts +61 -48
  163. package/src/console/data-management/routes.ts +4 -2
  164. package/src/console/domain-registration.ts +25 -3
  165. package/src/console/inferhub/client.ts +139 -0
  166. package/src/console/inferhub/key-store.ts +129 -0
  167. package/src/console/inferhub/normalize.ts +347 -0
  168. package/src/console/inferhub/routes.ts +411 -0
  169. package/src/console/inferhub/store.ts +109 -0
  170. package/src/console/inferhub/types.ts +183 -0
  171. package/src/console/observability/contracts.ts +2 -41
  172. package/src/console/observability/store.ts +176 -371
  173. package/src/console/providers/catalog/public-model-store.ts +0 -0
  174. package/src/console/providers/catalog/store.ts +23 -36
  175. package/src/console/quota/account-quota-shared.ts +52 -52
  176. package/src/console/quota/account-quota-tenant.ts +16 -24
  177. package/src/console/quota/refresh.ts +441 -441
  178. package/src/console/remote-support/service.ts +270 -114
  179. package/src/console/routing/pools/import-parse.ts +206 -206
  180. package/src/console/routing/pools/operations.ts +543 -543
  181. package/src/console/routing/pools/probe-verdict.ts +132 -132
  182. package/src/console/routing/pools/routes.ts +181 -181
  183. package/src/console/routing/pools/store.ts +1 -1
  184. package/src/console/settings/contracts.ts +42 -40
  185. package/src/console/settings/store.ts +25 -25
  186. package/src/console/share/share-stats.ts +22 -4
  187. package/src/console/share/share-usage.ts +30 -4
  188. package/src/console/shared/cursor.ts +15 -0
  189. package/src/console/updates/repository-updates.ts +40 -39
  190. package/src/console/updates/routes.ts +12 -0
  191. package/src/main.ts +13 -5
  192. package/src/network/pool/resolver.ts +1104 -1104
  193. package/src/observability/client-name.ts +22 -0
  194. package/src/observability/event-log.ts +5 -29
  195. package/src/observability/event-query.ts +690 -0
  196. package/src/observability/log-ring.ts +26 -2
  197. package/src/observability/log-sanitize.ts +118 -0
  198. package/src/observability/logger.ts +17 -13
  199. package/src/observability/metrics.ts +35 -0
  200. package/src/observability/payload-capture.ts +114 -41
  201. package/src/observability/payload-store.ts +249 -24
  202. package/src/observability/raw-event-writer.ts +118 -0
  203. package/src/observability/runtime-metrics.ts +71 -1
  204. package/src/observability/telemetry-buffer.ts +100 -17
  205. package/src/observability/telemetry-reconciliation.ts +417 -0
  206. package/src/persistence/boot.ts +20 -9
  207. package/src/persistence/db-pg.ts +13 -0
  208. package/src/persistence/db-sqlite.ts +569 -497
  209. package/src/persistence/dialect.ts +3 -2
  210. package/src/persistence/migrate.ts +181 -181
  211. package/src/persistence/schema.ts +1496 -1406
  212. package/src/persistence/shared-cache.ts +5 -1
  213. package/src/persistence/stores/api-key-store.ts +581 -581
  214. package/src/persistence/stores/telemetry-store.ts +124 -63
  215. package/src/protocol/reasoning-text.ts +30 -0
  216. package/src/protocol/registry.ts +2 -0
  217. package/src/protocol/response/chat.ts +33 -7
  218. package/src/protocol/response/codex.ts +14 -2
  219. package/src/protocol/response/messages.ts +5 -2
  220. package/src/providers/authentication/oauth-flow-store.ts +3 -10
  221. package/src/providers/bundled-discovery-providers.ts +122 -122
  222. package/src/providers/default-registry.ts +14 -0
  223. package/src/providers/discovery/catalog/catalog-blob.ts +18 -18
  224. package/src/providers/discovery/models-dev-catalog.ts +354 -354
  225. package/src/providers/discovery/probe-phases.ts +43 -7
  226. package/src/providers/discovery/probing-service.ts +70 -32
  227. package/src/providers/integrations/antigravity/antigravity.ts +9 -2
  228. package/src/providers/integrations/buddy/buddy-catalog-shared.ts +85 -17
  229. package/src/providers/integrations/buddy/buddy-chat-shared.ts +934 -934
  230. package/src/providers/integrations/buddy/buddy-checkin.ts +5 -9
  231. package/src/providers/integrations/buddy/buddy-discovery-shared.ts +3 -7
  232. package/src/providers/integrations/buddy/buddy-quota-shared.ts +3 -1
  233. package/src/providers/integrations/buddy/capabilities.ts +4 -0
  234. package/src/providers/integrations/buddy/codebuddy/cn-provider.ts +57 -49
  235. package/src/providers/integrations/buddy/codebuddy/provider.ts +180 -180
  236. package/src/providers/integrations/buddy/workbuddy/provider.ts +206 -206
  237. package/src/providers/integrations/buddy/workbuddy/quota.ts +161 -161
  238. package/src/providers/integrations/claude/claude-quota.ts +2 -2
  239. package/src/providers/integrations/claude/claude-user-profiles.ts +3 -2
  240. package/src/providers/integrations/claude/claude.ts +3 -4
  241. package/src/providers/integrations/cline/cline.ts +94 -8
  242. package/src/providers/integrations/codex/codex.ts +61 -37
  243. package/src/providers/integrations/cursor/cursor-catalog.ts +368 -368
  244. package/src/providers/integrations/cursor/cursor-http2.ts +300 -300
  245. package/src/providers/integrations/cursor/cursor-identity.ts +2 -4
  246. package/src/providers/integrations/cursor/cursor-request.ts +11 -0
  247. package/src/providers/integrations/cursor/cursor.ts +29 -17
  248. package/src/providers/integrations/cursor/protocol/framing.ts +129 -129
  249. package/src/providers/integrations/cursor/protocol/messages.ts +2380 -2380
  250. package/src/providers/integrations/cursor/protocol/struct.ts +305 -305
  251. package/src/providers/integrations/cursor/protocol/tool-canonical.ts +275 -0
  252. package/src/providers/integrations/github/github.ts +3 -1
  253. package/src/providers/integrations/grok/grok-quota.ts +279 -279
  254. package/src/providers/integrations/grok/grok-ratelimit-store.ts +73 -73
  255. package/src/providers/integrations/grok/grok-ratelimit.ts +218 -218
  256. package/src/providers/integrations/hermes.ts +7 -1
  257. package/src/providers/integrations/inferhub.ts +201 -73
  258. package/src/providers/integrations/kilo/kilo.ts +152 -152
  259. package/src/providers/integrations/kiro/kiro-machine-id.ts +2 -4
  260. package/src/providers/integrations/opencode/provider.ts +2 -0
  261. package/src/providers/integrations/openrouter/provider.ts +129 -129
  262. package/src/providers/integrations/qoder/qoder-quota.ts +193 -192
  263. package/src/providers/integrations/qoder/qoder-realm.ts +106 -106
  264. package/src/providers/integrations/trae/trae-headers.ts +17 -48
  265. package/src/providers/integrations/trae/trae-oauth.ts +4 -26
  266. package/src/providers/integrations/trae/trae-quota.ts +389 -384
  267. package/src/providers/integrations/trae/trae-realm.ts +15 -2
  268. package/src/providers/integrations/trae/trae.ts +22 -24
  269. package/src/providers/integrations/xiaomi-mimo/think-stream.ts +100 -24
  270. package/src/providers/integrations/zcode/oauth.ts +1 -1
  271. package/src/providers/operations/account-health-service.ts +605 -279
  272. package/src/providers/provider-metadata.ts +12 -1
  273. package/src/providers/provider-model-definition.ts +373 -373
  274. package/src/providers/provider-probe.ts +3 -0
  275. package/src/providers/quota/quota-contracts.ts +3 -7
  276. package/src/providers/search/search-provider.ts +2 -6
  277. package/src/security/admission/contracts.ts +10 -0
  278. package/src/security/admission/in-memory-store.ts +89 -14
  279. package/src/security/admission/lua.ts +191 -182
  280. package/src/security/admission/redis-store.ts +30 -0
  281. package/src/security/admission/service.ts +18 -0
  282. package/src/security/api-key-auth-cache.ts +96 -0
  283. package/src/security/api-key-auth.ts +11 -100
  284. package/src/security/client-router-fingerprint.ts +3 -7
  285. package/src/security/ip-boundary.ts +7 -3
  286. package/src/shared/coerce.ts +67 -0
  287. package/src/shared/hash.ts +6 -0
  288. package/src/shared/time.ts +7 -0
  289. package/src/transport/dispatch/attempt-finalize.ts +26 -138
  290. package/src/transport/dispatch/attempt-loop.ts +103 -81
  291. package/src/transport/dispatch/capture-policy.ts +78 -0
  292. package/src/transport/dispatch/proxy-request.ts +4 -2
  293. package/src/transport/dispatch/streaming/encoder.ts +111 -5
  294. package/src/transport/dispatch/streaming/stream.ts +19 -2
  295. package/src/transport/dispatch/streaming/thinking-loop.ts +300 -0
  296. package/src/transport/failure-policy.ts +27 -0
  297. package/src/transport/guards/abuse-guard.ts +2 -2
  298. package/src/transport/guards/auth-guard.ts +17 -0
  299. package/src/transport/guards/body-policy.ts +3 -2
  300. package/src/transport/guards/concurrency-guard.ts +89 -13
  301. package/src/transport/guards/early-rejection-capture.ts +43 -3
  302. package/src/transport/guards/error-lifecycle.ts +10 -2
  303. package/src/transport/guards/guard-errors.ts +23 -0
  304. package/src/transport/guards/headroom-guard.ts +41 -7
  305. package/src/transport/guards/pipeline.ts +24 -0
  306. package/src/transport/guards/request-context.ts +2 -1
  307. package/src/transport/routing/admission.ts +51 -9
  308. package/src/transport/routing/bounded-lru.ts +49 -0
  309. package/src/transport/routing/candidate-index.ts +88 -0
  310. package/src/transport/routing/reservations.ts +121 -7
  311. package/src/transport/routing/round-robin.ts +10 -22
  312. package/src/transport/routing/route-catalog.ts +26 -13
  313. package/src/transport/routing/route-model.ts +22 -2
  314. package/src/transport/routing/router.ts +53 -31
  315. package/src/transport/surface/chat/encode.ts +2 -3
  316. package/src/transport/surface/chat/parse.ts +2 -1
  317. package/src/transport/surface/dialects.ts +11 -3
  318. package/src/transport/surface/messages/encode.ts +2 -1
  319. package/src/transport/surface/messages/parse.ts +3 -1
  320. package/src/transport/surface/messages/stream.ts +2 -6
  321. package/src/workers/maintenance-lease.ts +200 -0
  322. package/src/workers/scheduler.ts +101 -1
  323. package/dist/dashboard/assets/BannedPage-Brvuj_Eb.js.gz +0 -0
  324. package/dist/dashboard/assets/CliToolDetailPage-CqfXtI3y.js.gz +0 -0
  325. package/dist/dashboard/assets/CliToolsPage-GQeS91bg.js.gz +0 -0
  326. package/dist/dashboard/assets/CombosPage-BDRsTXBB.js.gz +0 -0
  327. package/dist/dashboard/assets/ConsoleLogPage-zP8AFHX0.js.gz +0 -0
  328. package/dist/dashboard/assets/CustomizationPage-BmfrNZ14.js.gz +0 -0
  329. package/dist/dashboard/assets/HealthEventsModal-Dn3M6WZc.js +0 -1
  330. package/dist/dashboard/assets/HealthEventsModal-Dn3M6WZc.js.gz +0 -0
  331. package/dist/dashboard/assets/LoginPage-DoreIgm8.js.gz +0 -0
  332. package/dist/dashboard/assets/ModelPicker-C7pDb41R.js.gz +0 -0
  333. package/dist/dashboard/assets/OverviewPage-CvvD1Ugk.js +0 -1
  334. package/dist/dashboard/assets/OverviewPage-CvvD1Ugk.js.gz +0 -0
  335. package/dist/dashboard/assets/ProviderDetailPage-Clbn1gsW.js +0 -3
  336. package/dist/dashboard/assets/ProviderDetailPage-Clbn1gsW.js.gz +0 -0
  337. package/dist/dashboard/assets/ProvidersPage-BnoPgA7w.js.gz +0 -0
  338. package/dist/dashboard/assets/ProxyPage-Bq_TGgdb.js.gz +0 -0
  339. package/dist/dashboard/assets/QuotaPage-D9DHXvom.js +0 -1
  340. package/dist/dashboard/assets/QuotaPage-D9DHXvom.js.gz +0 -0
  341. package/dist/dashboard/assets/SettingsPage-7xV8WkWL.js +0 -1
  342. package/dist/dashboard/assets/SettingsPage-7xV8WkWL.js.gz +0 -0
  343. package/dist/dashboard/assets/SetupPage-Day3mCOn.js.gz +0 -0
  344. package/dist/dashboard/assets/SortableList-DQxllnB5.js.gz +0 -0
  345. package/dist/dashboard/assets/UsagePage-DXa1oR-4.js.gz +0 -0
  346. package/dist/dashboard/assets/api-keys-DQYLQxpW.js.gz +0 -0
  347. package/dist/dashboard/assets/app-CX_Z8cMs.css +0 -2
  348. package/dist/dashboard/assets/app-CX_Z8cMs.css.gz +0 -0
  349. package/dist/dashboard/assets/assert-C9FD_JwJ.js.gz +0 -0
  350. package/dist/dashboard/assets/badge-CR72dasT.js.gz +0 -0
  351. package/dist/dashboard/assets/banner-CI9_eSfO.js.gz +0 -0
  352. package/dist/dashboard/assets/card-DS7CQEsO.js.gz +0 -0
  353. package/dist/dashboard/assets/cli-tools-CNqzrfdb.js.gz +0 -0
  354. package/dist/dashboard/assets/clipboard-button-611pSsaX.js.gz +0 -0
  355. package/dist/dashboard/assets/dialog-k37exjNt.js.gz +0 -0
  356. package/dist/dashboard/assets/drawer-CX7N8ucR.js.gz +0 -0
  357. package/dist/dashboard/assets/entry-B9Xvtnfj.js +0 -1
  358. package/dist/dashboard/assets/entry-B9Xvtnfj.js.gz +0 -0
  359. package/dist/dashboard/assets/entry-ByMGkR3C.js +0 -4
  360. package/dist/dashboard/assets/entry-ByMGkR3C.js.gz +0 -0
  361. package/dist/dashboard/assets/entry-CTP8AyiS.js.gz +0 -0
  362. package/dist/dashboard/assets/github-badge-sltk1qUi.js.gz +0 -0
  363. package/dist/dashboard/assets/index-z3zDOSMM.js.gz +0 -0
  364. package/dist/dashboard/assets/inline-BhY2sSnO.js.gz +0 -0
  365. package/dist/dashboard/assets/input-V1umFiBk.js.gz +0 -0
  366. package/dist/dashboard/assets/layout-BBOYycyS.js.gz +0 -0
  367. package/dist/dashboard/assets/list-row-1zzZYM0B.js.gz +0 -0
  368. package/dist/dashboard/assets/live-BivGfuUs.js.gz +0 -0
  369. package/dist/dashboard/assets/model-bans-CmffjLuG.js.gz +0 -0
  370. package/dist/dashboard/assets/mutation-46P0oWMe.js.gz +0 -0
  371. package/dist/dashboard/assets/numbers-DkfMR5Qs.js.gz +0 -0
  372. package/dist/dashboard/assets/query-keys-BFhGpwR1.js.gz +0 -0
  373. package/dist/dashboard/assets/routing-CAb4F37R.js.gz +0 -0
  374. package/dist/dashboard/assets/select-C6MMiaio.js.gz +0 -0
  375. package/dist/dashboard/assets/settings-DNX9sydi.js.gz +0 -0
  376. package/dist/dashboard/assets/stack-BHTfXdz_.js.gz +0 -0
  377. package/dist/dashboard/assets/state-mPDRlQkl.js.gz +0 -0
  378. package/dist/dashboard/assets/switch-DOmJxg7H.js.gz +0 -0
  379. package/dist/dashboard/assets/useMutation-Dem0lXQj.js.gz +0 -0
  380. package/scripts/build/aot.ts +0 -143
  381. package/scripts/build/build.ts +0 -24
  382. package/scripts/build/compile.ts +0 -88
  383. package/scripts/build/restart.ts +0 -120
  384. package/scripts/build/start.ts +0 -25
  385. package/src/observability/event-compaction.ts +0 -317
  386. package/src/observability/event-day-index.ts +0 -440
@@ -1 +1 @@
1
- import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CXUMngI_.js";import{s as i}from"./app-BIt446yE.js";import{n as a,t as o}from"./brain-Cwed_72z.js";import{C as s,D as c,S as l,T as u,a as d,b as ee,c as f,d as p,f as m,g as h,p as te,s as g,u as ne,w as _,y as re}from"./numbers-DkfMR5Qs.js";import{t as v}from"./chevron-right-BXIy5l3h.js";import{t as y}from"./circle-check-BU3v_mFW.js";import{t as ie}from"./eye-C_hawfH4.js";import{n as ae,t as oe}from"./github-badge-sltk1qUi.js";import{n as se,r as ce,t as le}from"./state-mPDRlQkl.js";import{t as ue}from"./key-round-UkavsGxp.js";import{n as de,r as fe,t as b}from"./clipboard-button-611pSsaX.js";import{t as x}from"./scaling-nWE4Cx8f.js";import{t as S}from"./wrench-B6E1oEuY.js";import{n as C,t as w}from"./card-DS7CQEsO.js";import{n as pe,t as me}from"./download-dRFo5_Wu.js";import{a as T,l as E,m as D,o as O,s as k}from"./tokens-COzario9.js";import{t as A}from"./stream-retry-5QnVuSSo.js";var j=e(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),M=t(n(),1),N=i();function P(e){if(e===`link_expired_or_used`)return`This enrollment link has expired or has already been used.`;if(e===`key_unavailable`)return`The shared access template is no longer available.`;if(e===`link_not_found`)return`This enrollment link is unavailable.`;if(e===`link_disabled`)return`This share link's API key is paused. Ask whoever shared this link to re-enable it.`;if(e===`link_expired`)return`This share link has expired.`;if(e===`link_revoked`)return`This share link's API key has been revoked, so the link can no longer be used. Ask whoever shared this link for a new one — a revoked key cannot be re-enabled.`}function F(e,t){let n=e.error;return P(typeof n==`string`?n:n?.code)??(typeof n==`string`?n:n?.message)??e.message??t}function I(e){let t=e.error;return(typeof t==`string`?t:t?.code)??null}function he(e,t){let n=t?.streamEvent,[r,i]=(0,M.useState)({data:null,error:null,code:null,loading:!0});return(0,M.useEffect)(()=>{let t=!0,r=new AbortController,a,o,s=e=>{i({data:e,error:null,code:null,loading:!1})};if(n===void 0)return fetch(e,{signal:r.signal,credentials:`same-origin`,cache:`no-store`,referrerPolicy:`no-referrer`}).then(async e=>{let n=await e.json();if(t){if(!e.ok){i({data:null,error:F(n,`This enrollment link is unavailable.`),code:I(n),loading:!1});return}s(n)}}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||t&&i({data:null,error:`Unable to reach the Cartethyia gateway.`,code:null,loading:!1})}),()=>{t=!1,r.abort()};let c=!1,l=()=>{if(!t)return;let r=new EventSource(e);a=r,r.addEventListener(n,e=>{if(t)try{s(JSON.parse(e.data))}catch{}}),r.addEventListener(`error`,()=>{r.close(),t&&(c||(c=!0,i(e=>e.data===null?{...e,loading:!1}:e)),o=setTimeout(l,A))})};return l(),()=>{t=!1,a?.close(),clearTimeout(o)}},[e,n]),r}var L=r(),R=`max-h-168 w-full min-w-0 overflow-x-auto overflow-y-auto touch-pan-x touch-pan-y [&_thead_th]:sticky [&_thead_th]:top-0 [&_thead_th]:z-card [&_thead_th]:bg-surface-2`,z=`w-full border-collapse text-caption [&_th]:border-b [&_th]:border-inner-border [&_th]:px-5 [&_th]:py-3 [&_th]:text-left [&_th]:font-mono [&_th]:text-micro [&_th]:font-bold [&_th]:uppercase [&_th]:tracking-label [&_th]:text-text-tertiary [&_td]:border-b [&_td]:border-surface-muted [&_td]:px-5 [&_td]:py-4 [&_td]:text-text-secondary [&_tr:last-child_td]:border-b-0 [&_code]:overflow-hidden [&_code]:text-ellipsis [&_code]:whitespace-nowrap`,B=(0,M.createContext)({data:null,loading:!0,unit:T,cycleUnit:()=>void 0}),V=`cartethyia:share-token-unit`;function H(){try{let e=window.localStorage.getItem(V);if(e===null)return T;if(e===`auto`)return-1;let t=Number(e);return Number.isInteger(t)&&t>=0&&t<=T?t:T}catch{return T}}function U(e){return e===-1?0:e>=T?-1:e+1}function W(e){return e===-1?`auto`:e>=T?`raw`:O[e]?.suffix??`auto`}function ge({path:e,children:t}){let n=he(e,{streamEvent:`stats`}),[r,i]=(0,M.useState)(()=>typeof window>`u`?T:H()),a=(0,M.useCallback)(()=>{i(e=>{let t=U(e);try{window.localStorage.setItem(V,t===-1?`auto`:String(t))}catch{}return t})},[]);return(0,L.jsx)(B.Provider,{value:{data:n.data,loading:n.loading,unit:r,cycleUnit:a},children:t})}function G(){let{unit:e,cycleUnit:t}=(0,M.useContext)(B),n=W(e),r=W(U(e));return(0,L.jsxs)(`button`,{type:`button`,className:`ml-auto inline-flex min-h-6 items-center gap-1 rounded-chip border border-inner-border bg-surface-2 px-2 text-text-secondary font-mono text-micro font-bold uppercase tracking-[0.04em] cursor-pointer hover:border-accent hover:text-text-primary`,"aria-label":`Token unit: currently ${n}, switch to ${r}`,title:`Show ${r}`,onClick:t,children:[(0,L.jsx)(x,{size:11,"aria-hidden":`true`}),n]})}function _e({policy:e}){let{data:t}=(0,M.useContext)(B);return(0,L.jsx)(Z,{policy:e,stats:t})}function ve(){let{data:e,loading:t}=(0,M.useContext)(B);return(0,L.jsx)(Se,{stats:e,loading:t})}function K(){let{unit:e}=(0,M.useContext)(B);return(0,M.useCallback)(t=>D(t,e),[e])}function q(e){return Number.isFinite(e)?Math.max(0,Math.round(e)).toLocaleString():`—`}function ye(e){return e===null||!Number.isFinite(e)||e<=0?`—`:`${Number(e.toFixed(1))} t/s`}function J(e){return e===null||!Number.isFinite(e)||e<=0?`—`:e>=1e3?`${Number((e/1e3).toFixed(1))}s`:`${Math.round(e)}ms`}function Y(e){if(!e)return`—`;let t=new Date(e).getTime();if(!Number.isFinite(t))return`—`;let n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.round(n/60);if(r<60)return`${r} min ago`;let i=Math.round(r/60);return i<24?`${i} h ago`:new Date(e).toLocaleDateString()}function X(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:00`}function Z({policy:e,stats:t}){let n=K(),r=[{label:`Lifetime`,used:t?.totals?.totalTokens??0,limit:e.oneTimeLimit},{label:`Daily`,used:t?.totals?.todayTokens??0,limit:e.dailyLimit},{label:`Monthly`,used:t?.totals?.monthTokens??0,limit:e.monthlyLimit}],i=t?.recipients;return(0,L.jsxs)(`div`,{className:`mt-5 flex flex-col gap-6 border-t border-inner-border pt-9`,children:[r.map(e=>{let t=e.limit!==null&&e.limit>0,r=t?Math.min(1,e.used/e.limit):1;return(0,L.jsxs)(`div`,{className:`flex items-center gap-6 max-sm:flex-col max-sm:items-stretch max-sm:gap-3`,children:[(0,L.jsx)(`span`,{className:`w-39 shrink-0 text-text-secondary font-mono text-micro uppercase tracking-label max-sm:w-auto`,children:e.label}),(0,L.jsx)(`div`,{className:`relative h-4 flex-1 overflow-hidden rounded-tiny bg-teal max-sm:flex-none`,title:t?`${n(e.used)} of ${n(e.limit)} used`:`${n(e.used)} used (no limit set)`,children:t?(0,L.jsx)(`div`,{className:`h-full rounded-tiny bg-red transition-[width] duration-200`,style:{width:`${Math.round(r*100)}%`}}):null}),(0,L.jsxs)(`span`,{className:`whitespace-nowrap text-text-secondary font-mono text-micro [&>strong]:text-text-primary [&>strong]:font-semibold max-sm:self-start`,children:[(0,L.jsx)(`strong`,{children:n(e.used)}),t?` / ${n(e.limit)}`:` used`]})]},e.label)}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(`span`,{className:`inline-flex min-h-14 items-center gap-3.5 rounded-pill border border-inner-border bg-surface-2 px-5 py-2.5 text-text-secondary font-mono text-badge leading-[1.3]`,children:[`RPM `,e.requestsPerMinute??`unlimited`]}),(0,L.jsxs)(`span`,{className:`inline-flex min-h-14 items-center gap-3.5 rounded-pill border border-inner-border bg-surface-2 px-5 py-2.5 text-text-secondary font-mono text-badge leading-[1.3]`,children:[`Concurrent `,e.maxConcurrentRequests??`unlimited`]}),i?(0,L.jsxs)(`span`,{className:`inline-flex min-h-14 items-center gap-3.5 rounded-pill border border-inner-border bg-surface-2 px-5 py-2.5 text-text-secondary font-mono text-badge leading-[1.3]`,children:[i.active,` / `,i.total,` recipients active`]}):null,(0,L.jsx)(G,{})]})]})}function be({hourly:e}){let t=K(),n=Math.max(1,...e.map(e=>e.requests)),r=e.length*10,[i,a]=(0,M.useState)(null),o=(t,n)=>{let r=t.getBoundingClientRect();if(r.width===0||e.length===0)return null;let i=Math.floor((n-r.left)/r.width*e.length);return i>=0&&i<e.length?i:null},s=i===null?void 0:e[i];return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`mb-2 flex min-h-9 items-baseline gap-4 text-text-tertiary font-mono text-badge [&>strong]:text-text-primary [&>strong]:font-head [&>strong]:text-body-lg [&>strong]:font-semibold`,"aria-live":`polite`,children:s?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`strong`,{children:t(s.tokens)}),(0,L.jsxs)(`span`,{children:[X(s.hour),` · `,q(s.requests),` req`]})]}):(0,L.jsx)(`span`,{children:`drag a bar`})}),(0,L.jsx)(`div`,{className:`cursor-crosshair touch-none`,onPointerEnter:e=>a(o(e.currentTarget,e.clientX)),onPointerMove:e=>a(o(e.currentTarget,e.clientX)),onPointerLeave:()=>a(null),children:(0,L.jsx)(`svg`,{className:`h-22 w-full`,viewBox:`0 0 ${r} 44`,preserveAspectRatio:`none`,role:`img`,"aria-label":`Requests per hour over the last 24 hours`,children:e.map((e,r)=>{let a=Math.round(e.requests/n*40);return(0,L.jsx)(`rect`,{className:`${e.requests===0?`fill-track`:`fill-teal`}${r===i?` fill-text-primary`:``}`,x:r*10+1,y:44-Math.max(2,a),width:7,height:Math.max(2,a),rx:1.5,children:(0,L.jsx)(`title`,{children:`${t(e.tokens)} tokens · ${q(e.requests)} requests`})},e.hour)})})}),(0,L.jsxs)(`div`,{className:`mt-1.5 flex justify-between text-text-tertiary font-mono text-micro`,children:[(0,L.jsx)(`span`,{children:e.length?X(e[0].hour):``}),(0,L.jsx)(`span`,{children:`last 24h`}),(0,L.jsx)(`span`,{children:e.length?X(e[e.length-1].hour):``})]})]})}function xe({value:e,max:t,label:n}){let r=t>0?Math.min(1,e/t):0;return(0,L.jsxs)(`div`,{className:`flex min-w-55 items-center gap-4 max-sm:min-w-32`,children:[(0,L.jsx)(`div`,{className:`h-3 min-w-0 flex-1 overflow-hidden rounded-tiny bg-surface-muted`,children:(0,L.jsx)(`div`,{className:`h-full rounded-tiny bg-teal`,style:{width:`${Math.round(r*100)}%`}})}),(0,L.jsx)(`span`,{className:`min-w-8 text-right font-mono text-micro text-text-secondary`,children:n})]})}function Se({stats:e,loading:t}){let[n,r]=(0,M.useState)(!1),i=K(),a=e?.totals,o=e?.models??[],c=e?.clientIps??[],l=Math.max(1,...o.map(e=>e.tokens)),u=Math.max(1,...c.map(e=>e.requests));return(0,L.jsxs)(w,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg p-5 backdrop-blur-md backdrop-saturate-150`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`group flex w-full cursor-pointer items-center gap-3 bg-transparent p-0 text-left`,"aria-expanded":n,onClick:()=>r(e=>!e),children:[(0,L.jsx)(v,{size:14,className:`shrink-0 text-text-secondary transition-transform duration-200${n?` rotate-90`:``}`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`text-text-secondary font-mono text-badge font-bold tracking-label transition-colors duration-150 group-hover:text-text-primary`,children:`STATS & ACTIVITY`}),(0,L.jsxs)(`span`,{className:`ml-auto flex flex-wrap items-center gap-2 text-text-tertiary font-mono text-micro max-medium:hidden`,children:[(0,L.jsxs)(`span`,{children:[c.length,` IPs`]}),(0,L.jsx)(`span`,{children:`·`}),(0,L.jsxs)(`span`,{children:[o.length,` models`]}),(0,L.jsx)(`span`,{children:`·`}),(0,L.jsxs)(`span`,{children:[q(a?.requests??0),` req`]})]})]}),n?(0,L.jsx)(`div`,{className:`mt-5 flex flex-col gap-5`,children:t&&!e?(0,L.jsx)(`p`,{className:`py-9 text-center text-text-tertiary text-caption`,children:`Loading activity…`}):e?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-4 gap-5 max-wide:grid-cols-2 max-narrow:grid-cols-1`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-panel border border-inner-border bg-surface-2 px-7 py-6`,children:[(0,L.jsx)(`span`,{className:`text-text-tertiary font-mono text-micro uppercase tracking-label`,children:`Requests`}),(0,L.jsx)(`span`,{className:`font-head text-display font-semibold tracking-tight`,children:q(a?.requests??0)}),(0,L.jsxs)(`span`,{className:`text-text-secondary text-micro`,children:[q(a?.errors??0),` errors`]})]}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-panel border border-inner-border bg-surface-2 px-7 py-6`,children:[(0,L.jsx)(`span`,{className:`text-text-tertiary font-mono text-micro uppercase tracking-label`,children:`Tokens`}),(0,L.jsx)(`span`,{className:`font-head text-display font-semibold tracking-tight`,children:i(a?.totalTokens??0)}),(0,L.jsx)(`span`,{className:`text-text-secondary text-micro`,children:`all time`})]}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-panel border border-inner-border bg-surface-2 px-7 py-6`,children:[(0,L.jsx)(`span`,{className:`text-text-tertiary font-mono text-micro uppercase tracking-label`,children:`Last hour`}),(0,L.jsx)(`span`,{className:`font-head text-display font-semibold tracking-tight`,children:q(a?.lastHourRequests??0)}),(0,L.jsx)(`span`,{className:`text-text-secondary text-micro`,children:`requests in 60 min`})]}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-panel border border-inner-border bg-surface-2 px-7 py-6`,children:[(0,L.jsx)(`span`,{className:`text-text-tertiary font-mono text-micro uppercase tracking-label`,children:`Models`}),(0,L.jsx)(`span`,{className:`font-head text-display font-semibold tracking-tight`,children:o.length}),(0,L.jsx)(`span`,{className:`text-text-secondary text-micro`,children:`in use`})]})]}),(0,L.jsx)(be,{hourly:e.hourly}),(0,L.jsxs)(`section`,{"aria-label":`Top models`,children:[(0,L.jsx)(`div`,{className:`flex items-center justify-between gap-6`,children:(0,L.jsxs)(`h3`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-badge font-bold tracking-label transition-colors duration-150`,children:[(0,L.jsx)(j,{size:13,"aria-hidden":`true`}),` TOP MODELS`]})}),o.length===0?(0,L.jsx)(`p`,{className:`py-9 text-center text-text-tertiary text-caption`,children:`No model traffic yet.`}):(0,L.jsx)(`div`,{className:R,children:(0,L.jsxs)(`table`,{className:z,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{scope:`col`,"aria-label":`Rank`}),(0,L.jsx)(`th`,{scope:`col`,children:`Model`}),(0,L.jsx)(`th`,{scope:`col`,className:`text-right`,children:`Req`}),(0,L.jsx)(`th`,{scope:`col`,className:`text-right`,title:`Average output tokens per second`,children:`Avg t/s`}),(0,L.jsx)(`th`,{scope:`col`,className:`text-right`,title:`Average time to first token`,children:`TTFT`}),(0,L.jsx)(`th`,{scope:`col`,children:`Tokens`})]})}),(0,L.jsx)(`tbody`,{children:o.map((e,t)=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{className:`w-13 font-mono text-micro text-text-tertiary`,children:t+1}),(0,L.jsx)(`td`,{children:(0,L.jsx)(`span`,{className:`flex min-w-0 flex-col gap-1 [&_code]:overflow-hidden [&_code]:text-ellipsis [&_code]:whitespace-nowrap [&_code]:text-text-primary [&_code]:text-caption [&_span]:font-mono [&_span]:text-micro [&_span]:text-text-tertiary`,children:(0,L.jsx)(`code`,{title:e.modelId,children:e.modelId})})}),(0,L.jsx)(`td`,{className:`text-right`,children:q(e.requests)}),(0,L.jsx)(`td`,{className:`text-right`,children:ye(e.avgTokensPerSec)}),(0,L.jsx)(`td`,{className:`text-right`,children:J(e.avgTtfbMs)}),(0,L.jsx)(`td`,{children:(0,L.jsx)(xe,{value:e.tokens,max:l,label:i(e.tokens)})})]},e.modelId))})]})})]}),(0,L.jsxs)(`section`,{"aria-label":`Client IPs`,children:[(0,L.jsx)(`div`,{className:`flex items-center justify-between gap-6`,children:(0,L.jsxs)(`h3`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-badge font-bold tracking-label transition-colors duration-150`,children:[(0,L.jsx)(s,{size:13,"aria-hidden":`true`}),` CLIENT IPS`]})}),c.length===0?(0,L.jsx)(`p`,{className:`py-9 text-center text-text-tertiary text-caption`,children:`No client addresses recorded yet.`}):(0,L.jsx)(`div`,{className:R,children:(0,L.jsxs)(`table`,{className:z,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{scope:`col`,children:`Address`}),(0,L.jsx)(`th`,{scope:`col`,children:`Client`}),(0,L.jsx)(`th`,{scope:`col`,className:`text-right`,children:`Req`}),(0,L.jsx)(`th`,{scope:`col`,children:`Tokens`}),(0,L.jsx)(`th`,{scope:`col`,children:`Last seen`})]})}),(0,L.jsx)(`tbody`,{children:c.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:(0,L.jsx)(`code`,{children:e.ip})}),(0,L.jsx)(`td`,{children:e.clientType?(0,L.jsx)(`span`,{className:`inline-block max-w-full overflow-hidden text-ellipsis whitespace-nowrap rounded-pill border border-inner-border bg-surface-2 px-3 py-px font-mono text-micro text-text-secondary`,children:e.clientType}):(0,L.jsx)(`span`,{className:`inline-block max-w-full overflow-hidden text-ellipsis whitespace-nowrap rounded-pill border border-inner-border bg-surface-2 px-3 py-px font-mono text-micro italic text-text-tertiary`,children:`unknown`})}),(0,L.jsx)(`td`,{className:`text-right`,children:q(e.requests)}),(0,L.jsx)(`td`,{children:(0,L.jsx)(xe,{value:e.requests,max:u,label:i(e.tokens)})}),(0,L.jsx)(`td`,{children:Y(e.lastSeenAt)})]},e.ip))})]})})]})]}):(0,L.jsx)(`p`,{className:`py-9 text-center text-text-tertiary text-caption`,children:`Activity is unavailable right now.`})}):null]})}var Ce=`cartethyia-share-keys`,Q=`issued-keys`,we=1;function $(){return new Promise((e,t)=>{if(typeof indexedDB>`u`){t(Error(`IndexedDB is unavailable`));return}let n=indexedDB.open(Ce,we);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(Q)||n.result.createObjectStore(Q)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??Error(`Could not open share-key storage`))})}function Te(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.key==`string`&&typeof t.keyId==`string`&&typeof t.keyPrefix==`string`&&typeof t.createdAt==`string`}async function Ee(e){let t=await $();return await new Promise((n,r)=>{let i=t.transaction(Q,`readonly`).objectStore(Q).get(e);i.onsuccess=()=>n(Te(i.result)?i.result:null),i.onerror=()=>r(i.error??Error(`Could not read share-key storage`))})}async function De(e,t){let n=await $();await new Promise((r,i)=>{let a=n.transaction(Q,`readwrite`);a.objectStore(Q).put(t,e),a.oncomplete=()=>r(),a.onerror=()=>i(a.error??Error(`Could not save share key in this browser`)),a.onabort=()=>i(a.error??Error(`Could not save share key in this browser`))})}async function Oe(e){let t=await $();await new Promise((n,r)=>{let i=t.transaction(Q,`readwrite`);i.objectStore(Q).delete(e),i.oncomplete=()=>n(),i.onerror=()=>r(i.error??Error(`Could not clear share-key storage`)),i.onabort=()=>r(i.error??Error(`Could not clear share-key storage`))})}function ke(e){return typeof e.error==`string`?e.error:e.error?.message??e.message??`Unable to generate an API key.`}var Ae={link_revoked:`Key revoked`,link_expired:`Link expired`,link_disabled:`Key paused`,link_not_found:`Link not available`,link_expired_or_used:`Link expired`,key_unavailable:`Key unavailable`};function je(e){let t=e.replace(/\/$/,``);return t.slice(t.lastIndexOf(`/`)+1)}var Me=20;function Ne({id:e,label:t,info:n,canProbe:r,probing:i,onProbe:c,result:l}){let u=(n?.capabilities?.input??[]).some(e=>e===`image`||e===`vision`);return(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2.5 rounded-control border border-inner-border bg-surface-2 p-3`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,L.jsx)(`span`,{className:`inline-flex size-13 shrink-0 items-center justify-center rounded-lg bg-teal-soft text-teal`,"aria-hidden":`true`,children:(0,L.jsx)(a,{size:14})}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-caption font-semibold leading-chat text-text-primary`,title:e,children:t})]}),(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-text-secondary text-badge`,children:[(0,L.jsxs)(`span`,{className:`inline-flex gap-1 [&>span]:inline-flex`,children:[n?.reasoning?(0,L.jsx)(`span`,{title:`Reasoning`,"aria-label":`Reasoning`,className:`text-purple`,children:(0,L.jsx)(o,{size:12})}):null,u?(0,L.jsx)(`span`,{title:`Vision`,"aria-label":`Vision`,className:`text-status-info`,children:(0,L.jsx)(ie,{size:12})}):null,n?.toolCall?(0,L.jsx)(`span`,{title:`Tool calling`,"aria-label":`Tool calling`,className:`text-orange`,children:(0,L.jsx)(S,{size:12})}):null,n?.webSearch?(0,L.jsx)(`span`,{title:`Web search`,"aria-label":`Web search`,className:`text-teal`,children:(0,L.jsx)(s,{size:12})}):null]}),(0,L.jsxs)(`span`,{className:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,children:[n?.contextLength==null?(0,L.jsx)(`span`,{title:k,className:`cursor-help`,children:`n/a ctx`}):`${E(n.contextLength)} ctx`,` · `,n?.maxOutputTokens==null?(0,L.jsx)(`span`,{title:k,className:`cursor-help`,children:`n/a out`}):`${E(n.maxOutputTokens)} out`]})]}),l?.ok?(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 font-mono text-badge text-text-secondary [&>strong]:font-sans [&>strong]:text-green`,role:`status`,children:[(0,L.jsx)(`strong`,{children:`OK`}),(0,L.jsxs)(`span`,{children:[`TTFT `,d(l.ttftMs)]}),(0,L.jsxs)(`span`,{children:[`Done `,d(l.totalMs)]})]}):null,(0,L.jsxs)(`div`,{className:`mt-auto grid min-w-0 grid-cols-2 items-center gap-4 [&>*]:w-full [&>*]:min-w-0 [&_.btn]:w-full [&_.btn]:min-w-0`,children:[r?(0,L.jsx)(f,{variant:`secondary`,size:`sm`,icon:l?.ok?(0,L.jsx)(`span`,{className:`inline-flex text-green`,children:(0,L.jsx)(y,{size:13})}):(0,L.jsx)(_,{size:13}),loading:i,disabled:i,onClick:()=>c(e),title:l?.ok?`Last test passed in ${d(l.totalMs)} — click to re-test`:l?`Last test failed${l.status===null?``:` with HTTP ${l.status}`} — click to re-test`:`Test this model using the shared API key`,children:i?`Testing…`:l?.ok?`Done ${d(l.totalMs)}`:l?`Failed${l.status===null?``:` ${l.status}`}`:`Test`}):null,(0,L.jsx)(b,{value:e,size:`sm`,variant:`secondary`,label:`Copy`,copiedLabel:`Copied`,"aria-label":`Copy ${e}`,title:`Copy ${e}`})]})]})}function Pe(){let e=typeof window>`u`?`/share`:window.location.pathname.replace(/\/$/,``),t=`${e}/data`,n=`${e}/issue`,r=typeof window>`u`?``:je(e),i=typeof window>`u`?``:window.location.origin,o=he(t),[d,h]=(0,M.useState)(null),[_,v]=(0,M.useState)(null),[y,ie]=(0,M.useState)(``),[x,S]=(0,M.useState)(null),[T,E]=(0,M.useState)(!1),[D,O]=(0,M.useState)(null),[k,A]=(0,M.useState)(()=>new Set),[j,N]=(0,M.useState)(()=>new Map),P=(0,M.useRef)(new Map),F=(0,M.useRef)(null),[I,R]=(0,M.useState)(()=>m(`dark`)),[z,B]=(0,M.useState)(!1),[V,H]=(0,M.useState)(`raw`);(0,M.useEffect)(()=>{let e=()=>B(window.scrollY>24);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),(0,M.useEffect)(()=>{document.title=`Cartethyia — Shared access`,R(m(`dark`)),ne(m(`dark`))},[]);let U=o.data?.kind===`enroll`?o.data:null;(0,M.useEffect)(()=>{let e=!0;if(h(null),v(null),S(null),!r||!U){o.error&&Oe(r).catch(()=>void 0);return}return Ee(r).then(t=>{e&&t&&(v(t),h(null))}).catch(()=>{e&&S(`This browser could not read the stored key. Issue a new key only if this enrollment permits one.`)}),()=>{e=!1}},[r,U,o.error]);let W=async()=>{E(!0),O(null),S(null);try{let e=await fetch(n,{method:`POST`,credentials:`same-origin`,cache:`no-store`,referrerPolicy:`no-referrer`,headers:{"content-type":`application/json`},body:JSON.stringify(y.trim()?{nameHint:y.trim().slice(0,Me)}:{})}),t=await e.json();if(!e.ok){O(ke(t));return}let i=t;if(v(null),h(i),!r)return;try{await De(r,{key:i.key,keyId:i.keyId,keyPrefix:i.keyPrefix,createdAt:i.createdAt}),v({key:i.key,keyId:i.keyId,keyPrefix:i.keyPrefix,createdAt:i.createdAt}),h(null)}catch{S(`Your key was issued, but this browser could not save it. Copy it now: refreshing will not restore it.`)}}catch{O(`Unable to reach the Cartethyia gateway. Please try again.`)}finally{E(!1)}},G=_??d,K=o.data,q=K?.kind===`handoff`?!!K.key:!!G?.key,ye=()=>{let e=F.current;e&&(e.scrollIntoView({behavior:`smooth`,block:`center`}),e.focus({preventScroll:!0}))},J=async e=>{let t=K?.kind===`handoff`?K.key:(_??d)?.key;if(k.has(e))return;if(!t){g.error(`Create your API key first`,`Generate a key in the API key panel before testing a model.`),ye();return}let n=new AbortController;P.current.set(e,n),A(t=>new Set(t).add(e));let r=performance.now(),a=null;try{let o=await fetch(`${i}/v1/chat/completions`,{method:`POST`,headers:{Authorization:`Bearer ${t}`,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify({model:e,messages:[{role:`user`,content:`Reply with exactly: OK`}],stream:!0,max_tokens:16}),cache:`no-store`,referrerPolicy:`no-referrer`,signal:n.signal});if(!o.ok||!o.body){N(t=>new Map(t).set(e,{ok:!1,status:o.status})),g.error(`Model probe failed`,`Request failed with HTTP ${o.status}`);return}let s=o.body.getReader();try{for(;;){let e=await s.read();if(e.value&&e.value.byteLength>0&&a===null&&(a=performance.now()),e.done)break}}finally{s.releaseLock()}let c=Math.round(performance.now()-r),l=Math.round((a??performance.now())-r);N(t=>new Map(t).set(e,{ok:!0,ttftMs:l,totalMs:c})),g.success(`Model test complete`,`${e} · TTFT ${l} ms · Done ${c} ms`)}catch(t){t instanceof DOMException&&t.name===`AbortError`||(N(t=>new Map(t).set(e,{ok:!1,status:null})),g.error(`Model probe failed`,t instanceof Error?t.message:`The request could not be completed.`))}finally{P.current.get(e)===n&&P.current.delete(e),A(t=>{let n=new Set(t);return n.delete(e),n})}};(0,M.useEffect)(()=>()=>{for(let e of P.current.values())e.abort()},[]);let Y=!!U?.canIssue&&!G,X=K?.kind===`handoff`?K.key:null,Z=new Map;for(let e of K?.models??[]){let t=e.indexOf(`/`),n=t>0?e.slice(0,t):`Other`,r=Z.get(n)??[];r.push(e),Z.set(n,r)}return(0,L.jsx)(ge,{path:`${e}/stats/stream`,children:(0,L.jsxs)(`div`,{className:`min-h-screen text-text-primary font-sans`,children:[(0,L.jsx)(`div`,{className:`share-backdrop`,"aria-hidden":`true`}),(0,L.jsx)(`header`,{className:`share-header`,"data-scrolled":z,children:(0,L.jsxs)(`div`,{className:`share-header-inner`,"data-scrolled":z,children:[(0,L.jsxs)(`a`,{className:`inline-flex items-center gap-5 font-head text-lead tracking-tight text-text-primary no-underline`,href:`/`,children:[(0,L.jsx)(`span`,{className:`grid size-17 place-items-center overflow-hidden rounded-control border border-inner-border bg-accent-soft text-accent`,"aria-hidden":`true`,children:(0,L.jsx)(`img`,{className:`block size-full object-cover`,src:`/assets/brand/favicon.jpg`,alt:``,width:34,height:34})}),(0,L.jsx)(`b`,{children:`Cartethyia`})]}),(0,L.jsxs)(`div`,{className:`inline-flex items-center gap-4 max-narrow:gap-3`,children:[(0,L.jsx)(oe,{className:`max-narrow:[&_.github-badge-metric]:hidden max-narrow:[&_.github-badge]:px-2.5`}),(0,L.jsx)(`button`,{type:`button`,className:`grid size-17 cursor-pointer place-items-center rounded-pill border border-inner-border bg-surface-2 text-text-secondary hover:border-border-strong hover:text-text-primary focus-visible:outline-2 focus-visible:outline-focus-ring focus-visible:outline-offset-2`,onClick:()=>{let e=p(I)?`light`:`dark`;R(e),te(e)},"aria-label":`Toggle theme`,"aria-pressed":p(I),title:p(I)?`Switch to light mode`:`Switch to dark mode`,children:p(I)?(0,L.jsx)(re,{size:15}):(0,L.jsx)(ee,{size:15})}),(0,L.jsxs)(`a`,{href:`/`,className:`inline-flex min-h-17 items-center gap-3 rounded-pill border border-inner-border bg-surface-2 px-6 text-badge font-semibold text-text-secondary no-underline hover:border-border-strong hover:text-text-primary max-narrow:px-5`,children:[(0,L.jsx)(ae,{size:13,"aria-hidden":`true`}),` Home`]})]})]})}),(0,L.jsx)(`main`,{className:`relative z-1 mx-auto flex w-full max-w-480 flex-col gap-8 px-12 pb-24 pt-40 max-narrow:gap-6 max-narrow:px-6 max-narrow:pb-16 max-narrow:pt-36`,children:o.loading?(0,L.jsx)(w,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:(0,L.jsx)(C,{children:(0,L.jsx)(ce,{label:`Loading enrollment policy…`})})}):o.error?(0,L.jsx)(w,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:(0,L.jsx)(C,{children:(0,L.jsx)(se,{title:Ae[o.code??``]??`Link not available`,message:o.error,onRetry:()=>window.location.reload()})})}):K?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(w,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-7 max-sm:p-5`,children:[(0,L.jsxs)(`p`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-micro font-bold tracking-label leading-normal`,children:[K.kind===`handoff`?(0,L.jsx)(ue,{size:13,"aria-hidden":`true`}):(0,L.jsx)(fe,{size:13,"aria-hidden":`true`}),K.kind===`handoff`?`SHARED ACCESS / KEY`:`SHARED ACCESS / ENROLLMENT`]}),(0,L.jsx)(`h1`,{children:K.name||`Shared API access`}),K.kind===`handoff`?(0,L.jsx)(`p`,{className:`mt-2.5 text-text-secondary text-body leading-loose`,children:`The API key for this gateway, provided through a share link. It is subject to the limits below.`}):null,(0,L.jsx)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:K.expiresAt?(0,L.jsxs)(`span`,{className:`inline-flex min-h-7 items-center gap-1.5 rounded-chip border border-inner-border bg-surface-2 px-2.5 py-1 text-text-secondary font-mono text-micro leading-snug`,children:[(0,L.jsx)(c,{size:12,"aria-hidden":`true`}),`Link expires `,new Date(K.expiresAt).toLocaleString()]}):null}),(0,L.jsx)(_e,{policy:K})]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-8 max-md:grid-cols-1`,children:[(0,L.jsxs)(w,{surface:`muted`,className:`flex min-w-0 flex-col items-start gap-6 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:[(0,L.jsxs)(`h2`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-micro font-bold tracking-label leading-normal`,children:[(0,L.jsx)(s,{size:13,"aria-hidden":`true`}),` BASE URL`]}),(0,L.jsxs)(`div`,{className:`flex w-full min-w-0 items-center gap-4 [&>code]:block [&>code]:min-w-0 [&>code]:flex-1 [&>code]:overflow-hidden [&>code]:text-ellipsis [&>code]:whitespace-nowrap [&>code]:rounded-inset [&>code]:border [&>code]:border-inner-border [&>code]:bg-code-surface [&>code]:p-5 [&>code]:text-text-primary [&>code]:font-mono [&>code]:text-caption [&>code]:leading-normal [&>button]:shrink-0`,children:[(0,L.jsxs)(`code`,{children:[i,`/v1`]}),(0,L.jsx)(b,{value:`${i}/v1`,size:`sm`,variant:`secondary`,label:`Copy URL`,copiedLabel:`Copied`,"aria-label":`Copy Base URL`})]}),(0,L.jsx)(`p`,{className:`text-caption leading-loose text-text-secondary`,children:`Point your SDK, Opencode, Claude Code, Droid, and any other CLI`})]}),(0,L.jsx)(`div`,{ref:F,tabIndex:-1,children:(0,L.jsxs)(w,{surface:`muted`,className:`flex min-w-0 flex-col items-start gap-6 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:[(0,L.jsxs)(`h2`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-micro font-bold tracking-label leading-normal`,children:[(0,L.jsx)(ue,{size:13,"aria-hidden":`true`}),` YOUR API KEY`]}),K.kind===`handoff`?X?(0,L.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-5`,role:`status`,children:[(0,L.jsx)(`p`,{className:`font-mono text-micro font-bold tracking-label text-orange`,children:`REVEALED BY THE LINK OWNER`}),(0,L.jsx)(`code`,{className:`block min-w-0 flex-1 overflow-hidden rounded-inset border border-inner-border bg-code-surface p-5 font-mono text-caption leading-normal text-text-primary [overflow-wrap:anywhere] [user-select:all]`,children:X}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5 [&>span]:font-mono [&>span]:text-micro [&>span]:text-text-tertiary`,children:[(0,L.jsx)(b,{value:X,size:`sm`,variant:`primary`,label:`Copy key`,copiedLabel:`Copied`}),(0,L.jsx)(f,{variant:`secondary`,size:`sm`,onClick:()=>pe(`cartethyia-api-key.txt`,`Cartethyia API key\n\n${X}\n\nKeep this secret.\n`,`text/plain;charset=utf-8`),children:`Save this key`}),(0,L.jsxs)(`span`,{children:[`Prefix `,K.keyPrefix??`—`]})]}),(0,L.jsx)(`p`,{className:`text-caption leading-loose text-text-secondary`,children:`This link reveals the key itself, so anyone holding the URL can read it. Keep the URL private; the link owner regenerates it to replace this key.`})]}):(0,L.jsx)(`p`,{className:`text-caption leading-normal text-text-secondary`,children:`This link can no longer reveal its key. Ask the link owner to regenerate it.`}):G?(0,L.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-5`,role:`status`,children:[(0,L.jsx)(`p`,{className:`font-mono text-micro font-bold tracking-wide text-orange`,children:`GENERATED ONCE · COPY AND KEEP IT`}),(0,L.jsx)(`code`,{className:`block min-w-0 flex-1 overflow-hidden rounded-inset border border-inner-border bg-code-surface p-5 font-mono text-caption leading-normal text-text-primary [overflow-wrap:anywhere] [user-select:all]`,children:G.key}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5 [&>span]:font-mono [&>span]:text-micro [&>span]:text-text-tertiary`,children:[(0,L.jsx)(b,{value:G.key,size:`sm`,variant:`primary`,label:`Copy key`,copiedLabel:`Copied`}),(0,L.jsx)(f,{variant:`secondary`,size:`sm`,onClick:()=>pe(`cartethyia-api-key.txt`,`Cartethyia API key\n\n${G.key}\n\nKeep this secret.\n`,`text/plain;charset=utf-8`),children:`Save this key`}),(0,L.jsxs)(`span`,{children:[`Key ID `,G.keyId.slice(0,12),`…`]})]}),(0,L.jsx)(`p`,{className:`text-caption leading-loose text-text-secondary`,children:`Saved in this browser while this enrollment link remains valid. It is not shown again from another browser, and an expired, revoked, or unavailable link does not restore a local copy.`})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`text-caption leading-normal text-text-secondary`,children:Y?`Issue a personal key to use the shared endpoint.`:`No key is available in this browser.`}),Y?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`label`,{className:`flex w-full flex-col gap-1.5 text-text-secondary text-micro font-bold [&>input]:w-full [&>input]:min-h-11 [&>input]:rounded-control [&>input]:border [&>input]:border-inner-border [&>input]:bg-surface-1 [&>input]:px-3 [&>input]:text-text-primary [&>input]:text-body [&>input]:font-medium [&>input]:focus-visible:outline-2 [&>input]:focus-visible:outline-focus-ring [&>input]:focus-visible:outline-offset-2`,children:[(0,L.jsx)(`span`,{children:`Your name`}),(0,L.jsx)(`input`,{type:`text`,value:y,required:!0,maxLength:Me,autoComplete:`nickname`,onChange:e=>ie(e.target.value)}),(0,L.jsx)(`span`,{className:`text-text-tertiary text-micro font-normal leading-normal`,children:`Shown on your key (best kept to ~5 letters) — the gateway appends its own code.`})]}),(0,L.jsx)(`p`,{className:`-mt-3 text-text-tertiary text-micro font-normal leading-normal`,children:`Enter your name to generate a personal key.`}),(0,L.jsx)(f,{variant:`primary`,size:`sm`,loading:T,disabled:T||!y.trim(),onClick:()=>void W(),children:T?`Generating…`:`Generate API Key`})]}):null]}),K.kind===`enroll`&&!Y&&!G?(0,L.jsx)(`p`,{role:`status`,className:`w-full rounded-inset border border-orange-soft bg-orange-soft px-5 py-4 text-badge leading-normal text-orange`,children:D??`This enrollment link is not currently accepting key requests.`}):null,D&&Y?(0,L.jsx)(`p`,{role:`alert`,className:`form-error`,children:D}):null,x?(0,L.jsx)(`p`,{role:`alert`,className:`form-error`,children:x}):null]})})]}),K.sharePopup.enabled&&K.sharePopup.hasImage?(0,L.jsx)(w,{surface:`muted`,className:`min-w-0 overflow-hidden border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150`,children:(0,L.jsxs)(`div`,{className:`grid grid-cols-qris gap-0 max-sm:grid-cols-qris-compact`,children:[(0,L.jsx)(`div`,{className:`relative flex items-center justify-center bg-white p-4`,children:(0,L.jsx)(`img`,{src:`/share/`+r+`/popup-image`,alt:K.sharePopup.title??`Support QR code`,className:`block w-full max-w-qris-badge rounded-control`})}),(0,L.jsxs)(`div`,{className:`flex flex-col justify-center gap-5 p-6 max-sm:p-4 max-sm:gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`p`,{className:`inline-flex items-center gap-2 text-text-tertiary font-mono text-micro font-bold tracking-label leading-normal mb-3`,children:[(0,L.jsx)(l,{size:12,"aria-hidden":`true`,className:`text-orange`}),` SUPPORT`]}),K.sharePopup.title?(0,L.jsx)(`h2`,{className:`font-head text-title font-semibold leading-snug wrap-anywhere max-sm:text-lead`,children:K.sharePopup.title}):null,K.sharePopup.body?(0,L.jsx)(`p`,{className:`mt-2 text-body leading-loose whitespace-pre-wrap text-text-secondary wrap-anywhere max-sm:text-caption max-sm:leading-normal`,children:K.sharePopup.body}):null]}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:(0,L.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-2 rounded-pill border border-inner-border bg-surface-2 px-5 py-2.5 text-caption font-semibold text-text-primary hover:brightness-110 focus-visible:outline-2 focus-visible:outline-focus-ring focus-visible:outline-offset-2 transition-[filter]`,onClick:async()=>{try{let e=await fetch(`/share/`+r+`/popup-image`);if(!e.ok)throw Error(`fetch failed`);let t=await e.arrayBuffer(),n=e.headers.get(`content-type`)??`image/png`,i=n.includes(`jpeg`)?`jpg`:n.split(`/`)[1]??`png`;me(`qris-support.`+i,new Uint8Array(t),n)}catch{g.error(`Could not download the image.`)}},children:[(0,L.jsx)(u,{size:14,"aria-hidden":`true`}),`Download QR`]})}),(0,L.jsxs)(`div`,{className:`border-t border-inner-border pt-4 max-sm:pt-3 flex flex-col gap-1`,children:[(0,L.jsxs)(`p`,{className:`text-badge text-text-tertiary`,children:[(0,L.jsx)(`span`,{className:`font-semibold text-text-secondary`,children:`Gateway`}),` `,K.name]}),(0,L.jsx)(`p`,{className:`text-badge text-text-tertiary max-sm:hidden`,children:`Scan with any QRIS-compatible banking or e-wallet app.`})]})]})]})}):null,K.notes.title||K.notes.subtitle||K.notes.body?(0,L.jsxs)(w,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:[(0,L.jsxs)(`h2`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-micro font-bold tracking-label leading-normal`,children:[(0,L.jsx)(de,{size:13,"aria-hidden":`true`}),` NOTES`]}),K.notes.title?(0,L.jsx)(`h3`,{className:`mt-5 font-head text-title font-semibold`,children:K.notes.title}):null,K.notes.subtitle?(0,L.jsx)(`p`,{className:`mt-3 text-caption font-semibold text-text-secondary`,children:K.notes.subtitle}):null,K.notes.body?(0,L.jsx)(`p`,{className:`mt-5 text-body leading-loose whitespace-pre-wrap text-text-secondary`,children:K.notes.body}):null]}):null,(0,L.jsx)(ve,{}),(0,L.jsxs)(w,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`p`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-micro font-bold tracking-label leading-normal`,children:[(0,L.jsx)(a,{size:13,"aria-hidden":`true`}),` MODEL ACCESS`]}),(0,L.jsx)(`h2`,{className:`mt-3 font-head text-lead font-semibold tracking-tight`,children:`Allowed models`})]}),(0,L.jsxs)(`div`,{className:`inline-flex items-center gap-4`,children:[(0,L.jsxs)(`div`,{className:`inline-flex rounded-pill border border-inner-border bg-surface-2 p-1`,role:`tablist`,"aria-label":`Allowed model layout`,children:[(0,L.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":V===`raw`,className:`min-h-13 cursor-pointer rounded-pill border-0 bg-transparent px-5 font-mono text-micro font-bold tracking-label text-text-secondary uppercase hover:text-text-primary${V===`raw`?` bg-accent text-accent-foreground`:``}`,onClick:()=>H(`raw`),children:`Raw`}),(0,L.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":V===`grouped`,className:`min-h-13 cursor-pointer rounded-pill border-0 bg-transparent px-5 font-mono text-micro font-bold tracking-label text-text-secondary uppercase hover:text-text-primary${V===`grouped`?` bg-accent text-accent-foreground`:``}`,onClick:()=>H(`grouped`),children:`Grouped`})]}),K.models.length?(0,L.jsx)(b,{value:K.models.join(`, `),size:`sm`,variant:`secondary`,label:`Copy all`,copiedLabel:`Copied`,"aria-label":`Copy all granted models`}):null]})]}),Z.size?V===`raw`?(0,L.jsx)(`div`,{className:`mt-8 grid grid-cols-3 gap-4 max-wide:grid-cols-2 max-narrow:grid-cols-1`,children:K.models.map(e=>(0,L.jsx)(Ne,{id:e,label:e,info:K.modelInfo?.[e],canProbe:q,probing:k.has(e),onProbe:J,result:j.get(e)},e))}):(0,L.jsx)(`div`,{className:`mt-8 grid grid-cols-2 gap-6 min-extra-wide:grid-cols-3 max-medium:grid-cols-1`,children:[...Z].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>(0,L.jsxs)(`section`,{className:`min-w-0 overflow-hidden rounded-panel border border-inner-border bg-surface-2`,"aria-label":`${e} models`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-6 border-b border-inner-border px-6 py-5`,children:[(0,L.jsx)(`h3`,{className:`font-mono text-badge font-bold text-text-primary wrap-anywhere`,children:e}),(0,L.jsx)(`span`,{className:`rounded-pill bg-accent-soft px-4 py-1 font-mono text-micro font-bold text-accent`,children:t.length})]}),(0,L.jsx)(`div`,{className:`mt-0 grid max-h-150 grid-cols-1 gap-3 overflow-y-auto p-4`,children:t.map(t=>(0,L.jsx)(Ne,{id:t,label:e===`Other`?t:t.slice(e.length+1),info:K.modelInfo?.[t],canProbe:q,probing:k.has(t),onProbe:J,result:j.get(t)},t))})]},e))}):(0,L.jsx)(`p`,{className:`mt-8 rounded-control border border-inner-border bg-surface-2 p-7 text-caption text-text-secondary`,children:`Model access follows the share template policy.`}),K.modelPrefix?(0,L.jsxs)(`p`,{className:`mt-6 text-badge leading-normal text-text-secondary wrap-anywhere`,children:[`Required model prefix: `,K.modelPrefix]}):null]})]}):(0,L.jsx)(w,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:(0,L.jsx)(C,{children:(0,L.jsx)(le,{title:`No enrollment data`,message:`This enrollment link did not return usable policy data.`})})})})]})})}var Fe=document.getElementById(`root`);if(Fe===null)throw Error(`Share root element is missing`);(0,N.createRoot)(Fe).render((0,L.jsxs)(M.StrictMode,{children:[(0,L.jsx)(Pe,{}),(0,L.jsx)(h,{position:`top-right`,offset:{top:`1rem`,right:`1rem`},mobileOffset:{top:`1rem`,left:`1rem`,right:`1rem`},visibleToasts:2,toastOptions:{className:`toast-surface select-text`,style:{background:`var(--glass-bg-2)`,border:`1px solid var(--glass-border-2)`,color:`var(--text-primary)`,fontSize:`12.5px`},classNames:{title:`select-text`,description:`select-text`},actionButtonStyle:{background:`var(--accent)`,color:`var(--accent-foreground)`},cancelButtonStyle:{background:`var(--surface-muted)`,color:`var(--text-primary)`}}})]}));
1
+ import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CXUMngI_.js";import{l as i}from"./app-2KhtHCv9.js";import{n as a,t as o}from"./brain-Cwed_72z.js";import{C as s,D as c,S as l,T as u,a as d,b as ee,c as f,d as p,f as m,g as h,p as te,s as g,u as ne,w as _,y as re}from"./numbers-BOevJzdz.js";import{t as v}from"./chevron-right-BXIy5l3h.js";import{t as y}from"./circle-check-BU3v_mFW.js";import{t as ie}from"./eye-C_hawfH4.js";import{r as ae,t as oe}from"./github-badge-DmQreSDd.js";import{n as se,r as ce,t as le}from"./state-2c5V4zo7.js";import{t as ue}from"./key-round-UkavsGxp.js";import{n as de,r as fe,t as b}from"./clipboard-button-uL5aYLfW.js";import{t as x}from"./scaling-nWE4Cx8f.js";import{t as S}from"./wrench-B6E1oEuY.js";import{n as C,t as w}from"./card-CdsSlWA3.js";import{n as pe,t as me}from"./download-dRFo5_Wu.js";import{a as T,l as E,m as D,o as O,s as k}from"./tokens-COzario9.js";import{t as A}from"./stream-retry-5QnVuSSo.js";var j=e(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),M=t(n(),1),N=i();function P(e){if(e===`link_expired_or_used`)return`This enrollment link has expired or has already been used.`;if(e===`key_unavailable`)return`The shared access template is no longer available.`;if(e===`link_not_found`)return`This enrollment link is unavailable.`;if(e===`link_disabled`)return`This share link's API key is paused. Ask whoever shared this link to re-enable it.`;if(e===`link_expired`)return`This share link has expired.`;if(e===`link_revoked`)return`This share link's API key has been revoked, so the link can no longer be used. Ask whoever shared this link for a new one — a revoked key cannot be re-enabled.`}function F(e,t){let n=e.error;return P(typeof n==`string`?n:n?.code)??(typeof n==`string`?n:n?.message)??e.message??t}function I(e){let t=e.error;return(typeof t==`string`?t:t?.code)??null}function he(e,t){let n=t?.streamEvent,[r,i]=(0,M.useState)({data:null,error:null,code:null,loading:!0});return(0,M.useEffect)(()=>{let t=!0,r=new AbortController,a,o,s=e=>{i({data:e,error:null,code:null,loading:!1})};if(n===void 0)return fetch(e,{signal:r.signal,credentials:`same-origin`,cache:`no-store`,referrerPolicy:`no-referrer`}).then(async e=>{let n=await e.json();if(t){if(!e.ok){i({data:null,error:F(n,`This enrollment link is unavailable.`),code:I(n),loading:!1});return}s(n)}}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||t&&i({data:null,error:`Unable to reach the Cartethyia gateway.`,code:null,loading:!1})}),()=>{t=!1,r.abort()};let c=!1,l=()=>{if(!t)return;let r=new EventSource(e);a=r,r.addEventListener(n,e=>{if(t)try{s(JSON.parse(e.data))}catch{}}),r.addEventListener(`error`,()=>{r.close(),t&&(c||(c=!0,i(e=>e.data===null?{...e,loading:!1}:e)),o=setTimeout(l,A))})};return l(),()=>{t=!1,a?.close(),clearTimeout(o)}},[e,n]),r}var L=r(),R=`max-h-168 w-full min-w-0 overflow-x-auto overflow-y-auto touch-pan-x touch-pan-y [&_thead_th]:sticky [&_thead_th]:top-0 [&_thead_th]:z-card [&_thead_th]:bg-surface-2`,z=`w-full border-collapse text-caption [&_th]:border-b [&_th]:border-inner-border [&_th]:px-5 [&_th]:py-3 [&_th]:text-left [&_th]:font-mono [&_th]:text-micro [&_th]:font-bold [&_th]:uppercase [&_th]:tracking-label [&_th]:text-text-tertiary [&_td]:border-b [&_td]:border-surface-muted [&_td]:px-5 [&_td]:py-4 [&_td]:text-text-secondary [&_tr:last-child_td]:border-b-0 [&_code]:overflow-hidden [&_code]:text-ellipsis [&_code]:whitespace-nowrap`,B=(0,M.createContext)({data:null,loading:!0,unit:T,cycleUnit:()=>void 0}),V=`cartethyia:share-token-unit`;function H(){try{let e=window.localStorage.getItem(V);if(e===null)return T;if(e===`auto`)return-1;let t=Number(e);return Number.isInteger(t)&&t>=0&&t<=T?t:T}catch{return T}}function U(e){return e===-1?0:e>=T?-1:e+1}function W(e){return e===-1?`auto`:e>=T?`raw`:O[e]?.suffix??`auto`}function ge({path:e,children:t}){let n=he(e,{streamEvent:`stats`}),[r,i]=(0,M.useState)(()=>typeof window>`u`?T:H()),a=(0,M.useCallback)(()=>{i(e=>{let t=U(e);try{window.localStorage.setItem(V,t===-1?`auto`:String(t))}catch{}return t})},[]);return(0,L.jsx)(B.Provider,{value:{data:n.data,loading:n.loading,unit:r,cycleUnit:a},children:t})}function G(){let{unit:e,cycleUnit:t}=(0,M.useContext)(B),n=W(e),r=W(U(e));return(0,L.jsxs)(`button`,{type:`button`,className:`ml-auto inline-flex min-h-6 items-center gap-1 rounded-chip border border-inner-border bg-surface-2 px-2 text-text-secondary font-mono text-micro font-bold uppercase tracking-[0.04em] cursor-pointer hover:border-accent hover:text-text-primary`,"aria-label":`Token unit: currently ${n}, switch to ${r}`,title:`Show ${r}`,onClick:t,children:[(0,L.jsx)(x,{size:11,"aria-hidden":`true`}),n]})}function _e({policy:e}){let{data:t}=(0,M.useContext)(B);return(0,L.jsx)(Z,{policy:e,stats:t})}function ve(){let{data:e,loading:t}=(0,M.useContext)(B);return(0,L.jsx)(Se,{stats:e,loading:t})}function K(){let{unit:e}=(0,M.useContext)(B);return(0,M.useCallback)(t=>D(t,e),[e])}function q(e){return Number.isFinite(e)?Math.max(0,Math.round(e)).toLocaleString():`—`}function ye(e){return e===null||!Number.isFinite(e)||e<=0?`—`:`${Number(e.toFixed(1))} t/s`}function J(e){return e===null||!Number.isFinite(e)||e<=0?`—`:e>=1e3?`${Number((e/1e3).toFixed(1))}s`:`${Math.round(e)}ms`}function Y(e){if(!e)return`—`;let t=new Date(e).getTime();if(!Number.isFinite(t))return`—`;let n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.round(n/60);if(r<60)return`${r} min ago`;let i=Math.round(r/60);return i<24?`${i} h ago`:new Date(e).toLocaleDateString()}function X(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:00`}function Z({policy:e,stats:t}){let n=K(),r=[{label:`Lifetime`,used:t?.totals?.totalTokens??0,limit:e.oneTimeLimit},{label:`Daily`,used:t?.totals?.todayTokens??0,limit:e.dailyLimit},{label:`Monthly`,used:t?.totals?.monthTokens??0,limit:e.monthlyLimit}],i=t?.recipients;return(0,L.jsxs)(`div`,{className:`mt-5 flex flex-col gap-6 border-t border-inner-border pt-9`,children:[r.map(e=>{let t=e.limit!==null&&e.limit>0,r=t?Math.min(1,e.used/e.limit):1;return(0,L.jsxs)(`div`,{className:`flex items-center gap-6 max-sm:flex-col max-sm:items-stretch max-sm:gap-3`,children:[(0,L.jsx)(`span`,{className:`w-39 shrink-0 text-text-secondary font-mono text-micro uppercase tracking-label max-sm:w-auto`,children:e.label}),(0,L.jsx)(`div`,{className:`relative h-4 flex-1 overflow-hidden rounded-tiny bg-teal max-sm:flex-none`,title:t?`${n(e.used)} of ${n(e.limit)} used`:`${n(e.used)} used (no limit set)`,children:t?(0,L.jsx)(`div`,{className:`h-full rounded-tiny bg-red transition-[width] duration-200`,style:{width:`${Math.round(r*100)}%`}}):null}),(0,L.jsxs)(`span`,{className:`whitespace-nowrap text-text-secondary font-mono text-micro [&>strong]:text-text-primary [&>strong]:font-semibold max-sm:self-start`,children:[(0,L.jsx)(`strong`,{children:n(e.used)}),t?` / ${n(e.limit)}`:` used`]})]},e.label)}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(`span`,{className:`inline-flex min-h-14 items-center gap-3.5 rounded-pill border border-inner-border bg-surface-2 px-5 py-2.5 text-text-secondary font-mono text-badge leading-[1.3]`,children:[`RPM `,e.requestsPerMinute??`unlimited`]}),(0,L.jsxs)(`span`,{className:`inline-flex min-h-14 items-center gap-3.5 rounded-pill border border-inner-border bg-surface-2 px-5 py-2.5 text-text-secondary font-mono text-badge leading-[1.3]`,children:[`Concurrent `,e.maxConcurrentRequests??`unlimited`]}),i?(0,L.jsxs)(`span`,{className:`inline-flex min-h-14 items-center gap-3.5 rounded-pill border border-inner-border bg-surface-2 px-5 py-2.5 text-text-secondary font-mono text-badge leading-[1.3]`,children:[i.active,` / `,i.total,` recipients active`]}):null,(0,L.jsx)(G,{})]})]})}function be({hourly:e}){let t=K(),n=Math.max(1,...e.map(e=>e.requests)),r=e.length*10,[i,a]=(0,M.useState)(null),o=(t,n)=>{let r=t.getBoundingClientRect();if(r.width===0||e.length===0)return null;let i=Math.floor((n-r.left)/r.width*e.length);return i>=0&&i<e.length?i:null},s=i===null?void 0:e[i];return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`mb-2 flex min-h-9 items-baseline gap-4 text-text-tertiary font-mono text-badge [&>strong]:text-text-primary [&>strong]:font-head [&>strong]:text-body-lg [&>strong]:font-semibold`,"aria-live":`polite`,children:s?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`strong`,{children:t(s.tokens)}),(0,L.jsxs)(`span`,{children:[X(s.hour),` · `,q(s.requests),` req`]})]}):(0,L.jsx)(`span`,{children:`drag a bar`})}),(0,L.jsx)(`div`,{className:`cursor-crosshair touch-none`,onPointerEnter:e=>a(o(e.currentTarget,e.clientX)),onPointerMove:e=>a(o(e.currentTarget,e.clientX)),onPointerLeave:()=>a(null),children:(0,L.jsx)(`svg`,{className:`h-22 w-full`,viewBox:`0 0 ${r} 44`,preserveAspectRatio:`none`,role:`img`,"aria-label":`Requests per hour over the last 24 hours`,children:e.map((e,r)=>{let a=Math.round(e.requests/n*40);return(0,L.jsx)(`rect`,{className:`${e.requests===0?`fill-track`:`fill-teal`}${r===i?` fill-text-primary`:``}`,x:r*10+1,y:44-Math.max(2,a),width:7,height:Math.max(2,a),rx:1.5,children:(0,L.jsx)(`title`,{children:`${t(e.tokens)} tokens · ${q(e.requests)} requests`})},e.hour)})})}),(0,L.jsxs)(`div`,{className:`mt-1.5 flex justify-between text-text-tertiary font-mono text-micro`,children:[(0,L.jsx)(`span`,{children:e.length?X(e[0].hour):``}),(0,L.jsx)(`span`,{children:`last 24h`}),(0,L.jsx)(`span`,{children:e.length?X(e[e.length-1].hour):``})]})]})}function xe({value:e,max:t,label:n}){let r=t>0?Math.min(1,e/t):0;return(0,L.jsxs)(`div`,{className:`flex min-w-55 items-center gap-4 max-sm:min-w-32`,children:[(0,L.jsx)(`div`,{className:`h-3 min-w-0 flex-1 overflow-hidden rounded-tiny bg-surface-muted`,children:(0,L.jsx)(`div`,{className:`h-full rounded-tiny bg-teal`,style:{width:`${Math.round(r*100)}%`}})}),(0,L.jsx)(`span`,{className:`min-w-8 text-right font-mono text-micro text-text-secondary`,children:n})]})}function Se({stats:e,loading:t}){let[n,r]=(0,M.useState)(!1),i=K(),a=e?.totals,o=e?.models??[],c=e?.clientIps??[],l=Math.max(1,...o.map(e=>e.tokens)),u=Math.max(1,...c.map(e=>e.requests));return(0,L.jsxs)(w,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg p-5 backdrop-blur-md backdrop-saturate-150`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`group flex w-full cursor-pointer items-center gap-3 bg-transparent p-0 text-left`,"aria-expanded":n,onClick:()=>r(e=>!e),children:[(0,L.jsx)(v,{size:14,className:`shrink-0 text-text-secondary transition-transform duration-200${n?` rotate-90`:``}`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`text-text-secondary font-mono text-badge font-bold tracking-label transition-colors duration-150 group-hover:text-text-primary`,children:`STATS & ACTIVITY`}),(0,L.jsxs)(`span`,{className:`ml-auto flex flex-wrap items-center gap-2 text-text-tertiary font-mono text-micro max-medium:hidden`,children:[(0,L.jsxs)(`span`,{children:[c.length,` IPs`]}),(0,L.jsx)(`span`,{children:`·`}),(0,L.jsxs)(`span`,{children:[o.length,` models`]}),(0,L.jsx)(`span`,{children:`·`}),(0,L.jsxs)(`span`,{children:[q(a?.requests??0),` req`]})]})]}),n?(0,L.jsx)(`div`,{className:`mt-5 flex flex-col gap-5`,children:t&&!e?(0,L.jsx)(`p`,{className:`py-9 text-center text-text-tertiary text-caption`,children:`Loading activity…`}):e?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-4 gap-5 max-wide:grid-cols-2 max-narrow:grid-cols-1`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-panel border border-inner-border bg-surface-2 px-7 py-6`,children:[(0,L.jsx)(`span`,{className:`text-text-tertiary font-mono text-micro uppercase tracking-label`,children:`Requests`}),(0,L.jsx)(`span`,{className:`font-head text-display font-semibold tracking-tight`,children:q(a?.requests??0)}),(0,L.jsxs)(`span`,{className:`text-text-secondary text-micro`,children:[q(a?.errors??0),` errors`]})]}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-panel border border-inner-border bg-surface-2 px-7 py-6`,children:[(0,L.jsx)(`span`,{className:`text-text-tertiary font-mono text-micro uppercase tracking-label`,children:`Tokens`}),(0,L.jsx)(`span`,{className:`font-head text-display font-semibold tracking-tight`,children:i(a?.totalTokens??0)}),(0,L.jsx)(`span`,{className:`text-text-secondary text-micro`,children:`all time`})]}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-panel border border-inner-border bg-surface-2 px-7 py-6`,children:[(0,L.jsx)(`span`,{className:`text-text-tertiary font-mono text-micro uppercase tracking-label`,children:`Last hour`}),(0,L.jsx)(`span`,{className:`font-head text-display font-semibold tracking-tight`,children:q(a?.lastHourRequests??0)}),(0,L.jsx)(`span`,{className:`text-text-secondary text-micro`,children:`requests in 60 min`})]}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-panel border border-inner-border bg-surface-2 px-7 py-6`,children:[(0,L.jsx)(`span`,{className:`text-text-tertiary font-mono text-micro uppercase tracking-label`,children:`Models`}),(0,L.jsx)(`span`,{className:`font-head text-display font-semibold tracking-tight`,children:o.length}),(0,L.jsx)(`span`,{className:`text-text-secondary text-micro`,children:`in use`})]})]}),(0,L.jsx)(be,{hourly:e.hourly}),(0,L.jsxs)(`section`,{"aria-label":`Top models`,children:[(0,L.jsx)(`div`,{className:`flex items-center justify-between gap-6`,children:(0,L.jsxs)(`h3`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-badge font-bold tracking-label transition-colors duration-150`,children:[(0,L.jsx)(j,{size:13,"aria-hidden":`true`}),` TOP MODELS`]})}),o.length===0?(0,L.jsx)(`p`,{className:`py-9 text-center text-text-tertiary text-caption`,children:`No model traffic yet.`}):(0,L.jsx)(`div`,{className:R,children:(0,L.jsxs)(`table`,{className:z,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{scope:`col`,"aria-label":`Rank`}),(0,L.jsx)(`th`,{scope:`col`,children:`Model`}),(0,L.jsx)(`th`,{scope:`col`,className:`text-right`,children:`Req`}),(0,L.jsx)(`th`,{scope:`col`,className:`text-right`,title:`Average output tokens per second`,children:`Avg t/s`}),(0,L.jsx)(`th`,{scope:`col`,className:`text-right`,title:`Average time to first token`,children:`TTFT`}),(0,L.jsx)(`th`,{scope:`col`,children:`Tokens`})]})}),(0,L.jsx)(`tbody`,{children:o.map((e,t)=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{className:`w-13 font-mono text-micro text-text-tertiary`,children:t+1}),(0,L.jsx)(`td`,{children:(0,L.jsx)(`span`,{className:`flex min-w-0 flex-col gap-1 [&_code]:overflow-hidden [&_code]:text-ellipsis [&_code]:whitespace-nowrap [&_code]:text-text-primary [&_code]:text-caption [&_span]:font-mono [&_span]:text-micro [&_span]:text-text-tertiary`,children:(0,L.jsx)(`code`,{title:e.modelId,children:e.modelId})})}),(0,L.jsx)(`td`,{className:`text-right`,children:q(e.requests)}),(0,L.jsx)(`td`,{className:`text-right`,children:ye(e.avgTokensPerSec)}),(0,L.jsx)(`td`,{className:`text-right`,children:J(e.avgTtfbMs)}),(0,L.jsx)(`td`,{children:(0,L.jsx)(xe,{value:e.tokens,max:l,label:i(e.tokens)})})]},e.modelId))})]})})]}),(0,L.jsxs)(`section`,{"aria-label":`Client IPs`,children:[(0,L.jsx)(`div`,{className:`flex items-center justify-between gap-6`,children:(0,L.jsxs)(`h3`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-badge font-bold tracking-label transition-colors duration-150`,children:[(0,L.jsx)(s,{size:13,"aria-hidden":`true`}),` CLIENT IPS`]})}),c.length===0?(0,L.jsx)(`p`,{className:`py-9 text-center text-text-tertiary text-caption`,children:`No client addresses recorded yet.`}):(0,L.jsx)(`div`,{className:R,children:(0,L.jsxs)(`table`,{className:z,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{scope:`col`,children:`Address`}),(0,L.jsx)(`th`,{scope:`col`,children:`Client`}),(0,L.jsx)(`th`,{scope:`col`,className:`text-right`,children:`Req`}),(0,L.jsx)(`th`,{scope:`col`,children:`Tokens`}),(0,L.jsx)(`th`,{scope:`col`,children:`Last seen`})]})}),(0,L.jsx)(`tbody`,{children:c.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:(0,L.jsx)(`code`,{children:e.ip})}),(0,L.jsx)(`td`,{children:e.clientType?(0,L.jsx)(`span`,{className:`inline-block max-w-full overflow-hidden text-ellipsis whitespace-nowrap rounded-pill border border-inner-border bg-surface-2 px-3 py-px font-mono text-micro text-text-secondary`,children:e.clientType}):(0,L.jsx)(`span`,{className:`inline-block max-w-full overflow-hidden text-ellipsis whitespace-nowrap rounded-pill border border-inner-border bg-surface-2 px-3 py-px font-mono text-micro italic text-text-tertiary`,children:`unknown`})}),(0,L.jsx)(`td`,{className:`text-right`,children:q(e.requests)}),(0,L.jsx)(`td`,{children:(0,L.jsx)(xe,{value:e.requests,max:u,label:i(e.tokens)})}),(0,L.jsx)(`td`,{children:Y(e.lastSeenAt)})]},e.ip))})]})})]})]}):(0,L.jsx)(`p`,{className:`py-9 text-center text-text-tertiary text-caption`,children:`Activity is unavailable right now.`})}):null]})}var Ce=`cartethyia-share-keys`,Q=`issued-keys`,we=1;function $(){return new Promise((e,t)=>{if(typeof indexedDB>`u`){t(Error(`IndexedDB is unavailable`));return}let n=indexedDB.open(Ce,we);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(Q)||n.result.createObjectStore(Q)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??Error(`Could not open share-key storage`))})}function Te(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.key==`string`&&typeof t.keyId==`string`&&typeof t.keyPrefix==`string`&&typeof t.createdAt==`string`}async function Ee(e){let t=await $();return await new Promise((n,r)=>{let i=t.transaction(Q,`readonly`).objectStore(Q).get(e);i.onsuccess=()=>n(Te(i.result)?i.result:null),i.onerror=()=>r(i.error??Error(`Could not read share-key storage`))})}async function De(e,t){let n=await $();await new Promise((r,i)=>{let a=n.transaction(Q,`readwrite`);a.objectStore(Q).put(t,e),a.oncomplete=()=>r(),a.onerror=()=>i(a.error??Error(`Could not save share key in this browser`)),a.onabort=()=>i(a.error??Error(`Could not save share key in this browser`))})}async function Oe(e){let t=await $();await new Promise((n,r)=>{let i=t.transaction(Q,`readwrite`);i.objectStore(Q).delete(e),i.oncomplete=()=>n(),i.onerror=()=>r(i.error??Error(`Could not clear share-key storage`)),i.onabort=()=>r(i.error??Error(`Could not clear share-key storage`))})}function ke(e){return typeof e.error==`string`?e.error:e.error?.message??e.message??`Unable to generate an API key.`}var Ae={link_revoked:`Key revoked`,link_expired:`Link expired`,link_disabled:`Key paused`,link_not_found:`Link not available`,link_expired_or_used:`Link expired`,key_unavailable:`Key unavailable`};function je(e){let t=e.replace(/\/$/,``);return t.slice(t.lastIndexOf(`/`)+1)}var Me=20;function Ne({id:e,label:t,info:n,canProbe:r,probing:i,onProbe:c,result:l}){let u=(n?.capabilities?.input??[]).some(e=>e===`image`||e===`vision`);return(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2.5 rounded-control border border-inner-border bg-surface-2 p-3`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,L.jsx)(`span`,{className:`inline-flex size-13 shrink-0 items-center justify-center rounded-lg bg-teal-soft text-teal`,"aria-hidden":`true`,children:(0,L.jsx)(a,{size:14})}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-caption font-semibold leading-chat text-text-primary`,title:e,children:t})]}),(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-text-secondary text-badge`,children:[(0,L.jsxs)(`span`,{className:`inline-flex gap-1 [&>span]:inline-flex`,children:[n?.reasoning?(0,L.jsx)(`span`,{title:`Reasoning`,"aria-label":`Reasoning`,className:`text-purple`,children:(0,L.jsx)(o,{size:12})}):null,u?(0,L.jsx)(`span`,{title:`Vision`,"aria-label":`Vision`,className:`text-status-info`,children:(0,L.jsx)(ie,{size:12})}):null,n?.toolCall?(0,L.jsx)(`span`,{title:`Tool calling`,"aria-label":`Tool calling`,className:`text-orange`,children:(0,L.jsx)(S,{size:12})}):null,n?.webSearch?(0,L.jsx)(`span`,{title:`Web search`,"aria-label":`Web search`,className:`text-teal`,children:(0,L.jsx)(s,{size:12})}):null]}),(0,L.jsxs)(`span`,{className:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,children:[n?.contextLength==null?(0,L.jsx)(`span`,{title:k,className:`cursor-help`,children:`n/a ctx`}):`${E(n.contextLength)} ctx`,` · `,n?.maxOutputTokens==null?(0,L.jsx)(`span`,{title:k,className:`cursor-help`,children:`n/a out`}):`${E(n.maxOutputTokens)} out`]})]}),l?.ok?(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 font-mono text-badge text-text-secondary [&>strong]:font-sans [&>strong]:text-green`,role:`status`,children:[(0,L.jsx)(`strong`,{children:`OK`}),(0,L.jsxs)(`span`,{children:[`TTFT `,d(l.ttftMs)]}),(0,L.jsxs)(`span`,{children:[`Done `,d(l.totalMs)]})]}):null,(0,L.jsxs)(`div`,{className:`mt-auto grid min-w-0 grid-cols-2 items-center gap-4 [&>*]:w-full [&>*]:min-w-0 [&_.btn]:w-full [&_.btn]:min-w-0`,children:[r?(0,L.jsx)(f,{variant:`secondary`,size:`sm`,icon:l?.ok?(0,L.jsx)(`span`,{className:`inline-flex text-green`,children:(0,L.jsx)(y,{size:13})}):(0,L.jsx)(_,{size:13}),loading:i,disabled:i,onClick:()=>c(e),title:l?.ok?`Last test passed in ${d(l.totalMs)} — click to re-test`:l?`Last test failed${l.status===null?``:` with HTTP ${l.status}`} — click to re-test`:`Test this model using the shared API key`,children:i?`Testing…`:l?.ok?`Done ${d(l.totalMs)}`:l?`Failed${l.status===null?``:` ${l.status}`}`:`Test`}):null,(0,L.jsx)(b,{value:e,size:`sm`,variant:`secondary`,label:`Copy`,copiedLabel:`Copied`,"aria-label":`Copy ${e}`,title:`Copy ${e}`})]})]})}function Pe(){let e=typeof window>`u`?`/share`:window.location.pathname.replace(/\/$/,``),t=`${e}/data`,n=`${e}/issue`,r=typeof window>`u`?``:je(e),i=typeof window>`u`?``:window.location.origin,o=he(t),[d,h]=(0,M.useState)(null),[_,v]=(0,M.useState)(null),[y,ie]=(0,M.useState)(``),[x,S]=(0,M.useState)(null),[T,E]=(0,M.useState)(!1),[D,O]=(0,M.useState)(null),[k,A]=(0,M.useState)(()=>new Set),[j,N]=(0,M.useState)(()=>new Map),P=(0,M.useRef)(new Map),F=(0,M.useRef)(null),[I,R]=(0,M.useState)(()=>m(`dark`)),[z,B]=(0,M.useState)(!1),[V,H]=(0,M.useState)(`raw`);(0,M.useEffect)(()=>{let e=()=>B(window.scrollY>24);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),(0,M.useEffect)(()=>{document.title=`Cartethyia — Shared access`,R(m(`dark`)),ne(m(`dark`))},[]);let U=o.data?.kind===`enroll`?o.data:null;(0,M.useEffect)(()=>{let e=!0;if(h(null),v(null),S(null),!r||!U){o.error&&Oe(r).catch(()=>void 0);return}return Ee(r).then(t=>{e&&t&&(v(t),h(null))}).catch(()=>{e&&S(`This browser could not read the stored key. Issue a new key only if this enrollment permits one.`)}),()=>{e=!1}},[r,U,o.error]);let W=async()=>{E(!0),O(null),S(null);try{let e=await fetch(n,{method:`POST`,credentials:`same-origin`,cache:`no-store`,referrerPolicy:`no-referrer`,headers:{"content-type":`application/json`},body:JSON.stringify(y.trim()?{nameHint:y.trim().slice(0,Me)}:{})}),t=await e.json();if(!e.ok){O(ke(t));return}let i=t;if(v(null),h(i),!r)return;try{await De(r,{key:i.key,keyId:i.keyId,keyPrefix:i.keyPrefix,createdAt:i.createdAt}),v({key:i.key,keyId:i.keyId,keyPrefix:i.keyPrefix,createdAt:i.createdAt}),h(null)}catch{S(`Your key was issued, but this browser could not save it. Copy it now: refreshing will not restore it.`)}}catch{O(`Unable to reach the Cartethyia gateway. Please try again.`)}finally{E(!1)}},G=_??d,K=o.data,q=K?.kind===`handoff`?!!K.key:!!G?.key,ye=()=>{let e=F.current;e&&(e.scrollIntoView({behavior:`smooth`,block:`center`}),e.focus({preventScroll:!0}))},J=async e=>{let t=K?.kind===`handoff`?K.key:(_??d)?.key;if(k.has(e))return;if(!t){g.error(`Create your API key first`,`Generate a key in the API key panel before testing a model.`),ye();return}let n=new AbortController;P.current.set(e,n),A(t=>new Set(t).add(e));let r=performance.now(),a=null;try{let o=await fetch(`${i}/v1/chat/completions`,{method:`POST`,headers:{Authorization:`Bearer ${t}`,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify({model:e,messages:[{role:`user`,content:`Reply with exactly: OK`}],stream:!0,max_tokens:16}),cache:`no-store`,referrerPolicy:`no-referrer`,signal:n.signal});if(!o.ok||!o.body){N(t=>new Map(t).set(e,{ok:!1,status:o.status})),g.error(`Model probe failed`,`Request failed with HTTP ${o.status}`);return}let s=o.body.getReader();try{for(;;){let e=await s.read();if(e.value&&e.value.byteLength>0&&a===null&&(a=performance.now()),e.done)break}}finally{s.releaseLock()}let c=Math.round(performance.now()-r),l=Math.round((a??performance.now())-r);N(t=>new Map(t).set(e,{ok:!0,ttftMs:l,totalMs:c})),g.success(`Model test complete`,`${e} · TTFT ${l} ms · Done ${c} ms`)}catch(t){t instanceof DOMException&&t.name===`AbortError`||(N(t=>new Map(t).set(e,{ok:!1,status:null})),g.error(`Model probe failed`,t instanceof Error?t.message:`The request could not be completed.`))}finally{P.current.get(e)===n&&P.current.delete(e),A(t=>{let n=new Set(t);return n.delete(e),n})}};(0,M.useEffect)(()=>()=>{for(let e of P.current.values())e.abort()},[]);let Y=!!U?.canIssue&&!G,X=K?.kind===`handoff`?K.key:null,Z=new Map;for(let e of K?.models??[]){let t=e.indexOf(`/`),n=t>0?e.slice(0,t):`Other`,r=Z.get(n)??[];r.push(e),Z.set(n,r)}return(0,L.jsx)(ge,{path:`${e}/stats/stream`,children:(0,L.jsxs)(`div`,{className:`min-h-screen text-text-primary font-sans`,children:[(0,L.jsx)(`div`,{className:`share-backdrop`,"aria-hidden":`true`}),(0,L.jsx)(`header`,{className:`share-header`,"data-scrolled":z,children:(0,L.jsxs)(`div`,{className:`share-header-inner`,"data-scrolled":z,children:[(0,L.jsxs)(`a`,{className:`inline-flex items-center gap-5 font-head text-lead tracking-tight text-text-primary no-underline`,href:`/`,children:[(0,L.jsx)(`span`,{className:`grid size-17 place-items-center overflow-hidden rounded-control border border-inner-border bg-accent-soft text-accent`,"aria-hidden":`true`,children:(0,L.jsx)(`img`,{className:`block size-full object-cover`,src:`/assets/brand/favicon.jpg`,alt:``,width:34,height:34})}),(0,L.jsx)(`b`,{children:`Cartethyia`})]}),(0,L.jsxs)(`div`,{className:`inline-flex items-center gap-4 max-narrow:gap-3`,children:[(0,L.jsx)(oe,{className:`max-narrow:[&_.github-badge-metric]:hidden max-narrow:[&_.github-badge]:px-2.5`}),(0,L.jsx)(`button`,{type:`button`,className:`grid size-17 cursor-pointer place-items-center rounded-pill border border-inner-border bg-surface-2 text-text-secondary hover:border-border-strong hover:text-text-primary focus-visible:outline-2 focus-visible:outline-focus-ring focus-visible:outline-offset-2`,onClick:()=>{let e=p(I)?`light`:`dark`;R(e),te(e)},"aria-label":`Toggle theme`,"aria-pressed":p(I),title:p(I)?`Switch to light mode`:`Switch to dark mode`,children:p(I)?(0,L.jsx)(re,{size:15}):(0,L.jsx)(ee,{size:15})}),(0,L.jsxs)(`a`,{href:`/`,className:`inline-flex min-h-17 items-center gap-3 rounded-pill border border-inner-border bg-surface-2 px-6 text-badge font-semibold text-text-secondary no-underline hover:border-border-strong hover:text-text-primary max-narrow:px-5`,children:[(0,L.jsx)(ae,{size:13,"aria-hidden":`true`}),` Home`]})]})]})}),(0,L.jsx)(`main`,{className:`relative z-1 mx-auto flex w-full max-w-480 flex-col gap-8 px-12 pb-24 pt-40 max-narrow:gap-6 max-narrow:px-6 max-narrow:pb-16 max-narrow:pt-36`,children:o.loading?(0,L.jsx)(w,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:(0,L.jsx)(C,{children:(0,L.jsx)(ce,{label:`Loading enrollment policy…`})})}):o.error?(0,L.jsx)(w,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:(0,L.jsx)(C,{children:(0,L.jsx)(se,{title:Ae[o.code??``]??`Link not available`,message:o.error,onRetry:()=>window.location.reload()})})}):K?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(w,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-7 max-sm:p-5`,children:[(0,L.jsxs)(`p`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-micro font-bold tracking-label leading-normal`,children:[K.kind===`handoff`?(0,L.jsx)(ue,{size:13,"aria-hidden":`true`}):(0,L.jsx)(fe,{size:13,"aria-hidden":`true`}),K.kind===`handoff`?`SHARED ACCESS / KEY`:`SHARED ACCESS / ENROLLMENT`]}),(0,L.jsx)(`h1`,{children:K.name||`Shared API access`}),K.kind===`handoff`?(0,L.jsx)(`p`,{className:`mt-2.5 text-text-secondary text-body leading-loose`,children:`The API key for this gateway, provided through a share link. It is subject to the limits below.`}):null,(0,L.jsx)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:K.expiresAt?(0,L.jsxs)(`span`,{className:`inline-flex min-h-7 items-center gap-1.5 rounded-chip border border-inner-border bg-surface-2 px-2.5 py-1 text-text-secondary font-mono text-micro leading-snug`,children:[(0,L.jsx)(c,{size:12,"aria-hidden":`true`}),`Link expires `,new Date(K.expiresAt).toLocaleString()]}):null}),(0,L.jsx)(_e,{policy:K})]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-8 max-md:grid-cols-1`,children:[(0,L.jsxs)(w,{surface:`muted`,className:`flex min-w-0 flex-col items-start gap-6 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:[(0,L.jsxs)(`h2`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-micro font-bold tracking-label leading-normal`,children:[(0,L.jsx)(s,{size:13,"aria-hidden":`true`}),` BASE URL`]}),(0,L.jsxs)(`div`,{className:`flex w-full min-w-0 items-center gap-4 [&>code]:block [&>code]:min-w-0 [&>code]:flex-1 [&>code]:overflow-hidden [&>code]:text-ellipsis [&>code]:whitespace-nowrap [&>code]:rounded-inset [&>code]:border [&>code]:border-inner-border [&>code]:bg-code-surface [&>code]:p-5 [&>code]:text-text-primary [&>code]:font-mono [&>code]:text-caption [&>code]:leading-normal [&>button]:shrink-0`,children:[(0,L.jsxs)(`code`,{children:[i,`/v1`]}),(0,L.jsx)(b,{value:`${i}/v1`,size:`sm`,variant:`secondary`,label:`Copy URL`,copiedLabel:`Copied`,"aria-label":`Copy Base URL`})]}),(0,L.jsx)(`p`,{className:`text-caption leading-loose text-text-secondary`,children:`Point your SDK, Opencode, Claude Code, Droid, and any other CLI`})]}),(0,L.jsx)(`div`,{ref:F,tabIndex:-1,children:(0,L.jsxs)(w,{surface:`muted`,className:`flex min-w-0 flex-col items-start gap-6 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:[(0,L.jsxs)(`h2`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-micro font-bold tracking-label leading-normal`,children:[(0,L.jsx)(ue,{size:13,"aria-hidden":`true`}),` YOUR API KEY`]}),K.kind===`handoff`?X?(0,L.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-5`,role:`status`,children:[(0,L.jsx)(`p`,{className:`font-mono text-micro font-bold tracking-label text-orange`,children:`REVEALED BY THE LINK OWNER`}),(0,L.jsx)(`code`,{className:`block min-w-0 flex-1 overflow-hidden rounded-inset border border-inner-border bg-code-surface p-5 font-mono text-caption leading-normal text-text-primary [overflow-wrap:anywhere] [user-select:all]`,children:X}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5 [&>span]:font-mono [&>span]:text-micro [&>span]:text-text-tertiary`,children:[(0,L.jsx)(b,{value:X,size:`sm`,variant:`primary`,label:`Copy key`,copiedLabel:`Copied`}),(0,L.jsx)(f,{variant:`secondary`,size:`sm`,onClick:()=>pe(`cartethyia-api-key.txt`,`Cartethyia API key\n\n${X}\n\nKeep this secret.\n`,`text/plain;charset=utf-8`),children:`Save this key`}),(0,L.jsxs)(`span`,{children:[`Prefix `,K.keyPrefix??`—`]})]}),(0,L.jsx)(`p`,{className:`text-caption leading-loose text-text-secondary`,children:`This link reveals the key itself, so anyone holding the URL can read it. Keep the URL private; the link owner regenerates it to replace this key.`})]}):(0,L.jsx)(`p`,{className:`text-caption leading-normal text-text-secondary`,children:`This link can no longer reveal its key. Ask the link owner to regenerate it.`}):G?(0,L.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-5`,role:`status`,children:[(0,L.jsx)(`p`,{className:`font-mono text-micro font-bold tracking-wide text-orange`,children:`GENERATED ONCE · COPY AND KEEP IT`}),(0,L.jsx)(`code`,{className:`block min-w-0 flex-1 overflow-hidden rounded-inset border border-inner-border bg-code-surface p-5 font-mono text-caption leading-normal text-text-primary [overflow-wrap:anywhere] [user-select:all]`,children:G.key}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5 [&>span]:font-mono [&>span]:text-micro [&>span]:text-text-tertiary`,children:[(0,L.jsx)(b,{value:G.key,size:`sm`,variant:`primary`,label:`Copy key`,copiedLabel:`Copied`}),(0,L.jsx)(f,{variant:`secondary`,size:`sm`,onClick:()=>pe(`cartethyia-api-key.txt`,`Cartethyia API key\n\n${G.key}\n\nKeep this secret.\n`,`text/plain;charset=utf-8`),children:`Save this key`}),(0,L.jsxs)(`span`,{children:[`Key ID `,G.keyId.slice(0,12),`…`]})]}),(0,L.jsx)(`p`,{className:`text-caption leading-loose text-text-secondary`,children:`Saved in this browser while this enrollment link remains valid. It is not shown again from another browser, and an expired, revoked, or unavailable link does not restore a local copy.`})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`text-caption leading-normal text-text-secondary`,children:Y?`Issue a personal key to use the shared endpoint.`:`No key is available in this browser.`}),Y?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`label`,{className:`flex w-full flex-col gap-1.5 text-text-secondary text-micro font-bold [&>input]:w-full [&>input]:min-h-11 [&>input]:rounded-control [&>input]:border [&>input]:border-inner-border [&>input]:bg-surface-1 [&>input]:px-3 [&>input]:text-text-primary [&>input]:text-body [&>input]:font-medium [&>input]:focus-visible:outline-2 [&>input]:focus-visible:outline-focus-ring [&>input]:focus-visible:outline-offset-2`,children:[(0,L.jsx)(`span`,{children:`Your name`}),(0,L.jsx)(`input`,{type:`text`,value:y,required:!0,maxLength:Me,autoComplete:`nickname`,onChange:e=>ie(e.target.value)}),(0,L.jsx)(`span`,{className:`text-text-tertiary text-micro font-normal leading-normal`,children:`Shown on your key (best kept to ~5 letters) — the gateway appends its own code.`})]}),(0,L.jsx)(`p`,{className:`-mt-3 text-text-tertiary text-micro font-normal leading-normal`,children:`Enter your name to generate a personal key.`}),(0,L.jsx)(f,{variant:`primary`,size:`sm`,loading:T,disabled:T||!y.trim(),onClick:()=>void W(),children:T?`Generating…`:`Generate API Key`})]}):null]}),K.kind===`enroll`&&!Y&&!G?(0,L.jsx)(`p`,{role:`status`,className:`w-full rounded-inset border border-orange-soft bg-orange-soft px-5 py-4 text-badge leading-normal text-orange`,children:D??`This enrollment link is not currently accepting key requests.`}):null,D&&Y?(0,L.jsx)(`p`,{role:`alert`,className:`form-error`,children:D}):null,x?(0,L.jsx)(`p`,{role:`alert`,className:`form-error`,children:x}):null]})})]}),K.sharePopup.enabled&&K.sharePopup.hasImage?(0,L.jsx)(w,{surface:`muted`,className:`min-w-0 overflow-hidden border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150`,children:(0,L.jsxs)(`div`,{className:`grid grid-cols-qris gap-0 max-sm:grid-cols-qris-compact`,children:[(0,L.jsx)(`div`,{className:`relative flex items-center justify-center bg-white p-4`,children:(0,L.jsx)(`img`,{src:`/share/`+r+`/popup-image`,alt:K.sharePopup.title??`Support QR code`,className:`block w-full max-w-qris-badge rounded-control`})}),(0,L.jsxs)(`div`,{className:`flex flex-col justify-center gap-5 p-6 max-sm:p-4 max-sm:gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`p`,{className:`inline-flex items-center gap-2 text-text-tertiary font-mono text-micro font-bold tracking-label leading-normal mb-3`,children:[(0,L.jsx)(l,{size:12,"aria-hidden":`true`,className:`text-orange`}),` SUPPORT`]}),K.sharePopup.title?(0,L.jsx)(`h2`,{className:`font-head text-title font-semibold leading-snug wrap-anywhere max-sm:text-lead`,children:K.sharePopup.title}):null,K.sharePopup.body?(0,L.jsx)(`p`,{className:`mt-2 text-body leading-loose whitespace-pre-wrap text-text-secondary wrap-anywhere max-sm:text-caption max-sm:leading-normal`,children:K.sharePopup.body}):null]}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:(0,L.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-2 rounded-pill border border-inner-border bg-surface-2 px-5 py-2.5 text-caption font-semibold text-text-primary hover:brightness-110 focus-visible:outline-2 focus-visible:outline-focus-ring focus-visible:outline-offset-2 transition-[filter]`,onClick:async()=>{try{let e=await fetch(`/share/`+r+`/popup-image`);if(!e.ok)throw Error(`fetch failed`);let t=await e.arrayBuffer(),n=e.headers.get(`content-type`)??`image/png`,i=n.includes(`jpeg`)?`jpg`:n.split(`/`)[1]??`png`;me(`qris-support.`+i,new Uint8Array(t),n)}catch{g.error(`Could not download the image.`)}},children:[(0,L.jsx)(u,{size:14,"aria-hidden":`true`}),`Download QR`]})}),(0,L.jsxs)(`div`,{className:`border-t border-inner-border pt-4 max-sm:pt-3 flex flex-col gap-1`,children:[(0,L.jsxs)(`p`,{className:`text-badge text-text-tertiary`,children:[(0,L.jsx)(`span`,{className:`font-semibold text-text-secondary`,children:`Gateway`}),` `,K.name]}),(0,L.jsx)(`p`,{className:`text-badge text-text-tertiary max-sm:hidden`,children:`Scan with any QRIS-compatible banking or e-wallet app.`})]})]})]})}):null,K.notes.title||K.notes.subtitle||K.notes.body?(0,L.jsxs)(w,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:[(0,L.jsxs)(`h2`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-micro font-bold tracking-label leading-normal`,children:[(0,L.jsx)(de,{size:13,"aria-hidden":`true`}),` NOTES`]}),K.notes.title?(0,L.jsx)(`h3`,{className:`mt-5 font-head text-title font-semibold`,children:K.notes.title}):null,K.notes.subtitle?(0,L.jsx)(`p`,{className:`mt-3 text-caption font-semibold text-text-secondary`,children:K.notes.subtitle}):null,K.notes.body?(0,L.jsx)(`p`,{className:`mt-5 text-body leading-loose whitespace-pre-wrap text-text-secondary`,children:K.notes.body}):null]}):null,(0,L.jsx)(ve,{}),(0,L.jsxs)(w,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`p`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-micro font-bold tracking-label leading-normal`,children:[(0,L.jsx)(a,{size:13,"aria-hidden":`true`}),` MODEL ACCESS`]}),(0,L.jsx)(`h2`,{className:`mt-3 font-head text-lead font-semibold tracking-tight`,children:`Allowed models`})]}),(0,L.jsxs)(`div`,{className:`inline-flex items-center gap-4`,children:[(0,L.jsxs)(`div`,{className:`inline-flex rounded-pill border border-inner-border bg-surface-2 p-1`,role:`tablist`,"aria-label":`Allowed model layout`,children:[(0,L.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":V===`raw`,className:`min-h-13 cursor-pointer rounded-pill border-0 bg-transparent px-5 font-mono text-micro font-bold tracking-label text-text-secondary uppercase hover:text-text-primary${V===`raw`?` bg-accent text-accent-foreground`:``}`,onClick:()=>H(`raw`),children:`Raw`}),(0,L.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":V===`grouped`,className:`min-h-13 cursor-pointer rounded-pill border-0 bg-transparent px-5 font-mono text-micro font-bold tracking-label text-text-secondary uppercase hover:text-text-primary${V===`grouped`?` bg-accent text-accent-foreground`:``}`,onClick:()=>H(`grouped`),children:`Grouped`})]}),K.models.length?(0,L.jsx)(b,{value:K.models.join(`, `),size:`sm`,variant:`secondary`,label:`Copy all`,copiedLabel:`Copied`,"aria-label":`Copy all granted models`}):null]})]}),Z.size?V===`raw`?(0,L.jsx)(`div`,{className:`mt-8 grid grid-cols-3 gap-4 max-wide:grid-cols-2 max-narrow:grid-cols-1`,children:K.models.map(e=>(0,L.jsx)(Ne,{id:e,label:e,info:K.modelInfo?.[e],canProbe:q,probing:k.has(e),onProbe:J,result:j.get(e)},e))}):(0,L.jsx)(`div`,{className:`mt-8 grid grid-cols-2 gap-6 min-extra-wide:grid-cols-3 max-medium:grid-cols-1`,children:[...Z].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>(0,L.jsxs)(`section`,{className:`min-w-0 overflow-hidden rounded-panel border border-inner-border bg-surface-2`,"aria-label":`${e} models`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-6 border-b border-inner-border px-6 py-5`,children:[(0,L.jsx)(`h3`,{className:`font-mono text-badge font-bold text-text-primary wrap-anywhere`,children:e}),(0,L.jsx)(`span`,{className:`rounded-pill bg-accent-soft px-4 py-1 font-mono text-micro font-bold text-accent`,children:t.length})]}),(0,L.jsx)(`div`,{className:`mt-0 grid max-h-150 grid-cols-1 gap-3 overflow-y-auto p-4`,children:t.map(t=>(0,L.jsx)(Ne,{id:t,label:e===`Other`?t:t.slice(e.length+1),info:K.modelInfo?.[t],canProbe:q,probing:k.has(t),onProbe:J,result:j.get(t)},t))})]},e))}):(0,L.jsx)(`p`,{className:`mt-8 rounded-control border border-inner-border bg-surface-2 p-7 text-caption text-text-secondary`,children:`Model access follows the share template policy.`}),K.modelPrefix?(0,L.jsxs)(`p`,{className:`mt-6 text-badge leading-normal text-text-secondary wrap-anywhere`,children:[`Required model prefix: `,K.modelPrefix]}):null]})]}):(0,L.jsx)(w,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:(0,L.jsx)(C,{children:(0,L.jsx)(le,{title:`No enrollment data`,message:`This enrollment link did not return usable policy data.`})})})})]})})}var Fe=document.getElementById(`root`);if(Fe===null)throw Error(`Share root element is missing`);(0,N.createRoot)(Fe).render((0,L.jsxs)(M.StrictMode,{children:[(0,L.jsx)(Pe,{}),(0,L.jsx)(h,{position:`top-right`,offset:{top:`1rem`,right:`1rem`},mobileOffset:{top:`1rem`,left:`1rem`,right:`1rem`},visibleToasts:2,toastOptions:{className:`toast-surface select-text`,style:{background:`var(--glass-bg-2)`,border:`1px solid var(--glass-border-2)`,color:`var(--text-primary)`,fontSize:`12.5px`},classNames:{title:`select-text`,description:`select-text`},actionButtonStyle:{background:`var(--accent)`,color:`var(--accent-foreground)`},cancelButtonStyle:{background:`var(--surface-muted)`,color:`var(--text-primary)`}}})]}));
@@ -0,0 +1,4 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LoginPage-CbphLvjg.js","assets/jsx-runtime-CXUMngI_.js","assets/numbers-BOevJzdz.js","assets/app-2KhtHCv9.js","assets/app-CEeaMHOy.css","assets/log-in-BmRjy60c.js","assets/query-keys-UETqfytp.js","assets/input-CjCnXweJ.js","assets/eye-off-Bk5g2luF.js","assets/eye-C_hawfH4.js","assets/SetupPage-D4g6vOGc.js","assets/layout-V6y8DAkl.js","assets/backup-file-gdKIlg8U.js","assets/BannedPage-l6XMnfr9.js","assets/OverviewPage-DABu2Wgt.js","assets/terminal-0_IjPWTk.js","assets/model-bans-BmYTmbAk.js","assets/assert-DU6qrMA_.js","assets/useMutation-EDFRkn1i.js","assets/mutation-g_fduiNw.js","assets/concurrency-BDF0ok7y.js","assets/chevron-right-BXIy5l3h.js","assets/SortableList-C93i14BD.js","assets/stack-_gfTdLVB.js","assets/database-Dz9N3zGd.js","assets/gauge-BbIMy7MB.js","assets/state-2c5V4zo7.js","assets/key-round-UkavsGxp.js","assets/clipboard-button-uL5aYLfW.js","assets/use-clipboard-B0Sy03fE.js","assets/dialog-C07hr5_G.js","assets/use-modal-focus-By7oJoGd.js","assets/pencil-768ysRAr.js","assets/plus-DIdX_g-x.js","assets/power-off-Yjw9GMJh.js","assets/refresh-cw-BqJFk4sU.js","assets/route-CNSNj9Zm.js","assets/search-JOKus9rb.js","assets/shield-check-DVS0Foqh.js","assets/settings--3hxSyry.js","assets/trash-Cppn5c3R.js","assets/card-CdsSlWA3.js","assets/download-dRFo5_Wu.js","assets/tokens-COzario9.js","assets/badge-CKsF123d.js","assets/select-C980c4cz.js","assets/ModelPicker-DVny4S5_.js","assets/ProviderIcon-CmfzxpVM.js","assets/switch-Dkke7Naf.js","assets/inline-C9dCYaBZ.js","assets/api-keys-C23S9sgp.js","assets/cli-tools-BaFUuFFF.js","assets/quota-DZGyp0N5.js","assets/UsagePage-BFME-eba.js","assets/drawer-BPO1TcKH.js","assets/circle-check-BU3v_mFW.js","assets/cog-CdWhsajs.js","assets/image-BPaouViG.js","assets/scaling-nWE4Cx8f.js","assets/wrench-B6E1oEuY.js","assets/use-reduced-motion-C4B0R6Sz.js","assets/banner-8j7uChA9.js","assets/privacy-mode-GM8bej85.js","assets/use-timeout-BwcBBRrT.js","assets/live-ta6GMb-8.js","assets/stream-retry-5QnVuSSo.js","assets/ProviderDetailPage-C15x9q13.js","assets/arrow-left-CpBxkoxI.js","assets/brain-Cwed_72z.js","assets/circle-alert-CntYHV5v.js","assets/layers-2-glBbjl.js","assets/rotate-ccw-CufcqITi.js","assets/list-row-CM1AaG_y.js","assets/routing-BPUo-W8d.js","assets/HealthEventsModal-C8MR_BdB.js","assets/AccountCooldown-Bjo92Qat.js","assets/ProvidersPage-Dfb2896L.js","assets/dialog-actions-B1axpEg7.js","assets/CombosPage-6kYIUpzR.js","assets/arrow-right-Dl5yKnp8.js","assets/QuotaPage-BsdoCIw1.js","assets/zap-C4EeVW4q.js","assets/ProxyPage-BaCIdAUt.js","assets/SettingsPage-KVJFh3Ip.js","assets/CliToolsPage-BT3Up3QA.js","assets/ToolIcon-K1ckcDKg.js","assets/CliToolDetailPage-DwOzAW45.js","assets/ConsoleLogPage-zRnj1mlR.js","assets/CustomizationPage-C7m-H1Rz.js","assets/StudioPage-SgQpymjm.js","assets/message-circle-CCxGwRvv.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CXUMngI_.js";import{t as i}from"./index-Bblu6erR.js";import{c as a,l as o,n as s,o as c,r as l,s as u,u as d}from"./app-2KhtHCv9.js";import{i as f,n as p,r as m,t as h}from"./terminal-0_IjPWTk.js";import{C as g,D as _,E as v,O as y,S as b,T as ee,b as x,c as S,d as te,f as C,g as ne,m as re,o as ie,p as ae,s as w,u as oe,v as se,w as ce,x as le,y as ue}from"./numbers-BOevJzdz.js";import{r as de}from"./use-modal-focus-By7oJoGd.js";import{t as fe}from"./dialog-C07hr5_G.js";import{C as T,T as E,_ as pe,c as me,d as he,f as ge,g as _e,h as ve,l as ye,m as be,n as xe,p as Se,r as Ce,s as we,t as Te,v as D,w as Ee}from"./assert-DU6qrMA_.js";import{C as De,D as Oe,E as ke,O,P as Ae,S as je,_ as Me,a as k,b as Ne,c as Pe,d as Fe,f as Ie,g as Le,i as A,j as Re,k as ze,l as j,o as M,r as Be,t as N,v as P,w as Ve,y as He}from"./query-keys-UETqfytp.js";import{t as Ue}from"./mutation-g_fduiNw.js";import{t as F}from"./useMutation-EDFRkn1i.js";import{t as We}from"./dialog-actions-B1axpEg7.js";var Ge=e(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Ke=e(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),qe=e(`coffee`,[[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M14 2v2`,key:`6buw04`}],[`path`,{d:`M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1`,key:`pwadti`}],[`path`,{d:`M6 2v2`,key:`colzsn`}]]),Je=e(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Ye=e(`external-link`,[[`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`}]]),Xe=e(`hand-heart`,[[`path`,{d:`M11 14h2a2 2 0 0 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 16`,key:`1v1a37`}],[`path`,{d:`m14.45 13.39 5.05-4.694C20.196 8 21 6.85 21 5.75a2.75 2.75 0 0 0-4.797-1.837.276.276 0 0 1-.406 0A2.75 2.75 0 0 0 11 5.75c0 1.2.802 2.248 1.5 2.946L16 11.95`,key:`fhfbnt`}],[`path`,{d:`m2 15 6 6`,key:`10dquu`}],[`path`,{d:`m7 20 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a1 1 0 0 0-2.75-2.91`,key:`1x6kdw`}]]),Ze=e(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Qe=e(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),$e=e(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),et=e(`memory-stick`,[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]),tt=e(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),nt=e(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),rt=e(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),it=e(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),at=e(`qr-code`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),ot=e(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),st=e(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),ct=e(`server`,[[`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`}]]),lt=e(`settings`,[[`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`}]]),ut=e(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),dt=e(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),ft=e(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]);function pt(e){let t;if(e.then(e=>(t=e,e),O)?.catch?.(O),t!==void 0)return{data:t}}function mt(e){return{mutationKey:e.options.mutationKey,state:e.state,...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:e.meta}}}function ht(e,t,n){let r=e.promise?.then(t).catch(e=>n?.(e)===!1?Promise.reject(e):Promise.reject(Error(`redacted`)));return r?.catch(O),r}function gt(e,t,n){return{dehydratedAt:Date.now(),state:{...e.state,...e.state.data!==void 0&&{data:t?t(e.state.data):e.state.data}},queryKey:e.queryKey,queryHash:e.queryHash,...e.state.status===`pending`&&{promise:ht(e,t,n)},...e.meta&&{meta:e.meta},...e.queryType&&{queryType:e.queryType}}}function _t(e){return e.state.isPaused}function vt(e){return e.state.status===`success`}function yt(e,t={}){let n=t.shouldDehydrateMutation??e.getDefaultOptions().dehydrate?.shouldDehydrateMutation??_t,r=e.getMutationCache().getAll().flatMap(e=>n(e)?[mt(e)]:[]),i=t.shouldDehydrateQuery??e.getDefaultOptions().dehydrate?.shouldDehydrateQuery??vt,a=t.shouldRedactErrors??e.getDefaultOptions().dehydrate?.shouldRedactErrors,o=t.serializeData??e.getDefaultOptions().dehydrate?.serializeData;return{mutations:r,queries:e.getQueryCache().getAll().flatMap(e=>i(e)?[gt(e,o,a)]:[])}}function bt(e,t,n){let r=e.getMutationCache(),i=e.getQueryCache(),a=n?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData;t.mutations?.forEach(({state:t,...i})=>{r.build(e,{...e.getDefaultOptions().hydrate?.mutations,...n?.defaultOptions?.mutations,...i},t)}),t.queries?.forEach(({queryKey:t,state:r,queryHash:o,meta:s,promise:c,dehydratedAt:l,queryType:u})=>{let d=c?pt(c):void 0,f=r.data===void 0?d?.data:r.data,p=f===void 0?f:a?a(f):f,m=i.get(o),h=m?.state.status===`pending`,g=m?.state.fetchStatus===`fetching`;if(m){let e=d&&l!==void 0&&l>m.state.dataUpdatedAt;if(r.dataUpdatedAt>m.state.dataUpdatedAt||e){let{fetchStatus:e,...t}=r;m.setState({...t,data:p,...r.status===`pending`&&p!==void 0&&{status:`success`,dataUpdatedAt:l??Date.now(),...!g&&{fetchStatus:`idle`}}})}}else m=i.build(e,{...e.getDefaultOptions().hydrate?.queries,...n?.defaultOptions?.queries,queryKey:t,queryHash:o,meta:s,_type:u},{...r,data:p,fetchStatus:`idle`,status:r.status===`pending`&&p!==void 0?`success`:r.status,...r.status===`pending`&&p!==void 0&&{dataUpdatedAt:l??Date.now()}});c&&!d&&!h&&!g&&(l===void 0||l>m.state.dataUpdatedAt)&&m.fetch(void 0,{initialPromise:Promise.resolve(c).then(a)}).catch(O)})}var xt=class extends Ne{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Ue({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=St(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=St(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=St(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=St(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){P.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ke(t,e))}findAll(e={}){return this.getAll().filter(t=>ke(e,t))}notify(e){P.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return P.batch(()=>Promise.all(e.map(e=>e.continue().catch(O))))}};function St(e){return e.options.scope?.id}var Ct=class extends Ne{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Ve(r,t),a=this.get(i);return a||(a=new Ie({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){P.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Oe(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Oe(e,t)):t}notify(e){P.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){P.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){P.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},wt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ct,this.#t=e.mutationCache||new xt,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=He.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Me.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Re(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=je(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return P.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;P.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return P.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=P.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(O).catch(O)}invalidateQueries(e,t={}){return P.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=P.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(O)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(O)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Re(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Re(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(O).catch(O)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(O).catch(O)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Me.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(De(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ze(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(De(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ze(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Ve(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Ae&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},I=t(n(),1),Tt=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Et=/^[\\/]{2}/;function Dt(e,t){return t+e.replace(/\\/g,`/`)}var Ot=`popstate`;function kt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function At(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return Nt(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:z(t)}return Ft(t,n,null,e)}function L(e,t){if(e===!1||e==null)throw Error(t)}function R(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function jt(){return Math.random().toString(36).substring(2,10)}function Mt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Nt(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Pt(t):t,state:n,key:t&&t.key||r||jt(),mask:i}}function z({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function Pt(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Ft(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=kt(e)?e:Nt(h.location,e,t);n&&n(r,e),l=u()+1;let d=Mt(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=kt(e)?e:Nt(h.location,e,t);n&&n(r,e),l=u();let i=Mt(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return It(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(Ot,d),c=e,()=>{i.removeEventListener(Ot,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function It(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),L(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:z(t);return i=i.replace(/ $/,`%20`),!n&&Et.test(i)&&(i=r+i),new URL(i,r)}function Lt(e,t,n=`/`){return Rt(e,t,n,!1)}function Rt(e,t,n,r,i){let a=B((typeof t==`string`?Pt(t):t).pathname||`/`,n);if(a==null)return null;let o=i??zt(e),s=null,c=nn(a);for(let e=0;s==null&&e<o.length;++e)s=Qt(o[e],c,r);return s}function zt(e){let t=Bt(e);return Ht(t),t}function Bt(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;L(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=V([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(L(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Bt(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:Xt(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=tn(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Vt(e.path))a(e,t,!0,n)}),t}function Vt(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Vt(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Ht(e){e.sort((e,t)=>e.score===t.score?Zt(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Ut=/^:[\w-]+$/,Wt=3,Gt=2,Kt=1,qt=10,Jt=-2,Yt=e=>e===`*`;function Xt(e,t){let n=e.split(`/`),r=n.length;return n.some(Yt)&&(r+=Jt),t&&(r+=Gt),n.filter(e=>!Yt(e)).reduce((e,t)=>e+(Ut.test(t)?Wt:t===``?Kt:qt),r)}function Zt(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Qt(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?en(u,l,s.matcher,s.compiledParams):$t(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=$t({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:V([a,d.pathname]),pathnameBase:fn(V([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=V([a,d.pathnameBase]))}return o}function $t(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=tn(e.path,e.caseSensitive,e.end);return en(e,t,n,r)}function en(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=dn(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=dn(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function tn(e,t=!1,n=!0){R(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function nn(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return R(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function B(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function rn(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Pt(e):e,a;return n?(n=un(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?an(n.substring(1),`/`):an(n,t)):a=t,{pathname:a,search:pn(r),hash:mn(i)}}function an(e,t){let n=dn(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function on(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function sn(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function cn(e){let t=sn(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function ln(e,t,n,r=!1){let i;typeof e==`string`?i=Pt(e):(i={...e},L(!i.pathname||!i.pathname.includes(`?`),on(`?`,`pathname`,`search`,i)),L(!i.pathname||!i.pathname.includes(`#`),on(`#`,`pathname`,`hash`,i)),L(!i.search||!i.search.includes(`#`),on(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=rn(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var un=e=>e.replace(/[\\/]{2,}/g,`/`),V=e=>un(e.join(`/`));function dn(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var fn=e=>dn(e).replace(/^\/*/,`/`),pn=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,mn=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,hn=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function gn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function _n(e){return V(e.map(e=>e.route.path).filter(Boolean))||`/`}var vn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function yn(e,t){let n=e;if(typeof n!=`string`||!Tt.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(vn)try{let e=new URL(window.location.href),r=Et.test(n)?new URL(Dt(n,e.protocol)):new URL(n),a=B(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{R(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var bn=new URL(`http://localhost`);function xn(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),bn)}catch{return bn}}function Sn(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function Cn(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function wn(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!Sn(i,n),s=!Sn(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!Cn(e,i)||!Sn(i,a)))throw Error(`External navigation is not allowed`)}var Tn=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Tn);var En=[`GET`,...Tn];new Set(En);var Dn=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function On(e){try{return Dn.includes(new URL(e).protocol)}catch{return!1}}var kn=I.createContext(null);kn.displayName=`DataRouter`;var An=I.createContext(null);An.displayName=`DataRouterState`;var jn=I.createContext(!1);function Mn(){return I.useContext(jn)}var Nn=I.createContext({isTransitioning:!1});Nn.displayName=`ViewTransition`;var Pn=I.createContext(new Map);Pn.displayName=`Fetchers`;var Fn=I.createContext(null);Fn.displayName=`Await`;var H=I.createContext(null);H.displayName=`Navigation`;var In=I.createContext(null);In.displayName=`Location`;var U=I.createContext({outlet:null,matches:[],isDataRoute:!1});U.displayName=`Route`;var Ln=I.createContext(null);Ln.displayName=`RouteError`;var Rn=`REACT_ROUTER_ERROR`,zn=`REDIRECT`,Bn=`ROUTE_ERROR_RESPONSE`;function Vn(e){if(e.startsWith(`${Rn}:${zn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Hn(e){if(e.startsWith(`${Rn}:${Bn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new hn(t.status,t.statusText,t.data)}catch{}}function Un(e,{relative:t}={}){L(Wn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=I.useContext(H),{hash:i,pathname:a,search:o}=Yn(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:V([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Wn(){return I.useContext(In)!=null}function W(){return L(Wn(),`useLocation() may be used only in the context of a <Router> component.`),I.useContext(In).location}var Gn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Kn(e){I.useContext(H).static||I.useLayoutEffect(e)}function G(){let{isDataRoute:e}=I.useContext(U);return e?fr():qn()}function qn(){L(Wn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=I.useContext(kn),{basename:t,navigator:n}=I.useContext(H),{matches:r}=I.useContext(U),{pathname:i}=W(),a=JSON.stringify(cn(r)),o=I.useRef(!1);return Kn(()=>{o.current=!0}),I.useCallback((r,s={})=>{if(R(o.current,Gn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=ln(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:V([t,c.pathname])),wn(typeof r==`string`?r:z(r),n.createHref(c),xn(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}I.createContext(null);function Jn(){let{matches:e}=I.useContext(U);return e[e.length-1]?.params??{}}function Yn(e,{relative:t}={}){let{matches:n}=I.useContext(U),{pathname:r}=W(),i=JSON.stringify(cn(n));return I.useMemo(()=>ln(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Xn(e,t){return Zn(e,t)}function Zn(e,t,n){L(Wn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=I.useContext(H),{matches:i}=I.useContext(U),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;mr(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
3
+
4
+ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=W(),d;if(t){let e=typeof t==`string`?Pt(t):t;L(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):Lt(e,{pathname:p});R(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),R(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=ir(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:V([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:V([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?I.createElement(In.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function Qn(){let e=dr(),t=gn(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=I.createElement(I.Fragment,null,I.createElement(`p`,null,`💿 Hey developer 👋`),I.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,I.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,I.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),I.createElement(I.Fragment,null,I.createElement(`h2`,null,`Unexpected Application Error!`),I.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?I.createElement(`pre`,{style:i},n):null,o)}var $n=I.createElement(Qn,null),er=class extends I.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Hn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:I.createElement(U.Provider,{value:this.props.routeContext},I.createElement(Ln.Provider,{value:e,children:this.props.component}));return this.context?I.createElement(nr,{error:e},t):t}};er.contextType=jn;var tr=new WeakMap;function nr({children:e,error:t}){let{basename:n,navigator:r}=I.useContext(H);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Vn(t.digest);if(e){let i=tr.get(t);if(i)throw i;let a=yn(e.location,n),o=a.absoluteURL||a.to;if(wn(e.location,o,xn(r),`allow-explicit`),On(o))throw Error(`Invalid redirect location`);if(vn&&!tr.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw tr.set(t,n),n}}return I.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function rr({routeContext:e,match:t,children:n}){let r=I.useContext(kn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),I.createElement(U.Provider,{value:e},n)}function ir(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);L(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:_n(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||$n,o&&(s<0&&c===0?(mr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?I.createElement(n.route.Component,null):n.route.element?n.route.element:e,I.createElement(rr,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?I.createElement(er,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function ar(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function or(e){let t=I.useContext(kn);return L(t,ar(e)),t}function sr(e){let t=I.useContext(An);return L(t,ar(e)),t}function cr(e){let t=I.useContext(U);return L(t,ar(e)),t}function lr(e){let t=cr(e),n=t.matches[t.matches.length-1];return L(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ur(){return lr(`useRouteId`)}function dr(){let e=I.useContext(Ln),t=sr(`useRouteError`),n=lr(`useRouteError`);return e===void 0?t.errors?.[n]:e}function fr(){let{router:e}=or(`useNavigate`),t=lr(`useNavigate`),n=I.useRef(!1);return Kn(()=>{n.current=!0}),I.useCallback(async(r,i={})=>{R(n.current,Gn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var pr={};function mr(e,t,n){!t&&!pr[e]&&(pr[e]=!0,R(!1,n))}I.memo(hr);function hr({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Zn(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function gr({to:e,replace:t,state:n,relative:r}){L(Wn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=I.useContext(H);R(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=I.useContext(U),{pathname:s}=W(),c=G(),l=ln(e,cn(o),s,r===`path`);wn(typeof e==`string`?e:z(e),a.createHref(l),xn(a),`reject`);let u=JSON.stringify(l);return I.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function K(e){L(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function _r({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){L(!Wn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=I.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=Pt(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=I.useMemo(()=>{let e=B(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return R(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:I.createElement(H.Provider,{value:c},I.createElement(In.Provider,{children:t,value:h}))}function vr({children:e,location:t}){return Xn(yr(e),t)}I.Component;function yr(e,t=[]){let n=[];return I.Children.forEach(e,(e,r)=>{if(!I.isValidElement(e))return;let i=[...t,r];if(e.type===I.Fragment){n.push.apply(n,yr(e.props.children,i));return}L(e.type===K,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),L(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=yr(e.props.children,i)),n.push(a)}),n}var br=`get`,xr=`application/x-www-form-urlencoded`;function Sr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Cr(e){return Sr(e)&&e.tagName.toLowerCase()===`button`}function wr(e){return Sr(e)&&e.tagName.toLowerCase()===`form`}function Tr(e){return Sr(e)&&e.tagName.toLowerCase()===`input`}function Er(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Dr(e,t){return e.button===0&&(!t||t===`_self`)&&!Er(e)}function Or(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function kr(e,t){let n=Or(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Ar=null;function jr(){if(Ar===null)try{new FormData(document.createElement(`form`),0),Ar=!1}catch{Ar=!0}return Ar}var Mr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Nr(e){return e!=null&&!Mr.has(e)?(R(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${xr}"`),null):e}function Pr(e,t){let n,r,i,a,o;if(wr(e)){let o=e.getAttribute(`action`);r=o?B(o,t):null,n=e.getAttribute(`method`)||br,i=Nr(e.getAttribute(`enctype`))||xr,a=new FormData(e)}else if(Cr(e)||Tr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?B(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||br,i=Nr(e.getAttribute(`formenctype`))||Nr(o.getAttribute(`enctype`))||xr,a=new FormData(o,e),!jr()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Sr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=br,r=null,i=xr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Fr(e,t){if(e===!1||e==null)throw Error(t)}function Ir(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&B(i.pathname,t)===`/`?`${dn(t)}/_root.${r}`:`${dn(i.pathname)}.${r}`,i}async function Lr(e,t){if(e.id in t)return t[e.id];try{let n=await i(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Rr(e){return e!=null&&typeof e.page==`string`}function zr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Br(e,t,n){return Gr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Lr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(zr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Vr(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Hr(e,t,{includeHydrateFallback:n}={}){return Ur(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Ur(e){return[...new Set(e)]}function Wr(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Gr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Rr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Wr(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Kr(){let e=I.useContext(kn);return Fr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function qr(){let e=I.useContext(An);return Fr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Jr=I.createContext(void 0);Jr.displayName=`FrameworkContext`;function Yr(){let e=I.useContext(Jr);return Fr(e,`You must render this element inside a <HydratedRouter> element`),e}function Xr(e,t){let n=I.useContext(Jr),[r,i]=I.useState(!1),[a,o]=I.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=I.useRef(null);I.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),I.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Zr(s,p),onBlur:Zr(c,m),onMouseEnter:Zr(l,p),onMouseLeave:Zr(u,m),onTouchStart:Zr(d,p)}]:[a,f,{}]:[!1,f,{}]}function Zr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Qr({page:e,...t}){let n=Mn(),{nonce:r}=Yr(),{router:i}=Kr(),a=I.useMemo(()=>Lt(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?I.createElement(ei,{page:e,matches:a,...t}):I.createElement(ti,{page:e,matches:a,...t})):null}function $r(e){let{manifest:t,routeModules:n}=Yr(),[r,i]=I.useState([]);return I.useEffect(()=>{let r=!1;return Br(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function ei({page:e,matches:t,...n}){let r=W(),{future:i}=Yr(),{basename:a}=Kr(),o=I.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Ir(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return I.createElement(I.Fragment,null,o.map(e=>I.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function ti({page:e,matches:t,...n}){let r=W(),{future:i,manifest:a,routeModules:o}=Yr(),{basename:s}=Kr(),{loaderData:c,matches:l}=qr(),u=I.useMemo(()=>Vr(e,t,l,a,r,`data`),[e,t,l,a,r]),d=I.useMemo(()=>Vr(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=I.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];t&&t.hasLoader&&(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Ir(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=I.useMemo(()=>Hr(d,a),[d,a]),m=$r(d);return I.createElement(I.Fragment,null,f.map(e=>I.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>I.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>I.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function ni(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}I.Component;var ri=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{ri&&(window.__reactRouterVersion=`7.18.3`)}catch{}function ii({basename:e,children:t,useTransitions:n,window:r}){let i=I.useRef();i.current??=At({window:r,v5Compat:!0});let a=i.current,[o,s]=I.useState({action:a.action,location:a.location}),c=I.useCallback(e=>{n===!1?s(e):I.startTransition(()=>s(e))},[n]);return I.useLayoutEffect(()=>a.listen(c),[a,c]),I.createElement(_r,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var ai=I.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=I.useContext(H),v=typeof l==`string`&&Tt.test(l),y=yn(l,h);l=y.to;let b=Un(l,{relative:r}),ee=W(),x=null;if(o){let e=ln(o,[],ee.mask?ee.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:V([h,e.pathname])),x=g.createHref(e)}let[S,te,C]=Xr(n,p),ne=ui(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function re(t){e&&e(t),t.defaultPrevented||ne(t)}let ie=!(y.isExternal||i),ae=I.createElement(`a`,{...p,...C,href:(ie?x:void 0)||y.absoluteURL||b,onClick:ie?re:e,ref:ni(m,te),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return S&&!v?I.createElement(I.Fragment,null,ae,I.createElement(Qr,{page:b})):ae});ai.displayName=`Link`;var oi=I.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Yn(a,{relative:c.relative}),d=W(),f=I.useContext(An),{navigator:p,basename:m}=I.useContext(H),h=f!=null&&gi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=B(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,ee=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),x={isActive:b,isPending:ee,isTransitioning:h},S=b?e:void 0,te;te=typeof n==`function`?n(x):[n,b?`active`:null,ee?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let C=typeof i==`function`?i(x):i;return I.createElement(ai,{...c,"aria-current":S,className:te,ref:l,style:C,to:a,viewTransition:o},typeof s==`function`?s(x):s)});oi.displayName=`NavLink`;var si=I.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=br,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=I.useContext(H),g=mi(),_=hi(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&Tt.test(s);return I.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?I.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});si.displayName=`Form`;function ci(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function li(e){let t=I.useContext(kn);return L(t,ci(e)),t}function ui(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=G(),d=W(),f=Yn(e,{relative:o});return I.useCallback(p=>{if(Dr(p,t)){p.preventDefault();let t=n===void 0?z(d)===z(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?I.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function di(e){R(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=I.useRef(Or(e)),n=I.useRef(!1),r=W(),i=I.useMemo(()=>kr(r.search,n.current?null:t.current),[r.search]),a=G();return[i,I.useCallback((e,t)=>{let r=Or(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var fi=0,pi=()=>`__${String(++fi)}__`;function mi(){let{router:e}=li(`useSubmit`),{basename:t}=I.useContext(H),n=ur(),r=e.fetch,i=e.navigate;return I.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Pr(e,t);if(a.navigate===!1){let e=a.fetcherKey||pi();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function hi(e,{relative:t}={}){let{basename:n}=I.useContext(H),r=I.useContext(U);L(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Yn(e||`.`,{relative:t})},o=W();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:V([n,a.pathname])),z(a)}function gi(e,{relative:t}={}){let n=I.useContext(Nn);L(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=li(`useViewTransitionState`),i=Yn(e,{relative:t});if(!n.isTransitioning)return!1;let a=B(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=B(n.nextLocation.pathname,r)||n.nextLocation.pathname;return $t(i.pathname,o)!=null||$t(i.pathname,a)!=null}var _i=o(),q=r(),vi=`https://saweria.co/risuncode`,yi=`/donation/qris-risun-marke.png`,bi=[{id:`en`,label:`EN`,name:`English`},{id:`id`,label:`ID`,name:`Bahasa Indonesia`},{id:`zh`,label:`中文`,name:`简体中文`},{id:`ja`,label:`日本語`,name:`日本語`}];function xi(){let[e,t]=(0,I.useState)(!1),[n,r]=(0,I.useState)(`en`),i=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(!e)return;let n=e=>{i.current?.contains(e.target)||t(!1)},r=e=>{e.key===`Escape`&&t(!1)};return document.addEventListener(`mousedown`,n),document.addEventListener(`keydown`,r),()=>{document.removeEventListener(`mousedown`,n),document.removeEventListener(`keydown`,r)}},[e]);let a=bi.find(e=>e.id===n)??bi[0];return(0,q.jsxs)(`div`,{className:`relative`,ref:i,children:[(0,q.jsx)(`button`,{type:`button`,className:`topbar-icon-button`,"aria-haspopup":`menu`,"aria-expanded":e,"aria-label":`Change language — ${a.name}`,title:`Change language (coming soon)`,onClick:()=>t(e=>!e),children:(0,q.jsx)(Ze,{size:14,"aria-hidden":`true`})}),e?(0,q.jsxs)(`div`,{role:`menu`,className:`app-topbar-popover popout-enter glass absolute right-0 top-full z-popover mt-2 min-w-44 rounded-sidebar border border-inner-border bg-popover-bg p-2 shadow-popout`,children:[bi.map(e=>(0,q.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`flex w-full items-center justify-between gap-3 rounded-inset px-3 py-2 text-left text-body text-text-secondary hover:bg-hover-bg hover:text-text-primary`,onClick:()=>{r(e.id),t(!1)},children:[(0,q.jsx)(`span`,{children:e.name}),e.id===n?(0,q.jsx)(`span`,{className:`text-accent-text`,children:`✓`}):null]},e.id)),(0,q.jsx)(`p`,{className:`px-3 pb-1 pt-2 text-badge leading-snug text-text-tertiary`,children:`Translations are not wired up yet — the console stays in English for now.`})]}):null]})}function Si({open:e,onClose:t}){return(0,q.jsx)(fe,{open:e,onClose:t,title:`Buy me a coffee`,description:`Support Cartethyia development via QRIS or Saweria.`,size:`lg`,footer:(0,q.jsxs)(We,{children:[(0,q.jsxs)(`a`,{href:yi,download:`qris-risun-marke.png`,className:`flex items-center gap-1.5 rounded-inset border border-inner-border px-3 py-2 text-body text-text-secondary hover:bg-hover-bg hover:text-text-primary`,children:[(0,q.jsx)(ee,{size:14,"aria-hidden":`true`}),`Save QR`]}),(0,q.jsxs)(`a`,{href:vi,target:`_blank`,rel:`noreferrer noopener`,className:`flex items-center gap-1.5 rounded-inset bg-accent-bg px-4 py-2 text-body font-semibold text-accent-text hover:opacity-90`,children:[(0,q.jsx)(qe,{size:14,"aria-hidden":`true`}),`Donate via Saweria`,(0,q.jsx)(Ye,{size:12,"aria-hidden":`true`})]})]}),children:(0,q.jsxs)(`div`,{className:`grid grid-cols-1 gap-5 sm:gap-6 donate-qr-grid`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,q.jsx)(`img`,{src:yi,alt:`QRIS payment code for RISUN`,className:`aspect-square w-full donate-qr-image rounded-inset border border-inner-border bg-white object-contain p-2`}),(0,q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-badge text-text-tertiary`,children:[(0,q.jsx)(at,{size:12,"aria-hidden":`true`}),`Scan with any QRIS app`]})]}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-body leading-relaxed text-text-secondary`,children:`Cartethyia is built in the spare hours between everything else — late nights, weekends, and a suspicious number of energy drinks. If it saved you an afternoon of fighting with rate limits, or made your proxy pool behave, a coffee genuinely helps keep the lights on and the commits coming.`}),(0,q.jsxs)(`ul`,{className:`mt-3 flex flex-col gap-1.5 text-caption text-text-secondary`,children:[(0,q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(p,{size:14,className:`mt-0.5 shrink-0 text-accent-text`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:`Keeps late-night debugging sessions fuelled.`})]}),(0,q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(b,{size:14,className:`mt-0.5 shrink-0 text-accent-text`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:`Funds the coffee that funds the next release.`})]})]}),(0,q.jsxs)(`div`,{className:`mt-4 border-t border-inner-border pt-3`,children:[(0,q.jsx)(`p`,{className:`text-badge font-bold uppercase tracking-label text-text-tertiary`,children:`Other ways to support`}),(0,q.jsx)(`ul`,{className:`mt-2 grid grid-cols-1 gap-1.5 sm:grid-cols-2`,children:a.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer noopener`,className:`flex items-center gap-2 rounded-inset border border-inner-border px-3 py-2 text-caption text-text-secondary hover:bg-hover-bg hover:text-text-primary`,children:[e.id===`github-alt`?(0,q.jsx)(dt,{size:12,className:`shrink-0 text-accent-text`,"aria-hidden":`true`}):(0,q.jsx)(Ye,{size:12,className:`shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,q.jsx)(`span`,{className:`ml-auto shrink-0 text-micro text-text-tertiary`,children:e.hint})]})},e.id))})]}),(0,q.jsx)(`p`,{className:`mt-3 text-badge leading-relaxed text-text-tertiary`,children:`No obligation, no paywall, no nagging — the project stays free either way. Thank you for using it. 💙`})]})]})})}function Ci(){let[e,t]=(0,I.useState)(!1);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`topbar-donate-button`,"aria-label":`Support the project`,title:`Buy me a coffee`,onClick:()=>t(!0),children:[(0,q.jsx)(`span`,{className:`text-badge font-bold tracking-wide`,children:`Donate`}),(0,q.jsx)(Xe,{size:14,"aria-hidden":`true`})]}),(0,q.jsx)(xi,{}),(0,q.jsx)(Si,{open:e,onClose:()=>t(!1)})]})}var wi=t(d(),1),Ti=`cartethyia.customization`,J=`media`,Ei=`background`,Di=1,Oi=`/console-backgrounds.jpg`;function ki(){let{promise:e,resolve:t,reject:n}=Promise.withResolvers(),r=indexedDB.open(Ti,Di);return r.onupgradeneeded=()=>{let e=r.result;e.objectStoreNames.contains(J)||e.createObjectStore(J)},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error??Error(`Could not open the media database.`)),e}function Ai(e){let{promise:t,resolve:n,reject:r}=Promise.withResolvers();return e.onsuccess=()=>n(e.result),e.onerror=()=>r(e.error??Error(`The media database rejected the request.`)),t}function ji(e,t){let{promise:n,resolve:r,reject:i}=Promise.withResolvers();return e.oncomplete=()=>r(),e.onerror=()=>i(e.error??Error(t)),n}async function Mi(){let e=await ki();try{let t=await Ai(e.transaction(J,`readonly`).objectStore(J).get(Ei));if(!t||!t.blob)return null;let n=t;return{blob:n.blob,kind:n.kind,url:URL.createObjectURL(n.blob)}}finally{e.close()}}async function Ni(e,t){let n=await ki();try{let r=n.transaction(J,`readwrite`);r.objectStore(J).put({blob:e,kind:t},Ei),await ji(r,`Could not store the background.`)}finally{n.close()}}async function Pi(){let e=await ki();try{let t=e.transaction(J,`readwrite`);t.objectStore(J).delete(Ei),await ji(t,`Could not remove the background.`)}finally{e.close()}}var Fi=2560,Ii=.85;async function Li(e){let t=await createImageBitmap(e).catch(()=>null);if(!t)return e;try{let n=Math.max(t.width,t.height),r=Math.min(1,Fi/n),i=document.createElement(`canvas`);i.width=Math.max(1,Math.round(t.width*r)),i.height=Math.max(1,Math.round(t.height*r));let a=i.getContext(`2d`);return a?(a.drawImage(t,0,0,i.width,i.height),await Bi(i)??e):e}finally{t.close()}}var Ri=4294967296,zi=268435456;function Bi(e){let{promise:t,resolve:n}=Promise.withResolvers();return e.toBlob(e=>n(e),`image/webp`,Ii),t}function Vi(e){return e.type.startsWith(`image/`)?`image`:e.type.startsWith(`video/`)?`video`:null}var Hi=[`none`,`frosted`,`vibrancy`,`heavy`],Y={backgroundSet:!1,backgroundEnabled:!0,backgroundRevision:0,backgroundOpacity:20,backgroundScale:100,backgroundX:0,backgroundY:0,backgroundBlur:5,blurCards:`frosted`,blurChrome:`frosted`,blurCardsAmount:45,blurCardsDepth:20,blurChromeAmount:25,blurChromeDepth:10,blurCardsEnabled:!0,blurChromeEnabled:!0,emptyOutline:!1},Ui=`cartethyia.customization`,Wi=`cartethyia-customization-change`,Gi=[`cards`,`chrome`];function Ki(e){return typeof e==`string`&&Hi.includes(e)}function X(e,t,n,r){let i=typeof e==`number`?e:Number(e);return Number.isFinite(i)?Math.min(n,Math.max(t,i)):r}function qi(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e:{};return{backgroundSet:t.backgroundSet===!0,backgroundRevision:X(t.backgroundRevision,0,2**53-1,0),backgroundEnabled:typeof t.backgroundEnabled==`boolean`?t.backgroundEnabled:Y.backgroundEnabled,backgroundOpacity:X(t.backgroundOpacity,0,100,Y.backgroundOpacity),backgroundScale:X(t.backgroundScale,100,180,Y.backgroundScale),backgroundX:X(t.backgroundX,-100,100,Y.backgroundX),backgroundY:X(t.backgroundY,-100,100,Y.backgroundY),backgroundBlur:X(t.backgroundBlur,0,100,Y.backgroundBlur),blurCards:Ki(t.blurCards)?t.blurCards:Y.blurCards,blurChrome:Ki(t.blurChrome)?t.blurChrome:Y.blurChrome,blurCardsAmount:X(t.blurCardsAmount,0,100,Y.blurCardsAmount),blurChromeAmount:X(t.blurChromeAmount,0,100,Y.blurChromeAmount),blurCardsDepth:X(t.blurCardsDepth,0,100,Y.blurCardsDepth),blurChromeDepth:X(t.blurChromeDepth,0,100,Y.blurChromeDepth),blurCardsEnabled:t.blurCardsEnabled!==!1,blurChromeEnabled:t.blurChromeEnabled!==!1,emptyOutline:t.emptyOutline===!0}}var Ji=null;function Yi(){if(Ji)return Ji;if(typeof window>`u`)return Y;try{Ji=qi(JSON.parse(window.localStorage.getItem(Ui)??`null`))}catch{Ji={...Y}}return Ji}function Xi(e){if(typeof document>`u`)return;let t=document.documentElement;t.dataset.blurCards=e.blurCards,t.dataset.blurChrome=e.blurChrome,t.style.setProperty(`--blur-cards`,`${e.blurCardsAmount}`),t.style.setProperty(`--blur-chrome`,`${e.blurChromeAmount}`),t.style.setProperty(`--blur-cards-depth`,`${e.blurCardsDepth}`),t.style.setProperty(`--blur-chrome-depth`,`${e.blurChromeDepth}`),t.dataset.blurCardsOn=e.blurCardsEnabled?`true`:`false`,t.dataset.blurChromeOn=e.blurChromeEnabled?`true`:`false`,t.dataset.emptyOutline=e.emptyOutline?`true`:`false`,t.dataset.bgActive=e.backgroundEnabled?`true`:`false`,t.style.setProperty(`--bg-opacity`,(e.backgroundOpacity/100).toFixed(2)),t.style.setProperty(`--bg-scale`,(e.backgroundScale/100).toFixed(2)),t.style.setProperty(`--bg-x`,`${e.backgroundX}%`),t.style.setProperty(`--bg-y`,`${e.backgroundY}%`),t.style.setProperty(`--bg-blur`,`${Math.round(e.backgroundBlur*.4)}px`)}function Zi(e){try{window.localStorage.setItem(Ui,JSON.stringify(e))}catch{}}function Qi(e){let t=qi({...Yi(),...e});return Ji=t,typeof window<`u`&&(Zi(t),Xi(t),window.dispatchEvent(new CustomEvent(Wi))),t}function $i(){let[e,t]=(0,I.useState)(Yi);return(0,I.useEffect)(()=>{let e=()=>t(Yi());return window.addEventListener(Wi,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(Wi,e),window.removeEventListener(`storage`,e)}},[]),[e,e=>t(Qi(e))]}var ea=Gi,ta=`(max-width: 767px)`,na=`(prefers-reduced-motion: reduce)`;function ra(e){let[t,n]=(0,I.useState)(()=>typeof window<`u`&&window.matchMedia(e).matches);return(0,I.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function ia(){let[e,t]=(0,I.useState)(()=>typeof document>`u`||!document.hidden);return(0,I.useEffect)(()=>{let e=()=>t(!document.hidden);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e}function aa(){let[e]=$i(),[t,n]=(0,I.useState)(null),r=ra(ta),i=ra(na),a=ia();(0,I.useEffect)(()=>{if(!e.backgroundSet){n(e=>(e&&URL.revokeObjectURL(e.url),{blob:new Blob,kind:`image`,url:Oi}));return}let t=!1,r=null;return Mi().then(e=>{if(t){e&&URL.revokeObjectURL(e.url);return}r=e,n(e)}).catch(()=>{t||n(null)}),()=>{t=!0,r&&URL.revokeObjectURL(r.url)}},[e.backgroundSet,e.backgroundRevision]);let o=(0,I.useRef)(null),s=t?.kind===`video`&&!r&&!i&&a;return(0,I.useEffect)(()=>{let e=o.current;if(e){if(s){e.play().catch(()=>{});return}e.pause()}},[s]),!t||!e.backgroundEnabled?null:(0,q.jsx)(`div`,{className:`custom-background`,"data-kind":t.kind,"data-playing":s?`true`:`false`,"aria-hidden":`true`,children:t.kind===`video`?(0,q.jsx)(`video`,{ref:o,className:`custom-background-media`,src:t.url,autoPlay:s,loop:!0,muted:!0,playsInline:!0,preload:r?`metadata`:`auto`}):(0,q.jsx)(`img`,{className:`custom-background-media`,src:t.url,alt:``})})}function oa({open:e,onClose:t,onConfirm:n,title:r,message:i,confirmLabel:a=`Confirm`,cancelLabel:o=`Cancel`,danger:s}){let[c,l]=(0,I.useState)(null),[u,d]=(0,I.useState)(!1);return(0,I.useEffect)(()=>{e&&(l(null),d(!1))},[e]),(0,q.jsx)(fe,{open:e,onClose:t,title:r,description:i,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-8 py-2 px-0`,children:[(0,q.jsx)(`p`,{className:`text-body text-text-secondary leading-normal`,children:i}),c?(0,q.jsx)(`p`,{role:`alert`,className:`text-caption text-red`,children:c}):null,(0,q.jsxs)(We,{children:[(0,q.jsx)(S,{variant:`secondary`,size:`sm`,onClick:t,disabled:u,children:o}),(0,q.jsx)(S,{variant:s?`danger`:`primary`,size:`sm`,onClick:()=>{u||(l(null),d(!0),Promise.resolve().then(()=>n()).then(()=>t()).catch(e=>{l(j(e,`Action failed. Please try again.`)),d(!1)}))},disabled:u,children:u?`Working…`:a})]})]})})}var sa={plain:`code-chip-plain`,muted:`code-chip-muted text-text-secondary bg-surface-muted border border-inner-border px-4 py-1 rounded-chip`,accent:`code-chip-accent text-accent bg-accent-soft px-4 py-1.5 rounded-chip font-bold`};function ca({value:e,tone:t=`muted`,action:n,className:r=``,children:i,...a}){return(0,q.jsxs)(`span`,{className:re(`code-chip inline-flex items-center gap-3 min-w-0 max-w-full font-mono text-caption tabular-nums`,sa[t],r),...a,children:[(0,q.jsx)(`code`,{className:`code-chip-value min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,title:a.title??e,children:e}),n?(0,q.jsx)(`span`,{className:`code-chip-action inline-flex shrink-0`,children:n}):null,i]})}var la=`cartethyia:update-dismissed`;function ua(){try{return window.localStorage.getItem(la)}catch{return null}}function da(e){try{window.localStorage.setItem(la,e)}catch{}}function fa(){let[e,t]=(0,I.useState)(!1);return{copied:e,copy:e=>{navigator.clipboard?.writeText(e),t(!0),window.setTimeout(()=>t(!1),1500)}}}function pa({open:e,onClose:t,currentVersion:n,latestVersion:r,releaseUrl:i,onDismissVersion:a,onUpdateNow:o,updating:l=!1}){let{copied:d,copy:f}=fa(),p=r??`the latest release`;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(fe,{open:e,onClose:t,title:`Update available`,description:`Cartethyia ${p} is available; this install runs ${n}.`,size:`md`,footer:(0,q.jsxs)(We,{children:[a===void 0?(0,q.jsx)(S,{variant:`ghost`,onClick:t,children:`Later`}):(0,q.jsxs)(S,{variant:`ghost`,onClick:()=>{a?.(),t()},children:[`Don’t show for v`,p]}),o===void 0?null:(0,q.jsxs)(S,{onClick:o,disabled:l,children:[l?(0,q.jsx)(le,{size:14,className:`animate-spin`,"aria-hidden":`true`}):null,l?`Updating…`:`Update now`]}),(0,q.jsxs)(S,{onClick:()=>f(u),disabled:l,children:[d?(0,q.jsx)(y,{size:14,"aria-hidden":`true`}):(0,q.jsx)(v,{size:14,"aria-hidden":`true`}),d?`Copied`:`Copy update command`]})]}),children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-8 py-2 px-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-6`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 grid size-12 shrink-0 place-items-center rounded-control bg-surface-1 text-text-secondary`,children:(0,q.jsx)(rt,{size:16,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsxs)(`p`,{className:`font-semibold text-caption`,children:[n,` → `,p]}),(0,q.jsx)(`p`,{className:`text-badge text-text-secondary mt-1`,children:`Stop the gateway, run the command, then start again.`})]})]}),(0,q.jsxs)(`div`,{className:`rounded-card border border-inner-border bg-surface-2 p-4`,children:[(0,q.jsx)(`p`,{className:`text-badge text-text-tertiary`,children:`Run this in a terminal`}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center gap-4 min-w-0`,children:[(0,q.jsx)(ca,{value:u,tone:`muted`,title:u,className:`min-w-0 flex-1 truncate`}),(0,q.jsx)(S,{variant:`ghost`,size:`sm`,className:`shrink-0`,onClick:()=>f(u),"aria-label":`Copy the update command`,children:d?(0,q.jsx)(y,{size:14,"aria-hidden":`true`}):(0,q.jsx)(v,{size:14,"aria-hidden":`true`})})]})]}),(0,q.jsxs)(`div`,{className:`flex items-start gap-6 rounded-card border border-inner-border bg-surface-2 p-4`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 shrink-0 text-text-secondary`,children:(0,q.jsx)(se,{size:14,"aria-hidden":`true`})}),(0,q.jsx)(`p`,{className:`text-badge text-text-secondary min-w-0`,children:`npm cannot replace the package while Cartethyia is running from it, so this cannot update itself the way a single-binary tool can. That is why the console gives you the command instead of a button that installs.`})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,q.jsxs)(`a`,{href:i??s,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-2 text-badge text-accent hover:underline`,children:[(0,q.jsx)(Ye,{size:12,"aria-hidden":`true`}),`What’s new on GitHub`]}),(0,q.jsxs)(`a`,{href:c,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-2 text-badge text-accent hover:underline`,children:[(0,q.jsx)(Ye,{size:12,"aria-hidden":`true`}),`Package on npm`]})]})]})}),l?(0,q.jsx)(`div`,{className:`fixed inset-0 z-toast grid place-items-center bg-black/70 backdrop-blur-sm`,children:(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-white`,children:[(0,q.jsx)(le,{size:40,className:`animate-spin`,"aria-hidden":`true`}),(0,q.jsx)(`p`,{className:`text-lg font-semibold`,children:`Updating Cartethyia…`}),(0,q.jsx)(`p`,{className:`text-sm opacity-80`,children:`Do not refresh or close this page.`})]})}):null]})}var ma=`cartethyia.query-cache`,Z=`client`,ha=`default`,ga=1;function _a(){let{promise:e,resolve:t,reject:n}=Promise.withResolvers(),r=indexedDB.open(ma,ga);return r.onupgradeneeded=()=>{let e=r.result;e.objectStoreNames.contains(Z)||e.createObjectStore(Z)},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error??Error(`Could not open the query cache.`)),e}function va(e){let{promise:t,resolve:n,reject:r}=Promise.withResolvers();return e.onsuccess=()=>n(e.result),e.onerror=()=>r(e.error??Error(`The query cache rejected the request.`)),t}function ya(e,t){let{promise:n,resolve:r,reject:i}=Promise.withResolvers();return e.oncomplete=()=>r(),e.onerror=()=>i(e.error??Error(t)),n}function ba(e){if(typeof e!=`object`||!e||!(`version`in e)||!(`state`in e))return!1;let{version:t,state:n}=e;return t===1&&typeof n==`object`&&!!n}async function xa(e){try{let t=await _a();try{let n=t.transaction(Z,`readwrite`);n.objectStore(Z).put({version:1,state:e},ha),await ya(n,`Could not store the query cache.`)}finally{t.close()}}catch{}}async function Sa(){try{let e=await _a();try{let t=await va(e.transaction(Z,`readonly`).objectStore(Z).get(ha));return ba(t)?t.state:void 0}finally{e.close()}}catch{return}}async function Ca(){try{let e=await _a();try{let t=e.transaction(Z,`readwrite`);t.objectStore(Z).delete(ha),await ya(t,`Could not remove the query cache.`)}finally{e.close()}}catch{}}var Q=new wt({defaultOptions:{queries:A,mutations:Be}});function wa(e){let[t,n,r]=e.queryKey;return t===`console`?n===`session`?!0:n===`providers`?r===void 0||e.queryKey[3]===`models`:n===`settings`?r===`runtime`:n===`cli-tools`&&r===`registry`:!1}async function Ta(){let e=await Sa();e!==void 0&&bt(Q,e)}function Ea(){Ca()}function Da(){let e,t=Q.getQueryCache().subscribe(t=>{t.type===`updated`&&(t.action.type===`success`||t.action.type===`error`)&&e===void 0&&(e=setTimeout(()=>{e=void 0,xa(yt(Q,{shouldDehydrateQuery:wa}))},2e3))});return()=>{e!==void 0&&clearTimeout(e),t()}}function Oa(e){let[t,n]=(e.trim().replace(/^v/i,``).split(`+`,1)[0]??``).split(`-`,2);if(t===void 0||!/^\d+\.\d+\.\d+$/.test(t))return null;let r=t.split(`.`).map(Number);if(r.length!==3||r.some(e=>!Number.isSafeInteger(e)||e<0))return null;let i=n===void 0||n.length===0?[]:n.split(`.`).map(e=>/^\d+$/.test(e)?Number(e):e);return i.some(e=>typeof e==`number`&&(!Number.isSafeInteger(e)||e<0))?null:{core:[r[0]??0,r[1]??0,r[2]??0],prerelease:i}}function ka(e,t){if(e===void 0||t===void 0)return!1;let n=Oa(e),r=Oa(t);return n===null||r===null?t.trim()!==e.trim():Aa(r,n)>0}function Aa(e,t){for(let n=0;n<e.core.length;n+=1){let r=e.core[n]??0,i=t.core[n]??0;if(r!==i)return r>i?1:-1}if(e.prerelease.length===0&&t.prerelease.length>0)return 1;if(e.prerelease.length>0&&t.prerelease.length===0)return-1;for(let n=0;n<Math.max(e.prerelease.length,t.prerelease.length);n+=1){let r=e.prerelease[n],i=t.prerelease[n];if(r===void 0)return-1;if(i===void 0)return 1;if(r!==i)return typeof r==`number`&&typeof i==`string`?-1:typeof r==`string`&&typeof i==`number`||r>i?1:-1}return 0}var ja=5e3,Ma=new WeakMap,Na={"/":[{queryKey:N.settings.runtime,read:e=>M(`/settings/runtime`,{signal:e})},{queryKey:N.apiKeys.all,read:e=>M(`/api-keys`,{signal:e}).then(Te)}],"/providers":[{queryKey:N.providers.all,read:e=>M(`/providers`,{signal:e}).then(he)}],"/proxy":[{queryKey:N.network.pools,read:e=>M(`/network/pools`,{signal:e}).then(me)}]};function Pa(e,t){let n=Na[t];if(n===void 0)return Promise.resolve();let r=Date.now(),i=Ma.get(e);if(i!==void 0){if(i>r)return Promise.resolve();Ma.delete(e)}return Promise.allSettled(n.map(t=>e.fetchQuery({queryKey:t.queryKey,queryFn:e=>t.read(D(e)),...A}))).then(t=>{if(t.some(e=>e.status===`rejected`&&!Le(e.reason))){Ma.set(e,Date.now()+ja);return}Ma.delete(e)})}var Fa=3e3,Ia=20;function La(e){if(typeof e!=`object`||!e)return;let t=e;if(!(typeof t.id!=`string`||typeof t.title!=`string`||typeof t.message!=`string`||typeof t.createdAt!=`string`||t.kind!==`memory-high`&&t.kind!==`memory-growth`&&t.kind!==`update-available`||t.level!==`warning`&&t.level!==`info`))return{id:t.id,kind:t.kind,title:t.title,message:t.message,createdAt:t.createdAt,level:t.level,...t.href===l?{href:t.href}:{}}}function Ra(){let[e,t]=(0,I.useState)([]);return(0,I.useEffect)(()=>{let e=!0,n,r,i=()=>{e&&(n=new EventSource(`/console/api/notifications/stream`),n.addEventListener(`notification`,n=>{let r;try{r=JSON.parse(n.data)}catch{return}let i=La(r);i&&e&&t(e=>[i,...e.filter(e=>e.id!==i.id)].slice(0,Ia))}),n.onerror=()=>{n?.close(),n=void 0,e&&r===void 0&&(r=setTimeout(()=>{r=void 0,i()},Fa))})};return i(),()=>{e=!1,n?.close(),clearTimeout(r)}},[]),e}function za(){return T({queryKey:N.session.current,queryFn:()=>Pe(),staleTime:6e4,gcTime:3e5,retry:!1,refetchOnWindowFocus:!1})}function Ba(){return T({queryKey:N.system.health,queryFn:e=>M(`/system/health`,{signal:D(e)}).then(ge),...A,refetchInterval:k.status})}function Va(){return T({queryKey:N.releases.githubLatest,queryFn:e=>M(`/updates/release`,{signal:D(e)}).then(Ce),...A,staleTime:18e5,refetchInterval:18e5,retry:!1})}function Ha(e){return T({queryKey:N.usageAnalytics.summary(e),queryFn:t=>M(`/system/usage/summary?period=${encodeURIComponent(e)}`,{signal:D(t)}).then(pe),...A,refetchInterval:k.status})}function Ua(e){return T({queryKey:N.usageAnalytics.chart(e),queryFn:t=>M(`/system/usage/chart?period=${encodeURIComponent(e)}`,{signal:D(t)}).then(be),...A,refetchInterval:k.status})}function Wa(e,t){return T({queryKey:N.usageAnalytics.by(e,t),queryFn:n=>M(`/system/usage/by-${t}?period=${encodeURIComponent(e)}`,{signal:D(n)}).then(Se),...A,refetchInterval:k.status})}function Ga(e,t=50,n){let r=n==null?``:`&httpStatus=${encodeURIComponent(String(n))}`;return T({queryKey:N.usageAnalytics.requests(e,t,n),queryFn:n=>M(`/system/usage/requests?period=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${r}`,{signal:D(n)}).then(_e),...A,placeholderData:e=>e,refetchInterval:k.live})}function Ka(e){return T({queryKey:N.usageAnalytics.requestDetail(e??`_`),queryFn:t=>{if(!e)throw{status:400,code:`invalid_request`,message:`Request is required`};return M(`/system/usage/requests/${encodeURIComponent(e)}`,{signal:D(t)}).then(ve)},enabled:e!==null,...A})}function qa(e){return T({queryKey:N.audit.list(e??{}),queryFn:t=>{let n=new URLSearchParams;e?.action&&n.set(`action`,e.action),e?.actor&&n.set(`actor`,e.actor),e?.cursor&&n.set(`cursor`,e.cursor),e?.limit&&n.set(`limit`,String(e.limit));let r=n.toString()?`?${n.toString()}`:``;return M(`/audit${r}`,{signal:D(t)}).then(xe)},...A})}function Ja(){return T({queryKey:N.providers.all,queryFn:e=>M(`/providers`,{signal:D(e)}).then(he),...A,gcTime:6e5,refetchInterval:k.catalog})}function Ya(e){return T({queryKey:N.providers.detail(e??``),queryFn:t=>M(`/providers/${encodeURIComponent(e??``)}`,{signal:D(t)}).then(ye),enabled:!!e,...A})}function Xa(e){return T({queryKey:N.providers.models(e),queryFn:t=>{if(!e)throw{status:400,code:`invalid_request`,message:`Provider is required`};return M(`/providers/${encodeURIComponent(e)}/models`,{signal:D(t)}).then(we)},...A,staleTime:3e5,gcTime:6e5,enabled:!!e})}function Za(){let e=E();return F({mutationFn:({providerId:e,modelIds:t,wireFamily:n,metadata:r})=>M(`/providers/${encodeURIComponent(e)}/models`,{method:`POST`,body:JSON.stringify({modelIds:t,...n?{wireFamily:n}:{},...r?{metadata:r}:{}})}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:N.providers.models(n.providerId)}),w.success(`Models registered`,`${n.modelIds.length} model(s) added to ${n.providerId}`)},onError:e=>{w.error(`Failed to register models`,j(e))}})}function Qa(){let e=E();return F({mutationFn:({providerId:e,request:t})=>M(`/providers/${encodeURIComponent(e)}/models/probe`,{method:`POST`,body:JSON.stringify(t)}),onSettled:async(t,n,r)=>{await uo(e,r.providerId)}})}function $a(){return F({mutationFn:e=>M(`/providers/connection-test`,{method:`POST`,body:JSON.stringify(e)})})}function eo(){let e=E();return F({mutationFn:({providerId:e,request:t})=>M(`/providers/${encodeURIComponent(e)}/accounts/probe`,{method:`POST`,body:JSON.stringify(t)}),onSettled:async(t,n,r)=>{await uo(e,r.providerId)}})}function to(){let e=E();return F({mutationFn:({providerId:e,request:t})=>M(`/providers/${encodeURIComponent(e)}/models`,{method:`PATCH`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:N.providers.models(n.providerId)})}})}function no(){let e=E();return F({mutationFn:({providerId:e,modelId:t,route:n,metadata:r})=>M(`/providers/${encodeURIComponent(e)}/models`,{method:`PATCH`,body:JSON.stringify({modelId:t,route:n,enabled:!0,metadata:r})}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:N.providers.models(n.providerId)}),w.success(`Model updated`,`${n.modelId} limits and capabilities saved`)},onError:e=>{w.error(`Failed to update model`,j(e))}})}function ro(){let e=E();return F({mutationFn:({providerId:e,request:t})=>M(`/providers/${encodeURIComponent(e)}/models`,{method:`DELETE`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:N.providers.models(n.providerId)})}})}function io(e){return T({queryKey:N.providers.accounts(e),queryFn:t=>M(`/providers/${encodeURIComponent(e??``)}/accounts`,{signal:D(t)}),enabled:!!e,...A,staleTime:3e4,gcTime:6e5})}function ao(){let e=E();return F({mutationFn:({providerId:e,request:t})=>M(`/providers/${encodeURIComponent(e)}/accounts`,{method:`POST`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:N.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:N.providers.all})])}})}function oo(){let e=E();return F({mutationFn:({providerId:e,accounts:t})=>M(`/providers/${encodeURIComponent(e)}/accounts/batch`,{method:`POST`,body:JSON.stringify({accounts:t})}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:N.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:N.providers.all})])}})}function so(){let e=E();return F({mutationFn:({providerId:e,accountId:t,request:n})=>M(`/providers/${encodeURIComponent(e)}/accounts/${encodeURIComponent(t)}`,{method:`PATCH`,body:JSON.stringify(n)}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:N.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:N.providers.all})])}})}function co(e,t){return T({queryKey:N.providers.healthEvents(e,t),queryFn:n=>M(`/providers/${encodeURIComponent(e??``)}/accounts/${encodeURIComponent(t??``)}/health-events`,{signal:D(n)}),enabled:!!e&&!!t,...A,refetchInterval:k.status})}async function lo(e,t){await e.invalidateQueries({predicate:e=>{let n=e.queryKey;return n[0]===`console`&&n[1]===`providers`&&n[2]===t&&n[3]===`accounts`&&n[5]===`health-events`}})}async function uo(e,t){await Promise.all([e.invalidateQueries({queryKey:N.providers.accounts(t)}),lo(e,t),e.invalidateQueries({queryKey:N.providers.all})])}function fo(){let e=E();return F({mutationFn:({providerId:e,accountId:t})=>M(`/providers/${encodeURIComponent(e)}/accounts/${encodeURIComponent(t)}/recover`,{method:`POST`,body:`{}`}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:N.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:N.providers.healthEvents(n.providerId,n.accountId)}),e.invalidateQueries({queryKey:N.providers.all})]),w.success(`Account recovered`)},onError:e=>{w.error(`Could not recover the account.`,j(e))}})}function po(){let e=E();return F({mutationFn:({providerId:e,accountId:t})=>M(`/providers/${encodeURIComponent(e)}/accounts/${encodeURIComponent(t)}/health-events`,{method:`DELETE`}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:N.providers.healthEvents(n.providerId,n.accountId)}),e.invalidateQueries({queryKey:N.settings.diskUsage})]),w.success(t.deleted===0?`Health log was already empty`:`Purged ${t.deleted} health events`,n.title)},onError:e=>{w.error(`Could not purge the health log.`,j(e))}})}function mo(){return F({mutationFn:({providerId:e,accountIds:t})=>M(`/providers/${encodeURIComponent(e)}/accounts/export`,{method:`POST`,body:JSON.stringify({accountIds:t})})})}function ho(){return F({mutationFn:({providerId:e,accountLabel:t,parameters:n})=>M(`/providers/${encodeURIComponent(e)}/oauth/authorize`,{method:`POST`,body:JSON.stringify({...t?{accountLabel:t}:{},...n&&Object.keys(n).length>0?{parameters:n}:{}})})})}function go(){let e=E();return F({mutationFn:({providerId:e,code:t,state:n})=>M(`/providers/${encodeURIComponent(e)}/oauth/callback?${new URLSearchParams({code:t,state:n}).toString()}`),onSuccess:async(t,n)=>{await uo(e,n.providerId)}})}function _o(){return F({mutationFn:({providerId:e,accountLabel:t,parameters:n})=>M(`/providers/${encodeURIComponent(e)}/oauth/device/start`,{method:`POST`,body:JSON.stringify({...t?{accountLabel:t}:{},...n&&Object.keys(n).length>0?{parameters:n}:{}})})})}function vo(){let e=E();return F({mutationFn:({providerId:e,credential:t,fields:n,accountLabel:r})=>M(`/providers/${encodeURIComponent(e)}/oauth/import`,{method:`POST`,body:JSON.stringify({credential:t,...n&&Object.keys(n).length>0?{fields:n}:{},...r?{accountLabel:r}:{}})}),onSuccess:async(t,n)=>{await uo(e,n.providerId),await e.invalidateQueries({queryKey:N.quota.all})}})}function yo(){let e=E();return F({mutationFn:({providerId:e,deviceAuthId:t})=>M(`/providers/${encodeURIComponent(e)}/oauth/device/poll`,{method:`POST`,body:JSON.stringify({deviceAuthId:t})}),onSuccess:async(t,n)=>{t.status===`complete`&&await Promise.all([e.invalidateQueries({queryKey:N.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:N.providers.healthEvents(n.providerId,t.accountId)}),e.invalidateQueries({queryKey:N.quota.all}),uo(e,n.providerId)])}})}function bo(){let e=E();return F({mutationFn:e=>M(`/providers`,{method:`POST`,body:JSON.stringify(e)}),onSuccess:async t=>{await Promise.all([e.invalidateQueries({queryKey:N.providers.all}),e.invalidateQueries({queryKey:N.modelRouting.all})]),w.success(`Provider created`,t.label??t.providerId)},onError:e=>{w.error(`Failed to create provider`,j(e))}})}function xo(){let e=E();return F({mutationFn:({providerId:e,request:t})=>M(`/providers/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),onSuccess:async(t,{providerId:n})=>{await Promise.all([e.invalidateQueries({queryKey:N.providers.all}),e.invalidateQueries({queryKey:N.providers.detail(n)})]),w.success(`Provider updated`,n)},onError:e=>{w.error(`Failed to update provider`,j(e))}})}function So(){let e=E();return F({mutationFn:({providerId:e,enabled:t})=>M(`/providers/platform/global/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({enabled:t})}),onSuccess:async(t,{providerId:n})=>{await Promise.all([e.invalidateQueries({queryKey:N.providers.all}),e.invalidateQueries({queryKey:N.providers.detail(n)})])}})}function Co(e={}){let t=E();return F({mutationFn:e=>M(`/providers/${encodeURIComponent(e)}/models/sync`,{method:`POST`,body:`{}`}),onSuccess:async(n,r)=>{await t.invalidateQueries({queryKey:N.providers.models(r)}),e.silent||w.success(`Models fetched`,n.synced>0?`${n.synced} new model${n.synced===1?``:`s`} added`:`No new models found`)},onError:t=>{e.silent||w.error(`Failed to fetch models`,j(t))}})}function wo(){let e=E();return F({mutationFn:e=>M(`/providers/${encodeURIComponent(e)}`,{method:`DELETE`}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:N.providers.all}),e.invalidateQueries({queryKey:N.quota.all}),e.invalidateQueries({queryKey:N.modelRouting.all})]),w.success(`Provider deleted`,n)},onError:e=>{w.error(`Failed to delete provider`,j(e))}})}var To={name:`cartethyia`,version:`2.6.0`,description:`A powerful, self-hosted reverse proxy for OpenAI- and Anthropic-compatible AI clients, powered by native Bun and Elysia. It serves both protocols from a single server, routes every model across any configured provider, and translates requests and responses in real time — streaming and prompt caching included. Underneath it runs a full delivery engine: per-account health tracking, quota and cooldown enforcement, automatic failover across pools and providers, usage accounting, and telemetry. Point OpenCode, Cline, Claude Code, Codex, or any compatible client at Cartethyia and it keeps its native protocol while the gateway absorbs every provider-specific difference behind it. Runs on embedded SQLite or external PostgreSQL with optional Redis coordination, ships as a global CLI with a system-tray console, and needs only Bun 1.4+ alongside Node.js/npm.`,license:`GPL-3.0-only`,type:`module`,packageManager:`bun@1.4.0`,repository:{type:`git`,url:`git+https://github.com/risunCodex/Cartethyia.git`},homepage:`https://github.com/risunCodex/Cartethyia#readme`,bugs:{url:`https://github.com/risunCodex/Cartethyia/issues`},keywords:[`ai`,`gateway`,`llm`,`bun`,`self-hosted`],bin:{cartethyia:`scripts/cli/bin/cartethyia.cjs`,carte:`scripts/cli/bin/carte.cjs`},files:[`scripts/cli/`,`src/`,`migrations/`,`dist/dashboard/`,`.env.example`,`README.md`],workspaces:[`dashboard`],engines:{bun:`>=1.4.0`},scripts:{dev:`bun run dev:stack`,"dev:watch":`bun run scripts/dev/supervisor.ts`,test:`bun run scripts/test/run.ts`,build:`bun run scripts/build/build.ts`,prepack:`bun run dashboard:build`,setup:`bun run scripts/cli/setup.ts`,start:`bun run scripts/cli/main.ts start`,doctor:`bun run scripts/cli/doctor.ts`,"probe:egress":`bun run scripts/tools/probe-egress.ts`,restart:`bun run scripts/build/restart.ts`,"build:aot":`bun run scripts/build/aot.ts`,"dev:stack":`concurrently -n BACKEND,DASHBOARD -c cyan,magenta --kill-others-on-fail "bun run dev:backend" "bun run dashboard:dev"`,typecheck:`tsc --noEmit`,"test:watch":`bun run scripts/test/run.ts --watch`,"test-db:up":`docker compose -f docker-compose.test.yml up -d --wait postgres-test`,"dev:backend":`bun run --hot src/main.ts`,"dev:console-auth":`bun run scripts/test/console-session.ts`,"dev:visual-baseline":`bun run scripts/test/visual-baseline.ts`,"build:binary":`bun run scripts/build/compile.ts`,"test:backend":`bun run scripts/test/run.ts --scope backend`,"test:integration":`bun run scripts/test/run.ts --scope integration`,"test-db:down":`docker compose -f docker-compose.test.yml down`,"dashboard:dev":`bun run --cwd dashboard dev`,"test-db:check":`bun run scripts/test/check-db.ts`,"dashboard:test":`bun run scripts/test/run.ts --scope dashboard`,"test-db:reset":`docker compose -f docker-compose.test.yml down -v && docker compose -f docker-compose.test.yml up -d --wait postgres-test`,"dashboard:build":`bun run --cwd dashboard build`,"dashboard:typecheck":`bun run --cwd dashboard typecheck`,"check:migrations":`bun run scripts/test/check-migrations.ts`},dependencies:{"drizzle-orm":`0.45.2`,elysia:`2.0.0-beta.16`,enquirer:`^2.4.1`,ioredis:`6.0.0`,jose:`^6.2.12`,jsonrepair:`^3.15.0`,pg:`8.23.0`,pino:`^10.3.1`,"pino-pretty":`^13.1.3`,protobufjs:`^7.6.5`,"socks-proxy-agent":`^10.1.0`,systray2:`2.1.4`,typebox:`1.3.27`,ws:`8.22.0`},devDependencies:{"@types/pg":`8.11.10`,"@types/ws":`8.18.1`,"bun-types":`1.4.0`,concurrently:`^10.0.5`,"drizzle-kit":`^0.31.11`,typescript:`5.9.2`}}.version,Eo=`v${To.replace(/\.0$/,``)} (Jinhsi)`,Do=[{label:`Main`,items:[{label:`Overview`,path:`/`,icon:Qe},{label:`Usage`,path:`/usage`,icon:f},{label:`Providers`,path:`/providers`,icon:ct},{label:`Model Lab`,path:`/model-lab`,icon:ce}]},{label:`Control`,items:[{label:`Combos & Routes`,path:`/combos`,icon:Je},{label:`Quota Management`,path:`/quota`,icon:ut},{label:`Proxy & Requests`,path:`/proxy`,icon:m},{label:`CLI Tools`,path:`/cli-tools`,icon:h}]},{label:`Tools`,items:[{label:`Tools`,icon:g,children:[]}]},{label:`System`,items:[{label:`Customization`,path:`/customization`,icon:it},{label:`Console Log`,path:`/console-log`,icon:st},{label:`Settings`,path:`/settings`,icon:lt}]}],Oo={"/":{title:`Overview`,sub:`Gateway health, capacity, and live metrics`,icon:Qe},"/usage":{title:`Usage & Metrics`,sub:`Token economics, requests, and cost breakdown`,icon:f},"/providers":{title:`Provider Catalog`,sub:`Upstream credentials, models, and latency`,icon:ct},"/combos":{title:`Combos & Routing`,sub:`Failover policies, model aliases, and weighted routes`,icon:Je},"/quota":{title:`Quota Management`,sub:`Rate limits, leases, and tenant quotas`,icon:ut},"/proxy":{title:`Proxy & Requests`,sub:`Network pools, SOCKS5/HTTP egress, and dispatch`,icon:m},"/customization":{title:`Customization`,sub:`Background, transparency, and blur`,icon:it},"/model-lab":{title:`Model Lab`,sub:`Chat a routed model without leaving the console`,icon:ce},"/console-log":{title:`Console Log`,sub:`Live server logs and audit trail`,icon:st},"/cli-tools":{title:`CLI Tools`,sub:`Claude Code CLI, OpenCode, and local developer tool integrations`,icon:h},"/settings":{title:`Settings`,sub:`Account security, runtime preferences, and state recovery`,icon:lt}},ko={title:`Console`,sub:`Cartethyia AI Gateway Administration`,icon:Qe};function Ao(e,t){let n=/^\/providers\/([^/]+)\/?$/.exec(e);if(n?.[1]){let e=t.find(e=>e.providerId===n[1]);return{title:e?.label||e?.displayName||n[1],sub:`Routing, accounts, models, and health`,icon:ct}}let r=/^\/cli-tools\/([^/]+)\/?$/.exec(e);return r?.[1]?{title:`CLI Tool`,sub:`${r[1]} — mappings, endpoints, and downloadable config`,icon:h}:Oo[e]??ko}function jo(){try{return Ba()}catch{return{data:void 0,isError:!1,isFetching:!1,isPending:!1}}}function Mo(){let[e,t]=(0,I.useState)(()=>C()),n=te(e);return(0,I.useEffect)(()=>{let e=()=>t(C());return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,I.useEffect)(()=>{oe(e)},[e]),(0,q.jsx)(`button`,{type:`button`,onClick:()=>{let e=n?`light`:`dark`;t(e),ae(e)},"aria-label":`Toggle theme`,"aria-pressed":n,className:`topbar-icon-button`,title:n?`Switch to light mode`:`Switch to dark mode`,children:(0,q.jsx)(`span`,{className:`grid place-items-center`,children:n?(0,q.jsx)(ue,{size:17}):(0,q.jsx)(x,{size:17})},n?`sun`:`moon`)})}var No=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),Po=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`,timeZone:`UTC`});function Fo(e){if(!Number.isFinite(e)||e<0)return`Unavailable`;let t=e>=1024**3?{divisor:1024**3,label:`GiB`}:{divisor:1024**2,label:`MiB`};return`${(e/t.divisor).toFixed(1)} ${t.label}`}function Io({icon:e,label:t,value:n,detail:r,title:i}){return(0,q.jsxs)(`div`,{className:`min-w-0 rounded-control border border-inner-border bg-surface-2 p-3`,title:i,children:[(0,q.jsxs)(`dt`,{className:`flex items-center gap-2 text-micro font-medium text-text-tertiary`,children:[(0,q.jsx)(e,{size:13,strokeWidth:1.8,className:`shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:t})]}),(0,q.jsx)(`dd`,{className:`mt-1 truncate font-mono text-caption font-semibold tabular-nums text-text-primary`,children:n}),r?(0,q.jsx)(`dd`,{className:`mt-1 text-micro text-text-secondary`,children:r}):null]})}function Lo({health:e,onOpenUpdate:t}){let[n,r]=(0,I.useState)(!1),[i,a]=(0,I.useState)(()=>new Date),o=(0,I.useRef)(null),s=(0,I.useRef)(null),c=Ra();(0,I.useEffect)(()=>{if(!n)return;a(new Date);let e=window.setInterval(()=>a(new Date),1e3);return()=>window.clearInterval(e)},[n]),(0,I.useEffect)(()=>{if(!n)return;let e=e=>{let t=e.target;s.current&&!s.current.contains(t)&&o.current&&!o.current.contains(t)&&r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]);let l=[e?e.database_in_process?e.database_healthy?`SQLite in-process, connected.`:`SQLite in-process is not answering.`:e.database_healthy?`Postgres connected.`:`Postgres unreachable.`:void 0,e?e.redis_configured?e.redis_healthy?`Redis connected.`:`Redis unreachable.`:`Redis not configured.`:void 0].filter(Boolean).join(` · `),u=e?e.status===`healthy`?`All systems operational`:e.status===`degraded`?`Gateway degraded`:`Gateway unhealthy`:`System health unavailable`,d=e?e.status===`healthy`?l||`Gateway reported healthy.`:[l,`Check connection logs.`].filter(Boolean).join(` — `):`Live gateway metrics are not available.`,f=e&&[Number.isFinite(e.memory_percent)?`${e.memory_percent.toFixed(1)}% of system RAM`:void 0,e.database_in_process?`In-process DB included`:void 0].filter(Boolean).join(` · `)||void 0,p=e?.cpu_percent??void 0,m=p!==void 0&&Number.isFinite(p),h=e?m?Number.isFinite(e.cpu_cores)&&e.cpu_cores>0?`1-min load · ${e.cpu_cores} cores`:`Normalized 1-min load`:`Not reported on this platform`:void 0;return(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsxs)(`button`,{ref:o,type:`button`,className:`topbar-icon-button`,"aria-label":`Notifications`,"aria-expanded":n,"aria-haspopup":`dialog`,onClick:()=>r(e=>!e),children:[(0,q.jsx)(Ge,{size:17}),c.length>0?(0,q.jsx)(`span`,{"aria-label":`${c.length} notifications`,className:`absolute right-1.5 top-1.5 size-2 rounded-full bg-accent`}):null]}),n?(0,wi.createPortal)((0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`fixed inset-0 z-floating bg-overlay backdrop-blur-dialog`,onClick:()=>r(!1)}),(0,q.jsxs)(`div`,{ref:s,role:`dialog`,"aria-label":`Notifications`,className:`app-topbar-popover popout-enter glass rounded-sidebar border border-inner-border bg-popover-bg p-5 shadow-popout z-popover`,children:[(0,q.jsxs)(`div`,{className:`mb-3 flex shrink-0 items-center justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3 font-bold text-body-lg`,children:[(0,q.jsx)(`span`,{className:`w-13 h-13 rounded-pill bg-accent-soft text-accent grid place-items-center`,children:(0,q.jsx)(Ge,{size:13})}),(0,q.jsx)(`span`,{children:`Notifications`})]}),(0,q.jsx)(`button`,{type:`button`,"aria-label":`Close notifications`,onClick:()=>r(!1),className:`cursor-pointer border-none bg-transparent p-2 text-caption text-text-tertiary`,children:(0,q.jsx)(de,{size:14})})]}),(0,q.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 flex flex-col gap-3`,children:[c.length>0?(0,q.jsx)(`section`,{"aria-label":`Notifications`,className:`flex flex-col gap-2`,children:c.map(e=>(0,q.jsxs)(`article`,{className:`flex items-start gap-3 rounded-card border p-4 ${e.level===`warning`?`border-orange-soft bg-orange-soft`:`border-accent/25 bg-accent-soft`}`,children:[(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block text-caption font-semibold text-text-primary`,children:e.title}),(0,q.jsx)(`span`,{className:`mt-1 block text-badge text-text-secondary`,children:e.message})]}),e.href?e.kind===`update-available`?(0,q.jsx)(`button`,{type:`button`,className:`shrink-0 text-badge font-semibold text-accent`,onClick:t,children:`Update`}):(0,q.jsx)(`a`,{className:`shrink-0 text-badge font-semibold text-accent`,href:e.href,target:`_blank`,rel:`noreferrer`,children:`Open`}):null]},e.id))}):(0,q.jsx)(`div`,{className:`rounded-card border border-inner-border bg-surface-2 p-4 text-badge text-text-secondary`,children:`No active memory or update alerts.`}),(0,q.jsxs)(`div`,{className:`flex items-start gap-3 rounded-card border border-inner-border bg-surface-2 p-4`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 grid w-12 h-12 shrink-0 place-items-center rounded-control bg-surface-1 text-text-secondary`,children:(0,q.jsx)(ct,{size:16,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`font-semibold text-caption`,children:u}),(0,q.jsx)(`p`,{className:`text-badge text-text-secondary mt-1`,children:d})]})]}),(0,q.jsxs)(`dl`,{"aria-label":`Runtime metrics`,className:`grid grid-cols-2 gap-2`,children:[(0,q.jsx)(Io,{icon:_,label:`Local time`,value:No.format(i)}),(0,q.jsx)(Io,{icon:g,label:`UTC`,value:Po.format(i)}),(0,q.jsx)(Io,{icon:ft,label:`Uptime`,value:e?ie(e.uptime_seconds):`Unavailable`,detail:e&&Number.isFinite(e.uptime_seconds)&&e.uptime_seconds>=0?`Gateway process running`:void 0}),(0,q.jsx)(Io,{icon:et,label:`Process RSS`,value:e?Fo(e.memory_bytes):`Unavailable`,detail:f,title:`Process resident set size; percentage is share of system RAM.`}),(0,q.jsx)(Io,{icon:Je,label:`CPU load`,value:m&&p!==void 0?`${p.toFixed(1)}%`:`Unavailable`,detail:h,title:`One-minute load average normalized by the number of CPU cores.`}),(0,q.jsx)(Io,{icon:nt,label:`Runtime`,value:e?.platform?.trim()||`Unavailable`,detail:e?.platform?.trim()?`Gateway host platform`:void 0,title:e?.platform?.trim()||`Runtime platform unavailable`})]}),(0,q.jsxs)(`div`,{className:`flex items-start gap-3 rounded-card border border-inner-border bg-surface-2 p-4`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 grid w-12 h-12 shrink-0 place-items-center rounded-control bg-surface-1 text-text-secondary`,children:(0,q.jsx)(ot,{size:16,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`font-semibold text-caption`,children:Eo}),(0,q.jsx)(`p`,{className:`text-badge text-text-secondary mt-1`,children:`High-performance AI Gateway & Protocol Orchestrator.`})]})]})]})]})]}),document.body):null]})}function Ro({group:e,pathname:t,onIntent:n}){return(0,q.jsxs)(`div`,{className:`nav-group-section`,children:[(0,q.jsx)(`p`,{className:`nav-group-title`,children:e.label}),(0,q.jsx)(zo,{items:e.items,pathname:t,onIntent:n})]})}function zo({items:e,pathname:t,onIntent:n}){let r=(0,I.useRef)(null),[i,a]=(0,I.useState)({top:0,height:0,opacity:0}),[o,s]=(0,I.useState)(()=>new Set);return(0,I.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=e.querySelector(`[data-active="true"]`);if(!t){a(e=>({...e,opacity:0}));return}let n=e.getBoundingClientRect(),i=t.getBoundingClientRect();a({top:i.top-n.top,height:i.height,opacity:1})},[t,e]),(0,q.jsxs)(`div`,{ref:r,className:`nav-items-container`,children:[(0,q.jsx)(`div`,{className:`sidebar-active-indicator`,style:{transform:`translateY(${i.top}px)`,height:`${i.height}px`,opacity:i.opacity},"aria-hidden":`true`}),e.map(e=>{if(e.children!==void 0){let t=o.has(e.path??e.label);return(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`nav-link-item w-full`,"aria-expanded":t,onClick:()=>s(t=>{let n=new Set(t),r=e.path??e.label;return n.has(r)?n.delete(r):n.add(r),n}),children:[(0,q.jsx)(e.icon,{size:17,className:`nav-link-icon`}),(0,q.jsx)(`span`,{children:e.label}),(0,q.jsx)(Ke,{size:14,className:`ml-auto shrink-0 transition-transform ${t?`rotate-180`:``}`,"aria-hidden":`true`})]}),t?(0,q.jsx)(`div`,{className:`ml-6 border-l border-inner-border pl-2`,children:e.children.map(e=>(0,q.jsxs)(`button`,{type:`button`,className:`nav-link-item w-full`,disabled:e.disabled===!0,title:e.label,children:[(0,q.jsx)(e.icon,{size:15,className:`nav-link-icon`}),(0,q.jsx)(`span`,{children:e.label}),e.badge?(0,q.jsx)(`span`,{className:`nav-link-badge`,children:e.badge}):null]},e.path??e.label))}):null]},e.path??e.label)}if(e.disabled)return(0,q.jsxs)(`button`,{type:`button`,className:`nav-link-item w-full cursor-not-allowed opacity-55`,disabled:!0,"aria-label":`${e.label} — unavailable`,title:`Coming soon`,children:[(0,q.jsx)(e.icon,{size:17,className:`nav-link-icon`}),(0,q.jsx)(`span`,{children:e.label}),(0,q.jsx)(`span`,{className:`nav-link-badge`,children:`Soon`})]},e.path??e.label);if(e.path===void 0)return null;let r=e.path,i=r===`/`?t===`/`:t===r||t.startsWith(`${r}/`);return(0,q.jsxs)(oi,{to:r,end:r===`/`,"data-active":i?`true`:void 0,className:`nav-link-item ${i?`active`:``}`,onMouseEnter:()=>n(r),onFocus:()=>n(r),children:[(0,q.jsx)(e.icon,{size:17,className:`nav-link-icon`}),(0,q.jsx)(`span`,{children:e.label}),e.badge?(0,q.jsx)(`span`,{className:`nav-link-badge`,children:e.badge}):null]},r)})]})}function Bo({user:e,children:t}){let n=G(),r=W(),[i,a]=(0,I.useState)(!1),[o,s]=(0,I.useState)(!1),[c,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(!1),[p,m]=(0,I.useState)(!1),h=async()=>{m(!0);try{await M(`/updates/apply`,{method:`POST`})}catch{m(!1);return}let e=e=>{e.preventDefault()};window.addEventListener(`beforeunload`,e);let t=y,n=window.setInterval(async()=>{try{let r=await(await fetch(`/console/api/updates/release`)).json();t!==void 0&&r.tag_name!==t&&(window.clearInterval(n),window.removeEventListener(`beforeunload`,e),window.location.reload())}catch{}},3e3)},g=jo(),_=Va(),v=g.data?.version??To,y=_.data?.tag_name?.replace(/^v/,``),b=ka(v,y),ee=Ja(),x=(0,I.useRef)(null);(0,I.useEffect)(()=>{b&&y!==void 0&&ua()!==y&&x.current!==y&&(x.current=y,f(!0))},[b,y]);let S=e=>{Pa(Q,e)};(0,I.useEffect)(()=>{a(!1)},[r.pathname]),(0,I.useEffect)(()=>{let e=()=>a(!1);return window.addEventListener(`cartethyia:overlay-open`,e),()=>window.removeEventListener(`cartethyia:overlay-open`,e)},[]),(0,I.useLayoutEffect)(()=>{window.scrollTo(0,0)},[r.pathname]);let te=async()=>{s(!0);try{await M(`/auth/logout`,{method:`POST`})}finally{Q.clear(),Ea(),n(`/login`,{replace:!0})}};(0,I.useEffect)(()=>(document.documentElement.dataset.glassEnabled=`true`,Xi(Yi()),()=>{delete document.documentElement.dataset.glassEnabled}),[]);let C=Ao(r.pathname,ee.data??[]);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`app-bg`,"aria-hidden":`true`}),(0,q.jsx)(aa,{}),(0,q.jsx)(`div`,{className:`app-shell-frame`,children:(0,q.jsxs)(`div`,{className:`app-shell-root`,"data-drawer":i?`open`:void 0,"data-page-scroll":r.pathname===`/console-log`?`contained`:void 0,onClick:e=>{i&&e.target.closest(`.app-main-column`)&&a(!1)},children:[(0,q.jsxs)(`aside`,{className:`glass app-sidebar ${i?`is-open`:``}`,"aria-label":`Dashboard navigation`,children:[(0,q.jsxs)(`div`,{className:`brand-header`,children:[(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`brand-icon overflow-hidden p-0`,children:(0,q.jsx)(`img`,{src:`/assets/brand/sidebar_ico.jpg`,alt:`Cartethyia`,onError:e=>{e.currentTarget.onerror=null,e.currentTarget.src=`/assets/brand/sidebar_ico.jpg`},className:`w-full h-full object-cover block`})}),(0,q.jsxs)(`div`,{className:`brand-meta`,children:[(0,q.jsx)(`div`,{className:`brand-name`,children:(0,q.jsx)(`span`,{children:`Cartethyia`})}),(0,q.jsxs)(`div`,{className:`brand-version-badge`,children:[(0,q.jsx)(`a`,{href:l,target:`_blank`,rel:`noreferrer`,className:`brand-version-link`,children:Eo}),b?(0,q.jsxs)(`button`,{type:`button`,onClick:()=>f(!0),className:`brand-update-badge`,title:y===void 0?`A newer Cartethyia release is available`:`Update available: v${y} — how to install it`,children:[(0,q.jsx)(ot,{size:9,className:`shrink-0`,"aria-hidden":`true`}),y===void 0?`update`:`Update v${y}`]}):null]})]})]}),(0,q.jsx)(`nav`,{className:`flex-1 overflow-y-auto py-2 px-0`,children:Do.map(e=>(0,q.jsx)(Ro,{group:e,pathname:r.pathname,onIntent:S},e.label))}),(0,q.jsx)(`div`,{className:`sidebar-user-card`,children:(0,q.jsxs)(`div`,{className:`user-card-content`,children:[(0,q.jsx)(`div`,{className:`user-avatar`,"aria-hidden":`true`,children:(e.displayName??e.email).slice(0,2).toUpperCase()}),(0,q.jsxs)(`div`,{className:`user-info`,children:[(0,q.jsx)(`p`,{className:`user-name`,children:e.displayName||`Admin`}),(0,q.jsx)(`p`,{className:`user-role`,children:e.email})]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>u(!0),disabled:o,"aria-label":`Sign out`,title:`Sign out`,className:`topbar-icon-button w-15 h-15 rounded-inset`,children:(0,q.jsx)($e,{size:14})})]})})]}),(0,q.jsxs)(`div`,{className:`app-main-column`,children:[(0,q.jsxs)(`header`,{className:`glass app-topbar`,children:[(0,q.jsx)(`button`,{type:`button`,"aria-label":`Open navigation`,className:`topbar-menu-btn`,onClick:()=>a(!0),children:(0,q.jsx)(tt,{size:18})}),(0,q.jsxs)(`div`,{className:`topbar-meta`,children:[(0,q.jsxs)(`h1`,{className:`topbar-title`,children:[(0,q.jsx)(C.icon,{className:`topbar-title-icon`,size:16,"aria-hidden":`true`}),C.title]}),(0,q.jsx)(`p`,{className:`topbar-subtitle`,children:C.sub})]}),(0,q.jsxs)(`div`,{className:`topbar-actions`,children:[(0,q.jsx)(Ci,{}),(0,q.jsx)(Mo,{}),(0,q.jsx)(Lo,{health:g.data,onOpenUpdate:()=>f(!0)})]})]}),(0,q.jsx)(`main`,{className:`route-enter w-full min-w-0`,children:t})]})]})}),(0,q.jsx)(oa,{open:c,onClose:()=>u(!1),onConfirm:te,title:`Sign out?`,message:`You will need to sign in again to open the console.`,confirmLabel:`Sign out`,danger:!0}),(0,q.jsx)(pa,{open:d,onClose:()=>f(!1),currentVersion:v,...y===void 0?{}:{latestVersion:y},..._.data?.html_url===void 0?{}:{releaseUrl:_.data.html_url},...y===void 0?{}:{onDismissVersion:()=>da(y)},onUpdateNow:h,updating:p})]})}var Vo=class extends I.Component{state={error:null,componentStack:null};static getDerivedStateFromError(e){return{error:e,componentStack:null}}componentDidCatch(e,t){console.error(`[console] route render failed:`,e,t.componentStack),this.setState({componentStack:t.componentStack??null})}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.error!==null&&this.setState({error:null})}render(){if(this.state.error===null)return this.props.children;let e=this.state.componentStack?.trim(),t=this.state.error.stack?.trim(),n=e!==void 0&&e.length>0?e:t!==void 0&&t.length>0?t:null;return(0,q.jsx)(`main`,{className:`auth-viewport`,children:(0,q.jsxs)(`div`,{className:`card-solid auth-window border border-red-soft`,children:[(0,q.jsxs)(`div`,{className:`auth-header`,children:[(0,q.jsx)(`h1`,{className:`auth-title`,children:`Console view failed`}),(0,q.jsx)(`p`,{className:`auth-desc`,children:`This view could not be rendered.`})]}),(0,q.jsxs)(`div`,{className:`rounded-panel border border-inner-border bg-surface-2 p-7 leading-normal text-caption text-text-secondary`,children:[(0,q.jsx)(`strong`,{className:`block text-text-primary mb-2`,children:`Rendering error`}),(0,q.jsx)(`span`,{className:`select-text break-words`,children:this.state.error.message}),n===null?null:(0,q.jsx)(`pre`,{className:`mt-4 max-h-80 overflow-auto whitespace-pre-wrap break-words text-badge text-text-tertiary`,children:n})]}),(0,q.jsx)(`button`,{type:`button`,className:`btn btn-primary inline-flex w-full items-center justify-center rounded-control bg-accent font-semibold text-accent-foreground mt-3 h-20 text-caption`,onClick:()=>window.location.reload(),children:`Reload console`})]})})}},Ho=3e5;function Uo(e){return`cartethyia:lazy-retry:${e}`}function Wo(e,t){if(e===null)return!0;let n=Number(e);return!Number.isFinite(n)||t-n>Ho}function Go(){try{return typeof sessionStorage>`u`?void 0:sessionStorage}catch{return}}function $(e,t,n={}){let r=n.storage??Go(),i=n.reload??(()=>{window.location.reload()}),a=n.now??(()=>Date.now()),o=Uo(t);return(0,I.lazy)(async()=>{try{let t=await e();try{r?.removeItem(o)}catch{}return t}catch(e){let t=null;try{t=r?.getItem(o)??null}catch{t=null}if(Wo(t,a())){try{r?.setItem(o,String(a()))}catch{}return i(),new Promise(()=>{})}throw e}})}function Ko(){return(0,q.jsxs)(`div`,{role:`status`,"aria-label":`Loading console`,className:`min-h-dvh flex flex-col items-center justify-center gap-6 text-text-tertiary`,children:[(0,q.jsx)(le,{size:22,className:`animate-spin`,"aria-hidden":`true`}),(0,q.jsx)(`p`,{className:`text-caption`,children:`Loading console…`})]})}var qo=$(()=>i(()=>import(`./LoginPage-CbphLvjg.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),`login`),Jo=$(()=>i(()=>import(`./SetupPage-D4g6vOGc.js`),__vite__mapDeps([10,1,2,3,4,6,7,8,9,11,12])),`setup`),Yo=$(()=>i(()=>import(`./BannedPage-l6XMnfr9.js`),__vite__mapDeps([13,1])),`banned`),Xo=$(()=>i(()=>import(`./OverviewPage-DABu2Wgt.js`),__vite__mapDeps([14,1,15,16,17,6,18,19,20,2,3,4,21,22,23,24,8,9,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,7,45,46,47,48,49,50,51,11,52])),`overview`),Zo=$(()=>i(()=>import(`./UsagePage-BFME-eba.js`),__vite__mapDeps([53,1,15,54,3,4,2,31,16,17,6,18,19,55,56,24,8,9,57,26,5,36,58,59,60,41,42,43,45,23,49,11,61,62,63,64,65])),`usage`),Qo=$(()=>i(()=>import(`./ProviderDetailPage-C15x9q13.js`),__vite__mapDeps([66,1,15,67,68,20,2,3,4,69,55,56,8,9,25,57,26,27,70,31,30,32,33,34,35,71,37,40,59,17,6,41,42,43,44,7,45,47,48,23,49,52,72,73,18,19,61,74,11,62,75,63])),`provider-detail`),$o=$(()=>i(()=>import(`./ProvidersPage-Dfb2896L.js`),__vite__mapDeps([76,1,2,3,4,8,9,26,30,31,33,40,6,77,41,44,7,45,47,48,23,49,72,62,75])),`providers`),es=$(()=>i(()=>import(`./CombosPage-6kYIUpzR.js`),__vite__mapDeps([78,1,79,2,3,4,22,23,26,70,31,30,32,33,36,37,40,6,77,41,29,7,8,9,45,46,17,43,44,47,49,72,73,18,19,63])),`combos`),ts=$(()=>i(()=>import(`./QuotaPage-BsdoCIw1.js`),__vite__mapDeps([80,1,15,2,3,4,21,8,26,30,31,35,71,40,81,6,41,44,45,47,48,23,49,11,52,74,17,18,19])),`quota`),ns=$(()=>i(()=>import(`./ProxyPage-BaCIdAUt.js`),__vite__mapDeps([82,1,15,2,3,4,8,9,25,26,30,31,32,33,34,71,38,40,17,6,18,19,41,42,44,7,45,48,23,49,11,62,64,65])),`proxy`),rs=$(()=>i(()=>import(`./SettingsPage-KVJFh3Ip.js`),__vite__mapDeps([83,1,15,2,3,4,24,9,26,70,30,31,39,17,6,18,19,40,81,41,42,7,8,45,48,23,61,12])),`settings`),is=$(()=>i(()=>import(`./CliToolsPage-BT3Up3QA.js`),__vite__mapDeps([84,1,15,26,2,3,4,41,44,23,49,51,17,6,18,19,85,11])),`cli-tools`),as=$(()=>i(()=>import(`./CliToolDetailPage-DwOzAW45.js`),__vite__mapDeps([86,1,67,2,3,4,55,26,36,37,6,41,42,44,7,8,9,45,46,31,30,17,43,47,48,23,49,50,18,19,51,85])),`cli-tool-detail`),os=$(()=>i(()=>import(`./ConsoleLogPage-zRnj1mlR.js`),__vite__mapDeps([87,1,2,3,4,26,35,37,38,40,6,41,65,44,7,8,9,11])),`console-log`),ss=$(()=>i(()=>import(`./CustomizationPage-C7m-H1Rz.js`),__vite__mapDeps([88,1,2,3,4,57,70,71,41,48,23,49])),`customization`),cs=$(()=>i(()=>import(`./StudioPage-SgQpymjm.js`),__vite__mapDeps([89,1,54,3,4,2,31,68,69,25,90,30,32,71,59,41,7,8,9,45,46,36,37,17,6,43,44,47,50,18,19])),`studio`);function ls(){let e=G(),t=W();return(0,I.useEffect)(()=>(Fe(n=>{if(Q.clear(),Ea(),n===`banned`){e(`/banned`,{replace:!0});return}e(`/login?returnTo=${encodeURIComponent(t.pathname)}`,{replace:!0})}),()=>Fe(void 0)),[e,t.pathname]),null}function us(){let e=W();return(0,q.jsx)(Vo,{resetKey:`${e.pathname}${e.search}`,children:(0,q.jsx)(I.Suspense,{fallback:(0,q.jsx)(Ko,{}),children:(0,q.jsxs)(vr,{children:[(0,q.jsx)(K,{path:`/login`,element:(0,q.jsx)(qo,{})}),(0,q.jsx)(K,{path:`/setup`,element:(0,q.jsx)(Jo,{})}),(0,q.jsx)(K,{path:`/banned`,element:(0,q.jsx)(Yo,{})}),(0,q.jsx)(K,{path:`/*`,element:(0,q.jsx)(ds,{})})]})})})}function ds(){let[e,t]=(0,I.useState)({kind:`loading`}),n=W(),r=G(),[i]=(0,I.useState)(()=>n.pathname);return(0,I.useEffect)(()=>{let e=new AbortController;return Q.fetchQuery({queryKey:N.session.current,queryFn:()=>Pe(),staleTime:6e4}).then(n=>{if(!e.signal.aborted){if(n){Q.setQueryData(N.session.current,n),t({kind:`ready`,user:n}),n.isFirstBoot&&i!==`/setup`&&r(`/setup`,{replace:!0});return}Q.removeQueries({queryKey:N.session.current}),M(`/auth/first-boot`,{signal:e.signal}).then(n=>{e.signal.aborted||t({kind:`unauthenticated`,needsSetup:n.requires_setup})}).catch(()=>{e.signal.aborted||t({kind:`unauthenticated`,needsSetup:!1})})}}).catch(n=>{e.signal.aborted||(typeof n==`object`&&n&&`status`in n&&n.status===403?t({kind:`blocked`}):t({kind:`unauthenticated`,needsSetup:!1}))}),()=>e.abort()},[i,r]),e.kind===`loading`?null:e.kind===`blocked`?(0,q.jsx)(gr,{to:`/banned`,replace:!0}):e.kind===`unauthenticated`?(0,q.jsx)(gr,{to:e.needsSetup?`/setup`:`/login?returnTo=${encodeURIComponent(n.pathname)}`,replace:!0}):(0,q.jsx)(Bo,{user:e.user,children:(0,q.jsxs)(vr,{children:[(0,q.jsx)(K,{path:`/`,element:(0,q.jsx)(Xo,{})}),(0,q.jsx)(K,{path:`/usage`,element:(0,q.jsx)(Zo,{})}),(0,q.jsx)(K,{path:`/providers`,element:(0,q.jsx)($o,{})}),(0,q.jsx)(K,{path:`/providers/:providerId`,element:(0,q.jsx)(Qo,{})}),(0,q.jsx)(K,{path:`/combos`,element:(0,q.jsx)(es,{})}),(0,q.jsx)(K,{path:`/quota`,element:(0,q.jsx)(ts,{})}),(0,q.jsx)(K,{path:`/proxy`,element:(0,q.jsx)(ns,{})}),(0,q.jsx)(K,{path:`/console-log`,element:(0,q.jsx)(os,{})}),(0,q.jsx)(K,{path:`/customization`,element:(0,q.jsx)(ss,{})}),(0,q.jsx)(K,{path:`/model-lab`,element:(0,q.jsx)(cs,{})}),(0,q.jsx)(K,{path:`/cli-tools`,element:(0,q.jsx)(is,{})}),(0,q.jsx)(K,{path:`/cli-tools/:toolId`,element:(0,q.jsx)(as,{})}),(0,q.jsx)(K,{path:`/settings`,element:(0,q.jsx)(rs,{})}),(0,q.jsx)(K,{path:`*`,element:(0,q.jsx)(gr,{to:`/`,replace:!0})})]})})}function fs(){return(0,q.jsx)(Ee,{client:Q,children:(0,q.jsxs)(ii,{basename:`/console`,children:[(0,q.jsx)(ls,{}),(0,q.jsx)(us,{}),(0,q.jsx)(ne,{position:`top-right`,offset:{top:`6rem`,right:`1rem`},mobileOffset:{top:`6rem`,left:`1rem`,right:`1rem`},visibleToasts:2,richColors:!0,duration:5e3,toastOptions:{className:`toast-surface select-text`,descriptionClassName:`select-text`,classNames:{title:`select-text`},style:{background:`var(--glass-bg-2)`,border:`1px solid var(--glass-border-2)`,color:`var(--text-primary)`,fontSize:`12.5px`,userSelect:`text`},actionButtonStyle:{background:`var(--accent)`,color:`var(--accent-foreground)`},cancelButtonStyle:{background:`var(--surface-muted)`,color:`var(--text-primary)`}}})]})})}function ps(e){document.title=`Cartethyia Console`,Ta().finally(()=>{Da(),(0,_i.createRoot)(e).render((0,q.jsx)(I.StrictMode,{children:(0,q.jsx)(fs,{})}))})}export{G as $,qa as A,ea as B,_o as C,no as D,So as E,Ga as F,zi as G,Qi as H,Ha as I,Vi as J,Oi as K,Q as L,Wa as M,Ua as N,xo as O,Ka as P,ai as Q,ca as R,ho as S,$a as T,$i as U,Y as V,Ri as W,Li as X,Mi as Y,Ni as Z,Ja as _,ao as a,st as at,Za as b,ro as c,Ye as ct,yo as d,Jn as et,eo as f,Xa as g,Ya as h,bo as i,ct as it,za as j,so as k,mo as l,Ke as lt,io as m,ps as mountConsole,co as n,ft as nt,oo as o,Qe as ot,Qa as p,Pi as q,go as r,ut as rt,wo as s,Ze as st,To as t,di as tt,vo as u,po as v,Co as w,to as x,fo as y,oa as z};
@@ -0,0 +1 @@
1
+ import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CXUMngI_.js";import{a as i,l as a,t as o}from"./app-2KhtHCv9.js";import{i as s,n as c,r as l,t as u}from"./terminal-0_IjPWTk.js";import{t as d}from"./arrow-right-Dl5yKnp8.js";import{n as f,r as p,t as m}from"./github-badge-DmQreSDd.js";import{t as h}from"./log-in-BmRjy60c.js";import{t as g}from"./message-circle-CCxGwRvv.js";import{t as _}from"./shield-check-DVS0Foqh.js";import{t as v}from"./use-reduced-motion-C4B0R6Sz.js";var y=e(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),b=a(),x=t(n(),1),S=r(),C=`/`,w=`/console`,T={night:{"--story-accent":`var(--color-story-night)`},core:{"--story-accent":`var(--color-story-core)`},blossom:{"--story-accent":`var(--color-story-blossom)`},voices:{"--story-accent":`var(--color-story-voices)`},red:{"--story-accent":`var(--color-story-red)`},denial:{"--story-accent":`var(--color-story-denial)`},shore:{"--story-accent":`var(--color-story-shore)`}},E=e=>`${C}assets/story/${e}`,D=e=>e.toLowerCase().replace(/\b\w/g,e=>e.toUpperCase()),O=e=>{let t=k[e+1];return t===void 0?`Back to ${k[0]?.label??`the beginning`}`:`Go to ${D(t.location)}`},k=[{id:`blessed-maiden`,number:`01`,label:`The Blessed Maiden`,location:`THE FIRST CROSSING`,theme:`night`,title:`A single signal enters the unknown.`,description:`Every client begins with one request and a question: where should it go? Cartethyia gives that signal a reliable gateway — self-hosted, authenticated, and ready for the crossing.`,image:E(`fleurdelys_plus.webp`),imageAlt:`The Blessed Maiden beneath a luminous blue sky`,signals:[{label:`The first crossing`,value:`OPEN`,icon:`network`},{label:`The chosen vessel`,value:`YOURS`,icon:`shield`},{label:`The gate`,value:`ALIGNED`,icon:`sparkles`}]},{id:`resonant-core`,number:`02`,label:`The Resonant Core`,location:`THE ROUTING SANCTUM`,theme:`core`,title:`The route becomes the power.`,description:`One surface can speak to many providers. Cartethyia translates protocols, balances targets, and keeps each request moving through the right vessel — even when the first path goes quiet.`,image:E(`cartethyia-god.webp`),imageAlt:`Cartethyia surrounded by a celestial blue routing field`,signals:[{label:`The many voices`,value:`30+`,icon:`network`},{label:`The bridge`,value:`ALIGNED`,icon:`terminal`},{label:`The fallback`,value:`AWARE`,icon:`activity`}]},{id:`pink-blossom`,number:`03`,label:`The Pink Blossom Calm`,location:`THE QUIET CONTROL`,theme:`blossom`,title:`Behind every powerful system, there is a quiet place to govern.`,description:`Observe the flow, tune the balance, and let the models answer. Provider accounts, credentials, usage, and health stay in one calm console built for the person operating the route.`,image:E(`jinhsi-blossom.webp`),imageAlt:`Jinhsi beneath soft pink blossoms`,signals:[{label:`The quiet engine`,value:`AWAKE`,icon:`activity`},{label:`The studio`,value:`READY`,icon:`sparkles`},{label:`The balance`,value:`HELD`,icon:`shield`}]},{id:`many-voices`,number:`04`,label:`The Many Voices`,location:`THE LIVING NETWORK`,theme:`voices`,title:`Every route carries a living world.`,description:`Providers, clients, and models bring different voices to the crossing. Cartethyia gives them one dependable gateway without silencing what makes each path unique.`,image:E(`wuthering-waves-hiyuki-aemeath-hiyuki-rover.webp`),imageAlt:`A bright celebration of characters and connected voices`,signals:[{label:`The many voices`,value:`CONNECTED`,icon:`network`},{label:`The shared world`,value:`OPEN`,icon:`sparkles`},{label:`The crossing`,value:`ALIGNED`,icon:`terminal`}]},{id:`red-thread`,number:`05`,label:`The Red Thread`,location:`THE FRACTURED PATH`,theme:`red`,title:`A beautiful signal can still be dangerous.`,description:`Every powerful route attracts pressure. Cartethyia watches the boundary, rejects hostile paths, and keeps a single failure from tearing through the whole network.`,image:E(`phrolova-a.webp`),imageAlt:`A figure surrounded by dark red threads and fractured signals`,signals:[{label:`The threat`,value:`SEEN`,icon:`activity`},{label:`The boundary`,value:`HELD`,icon:`shield`},{label:`The fallback`,value:`READY`,icon:`network`}]},{id:`request-denial`,number:`06`,label:`The Gate of Discernment`,location:`THE GATE OF DISCERNMENT`,theme:`denial`,title:`Not every signal should pass.`,description:`Every game needs a gatekeeper. Cartethyia verifies intent, protects the route, and denies the requests that would fracture the system.`,image:E(`requestdeniawokkjpg.webp`),imageAlt:`A radiant gatekeeper surrounded by cascading signals`,signals:[{label:`The verdict`,value:`CLEAR`,icon:`shield`},{label:`The boundary`,value:`GUARDED`,icon:`network`},{label:`The route`,value:`TRUSTED`,icon:`sparkles`}]},{id:`shorekeeper`,number:`07`,label:`The Open Shore`,location:`THE SHOREKEEPER`,theme:`shore`,title:`The gateway is yours to shape.`,description:`Find your way back to the source, share your route, and join the people building a dependable gateway across a changing AI landscape.`,image:E(`Shorekeeper.webp`),imageAlt:`Shorekeeper watching over a luminous open shore`,signals:[{label:`The source`,value:`OPEN`,icon:`terminal`},{label:`The shore`,value:`AWAITS`,icon:`network`},{label:`The next step`,value:`YOURS`,icon:`sparkles`}]}],A={activity:s,network:l,shield:_,sparkles:c,terminal:u};function j({signal:e}){let t=A[e.icon];return(0,S.jsxs)(`div`,{className:`landing-signal-tile`,children:[(0,S.jsx)(`span`,{className:`landing-signal-icon`,children:(0,S.jsx)(t,{size:12,"aria-hidden":!0})}),(0,S.jsxs)(`div`,{className:`landing-signal-copy`,children:[(0,S.jsx)(`div`,{className:`landing-signal-label`,children:e.label}),(0,S.jsx)(`div`,{className:`landing-signal-value`,children:e.value})]})]})}function M(){let e=v(),t=e?`auto`:`smooth`,[n,r]=(0,x.useState)(0),[a,s]=(0,x.useState)(()=>new Set([0])),[c,l]=(0,x.useState)(!1),[_,b]=(0,x.useState)(!1);(0,x.useEffect)(()=>{let e=()=>b(window.scrollY>24);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]);let E=(0,x.useRef)([]);(0,x.useEffect)(()=>{if(typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(e=>{let t=e.filter(e=>e.isIntersecting).sort((e,t)=>t.intersectionRatio-e.intersectionRatio)[0];if(t){let e=Number(t.target.dataset.chapterIndex);r(e),s(t=>t.has(e)?t:new Set([...t,e]))}},{threshold:[.35,.6,.85]});E.current.forEach(t=>{t&&e.observe(t)});let i=e=>{if(!e.target?.matches(`input, textarea, select, [contenteditable="true"]`)){if(e.key===`ArrowDown`||e.key===`ArrowRight`||e.key===`PageDown`){e.preventDefault();let r=Math.min(k.length-1,n+1);E.current[r]?.scrollIntoView({behavior:t,block:`start`})}else if(e.key===`ArrowUp`||e.key===`ArrowLeft`||e.key===`PageUp`){e.preventDefault();let r=Math.max(0,n-1);E.current[r]?.scrollIntoView({behavior:t,block:`start`})}}};return window.addEventListener(`keydown`,i),()=>{e.disconnect(),window.removeEventListener(`keydown`,i)}},[n,t]);let D=e=>{E.current[e]?.scrollIntoView({behavior:t,block:`start`})},M=k[n]?.theme??`night`,N=(t,n=``)=>a.has(t)?e?``:`animate-story-reveal-up ${n}`.trim():`opacity-0`;return(0,S.jsxs)(`div`,{className:`relative min-h-screen overflow-x-clip bg-story-deep font-sans text-story-ink`,id:`top`,style:T[M],children:[(0,S.jsx)(`header`,{className:`landing-header`,"data-scrolled":_,children:(0,S.jsxs)(`div`,{className:`landing-header-inner`,"data-scrolled":_,children:[(0,S.jsxs)(`a`,{className:`landing-header-brand`,href:`#top`,onClick:e=>{e.preventDefault(),D(0)},children:[(0,S.jsx)(`span`,{className:`flex size-9 items-center justify-center rounded-xl border border-story-white/25 bg-story-white p-0.5`,children:(0,S.jsx)(`img`,{className:`size-full rounded-lg object-cover`,src:`${C}assets/brand/favicon.jpg`,alt:``})}),(0,S.jsxs)(`span`,{children:[(0,S.jsx)(`strong`,{className:`block font-heading text-lead leading-none`,children:`Cartethyia`}),(0,S.jsx)(`small`,{className:`mt-1 block font-mono text-micro font-medium leading-none tracking-code text-story-white/50`,children:`AI PROXY ROUTER`})]})]}),(0,S.jsxs)(`nav`,{className:`landing-header-desktop-nav`,"aria-label":`Primary navigation`,children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>D(0),children:[(0,S.jsx)(p,{size:14,"aria-hidden":!0}),`Home`]}),(0,S.jsxs)(`a`,{href:w,children:[(0,S.jsx)(u,{size:14,"aria-hidden":!0}),`Console`]}),(0,S.jsxs)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,children:[(0,S.jsx)(f,{size:14}),`GitHub`]}),(0,S.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,children:[(0,S.jsx)(g,{size:14,"aria-hidden":!0}),`Community`]})]}),(0,S.jsxs)(`div`,{className:`landing-header-actions`,children:[(0,S.jsx)(m,{className:`landing-header-github`}),(0,S.jsxs)(`button`,{type:`button`,"aria-label":c?`Show story`:`Show all`,"aria-pressed":c,onClick:()=>l(e=>!e),className:`landing-header-control landing-header-show-all${c?` is-active`:``}`,children:[(0,S.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}),c?`Story`:`All view`]}),(0,S.jsxs)(`a`,{className:`landing-header-control landing-header-console`,href:w,children:[`Enter console`,(0,S.jsx)(h,{size:14,"aria-hidden":!0})]})]})]})}),c?(0,S.jsx)(`main`,{className:`px-12 pb-17.5 pt-44 max-compact:px-8`,children:(0,S.jsxs)(`div`,{className:`mx-auto w-full max-w-640`,children:[(0,S.jsxs)(`div`,{className:`mb-10.5 flex flex-wrap items-end justify-between gap-5.25`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`text-badge font-bold uppercase tracking-code text-story-white/50`,children:`All chapters · 7 stories`}),(0,S.jsx)(`h2`,{className:`mt-3.5 font-serif text-hero font-normal leading-none tracking-tight text-story-white`,children:`Everything at a glance`}),(0,S.jsx)(`p`,{className:`mt-3.5 max-w-60ch text-body leading-5 text-story-white/65`,children:`Hover a card to lift it — click to jump to its story. All 7 visuals, captions and signals visible without scrolling forever.`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-3.5 text-badge text-story-white/50`,children:[(0,S.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-story-success shadow-glow-success`,"aria-hidden":!0}),` Stylish overview`]})]}),(0,S.jsx)(`div`,{className:`grid gap-7 sm:grid-cols-2 lg:grid-cols-3`,children:k.map((e,t)=>(0,S.jsxs)(`article`,{onClick:()=>{l(!1),requestAnimationFrame(()=>D(t))},className:`group relative flex cursor-pointer flex-col overflow-hidden rounded-hero border bg-story-surface text-left transition hover:-translate-y-1 hover:shadow-window focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-story-white/30`,style:T[e.theme],tabIndex:0,role:`button`,"aria-label":`Open ${e.label}`,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l(!1),requestAnimationFrame(()=>D(t)))},children:[(0,S.jsxs)(`div`,{className:`relative h-95 overflow-hidden`,children:[(0,S.jsx)(`img`,{src:e.image,alt:e.imageAlt,className:`h-full w-full object-cover transition duration-500 group-hover:scale-104`,loading:`lazy`,decoding:`async`}),(0,S.jsx)(`div`,{className:`absolute inset-0 bg-gradient-to-t from-story-deep/85 via-story-deep/10 to-transparent`}),(0,S.jsxs)(`div`,{className:`absolute left-3 top-3 flex items-center gap-3`,children:[(0,S.jsx)(`span`,{className:`rounded-chip bg-story-white px-3 py-1 font-mono text-micro font-bold tracking-label text-story-deep`,children:e.number}),(0,S.jsx)(`span`,{className:`rounded-chip border border-story-white/20 bg-story-black/25 px-3.5 py-1 text-micro font-bold uppercase tracking-label text-story-white backdrop-blur`,children:e.theme})]}),(0,S.jsxs)(`div`,{className:`absolute bottom-2 left-3 right-3 flex items-center justify-between text-micro font-bold uppercase tracking-label text-story-white/75`,children:[(0,S.jsx)(`span`,{className:`truncate`,children:e.location}),(0,S.jsx)(y,{size:13,"aria-hidden":!0,className:`opacity-60 group-hover:opacity-100`})]})]}),(0,S.jsxs)(`div`,{className:`flex flex-1 flex-col gap-3.5 p-7`,children:[(0,S.jsx)(`h3`,{className:`font-serif text-title font-normal leading-tight tracking-tight text-story-white`,children:e.title}),(0,S.jsx)(`p`,{className:`line-clamp-2 text-caption leading-5 text-story-white/65`,children:e.description}),(0,S.jsx)(`div`,{className:`mt-1.75 flex flex-wrap gap-3`,children:e.signals.map(t=>{let n=A[t.icon];return(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1.75 rounded-chip border border-story-white/10 bg-story-white/6 px-3.5 py-1.75 text-micro font-semibold uppercase tracking-label text-story-white/75`,children:[(0,S.jsx)(n,{size:12,"aria-hidden":!0,className:`text-story-accent`}),t.label,(0,S.jsx)(`strong`,{className:`font-bold text-story-white`,children:t.value})]},`${e.id}-${t.label}`)})})]})]},e.id))})]})}):(0,S.jsx)(`main`,{className:`relative z-1`,children:k.map((e,t)=>(0,S.jsxs)(`article`,{id:`chapter-${t}`,"data-chapter-index":t,ref:e=>{E.current[t]=e},className:`relative flex min-h-screen items-center overflow-hidden bg-story-deep bg-[linear-gradient(to_right,color-mix(in_srgb,var(--story-accent)_2.4%,transparent)_1px,transparent_1px),linear-gradient(to_bottom,color-mix(in_srgb,var(--story-accent)_2.4%,transparent)_1px,transparent_1px)] bg-[length:44px_100%,100%_40px] py-16 max-medium:min-h-0 max-medium:py-36 max-compact:py-52 max-compact:pb-16`,style:T[e.theme],"aria-labelledby":`chapter-title-${t}`,children:[(0,S.jsx)(`div`,{className:`absolute inset-0 z-0 scale-108 bg-cover bg-center mix-blend-screen`,style:{backgroundImage:`url(${e.image})`,filter:`blur(27px) saturate(1.14)`,opacity:.24},"aria-hidden":!0}),(0,S.jsxs)(`div`,{className:`landing-story-shell relative z-1 mx-auto`,children:[(0,S.jsxs)(`figure`,{className:`landing-story-visual relative row-start-1 min-w-0 w-full self-center overflow-hidden border border-story-white/20 bg-[#090d16] shadow-popout after:absolute after:inset-0 after:bg-gradient-to-b after:from-story-deep/4 after:via-story-deep/30 after:to-story-deep/60 after:content-[''] ${t%2==0?`col-start-1`:`col-start-2`}`,children:[(0,S.jsx)(`img`,{className:`block size-full object-cover object-center`,src:e.image,alt:e.imageAlt,loading:t===0?`eager`:`lazy`,fetchPriority:t===0?`high`:`low`,decoding:`async`}),(0,S.jsxs)(`figcaption`,{className:`absolute inset-x-4 bottom-4 z-1 flex justify-between font-mono text-micro font-medium leading-none tracking-label text-story-white/70 uppercase`,children:[e.location,` `,(0,S.jsx)(`span`,{className:`text-story-accent`,children:e.number})]})]}),(0,S.jsxs)(`div`,{className:`min-w-0 ${t%2==0?`col-start-2 row-start-1`:`col-start-1 row-start-1`}`,children:[(0,S.jsx)(`h1`,{className:`mt-6 max-w-12ch font-head text-story-hero font-normal leading-[0.98] tracking-[-0.045em] text-balance max-compact:max-w-13ch max-compact:text-story-hero-compact ${N(t,`delay-100`)}`,id:`chapter-title-${t}`,children:e.title}),(0,S.jsx)(`p`,{className:`landing-story-description mt-10 max-h-none max-w-[545px] text-lead leading-14 text-story-white/70 max-compact:max-w-full max-compact:text-body max-compact:leading-6 ${N(t,`delay-150`)}`,children:e.description}),(0,S.jsx)(`div`,{className:`landing-signal-grid ${N(t,`delay-200`)}`,children:e.signals.map(t=>(0,S.jsx)(j,{signal:t},`${e.id}-${t.label}`))}),(0,S.jsx)(`div`,{className:`mt-7 flex flex-wrap gap-3.5 max-compact:mt-5 ${N(t,`delay-300`)}`,children:(0,S.jsxs)(`button`,{className:`inline-flex h-22 items-center gap-2 rounded-control border border-story-white/25 bg-story-white/8 px-4.5 text-body font-bold text-story-white transition-transform active:scale-97 hover:bg-story-white/18 max-compact:h-21 max-compact:px-3.5 max-compact:text-badge`,type:`button`,onClick:()=>D(t===k.length-1?0:t+1),children:[O(t),(0,S.jsx)(d,{size:15,"aria-hidden":!0})]})})]})]})]},e.id))})]})}function N(e){document.title=`Cartethyia — The One-Stop AI Proxy Router`,(0,b.createRoot)(e).render((0,S.jsx)(x.StrictMode,{children:(0,S.jsx)(M,{})}))}export{N as mountLanding};
@@ -1 +1 @@
1
- import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CXUMngI_.js";import{n as i,o as a,r as o}from"./app-BIt446yE.js";var s=e(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),c=t(n(),1),l=r(),u=`https://img.shields.io`;function d(e,t){let n=new URLSearchParams({style:`flat-square`,labelColor:`0b1220`,color:t});return`${u}/github/${e}/${i}?${n.toString()}`}function f({size:e=16}){return(0,l.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,l.jsx)(`path`,{d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z`})})}function p({size:e=15}){return(0,l.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,l.jsx)(`path`,{d:`M0 0v16h16V0H0Zm13 13h-2V5H8v8H3V3h10v10Z`})})}function m({size:e=15}){return(0,l.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,l.jsx)(`path`,{d:`m15.5 6.3-.02-.06-2.14-5.58a.56.56 0 0 0-.22-.26.57.57 0 0 0-.65.03.57.57 0 0 0-.19.29l-1.45 4.42H5.17L3.72.72A.57.57 0 0 0 3.53.43a.57.57 0 0 0-.65-.03.56.56 0 0 0-.22.26L.52 6.24l-.02.06a3.97 3.97 0 0 0 1.32 4.59l.01.01.02.02 3.25 2.44 1.61 1.22.98.74a.67.67 0 0 0 .81 0l.98-.74 1.61-1.22 3.26-2.45.01-.01a3.97 3.97 0 0 0 1.32-4.59Z`})})}function h({size:e=15}){return(0,l.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,l.jsx)(`path`,{d:`M13.55 3.02A12.6 12.6 0 0 0 10.5 2.1a8.9 8.9 0 0 0-.4.83 11.7 11.7 0 0 0-3.2 0 8.6 8.6 0 0 0-.41-.83 12.6 12.6 0 0 0-3.05.92C1.3 5.75.85 8.4 1.07 11.01a12.7 12.7 0 0 0 3.74 1.9c.3-.41.57-.85.8-1.31-.44-.17-.86-.37-1.26-.6l.31-.24a9 9 0 0 0 7.68 0l.31.24c-.4.23-.82.43-1.26.6.23.46.5.9.8 1.31a12.7 12.7 0 0 0 3.74-1.9c.26-3.03-.44-5.66-1.98-7.99ZM5.68 9.4c-.73 0-1.33-.67-1.33-1.49s.59-1.49 1.33-1.49c.74 0 1.34.68 1.33 1.49 0 .82-.59 1.49-1.33 1.49Zm4.64 0c-.73 0-1.33-.67-1.33-1.49s.59-1.49 1.33-1.49c.74 0 1.34.68 1.33 1.49 0 .82-.59 1.49-1.33 1.49Z`})})}function g({id:e,size:t}){return e===`npm`?(0,l.jsx)(p,{size:t}):e===`gitlab`?(0,l.jsx)(m,{size:t}):e===`discord`?(0,l.jsx)(h,{size:t}):(0,l.jsx)(f,{size:t})}function _({className:e=``}){let[t,n]=(0,c.useState)(!1),r=(0,c.useRef)(null),i=(0,c.useId)(),s=(0,c.useCallback)(()=>n(!1),[]);return(0,c.useEffect)(()=>{if(!t)return;let e=e=>{r.current!==null&&!r.current.contains(e.target)&&s()},n=e=>{e.key===`Escape`&&s()};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,n)}},[t,s]),(0,l.jsx)(`div`,{className:e,ref:r,children:(0,l.jsxs)(`div`,{className:`github-split`,children:[(0,l.jsxs)(`a`,{className:`github-badge`,href:o,target:`_blank`,rel:`noreferrer`,"aria-label":`Cartethyia on GitHub`,children:[(0,l.jsx)(f,{size:15}),(0,l.jsx)(`img`,{className:`github-badge-metric`,src:d(`stars`,`2ea043`),alt:`GitHub stars`,height:20,loading:`lazy`,decoding:`async`}),(0,l.jsx)(`img`,{className:`github-badge-metric`,src:d(`forks`,`1f6feb`),alt:`GitHub forks`,height:20,loading:`lazy`,decoding:`async`})]}),(0,l.jsx)(`button`,{type:`button`,className:`github-split-toggle`,"aria-haspopup":`menu`,"aria-expanded":t,"aria-controls":i,"aria-label":`More ways to get Cartethyia`,onClick:()=>n(e=>!e),children:(0,l.jsx)(`svg`,{width:12,height:12,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,l.jsx)(`path`,{d:`M8 11 3 5h10l-5 6Z`})})}),t?(0,l.jsx)(`div`,{className:`github-split-menu`,id:i,role:`menu`,"aria-label":`Source and package links`,children:a.map(e=>(0,l.jsxs)(`a`,{className:`github-split-item`,href:e.href,target:`_blank`,rel:`noreferrer`,role:`menuitem`,onClick:s,children:[(0,l.jsx)(g,{id:e.id,size:14}),(0,l.jsxs)(`span`,{className:`github-split-item-text`,children:[(0,l.jsx)(`span`,{className:`github-split-item-label`,children:e.label}),(0,l.jsx)(`span`,{className:`github-split-item-hint`,children:e.hint})]})]},e.id))}):null]})})}export{s as n,_ as t};
1
+ import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CXUMngI_.js";import{a as i,c as a,i as o}from"./app-2KhtHCv9.js";var s=e(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),c=t(n(),1),l=r(),u=`https://img.shields.io`;function d(e,t){let n=new URLSearchParams({style:`flat-square`,labelColor:`0b1220`,color:t});return`${u}/github/${e}/${o}?${n.toString()}`}function f({size:e=16}){return(0,l.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,l.jsx)(`path`,{d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z`})})}function p({size:e=15}){return(0,l.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,l.jsx)(`path`,{d:`M0 0v16h16V0H0Zm13 13h-2V5H8v8H3V3h10v10Z`})})}function m({size:e=15}){return(0,l.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,l.jsx)(`path`,{d:`m15.5 6.3-.02-.06-2.14-5.58a.56.56 0 0 0-.22-.26.57.57 0 0 0-.65.03.57.57 0 0 0-.19.29l-1.45 4.42H5.17L3.72.72A.57.57 0 0 0 3.53.43a.57.57 0 0 0-.65-.03.56.56 0 0 0-.22.26L.52 6.24l-.02.06a3.97 3.97 0 0 0 1.32 4.59l.01.01.02.02 3.25 2.44 1.61 1.22.98.74a.67.67 0 0 0 .81 0l.98-.74 1.61-1.22 3.26-2.45.01-.01a3.97 3.97 0 0 0 1.32-4.59Z`})})}function h({size:e=15}){return(0,l.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,l.jsx)(`path`,{d:`M13.55 3.02A12.6 12.6 0 0 0 10.5 2.1a8.9 8.9 0 0 0-.4.83 11.7 11.7 0 0 0-3.2 0 8.6 8.6 0 0 0-.41-.83 12.6 12.6 0 0 0-3.05.92C1.3 5.75.85 8.4 1.07 11.01a12.7 12.7 0 0 0 3.74 1.9c.3-.41.57-.85.8-1.31-.44-.17-.86-.37-1.26-.6l.31-.24a9 9 0 0 0 7.68 0l.31.24c-.4.23-.82.43-1.26.6.23.46.5.9.8 1.31a12.7 12.7 0 0 0 3.74-1.9c.26-3.03-.44-5.66-1.98-7.99ZM5.68 9.4c-.73 0-1.33-.67-1.33-1.49s.59-1.49 1.33-1.49c.74 0 1.34.68 1.33 1.49 0 .82-.59 1.49-1.33 1.49Zm4.64 0c-.73 0-1.33-.67-1.33-1.49s.59-1.49 1.33-1.49c.74 0 1.34.68 1.33 1.49 0 .82-.59 1.49-1.33 1.49Z`})})}function g({id:e,size:t}){return e===`npm`?(0,l.jsx)(p,{size:t}):e===`gitlab`?(0,l.jsx)(m,{size:t}):e===`discord`?(0,l.jsx)(h,{size:t}):(0,l.jsx)(f,{size:t})}function _({className:e=``}){let[t,n]=(0,c.useState)(!1),r=(0,c.useRef)(null),o=(0,c.useId)(),s=(0,c.useCallback)(()=>n(!1),[]);return(0,c.useEffect)(()=>{if(!t)return;let e=e=>{r.current!==null&&!r.current.contains(e.target)&&s()},n=e=>{e.key===`Escape`&&s()};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,n)}},[t,s]),(0,l.jsx)(`div`,{className:e,ref:r,children:(0,l.jsxs)(`div`,{className:`github-split`,children:[(0,l.jsxs)(`a`,{className:`github-badge`,href:i,target:`_blank`,rel:`noreferrer`,"aria-label":`Cartethyia on GitHub`,children:[(0,l.jsx)(f,{size:15}),(0,l.jsx)(`img`,{className:`github-badge-metric`,src:d(`stars`,`2ea043`),alt:`GitHub stars`,height:20,loading:`lazy`,decoding:`async`}),(0,l.jsx)(`img`,{className:`github-badge-metric`,src:d(`forks`,`1f6feb`),alt:`GitHub forks`,height:20,loading:`lazy`,decoding:`async`})]}),(0,l.jsx)(`button`,{type:`button`,className:`github-split-toggle`,"aria-haspopup":`menu`,"aria-expanded":t,"aria-controls":o,"aria-label":`More ways to get Cartethyia`,onClick:()=>n(e=>!e),children:(0,l.jsx)(`svg`,{width:12,height:12,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,l.jsx)(`path`,{d:`M8 11 3 5h10l-5 6Z`})})}),t?(0,l.jsx)(`div`,{className:`github-split-menu`,id:o,role:`menu`,"aria-label":`Source and package links`,children:a.map(e=>(0,l.jsxs)(`a`,{className:`github-split-item`,href:e.href,target:`_blank`,rel:`noreferrer`,role:`menuitem`,onClick:s,children:[(0,l.jsx)(g,{id:e.id,size:14}),(0,l.jsxs)(`span`,{className:`github-split-item-text`,children:[(0,l.jsx)(`span`,{className:`github-split-item-label`,children:e.label}),(0,l.jsx)(`span`,{className:`github-split-item-hint`,children:e.hint})]})]},e.id))}):null]})})}export{f as n,s as r,_ as t};