keyrouter 1.0.4 → 1.0.5

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 (508) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +19 -19
  3. package/app/.next-cli-build/build-manifest.json +3 -3
  4. package/app/.next-cli-build/prerender-manifest.json +19 -19
  5. package/app/.next-cli-build/react-loadable-manifest.json +8 -8
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +5 -5
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-injection/page.js +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-injection/page.js.nft.json +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-injection/page_client-reference-manifest.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  75. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  76. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  77. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  78. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  79. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  80. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  81. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  82. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  83. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  84. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  85. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  86. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  87. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  88. package/app/.next-cli-build/server/app/_not-found.rsc +7 -7
  89. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +7 -7
  90. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +7 -7
  91. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  92. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  93. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  94. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  95. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  96. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  97. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
  98. package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js.nft.json +1 -1
  99. package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js.nft.json +1 -1
  100. package/app/.next-cli-build/server/app/api/auth/saml/start/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/auth/saml/test/route.js.nft.json +1 -1
  102. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  104. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js.nft.json +1 -1
  110. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  112. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  114. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js.nft.json +1 -1
  116. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js.nft.json +1 -1
  118. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js.nft.json +1 -1
  120. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/hermes-profiles/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js.nft.json +1 -1
  126. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  131. package/app/.next-cli-build/server/app/api/combos/presets/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  136. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  138. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  143. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  149. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
  155. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  157. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  160. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  162. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  164. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  165. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  168. package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  170. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  171. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  175. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js.nft.json +1 -1
  177. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/start/route.js.nft.json +1 -1
  179. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/status/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/oauth/zed/auto-import/route.js.nft.json +1 -1
  181. package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js.nft.json +1 -1
  182. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/prompt-injection/route.js.nft.json +1 -1
  184. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  186. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  188. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  189. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  190. package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  192. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  194. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  196. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  198. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  199. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  201. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  202. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  203. package/app/.next-cli-build/server/app/api/providers/web-login/route.js.nft.json +1 -1
  204. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  205. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  206. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  207. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  208. package/app/.next-cli-build/server/app/api/proxy-pools/netlify-deploy/route.js.nft.json +1 -1
  209. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  210. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  212. package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  213. package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  215. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  217. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  219. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  221. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  223. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  224. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  225. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  226. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  228. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  230. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  232. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  234. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  236. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  237. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
  241. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js.nft.json +1 -1
  242. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  243. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  244. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  245. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  246. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  248. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  250. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  252. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  254. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  255. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  256. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  257. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
  259. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  261. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  263. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  264. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  265. package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  267. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  268. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  270. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  271. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  272. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  273. package/app/.next-cli-build/server/app/api/v1/systemone/route.js.nft.json +1 -1
  274. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  275. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  276. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  277. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  278. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  279. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  280. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  281. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  282. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  283. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  284. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  285. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  286. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  287. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  288. package/app/.next-cli-build/server/app/callback.html +1 -1
  289. package/app/.next-cli-build/server/app/callback.rsc +7 -7
  290. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +7 -7
  291. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  292. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +7 -7
  293. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  294. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +7 -7
  295. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +7 -7
  296. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +7 -7
  297. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  298. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  299. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +8 -8
  300. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +8 -8
  301. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +8 -8
  302. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  303. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  304. package/app/.next-cli-build/server/app/dashboard/combos.rsc +8 -8
  305. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +8 -8
  306. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +8 -8
  307. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  308. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  309. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +8 -8
  310. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +8 -8
  311. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +8 -8
  312. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  313. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  314. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +7 -7
  315. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +7 -7
  316. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +7 -7
  317. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
  318. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  319. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +8 -8
  320. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +8 -8
  321. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +8 -8
  322. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  323. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  324. package/app/.next-cli-build/server/app/dashboard/profile.rsc +8 -8
  325. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +8 -8
  326. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +8 -8
  327. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  328. package/app/.next-cli-build/server/app/dashboard/prompt-injection.html +1 -1
  329. package/app/.next-cli-build/server/app/dashboard/prompt-injection.rsc +8 -8
  330. package/app/.next-cli-build/server/app/dashboard/prompt-injection.segments/!KGRhc2hib2FyZCk/dashboard/prompt-injection/__PAGE__.segment.rsc +8 -8
  331. package/app/.next-cli-build/server/app/dashboard/prompt-injection.segments/_full.segment.rsc +8 -8
  332. package/app/.next-cli-build/server/app/dashboard/prompt-injection.segments/_tree.segment.rsc +2 -2
  333. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  334. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +7 -7
  335. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +7 -7
  336. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -7
  337. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  338. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  339. package/app/.next-cli-build/server/app/dashboard/providers.rsc +8 -8
  340. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +8 -8
  341. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +8 -8
  342. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  343. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  344. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +8 -8
  345. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +8 -8
  346. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +8 -8
  347. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  348. package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  349. package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +8 -8
  350. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +8 -8
  351. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +8 -8
  352. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +2 -2
  353. package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  354. package/app/.next-cli-build/server/app/dashboard/quota.rsc +8 -8
  355. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +8 -8
  356. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +8 -8
  357. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  358. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
  359. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  360. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  361. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  362. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +8 -8
  363. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +8 -8
  364. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  365. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +8 -8
  366. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  367. package/app/.next-cli-build/server/app/dashboard/skills.rsc +8 -8
  368. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +8 -8
  369. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +8 -8
  370. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
  371. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  372. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +8 -8
  373. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +8 -8
  374. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +8 -8
  375. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
  376. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  377. package/app/.next-cli-build/server/app/dashboard/translator.rsc +7 -7
  378. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +7 -7
  379. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +7 -7
  380. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  381. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  382. package/app/.next-cli-build/server/app/dashboard/usage.rsc +9 -9
  383. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +9 -9
  384. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +9 -9
  385. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  386. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  387. package/app/.next-cli-build/server/app/dashboard.rsc +8 -8
  388. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +8 -8
  389. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +8 -8
  390. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  391. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  392. package/app/.next-cli-build/server/app/index.html +1 -1
  393. package/app/.next-cli-build/server/app/index.rsc +7 -7
  394. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +7 -7
  395. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +7 -7
  396. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  397. package/app/.next-cli-build/server/app/landing/page.js +1 -1
  398. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  399. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  400. package/app/.next-cli-build/server/app/landing.html +1 -1
  401. package/app/.next-cli-build/server/app/landing.rsc +8 -8
  402. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +8 -8
  403. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  404. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +8 -8
  405. package/app/.next-cli-build/server/app/login/page.js +1 -1
  406. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  407. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  408. package/app/.next-cli-build/server/app/login.html +1 -1
  409. package/app/.next-cli-build/server/app/login.rsc +8 -8
  410. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +8 -8
  411. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  412. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +8 -8
  413. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  414. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  415. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  416. package/app/.next-cli-build/server/app-paths-manifest.json +19 -19
  417. package/app/.next-cli-build/server/chunks/1051.js +1 -1
  418. package/app/.next-cli-build/server/chunks/2172.js +1 -1
  419. package/app/.next-cli-build/server/chunks/3449.js +1 -1
  420. package/app/.next-cli-build/server/chunks/3697.js +1 -1
  421. package/app/.next-cli-build/server/chunks/412.js +6 -6
  422. package/app/.next-cli-build/server/chunks/4190.js +1 -1
  423. package/app/.next-cli-build/server/chunks/4620.js +1 -0
  424. package/app/.next-cli-build/server/chunks/5299.js +7 -7
  425. package/app/.next-cli-build/server/chunks/615.js +1 -1
  426. package/app/.next-cli-build/server/chunks/6708.js +1 -1
  427. package/app/.next-cli-build/server/chunks/7066.js +1 -1
  428. package/app/.next-cli-build/server/chunks/8128.js +1 -1
  429. package/app/.next-cli-build/server/chunks/8251.js +1 -1
  430. package/app/.next-cli-build/server/chunks/8682.js +3 -3
  431. package/app/.next-cli-build/server/chunks/869.js +1 -1
  432. package/app/.next-cli-build/server/chunks/9604.js +1 -1
  433. package/app/.next-cli-build/server/instrumentation.js.nft.json +1 -1
  434. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  435. package/app/.next-cli-build/server/middleware-react-loadable-manifest.js +1 -1
  436. package/app/.next-cli-build/server/middleware.js.nft.json +1 -1
  437. package/app/.next-cli-build/server/pages/404.html +1 -1
  438. package/app/.next-cli-build/server/pages/500.html +1 -1
  439. package/app/.next-cli-build/static/chunks/{124.b7052d76521ac60b.js → 124.2dcfd9a087c9e48b.js} +1 -1
  440. package/app/.next-cli-build/static/chunks/{2435.51481baa53b475e1.js → 2435.7cc8c894f4a21999.js} +1 -1
  441. package/app/.next-cli-build/static/chunks/{2470-e9f1fd5f21c43fac.js → 2470-73a591ec7a5bdf40.js} +1 -1
  442. package/app/.next-cli-build/static/chunks/3521.96065c08772d432e.js +1 -0
  443. package/app/.next-cli-build/static/chunks/3557-ab733a862d0bba72.js +10 -0
  444. package/app/.next-cli-build/static/chunks/{5462.500e87268a882da6.js → 5462.b5dccc4c3626a6a1.js} +1 -1
  445. package/app/.next-cli-build/static/chunks/5496-336ad33bc5785fb5.js +9 -0
  446. package/app/.next-cli-build/static/chunks/5497-b6161d058c4b63f4.js +1 -0
  447. package/app/.next-cli-build/static/chunks/6808-ecaf0603c2c647dd.js +1 -0
  448. package/app/.next-cli-build/static/chunks/761-748923a2523301a7.js +132 -0
  449. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/page-dc2bbddae0338265.js +1 -0
  450. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-946dbaff84568fd1.js +1 -0
  451. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/page-c995565de72de5d6.js +1 -0
  452. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-569d2ce1c361cb5b.js → page-e9856c47cc41d2f2.js} +5 -5
  453. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/page-d8d32b819432e76e.js +1 -0
  454. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/prompt-injection/page-c0c7f0ec4d840259.js +1 -0
  455. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-745147f2bf98d096.js +27 -0
  456. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-3006aca559388a7a.js +1 -0
  457. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-c832cd28ad361668.js +4 -0
  458. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/pxpipe/page-f4d89bf3d96928c9.js +1 -0
  459. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-33826a8bc196b7de.js +1 -0
  460. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-6acecf90f03a1af3.js +1 -0
  461. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/page-71814d68cea6ef7d.js +1 -0
  462. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-ebe244550b022a8f.js +1 -0
  463. package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-84ba30538381db07.js +1 -0
  464. package/app/.next-cli-build/static/chunks/app/dashboard/settings/pricing/page-607b1f15b82c8bba.js +1 -0
  465. package/app/.next-cli-build/static/chunks/app/landing/page-3e38f4876602c2fb.js +1 -0
  466. package/app/.next-cli-build/static/chunks/app/{layout-5be078fd5da689ca.js → layout-8e337d947af1970c.js} +1 -1
  467. package/app/.next-cli-build/static/chunks/app/login/{page-d50a71c8703d2790.js → page-17082356385ade34.js} +1 -1
  468. package/app/.next-cli-build/static/chunks/{webpack-01b0b9fe7dbba18d.js → webpack-a1905b20ab1a879d.js} +1 -1
  469. package/app/.next-cli-build/static/css/d7b388223f36a397.css +1 -0
  470. package/app/package.json +1 -1
  471. package/app/public/favicon.svg +2 -12
  472. package/app/public/fonts/arabic-subset.ttf +0 -0
  473. package/app/public/fonts/bengali-subset.ttf +0 -0
  474. package/app/public/fonts/devanagari-subset.ttf +0 -0
  475. package/app/public/fonts/hebrew-subset.ttf +0 -0
  476. package/app/public/fonts/jp-subset.ttf +0 -0
  477. package/app/public/fonts/khmer-subset.ttf +0 -0
  478. package/app/public/fonts/kr-subset.ttf +0 -0
  479. package/app/public/fonts/sc-subset.ttf +0 -0
  480. package/app/public/fonts/tc-subset.ttf +0 -0
  481. package/app/public/fonts/thai-subset.ttf +0 -0
  482. package/package.json +1 -1
  483. package/app/.next-cli-build/server/chunks/5626.js +0 -1
  484. package/app/.next-cli-build/static/chunks/3521.03e47d524e0fcbf6.js +0 -1
  485. package/app/.next-cli-build/static/chunks/3557-437defff109ccb42.js +0 -10
  486. package/app/.next-cli-build/static/chunks/5496-a3a9ad577f310490.js +0 -9
  487. package/app/.next-cli-build/static/chunks/5497-3add1c35ece30dbf.js +0 -1
  488. package/app/.next-cli-build/static/chunks/6808-4e4ca2233c09ffad.js +0 -1
  489. package/app/.next-cli-build/static/chunks/761-00700c1c25957243.js +0 -132
  490. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/page-7feaa4a67a8eb771.js +0 -1
  491. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-624e8d61fe459544.js +0 -1
  492. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/page-5da47ad2a6d8d5de.js +0 -1
  493. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/page-628c4ef1c9482980.js +0 -1
  494. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/prompt-injection/page-35a6881f7569aa64.js +0 -1
  495. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-3b9d43febf1e79d4.js +0 -27
  496. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-e9c955f52e5ae812.js +0 -1
  497. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-bbf57717de4a9782.js +0 -4
  498. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/pxpipe/page-b275a947fc978997.js +0 -1
  499. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-5434337e59f24de1.js +0 -1
  500. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-c7eb81dfb0b4fd77.js +0 -1
  501. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/page-1b0510b28ff8de92.js +0 -1
  502. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-be974a86e9053540.js +0 -1
  503. package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-18c2613dd78ff66f.js +0 -1
  504. package/app/.next-cli-build/static/chunks/app/dashboard/settings/pricing/page-c439d82cf7840dc9.js +0 -1
  505. package/app/.next-cli-build/static/chunks/app/landing/page-38fc3c430a1a29dc.js +0 -1
  506. package/app/.next-cli-build/static/css/841943e9a30fe5cd.css +0 -1
  507. /package/app/.next-cli-build/static/{7Sq72xYQxt_cCm5BESVbY → nPdnpoRoh59z5OwsCS3Vd}/_buildManifest.js +0 -0
  508. /package/app/.next-cli-build/static/{7Sq72xYQxt_cCm5BESVbY → nPdnpoRoh59z5OwsCS3Vd}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8460],{13950:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>A});var a=s(95155),r=s(12115),l=s(73321),i=s(14051),n=s.n(i),o=s(35497),c=s(57250),d=s(8247),m=s(90620),p=s(88105),x=s(98500),u=s.n(x),h=s(65921),f=s(38003);let b={available:{icon:"check_circle",color:"#22c55e",label:"Available"},cooldown:{icon:"schedule",color:"#f59e0b",label:"Cooldown"},unavailable:{icon:"error",color:"#ef4444",label:"Unavailable"},unknown:{icon:"help",color:"#6b7280",label:"Unknown"}};function g(){let[e,t]=(0,r.useState)(null),[s,l]=(0,r.useState)(!0),[i,n]=(0,r.useState)(!1),[c,d]=(0,r.useState)(null),m=(0,r.useRef)(null),p=(0,h.i)(),x=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/availability");if(e.ok){let s=await e.json();t(s)}}catch{}finally{l(!1)}},[]);(0,r.useEffect)(()=>{x();let e=setInterval(x,3e4);return()=>clearInterval(e)},[x]),(0,r.useEffect)(()=>{let e=e=>{m.current&&!m.current.contains(e.target)&&n(!1)};return i&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);let u=async(e,t)=>{d(`${e}:${t}`);try{(await fetch("/api/models/availability",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clearCooldown",provider:e,model:t})})).ok?(p.success(`Cooldown cleared for ${t}`),await x()):p.error("Failed to clear cooldown")}catch{p.error("Failed to clear cooldown")}finally{d(null)}};if(s)return null;let f=e?.models||[],g=0===(e?.unavailableCount||f.filter(e=>"available"!==e.status).length),v={};return f.forEach(e=>{if("available"===e.status)return;let t=e.provider||"unknown";v[t]||(v[t]=[]),v[t].push(e)}),(0,a.jsx)("div",{className:"relative",ref:m,children:i&&(0,a.jsxs)("div",{className:"absolute top-full right-0 mt-2 w-80 bg-surface border border-border rounded-xl shadow-2xl z-50 overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-bg",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",style:{color:g?"#22c55e":"#f59e0b"},children:g?"verified":"warning"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-text-main",children:"Model Status"})]}),(0,a.jsx)("button",{onClick:x,className:"p-1 rounded-lg hover:bg-surface text-text-muted hover:text-text-main transition-colors",title:"Refresh",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"})})]}),(0,a.jsx)("div",{className:"px-4 py-3 max-h-60 overflow-y-auto",children:g?(0,a.jsx)("p",{className:"text-sm text-text-muted text-center py-2",children:"All models are responding normally."}):(0,a.jsx)("div",{className:"flex flex-col gap-2.5",children:Object.entries(v).map(([e,t])=>(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-text-main mb-1.5 capitalize",children:e}),(0,a.jsx)("div",{className:"flex flex-col gap-1",children:t.map(e=>{let t=b[e.status]||b.unknown,s=c===`${e.provider}:${e.model}`;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5 rounded-lg bg-surface/30",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] shrink-0",style:{color:t.color},children:t.icon}),(0,a.jsx)("span",{className:"font-mono text-xs text-text-main truncate",children:e.model})]}),"cooldown"===e.status&&(0,a.jsx)(o.$n,{size:"sm",variant:"ghost",onClick:()=>u(e.provider,e.model),disabled:s,className:"text-[10px] px-1.5! py-0.5! ml-2",children:s?"...":"Clear"})]},`${e.provider}-${e.model}`)})})]},e))})})]})})}let v={openai:{title:"Add OpenAI Compatible",type:"openai-compatible",defaultBaseUrl:"https://api.openai.com/v1",namePlaceholder:"OpenAI Compatible (Prod)",prefixPlaceholder:"oc-prod",baseUrlHint:"Use the base URL (ending in /v1) for your OpenAI-compatible API.",modelIdPlaceholder:"e.g. gpt-4, claude-3-opus",errorLabel:"OpenAI Compatible",hasApiType:!0},anthropic:{title:"Add Anthropic Compatible",type:"anthropic-compatible",defaultBaseUrl:"https://api.anthropic.com/v1",namePlaceholder:"Anthropic Compatible (Prod)",prefixPlaceholder:"ac-prod",baseUrlHint:"Use the base URL (ending in /v1) for your Anthropic-compatible API. The system will append /messages.",modelIdPlaceholder:"e.g. claude-3-opus",errorLabel:"Anthropic Compatible",hasApiType:!1}},y=[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}];function j({variant:e,isOpen:t,onClose:s,onCreated:l}){let i=v[e],n=()=>({name:"",prefix:"",...i.hasApiType?{apiType:"chat"}:{},baseUrl:i.defaultBaseUrl}),[c,d]=(0,r.useState)(n),[m,p]=(0,r.useState)(!1),[x,u]=(0,r.useState)(""),[h,f]=(0,r.useState)(""),[b,g]=(0,r.useState)(!1),[N,k]=(0,r.useState)(null);(0,r.useEffect)(()=>{i.hasApiType?d(e=>({...e,baseUrl:i.defaultBaseUrl})):t&&(k(null),u(""),f(""))},[i.hasApiType?c.apiType:t]);let w=async()=>{if(c.name.trim()&&c.prefix.trim()&&c.baseUrl.trim()){p(!0);try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:c.name,prefix:c.prefix,...i.hasApiType?{apiType:c.apiType}:{},baseUrl:c.baseUrl,type:i.type})}),t=await e.json();e.ok&&(l(t.node),d(n()),u(""),k(null))}catch(e){console.log(`Error creating ${i.errorLabel} node:`,e)}finally{p(!1)}}},C=async()=>{g(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:c.baseUrl,apiKey:x,type:i.type,modelId:h.trim()||void 0})}),t=await e.json();k(t)}catch{k({valid:!1,error:"Network error"})}finally{g(!1)}};return(0,a.jsx)(o.aF,{isOpen:t,title:i.title,onClose:s,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(o.pd,{label:"Name",value:c.name,onChange:e=>d({...c,name:e.target.value}),placeholder:i.namePlaceholder,hint:"Required. A friendly label for this node."}),(0,a.jsx)(o.pd,{label:"Prefix",value:c.prefix,onChange:e=>d({...c,prefix:e.target.value}),placeholder:i.prefixPlaceholder,hint:"Required. Used as the provider prefix for model IDs."}),i.hasApiType&&(0,a.jsx)(o.l6,{label:"API Type",options:y,value:c.apiType,onChange:e=>d({...c,apiType:e.target.value})}),(0,a.jsx)(o.pd,{label:"Base URL",value:c.baseUrl,onChange:e=>d({...c,baseUrl:e.target.value}),placeholder:i.defaultBaseUrl,hint:i.baseUrlHint}),(0,a.jsx)(o.pd,{label:"API Key (for Check)",type:"password",value:x,onChange:e=>u(e.target.value)}),(0,a.jsx)(o.pd,{label:"Model ID (optional)",value:h,onChange:e=>f(e.target.value),placeholder:i.modelIdPlaceholder,hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[(0,a.jsx)(o.$n,{onClick:C,disabled:!x||b||!c.baseUrl.trim(),variant:"secondary",className:"w-full sm:w-auto",children:b?"Checking...":"Check"}),(()=>{if(!N)return null;let{valid:e,error:t,method:s}=N;return e?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Ex,{variant:"success",children:"Valid"}),"chat"===s&&(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"(via inference test)"})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)(o.Ex,{variant:"error",children:"Invalid"}),t&&(0,a.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,a.jsx)(o.$n,{onClick:w,fullWidth:!0,disabled:!c.name.trim()||!c.prefix.trim()||!c.baseUrl.trim()||m,children:m?"Creating...":"Create"}),(0,a.jsx)(o.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}j.propTypes={variant:n().oneOf(["openai","anthropic"]).isRequired,isOpen:n().bool.isRequired,onClose:n().func.isRequired,onCreated:n().func.isRequired};let N={all:{icon:"apps"},active:{icon:"check_circle"},inactive:{icon:"pause_circle"},none:{icon:"link_off"}};function k({options:e,value:t,onChange:s}){let[l,i]=(0,r.useState)(!1),n=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=e=>{n.current&&!n.current.contains(e.target)&&i(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let o=e.find(e=>e.value===t)||e[0];return(0,a.jsxs)("div",{className:"relative w-full sm:w-44",ref:n,children:[(0,a.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),"aria-haspopup":"listbox","aria-expanded":l,className:"flex h-9 w-full items-center gap-2 rounded-lg border border-border bg-surface-2 px-3 font-display text-sm text-text-main outline-none transition-colors hover:border-text-subtle focus-visible:ring-2 focus-visible:ring-text-subtle/60",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted",children:"filter_alt"}),(0,a.jsx)("span",{className:"flex-1 text-left font-display",children:o?.label}),(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] text-text-muted transition-transform duration-150 ${l?"rotate-180":""}`,children:"expand_more"})]}),l&&(0,a.jsx)("div",{role:"listbox",className:"absolute left-0 right-0 z-30 mt-2 overflow-hidden rounded-xl border border-border bg-surface p-1 shadow-[var(--shadow-elevated)]",children:e.map(e=>{let r=e.value===t,l=N[e.value]||{icon:"label"};return(0,a.jsxs)("button",{type:"button",role:"option","aria-selected":r,onClick:()=>{s(e.value),i(!1)},className:`group flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm transition-colors ${r?"bg-surface-2 text-text-main":"text-text-muted hover:text-primary dark:hover:text-primary"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${r?"text-text-main":"text-text-subtle group-hover:text-primary dark:group-hover:text-primary"}`,children:l.icon}),(0,a.jsx)("span",{className:"flex-1 font-display",children:e.label}),r&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary dark:text-primary",children:"check"})]},e.value)})})]})}k.propTypes={options:n().arrayOf(n().shape({value:n().string.isRequired,label:n().string.isRequired})).isRequired,value:n().string.isRequired,onChange:n().func.isRequired};let w=[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"none",label:"No connection"}];function C(e){let t=Object.entries(e).some(([e,t])=>e.startsWith("modelLock_")&&t&&new Date(t).getTime()>Date.now());return"unavailable"!==e.testStatus||t?e.testStatus:"active"}function A(){return(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)(o.Qv,{}),children:(0,a.jsx)(T,{})})}function T(){let e,t,s=(0,l.useSearchParams)(),i=(0,l.useRouter)(),n=["custom","oauth","free","apikey"],d="providersActiveTab",x=(()=>{let e=s.get("tab");if(e&&n.includes(e))return e;{let e=window.localStorage.getItem(d);if(e&&n.includes(e))return e}return"custom"})(),[u,b]=(0,r.useState)([]),[v,y]=(0,r.useState)([]),[N,A]=(0,r.useState)(!0),[T,$]=(0,r.useState)(!1),[R,O]=(0,r.useState)(!1),[E,_]=(0,r.useState)(!1),[U,z]=(0,r.useState)(null),[q,D]=(0,r.useState)(null),[L,M]=(0,r.useState)("all"),F=(0,h.i)(),K=(0,f.C)(e=>e.query),H=(0,f.C)(e=>e.register),J=(0,f.C)(e=>e.unregister);(0,r.useEffect)(()=>(H("Search providers..."),()=>J()),[H,J]);let B=e=>!K.trim()||!!e&&e.toLowerCase().includes(K.trim().toLowerCase());(0,r.useEffect)(()=>{(async()=>{try{let[e,t]=await Promise.all([fetch("/api/providers"),fetch("/api/provider-nodes")]),s=await e.json(),a=await t.json();e.ok&&b(s.connections||[]),t.ok&&y(a.nodes||[])}catch(e){console.log("Error fetching data:",e)}finally{A(!1)}})()},[]);let W=(e,t)=>{let s=Array.isArray(t)?t:[t],a=u.filter(t=>t.provider===e&&s.includes(t.authType)),r=a.filter(e=>{let t=C(e);return"active"===t||"success"===t}).length,l=a.filter(e=>{let t=C(e);return"error"===t||"expired"===t||"unavailable"===t}),i=l.length,n=a.length,o=n>0&&a.every(e=>!1===e.isActive),c=l.sort((e,t)=>new Date(t.lastErrorAt||0)-new Date(e.lastErrorAt||0))[0];return{connected:r,error:i,total:n,errorCode:c?function(e){if(!e)return null;let t=e.lastErrorType;if("runtime_error"===t)return"RUNTIME";if("upstream_auth_error"===t||"auth_missing"===t||"token_refresh_failed"===t||"token_expired"===t)return"AUTH";if("upstream_rate_limited"===t)return"429";if("upstream_unavailable"===t)return"5XX";if("network_error"===t)return"NET";let s=Number(e.errorCode);if(Number.isFinite(s)&&s>=400)return String(s);let a=function(e){if(!e)return null;let t=e.match(/\b([45]\d{2})\b/);return t?t[1]:"ERR"}(e.lastError);if("401"===a||"403"===a)return"AUTH";if(a&&"ERR"!==a)return a;let r=(e.lastError||"").toLowerCase();return r.includes("runtime")||r.includes("not runnable")||r.includes("not installed")?"RUNTIME":r.includes("invalid api key")||r.includes("token invalid")||r.includes("revoked")||r.includes("unauthorized")?"AUTH":"ERR"}(c):null,errorTime:c?.lastErrorAt?function(e){if(!e)return"";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let s=Math.floor(t/60);if(s<24)return`${s}h ago`;let a=Math.floor(s/24);return`${a}d ago`}(c.lastErrorAt):null,allDisabled:o}},Q=(e,t)=>(function(e,t,s=!1){return"all"===e||function(e,t=!1){return t?"active":e&&0!==e.total?e.allDisabled?"inactive":"active":"none"}(t,s)===e})(L,e,t),Z=async(e,t,s)=>{let a=Array.isArray(t)?t:[t],r=t=>t.provider===e&&a.includes(t.authType),l=u.filter(r);b(e=>e.map(e=>r(e)?{...e,isActive:s}:e)),await Promise.allSettled(l.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:s})})))},X=async(e,t=null)=>{if(!U){z("provider"===e?t:e),D(null);try{let s=await fetch("/api/providers/test-batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e,providerId:t})}),a=await s.json();if(D(a),a.summary){let{passed:e,failed:t,total:s}=a.summary;0===t?F.success(`All ${s} tests passed`):F.warning(`${e}/${s} passed, ${t} failed`)}}catch(e){D({error:"Test request failed"}),F.error("Provider test failed")}finally{z(null)}}},V=v.filter(e=>"openai-compatible"===e.type).map(e=>({id:e.id,name:e.name||"OpenAI Compatible",color:"#10A37F",textIcon:"OC",apiType:e.apiType})).filter(e=>B(e.name)&&Q(W(e.id,"apikey"))),Y=v.filter(e=>"anthropic-compatible"===e.type).map(e=>({id:e.id,name:e.name||"Anthropic Compatible",color:"#D97757",textIcon:"AC"})).filter(e=>B(e.name)&&Q(W(e.id,"apikey"))),G=(e,t)=>{if("kiro"===t)return["oauth","apikey","api_key"];let s=e?.authModes;return Array.isArray(s)?s.includes("apikey")?["oauth","apikey","api_key"]:"oauth":t in p.nJ||t in m.fg?["oauth","apikey","api_key"]:"oauth"},ee=(e=Object.entries(m.zN).filter(([e,t])=>!t.hidden&&B(t.name)&&Q(W(e,G(t,e)),t.noAuth)),t="oauth",[...e].sort(([e,s],[a,r])=>{let l=s.priority??999,i=r.priority??999;if(l!==i)return l-i;let n=W(e,t),o=W(a,t),c=+(n.connected>0),d=+(o.connected>0);return c!==d?d-c:(s.name||"").localeCompare(r.name||"")})),et=Object.entries(p.IS).filter(([e,t])=>!t.hidden&&B(t.name)&&Q(W(e,G(t,e)),t.noAuth)).sort(([,e],[,t])=>!!t.noAuth-!!e.noAuth),es=Object.entries(p.nJ).filter(([e,t])=>!t.hidden&&B(t.name)&&(t.serviceKinds??["llm"]).includes("llm")&&Q(W(e,G(t,e)),t.noAuth)).sort(([e,t],[s,a])=>{let r=t.priority??999,l=a.priority??999;if(r!==l)return r-l;let i=!!a.noAuth-!!t.noAuth;if(0!==i)return i;let n=W(e,G(t,e)).connected>0?0:1,o=W(s,G(a,s)).connected>0?0:1;return n!==o?n-o:(t.name||"").localeCompare(a.name||"")}),ea=Object.entries(m.fg).filter(([e,t])=>!t.hidden&&(t.serviceKinds??["llm"]).includes("llm")&&B(t.name)&&Q(W(e,"apikey"),t.noAuth)).sort(([e,t],[s,a])=>{let r=W(e,"apikey").total>0?0:1,l=W(s,"apikey").total>0?0:1;return r!==l?r-l:(t.name||"").localeCompare(a.name||"")}),er=!!K.trim()||"all"!==L,el=er||T?ea:ea.slice(0,20),ei=ea.length-20,en=Object.entries(p.br).filter(([e,t])=>!t.hidden&&(t.serviceKinds??["llm"]).includes("llm")&&B(t.name)&&Q(W(e,"cookie"),t.noAuth)).sort(([e,t],[s,a])=>{let r=W(e,"cookie").total>0?0:1,l=W(s,"cookie").total>0?0:1;return r!==l?r-l:(t.name||"").localeCompare(a.name||"")});if(N)return(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(o.Qv,{}),(0,a.jsx)(o.Qv,{})]});let eo=ee.length>0||et.length>0||es.length>0||ea.length>0||en.length>0||V.length>0||Y.length>0,ec={total:u.length,connected:u.filter(e=>{let t=C(e);return"active"===t||"success"===t}).length,errors:u.filter(e=>{let t=C(e);return"error"===t||"expired"===t||"unavailable"===t}).length,activeProviders:new Set(u.filter(e=>!1!==e.isActive).map(e=>e.provider)).size,uniqueProviders:new Set(u.map(e=>e.provider)).size},ed=e=>(0,a.jsxs)("button",{onClick:()=>X(e),disabled:!!U,className:`flex w-full items-center justify-center gap-2 rounded-lg px-3.5 py-2 font-display text-sm font-medium transition-colors sm:w-auto ${U===e?"bg-primary text-white dark:text-amber-950 animate-pulse":"border border-border bg-surface text-text-muted hover:border-text-subtle hover:text-text-main"}`,title:`Test all ${e} connections`,"aria-label":`Test all ${e} connections`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px]${U===e?" animate-spin":""}`,children:"play_arrow"}),U===e?"Testing...":"Test All"]}),em=[{id:"custom",label:"Custom",icon:"extension",count:V.length+Y.length},{id:"oauth",label:"OAuth",icon:"lock_open",count:ee.length},{id:"free",label:"Free Tier",icon:"spa",count:et.length+es.length},{id:"apikey",label:"API Key",icon:"vpn_key",count:ea.length+en.length}],ep=(e,t)=>e.map(e=>{let{id:s,key:a,info:r,stats:l,authType:i,onToggle:n}=t(e);return{key:a??s,id:s,info:r,stats:l,authType:i,onToggle:n,size:"compact"}}),ex=ep([...V,...Y],e=>({id:e.id,info:e,stats:W(e.id,"apikey"),authType:"compatible",onToggle:t=>Z(e.id,"apikey",t)})),eu=ep(ee,([e,t])=>{let s=G(t,e);return{id:e,info:t,stats:W(e,s),authType:"oauth",onToggle:t=>Z(e,s,t)}}),eh=ep([...et.map(([e,t])=>({key:e,info:t,kind:"free"})),...es.map(([e,t])=>({key:e,info:t,kind:"freeTier"}))],({key:e,info:t,kind:s})=>{let a=G(t,e),r="freeTier"===s?Array.isArray(a)?a[0]??"apikey":a:"free";return{id:e,key:`${s}-${e}`,info:t,stats:W(e,a),authType:r,onToggle:t=>Z(e,a,t)}}),ef=ep([...el.map(([e,t])=>({key:e,info:t,authType:"apikey"})),...en.map(([e,t])=>({key:e,info:t,authType:"cookie"}))],({key:e,info:t,authType:s})=>({id:e,key:`${s}-${e}`,info:t,stats:W(e,s),authType:s,onToggle:t=>Z(e,s,t)})),eb=e=>(0,a.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-4",children:e.map(e=>(0,a.jsx)(P,{providerId:e.id,provider:e.info,stats:e.stats,authType:e.authType,onToggle:e.onToggle,size:e.size},e.key))});return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[(0,a.jsx)(I,{icon:"hub",label:"Total koneksi",value:ec.total}),(0,a.jsx)(I,{icon:"check_circle",label:"Connected",value:ec.connected,tone:"success"}),(0,a.jsx)(I,{icon:"error",label:"Error",value:ec.errors,tone:"danger"}),(0,a.jsx)(I,{icon:"toggle_on",label:"Provider aktif",value:ec.activeProviders})]}),(0,a.jsx)("div",{className:"flex flex-col gap-3",children:(0,a.jsxs)("div",{className:"flex flex-col items-stretch gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("div",{role:"tablist","aria-label":"Provider categories",className:"inline-flex max-w-full items-center gap-1 overflow-x-auto rounded-full bg-surface-2 p-1",children:em.map(e=>{let t=x===e.id;return(0,a.jsxs)("button",{role:"tab","aria-selected":t,onClick:()=>(e=>{if(e===x)return;let t=new URLSearchParams(s);t.set("tab",e);try{window.localStorage.setItem(d,e)}catch{}i.push(`/dashboard/providers?${t.toString()}`,{scroll:!1})})(e.id),className:`flex shrink-0 items-center gap-1.5 rounded-full px-3.5 py-1.5 font-display text-[13px] font-medium transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-text-subtle/60 focus-visible:ring-offset-1 focus-visible:ring-offset-surface-2 ${t?"bg-surface text-primary shadow-[var(--shadow-soft)] dark:text-primary":"text-text-muted hover:text-text-main"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[15px] ${t?"text-primary dark:text-primary":"text-text-subtle"}`,children:e.icon}),e.label,(0,a.jsx)("span",{className:`rounded-full px-1.5 py-0.5 font-mono text-[10px] leading-none ${t?"bg-surface-2 text-text-main":"bg-bg text-text-muted"}`,children:e.count})]},e.id)})}),(0,a.jsx)(k,{options:w,value:L,onChange:M})]})}),!eo&&(0,a.jsxs)("div",{className:"text-center py-8 border border-dashed border-border rounded-md",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px] text-text-muted mb-2",children:"search_off"}),(0,a.jsx)("p",{className:"text-text-muted text-sm",children:"No providers match your search or filters"})]}),"custom"===x&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"font-display text-lg font-semibold text-text-main",children:"Custom Providers"}),(0,a.jsx)("p",{className:"mt-0.5 font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"OpenAI- & Anthropic-compatible endpoints"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:w-auto",children:[(0,a.jsxs)("button",{onClick:()=>_(!0),className:"group flex items-center gap-3 rounded-xl border border-border bg-surface px-4 py-2.5 text-left transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,a.jsx)("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg bg-surface-2",children:(0,a.jsx)(c.A,{src:"/providers/anthropic-m.png",alt:"Anthropic Compatible",size:24,className:"object-contain rounded-md"})}),(0,a.jsxs)("span",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"block truncate font-display text-sm font-semibold text-text-main",children:"Anthropic Compatible"}),(0,a.jsxs)("span",{className:"mt-0.5 block text-xs text-text-muted",children:[(0,a.jsx)("span",{className:"font-mono","aria-hidden":"true",children:"+"})," ","endpoint"]})]})]}),(0,a.jsxs)("button",{onClick:()=>O(!0),className:"group flex items-center gap-3 rounded-xl border border-border bg-surface px-4 py-2.5 text-left transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,a.jsx)("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg bg-surface-2",children:(0,a.jsx)(c.A,{src:"/providers/oai-cc.png",alt:"OpenAI Compatible",size:24,className:"object-contain rounded-md"})}),(0,a.jsxs)("span",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"block truncate font-display text-sm font-semibold text-text-main",children:"OpenAI Compatible"}),(0,a.jsxs)("span",{className:"mt-0.5 block text-xs text-text-muted",children:[(0,a.jsx)("span",{className:"font-mono","aria-hidden":"true",children:"+"})," ","endpoint"]})]})]})]})]}),0===ex.length?(0,a.jsxs)("div",{className:"flex flex-col items-center gap-4 rounded-xl border border-dashed border-border px-6 py-10 text-center",children:[(0,a.jsx)("span",{className:"grid size-12 shrink-0 place-items-center rounded-full bg-surface-2 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[24px]",children:"extension"})}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("p",{className:"font-display text-base font-semibold text-text-main",children:"No custom providers yet"}),(0,a.jsx)("p",{className:"mx-auto max-w-sm text-sm leading-relaxed text-text-muted",children:"Add an OpenAI- or Anthropic-compatible endpoint using the buttons above."})]})]}):eb(ex)]}),"oauth"===x&&eu.length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-text-subtle",children:"Sign in with provider account"}),(0,a.jsx)("h2",{className:"mt-0.5 text-lg font-semibold text-text-main",children:"OAuth Providers"})]}),(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsx)(g,{}),ed("oauth")]})]}),eb(eu)]}),"free"===x&&eh.length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-text-subtle",children:"No-key / trial providers"}),(0,a.jsx)("h2",{className:"mt-0.5 text-lg font-semibold text-text-main",children:"Free Tier Providers"})]}),ed("free")]}),eb(eh)]}),"apikey"===x&&ef.length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-text-subtle",children:"Providers using an API key"}),(0,a.jsx)("h2",{className:"mt-0.5 text-lg font-semibold text-text-main",children:"API Key Providers"})]}),ed("apikey")]}),eb(ef),!er&&!T&&ei>0&&(0,a.jsxs)("button",{onClick:()=>$(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-full border border-dashed border-text-subtle px-3 py-2.5 font-mono text-sm uppercase tracking-wider text-text-muted transition-colors hover:border-text-main hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-text-subtle/60",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"expand_more"}),"Show all ",ea.length," providers"]})]}),(0,a.jsx)(j,{variant:"openai",isOpen:R,onClose:()=>O(!1),onCreated:e=>{y(t=>[...t,e]),O(!1)}}),(0,a.jsx)(j,{variant:"anthropic",isOpen:E,onClose:()=>_(!1),onCreated:e=>{y(t=>[...t,e]),_(!1)}}),q&&(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-start justify-center px-3 pt-[6vh] sm:pt-[10vh]",onClick:()=>D(null),children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),(0,a.jsxs)("div",{className:"relative bg-surface border border-border rounded-md w-full max-w-[600px] max-h-[86vh] sm:max-h-[80vh] overflow-y-auto shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"sticky top-0 z-10 flex items-center justify-between px-5 py-3 border-b border-border bg-surface/95 backdrop-blur-sm rounded-t-md",children:[(0,a.jsx)("h3",{className:"font-semibold",children:"Test Results"}),(0,a.jsx)("button",{onClick:()=>D(null),className:"p-1 rounded-lg hover:bg-bg text-text-muted hover:text-text-main transition-colors","aria-label":"Close test results",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]}),(0,a.jsx)("div",{className:"p-5",children:(0,a.jsx)(S,{results:q})})]})]})]})}function I({icon:e,label:t,value:s,sub:r,tone:l}){return(0,a.jsxs)(o.Zp,{padding:"none",className:"flex items-center gap-2 p-2.5 pl-4",children:[(0,a.jsx)("span",{className:`material-symbols-outlined !text-[18px] shrink-0 ${{default:"text-primary dark:text-primary",success:"text-success",danger:"text-danger",brand:"text-primary dark:text-primary"}[l||"default"]}`,children:e}),(0,a.jsxs)("div",{className:"min-w-0 leading-none",children:[(0,a.jsx)("p",{className:"font-mono text-[9px] uppercase tracking-[0.12em] text-text-muted leading-none",children:t}),(0,a.jsx)("p",{className:`font-display text-sm font-bold leading-none mt-0.5 ${{default:"text-text-main",success:"text-success",danger:"text-danger",brand:"text-text-main"}[l||"default"]}`,children:s}),r&&(0,a.jsx)("p",{className:"truncate text-[10px] text-text-muted leading-none mt-0.5",children:r})]})]})}function P({providerId:e,provider:t,stats:s,authType:r,onToggle:l,size:i="compact"}){let{connected:n,error:m,errorCode:x,errorTime:h,allDisabled:f}=s,b=!!t.noAuth,g=e.startsWith(p.JH),v=e.startsWith(p.DI),y=()=>g&&t.apiType?"responses"===t.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":v?"/providers/anthropic-m.png":(0,d.HY)(t.id),j=f?"bg-text-subtle/40":m>0?"bg-danger":n>0?"bg-success":"bg-warning",N={free:"Free",oauth:"OAuth",apikey:"API Key",cookie:"Cookie",compatible:"Compatible"}[r]||"Provider",k=()=>f?(0,a.jsx)(o.Ex,{variant:"default",size:"sm",children:(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"pause_circle"}),"Disabled"]})}):b?(0,a.jsx)(o.Ex,{variant:"success",size:"sm",dot:!0,children:"Ready"}):(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:`size-2 rounded-full ${j}`}),(0,a.jsx)("span",{className:"text-xs font-medium text-text-muted",children:m>0?x||"Error":n>0?"Connected":"Idle"}),"large"===i&&h&&(0,a.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:h})]}),w=s.total>0&&(0,a.jsx)("div",{title:f?"Enable provider":"Disable provider",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(!!f)},children:(0,a.jsx)(o.lM,{size:"sm",checked:!f,onChange:()=>{}})});return"large"===i?(0,a.jsx)(u(),{href:`/dashboard/providers/${e}`,className:"group min-w-0 sm:col-span-2",children:(0,a.jsxs)(o.Zp,{padding:"none",className:`relative h-full overflow-hidden transition-colors hover:bg-surface-2 cursor-pointer ${f?"opacity-60":""}`,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 px-4 pt-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`size-2 rounded-full ${j}`}),(0,a.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-text-subtle",children:f?"Disabled":m>0?"Error":n>0?"Connected":"Idle"})]}),(0,a.jsx)(o.Ex,{variant:"default",size:"sm",children:N})]}),(0,a.jsxs)("div",{className:"flex items-center gap-4 p-4 pt-3",children:[(0,a.jsx)("div",{className:"grid size-12 shrink-0 place-items-center rounded-xl bg-surface-2",children:(0,a.jsx)(c.A,{src:y(),alt:t.name,size:28,className:"object-contain rounded-md max-w-[30px] max-h-[30px]",fallbackText:t.textIcon||t.id.slice(0,2).toUpperCase(),fallbackColor:t.color})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("h3",{className:"truncate font-display text-base font-semibold text-text-main",children:t.name}),(0,a.jsx)("div",{className:"mt-1.5 flex min-w-0 flex-wrap items-center gap-2",children:k()})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[w,(0,a.jsxs)("span",{className:"inline-flex h-7 items-center gap-1 rounded-md bg-bg px-2.5 text-xs font-medium text-text-muted transition-colors group-hover:text-text-main",children:["Manage",(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"chevron_right"})]})]})]})]})}):(0,a.jsx)(u(),{href:`/dashboard/providers/${e}`,className:"group min-w-0",children:(0,a.jsx)(o.Zp,{padding:"none",className:`relative h-full overflow-hidden transition-colors hover:bg-surface-2 cursor-pointer ${f?"opacity-60":""}`,children:(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3",children:[(0,a.jsx)("div",{className:"grid size-11 shrink-0 place-items-center rounded-lg bg-surface-2",children:(0,a.jsx)(c.A,{src:y(),alt:t.name,size:24,className:"object-contain rounded-md max-w-[26px] max-h-[26px]",fallbackText:t.textIcon||t.id.slice(0,2).toUpperCase(),fallbackColor:t.color})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("h3",{className:"truncate font-display text-[13px] font-medium text-text-main",children:t.name}),(0,a.jsx)(o.Ex,{variant:"default",size:"sm",children:N})]}),(0,a.jsx)("div",{className:"mt-1 flex min-w-0 items-center gap-1.5",children:k()})]}),w,(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-subtle opacity-40 transition-opacity group-hover:opacity-100",children:"chevron_right"})]})})})}function S({results:e}){if(e.error&&!e.results)return(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-red-500 text-[32px] mb-2 block",children:"error"}),(0,a.jsx)("p",{className:"text-sm text-red-400",children:e.error})]});let{summary:t,mode:s}=e,r=e.results||[];return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-3",children:[t&&(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs mb-1 sm:gap-3",children:[(0,a.jsxs)("span",{className:"text-text-muted",children:[{oauth:"OAuth",free:"Free",apikey:"API Key",provider:"Provider",all:"All"}[s]||s," Test"]}),(0,a.jsxs)("span",{className:"px-2 py-0.5 rounded bg-emerald-500/15 text-emerald-400 font-medium",children:[t.passed," passed"]}),t.failed>0&&(0,a.jsxs)("span",{className:"px-2 py-0.5 rounded bg-red-500/15 text-red-400 font-medium",children:[t.failed," failed"]}),(0,a.jsxs)("span",{className:"text-text-muted sm:ml-auto",children:[t.total," tested"]})]}),r.map((e,t)=>(0,a.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2 rounded-md bg-surface-2 px-3 py-2 text-xs sm:flex-nowrap",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] ${e.valid?"text-emerald-500":"text-red-500"}`,children:e.valid?"check_circle":"error"}),(0,a.jsxs)("div",{className:"min-w-0 flex-[1_1_160px]",children:[(0,a.jsx)("span",{className:"block truncate font-medium sm:inline",children:e.connectionName}),(0,a.jsxs)("span",{className:"block truncate text-text-muted sm:ml-1.5 sm:inline",children:["(",e.provider,")"]})]}),void 0!==e.latencyMs&&(0,a.jsxs)("span",{className:"shrink-0 text-text-muted font-mono tabular-nums",children:[e.latencyMs,"ms"]}),(0,a.jsx)("span",{className:`shrink-0 text-[10px] uppercase font-bold px-1.5 py-0.5 rounded ${e.valid?"bg-emerald-500/15 text-emerald-400":"bg-red-500/15 text-red-400"}`,children:e.valid?"OK":e.diagnosis?.type||"ERROR"})]},e.connectionId||t)),0===r.length&&(0,a.jsx)("div",{className:"text-center py-4 text-text-muted text-sm",children:"No active connections found for this group."})]})}I.propTypes={icon:n().string.isRequired,label:n().string.isRequired,value:n().number.isRequired,sub:n().string,tone:n().string},P.propTypes={providerId:n().string.isRequired,provider:n().shape({id:n().string.isRequired,name:n().string.isRequired,color:n().string,textIcon:n().string,apiType:n().string}).isRequired,stats:n().shape({connected:n().number,error:n().number,errorCode:n().string,errorTime:n().string,total:n().number,allDisabled:n().bool}).isRequired,authType:n().string,onToggle:n().func,size:n().oneOf(["compact","large"])},S.propTypes={results:n().shape({mode:n().string,results:n().array,summary:n().shape({total:n().number,passed:n().number,failed:n().number}),error:n().string}).isRequired}},97080:(e,t,s)=>{Promise.resolve().then(s.bind(s,13950))}},e=>{e.O(0,[763,2470,705,3557,5497,8441,3794,7358],()=>e(e.s=97080)),_N_E=e.O()}]);
@@ -0,0 +1,4 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6812],{57076:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var l=r(95155),s=r(12115),o=r(35497),a=r(65921);function i(e={}){return{name:e.name||"",proxyUrl:e.proxyUrl||"",noProxy:e.noProxy||"",isActive:!1!==e.isActive,strictProxy:!0===e.strictProxy}}function n(){let[e,t]=(0,s.useState)([]),[r,n]=(0,s.useState)(!0),[d,c]=(0,s.useState)(!1),[x,p]=(0,s.useState)(!1),[m,h]=(0,s.useState)(!1),[u,y]=(0,s.useState)(!1),[f,g]=(0,s.useState)(!1),[j,b]=(0,s.useState)(!1),[v,k]=(0,s.useState)(!1),[N,w]=(0,s.useState)(null),[C,P]=(0,s.useState)(i()),[D,$]=(0,s.useState)(""),[T,S]=(0,s.useState)({vercelToken:"",projectName:"vercel-relay"}),[A,I]=(0,s.useState)({accountId:"",apiToken:"",projectName:"cloudflare-relay"}),[E,U]=(0,s.useState)({denoToken:"",orgDomain:"",projectName:""}),[O,R]=(0,s.useState)({netlifyToken:"",projectName:"netlify-relay"}),[F,W]=(0,s.useState)(!1),[z,_]=(0,s.useState)(!1),[L,q]=(0,s.useState)(!1),[V,G]=(0,s.useState)(null),[J,B]=(0,s.useState)([]),[M,H]=(0,s.useState)(!1),[Y,Q]=(0,s.useState)({current:0,total:0}),[K,Z]=(0,s.useState)(!1),[X,ee]=(0,s.useState)(null),et=(0,s.useRef)(null),er=(0,a.i)();(0,s.useEffect)(()=>{let e=e=>{et.current&&!et.current.contains(e.target)&&k(!1)};return v&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[v]);let el=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/proxy-pools?includeUsage=true",{cache:"no-store"}),r=await e.json();e.ok&&t(r.proxyPools||[])}catch(e){console.log("Error fetching proxy pools:",e)}finally{n(!1)}},[]);(0,s.useEffect)(()=>{el()},[el]);let es=()=>{w(null),P(i())},eo=()=>{es(),c(!0)},ea=()=>{c(!1),es()},ei=async()=>{let e={name:C.name.trim(),proxyUrl:C.proxyUrl.trim(),noProxy:C.noProxy.trim(),isActive:!0===C.isActive,strictProxy:!0===C.strictProxy};if(e.name&&e.proxyUrl){W(!0);try{let t=!!N,r=await fetch(t?`/api/proxy-pools/${N.id}`:"/api/proxy-pools",{method:t?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok)await el(),ea(),er.success(N?"Proxy pool updated":"Proxy pool created");else{let e=await r.json();er.error(e.error||"Failed to save proxy pool")}}catch(e){console.log("Error saving proxy pool:",e)}finally{W(!1)}}},en=async e=>{ee({title:"Delete Proxy Pool",message:`Delete proxy pool "${e.name}"?`,onConfirm:async()=>{ee(null);try{let r=await fetch(`/api/proxy-pools/${e.id}`,{method:"DELETE"});if(r.ok){t(t=>t.filter(t=>t.id!==e.id)),er.success("Proxy pool deleted");return}let l=await r.json();409===r.status?er.warning(`Cannot delete: ${l.boundConnectionCount||0} connection(s) are still using this pool.`):er.error(l.error||"Failed to delete proxy pool")}catch(e){console.log("Error deleting proxy pool:",e),er.error("Failed to delete proxy pool")}}})},ed=async e=>{G(e);try{let t=await fetch(`/api/proxy-pools/${e}/test`,{method:"POST"}),r=await t.json();if(!t.ok)return void er.error(r.error||"Failed to test proxy");await el(),er.success(r.ok?"Proxy test passed":"Proxy test failed")}catch(e){console.log("Error testing proxy pool:",e),er.error("Failed to test proxy")}finally{G(null)}},ec=async e=>{let r=!e.isActive;t(t=>t.map(t=>t.id===e.id?{...t,isActive:r}:t));try{(await fetch(`/api/proxy-pools/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:r})})).ok||(t(t=>t.map(t=>t.id===e.id?{...t,isActive:e.isActive}:t)),er.error("Failed to update active state"))}catch(r){console.log("Error toggling active:",r),t(t=>t.map(t=>t.id===e.id?{...t,isActive:e.isActive}:t))}},ex=e.length>0&&J.length===e.length,ep=()=>B([]),em=async t=>{let r=J.length>0?J:e.map(e=>e.id);if(0!==r.length){Z(!0);try{let e=0,l=0;for(let s of r)try{(await fetch(`/api/proxy-pools/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok?e+=1:l+=1}catch{l+=1}await el(),er.success(`${t?"Activated":"Deactivated"} ${e}${l?`, failed ${l}`:""}`)}finally{Z(!1)}}},eh=async()=>{0!==J.length&&ee({title:"Delete Proxy Pools",message:`Delete ${J.length} proxy pool(s)?`,onConfirm:async()=>{ee(null),Z(!0);try{let e=0,t=0,r=0;for(let l of J)try{let s=await fetch(`/api/proxy-pools/${l}`,{method:"DELETE"});s.ok?e+=1:409===s.status?t+=1:r+=1}catch{r+=1}await el(),ep(),er.success(`Deleted ${e}${t?`, ${t} bound`:""}${r?`, ${r} failed`:""}`)}finally{Z(!1)}}})},eu=async()=>{let t=J.length>0?e.filter(e=>J.includes(e.id)):e;if(0===t.length)return;H(!0),Q({current:0,total:t.length});let r=0,l=[],s=0,o=[...t],a=async()=>{for(;o.length>0;){let e=o.shift();if(!e)break;try{let t=await fetch(`/api/proxy-pools/${e.id}/test`,{method:"POST"}),s=await t.json();t.ok&&s.ok?r+=1:l.push(e.id)}catch{l.push(e.id)}finally{Q({current:s+=1,total:t.length})}}};await Promise.all(Array.from({length:Math.min(10,t.length)},a)),await el(),H(!1),Q({current:0,total:0}),l.length>0?ee({title:"Disable Dead Proxies",message:`Alive: ${r}, Dead: ${l.length}.
2
+
3
+ Disable ${l.length} dead proxies?`,onConfirm:async()=>{ee(null),Z(!0);try{for(let e of l)try{await fetch(`/api/proxy-pools/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:!1})})}catch{}await el(),er.success(`Disabled ${l.length} dead proxies`)}finally{Z(!1)}}}):er.success(`Health check done. Alive: ${r}, Dead: ${l.length}`)};(0,s.useEffect)(()=>{B(t=>t.filter(t=>e.some(e=>e.id===t)))},[e]);let ey=()=>{z||p(!1)},ef=()=>{L||h(!1)},eg=()=>{L||y(!1)},ej=()=>{L||g(!1)},eb=()=>{L||b(!1)},ev=async()=>{if(T.vercelToken.trim()){q(!0);try{let e=await fetch("/api/proxy-pools/vercel-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)}),t=await e.json();e.ok?(await el(),ef(),er.success(`Deployed: ${t.deployUrl}`)):er.error(t.error||"Deploy failed")}catch(e){console.log("Error deploying Vercel relay:",e),er.error("Deploy failed")}finally{q(!1)}}},ek=async()=>{if(A.accountId.trim()&&A.apiToken.trim()){q(!0);try{let e=await fetch("/api/proxy-pools/cloudflare-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)}),t=await e.json();e.ok?(await el(),eg(),er.success(`Deployed: ${t.deployUrl}`)):er.error(t.error||"Deploy failed")}catch(e){console.log("Error deploying Cloudflare relay:",e),er.error("Deploy failed")}finally{q(!1)}}},eN=async()=>{if(E.denoToken.trim()){q(!0);try{let e=await fetch("/api/proxy-pools/deno-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)}),t=await e.json();e.ok?(await el(),ej(),er.success(`Deployed: ${t.deployUrl}`)):er.error(t.error||"Deploy failed")}catch(e){console.log("Error deploying Deno relay:",e),er.error("Deploy failed")}finally{q(!1)}}},ew=async()=>{if(O.netlifyToken.trim()){q(!0);try{let e=await fetch("/api/proxy-pools/netlify-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)}),t=await e.json();e.ok?(await el(),eb(),er.success(`Deployed: ${t.deployUrl}`)):er.error(t.error||"Deploy failed")}catch(e){console.log("Error deploying Netlify relay:",e),er.error("Deploy failed")}finally{q(!1)}}},eC=async()=>{let t=D.split(/\r?\n/).map(e=>e.trim()).filter(Boolean);if(0===t.length)return void er.warning("Please paste at least one proxy line.");let r=[],l=[];if(t.forEach((e,t)=>{try{let l=(e=>{let t=e.trim();if(!t)return null;if(t.includes("://")){let e=new URL(t),r=e.port?`${e.hostname}:${e.port}`:e.hostname;return{proxyUrl:e.toString(),name:`Imported ${r}`}}let r=t.split(":");if(4===r.length){let[e,t,l,s]=r;if(!e||!t||!l||!s)throw Error("Invalid host:port:user:pass format");return{proxyUrl:new URL(`http://${encodeURIComponent(l)}:${encodeURIComponent(s)}@${e}:${t}`).toString(),name:`Imported ${e}:${t}`}}throw Error("Unsupported format")})(e);l&&r.push({...l,lineNumber:t+1})}catch(e){l.push(`Line ${t+1}: ${e.message}`)}}),l.length>0)return void er.error(`Invalid proxy format:
4
+ ${l.join("\n")}`);_(!0);try{let t=new Set(e.map(e=>`${(e.proxyUrl||"").trim()}|||${(e.noProxy||"").trim()}`)),l=0,s=0,o=0;for(let e of r){let r=`${e.proxyUrl}|||`;if(t.has(r)){s+=1;continue}(await fetch("/api/proxy-pools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,proxyUrl:e.proxyUrl,noProxy:"",isActive:!0})})).ok?(l+=1,t.add(r)):o+=1}await el(),p(!1),er.success(`Batch import completed: Created ${l}, Skipped ${s}, Failed ${o}`)}catch(e){console.log("Error batch importing proxies:",e),er.error("Batch import failed")}finally{_(!1)}},eP=(0,s.useMemo)(()=>e.filter(e=>!0===e.isActive).length,[e]);return r?(0,l.jsxs)("div",{className:"flex w-full flex-col gap-4 px-1 sm:gap-6 sm:px-0",children:[(0,l.jsx)(o.Qv,{}),(0,l.jsx)(o.Qv,{})]}):(0,l.jsxs)("div",{className:"flex w-full flex-col gap-4 px-1 sm:gap-6 sm:px-0",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-main",children:"Proxy Pools"}),(0,l.jsx)("p",{className:"mt-1 font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"Rotating IP relay pools for outbound provider requests"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)("div",{className:"relative",ref:et,children:[(0,l.jsxs)("button",{onClick:()=>k(!v),className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-lg border border-border bg-surface px-3.5 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[17px] text-text-muted",children:"rocket_launch"}),"Deploy Relay",(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-subtle",children:v?"expand_less":"expand_more"})]}),v&&(0,l.jsxs)("div",{className:"absolute left-0 top-full z-50 mt-1 w-52 rounded-xl border border-border bg-surface p-1 shadow-warm sm:left-auto sm:right-0",children:[(0,l.jsxs)("button",{onClick:()=>{I({accountId:"",apiToken:"",projectName:"cloudflare-relay"}),y(!0),k(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:text-primary dark:hover:text-primary",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:"cloud"}),"Cloudflare Relay"]}),(0,l.jsxs)("button",{onClick:()=>{S({vercelToken:"",projectName:"vercel-relay"}),h(!0),k(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:text-primary dark:hover:text-primary",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:"cloud_upload"}),"Vercel Relay"]}),(0,l.jsxs)("button",{onClick:()=>{U({denoToken:"",orgDomain:"",projectName:""}),g(!0),k(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:text-primary dark:hover:text-primary",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:"terminal"}),"Deno Relay"]}),(0,l.jsxs)("button",{onClick:()=>{R({netlifyToken:"",projectName:"netlify-relay"}),b(!0),k(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:text-primary dark:hover:text-primary",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:"deployed_code"}),"Netlify Relay"]})]})]}),(0,l.jsxs)("button",{onClick:()=>{$(""),p(!0)},className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-lg border border-border bg-surface px-3.5 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[17px] text-text-muted",children:"upload"}),"Batch Import"]}),(0,l.jsxs)("button",{onClick:eo,className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-lg bg-primary px-3.5 text-sm font-display font-medium text-white dark:text-amber-950 transition-colors hover:bg-primary-hover",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"add"}),"Add Proxy Pool"]})]})]}),(0,l.jsxs)(o.Zp,{children:[(0,l.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[e.length>0&&(0,l.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-text-muted cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",checked:ex,onChange:()=>B(ex?[]:e.map(e=>e.id)),className:"size-4 rounded border-black/20 dark:border-white/20"}),ex?"Unselect all":"Select all"]}),(0,l.jsxs)("span",{className:"rounded-full border border-border bg-surface-2 px-2.5 py-0.5 font-mono text-[11px] uppercase tracking-wider text-text-muted",children:["Total: ",e.length]}),(0,l.jsxs)("span",{className:"rounded-full border border-border bg-surface-2 px-2.5 py-0.5 font-mono text-[11px] uppercase tracking-wider text-text-muted",children:["Active: ",eP]})]}),(J.length>0||M)&&(0,l.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-2 rounded-lg border border-border bg-surface-2/50 px-3 py-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:"checklist"}),(0,l.jsx)("span",{className:"font-mono text-xs font-medium text-text-main",children:J.length>0?`${J.length} selected`:"All pools"}),(0,l.jsxs)("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[(0,l.jsx)(o.$n,{size:"sm",icon:M?"progress_activity":"health_and_safety",onClick:eu,disabled:M||K||0===e.length,children:M?`Checking ${Y.current}/${Y.total}`:"Health Check"}),J.length>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"toggle_on",onClick:()=>em(!0),disabled:K||M,children:"Activate"}),(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"toggle_off",onClick:()=>em(!1),disabled:K||M,children:"Deactivate"}),(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:eh,disabled:K||M,children:"Delete"}),(0,l.jsx)(o.$n,{size:"sm",variant:"ghost",onClick:ep,disabled:K||M,children:"Clear"})]})]})]}),0===e.length?(0,l.jsxs)("div",{className:"flex flex-col items-center justify-center rounded-xl border border-dashed border-border bg-surface/40 px-6 py-12 text-center",children:[(0,l.jsx)("div",{className:"grid size-12 place-items-center rounded-xl border border-border bg-surface-2",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-2xl text-text-muted",children:"public"})}),(0,l.jsx)("p",{className:"mt-4 font-display text-lg font-semibold text-text-main",children:"No proxy pool entries yet"}),(0,l.jsx)("p",{className:"mt-1 max-w-sm font-mono text-[11px] uppercase tracking-wider text-text-subtle",children:"Create a proxy pool entry, then assign it to connections."}),(0,l.jsxs)("button",{onClick:eo,className:"mt-6 inline-flex h-8 items-center justify-center gap-1.5 rounded-lg bg-primary px-3.5 text-sm font-display font-medium text-white dark:text-amber-950 transition-colors hover:bg-primary-hover",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"add"}),"Add Proxy Pool"]})]}):(0,l.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.04] dark:divide-white/[0.05]",children:e.map(e=>{var t;return(0,l.jsxs)("div",{className:"flex flex-col gap-3 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[(0,l.jsx)("input",{type:"checkbox",checked:J.includes(e.id),onChange:()=>{let t;return t=e.id,B(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"mt-1 size-4 shrink-0 rounded border-black/20 dark:border-white/20"}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,l.jsx)("p",{className:"min-w-0 max-w-full truncate font-display text-sm font-medium text-text-main sm:max-w-[18rem]",children:e.name}),(0,l.jsx)(o.Ex,{variant:"active"===(t=e.testStatus)?"success":"error"===t?"error":"default",size:"sm",dot:!0,children:e.testStatus||"unknown"}),(0,l.jsx)(o.Ex,{variant:e.isActive?"success":"default",size:"sm",children:e.isActive?"active":"inactive"}),"vercel"===e.type&&(0,l.jsx)(o.Ex,{variant:"default",size:"sm",children:"vercel relay"}),"cloudflare"===e.type&&(0,l.jsx)(o.Ex,{variant:"default",size:"sm",children:"cloudflare relay"}),"deno"===e.type&&(0,l.jsx)(o.Ex,{variant:"default",size:"sm",children:"deno relay"}),"netlify"===e.type&&(0,l.jsx)(o.Ex,{variant:"default",size:"sm",children:"netlify relay"}),(0,l.jsxs)(o.Ex,{variant:"default",size:"sm",children:[e.boundConnectionCount||0," bound"]})]}),(0,l.jsx)("p",{className:"truncate font-mono text-xs text-text-muted mt-1",children:e.proxyUrl}),e.noProxy?(0,l.jsxs)("p",{className:"truncate font-mono text-xs text-text-muted",children:["No proxy: ",e.noProxy]}):null,(0,l.jsxs)("p",{className:"font-mono text-[11px] text-text-muted mt-1",children:["Last tested: ",function(e){if(!e)return"Never";let t=new Date(e);return Number.isNaN(t.getTime())?"Never":t.toLocaleString()}(e.lastTestedAt),e.lastError?` \xb7 ${e.lastError}`:""]})]})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,l.jsx)(o.lM,{size:"sm",checked:!0===e.isActive,onChange:()=>ec(e),title:e.isActive?"Disable":"Enable"}),(0,l.jsx)("button",{onClick:()=>ed(e.id),className:"p-2 rounded hover:bg-surface-2 text-text-muted hover:text-primary",title:"Test proxy",disabled:V===e.id,children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",style:V===e.id?{animation:"spin 1s linear infinite"}:void 0,children:V===e.id?"progress_activity":"science"})}),(0,l.jsx)("button",{onClick:()=>{w(e),P(i(e)),c(!0)},className:"p-2 rounded hover:bg-surface-2 text-text-muted hover:text-primary",title:"Edit",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,l.jsx)("button",{onClick:()=>en(e),className:"p-2 rounded hover:bg-danger/10 text-text-muted hover:text-danger",title:"Delete",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]},e.id)})})]}),(0,l.jsx)(o.aF,{isOpen:x,title:"Batch Import Proxies",onClose:ey,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"text-sm font-medium text-text-main mb-1 block",children:"Paste Proxy List (One per line)"}),(0,l.jsx)("textarea",{value:D,onChange:e=>$(e.target.value),placeholder:"http://user:pass@127.0.0.1:7897\n127.0.0.1:7897:user:pass",className:"w-full min-h-[180px] py-2 px-3 text-sm text-text-main bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none transition-all"}),(0,l.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Supported formats: protocol://user:pass@host:port, host:port:user:pass"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:eC,disabled:!D.trim()||z,children:z?"Importing...":"Import"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:ey,disabled:z,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:m,title:"Deploy Vercel Relay",onClose:ef,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2/50 p-3 flex flex-col gap-1.5",children:[(0,l.jsx)("p",{className:"text-sm text-text-main font-medium",children:"What is Vercel Relay?"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Deploys an edge relay function to Vercel. All AI provider requests will be forwarded through Vercel's edge network, masking your real IP from providers."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"Your IP is replaced by Vercel's dynamic edge IPs (hundreds of IPs across 20+ global regions)"}),(0,l.jsx)("li",{children:"Vercel serves millions of apps - providers can't block Vercel IPs without affecting legitimate traffic"}),(0,l.jsx)("li",{children:"Free tier: 100GB bandwidth/month, 500K edge invocations"}),(0,l.jsx)("li",{children:"Deploy multiple relays on different accounts for more IP diversity"})]})]}),(0,l.jsx)(o.pd,{label:"Vercel API Token",value:T.vercelToken,onChange:e=>S(t=>({...t,vercelToken:e.target.value})),placeholder:"your-vercel-api-token",hint:(0,l.jsxs)(l.Fragment,{children:["Token is used once for deployment and not stored. ",(0,l.jsx)("a",{href:"https://vercel.com/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]}),type:"password"}),(0,l.jsx)(o.pd,{label:"Project Name",value:T.projectName,onChange:e=>S(t=>({...t,projectName:e.target.value})),placeholder:"my-relay",hint:"Unique name for your Vercel project. Leave empty for auto-generated name."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:ev,disabled:!T.vercelToken.trim()||L,children:L?"Deploying... (may take ~1 min)":"Deploy"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:ef,disabled:L,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:u,title:"Deploy Cloudflare Relay",onClose:eg,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2/50 p-3 flex flex-col gap-1.5",children:[(0,l.jsx)("p",{className:"text-sm text-text-main font-medium",children:"What is Cloudflare Relay?"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Deploys a Cloudflare Worker as a proxy relay. All AI provider requests will be forwarded through Cloudflare's global edge network."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"High performance global routing and IP masking via Cloudflare Workers"}),(0,l.jsx)("li",{children:"Free tier: 100,000 requests per day"}),(0,l.jsx)("li",{children:"Requires Cloudflare Account ID and a Workers API Token (Edit Workers permission)"})]}),(0,l.jsxs)("div",{className:"mt-2 pt-2 border-t border-border text-xs text-text-muted",children:[(0,l.jsx)("p",{className:"font-medium text-text-main mb-1",children:"How to generate your API Token:"}),(0,l.jsxs)("ol",{className:"list-decimal pl-4 space-y-0.5",children:[(0,l.jsxs)("li",{children:["Go to ",(0,l.jsx)("b",{children:"My Profile"})," → ",(0,l.jsx)("b",{children:"API Tokens"})," → ",(0,l.jsx)("b",{children:"Create Token"})]}),(0,l.jsxs)("li",{children:["Scroll down to ",(0,l.jsx)("b",{children:"Custom Token"})," and click ",(0,l.jsx)("b",{children:"Get started"})]}),(0,l.jsxs)("li",{children:["Under ",(0,l.jsx)("b",{children:"Permissions"}),": Account | Workers Scripts | Edit"]}),(0,l.jsxs)("li",{children:["Under ",(0,l.jsx)("b",{children:"Account Resources"}),": Include | Account | ",(0,l.jsx)("i",{children:"Your Account Name"})]}),(0,l.jsxs)("li",{children:["Click ",(0,l.jsx)("b",{children:"Continue to summary"})," → ",(0,l.jsx)("b",{children:"Create Token"})]})]})]})]}),(0,l.jsx)(o.pd,{label:"Account ID",value:A.accountId,onChange:e=>I(t=>({...t,accountId:e.target.value})),placeholder:"your-cloudflare-account-id",hint:(0,l.jsx)(l.Fragment,{children:"Found on the right side of the Cloudflare dashboard overview page."})}),(0,l.jsx)(o.pd,{label:"API Token",value:A.apiToken,onChange:e=>I(t=>({...t,apiToken:e.target.value})),placeholder:"your-cloudflare-api-token",hint:(0,l.jsxs)(l.Fragment,{children:['Requires "Workers Scripts: Edit" permission. ',(0,l.jsx)("a",{href:"https://dash.cloudflare.com/profile/api-tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]}),type:"password"}),(0,l.jsx)(o.pd,{label:"Worker Name",value:A.projectName,onChange:e=>I(t=>({...t,projectName:e.target.value})),placeholder:"my-relay",hint:"Unique name for your Cloudflare Worker. Leave empty for auto-generated name."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:ek,disabled:!A.accountId.trim()||!A.apiToken.trim()||L,children:L?"Deploying...":"Deploy Worker"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:eg,disabled:L,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:f,title:"Deploy Deno Relay",onClose:ej,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"rounded-lg bg-surface-2/50 border border-border p-3 flex flex-col gap-1.5",children:[(0,l.jsx)("p",{className:"text-sm text-text-main font-medium",children:"What is Deno Relay?"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Deploys a relay worker to Deno Deploy's global edge network. All AI provider requests are forwarded through Deno's edge, masking your real IP."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"Deno Deploy v2 runs on a high-performance global edge network"}),(0,l.jsx)("li",{children:"Free tier: 1M requests & 100GiB outbound traffic per month"}),(0,l.jsx)("li",{children:"No per-request CPU time limits (unlike Vercel/Cloudflare)"}),(0,l.jsx)("li",{children:"Support up to 20 active apps & 50 custom domains"}),(0,l.jsx)("li",{children:"Deploy multiple relays for maximum IP diversity"})]}),(0,l.jsxs)("div",{className:"mt-2 pt-2 border-t border-black/10 dark:border-white/10 text-xs text-text-muted",children:[(0,l.jsx)("p",{className:"font-medium text-text-main mb-1",children:"How to generate API token:"}),(0,l.jsxs)("ol",{className:"list-decimal pl-4 space-y-0.5",children:[(0,l.jsxs)("li",{children:["Go to ",(0,l.jsx)("b",{children:"console.deno.com"})]}),(0,l.jsxs)("li",{children:["Select your ",(0,l.jsx)("b",{children:"Organization"})," → ",(0,l.jsx)("b",{children:"Settings"})," → ",(0,l.jsx)("b",{children:"Organization Tokens"})]}),(0,l.jsxs)("li",{children:["Create a ",(0,l.jsx)("b",{children:"Organization Token"})," (prefix ",(0,l.jsx)("b",{children:"ddo_"}),")"]})]})]})]}),(0,l.jsx)(o.pd,{label:"Deno Deploy API Token",value:E.denoToken,onChange:e=>U(t=>({...t,denoToken:e.target.value})),placeholder:"ddo_xxxxxxxxxxxxxxxx",hint:(0,l.jsx)(l.Fragment,{children:"Token is used once for deployment, not stored. Found in Organization Settings."}),type:"password"}),(0,l.jsx)(o.pd,{label:"Organization Domain",value:E.orgDomain,onChange:e=>U(t=>({...t,orgDomain:e.target.value})),placeholder:"your-org.deno.net",hint:"Organization's default domain. Your relay URL will be in the format: https://my-relay.your-org.deno.net"}),(0,l.jsx)(o.pd,{label:"App Name",value:E.projectName,onChange:e=>U(t=>({...t,projectName:e.target.value})),placeholder:"deno-relay",hint:"Unique app name. Leave empty for auto-generated name."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:eN,disabled:!E.denoToken.trim()||!E.orgDomain.trim()||L,children:L?"Deploying...":"Deploy Relay"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:ej,disabled:L,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:j,title:"Deploy Netlify Relay",onClose:eb,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2/50 p-3 flex flex-col gap-1.5",children:[(0,l.jsx)("p",{className:"text-sm text-text-main font-medium",children:"What is Netlify Relay?"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Deploys a serverless relay function to Netlify's global edge network. All AI provider requests are forwarded through Netlify's edge, masking your real IP."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"Runs on Netlify Functions with a 60-second execution limit and streaming support"}),(0,l.jsx)("li",{children:"Free tier: 125,000 function invocations and 100GB bandwidth per month"}),(0,l.jsx)("li",{children:"Relay URL format: https://your-site.netlify.app/.netlify/functions/relay"}),(0,l.jsx)("li",{children:"Deploy multiple relays on different accounts for more IP diversity"})]}),(0,l.jsxs)("div",{className:"mt-2 pt-2 border-t border-border text-xs text-text-muted",children:[(0,l.jsx)("p",{className:"font-medium text-text-main mb-1",children:"How to generate API token:"}),(0,l.jsxs)("ol",{className:"list-decimal pl-4 space-y-0.5",children:[(0,l.jsxs)("li",{children:["Go to ",(0,l.jsx)("b",{children:"User Settings"})," → ",(0,l.jsx)("b",{children:"Applications"})," → ",(0,l.jsx)("b",{children:"Personal access tokens"})]}),(0,l.jsxs)("li",{children:["Select ",(0,l.jsx)("b",{children:"New access token"})," and generate a token"]}),(0,l.jsx)("li",{children:"Copy the token - you won't see it again after leaving the page"})]})]})]}),(0,l.jsx)(o.pd,{label:"Netlify API Token",value:O.netlifyToken,onChange:e=>R(t=>({...t,netlifyToken:e.target.value})),placeholder:"nfp_xxxxxxxxxxxxxxxx",hint:(0,l.jsxs)(l.Fragment,{children:["Token is used once for deployment and not stored. ",(0,l.jsx)("a",{href:"https://app.netlify.com/user/applications#personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]}),type:"password"}),(0,l.jsx)(o.pd,{label:"Site Name",value:O.projectName,onChange:e=>R(t=>({...t,projectName:e.target.value})),placeholder:"netlify-relay",hint:"Unique site name (lowercase letters, numbers, hyphens). Your relay URL will be https://site-name.netlify.app/.netlify/functions/relay"}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:ew,disabled:!O.netlifyToken.trim()||L,children:L?"Deploying... (may take ~1 min)":"Deploy"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:eb,disabled:L,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:d,title:N?"Edit Proxy Pool":"Add Proxy Pool",onClose:ea,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)(o.pd,{label:"Name",value:C.name,onChange:e=>P(t=>({...t,name:e.target.value})),placeholder:"Office Proxy"}),(0,l.jsx)(o.pd,{label:"Proxy URL",value:C.proxyUrl,onChange:e=>P(t=>({...t,proxyUrl:e.target.value})),placeholder:"http://127.0.0.1:7897"}),(0,l.jsx)(o.pd,{label:"No Proxy",value:C.noProxy,onChange:e=>P(t=>({...t,noProxy:e.target.value})),placeholder:"localhost,127.0.0.1,.internal",hint:"Comma-separated hosts/domains to bypass proxy"}),(0,l.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border/50 p-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-sm",children:"Active"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Inactive pools are ignored by runtime resolution."})]}),(0,l.jsx)(o.lM,{checked:!0===C.isActive,onChange:()=>P(e=>({...e,isActive:!e.isActive})),disabled:F})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border/50 p-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-sm",children:"Strict Proxy"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Fail request if proxy is unreachable instead of falling back to direct."})]}),(0,l.jsx)(o.lM,{checked:!0===C.strictProxy,onChange:()=>P(e=>({...e,strictProxy:!e.strictProxy})),disabled:F})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:ei,disabled:!C.name.trim()||!C.proxyUrl.trim()||F,children:F?"Saving...":"Save"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:ea,disabled:F,children:"Cancel"})]})]})}),(0,l.jsx)(o.uo,{isOpen:!!X,onClose:()=>ee(null),onConfirm:X?.onConfirm,title:X?.title||"Confirm",message:X?.message,variant:"danger"})]})}},81544:(e,t,r)=>{Promise.resolve().then(r.bind(r,57076))}},e=>{e.O(0,[763,2470,705,3557,5497,8441,3794,7358],()=>e(e.s=81544)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7414],{15697:(e,t,s)=>{Promise.resolve().then(s.bind(s,71470))},71470:(e,t,s)=>{"use strict";s.d(t,{default:()=>j});var a=s(95155),l=s(12115),r=s(21742),i=s(90639),d=s(77496),n=s(32539),o=s(59656),x=s(1162),c=s(97779),m=s(35497);let p=e=>e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e||0),h=[{id:"today",label:"Today"},{id:"yesterday",label:"Yesterday"},{id:"last7d",label:"7 days"},{id:"last30d",label:"30 days"},{id:"all",label:"All time"}],u={applied:"Prompt exceeded threshold",below_threshold:"Below size threshold",not_profitable:"Compression not profitable",below_min_chars:"Below minimum chars",below_min_tokens:"Below minimum tokens",unsupported_model:"Model not in allowlist",unsupported_format:"Non-Claude request format",timeout:"Compression timed out",transform_error:"Transform error",passthrough:"Passthrough",disabled:"Disabled",not_installed:"Not installed"};function g({label:e,value:t,sub:s,tone:l}){return(0,a.jsxs)(m.Zp,{className:"p-4",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted uppercase tracking-wide",children:e}),(0,a.jsx)("p",{className:`text-xl font-semibold mt-1 ${l||""}`,children:t}),s&&(0,a.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:s})]})}function j(){let[e,t]=(0,l.useState)(null),[s,j]=(0,l.useState)(null),[b,f]=(0,l.useState)(null),[N,y]=(0,l.useState)(null),[v,w]=(0,l.useState)("last7d"),[k,S]=(0,l.useState)(!0),P=(0,l.useCallback)(async()=>{S(!0);try{let[e,s,a]=await Promise.all([fetch("/api/pxpipe/status",{headers:{"Cache-Control":"no-store"}}),fetch("/api/pxpipe/stats"),fetch("/api/pxpipe/logs?limit=50")]);t(await e.json()),f(await s.json()),y(await a.json());let l=await fetch("/api/pxpipe/health",{method:"POST"});j(await l.json())}catch{}finally{S(!1)}},[]);(0,l.useEffect)(()=>{P()},[P]);let E=b?.windows?.[v],$=e?e.installed?s?.healthy?"Healthy":e.running?"Running":"Stopped":"Not installed":"-";return(0,a.jsxs)("div",{className:"space-y-6 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"image"}),"PXPIPE Dashboard"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("a",{href:"/dashboard/token-saver",className:"text-xs text-primary underline hover:opacity-80",children:"Token Saver settings"}),(0,a.jsx)(m.$n,{size:"sm",variant:"ghost",onClick:P,disabled:k,children:k?"Refreshing…":"Refresh"})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:[(0,a.jsx)(g,{label:"Status",value:$,tone:s?.healthy?"text-success":e?.installed?"text-warning":"text-text-muted",sub:e?.enabled?"Enabled in pipeline":"Disabled in pipeline"}),(0,a.jsx)(g,{label:"Version",value:e?.version?`v${e.version}`:"-",sub:"pxpipe-proxy"}),(0,a.jsx)(g,{label:"Uptime",value:(e=>{if(!e||e<=0)return"-";let t=Math.floor(e/6e4),s=Math.floor(t/60);return s>0?`${s}h${String(t%60).padStart(2,"0")}m`:`${t}m`})(e?.uptimeMs),sub:"module loaded"}),(0,a.jsx)(g,{label:"Requests",value:E?E.requests.toLocaleString():"-"}),(0,a.jsx)(g,{label:"Compressed",value:E?E.compressed.toLocaleString():"-",tone:"text-success"}),(0,a.jsx)(g,{label:"Bypassed",value:E?E.bypassed.toLocaleString():"-"})]}),(0,a.jsxs)(m.Zp,{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3 mb-4",children:[(0,a.jsx)("h3",{className:"font-medium",children:"Token savings (estimated)"}),(0,a.jsx)("div",{className:"flex items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1",children:h.map(e=>(0,a.jsx)("button",{onClick:()=>w(e.id),className:`px-3 py-1 rounded-md text-xs font-medium transition-colors ${v===e.id?"bg-primary text-white dark:text-amber-950 shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:e.label},e.id))})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-center",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Original tokens"}),(0,a.jsx)("p",{className:"text-lg font-semibold",children:E?p(E.tokensBeforeEst):"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"After PXPIPE"}),(0,a.jsx)("p",{className:"text-lg font-semibold",children:E?p(E.tokensAfterEst):"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Saved"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-success",children:E?p(E.tokensSavedEst):"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Reduction"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-success",children:E?`${E.savedPct}%`:"-"})]})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-3",children:["Estimates from body size before/after imaging; billed usage per request (recorded on the Usage page) remains the ground truth. Images generated:"," ",E?E.imagesGenerated.toLocaleString():"-"," \xb7 avg compression time:"," ",E?`${E.avgCompressionMs}ms`:"-"," \xb7 errors: ",E?E.errors:"-"]})]}),(0,a.jsxs)(m.Zp,{className:"p-4",children:[(0,a.jsx)("h3",{className:"font-medium mb-3",children:"Tokens saved - last 30 days"}),b?.timeline?.some(e=>e.tokensSavedEst>0)?(0,a.jsx)(r.u,{width:"100%",height:220,children:(0,a.jsxs)(i.Q,{data:b.timeline,margin:{top:4,right:8,left:0,bottom:0},children:[(0,a.jsx)("defs",{children:(0,a.jsxs)("linearGradient",{id:"gradPxpipe",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"5%",stopColor:"#10b981",stopOpacity:.25}),(0,a.jsx)("stop",{offset:"95%",stopColor:"#10b981",stopOpacity:0})]})}),(0,a.jsx)(d.d,{strokeDasharray:"3 3",strokeOpacity:.2}),(0,a.jsx)(n.W,{dataKey:"date",tick:{fontSize:11},tickFormatter:e=>e.slice(5)}),(0,a.jsx)(o.h,{tick:{fontSize:11},tickFormatter:p,width:48}),(0,a.jsx)(x.m,{formatter:e=>[p(e),"Tokens saved"],labelFormatter:e=>e}),(0,a.jsx)(c.Gk,{type:"monotone",dataKey:"tokensSavedEst",stroke:"#10b981",fill:"url(#gradPxpipe)",strokeWidth:2})]})}):(0,a.jsx)("div",{className:"h-32 flex items-center justify-center text-text-muted text-sm",children:"No savings recorded yet - enable PXPIPE in the Token Saver and route a large Claude-format request."})]}),(0,a.jsxs)(m.Zp,{className:"p-4",children:[(0,a.jsx)("h3",{className:"font-medium mb-3",children:"History"}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"text-left text-xs text-text-muted border-b border-border",children:[(0,a.jsx)("th",{className:"py-2 pr-3",children:"Time"}),(0,a.jsx)("th",{className:"py-2 pr-3",children:"Model"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"Original"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"Compressed"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"Saved"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"%"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"Duration"}),(0,a.jsx)("th",{className:"py-2",children:"Status"})]})}),(0,a.jsxs)("tbody",{children:[(b?.recent||[]).slice(0,50).map((e,t)=>(0,a.jsxs)("tr",{className:"border-b border-border/50",children:[(0,a.jsx)("td",{className:"py-1.5 pr-3 whitespace-nowrap text-text-muted",children:new Date(e.ts).toLocaleString()}),(0,a.jsx)("td",{className:"py-1.5 pr-3 font-mono text-xs",children:e.provider?`${e.provider}/${e.model}`:e.model||"-"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs",children:e.applied?p(e.tokensBeforeEst):"-"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs",children:e.applied?p(e.tokensAfterEst):"-"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs text-success",children:e.applied?p(e.tokensSavedEst):"-"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs",children:e.applied?`${e.savedPct}%`:"-"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs",children:null!=e.durationMs?`${e.durationMs}ms`:"-"}),(0,a.jsx)("td",{className:"py-1.5",children:(0,a.jsx)("span",{className:`text-xs px-2 py-0.5 rounded ${e.applied?"bg-success/15 text-success":"transform_error"===e.reason||"timeout"===e.reason?"bg-danger/15 text-danger":"bg-warning/15 text-warning"}`,title:e.detail||"",children:e.applied?"Compressed":u[e.reason]||e.reason})})]},`${e.ts}-${t}`)),(!b?.recent||0===b.recent.length)&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:8,className:"py-6 text-center text-text-muted text-sm",children:"No PXPIPE activity yet"})})]})]})})]}),(0,a.jsxs)(m.Zp,{className:"p-4",id:"logs",children:[(0,a.jsx)("h3",{className:"font-medium mb-3",children:"PXPIPE Logs"}),N?.installLog?(0,a.jsx)("pre",{className:"rounded bg-black/5 dark:bg-white/5 p-3 text-xs font-mono overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap",children:N.installLog}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No install log yet."})]})]})}}},e=>{e.O(0,[763,3842,4285,1649,2470,705,3557,5497,8441,3794,7358],()=>e(e.s=15697)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{56804:(e,t,r)=>{Promise.resolve().then(r.bind(r,75095)),Promise.resolve().then(r.bind(r,25086))},75095:(e,t,r)=>{"use strict";r.d(t,{default:()=>z});var a=r(95155),s=r(12115),n=r(73321),i=r(57250),l=r(39403),o=r(13097);let d="quotaCacheData",c="quotaAutoRefresh",u=[10,20,50,100],m=[{value:"all",label:"All accounts"},{value:"active",label:"Active"},{value:"inactive",label:"Turned off"}],x=[{value:"default",label:"Default quota order"},{value:"remaining-asc",label:"% quota: low to high"},{value:"remaining-desc",label:"% quota: high to low"}];function p(e){return e.name?.trim()||e.email?.trim()||e.displayName?.trim()||null}function h(e,t){let r=t[e.id]?.quotas?.[0];return r&&"number"==typeof r.remaining?r.remaining:1/0}function g(e){let t={};return e.forEach(e=>{t[e.id]=!0}),t}function b(e,t){let r=new Set(t.map(e=>e.id));return Object.fromEntries(Object.entries(e).filter(([e])=>r.has(e)))}async function f(e,t){return await e(t)}function y(){try{let e=window.localStorage.getItem(d);return e?JSON.parse(e):{}}catch(e){return console.error("Error reading quota cache:",e),{}}}function v(e,t){try{let r=y();r[e]={...t,cachedAt:new Date().toISOString()},window.localStorage.setItem(d,JSON.stringify(r))}catch(e){console.error("Error writing quota cache:",e)}}function w(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function j(e){return e&&"object"==typeof e?String(e.modelKey||e.name||"").trim():""}function N(e,t,r=[]){let a=t?.[e]?.hidden;return Array.isArray(a)&&0!==a.length?new Set((r.length>0?function(e=[],t=[]){if(!Array.isArray(e)||0===e.length)return[];let r=new Set(t.map(j).filter(Boolean));return[...new Set(e.map(e=>String(e).trim()).filter(e=>r.has(e)))]}(a,r):a).map(String)):new Set}function k({quotas:e=[],compact:t=!1,sortMode:r="default",showSortLabel:n=!1,onHideQuota:i=null}){let[l,o]=(0,s.useState)(1),d=(0,s.useMemo)(()=>e.map((e,t)=>({...e,index:t,remaining:e?.percentage!==void 0?Math.max(0,Math.round(!0===e.percentageIsUsed?100-e.percentage:e.percentage)):e?.remaining!==void 0?Math.max(0,Math.round(e.remaining)):e?.remainingPercentage!==void 0?Math.round(e.remainingPercentage):w(e?.used,e?.total)})),[e]),c=(0,s.useMemo)(()=>"remaining-asc"===r?[...d].sort((e,t)=>e.remaining-t.remaining||e.name.localeCompare(t.name)):"remaining-desc"===r?[...d].sort((e,t)=>t.remaining-e.remaining||e.name.localeCompare(t.name)):d,[d,r]),u=Math.max(1,Math.ceil(c.length/10));if((0,s.useEffect)(()=>{o(1)},[r,e]),(0,s.useEffect)(()=>{o(e=>Math.min(e,u))},[u]),!e||0===e.length)return null;let m=c.slice((l-1)*10,10*l),x=0===c.length?0:(l-1)*10+1,p=Math.min(10*l,c.length),h=t?"py-1 px-1.5":"py-2 px-3",g=t?"text-[11px]":"text-sm",b=t?"text-[11px]":"text-sm",f=t?"text-[10px] leading-tight":"text-xs",y="function"==typeof i;return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"text-[10px] text-text-muted",children:[c.length," quota",c.length>1?"s":""]}),n&&(0,a.jsx)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1 text-[10px] text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:"Sorted by account remaining"})]}),(0,a.jsx)("div",{className:"space-y-px",children:m.map(e=>{var r;let s=!0===e.unlimited,n=!0===e.isCreditBalance,l=n?{text:"text-blue-600 dark:text-blue-400",bg:"bg-blue-500",bgLight:"bg-blue-500/10",emoji:"\uD83D\uDCB0"}:(r=e.colorPercentage??e.remaining)>70?{text:"text-green-600 dark:text-green-400",bg:"bg-green-500",bgLight:"bg-green-500/10",emoji:"\uD83D\uDFE2"}:r>=30?{text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-500",bgLight:"bg-yellow-500/10",emoji:"\uD83D\uDFE1"}:{text:"text-red-600 dark:text-red-400",bg:"bg-red-500",bgLight:"bg-red-500/10",emoji:"\uD83D\uDD34"},o=e.neverExpires?"-":function(e){if(!e)return"-";try{let t="string"==typeof e?new Date(e):e,r=new Date,a=t-r;if(a<=0)return"-";let s=Math.ceil(a/6e4);if(s<60)return`${s}m`;let n=Math.floor(s/60),i=s%60;if(n<24)return`${n}h ${i}m`;let l=Math.floor(n/24);return`${l}d ${n%24}h ${i}m`}catch(e){return"-"}}(e.resetAt),d=!e.neverExpires&&!e.resetAt&&!!e.detailUrl,c=e.emptyMessage?e.emptyMessage:e.neverExpires?"Never expires":d?"See details":function(e){if(!e)return null;try{let t=new Date(e),r=new Date,a=new Date(r.getFullYear(),r.getMonth(),r.getDate()),s=new Date(a);s.setDate(s.getDate()+1);let n="";n=t>=a&&t<s?"Today":t>=s&&t<new Date(s.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let i=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${n}, ${i}`}catch{return null}}(e.resetAt),u=d&&e.detailUrl?e.detailUrl:c,m=!1!==e.recurring?`in ${o}`:`expires in ${o}`,x=t=>d?(0,a.jsxs)("a",{href:e.detailUrl,target:"_blank",rel:"noopener noreferrer",className:`${t} inline-flex items-center gap-0.5 hover:text-text-primary hover:underline`,title:`Open usage details: ${u}`,"aria-label":`Open usage details for ${e.name}`,children:[c,(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"open_in_new"})]}):c;return(0,a.jsxs)("div",{className:`flex items-center gap-2 border-b border-black/5 dark:border-white/5 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${h}`,children:[(0,a.jsxs)("div",{className:"flex w-36 min-w-0 items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-[10px] shrink-0",children:l.emoji}),(0,a.jsx)("span",{className:`${g} font-medium text-text-primary truncate`,children:e.name})]}),(0,a.jsxs)("div",{className:`min-w-0 flex-1 ${t?"space-y-1":"space-y-1.5"}`,children:[!s&&!n&&(0,a.jsx)("div",{className:`${t?"h-1":"h-1.5"} rounded-full overflow-hidden border ${l.bgLight} ${0===e.remaining?"border-black/10 dark:border-white/10":"border-transparent"}`,children:(0,a.jsx)("div",{className:`h-full transition-all duration-300 ${l.bg}`,style:{width:`${Math.min(e.remaining,100)}%`}})}),(0,a.jsxs)("div",{className:`flex items-center justify-between gap-1 min-w-0 ${t?"text-[10px]":"text-xs"}`,children:[(0,a.jsx)("span",{className:"text-text-muted truncate",title:s?`${e.used.toLocaleString()} used \xb7 Unlimited`:n?`Credit balance: ${e.total.toFixed(2)} ${e.currency||""}`:`${e.used.toLocaleString()} / ${e.total>0?e.total.toLocaleString():"∞"}`,children:s?`${e.used.toLocaleString()} used \xb7 Unlimited`:n?`Credit: ${e.total.toFixed(2)} ${e.currency||""}`:`${e.used.toLocaleString()} / ${e.total>0?e.total.toLocaleString():"∞"}${e.unit?` ${e.unit}`:""}`}),(0,a.jsx)("span",{className:`font-medium ${s?"text-green-600 dark:text-green-400":n?"text-blue-600 dark:text-blue-400":l.text} shrink-0`,children:s?"Unlimited":n?"":`${e.remaining}%`})]})]}),(0,a.jsx)("div",{className:"min-w-0 shrink",children:"-"!==o||c?t?(0,a.jsx)("div",{className:`${b} text-text-primary font-medium truncate`,title:u||"",children:"-"!==o?m:x(b)}):(0,a.jsxs)("div",{className:"min-w-0 space-y-0.5",children:["-"!==o&&(0,a.jsx)("div",{className:`${b} text-text-primary font-medium truncate`,children:m}),c&&(0,a.jsx)("div",{className:`${f} text-text-muted truncate`,children:x(f)})]}):(0,a.jsx)("div",{className:`${b} text-text-muted italic`,children:"N/A"})}),y&&(0,a.jsx)("button",{type:"button",onClick:()=>i(e),className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-text-muted transition-colors hover:bg-black/5 hover:text-text-primary dark:hover:bg-white/5",title:"Hide this quota row","aria-label":`Hide quota ${e.name}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[15px]",children:"visibility_off"})})]},`${e.name}-${e.index}`)})}),u>1&&(0,a.jsxs)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1.5 dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 text-[10px] text-text-muted",children:[(0,a.jsxs)("span",{children:["Showing ",x,"-",p," of ",c.length]}),(0,a.jsxs)("span",{children:["Page ",l," / ",u]})]}),(0,a.jsxs)("div",{className:"mt-1.5 flex items-center justify-end gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>o(e=>Math.max(1,e-1)),disabled:1===l,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Prev"}),(0,a.jsx)("button",{type:"button",onClick:()=>o(e=>Math.min(u,e+1)),disabled:l===u,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Next"})]})]})]})}var C=r(98542),S=r(97677),A=r(84588),$=r(35497),P=r(97132),q=r(93195),E=r(88105),_=r(11059);let D={"builder-id":"AWS Builder ID",idc:"IAM Identity Center",google:"Google",github:"GitHub",imported:"Imported Token",api_key:"API Key"},M={claude:"claudeAutoPing",codex:"codexAutoPing"};function O(e){return e.name?.trim()&&e.email?.trim()&&e.name.trim()!==e.email.trim()?e.email.trim():e.name?.trim()&&e.displayName?.trim()&&e.name.trim()!==e.displayName.trim()?e.displayName.trim():null}function T(e){let t=e.providerSpecificData?.region;if(t)return t;let r=e.providerSpecificData?.profileArn;return("string"==typeof r?r.split(":")[3]:"")||""}let I={five_hour:"session",seven_day:"weekly",seven_day_overage_included:"weekly",seven_day_opus:"Opus weekly",seven_day_sonnet:"Sonnet weekly"};function F(e){let t=[...new Set((e||[]).map(e=>I[e]).filter(Boolean))];return t.length?`${t.join(" + ")} limits`:"limits"}function L(e){return E.Q2[e]?.name||e}function U(e){if(!e)return"N/A";let t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):"N/A"}function R(e){if(!e)return"N/A";let t=new Date(e).getTime()-Date.now();if(!Number.isFinite(t))return"N/A";if(t<=0)return"Expired";let r=Math.ceil(t/36e5),a=Math.floor(r/24),s=r%24;return a>0?`${a}d ${s}h`:`${s}h`}function z(){let{copied:e,copy:t}=(0,_.C)(),r=(0,n.useSearchParams)(),I=(0,n.useRouter)(),z=(0,n.usePathname)(),[H,W]=(0,s.useState)([]),[B,J]=(0,s.useState)({}),[K,V]=(0,s.useState)({}),[G,Q]=(0,s.useState)({}),[Z,Y]=(0,s.useState)(!0),[X,ee]=(0,s.useState)({claude:{},codex:{}}),[et,er]=(0,s.useState)(null),[ea,es]=(0,s.useState)(null),[en,ei]=(0,s.useState)(!1),[el,eo]=(0,s.useState)(!1),[ed,ec]=(0,s.useState)(60),[eu,em]=(0,s.useState)(!0),[ex,ep]=(0,s.useState)(null),[eh,eg]=(0,s.useState)(null),[eb,ef]=(0,s.useState)(null),[ey,ev]=(0,s.useState)(null),[ew,ej]=(0,s.useState)(null),[eN,ek]=(0,s.useState)(!1),[eC,eS]=(0,s.useState)(null),[eA,e$]=(0,s.useState)([]),[eP,eq]=(0,s.useState)(()=>r?.get("provider")||"all"),eE=(0,s.useCallback)(e=>{eq(e);try{let t=new URLSearchParams(r?.toString()||"");"all"===e?t.delete("provider"):t.set("provider",e);let a=t.toString()?`${z}?${t.toString()}`:z;I.replace(a,{scroll:!1})}catch{}},[z,I,r]),[e_,eD]=(0,s.useState)([]),[eM,eO]=(0,s.useState)("all"),[eT,eI]=(0,s.useState)("default"),[eF,eL]=(0,s.useState)({}),[eU,eR]=(0,s.useState)(!1),[ez,eH]=(0,s.useState)(!1),[eW,eB]=(0,s.useState)(!1),[eJ,eK]=(0,s.useState)(1),[eV,eG]=(0,s.useState)(20),[eQ,eZ]=(0,s.useState)(String(20)),[eY,eX]=(0,s.useState)({page:1,pageSize:20,total:0,totalPages:1}),[e0,e1]=(0,s.useState)({eligibleConnections:0,providerFilteredConnections:0}),e2=(0,s.useRef)(null),e5=(0,s.useRef)(null),e3=(0,s.useRef)(0),e4=(0,s.useCallback)(async(e=eJ)=>{try{var t,r;let a=new URLSearchParams({page:String(e),pageSize:String(eV),accountStatus:eM,sort:"priority"});"all"!==eP&&a.set("provider",eP);let s=await fetch(`/api/providers/client?${a.toString()}`);if(!s.ok)throw Error("Failed to fetch connections");let n=await s.json(),i=n.connections||[],l=(t=n.pagination,t||{page:1,pageSize:eV,total:0,totalPages:1}),o=function(e,t=0){return e||{eligibleConnections:t,providerFilteredConnections:t}}(n.totals,i.length);return W(i),eD(n.providerOptions||[]),eX(l),e1(o),eK((r=n.pagination,r?.page||e)),i}catch(e){return console.error("Error fetching connections:",e),W([]),eD([]),eX({page:1,pageSize:eV,total:0,totalPages:1}),e1({eligibleConnections:0,providerFilteredConnections:0}),[]}},[eM,eU,eJ,eV,eP]),e8=(0,s.useCallback)(async(e,t,{force:r=!1}={})=>{V(t=>({...t,[e]:!0})),Q(t=>({...t,[e]:null}));try{console.log(`[ProviderLimits] Fetching quota for ${t} (${e})`);let a=`/api/usage/${e}${r?"?force=1":""}`,s=await fetch(a);if(!s.ok){let r=(await s.json().catch(()=>({}))).error||s.statusText;if(404===s.status)return void console.warn(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===s.status){console.warn(`[ProviderLimits] Auth error for ${t}:`,r);let a={quotas:[],message:r};J(t=>({...t,[e]:a})),v(e,a);return}throw Error(`HTTP ${s.status}: ${r}`)}let n=await s.json();console.log(`[ProviderLimits] Got quota for ${t}:`,n);let i={quotas:function(e,t){if(!t||"object"!=typeof t)return[];let r=[];try{switch(e.toLowerCase()){case"github":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":if(t.quotas){let e=Object.entries(t.quotas),a=new Set(["gemini_weekly","claude_gpt_weekly"]),s=new Set(["gemini_session","claude_gpt_session"]),n=new Set([...a,...s]),i=e.filter(([e])=>e.startsWith("gemini-")&&!e.includes("image")),l=e.filter(([e])=>e.startsWith("claude-")),o=e.filter(([e])=>e.includes("image")),d=e.filter(([e])=>n.has(e)),c=e.filter(([e])=>!e.startsWith("gemini-")&&!e.startsWith("claude-")&&!e.includes("image")&&!n.has(e)),u=!!t.quotas.gemini_weekly,m=!!t.quotas.gemini_session,x=!!t.quotas.claude_gpt_weekly,p=!!t.quotas.claude_gpt_session;if(m)d.filter(([e])=>"gemini_session"===e).forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});else if(i.length>0){let e=i.reduce((e,t)=>(t[1].remainingPercentage??100)<(e[1].remainingPercentage??100)?t:e)[1],a=t.quotas.gemini_weekly?.resetAt;u&&e.resetAt===a&&(e.remainingPercentage??0)===0||r.push({name:"Gemini (Flash / Pro)",modelKey:"gemini",used:e.used||0,total:e.total||0,resetAt:e.resetAt||null,remainingPercentage:e.remainingPercentage})}if(u&&d.filter(([e])=>"gemini_weekly"===e).forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})}),p)d.filter(([e])=>"claude_gpt_session"===e).forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});else if(l.length>0){let e=l.reduce((e,t)=>(t[1].remainingPercentage??100)<(e[1].remainingPercentage??100)?t:e)[1],a=t.quotas.claude_gpt_weekly?.resetAt;x&&e.resetAt===a&&(e.remainingPercentage??0)===0||r.push({name:"Claude (Sonnet / Opus)",modelKey:"claude",used:e.used||0,total:e.total||0,resetAt:e.resetAt||null,remainingPercentage:e.remainingPercentage})}x&&d.filter(([e])=>"claude_gpt_weekly"===e).forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})}),o.forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})}),x||p||c.forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})})}break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{let a=e;"spark_session"===e?a="Spark (5h)":"spark_weekly"===e?a="Spark (Weekly)":"session"===e?a="5h":"weekly"===e?a="Weekly":"review_session"===e?a="Review (5h)":"review_weekly"===e&&(a="Review (Weekly)"),r.push({name:a,quotaType:e,used:t.used||0,total:t.total||0,remaining:t.remaining,resetAt:t.resetAt||null})});break;case"kiro":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"qoder":case"qoder-cn":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{t&&0!==(Number(t.total)||0)&&r.push({name:"user"===e?"Personal":"organization"===e?"Organization":"addOn"===e?"Add-on":e,used:t.used||0,total:t.total||0,unit:t.unit,resetAt:t.resetAt||null,neverExpires:!0===t.neverExpires,detailUrl:t.detailUrl||null})});break;case"claude":t.message?r.push({name:"error",used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,remaining:void 0!==t.remaining?t.remaining:Math.max(0,(t.total||100)-(t.used||0)),remainingPercentage:void 0!==t.remainingPercentage?t.remainingPercentage:w(t.used,t.total),resetAt:t.resetAt||null})});break;case"vercel-ai-gateway":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codebuddy-cn":case"codebuddy-intl":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,recurring:!1!==t.recurring})});break;case"grok-cli":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"kimi":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"deepseek":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage,isCreditBalance:t.isCreditBalance??!0,currency:t.currency||(e.includes("(")?e.slice(e.indexOf("(")+1,e.indexOf(")")):"USD")})});break;case"cursor":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"groq":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"ollama":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage,isCreditBalance:t.isCreditBalance,currency:t.currency,unit:t.unit,unlimited:t.unlimited})});break;case"zed":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage,unlimited:t.unlimited})});break;case"minimax-code":case"minimax-code-global":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,remaining:t.remaining,remainingPercentage:t.remainingPercentage,resetAt:t.resetAt||null,message:t.message,isCreditBalance:t.isCreditBalance,currency:t.currency})});break;default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:t.name||e,used:t.used||0,total:t.total||0,percentage:t.percentage,colorPercentage:t.colorPercentage,percentageIsUsed:!0===t.percentageIsUsed,resetAt:t.resetAt||null,emptyMessage:t.emptyMessage||null})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}if(e?.toLowerCase()==="claude"){let e={"session (5h)":0,"weekly (7d)":1,"weekly fable (7d)":2,"weekly opus (7d)":3,"weekly sonnet (7d)":4};return r.sort((t,r)=>(e[t.name]??99)-(e[r.name]??99)),r}let a=(0,o.KC)(e);if(a.length>0){let e=new Map(a.map((e,t)=>[e.id,t]));r.sort((t,r)=>{let a=t.modelKey||t.name,s=r.modelKey||r.name;return("gemini"===a||"gemini_session"===a)&&(a="gemini-3.8-flash-high"),("claude"===a||"claude_gpt_session"===a)&&(a="claude-sonnet-4-6"),("gemini"===s||"gemini_session"===s)&&(s="gemini-3.8-flash-high"),("claude"===s||"claude_gpt_session"===s)&&(s="claude-sonnet-4-6"),(e.get(a)??999)-(e.get(s)??999)})}return r}(t,n),plan:n.plan||null,message:n.message||null,raw:n};J(t=>({...t,[e]:i})),v(e,i)}catch(r){console.error(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,r),Q(t=>({...t,[e]:r.message||"Failed to fetch quota"}))}finally{V(t=>({...t,[e]:!1}))}},[]),e6=(0,s.useCallback)(async(e,t)=>{await e8(e,t,{force:!0}),es(new Date)},[e8]),e9=(0,s.useCallback)(async(e,t)=>{if(("codex"===t||"claude"===t)&&!eb){ef(e),Q(t=>({...t,[e]:null}));try{let r="claude"===t?await fetch(`/api/usage/${e}/claude-reset`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grantId:B[e]?.raw?.resetCredits?.nextGrantId})}):await fetch(`/api/usage/${e}/codex-reset-credits`,{method:"POST"}),a=await r.json().catch(()=>({}));if(!r.ok)throw Error(a.message||a.error||a.code||"Failed to reset limit");await e8(e,t,{force:!0}),es(new Date)}catch(t){Q(r=>({...r,[e]:t.message||"Failed to reset limit"}))}finally{ef(null)}}},[e8,eb,B]),e7=(0,s.useCallback)((e,t)=>{ej({connection:e,loading:!1,error:null,data:{kind:"claude",...t}})},[]),te=(0,s.useCallback)(async e=>{ej({connection:e,loading:!0,error:null,data:null});try{let t=await fetch(`/api/usage/${e.id}/codex-reset-credits`,{cache:"no-store"}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(r.error||r.message||"Failed to load Codex reset credits");let a=Array.isArray(r.credits)?[...r.credits]:[];a.sort((e,t)=>(e.expiresAt?new Date(e.expiresAt).getTime():1/0)-(t.expiresAt?new Date(t.expiresAt).getTime():1/0)),ej({connection:e,loading:!1,error:null,data:{...r,credits:a}})}catch(t){ej({connection:e,loading:!1,error:t.message||"Failed to load Codex reset credits",data:null})}},[]),tt=(0,s.useCallback)(async e=>{if(confirm("Delete this connection?")){ep(e);try{if((await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok){J(t=>{let r={...t};return delete r[e],r}),V(t=>{let r={...t};return delete r[e],r}),Q(t=>{let r={...t};return delete r[e],r});try{let t=y();t[e]&&(delete t[e],window.localStorage.setItem(d,JSON.stringify(t)))}catch(e){console.error("Error deleting cache entry:",e)}await f(e4,eJ)}}catch(e){console.error("Error deleting connection:",e)}finally{ep(null)}}},[e4,eJ]),tr=(0,s.useCallback)(async(e,t)=>{eg(e);try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&(J(e=>({...e})),await f(e4,eJ))}catch(e){console.error("Error updating connection status:",e)}finally{eg(null)}},[e4,eJ]),ta=(0,s.useCallback)(async e=>{if(!eC?.id)return;let t=eC.id,r=eC.provider;try{(await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await e4(),ek(!1),eS(null),E.wb.includes(r)&&await e8(t,r))}catch(e){console.error("Error saving connection:",e)}},[eC,e4,e8]);(0,s.useEffect)(()=>{let e=!1;return fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.json()).then(t=>{!e&&t?.proxyPools&&e$(t.proxyPools)}).catch(()=>{}),()=>{e=!0}},[]);let ts=(0,s.useCallback)(async(e=!1)=>{if(el)return;eo(!0),ec(60);let t=e3.current+=1;try{let r=await e4(eJ);V(g(r)),Q(e=>b(e,r)),J(e=>b(e,r)),await Promise.all(r.filter(r=>e||"claude"!==r.provider||t%10==0).map(e=>e8(e.id,e.provider))),es(new Date)}catch(e){console.error("Error refreshing all providers:",e)}finally{eo(!1)}},[el,e4,e8,eJ]);(0,s.useEffect)(()=>{(async()=>{em(!0);let e=await e4(eJ);em(!1),V(g(e)),Q(t=>b(t,e)),J(t=>b(t,e)),await Promise.all(e.map(e=>e8(e.id,e.provider))),es(new Date)})()},[e4,e8,eJ]),(0,s.useEffect)(()=>{let e=window.localStorage.getItem(c);Y(null===e||"true"===e),ei(!0)},[]),(0,s.useEffect)(()=>{en&&window.localStorage.setItem(c,String(Z))},[Z,en]),(0,s.useEffect)(()=>{fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{}).then(e=>{ee({claude:e?.claudeAutoPing||{},codex:e?.codexAutoPing||{}}),eL(e?.quotaVisibility||{})}).catch(()=>{})},[]);let tn=(0,s.useCallback)(async(e,t,{reactive:r,schedule:a})=>{let s=M[t];if(!s)return;let n=X[t]||{},i={...n,connections:{...n.connections||{},[e]:r},schedules:{...n.schedules||{},[e]:a}};ee({...X,[t]:i});try{let e=await fetch("/api/settings",{cache:"no-store"}),t={...(e.ok?await e.json():{})[s]||{},connections:i.connections,schedules:i.schedules};await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[s]:t})})}catch{ee(X)}},[X]),ti=(0,s.useCallback)(async(e,t)=>{eL(e);try{if(!(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({quotaVisibility:e})})).ok)throw Error("Failed to update quota visibility")}catch(e){console.error("Error updating quota visibility:",e),eL(t)}},[]),tl=(0,s.useCallback)((e,t)=>{let r=j(t);if(!e||!r)return;let a=eF[e]||{},s=new Set(a.hidden||[]);if(s.add(r),"antigravity"===e){if("gemini"===r)for(let e of s)e.startsWith("gemini-")&&!e.includes("image")&&s.delete(e);else if("claude"===r)for(let e of s)e.startsWith("claude-")&&s.delete(e)}ti({...eF,[e]:{...a,hidden:[...s]}},eF)},[eF,ti]),to=(0,s.useCallback)((e,t)=>{let r=j(t);if(!e||!r)return;let a=eF[e]||{},s=new Set(a.hidden||[]);if(s.delete(r),"antigravity"===e){if("gemini"===r)for(let e of s)e.startsWith("gemini-")&&!e.includes("image")&&s.delete(e);else if("claude"===r)for(let e of s)e.startsWith("claude-")&&s.delete(e)}ti({...eF,[e]:{...a,hidden:[...s]}},eF)},[eF,ti]);(0,s.useEffect)(()=>{if(!en||!Z){e2.current&&(clearInterval(e2.current),e2.current=null),e5.current&&(clearInterval(e5.current),e5.current=null);return}return e2.current=setInterval(()=>{ts()},6e4),e5.current=setInterval(()=>{ec(e=>e<=1?60:e-1)},1e3),()=>{e2.current&&clearInterval(e2.current),e5.current&&clearInterval(e5.current)}},[Z,ts,en]),(0,s.useEffect)(()=>{let e=()=>{document.hidden?(e2.current&&(clearInterval(e2.current),e2.current=null),e5.current&&(clearInterval(e5.current),e5.current=null)):Z&&en&&(e2.current=setInterval(()=>ts(),6e4),e5.current=setInterval(()=>{ec(e=>e<=1?60:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[Z,ts,en]);let td=(0,s.useMemo)(()=>(function(e,t,r,a,s){if("codex"===a&&"default"!==s)return[...e].sort((e,r)=>{let a=h(e,t),n=h(r,t),i="remaining-asc"===s?a-n:n-a;return 0!==i?i:(p(e)||"").localeCompare(p(r)||"")});if(!r){let t=new Map;for(let r of e){let e=r.provider||"";t.has(e)||t.set(e,[]),t.get(e).push(r)}return Array.from(t.values()).flat()}let n=e=>{let r=(t[e.id]?.quotas||[]).map(e=>e.resetAt?new Date(e.resetAt).getTime():1/0).filter(e=>Number.isFinite(e));return r.length>0?Math.min(...r):1/0};return[...e].sort((e,t)=>{let r=n(e)-n(t);return 0!==r?r:(e.provider||"").localeCompare(t.provider||"")||(p(e)||"").localeCompare(p(t)||"")})})(H,B,eU,eP,eT),[H,B,eU,eP,eT]),tc=e=>{let t=B[e.id]?.quotas;return!!t?.length&&t.some(e=>!!e.total&&!(e.total<=0)&&5>=w(e.used,e.total))},tu=(0,s.useCallback)(async(e,t)=>{if(e.length&&!eW){eB(!0);try{await Promise.all(e.map(e=>fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})}))),await f(e4,eJ)}catch(e){console.error("Error bulk toggling connections:",e)}finally{eB(!1)}}},[eW,e4,eJ]),tm="all"===eP?"All providers":L(eP),tx=e0.eligibleConnections>0,tp=td.length>0,th=e0.eligibleConnections?e0.providerFilteredConnections?{icon:"filter_alt_off",title:"No Accounts On This Page",description:"Try moving to another page or refreshing the current filters."}:{icon:"filter_alt_off",title:"No Accounts Match Current Filters",description:"all"===eP?"Try changing the account status filter to see more quota trackers.":`No ${"inactive"===eM?"turned off":"active"===eM?"active":"matching"} accounts found for ${eP}.`}:{icon:"cloud_off",title:"No Providers Connected",description:"Connect to providers with OAuth to track your API quota limits and usage."},tg=function(e){var t;let{start:r,end:a}=(t=e).total?{start:(t.page-1)*t.pageSize+1,end:Math.min(t.page*t.pageSize,t.total)}:{start:0,end:0};return`Showing ${r}-${a} of ${e.total}`}(eY),tb=!u.includes(eV);return eu||tx?eu||tp?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-center",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>eH(e=>!e),className:"flex h-8 items-center justify-between gap-1 rounded-lg border border-border bg-surface px-2 font-display text-xs font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2","aria-haspopup":"menu","aria-expanded":ez,title:"Filter quota providers",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:["all"===eP?(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-primary dark:text-primary",children:"apps"}):(0,a.jsx)(i.A,{src:`/providers/${eP}.png`,alt:eP,size:18,className:"size-[18px] rounded object-contain",fallbackText:eP.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"truncate hidden lg:inline",children:tm})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"expand_more"})]}),ez&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"fixed inset-0 z-30 bg-transparent","aria-label":"Close provider filter",onClick:()=>eH(!1)}),(0,a.jsxs)("div",{className:"absolute left-0 z-40 mt-2 w-64 overflow-hidden rounded-xl border border-border bg-surface p-1.5 shadow-warm sm:w-72",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{"all"!==eP&&eK(1),eE("all"),eH(!1)},className:`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left text-sm transition-colors ${"all"===eP?"bg-surface-2 text-text-main":"text-text-main hover:text-primary dark:hover:text-primary"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[22px]",children:"apps"}),(0,a.jsx)("span",{className:"font-medium",children:"All providers"}),"all"===eP&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]}),(0,a.jsx)("div",{className:"my-1 h-px bg-border"}),(0,a.jsx)("div",{className:"max-h-72 overflow-y-auto pr-1",children:e_.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{eP!==e&&eK(1),eE(e),eH(!1)},className:`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left text-sm transition-colors ${eP===e?"bg-surface-2 text-text-main":"text-text-main hover:text-primary dark:hover:text-primary"}`,children:[(0,a.jsx)(i.A,{src:`/providers/${e}.png`,alt:e,size:24,className:"size-6 rounded-md object-contain",fallbackText:e.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"font-medium",children:L(e)}),eP===e&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]},e))})]})]})]}),(0,a.jsx)(l.A,{value:eM,onChange:e=>{eM!==e&&eK(1),eO(e)},options:m.map(e=>({value:e.value,label:e.label})),buttonClassName:"h-8 rounded-lg px-2 font-display text-xs font-medium",menuClassName:"w-48",align:"right"}),"codex"===eP&&(0,a.jsx)(l.A,{value:eT,onChange:eI,options:x.map(e=>({value:e.value,label:e.label})),buttonClassName:"h-8 rounded-lg px-2 font-display text-xs font-medium",menuClassName:"w-48",align:"right"}),(0,a.jsxs)("button",{type:"button",onClick:()=>eR(e=>!e),"aria-pressed":eU,className:`flex h-8 shrink-0 items-center gap-1 rounded-lg border px-2 font-display text-xs font-medium transition-colors ${eU?"border-text-subtle bg-surface-2 text-text-main":"border-border text-text-main hover:bg-surface-2"}`,title:"Sort accounts by earliest quota reset time",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"hourglass_top"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Expiring first"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{tu(td.filter(e=>(e.isActive??!0)&&tc(e)).map(e=>e.id),!1)},disabled:eW,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-border bg-surface px-2 font-display text-xs font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2 disabled:opacity-50",title:"Disable connections with depleted quota on the current page",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"block"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn off Empty"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{tu(td.filter(e=>!(e.isActive??!0)&&!tc(e)).map(e=>e.id),!0)},disabled:eW,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-border bg-surface px-2 font-display text-xs font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2 disabled:opacity-50",title:"Enable connections that still have quota on the current page",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"check_circle"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn on Available"})]}),(0,a.jsxs)("button",{onClick:()=>Y(e=>!e),className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-border bg-surface px-2 font-display text-xs font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",title:Z?"Disable auto-refresh":"Enable auto-refresh",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${Z?"text-text-main":"text-text-subtle"}`,children:Z?"toggle_on":"toggle_off"}),(0,a.jsx)("span",{className:"hidden text-text-main sm:inline",children:"Auto-refresh"}),Z&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted tabular-nums",children:["(",ed,"s)"]})]}),(0,a.jsx)("button",{type:"button",onClick:()=>ts(!0),disabled:el,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-border bg-surface px-2 font-display text-xs font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2 disabled:opacity-50",title:"Refresh all",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${el?"animate-spin":""}`,children:"refresh"})})]})}),eU&&(0,a.jsx)("div",{className:"rounded-xl border border-border bg-surface-2/50 px-3 py-2 text-xs text-text-muted",children:"Expiring-first currently reorders accounts inside the current page. Cross-page ordering still follows backend pagination."}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:td.map(r=>{let s,n,l,o=B[r.id],d=K[r.id],c=G[r.id],u=!1===r.isActive,m="codex"===r.provider,x="claude"===r.provider?o?.raw?.resetCredits:null,h=m?"Codex reset credit":"Claude limit reset",g=Number.isFinite(n="number"==typeof(s=o?.raw?.resetCredits?.availableCount)?s:Number(s))?Math.max(0,n):0,b=eb===r.id,f=ex===r.id||eh===r.id||b,y=o?.quotas||[],v=function(e,t=[],r={}){if(!Array.isArray(t)||0===t.length)return[];let a=N(e,r,t);return 0===a.size?t:t.filter(e=>!a.has(j(e)))}(r.provider,y,eF),w=function(e,t=[],r={}){if(!Array.isArray(t)||0===t.length)return[];let a=N(e,r,t);return 0===a.size?[]:t.filter(e=>a.has(j(e)))}(r.provider,y,eF);return(0,a.jsxs)(A.default,{padding:"none",className:`min-w-0 ${u?"opacity-60":""}`,children:[(0,a.jsx)("div",{className:"px-3 py-2 border-b border-border",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("div",{className:"w-8 h-8 shrink-0 rounded-md flex items-center justify-center overflow-hidden",children:(0,a.jsx)(i.A,{src:`/providers/${r.provider}.png`,alt:r.provider,size:32,className:"object-contain",fallbackText:r.provider?.slice(0,2).toUpperCase()||"PR"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-primary truncate",children:L(r.provider)}),p(r)?(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:p(r)}):null,O(r)?(0,a.jsx)("p",{className:"text-[11px] text-text-muted/80 truncate",children:O(r)}):null,"kiro"===r.provider&&(0,a.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[(0,a.jsx)("span",{className:"rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-medium text-text-muted",children:(l=r.providerSpecificData?.authMethod)&&D[l]?D[l]:"api_key"===r.authType?"API Key":"OAuth"}),T(r)&&(0,a.jsx)("span",{className:"rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-medium text-text-muted",children:T(r)}),(0,a.jsx)("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ${u?"bg-surface-2 text-text-muted":"active"===r.testStatus||"success"===r.testStatus?"bg-success/10 text-success":"error"===r.testStatus||"expired"===r.testStatus||"unavailable"===r.testStatus?"bg-danger/10 text-danger":"bg-surface-2 text-text-muted"}`,children:u?"disabled":r.testStatus||"unknown"}),r.providerSpecificData?.profileArn&&(0,a.jsxs)("button",{type:"button",onClick:()=>t(r.providerSpecificData.profileArn,r.id),title:r.providerSpecificData.profileArn,className:"inline-flex max-w-full items-center gap-1 rounded-full border border-border-subtle px-2 py-0.5 text-[10px] text-text-muted transition-colors hover:text-primary",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:e===r.id?"check":"content_copy"}),(0,a.jsx)("code",{className:"truncate font-mono",children:r.providerSpecificData.profileArn})]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(m||x)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.default,{text:g>0?x?`Use your reset now (${g} left, use by ${U(x.expiresAt)}) \xb7 refills ${F(x.clears)}`:`Use one ${h}. Available: ${g}`:`No ${h}s available`,children:(0,a.jsxs)("button",{type:"button",onClick:()=>ev({connection:r,resetCreditCount:g}),disabled:g<=0||d||f,"aria-label":g>0?`Use one ${h}. ${g} available.`:`No ${h}s available`,className:`flex h-8 min-w-10 items-center justify-center gap-1 rounded-lg border px-2 font-display text-[11px] font-medium tabular-nums transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary/60 disabled:cursor-not-allowed disabled:opacity-60 ${g>0?"border-text-subtle bg-surface-2 text-text-main hover:bg-surface-3":"border-border bg-surface text-text-muted"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[15px] ${b?"animate-spin":""}`,children:b?"progress_activity":"restart_alt"}),(0,a.jsx)("span",{children:g})]})}),(0,a.jsx)(S.default,{text:m?"View Codex reset credit expiry":"View Claude Code reset expiry",children:(0,a.jsx)("button",{type:"button",onClick:()=>m?te(r):e7(r,x),disabled:d||f,"aria-label":m?"View Codex reset credit expiry":"View Claude Code reset expiry",className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border bg-surface text-text-muted transition-colors hover:border-text-subtle hover:bg-surface-2 hover:text-text-main disabled:cursor-not-allowed disabled:opacity-50",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"schedule"})})})]}),M[r.provider]&&"oauth"===r.authType&&(()=>{let e=X[r.provider]||{},t=e.connections?.[r.id]===!0,s=e.schedules?.[r.id],n=s?.enabled===!0,i=[];if(t&&i.push("On reset"),n){let e=(0,q.JW)(s).join(" / ");i.push(`Scheduled (${e||"active"})`)}let l=i.length>0?`Auto-ping active: ${i.join(" + ")}. Click to configure.`:"codex"===r.provider?"Auto-starts the next 5h Codex window after reset or on schedule. Click to configure.":"Auto-starts a new window on quota reset or fixed schedule. Click to configure.";return(0,a.jsx)(S.default,{text:l,children:(0,a.jsx)("button",{type:"button",onClick:()=>er(r),"aria-label":"Configure auto-ping",className:`flex h-8 w-8 items-center justify-center rounded-lg border transition-colors hover:border-text-subtle hover:bg-surface-2 ${t||n?"border-text-subtle bg-surface-2 text-text-main":"border-border bg-surface text-text-muted"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"})})})})(),(0,a.jsx)(S.default,{text:"Refresh quota",children:(0,a.jsx)("button",{type:"button",onClick:()=>e6(r.id,r.provider),disabled:d||f,"aria-label":"Refresh quota",className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border bg-surface transition-colors hover:border-text-subtle hover:bg-surface-2 disabled:opacity-50",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted ${d?"animate-spin":""}`,children:"refresh"})})}),(0,a.jsx)(S.default,{text:"Edit connection",children:(0,a.jsx)("button",{type:"button",onClick:()=>{eS(r),ek(!0)},disabled:f,"aria-label":"Edit connection",className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border bg-surface text-text-muted transition-colors hover:border-text-subtle hover:bg-surface-2 hover:text-text-main disabled:opacity-50",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})})}),(0,a.jsx)(S.default,{text:"Delete connection",children:(0,a.jsx)("button",{type:"button",onClick:()=>tt(r.id),disabled:f,"aria-label":"Delete connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-red-500/10 text-red-500 transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${ex===r.id?"animate-pulse":""}`,children:"delete"})})}),(0,a.jsx)("div",{className:"inline-flex items-center pl-0.5",title:r.isActive??!0?"Disable connection":"Enable connection",children:(0,a.jsx)(C.default,{size:"sm",checked:r.isActive??!0,disabled:f,onChange:e=>tr(r.id,e)})})]})]})}),(0,a.jsxs)("div",{className:"px-2 py-1.5",children:[d?(0,a.jsx)("div",{className:"text-center py-5 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] animate-spin",children:"progress_activity"})}):c?(0,a.jsxs)("div",{className:"text-center py-5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] text-red-500",children:"error"}),(0,a.jsx)("p",{className:"mt-1.5 text-xs text-text-muted",children:c})]}):o?.message?(0,a.jsx)("div",{className:"text-center py-5",children:(0,a.jsx)("p",{className:"text-xs text-text-muted",children:o.message})}):(0,a.jsx)(k,{quotas:v,compact:!0,sortMode:"default",showSortLabel:"codex"===r.provider&&"default"!==eT,onHideQuota:e=>tl(r.provider,e)}),o?.message&&!c&&!d&&(0,a.jsx)("p",{className:"mt-2 px-1 text-[10px] leading-relaxed text-text-muted",children:o.message}),w.length>0&&(0,a.jsxs)("div",{className:"mt-2 flex min-w-0 items-center gap-1 border-t border-border pt-2 text-[10px] text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[14px] text-primary dark:text-primary",children:"visibility_off"}),(0,a.jsx)("span",{className:"shrink-0",children:"Hidden:"}),(0,a.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto whitespace-nowrap pb-2",children:w.map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>to(r.provider,e),className:"shrink-0 rounded-md border border-border bg-surface px-1.5 py-0.5 font-display transition-colors hover:bg-surface-2 hover:text-text-main",title:"Show this quota row",children:e.name},j(e)))})]})]})]},r.id)})}),(0,a.jsx)("div",{className:"rounded-xl border border-border bg-surface-2/50 px-3 py-2",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:tg}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(l.A,{value:tb?"custom":String(eV),onChange:e=>{if("custom"===e)return;let t=Number.parseInt(String(e),10);Number.isFinite(t)&&(eK(1),eG(t),eZ(String(t)))},options:[...u.map(e=>({value:String(e),label:`${e} / page`})),{value:"custom",label:"Custom"}],buttonClassName:"h-8 rounded-lg px-2 font-display text-xs font-medium",menuClassName:"w-40",align:"right"}),(0,a.jsx)("input",{type:"number",min:"1",max:String(500),inputMode:"numeric",value:eQ,onChange:e=>eZ(e.target.value),onBlur:()=>{let e=Number.parseInt(eQ,10);if(!Number.isFinite(e))return void eZ(String(eV));let t=Math.min(500,Math.max(1,e));eK(1),eG(t),eZ(String(t))},onKeyDown:e=>{if("Enter"!==e.key)return;let t=Number.parseInt(eQ,10);if(!Number.isFinite(t))return void eZ(String(eV));let r=Math.min(500,Math.max(1,t));eK(1),eG(r),eZ(String(r))},className:"h-8 w-20 rounded-lg border border-border bg-surface px-2 font-display text-xs font-medium text-text-main outline-none transition-colors hover:border-text-subtle hover:bg-surface-2","aria-label":"Custom accounts per page",placeholder:"Custom"}),(0,a.jsxs)("span",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:["Page ",eY.page," / ",eY.totalPages]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:()=>eK(1),disabled:eY.page<=1||eu||el,className:"flex h-8 items-center rounded-lg border border-border bg-surface px-3 font-display text-xs font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-40",children:"First Page"}),(0,a.jsx)("button",{type:"button",onClick:()=>eK(e=>Math.max(1,e-1)),disabled:eY.page<=1||eu||el,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border bg-surface font-display text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-40","aria-label":"Previous accounts page",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_left"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eK(e=>Math.min(eY.totalPages,e+1)),disabled:eY.page>=eY.totalPages||eu||el,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border bg-surface font-display text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-40","aria-label":"Next accounts page",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_right"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eK(eY.totalPages),disabled:eY.page>=eY.totalPages||eu||el,className:"flex h-8 items-center rounded-lg border border-border bg-surface px-3 font-display text-xs font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-40",children:"Last Page"})]})]})}),(0,a.jsx)($.uo,{isOpen:!!ey,onClose:()=>{eb||ev(null)},onConfirm:async()=>{let e=ey?.connection;e&&(await e9(e.id,e.provider),ev(null))},title:ey?.connection?.provider==="claude"?"Reset Claude limits?":"Reset Codex limit?",message:ey?.connection?.provider==="claude"?`Refills your ${F(B[ey.connection.id]?.raw?.resetCredits?.clears)} now for ${p(ey.connection)||"this account"} \xb7 your weekly reset day stays ${U(B[ey.connection.id]?.raw?.resetCredits?.weeklyResetsAt)}. This cannot be undone. Resets left: ${ey.resetCreditCount??0}.`:`Use 1 Codex reset credit for ${p(ey?.connection||{})||"this account"}. This cannot be undone. Remaining credits: ${ey?.resetCreditCount??0}.`,confirmText:"Reset limit",cancelText:"Cancel",variant:"danger",loading:!!eb}),ew&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-4 backdrop-blur-sm",children:(0,a.jsxs)("div",{className:"w-full max-w-2xl overflow-hidden rounded-2xl border border-black/15 bg-white shadow-2xl ring-1 ring-black/10 dark:border-white/15 dark:bg-neutral-950 dark:ring-white/10",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3 border-b border-black/10 bg-black/[0.03] px-4 py-3 dark:border-white/10 dark:bg-white/[0.04]",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-base font-semibold text-text-primary",children:ew.data?.kind==="claude"?"Claude Code Limit Resets":"Codex Reset Credit Expiry"}),(0,a.jsx)("p",{className:"mt-0.5 truncate text-xs text-text-muted",children:p(ew.connection)||(ew.data?.kind==="claude"?"Claude account":"Codex account")})]}),(0,a.jsx)("button",{type:"button",onClick:()=>ej(null),className:"flex h-8 w-8 items-center justify-center rounded-lg text-text-muted transition-colors hover:bg-black/5 hover:text-text-primary dark:hover:bg-white/5","aria-label":"Close reset credit expiry modal",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),(0,a.jsx)("div",{className:"max-h-[70vh] overflow-auto bg-white p-4 dark:bg-neutral-950",children:ew.loading?(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 py-10 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px]",children:"progress_activity"}),"Loading reset credits..."]}):ew.error?(0,a.jsx)("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-600 dark:text-red-300",children:ew.error}):ew.data?.kind==="claude"&&ew.data.grants?.length?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("span",{children:[ew.data.availableCount??0," reset",1===ew.data.availableCount?"":"s"," left"]}),(0,a.jsxs)("span",{children:["Weekly reset day: ",U(ew.data.weeklyResetsAt)]})]}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-xl border border-black/10 dark:border-white/10",children:(0,a.jsxs)("table",{className:"w-full min-w-[560px] text-left text-sm",children:[(0,a.jsx)("thead",{className:"bg-black/[0.03] text-xs uppercase tracking-wide text-text-muted dark:bg-white/[0.04]",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Reset"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Left"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Refills"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Use By"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Remaining"})]})}),(0,a.jsx)("tbody",{children:(ew.data.grants||[]).map(e=>(0,a.jsxs)("tr",{className:"border-t border-black/5 dark:border-white/5",children:[(0,a.jsxs)("td",{className:"px-3 py-2",children:[(0,a.jsx)("div",{className:"text-text-primary",children:e.label||e.id}),(0,a.jsx)("span",{className:"mt-1 inline-block rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:e.resetsLeft<=0?"used":e.paused?"paused":e.endsAt&&new Date(e.endsAt).getTime()<=Date.now()?"expired":e.usableNow?"usable now":e.startsAt&&new Date(e.startsAt).getTime()>Date.now()?"not started":e.useRequiresLimit?"at limit only":"unavailable"})]}),(0,a.jsxs)("td",{className:"whitespace-nowrap px-3 py-2 font-medium tabular-nums text-text-primary",children:[e.resetsLeft," / ",e.resetsTotal]}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-muted",children:F(e.clears)}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-primary",children:U(e.endsAt)}),(0,a.jsx)("td",{className:"whitespace-nowrap px-3 py-2 font-medium text-text-primary",children:R(e.endsAt)})]},e.id))})]})})]}):ew.data?.credits?.length?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("span",{children:[ew.data.credits.length," reset credit",1===ew.data.credits.length?"":"s"]}),(0,a.jsxs)("span",{children:[ew.data.availableCount??0," available"]})]}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-xl border border-black/10 dark:border-white/10",children:(0,a.jsxs)("table",{className:"w-full min-w-[560px] text-left text-sm",children:[(0,a.jsx)("thead",{className:"bg-black/[0.03] text-xs uppercase tracking-wide text-text-muted dark:bg-white/[0.04]",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Status"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Granted At"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Expires At"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Remaining"})]})}),(0,a.jsx)("tbody",{children:ew.data.credits.map((e,t)=>(0,a.jsxs)("tr",{className:"border-t border-black/5 dark:border-white/5",children:[(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsx)("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:e.status||"unknown"})}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-muted",children:U(e.grantedAt)}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-primary",children:U(e.expiresAt)}),(0,a.jsx)("td",{className:"px-3 py-2 font-medium text-text-primary",children:R(e.expiresAt)})]},`${e.status}-${e.expiresAt||t}`))})]})})]}):(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-8 text-center text-sm text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:ew.data?.kind==="claude"?"No limit resets available for this account.":"No reset credit details returned for this account."})})]})}),(0,a.jsx)($.wI,{isOpen:eN,connection:eC,proxyPools:eA,onSave:ta,onClose:()=>{ek(!1),eS(null)}}),et&&(0,a.jsx)(P.A,{isOpen:!!et,onClose:()=>er(null),connection:et,reactive:X[et.provider]?.connections?.[et.id]===!0,schedule:X[et.provider]?.schedules?.[et.id]||null,onSave:e=>tn(et.id,et.provider,e)})]}):(0,a.jsx)(A.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-primary dark:text-primary",children:th.icon}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:th.title}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:th.description})]})}):(0,a.jsx)(A.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-primary dark:text-primary",children:"cloud_off"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:"No Providers Connected"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})})}},93195:(e,t,r)=>{"use strict";function a(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}r.d(t,{JW:()=>o,Vm:()=>a,fB:()=>n,gy:()=>s,nz:()=>i});let s={anchor:"09:30",timezone:a(),windowHours:5,slotsPerDay:3};function n(e){let t=/^(\d{1,2}):(\d{2})$/.exec(String(e||"").trim());if(!t)return null;let r=Number(t[1]),a=Number(t[2]);return r>23||a>59?null:{hour:r,minute:a}}function i(e){return Math.max(1,Math.floor(24/e))}function l(e,t,r,a){let s="number"==typeof e?e:Number(e);return Number.isFinite(s)?Math.min(a,Math.max(r,s)):t}function o(e){let t=function(e){if(!e||!0!==e.enabled)return null;let t=n(e.anchor)||n(s.anchor),r=`${String(t.hour).padStart(2,"0")}:${String(t.minute).padStart(2,"0")}`,a=!function(e){if(!e||"string"!=typeof e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}(e.timezone)?s.timezone:e.timezone,o=l(e.windowHours,s.windowHours,.5,24),d=Math.round(l(e.slotsPerDay,s.slotsPerDay,1,i(o)));return{enabled:!0,anchor:r,timezone:a,windowHours:o,slotsPerDay:d}}(e);if(!t)return[];let{hour:r,minute:a}=n(t.anchor),o=60*r+a;return Array.from({length:t.slotsPerDay},(e,r)=>{let a=Math.round(o+r*t.windowHours*60)%1440;return`${String(Math.floor(a/60)).padStart(2,"0")}:${String(a%60).padStart(2,"0")}`})}},97132:(e,t,r)=>{"use strict";r.d(t,{A:()=>u});var a=r(95155),s=r(12115),n=r(14051),i=r.n(n),l=r(35497),o=r(31474),d=r(93195);let c=[{value:"off",label:"Off",icon:"block"},{value:"reset",label:"On reset",icon:"bolt"},{value:"schedule",label:"Schedule",icon:"schedule"}];function u({isOpen:e,onClose:t,onSave:r,connection:n,reactive:i=!1,schedule:m=null}){let[x,p]=(0,s.useState)(()=>({mode:m?.enabled===!0?"schedule":!0===i?"reset":"off",anchor:m?.anchor||d.gy.anchor,timezone:(0,d.Vm)(),windowHours:String(m?.windowHours??d.gy.windowHours),slotsPerDay:String(m?.slotsPerDay??d.gy.slotsPerDay)})),h=Number(x.windowHours),g=Number(x.slotsPerDay),b=!!(0,d.fB)(x.anchor),f=Number.isFinite(h)&&h>=.5&&h<=24,y=f?(0,d.nz)(h):24,v=Number.isInteger(g)&&g>=1&&g<=y,w=b&&f&&v,j="schedule"!==x.mode||w,N=w?(0,d.JW)({enabled:!0,...x,windowHours:h,slotsPerDay:g}):[],k=N.length&&f?(()=>{let{hour:e,minute:t}=(0,d.fB)(x.anchor),r=Math.round(60*e+t+g*h*60)%1440;return`${String(Math.floor(r/60)).padStart(2,"0")}:${String(r%60).padStart(2,"0")}`})():"",C=e=>p(t=>({...t,...e}));return(0,a.jsx)(l.aF,{isOpen:e,onClose:t,title:"Auto-ping settings",size:"lg",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.$n,{variant:"secondary",onClick:t,children:"Cancel"}),(0,a.jsx)(l.$n,{onClick:()=>{j&&(r({reactive:"reset"===x.mode,schedule:"schedule"===x.mode?{enabled:!0,anchor:x.anchor,timezone:x.timezone,windowHours:h,slotsPerDay:g}:{enabled:!1}}),t())},disabled:!j,children:"Save"})]}),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Configure automated quota pings",n?.name?` for ${n.name}`:""," - pick one mode."]}),(0,a.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-[10px] bg-surface-2 p-1",children:c.map(e=>{let t=x.mode===e.value;return(0,a.jsxs)("button",{type:"button",onClick:()=>C({mode:e.value}),className:(0,o.cn)("flex h-9 items-center justify-center gap-1.5 rounded-[8px] px-3 text-sm font-medium transition-all",t?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[15px] leading-none",children:e.icon}),(0,a.jsx)("span",{children:e.label})]},e.value)})}),"reset"===x.mode&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Pings right after the 5h quota window resets, so a new window starts immediately."}),"schedule"===x.mode&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Pings at fixed local times so the 5h windows align with your workday."}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[(0,a.jsx)(l.pd,{label:"Anchor time",type:"time",value:x.anchor,onChange:e=>C({anchor:e.target.value}),error:b?"":"Use HH:MM",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,a.jsx)(l.pd,{label:"Window (hours)",type:"number",min:"0.5",max:"24",step:"0.5",value:x.windowHours,onChange:e=>C({windowHours:e.target.value}),error:f?"":"0.5 – 24",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,a.jsx)(l.pd,{label:"Pings per day",type:"number",min:"1",max:String(y),step:"1",value:x.slotsPerDay,onChange:e=>C({slotsPerDay:e.target.value}),error:v?"":`1 – ${y}`,hint:v?`Max ${y}`:"",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"})]}),N.length>0&&(0,a.jsxs)("div",{className:"rounded-[10px] bg-surface-2 px-3 py-2.5",children:[(0,a.jsxs)("p",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:["Daily slots (",x.timezone,")"]}),(0,a.jsx)("p",{className:"mt-1 text-sm font-medium text-text-main",children:N.join(" → ")}),(0,a.jsxs)("p",{className:"mt-1 text-xs text-text-muted",children:["Covers ",N[0]," – ",k,", then pauses until ",N[0]," next day."]})]})]})]})})}u.propTypes={isOpen:i().bool.isRequired,onClose:i().func.isRequired,onSave:i().func.isRequired,connection:i().object,reactive:i().bool,schedule:i().object}}},e=>{e.O(0,[763,2470,705,3557,5497,8441,3794,7358],()=>e(e.s=56804)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9516],{64082:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>p});var i=r(95155),s=r(35497),n=r(11059);let a="keyzakyy-dev/keyrouter",o=`https://github.com/${a}`,d=`https://raw.githubusercontent.com/${a}/refs/heads/master/skills`,c=[{id:"keyrouter",name:"KeyRouter",description:"Setup guide + index of all capabilities. Start here.",endpoint:null,icon:"hub",isEntry:!0},{id:"keyrouter-chat",name:"Chat",description:"Chat & code generation via OpenAI or Anthropic formats, with streaming.",endpoint:"/v1/chat/completions",icon:"chat"},{id:"keyrouter-image",name:"Image Generation",description:"Text-to-image via DALL‑E, Imagen, FLUX, MiniMax, SD WebUI.",endpoint:"/v1/images/generations",icon:"image"},{id:"keyrouter-tts",name:"Text-to-Speech",description:"Speech synthesis via OpenAI, ElevenLabs, Edge, Google, or Deepgram.",endpoint:"/v1/audio/speech",icon:"record_voice_over"},{id:"keyrouter-stt",name:"Speech-to-Text",description:"Transcription via Whisper, Groq, Gemini, Deepgram, or AssemblyAI.",endpoint:"/v1/audio/transcriptions",icon:"mic"},{id:"keyrouter-embeddings",name:"Embeddings",description:"Embeddings for RAG & semantic search via OpenAI, Gemini, or Mistral.",endpoint:"/v1/embeddings",icon:"scatter_plot"},{id:"keyrouter-web-search",name:"Web Search",description:"Web & X search via Tavily, Exa, Brave, Serper, SearXNG, or PSE.",endpoint:"/v1/search",icon:"search"},{id:"keyrouter-web-fetch",name:"Web Fetch",description:"URL → markdown / text / HTML via Firecrawl, Jina, Tavily, or Exa.",endpoint:"/v1/web/fetch",icon:"language"}];function l(e){return`${d}/${e}/SKILL.md`}function x({value:e,label:t="Copy"}){let{copied:r,copy:s}=(0,n.C)(2e3);return(0,i.jsxs)("button",{onClick:()=>s(e),className:`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2.5 font-display text-[11px] font-semibold transition-colors cursor-pointer ${r?"bg-success/15 text-success":"bg-surface-2 text-text-main hover:bg-surface-3"}`,title:e,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:r?"check":"content_copy"}),r?"Copied!":t]})}function m({skill:e}){let t=l(e.id);return(0,i.jsxs)("div",{className:`flex items-start gap-3 p-4 rounded-xl border transition-colors ${e.isEntry?"border-border bg-surface-2/50":"border-border-subtle bg-surface hover:bg-surface-2/60"}`,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[22px] shrink-0 text-primary dark:text-primary",children:e.icon}),(0,i.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,i.jsx)("h3",{className:"truncate font-display text-sm font-medium text-text-main",children:e.name}),(0,i.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[e.isEntry&&(0,i.jsx)("span",{className:"rounded-full border border-border bg-surface-2 px-2 py-0.5 font-mono text-[10px] uppercase tracking-wider text-text-muted",children:"START HERE"}),e.endpoint&&(0,i.jsx)("span",{className:"rounded-full border border-border bg-surface-2 px-2 py-0.5 font-mono text-[10px] uppercase tracking-wider text-text-muted",children:(0,i.jsx)("code",{className:"text-[10px]",children:e.endpoint})})]}),(0,i.jsx)("p",{className:"mt-1 text-xs text-text-muted line-clamp-2",children:e.description})]}),(0,i.jsx)(x,{value:t})]})}function p(){return(0,i.jsxs)("div",{className:"space-y-6",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-main",children:"Skills"}),(0,i.jsx)("p",{className:"mt-1 font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"Copy-paste agent skills for KeyRouter"})]}),(0,i.jsxs)(s.Zp,{padding:"md",children:[(0,i.jsx)("div",{className:"mb-2 font-mono text-[11px] uppercase tracking-wider text-text-subtle",children:"Paste into your AI"}),(0,i.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2 font-mono text-[12px] text-text-main",children:["Read this skill and use it: ",l("keyrouter")]})]}),(0,i.jsx)("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-2",children:c.map(e=>(0,i.jsx)(m,{skill:e},e.id))}),(0,i.jsx)(s.Zp,{padding:"md",children:(0,i.jsxs)("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("svg",{viewBox:"0 0 16 16",width:"20",height:"20",fill:"currentColor",className:"shrink-0 text-primary dark:text-primary","aria-hidden":"true",children:(0,i.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-.27.68 0 1.36.09 2 .27 1.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"})}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"font-display text-base font-semibold text-text-main",children:"More on GitHub"}),(0,i.jsx)("p",{className:"mt-0.5 text-xs text-text-muted",children:"Browse the source, README, and examples for every skill."})]})]}),(0,i.jsxs)("a",{href:`${o}/tree/master/skills`,target:"_blank",rel:"noreferrer",className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-border bg-surface-2 px-3 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-3",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary dark:text-primary",children:"open_in_new"}),"View on GitHub"]})]})})]})}},96796:(e,t,r)=>{Promise.resolve().then(r.bind(r,64082))}},e=>{e.O(0,[763,2470,705,3557,5497,8441,3794,7358],()=>e(e.s=96796)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9839],{15536:(e,t,s)=>{"use strict";s.d(t,{Cp:()=>n,Hx:()=>r,Iv:()=>d,Nv:()=>m,RL:()=>c,ev:()=>x,fl:()=>i,hT:()=>a,oX:()=>l,t6:()=>o});let a=["zh-CN","zh-TW"],l=[{icon:"public",title:"Access Anywhere",desc:"Use your API from any network"},{icon:"group",title:"Share Endpoint",desc:"Share URL with team members"},{icon:"code",title:"Use in Cursor/Cline",desc:"Connect AI tools remotely"},{icon:"lock",title:"Encrypted",desc:"End-to-end TLS via Cloudflare"}],r=2e3,n=3e5,i=5e3,o=5,c=1e4,d=5e3,x=[{id:"lite",label:"Lite",desc:"Drop filler, keep grammar"},{id:"full",label:"Full",desc:"Drop articles, fragments OK"},{id:"ultra",label:"Ultra",desc:"Telegraphic, max compression"},{id:"wenyan-lite",label:"文 Lite",desc:"Classical Chinese, light compression",wenyan:!0},{id:"wenyan",label:"文 Full",desc:"Maximum 文言文, 80-90% reduction",wenyan:!0},{id:"wenyan-ultra",label:"文 Ultra",desc:"Extreme classical compression",wenyan:!0}],m=[{id:"lite",label:"Lite",desc:"Build asked, name lazier option"},{id:"full",label:"Full",desc:"Ladder enforced: stdlib/native first"},{id:"ultra",label:"Ultra",desc:"YAGNI extremist, deletion first"}]},61203:(e,t,s)=>{"use strict";s.d(t,{default:()=>c});var a=s(95155),l=s(12115),r=s(35497),n=s(11059),i=s(73006),o=s(15536);function c(){let[e,t]=(0,l.useState)(!0),[s,c]=(0,l.useState)(!1),[d,x]=(0,l.useState)("http://localhost:8787"),[m,h]=(0,l.useState)(3e3),[p,u]=(0,l.useState)({installed:!1,running:!1,python:null,loading:!0}),[f,g]=(0,l.useState)(!1),[b,j]=(0,l.useState)(!1),[y,v]=(0,l.useState)(""),[N,k]=(0,l.useState)({version:null,extras:{code:!1,ml:!1},available:["code","ml"],loading:!1}),[w,C]=(0,l.useState)([]),[S,E]=(0,l.useState)(!1),[T,P]=(0,l.useState)(""),[R,I]=(0,l.useState)(null),[$,L]=(0,l.useState)(""),[M,O]=(0,l.useState)(null),[U,H]=(0,l.useState)(!1),[A,_]=(0,l.useState)(!0),[D,F]=(0,l.useState)(!1),B=(0,l.useRef)(null),[J,K]=(0,l.useState)(!1),[W,G]=(0,l.useState)("full"),[z,X]=(0,l.useState)(!1),[q,Z]=(0,l.useState)("full"),[Y,Q]=(0,l.useState)(!1),[V,ee]=(0,l.useState)(25e3),[et,es]=(0,l.useState)({installed:!1,installing:!1,running:!1,version:null,loading:!0}),[ea,el]=(0,l.useState)(null),[er,en]=(0,l.useState)(!1),[ei,eo]=(0,l.useState)(!1),[ec,ed]=(0,l.useState)(""),[ex,em]=(0,l.useState)("en"),{copied:eh,copy:ep}=(0,n.C)();(0,l.useEffect)(()=>(em((0,i.kk)()),(0,i.oQ)(()=>em((0,i.kk)()))),[]);let eu=o.hT.includes(ex),ef=eu?o.ev:o.ev.filter(e=>!e.wenyan);(0,l.useEffect)(()=>{let e=o.ev.find(e=>e.id===W);e?.wenyan&&!eu&&(G("ultra"),eg({cavemanLevel:"ultra"}))},[eu,W]);let eg=async e=>{try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(e){console.log("Error updating setting:",e)}},eb=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({rtkEnabled:e})})).ok&&t(e)}catch(e){console.log("Error updating rtkEnabled:",e)}},ej=async()=>{let e=d.trim()||"http://localhost:8787";x(e),await eg({headroomUrl:e}),ey()},ey=(0,l.useCallback)(async()=>{u(e=>({...e,loading:!0}));try{let e=await fetch("/api/headroom/status",{headers:{"Cache-Control":"no-store"}}),t=await e.json();if(u({...t,loading:!1}),!t?.installed){k({version:null,extras:{code:!1,ml:!1},available:["code","ml"],loading:!1}),C([]);return}try{let e=await fetch("/api/headroom/extras",{headers:{"Cache-Control":"no-store"}});if(!e.ok)throw Error("extras status failed");let t=await e.json();k(e=>({...e,version:t.version??null,extras:t.extras||{code:!1,ml:!1},available:t.available||["code","ml"],loading:!1})),C([])}catch{k({version:null,extras:{code:!1,ml:!1},available:["code","ml"],loading:!1}),C([])}}catch{u({installed:!1,running:!1,python:null,loading:!1}),k({version:null,extras:{code:!1,ml:!1},available:["code","ml"],loading:!1}),C([])}},[]),ev=(0,l.useCallback)(async()=>{v(""),j(!0);try{let e=await fetch("/api/headroom/start",{method:"POST"}),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error||"Failed to start proxy");await ey()}catch(e){v(e.message)}finally{j(!1)}},[ey]),eN=(0,l.useCallback)(async()=>{j(!0);try{await fetch("/api/headroom/stop",{method:"POST"}),await ey()}finally{j(!1)}},[ey]),ek=(0,l.useCallback)(()=>{L(""),B.current&&clearInterval(B.current);let e=async()=>{try{let e=await fetch("/api/headroom/extras?log=1",{headers:{"Cache-Control":"no-store"}}),t=await e.json().catch(()=>({}));"string"==typeof t.log&&L(t.log)}catch{}};e(),B.current=setInterval(e,1500)},[]),ew=(0,l.useCallback)(()=>{B.current&&(clearInterval(B.current),B.current=null)},[]);(0,l.useEffect)(()=>()=>ew(),[ew]);let eC=(0,l.useCallback)(async()=>{if(0!==w.length){E(!0),P(""),ek();try{let e=await fetch("/api/headroom/extras",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({extras:w})}),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error||"Install failed");k(e=>({...e,version:t.version??e.version,extras:t.extras||e.extras})),C([])}catch(e){P(e.message)}finally{ew(),E(!1)}}},[w,ek,ew]),eS=(0,l.useCallback)(async e=>{I(e),P(""),ek();try{let t=await fetch("/api/headroom/extras",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({extras:[e]})}),s=await t.json().catch(()=>({}));if(!t.ok)throw Error(s.error||"Remove failed");k(e=>({...e,version:s.version??e.version,extras:s.extras||e.extras}))}catch(e){P(e.message)}finally{ew(),I(null)}},[ek,ew]),eE=(0,l.useCallback)(()=>{if(0!==w.length){if(w.includes("ml"))return void O({title:"Install [ml]",message:"[ml] downloads ~1 GB (torch + huggingface-hub). Continue?",confirmText:"Install",variant:"primary",onConfirm:eC});eC()}},[w,eC]),eT=(0,l.useCallback)(e=>{O({title:`Remove [${e}]`,message:`Remove [${e}] and its packages?`,confirmText:"Remove",variant:"danger",onConfirm:()=>eS(e)})},[eS]),eP=(0,l.useCallback)(async(e,t)=>{if(P(""),"code"===e&&H(t),"ml"===e&&_(t),await eg({["code"===e?"headroomCodeAware":"headroomKompress"]:t}),p.running){F(!0);try{let e=await fetch("/api/headroom/restart",{method:"POST"}),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error||"Restart failed");await ey()}catch(e){P(e.message)}finally{F(!1)}}},[p.running,ey]),eR=(0,l.useCallback)(async()=>{es(e=>({...e,loading:!0}));try{let e=await fetch("/api/pxpipe/status",{headers:{"Cache-Control":"no-store"}}),t=await e.json();es({...t,loading:!1}),"number"==typeof t.minChars&&ee(t.minChars)}catch{es({installed:!1,installing:!1,running:!1,version:null,loading:!1})}},[]),eI=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/pxpipe/health",{method:"POST"});el(await e.json())}catch(e){el({healthy:!1,checks:[],error:e.message})}},[]),e$=(0,l.useCallback)(async e=>{ed(""),eo(!0);try{let t=await fetch(`/api/pxpipe/${e}`,{method:"POST"}),s=await t.json().catch(()=>({}));if(!t.ok)throw Error(s.error||`PXPIPE ${e} failed`);await eR(),await eI()}catch(e){ed(e.message)}finally{eo(!1)}},[eR,eI]);(0,l.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/settings");if(e.ok){let s=await e.json();t(!1!==s.rtkEnabled),c(!!s.headroomEnabled),x(s.headroomUrl||"http://localhost:8787"),"number"==typeof s.headroomTimeoutMs&&h(s.headroomTimeoutMs),H(!0===s.headroomCodeAware),_(!1!==s.headroomKompress),K(!!s.cavemanEnabled),G(s.cavemanLevel||"full"),X(!!s.ponytailEnabled),Z(s.ponytailLevel||"full"),Q(!!s.pxpipeEnabled),"number"==typeof s.pxpipeMinChars&&ee(s.pxpipeMinChars),ey(),eR().then(eI)}}catch{}})()},[ey,eR,eI]);let eL=!!p.running,eM=p.loading?"Checking…":eL?"Running":!1===p.localUrl||p.installed?!1!==p.localUrl?"Stopped":"External":"Not installed",eO=!1!==p.localUrl,eU=!!p.canStart,eH=eO&&!!p.managedPid,eA=ea?.healthy===!0,e_=et.loading?"Checking…":et.installing?"Installing…":et.installed?eA?"Healthy":et.running?"Running":"Stopped":"Not installed";return eA||et.running,(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(r.Zp,{className:"relative overflow-hidden",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3.5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[26px] shrink-0 text-primary dark:text-primary",children:"savings"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"font-display text-lg font-semibold text-text-main",children:"Token Saver"}),(0,a.jsx)("p",{className:"mt-0.5 font-display text-sm text-text-muted",children:"Reduce token spend by compressing prompts and model output"})]})]}),(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsx)("span",{className:"rounded-full bg-surface-2 px-3 py-1 text-[11px] font-medium text-text-muted",children:"RTK \xb7 Headroom \xb7 Caveman \xb7 Ponytail"})})]})}),(0,a.jsxs)("div",{className:"grid grid-cols-1 items-stretch gap-5 lg:grid-cols-2",children:[(0,a.jsxs)(r.Zp,{id:"rtk",className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[22px] shrink-0 text-primary dark:text-primary",children:"bolt"}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-display text-base font-semibold text-text-main",children:"RTK"}),(0,a.jsx)("a",{href:"https://github.com/rtk-ai/rtk",target:"_blank",rel:"noreferrer",className:"text-xs text-primary underline dark:text-text-main hover:opacity-80",children:"docs"})]}),(0,a.jsx)("p",{className:"font-mono text-xs uppercase text-text-subtle",children:"Tool output compressor"})]})]}),(0,a.jsx)(r.lM,{checked:e,onChange:()=>eb(!e)})]}),(0,a.jsx)("div",{className:"rounded-lg bg-bg-subtle p-3",children:(0,a.jsx)("p",{className:"font-display text-sm text-text-muted",children:"git/grep/ls/tree/logs → 60-90% fewer input tokens"})}),(0,a.jsx)("div",{className:"mt-auto flex flex-wrap items-center gap-2",children:(0,a.jsx)("span",{className:"rounded-md bg-success/10 px-2 py-0.5 text-[11px] font-medium text-success",children:"Compresses tool output"})})]}),(0,a.jsxs)(r.Zp,{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[22px] shrink-0 text-primary dark:text-primary",children:"compress"}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-display text-base font-semibold text-text-main",children:"Headroom"}),(0,a.jsx)("a",{href:"https://github.com/chopratejas/headroom",target:"_blank",rel:"noreferrer",className:"text-xs text-primary underline dark:text-text-main hover:opacity-80",children:"docs"})]}),(0,a.jsx)("p",{className:"font-mono text-xs uppercase text-text-subtle",children:"Context compressor"})]})]}),(0,a.jsx)(r.lM,{checked:s,onChange:()=>{var e;let t;return e=!s,void(x(t=d.trim()||"http://localhost:8787"),c(e),eg({headroomEnabled:e,headroomUrl:t}))}})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`rounded-md px-2 py-0.5 text-[11px] font-medium ${eL?"bg-success/15 text-success":"bg-warning/15 text-warning"}`,children:eM}),(0,a.jsx)("button",{type:"button",onClick:()=>g(!0),className:"text-xs text-primary underline dark:text-text-main hover:opacity-80",children:eL?"Manage":"Setup"})]}),(0,a.jsx)("div",{className:"rounded-lg bg-bg-subtle p-3",children:(0,a.jsx)("p",{className:"font-display text-sm text-text-muted",children:"Compress prompts via /v1/compress before routing to the model"})}),p.installed&&(0,a.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border p-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Compression extras",N.version?` \xb7 v${N.version}`:"",":"]}),N.available.map(e=>{let t=!!N.extras[e],s=w.includes(e),l="code"===e?"tree-sitter AST compression for code responses":"Kompress-v2 HF model for prose/agentic traces (~+1GB)";if(t){let t="code"===e?U:A;return(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs px-2 py-1 rounded border border-success/40 bg-success/5 text-text",title:l,children:[(0,a.jsx)(r.lM,{size:"sm",checked:t,disabled:D,onChange:()=>eP(e,!t)}),(0,a.jsxs)("span",{className:"font-medium",children:["[",e,"]"]}),(0,a.jsx)("button",{type:"button",onClick:()=>eT(e),disabled:R===e,className:"ml-1 text-error underline hover:opacity-80 disabled:opacity-50",title:`Uninstall [${e}]`,children:R===e?"Uninstalling…":"Uninstall"})]},e)}return(0,a.jsxs)("label",{className:`flex items-center gap-1.5 text-xs px-2 py-1 rounded border cursor-pointer transition-colors ${s?"border-primary bg-primary/10 text-primary dark:text-text-main":"border-border text-text-muted hover:bg-surface-2"}`,title:l,children:[(0,a.jsx)("input",{type:"checkbox",className:"w-3 h-3",checked:s,onChange:()=>{C(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}}),(0,a.jsxs)("span",{className:"font-medium",children:["[",e,"]"]}),(0,a.jsx)("span",{className:"opacity-70",children:"not installed"})]},e)}),w.length>0&&(0,a.jsx)("button",{onClick:eE,disabled:S,className:"text-xs px-2.5 py-1 rounded bg-primary text-white dark:text-amber-950 hover:opacity-90 disabled:opacity-50",children:S?"Installing…":`Install [proxy,${w.join(",")}]`})]}),T&&(0,a.jsx)("p",{className:"text-xs text-error",children:T}),D&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Restarting proxy…"}),(S||R)&&$&&(0,a.jsx)("pre",{className:"max-h-32 overflow-auto rounded bg-surface-2 p-2 text-[10px] leading-tight text-text-muted whitespace-pre-wrap",children:$}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Installing adds the package; use ",(0,a.jsx)("code",{children:"on"}),"/",(0,a.jsx)("code",{children:"off"})," ","to activate it (restarts the proxy). Default install is"," ",(0,a.jsx)("code",{children:"[proxy]"})," only (SmartCrusher for JSON). Adding"," ",(0,a.jsx)("code",{children:"[code]"})," enables AST compression (Python/JS/TS/Go/Rust/Java/C/C++/Perl). Adding ",(0,a.jsx)("code",{children:"[ml]"})," ","enables the Kompress-v2 HF model for prose/agentic traces but adds ~1 GB (torch + huggingface-hub)."]})]})]}),(0,a.jsxs)(r.Zp,{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[22px] shrink-0 text-primary dark:text-primary",children:"format_quote"}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-display text-base font-semibold text-text-main",children:"Caveman"}),(0,a.jsx)("a",{href:"https://github.com/JuliusBrussee/caveman",target:"_blank",rel:"noreferrer",className:"text-xs text-primary underline dark:text-text-main hover:opacity-80",children:"docs"})]}),(0,a.jsx)("p",{className:"font-mono text-xs uppercase text-text-subtle",children:"LLM output compressor"})]})]}),(0,a.jsx)(r.lM,{checked:J,onChange:()=>{var e;K(e=!J),eg({cavemanEnabled:e})}})]}),(0,a.jsx)("div",{className:"rounded-lg bg-bg-subtle p-3",children:(0,a.jsx)("p",{className:"font-display text-sm text-text-muted",children:"Terse-style system prompt → ~65% fewer output tokens (up to 87%)"})}),J&&(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:ef.map(e=>(0,a.jsx)("button",{onClick:()=>{var t;G(t=e.id),eg({cavemanLevel:t})},className:`px-3 py-1.5 rounded text-xs font-medium border transition-colors ${W===e.id?"bg-primary text-white dark:text-amber-950 border-primary":"bg-transparent border-border text-text-muted hover:bg-surface-2"}`,title:e.desc,children:e.label},e.id))}),(0,a.jsx)("p",{className:"text-xs text-primary dark:text-text-main",children:o.ev.find(e=>e.id===W)?.desc})]})]}),(0,a.jsxs)(r.Zp,{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[22px] shrink-0 text-primary dark:text-primary",children:"content_cut"}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-display text-base font-semibold text-text-main",children:"Ponytail"}),(0,a.jsx)("a",{href:"https://github.com/DietrichGebert/ponytail",target:"_blank",rel:"noreferrer",className:"text-xs text-primary underline dark:text-text-main hover:opacity-80",children:"docs"})]}),(0,a.jsx)("p",{className:"font-mono text-xs uppercase text-text-subtle",children:"Minimal-code bias"})]})]}),(0,a.jsx)(r.lM,{checked:z,onChange:()=>{var e;X(e=!z),eg({ponytailEnabled:e})}})]}),(0,a.jsx)("div",{className:"rounded-lg bg-bg-subtle p-3",children:(0,a.jsx)("p",{className:"font-display text-sm text-text-muted",children:"Bias the model toward minimal code: YAGNI, reuse stdlib, deletion over addition"})}),z&&(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:o.Nv.map(e=>(0,a.jsx)("button",{onClick:()=>{var t;Z(t=e.id),eg({ponytailLevel:t})},className:`px-3 py-1.5 rounded text-xs font-medium border transition-colors ${q===e.id?"bg-primary text-white dark:text-amber-950 border-primary":"bg-transparent border-border text-text-muted hover:bg-surface-2"}`,title:e.desc,children:e.label},e.id))}),(0,a.jsx)("p",{className:"text-xs text-primary dark:text-text-main",children:o.Nv.find(e=>e.id===q)?.desc})]})]})]}),(0,a.jsx)(r.aF,{isOpen:f,title:eL?"Headroom":"Setup Headroom",onClose:()=>g(!1),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,a.jsx)("span",{children:"Status"}),(0,a.jsx)("span",{className:eL?"text-success":"text-warning",children:eM})]}),eL&&(0,a.jsx)("a",{href:"/api/headroom/proxy/dashboard",target:"_blank",rel:"noreferrer",className:"w-full rounded border border-border px-4 py-2 text-center text-sm hover:bg-surface-2",children:"Open Headroom Dashboard"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Proxy URL"}),(0,a.jsx)(r.pd,{value:d,onChange:e=>x(e.target.value),onBlur:ej,placeholder:"http://localhost:8787",className:"font-mono text-sm"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Use a local proxy for Start/Stop, or an external Docker sidecar like http://headroom:8787."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Timeout (ms)"}),(0,a.jsx)(r.pd,{value:String(m),onChange:e=>h(e.target.value),onBlur:()=>{let e=Math.round(Number(m)),t=Number.isFinite(e)&&e>0?e:3e3;h(t),eg({headroomTimeoutMs:t})},placeholder:"3000",className:"font-mono text-sm"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Request timeout in milliseconds. Defaults to 3000 ms."})]}),eH?(0,a.jsx)(r.$n,{onClick:eN,variant:"ghost",fullWidth:!0,disabled:b,children:b?"Stopping…":"Stop Headroom"}):eL?(0,a.jsx)("p",{className:"text-sm text-success",children:"Headroom proxy is reachable. You can enable the token saver."}):eU?(0,a.jsx)(r.$n,{onClick:ev,fullWidth:!0,disabled:b,children:b?"Starting…":"Start Headroom"}):eO?p.python?(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Install then click Start:"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("pre",{className:"flex-1 rounded bg-black/5 dark:bg-white/5 p-2 text-xs font-mono overflow-x-auto",children:'pip install "headroom-ai[proxy]"'}),(0,a.jsx)(r.$n,{size:"sm",variant:"ghost",onClick:()=>ep('pip install "headroom-ai[proxy]"'),children:eh?"Copied":"Copy"})]})]}):(0,a.jsx)("p",{className:"text-sm text-warning",children:"Python ≥ 3.10 required for local managed mode. Install Python first, or use an external proxy URL."}):(0,a.jsx)("p",{className:"text-sm text-warning",children:"Start Headroom separately at the configured URL, then recheck."}),y&&(0,a.jsx)("p",{className:"text-sm text-warning",children:y}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(r.$n,{onClick:()=>ey(),variant:"ghost",fullWidth:!0,children:"Recheck"}),(0,a.jsx)(r.$n,{onClick:()=>g(!1),fullWidth:!0,children:"Done"})]})]})}),(0,a.jsx)(r.aF,{isOpen:!1,title:et.installed?"PXPIPE":"Setup PXPIPE",onClose:()=>en(!1),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"font-display text-sm text-text-muted",children:"Compress prompts using multimodal encoding. Runs in-process - no extra server or environment variables required."}),(0,a.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,a.jsx)("span",{children:"Status"}),(0,a.jsxs)("span",{className:eA||et.running?"text-success":"text-warning",children:[e_,et.version?` \xb7 v${et.version}`:""]})]}),ea?.checks?.length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-1 rounded border border-border p-3",children:[(0,a.jsx)("p",{className:"text-sm font-medium mb-1",children:"Health check"}),ea.checks.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,a.jsxs)("span",{className:e.ok?"text-success":"text-warning",children:[e.ok?"●":"○"," ",e.label]}),e.detail&&(0,a.jsx)("span",{className:"text-text-muted font-mono truncate max-w-[50%]",children:e.detail})]},e.id)),ea.error&&(0,a.jsx)("p",{className:"text-xs text-warning mt-1",children:ea.error})]}),et.installed?(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[et.running?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.$n,{onClick:()=>e$("restart"),variant:"ghost",disabled:ei,children:"Restart"}),(0,a.jsx)(r.$n,{onClick:()=>e$("stop"),variant:"ghost",disabled:ei,children:"Stop"})]}):(0,a.jsx)(r.$n,{onClick:()=>e$("start"),disabled:ei,children:ei?"Starting…":"Start"}),(0,a.jsx)(r.$n,{onClick:()=>e$("install"),variant:"ghost",disabled:ei,children:"Repair"}),(0,a.jsx)("a",{href:"/dashboard/pxpipe#logs",className:"col-span-2 rounded border border-border px-4 py-2 text-center text-sm hover:bg-surface-2",children:"Open Logs"})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("p",{className:"text-sm text-warning",children:"PXPIPE is not installed."}),(0,a.jsx)(r.$n,{onClick:()=>e$("install"),fullWidth:!0,disabled:ei||et.installing,children:ei||et.installing?"Installing…":"Install"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Installs the npm package ",(0,a.jsx)("code",{className:"font-mono",children:"pxpipe-proxy"})," into the KeyRouter data directory. May take a few minutes."]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Minimum prompt size (chars)"}),(0,a.jsx)(r.pd,{value:String(V),onChange:e=>ee(e.target.value),onBlur:()=>{let e=Math.max(0,Number(V)||25e3);ee(e),eg({pxpipeMinChars:e})},placeholder:"25000",className:"font-mono text-sm"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Requests smaller than this bypass PXPIPE and are sent as-is."})]}),ec&&(0,a.jsx)("p",{className:"text-sm text-warning",children:ec}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(r.$n,{onClick:()=>eR().then(eI),variant:"ghost",fullWidth:!0,children:"Recheck"}),(0,a.jsx)(r.$n,{onClick:()=>en(!1),fullWidth:!0,children:"Done"})]})]})}),(0,a.jsx)(r.uo,{isOpen:!!M,onClose:()=>O(null),onConfirm:()=>{let e=M?.onConfirm;O(null),e?.()},title:M?.title,message:M?.message,confirmText:M?.confirmText,variant:M?.variant})]})}},73288:(e,t,s)=>{Promise.resolve().then(s.bind(s,61203))}},e=>{e.O(0,[763,2470,705,3557,5497,8441,3794,7358],()=>e(e.s=73288)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2825],{16797:(e,t,s)=>{Promise.resolve().then(s.bind(s,81772))},81772:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>S});var a=s(95155),n=s(12115),l=s(73321),i=s(35497),r=s(6808),o=s(84588),d=s(92542),x=s(31474);function c({isOpen:e,onClose:t,title:s,children:l,width:i="md",className:r}){let o={sm:"w-[400px]",md:"w-[500px]",lg:"w-[600px]",xl:"w-[800px]",full:"w-full"};return((0,n.useEffect)(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),(0,n.useEffect)(()=>{let s=s=>{"Escape"===s.key&&e&&t()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),e)?(0,a.jsxs)("div",{className:"fixed inset-0 z-50",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in cursor-pointer",onClick:t,"aria-hidden":"true"}),(0,a.jsxs)("div",{className:(0,x.cn)("absolute right-0 top-0 h-full bg-surface flex flex-col","shadow-[var(--shadow-elev)]","slide-in-right","border-l border-border-subtle",o[i]||o.md,r),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-border-subtle flex-shrink-0",children:[(0,a.jsx)("div",{className:"flex items-center gap-3",children:s&&(0,a.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:s})}),(0,a.jsx)("button",{type:"button",onClick:t,className:"p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto p-6 custom-scrollbar",children:l})]})]}):null}var m=s(39403);function p({currentPage:e,pageSize:t,totalItems:s,onPageChange:n,onPageSizeChange:l,className:i}){let r=Math.ceil(s/t),o=s>0?(e-1)*t+1:0,c=Math.min(e*t,s),u=(()=>{let t=[],s=Math.max(1,e-2),a=Math.min(r,s+5-1);a-s+1<5&&(s=Math.max(1,a-5+1));for(let e=s;e<=a;e++)t.push(e);return t})();return(0,a.jsxs)("div",{className:(0,x.cn)("flex flex-col sm:flex-row items-center justify-between gap-4 py-4 px-2",i),children:[s>0&&(0,a.jsxs)("div",{className:"text-sm text-text-muted",children:["Showing ",(0,a.jsx)("span",{className:"font-medium text-text-main",children:o})," to"," ",(0,a.jsx)("span",{className:"font-medium text-text-main",children:c})," of"," ",(0,a.jsx)("span",{className:"font-medium text-text-main",children:s})," results"]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 sm:gap-4",children:[l&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"Rows:"}),(0,a.jsx)(m.A,{value:t,onChange:e=>l(Number(e)),options:[10,20,50].map(e=>({value:e,label:String(e)})),buttonClassName:"h-9 min-w-[70px] py-1"})]}),r>1&&(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(d.default,{variant:"outline",size:"sm",onClick:()=>n(e-1),disabled:1===e,className:"w-9 px-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"})}),u[0]>1&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.default,{variant:"ghost",size:"sm",onClick:()=>n(1),className:"w-9 px-0 hidden sm:inline-flex",children:"1"}),u[0]>2&&(0,a.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."})]}),u.map(t=>(0,a.jsx)(d.default,{variant:e===t?"primary":"ghost",size:"sm",onClick:()=>n(t),className:(0,x.cn)("w-9 px-0",e===t?"inline-flex":"hidden sm:inline-flex"),children:t},t)),u[u.length-1]<r&&(0,a.jsxs)(a.Fragment,{children:[u[u.length-1]<r-1&&(0,a.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."}),(0,a.jsx)(d.default,{variant:"ghost",size:"sm",onClick:()=>n(r),className:"w-9 px-0 hidden sm:inline-flex",children:r})]}),(0,a.jsx)(d.default,{variant:"outline",size:"sm",onClick:()=>n(e+1),disabled:e===r,className:"w-9 px-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_right"})})]})]})]})}var u=s(88105);let h=null,f=null;async function j(){if(h&&f)return{providerNameCache:h,providerNodesCache:f};let e=await fetch("/api/provider-nodes"),t=(await e.json()).nodes||[];for(let e of(f={},t))f[e.id]=e.name;return{providerNameCache:h={...u.Q2,...f},providerNodesCache:f}}function g(e,t){if(!e||!t)return e;let s=t[e];if("string"==typeof s)return s;if(s?.name)return s.name;let a=(0,u.zt)(e)||u.Q2[e];return a?.name||e}function b({title:e,children:t,defaultOpen:s=!1,icon:l=null}){let[i,r]=(0,n.useState)(s);return(0,a.jsxs)("div",{className:"border border-border-subtle rounded-lg overflow-hidden",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>r(!i),className:"w-full flex items-center justify-between p-3 bg-bg-subtle/60 hover:bg-bg-subtle transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[l&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary dark:text-primary",children:l}),(0,a.jsx)("span",{className:"font-semibold text-sm text-text-main",children:e})]}),(0,a.jsx)("span",{className:(0,x.cn)("material-symbols-outlined text-[20px] text-text-muted transition-transform duration-200",i?"rotate-90":""),children:"chevron_right"})]}),i&&(0,a.jsx)("div",{className:"p-4 border-t border-border-subtle",children:t})]})}function v(e){return e?.cached_tokens||e?.cache_read_input_tokens||0}function N(e){return e?.cache_creation_input_tokens||0}function w(e){let t=e?.prompt_tokens||e?.input_tokens||0,s=v(e);return t<s?s:t}function y(){let[e,t]=(0,n.useState)([]),[s,l]=(0,n.useState)({page:1,pageSize:20,totalItems:0,totalPages:0}),[i,r]=(0,n.useState)(!1),[u,h]=(0,n.useState)(null),[f,y]=(0,n.useState)(!1),[k,S]=(0,n.useState)([]),[C,D]=(0,n.useState)(null),[_,P]=(0,n.useState)({provider:"",startDate:"",endDate:""}),z=(0,n.useCallback)(async()=>{try{let e=await fetch("/api/usage/providers"),t=await e.json();S(t.providers||[]);let s=await j();D(s.providerNameCache)}catch(e){console.error("Failed to fetch providers:",e)}},[]),L=(0,n.useCallback)(async()=>{r(!0);try{let e=new URLSearchParams({page:s.page.toString(),pageSize:s.pageSize.toString()});_.provider&&e.append("provider",_.provider),_.startDate&&e.append("startDate",_.startDate),_.endDate&&e.append("endDate",_.endDate);let a=await fetch(`/api/usage/request-details?${e}`),n=await a.json();t(n.details||[]),l(e=>({...e,...n.pagination}))}catch(e){console.error("Failed to fetch request details:",e)}finally{r(!1)}},[s.page,s.pageSize,_]);return(0,n.useEffect)(()=>{z()},[z]),(0,n.useEffect)(()=>{L()},[L]),(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[(0,a.jsx)(o.default,{padding:"md",children:(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-text-main",children:"Provider"}),(0,a.jsx)(m.A,{value:_.provider,onChange:e=>P({..._,provider:e}),options:[{value:"",label:"All Providers"},...k.map(e=>({value:e.id,label:e.name}))],buttonClassName:(0,x.cn)("h-9 px-3 rounded-lg","text-sm text-text-main w-full min-w-0"),className:"w-full min-w-0"})]}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,a.jsx)("label",{htmlFor:"start-date-filter",className:"text-sm font-medium text-text-main",children:"Start Date"}),(0,a.jsx)("input",{id:"start-date-filter",type:"datetime-local",value:_.startDate,onChange:e=>P({..._,startDate:e.target.value}),className:(0,x.cn)("h-9 px-3 rounded-lg border border-border bg-surface","w-full min-w-0 text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20")})]}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,a.jsx)("label",{htmlFor:"end-date-filter",className:"text-sm font-medium text-text-main",children:"End Date"}),(0,a.jsx)("input",{id:"end-date-filter",type:"datetime-local",value:_.endDate,onChange:e=>P({..._,endDate:e.target.value}),className:(0,x.cn)("h-9 px-3 rounded-lg border border-border bg-surface","w-full min-w-0 text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20")})]}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-2 sm:col-span-2 lg:col-span-1",children:[(0,a.jsx)("span",{className:"hidden text-sm font-medium text-text-main opacity-0 lg:block","aria-hidden":"true",children:"Clear"}),(0,a.jsx)(d.default,{variant:"ghost",onClick:()=>{P({provider:"",startDate:"",endDate:""})},disabled:!_.provider&&!_.startDate&&!_.endDate,className:"w-full",children:"Clear Filters"})]})]})}),(0,a.jsxs)(o.default,{padding:"none",children:[(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full min-w-[880px]",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-border-subtle",children:[(0,a.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Timestamp"}),(0,a.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Model"}),(0,a.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Provider"}),(0,a.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Input Tokens"}),(0,a.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Cached"}),(0,a.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Cache Creation"}),(0,a.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Output Tokens"}),(0,a.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Latency"}),(0,a.jsx)("th",{className:"text-center p-4 text-sm font-semibold text-text-main",children:"Action"})]})}),(0,a.jsx)("tbody",{children:i?(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:"7",className:"p-8 text-center text-text-muted",children:(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px]",children:"progress_activity"}),"Loading..."]})})}):0===e.length?(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:"7",className:"p-8 text-center text-text-muted",children:"No request details found"})}):e.map((e,t)=>(0,a.jsxs)("tr",{className:"border-b border-border-subtle last:border-b-0 hover:bg-surface-2/50 transition-colors",children:[(0,a.jsx)("td",{className:"whitespace-nowrap p-4 text-sm text-text-main",children:new Date(e.timestamp).toLocaleString()}),(0,a.jsx)("td",{className:"max-w-[260px] truncate p-4 font-mono text-sm text-text-main",children:e.model}),(0,a.jsx)("td",{className:"max-w-[180px] truncate p-4 text-sm text-text-main",children:(0,a.jsx)("span",{className:"font-medium",children:g(e.provider,C)})}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:w(e.tokens).toLocaleString()}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:v(e.tokens)>0?v(e.tokens).toLocaleString():"-"}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:N(e.tokens)>0?N(e.tokens).toLocaleString():"-"}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:e.tokens?.completion_tokens?.toLocaleString()||0}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-muted",children:(0,a.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,a.jsxs)("div",{children:["TTFT: ",(0,a.jsxs)("span",{className:"font-mono",children:[e.latency?.ttft||0,"ms"]})]}),(0,a.jsxs)("div",{children:["Total: ",(0,a.jsxs)("span",{className:"font-mono",children:[e.latency?.total||0,"ms"]})]})]})}),(0,a.jsx)("td",{className:"p-4 text-center",children:(0,a.jsx)(d.default,{variant:"outline",size:"sm",onClick:()=>{h(e),y(!0)},children:"Detail"})})]},`${e.id}-${t}`))})]})}),!i&&e.length>0&&(0,a.jsx)("div",{className:"border-t border-border-subtle",children:(0,a.jsx)(p,{currentPage:s.page,pageSize:s.pageSize,totalItems:s.totalItems,onPageChange:e=>{l(t=>({...t,page:e}))},onPageSizeChange:e=>{l(t=>({...t,pageSize:e,page:1}))}})})]}),(0,a.jsx)(c,{isOpen:f,onClose:()=>y(!1),title:"Request Details",width:"lg",children:u&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"grid min-w-0 grid-cols-1 gap-4 text-sm sm:grid-cols-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"ID:"})," ",(0,a.jsx)("span",{className:"break-all font-mono text-text-main",children:u.id})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Timestamp:"})," ",(0,a.jsx)("span",{className:"text-text-main",children:new Date(u.timestamp).toLocaleString()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Provider:"})," ",(0,a.jsx)("span",{className:"text-text-main font-medium",children:g(u.provider,C)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Model:"})," ",(0,a.jsx)("span",{className:"text-text-main font-mono",children:u.model})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Status:"})," ",(0,a.jsx)("span",{className:(0,x.cn)("font-medium","success"===u.status?"text-success":"text-danger"),children:u.status})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Latency:"})," ",(0,a.jsxs)("span",{className:"text-text-main font-mono",children:["TTFT ",u.latency?.ttft||0,"ms / Total ",u.latency?.total||0,"ms"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Input Tokens:"})," ",(0,a.jsx)("span",{className:"text-text-main font-mono",children:w(u.tokens).toLocaleString()})]}),v(u.tokens)>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Cached Tokens:"})," ",(0,a.jsx)("span",{className:"text-text-main font-mono",children:v(u.tokens).toLocaleString()})]}),N(u.tokens)>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Cache Creation:"})," ",(0,a.jsx)("span",{className:"text-text-main font-mono",children:N(u.tokens).toLocaleString()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Output Tokens:"})," ",(0,a.jsx)("span",{className:"text-text-main font-mono",children:u.tokens?.completion_tokens?.toLocaleString()||0})]})]}),u.pxpipe&&(0,a.jsxs)("div",{className:"rounded-lg border border-border-subtle p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary dark:text-primary",children:"image"}),(0,a.jsx)("span",{className:"font-semibold text-sm text-text-main",children:"PXPIPE"}),(0,a.jsx)("span",{className:(0,x.cn)("text-xs px-2 py-0.5 rounded",u.pxpipe.applied?"bg-success/15 text-success":"bg-warning/15 text-warning"),children:u.pxpipe.applied?"Activated":"Skipped"})]}),u.pxpipe.applied?(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-sm sm:grid-cols-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted block text-xs",children:"Original (est.)"}),(0,a.jsxs)("span",{className:"font-mono",children:[(u.pxpipe.tokensBeforeEst||0).toLocaleString()," tokens"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted block text-xs",children:"Compressed (est.)"}),(0,a.jsxs)("span",{className:"font-mono",children:[(u.pxpipe.tokensAfterEst||0).toLocaleString()," tokens"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted block text-xs",children:"Saved"}),(0,a.jsxs)("span",{className:"font-mono text-success",children:[u.pxpipe.savedPct||0,"%"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted block text-xs",children:"Images"}),(0,a.jsxs)("span",{className:"font-mono",children:[u.pxpipe.imageCount||0," (",u.pxpipe.durationMs||0,"ms)"]})]})]}):(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Reason: ",(0,a.jsx)("span",{className:"font-mono",children:u.pxpipe.reason}),u.pxpipe.detail?` - ${u.pxpipe.detail}`:""]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(b,{title:"1. Client Request (Input)",defaultOpen:!0,icon:"input",children:(0,a.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-border-subtle bg-bg-subtle p-3 font-mono text-xs text-text-main sm:p-4",children:JSON.stringify(u.request,null,2)})}),u.providerRequest&&(0,a.jsx)(b,{title:"2. Provider Request (Translated)",icon:"translate",children:(0,a.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-border-subtle bg-bg-subtle p-3 font-mono text-xs text-text-main sm:p-4",children:JSON.stringify(u.providerRequest,null,2)})}),u.providerResponse&&(0,a.jsx)(b,{title:"3. Provider Response (Raw)",icon:"data_object",children:(0,a.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-border-subtle bg-bg-subtle p-3 font-mono text-xs text-text-main sm:p-4",children:"object"==typeof u.providerResponse?JSON.stringify(u.providerResponse,null,2):u.providerResponse})}),(0,a.jsxs)(b,{title:"4. Client Response (Final)",defaultOpen:!0,icon:"output",children:[u.response?.thinking&&(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("h4",{className:"font-semibold text-text-main mb-2 flex items-center gap-2 text-xs uppercase tracking-wide opacity-70",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary dark:text-primary",children:"psychology"}),"Thinking Process"]}),(0,a.jsx)("pre",{className:"max-h-[200px] max-w-full overflow-auto rounded-lg border border-warning/40 bg-warning/10 p-3 font-mono text-xs text-warning sm:p-4",children:u.response.thinking})]}),(0,a.jsx)("h4",{className:"font-semibold text-text-main mb-2 text-xs uppercase tracking-wide opacity-70",children:"Content"}),(0,a.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-border-subtle bg-bg-subtle p-3 font-mono text-xs text-text-main sm:p-4",children:u.response?.content||"[No content]"})]})]})]})})]})}let k=[{value:"today",label:"Today"},{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"},{value:"all",label:"All"}];function S(){return(0,a.jsx)(n.Suspense,{fallback:(0,a.jsx)(i.Qv,{}),children:(0,a.jsx)(C,{})})}function C(){let e=(0,l.useSearchParams)(),t=(0,l.useRouter)(),[s,o]=(0,n.useState)("today"),d=e.get("tab"),x=d&&["overview","logs","details"].includes(d)?d:"overview";return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-main",children:"Usage"}),(0,a.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"Usage across every provider connection - real-time requests, tokens, and estimated cost."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)(i.Iz,{options:[{value:"overview",label:"Overview",icon:"monitoring"},{value:"details",label:"Details",icon:"table_rows"}],value:x,onChange:s=>{if(s===x)return;let a=new URLSearchParams(e);a.set("tab",s),t.push(`/dashboard/usage?${a.toString()}`,{scroll:!1})},className:"w-full sm:w-auto"}),"overview"===x&&(0,a.jsx)(i.Iz,{options:k,value:s,onChange:o,size:"sm",wrap:!0,className:"w-full sm:w-auto sm:justify-end"})]}),"overview"===x&&(0,a.jsx)(n.Suspense,{fallback:(0,a.jsx)(i.Qv,{}),children:(0,a.jsx)(r.default,{period:s,setPeriod:o,hidePeriodSelector:!0})}),"logs"===x&&(0,a.jsx)(i.gM,{}),"details"===x&&(0,a.jsx)(y,{})]})}}},e=>{e.O(0,[763,2470,705,3557,5497,6808,8441,3794,7358],()=>e(e.s=16797)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9305],{92663:(e,s,n)=>{Promise.resolve().then(n.bind(n,96748)),Promise.resolve().then(n.bind(n,56319)),Promise.resolve().then(n.bind(n,56061)),Promise.resolve().then(n.bind(n,92542)),Promise.resolve().then(n.bind(n,29366)),Promise.resolve().then(n.bind(n,84588)),Promise.resolve().then(n.bind(n,40197)),Promise.resolve().then(n.bind(n,9911)),Promise.resolve().then(n.bind(n,45455)),Promise.resolve().then(n.bind(n,30815)),Promise.resolve().then(n.bind(n,73579)),Promise.resolve().then(n.bind(n,92173)),Promise.resolve().then(n.bind(n,95088)),Promise.resolve().then(n.bind(n,8823)),Promise.resolve().then(n.bind(n,80752)),Promise.resolve().then(n.bind(n,23936)),Promise.resolve().then(n.bind(n,11910)),Promise.resolve().then(n.bind(n,61500)),Promise.resolve().then(n.bind(n,62899)),Promise.resolve().then(n.bind(n,94230)),Promise.resolve().then(n.bind(n,21931)),Promise.resolve().then(n.bind(n,91450)),Promise.resolve().then(n.bind(n,30233)),Promise.resolve().then(n.bind(n,25086)),Promise.resolve().then(n.bind(n,28815)),Promise.resolve().then(n.bind(n,28058)),Promise.resolve().then(n.bind(n,81127)),Promise.resolve().then(n.bind(n,28011)),Promise.resolve().then(n.bind(n,4823)),Promise.resolve().then(n.bind(n,90882)),Promise.resolve().then(n.bind(n,51825)),Promise.resolve().then(n.bind(n,23615)),Promise.resolve().then(n.bind(n,28067)),Promise.resolve().then(n.bind(n,98)),Promise.resolve().then(n.bind(n,92622)),Promise.resolve().then(n.bind(n,48366)),Promise.resolve().then(n.bind(n,21110)),Promise.resolve().then(n.bind(n,38587)),Promise.resolve().then(n.bind(n,98542)),Promise.resolve().then(n.bind(n,97677)),Promise.resolve().then(n.bind(n,38267)),Promise.resolve().then(n.bind(n,40684)),Promise.resolve().then(n.bind(n,30312))}},e=>{e.O(0,[763,2470,705,3557,5497,8441,3794,7358],()=>e(e.s=92663)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7370],{64506:(e,t,s)=>{Promise.resolve().then(s.bind(s,64533))},64533:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>d});var r=s(95155),a=s(12115),i=s(73321),n=s(84588),l=s(62630);function c({isOpen:e,onClose:t,onSave:s}){let[i,n]=(0,a.useState)({}),[d,o]=(0,a.useState)(!0),[x,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{e&&u()},[e]);let u=async()=>{o(!0);try{let e=await fetch("/api/pricing");if(e.ok){let t=await e.json();n(t)}else{let e=(0,l.ad)();n(e)}}catch(t){console.error("Failed to load pricing:",t);let e=(0,l.ad)();n(e)}finally{o(!1)}},h=async()=>{m(!0);try{let e=await fetch("/api/pricing",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(e.ok)s?.(),t();else{let t=await e.json();alert(`Failed to save pricing: ${t.error}`)}}catch(e){console.error("Failed to save pricing:",e),alert("Failed to save pricing")}finally{m(!1)}},p=async()=>{if(confirm("Reset all pricing to defaults? This cannot be undone."))try{if((await fetch("/api/pricing",{method:"DELETE"})).ok){let e=(0,l.ad)();n(e)}}catch(e){console.error("Failed to reset pricing:",e),alert("Failed to reset pricing")}};if(!e)return null;let b=Object.keys(i).sort(),j=["input","output","cached","reasoning","cache_creation"];return(0,r.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:(0,r.jsxs)("div",{className:"bg-bg-base border border-border rounded-lg shadow-xl max-w-6xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[(0,r.jsxs)("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"Pricing Configuration"}),(0,r.jsx)("button",{onClick:t,className:"text-text-muted hover:text-text text-2xl leading-none",children:"\xd7"})]}),(0,r.jsx)("div",{className:"flex-1 overflow-auto p-4",children:d?(0,r.jsx)("div",{className:"text-center py-8 text-text-muted",children:"Loading pricing data..."}):(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"bg-bg-subtle border border-border rounded-lg p-3 text-sm",children:[(0,r.jsx)("p",{className:"font-medium mb-1",children:"Pricing Rates Format"}),(0,r.jsxs)("p",{className:"text-text-muted",children:["All rates are in ",(0,r.jsx)("strong",{children:"dollars per million tokens"})," ($/1M tokens). Example: Input rate of 2.50 means $2.50 per 1,000,000 input tokens."]})]}),b.map(e=>{let t=Object.keys(i[e]).sort();return(0,r.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,r.jsx)("div",{className:"bg-bg-subtle px-4 py-2 font-semibold text-sm",children:e.toUpperCase()}),(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full text-sm",children:[(0,r.jsx)("thead",{className:"bg-bg-hover text-text-muted uppercase text-xs",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"px-3 py-2 text-left",children:"Model"}),(0,r.jsx)("th",{className:"px-3 py-2 text-right",children:"Input"}),(0,r.jsx)("th",{className:"px-3 py-2 text-right",children:"Output"}),(0,r.jsx)("th",{className:"px-3 py-2 text-right",children:"Cached"}),(0,r.jsx)("th",{className:"px-3 py-2 text-right",children:"Reasoning"}),(0,r.jsx)("th",{className:"px-3 py-2 text-right",children:"Cache Creation"})]})}),(0,r.jsx)("tbody",{className:"divide-y divide-border",children:t.map(t=>(0,r.jsxs)("tr",{className:"hover:bg-bg-subtle/50",children:[(0,r.jsx)("td",{className:"px-3 py-2 font-medium",children:t}),j.map(s=>(0,r.jsx)("td",{className:"px-3 py-2",children:(0,r.jsx)("input",{type:"number",step:"0.01",min:"0",value:i[e][t][s]||0,onChange:r=>{let a;!isNaN(a=parseFloat(r.target.value))&&!(a<0)&&n(r=>{let i={...r};return i[e]||(i[e]={}),i[e][t]||(i[e][t]={}),i[e][t][s]=a,i})},className:"w-20 px-2 py-1 text-right bg-bg-base border border-border rounded focus:outline-none focus:border-primary"})},s))]},t))})]})})]},e)}),0===b.length&&(0,r.jsx)("div",{className:"text-center py-8 text-text-muted",children:"No pricing data available"})]})}),(0,r.jsxs)("div",{className:"p-4 border-t border-border flex items-center justify-between gap-2",children:[(0,r.jsx)("button",{onClick:p,className:"px-4 py-2 text-sm text-red-500 hover:bg-red-500/10 rounded border border-red-500/20 transition-colors",disabled:x,children:"Reset to Defaults"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{onClick:t,className:"px-4 py-2 text-sm text-text-muted hover:text-text border border-border rounded transition-colors",disabled:x,children:"Cancel"}),(0,r.jsx)("button",{onClick:h,className:"px-4 py-2 text-sm bg-primary text-white dark:text-amber-950 rounded hover:bg-primary/90 transition-colors disabled:opacity-50",disabled:x,children:x?"Saving...":"Save Changes"})]})]})]})})}function d(){(0,i.useRouter)();let[e,t]=(0,a.useState)(!1),[s,l]=(0,a.useState)(null),[d,o]=(0,a.useState)(!0);(0,a.useEffect)(()=>{x()},[]);let x=async()=>{o(!0);try{let e=await fetch("/api/pricing");if(e.ok){let t=await e.json();l(t)}}catch(e){console.error("Failed to load pricing:",e)}finally{o(!1)}};return(0,r.jsxs)("div",{className:"max-w-6xl mx-auto p-6 space-y-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-3xl font-bold",children:"Pricing Settings"}),(0,r.jsx)("p",{className:"text-text-muted mt-1",children:"Configure pricing rates for cost tracking and calculations"})]}),(0,r.jsx)("button",{onClick:()=>t(!0),className:"px-4 py-2 bg-primary text-white dark:text-amber-950 rounded hover:bg-primary/90 transition-colors",children:"Edit Pricing"})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,r.jsxs)(n.default,{className:"p-4",children:[(0,r.jsx)("div",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Models"}),(0,r.jsx)("div",{className:"text-2xl font-bold mt-1",children:d?"...":(()=>{if(!s)return 0;let e=0;for(let t in s)e+=Object.keys(s[t]).length;return e})()})]}),(0,r.jsxs)(n.default,{className:"p-4",children:[(0,r.jsx)("div",{className:"text-text-muted text-sm uppercase font-semibold",children:"Providers"}),(0,r.jsx)("div",{className:"text-2xl font-bold mt-1",children:d?"...":(!s?[]:Object.keys(s).sort()).length})]}),(0,r.jsxs)(n.default,{className:"p-4",children:[(0,r.jsx)("div",{className:"text-text-muted text-sm uppercase font-semibold",children:"Status"}),(0,r.jsx)("div",{className:"text-2xl font-bold mt-1 text-success",children:d?"...":"Active"})]})]}),(0,r.jsxs)(n.default,{className:"p-6",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold mb-4",children:"How Pricing Works"}),(0,r.jsxs)("div",{className:"space-y-3 text-sm text-text-muted",children:[(0,r.jsxs)("p",{children:[(0,r.jsx)("strong",{children:"Cost Calculation:"})," Costs are calculated based on token usage and pricing rates. Each request's cost is determined by: (input_tokens \xd7 input_rate) + (output_tokens \xd7 output_rate) + (cached_tokens \xd7 cached_rate)"]}),(0,r.jsxs)("p",{children:[(0,r.jsx)("strong",{children:"Pricing Format:"})," All rates are in ",(0,r.jsx)("strong",{children:"dollars per million tokens"})," ($/1M tokens). Example: An input rate of 2.50 means $2.50 per 1,000,000 input tokens."]}),(0,r.jsx)("p",{children:(0,r.jsx)("strong",{children:"Token Types:"})}),(0,r.jsxs)("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Input:"})," Standard prompt tokens"]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Output:"})," Completion/response tokens"]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Cached:"})," Cached input tokens (typically 50% of input rate)"]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Reasoning:"})," Special reasoning/thinking tokens (fallback to output rate)"]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Cache Creation:"})," Tokens used to create cache entries (fallback to input rate)"]})]}),(0,r.jsxs)("p",{children:[(0,r.jsx)("strong",{children:"Custom Pricing:"})," You can override default pricing for specific models. Reset to defaults anytime to restore standard rates."]})]})]}),(0,r.jsxs)(n.default,{className:"p-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"Current Pricing Overview"}),(0,r.jsx)("button",{onClick:()=>t(!0),className:"text-primary hover:underline text-sm",children:"View Full Details"})]}),d?(0,r.jsx)("div",{className:"text-center py-4 text-text-muted",children:"Loading pricing data..."}):s?(0,r.jsxs)("div",{className:"space-y-3",children:[Object.keys(s).slice(0,5).map(e=>(0,r.jsxs)("div",{className:"text-sm",children:[(0,r.jsxs)("span",{className:"font-semibold",children:[e.toUpperCase(),":"]})," ",(0,r.jsxs)("span",{className:"text-text-muted",children:[Object.keys(s[e]).length," models"]})]},e)),Object.keys(s).length>5&&(0,r.jsxs)("div",{className:"text-sm text-text-muted",children:["+ ",Object.keys(s).length-5," more providers"]})]}):(0,r.jsx)("div",{className:"text-text-muted",children:"No pricing data available"})]}),e&&(0,r.jsx)(c,{isOpen:e,onClose:()=>t(!1),onSave:()=>{x()}})]})}},73321:(e,t,s)=>{"use strict";var r=s(74645);s.o(r,"notFound")&&s.d(t,{notFound:function(){return r.notFound}}),s.o(r,"useParams")&&s.d(t,{useParams:function(){return r.useParams}}),s.o(r,"usePathname")&&s.d(t,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}})}},e=>{e.O(0,[705,8441,3794,7358],()=>e(e.s=64506)),_N_E=e.O()}]);